annotate src/device-gtk.c @ 3094:ad2f4ae9895b

[xemacs-hg @ 2005-11-26 11:45:47 by stephent] Xft merge. <87k6ev4p8q.fsf@tleepslib.sk.tsukuba.ac.jp>
author stephent
date Sat, 26 Nov 2005 11:46:25 +0000
parents 141c2920ea48
children 229bd619740a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1 /* Device functions for X windows.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
2 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
3 Copyright (C) 1994, 1995 Free Software Foundation, Inc.
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 863
diff changeset
4 Copyright (C) 2002 Ben Wing.
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
5
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
6 This file is part of XEmacs.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
7
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
8 XEmacs is free software; you can redistribute it and/or modify it
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
9 under the terms of the GNU General Public License as published by the
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
10 Free Software Foundation; either version 2, or (at your option) any
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
11 later version.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
12
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
13 XEmacs is distributed in the hope that it will be useful, but WITHOUT
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
16 for more details.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
17
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
18 You should have received a copy of the GNU General Public License
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
19 along with XEmacs; see the file COPYING. If not, write to
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
21 Boston, MA 02111-1307, USA. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
22
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
23 /* Synched up with: Not in FSF. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
24
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
25 /* Original authors: Jamie Zawinski and the FSF */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
26 /* Rewritten by Ben Wing and Chuck Thompson. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
27 /* Gtk flavor written by William Perry */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
28
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
29 #include <config.h>
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
30 #include "lisp.h"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
31
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 863
diff changeset
32 #include "buffer.h"
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 863
diff changeset
33 #include "device-impl.h"
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 863
diff changeset
34 #include "elhash.h"
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 863
diff changeset
35 #include "events.h"
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 863
diff changeset
36 #include "faces.h"
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 863
diff changeset
37 #include "frame-impl.h"
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 863
diff changeset
38 #include "redisplay.h"
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 863
diff changeset
39 #include "sysdep.h"
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 863
diff changeset
40 #include "window.h"
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 863
diff changeset
41
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 863
diff changeset
42 #include "console-gtk-impl.h"
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
43 #include "gccache-gtk.h"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
44 #include "glyphs-gtk.h"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
45 #include "objects-gtk.h"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
46 #include "gtk-xemacs.h"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
47
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
48 #include "sysfile.h"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
49 #include "systime.h"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
50
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
51 #ifdef HAVE_GNOME
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
52 #include <libgnomeui/libgnomeui.h>
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
53 #endif
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
54
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
55 #ifdef HAVE_BONOBO
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
56 #include <bonobo.h>
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
57 #endif
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
58
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
59 /* Qdisplay in general.c */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
60 Lisp_Object Qinit_pre_gtk_win, Qinit_post_gtk_win;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
61
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
62 /* The application class of Emacs. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
63 Lisp_Object Vgtk_emacs_application_class;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
64
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
65 Lisp_Object Vgtk_initial_argv_list; /* #### ugh! */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
66 Lisp_Object Vgtk_initial_geometry;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
67
2828
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
68 Lisp_Object Qgtk_seen_characters;
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
69
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
70 static void gtk_device_init_x_specific_cruft (struct device *d);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
71
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 872
diff changeset
72 static const struct memory_description gtk_device_data_description_1 [] = {
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 872
diff changeset
73 { XD_LISP_OBJECT, offsetof (struct gtk_device, x_keysym_map_hashtable) },
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 872
diff changeset
74 { XD_LISP_OBJECT, offsetof (struct gtk_device, WM_COMMAND_frame) },
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 872
diff changeset
75 { XD_END }
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 872
diff changeset
76 };
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 872
diff changeset
77
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2828
diff changeset
78 #ifdef NEW_GC
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2828
diff changeset
79 DEFINE_LRECORD_IMPLEMENTATION ("gtk-device", gtk_device,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2828
diff changeset
80 1, /*dumpable-flag*/
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2828
diff changeset
81 0, 0, 0, 0, 0,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2828
diff changeset
82 gtk_device_data_description_1,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2828
diff changeset
83 Lisp_Gtk_Device);
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2828
diff changeset
84 #else /* not NEW_GC */
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 872
diff changeset
85 extern const struct sized_memory_description gtk_device_data_description;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 872
diff changeset
86
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 872
diff changeset
87 const struct sized_memory_description gtk_device_data_description = {
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 872
diff changeset
88 sizeof (struct gtk_device), gtk_device_data_description_1
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 872
diff changeset
89 };
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2828
diff changeset
90 #endif /* not NEW_GC */
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 872
diff changeset
91
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
92
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
93 /************************************************************************/
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
94 /* helper functions */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
95 /************************************************************************/
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
96
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
97 struct device *
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
98 decode_gtk_device (Lisp_Object device)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
99 {
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 778
diff changeset
100 device = wrap_device (decode_device (device));
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
101 CHECK_GTK_DEVICE (device);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
102 return XDEVICE (device);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
103 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
104
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
105
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
106 /************************************************************************/
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
107 /* initializing a GTK connection */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
108 /************************************************************************/
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
109 extern Lisp_Object
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
110 xemacs_gtk_convert_color(GdkColor *c, GtkWidget *w);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
111
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
112 extern Lisp_Object __get_gtk_font_truename (GdkFont *gdk_font, int expandp);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
113
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
114 #define convert_font(f) __get_gtk_font_truename (f, 0)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
115
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
116 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
117 allocate_gtk_device_struct (struct device *d)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
118 {
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2828
diff changeset
119 #ifdef NEW_GC
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2828
diff changeset
120 d->device_data = alloc_lrecord_type (struct gtk_device, &lrecord_gtk_device);
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2828
diff changeset
121 #else /* not NEW_GC */
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
122 d->device_data = xnew_and_zero (struct gtk_device);
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2828
diff changeset
123 #endif /* not NEW_GC */
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
124 DEVICE_GTK_DATA (d)->x_keysym_map_hashtable = Qnil;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
125 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
126
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
127 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
128 gtk_init_device_class (struct device *d)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
129 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
130 if (DEVICE_GTK_DEPTH(d) > 2)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
131 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
132 switch (DEVICE_GTK_VISUAL(d)->type)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
133 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
134 case GDK_VISUAL_STATIC_GRAY:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
135 case GDK_VISUAL_GRAYSCALE:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
136 DEVICE_CLASS (d) = Qgrayscale;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
137 break;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
138 default:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
139 DEVICE_CLASS (d) = Qcolor;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
140 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
141 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
142 else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
143 DEVICE_CLASS (d) = Qmono;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
144 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
145
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
146 #ifdef HAVE_GDK_IMLIB_INIT
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
147 extern void gdk_imlib_init(void);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
148 #endif
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
149
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 809
diff changeset
150 extern void emacs_gtk_selection_handle (GtkWidget *,
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 809
diff changeset
151 GtkSelectionData *selection_data,
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 809
diff changeset
152 guint info,
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 809
diff changeset
153 guint time_stamp,
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 809
diff changeset
154 gpointer data);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 809
diff changeset
155 extern void emacs_gtk_selection_clear_event_handle (GtkWidget *widget,
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 809
diff changeset
156 GdkEventSelection *event,
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 809
diff changeset
157 gpointer data);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 809
diff changeset
158 extern void emacs_gtk_selection_received (GtkWidget *widget,
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 809
diff changeset
159 GtkSelectionData *selection_data,
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 809
diff changeset
160 gpointer user_data);
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 809
diff changeset
161
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
162 #ifdef HAVE_BONOBO
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
163 static CORBA_ORB orb;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
164 #endif
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
165
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
166 DEFUN ("gtk-init", Fgtk_init, 1, 1, 0, /*
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
167 Initialize the GTK subsystem.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
168 ARGS is a standard list of command-line arguments.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
169
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
170 No effect if called more than once. Called automatically when
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
171 creating the first GTK device. Must be called manually from batch
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
172 mode.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
173 */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
174 (args))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
175 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
176 int argc;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
177 char **argv;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
178 static int done;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
179
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
180 if (done)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
181 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
182 return (Qt);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
183 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
184
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
185 make_argc_argv (args, &argc, &argv);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
186
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
187 slow_down_interrupts ();
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
188 #ifdef HAVE_GNOME
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
189 #ifdef INFODOCK
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
190 gnome_init ("InfoDock", EMACS_VERSION, argc, argv);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
191 #else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
192 gnome_init ("XEmacs", EMACS_VERSION, argc, argv);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
193 #endif /* INFODOCK */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
194 #else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
195 gtk_init (&argc, &argv);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
196 #endif
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
197
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
198 #ifdef HAVE_BONOBO
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
199 orb = oaf_init (argc, argv);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
200
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
201 if (bonobo_init (orb, NULL, NULL) == FALSE)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
202 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
203 g_warning ("Could not initialize bonobo...");
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
204 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
205
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
206 bonobo_activate ();
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
207 #endif
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
208
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
209 speed_up_interrupts ();
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
210
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
211 free_argc_argv (argv);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
212 return (Qt);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
213 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
214
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
215 static void
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2054
diff changeset
216 gtk_init_device (struct device *d, Lisp_Object UNUSED (props))
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
217 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
218 Lisp_Object display;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
219 GtkWidget *app_shell = NULL;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
220 GdkVisual *visual = NULL;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
221 GdkColormap *cmap = NULL;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
222
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
223 /* gtk_init() and even gtk_check_init() are so brain dead that
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
224 getting an empty argv array causes them to abort. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
225 if (NILP (Vgtk_initial_argv_list))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
226 {
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 545
diff changeset
227 invalid_operation ("gtk-initial-argv-list must be set before creating Gtk devices", Vgtk_initial_argv_list);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
228 return;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
229 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
230
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
231 allocate_gtk_device_struct (d);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
232 display = DEVICE_CONNECTION (d);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
233
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
234 /* Attempt to load a site-specific gtkrc */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
235 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
236 Lisp_Object gtkrc = Fexpand_file_name (build_string ("gtkrc"), Vdata_directory);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
237 gchar **default_files = gtk_rc_get_default_files ();
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
238 gint num_files;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
239
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
240 if (STRINGP (gtkrc))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
241 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
242 /* Found one, load it up! */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
243 gchar **new_rc_files = NULL;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
244 int ctr;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
245
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
246 for (num_files = 0; default_files[num_files]; num_files++);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
247
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
248 new_rc_files = xnew_array_and_zero (gchar *, num_files + 3);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
249
2054
91d4c8c65a0f [xemacs-hg @ 2004-05-02 04:06:51 by malcolmp]
malcolmp
parents: 1726
diff changeset
250 LISP_STRING_TO_EXTERNAL (gtkrc, new_rc_files[0], Qfile_name);
91d4c8c65a0f [xemacs-hg @ 2004-05-02 04:06:51 by malcolmp]
malcolmp
parents: 1726
diff changeset
251
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
252 for (ctr = 1; default_files[ctr-1]; ctr++)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
253 new_rc_files[ctr] = g_strdup (default_files[ctr-1]);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
254
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
255 gtk_rc_set_default_files (new_rc_files);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
256
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
257 for (ctr = 1; new_rc_files[ctr]; ctr++)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
258 free(new_rc_files[ctr]);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
259
1726
a8d8f419b459 [xemacs-hg @ 2003-09-30 15:26:34 by james]
james
parents: 1204
diff changeset
260 xfree (new_rc_files, gchar **);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
261 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
262 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
263
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
264 Fgtk_init (Vgtk_initial_argv_list);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
265
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
266 #ifdef __FreeBSD__
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
267 gdk_set_use_xshm (FALSE);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
268 #endif
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
269
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
270 /* We attempt to load this file so that the user can set
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
271 ** gtk-initial-geometry and not need GNOME & session management to
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
272 ** set their default frame size. It also avoids the flicker
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
273 ** associated with setting the frame size in your .emacs file.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
274 */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
275 call4 (Qload, build_string ("~/.xemacs/gtk-options.el"), Qt, Qt, Qt);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
276
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
277 #ifdef HAVE_GDK_IMLIB_INIT
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
278 /* Some themes in Gtk are so lame (most notably the Pixmap theme)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
279 that they rely on gdk_imlib, but don't call its initialization
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
280 routines. This makes them USELESS for non-gnome applications.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
281 So we bend over backwards to try and make them work. Losers. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
282 gdk_imlib_init ();
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
283 #endif
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
284
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
285 if (NILP (DEVICE_NAME (d)))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
286 DEVICE_NAME (d) = display;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
287
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
288 /* Always search for the best visual */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
289 visual = gdk_visual_get_best();
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
290 cmap = gdk_colormap_new (visual, TRUE);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
291
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
292 DEVICE_GTK_VISUAL (d) = visual;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
293 DEVICE_GTK_COLORMAP (d) = cmap;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
294 DEVICE_GTK_DEPTH (d) = visual->depth;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
295
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
296 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
297 GtkWidget *w = gtk_window_new (GTK_WINDOW_TOPLEVEL);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
298
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
299 app_shell = gtk_xemacs_new (NULL);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
300 gtk_container_add (GTK_CONTAINER (w), app_shell);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
301
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
302 gtk_widget_realize (w);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
303 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
304
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
305 DEVICE_GTK_APP_SHELL (d) = app_shell;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
306
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
307 /* Realize the app_shell so that its window exists for GC creation
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
308 purposes */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
309 gtk_widget_realize (GTK_WIDGET (app_shell));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
310
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
311 /* Need to set up some selection handlers */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
312 gtk_selection_add_target (GTK_WIDGET (app_shell), GDK_SELECTION_PRIMARY,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
313 GDK_SELECTION_TYPE_STRING, 0);
746
b13b1b7b11f1 [xemacs-hg @ 2002-02-08 13:04:18 by wmperry]
wmperry
parents: 563
diff changeset
314 gtk_selection_add_target (GTK_WIDGET (app_shell),
b13b1b7b11f1 [xemacs-hg @ 2002-02-08 13:04:18 by wmperry]
wmperry
parents: 563
diff changeset
315 gdk_atom_intern("CLIPBOARD", FALSE),
b13b1b7b11f1 [xemacs-hg @ 2002-02-08 13:04:18 by wmperry]
wmperry
parents: 563
diff changeset
316 GDK_SELECTION_TYPE_STRING, 0);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
317
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
318 gtk_signal_connect (GTK_OBJECT (app_shell), "selection_get",
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
319 GTK_SIGNAL_FUNC (emacs_gtk_selection_handle), NULL);
746
b13b1b7b11f1 [xemacs-hg @ 2002-02-08 13:04:18 by wmperry]
wmperry
parents: 563
diff changeset
320 gtk_signal_connect (GTK_OBJECT (app_shell), "selection_clear_event",
b13b1b7b11f1 [xemacs-hg @ 2002-02-08 13:04:18 by wmperry]
wmperry
parents: 563
diff changeset
321 GTK_SIGNAL_FUNC (emacs_gtk_selection_clear_event_handle),
b13b1b7b11f1 [xemacs-hg @ 2002-02-08 13:04:18 by wmperry]
wmperry
parents: 563
diff changeset
322 NULL);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
323 gtk_signal_connect (GTK_OBJECT (app_shell), "selection_received",
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
324 GTK_SIGNAL_FUNC (emacs_gtk_selection_received), NULL);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
325
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
326 DEVICE_GTK_WM_COMMAND_FRAME (d) = Qnil;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
327
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
328 gtk_init_modifier_mapping (d);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
329
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
330 gtk_device_init_x_specific_cruft (d);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
331
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
332 init_baud_rate (d);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
333 init_one_device (d);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
334
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
335 DEVICE_GTK_GC_CACHE (d) = make_gc_cache (GTK_WIDGET (app_shell));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
336 DEVICE_GTK_GRAY_PIXMAP (d) = NULL;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
337
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
338 gtk_init_device_class (d);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
339
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
340 /* Run the elisp side of the X device initialization. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
341 call0 (Qinit_pre_gtk_win);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
342 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
343
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
344 static void
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2054
diff changeset
345 gtk_finish_init_device (struct device *UNUSED (d), Lisp_Object UNUSED (props))
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
346 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
347 call0 (Qinit_post_gtk_win);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
348 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
349
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
350 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
351 gtk_mark_device (struct device *d)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
352 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
353 mark_object (DEVICE_GTK_WM_COMMAND_FRAME (d));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
354 mark_object (DEVICE_GTK_DATA (d)->x_keysym_map_hashtable);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
355 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
356
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
357
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
358 /************************************************************************/
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
359 /* closing an X connection */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
360 /************************************************************************/
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
361
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
362 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
363 free_gtk_device_struct (struct device *d)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
364 {
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2828
diff changeset
365 #ifdef NEW_GC
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2828
diff changeset
366 mc_free (d->device_data);
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2828
diff changeset
367 #else /* not NEW_GC */
1726
a8d8f419b459 [xemacs-hg @ 2003-09-30 15:26:34 by james]
james
parents: 1204
diff changeset
368 xfree (d->device_data, void *);
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2828
diff changeset
369 #endif /* not NEW_GC */
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
370 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
371
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
372 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
373 gtk_delete_device (struct device *d)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
374 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
375 #ifdef FREE_CHECKING
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
376 extern void (*__free_hook)();
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
377 int checking_free;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
378 #endif
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
379
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
380 if (1)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
381 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
382 #ifdef FREE_CHECKING
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
383 checking_free = (__free_hook != 0);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
384
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
385 /* Disable strict free checking, to avoid bug in X library */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
386 if (checking_free)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
387 disable_strict_free_check ();
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
388 #endif
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
389
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
390 free_gc_cache (DEVICE_GTK_GC_CACHE (d));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
391
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
392 #ifdef FREE_CHECKING
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
393 if (checking_free)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
394 enable_strict_free_check ();
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
395 #endif
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
396 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
397
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
398 free_gtk_device_struct (d);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
399 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
400
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
401
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
402 /************************************************************************/
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
403 /* handle X errors */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
404 /************************************************************************/
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
405
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
406 const char *
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
407 gtk_event_name (GdkEventType event_type)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
408 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
409 GtkEnumValue *vals = gtk_type_enum_get_values (GTK_TYPE_GDK_EVENT_TYPE);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
410
778
2923009caf47 [xemacs-hg @ 2002-03-16 10:38:59 by ben]
ben
parents: 746
diff changeset
411 while (vals && ((GdkEventType)(vals->value) != event_type)) vals++;
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
412
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
413 if (vals)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
414 return (vals->value_nick);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
415
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
416 return (NULL);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
417 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
418
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
419
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
420 /************************************************************************/
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
421 /* display information functions */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
422 /************************************************************************/
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
423
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
424 DEFUN ("gtk-display-visual-class", Fgtk_display_visual_class, 0, 1, 0, /*
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
425 Return the visual class of the GTK display DEVICE is using.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
426 The returned value will be one of the symbols `static-gray', `gray-scale',
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
427 `static-color', `pseudo-color', `true-color', or `direct-color'.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
428 */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
429 (device))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
430 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
431 GdkVisual *vis = DEVICE_GTK_VISUAL (decode_gtk_device (device));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
432 switch (vis->type)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
433 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
434 case GDK_VISUAL_STATIC_GRAY: return intern ("static-gray");
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
435 case GDK_VISUAL_GRAYSCALE: return intern ("gray-scale");
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
436 case GDK_VISUAL_STATIC_COLOR: return intern ("static-color");
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
437 case GDK_VISUAL_PSEUDO_COLOR: return intern ("pseudo-color");
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
438 case GDK_VISUAL_TRUE_COLOR: return intern ("true-color");
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
439 case GDK_VISUAL_DIRECT_COLOR: return intern ("direct-color");
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
440 default:
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 545
diff changeset
441 invalid_state ("display has an unknown visual class", Qunbound);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
442 return Qnil; /* suppress compiler warning */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
443 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
444 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
445
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
446 DEFUN ("gtk-display-visual-depth", Fgtk_display_visual_depth, 0, 1, 0, /*
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
447 Return the bitplane depth of the visual the GTK display DEVICE is using.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
448 */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
449 (device))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
450 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
451 return make_int (DEVICE_GTK_DEPTH (decode_gtk_device (device)));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
452 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
453
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
454 static Lisp_Object
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
455 gtk_device_system_metrics (struct device *d,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
456 enum device_metrics m)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
457 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
458 #if 0
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
459 GtkStyle *style = gtk_widget_get_style (GTK_WIDGET (DEVICE_GTK_APP_SHELL (d)));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
460
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
461 style = gtk_style_attach (style, w);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
462 #endif
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
463
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
464 switch (m)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
465 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
466 case DM_size_device:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
467 return Fcons (make_int (gdk_screen_width ()),
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
468 make_int (gdk_screen_height ()));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
469 case DM_size_device_mm:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
470 return Fcons (make_int (gdk_screen_width_mm ()),
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
471 make_int (gdk_screen_height_mm ()));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
472 case DM_num_color_cells:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
473 return make_int (gdk_colormap_get_system_size ());
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
474 case DM_num_bit_planes:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
475 return make_int (DEVICE_GTK_DEPTH (d));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
476
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
477 #if 0
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
478 case DM_color_default:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
479 case DM_color_select:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
480 case DM_color_balloon:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
481 case DM_color_3d_face:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
482 case DM_color_3d_light:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
483 case DM_color_3d_dark:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
484 case DM_color_menu:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
485 case DM_color_menu_highlight:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
486 case DM_color_menu_button:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
487 case DM_color_menu_disabled:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
488 case DM_color_toolbar:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
489 case DM_color_scrollbar:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
490 case DM_color_desktop:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
491 case DM_color_workspace:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
492 case DM_font_default:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
493 case DM_font_menubar:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
494 case DM_font_dialog:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
495 case DM_size_cursor:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
496 case DM_size_scrollbar:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
497 case DM_size_menu:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
498 case DM_size_toolbar:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
499 case DM_size_toolbar_button:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
500 case DM_size_toolbar_border:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
501 case DM_size_icon:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
502 case DM_size_icon_small:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
503 case DM_size_workspace:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
504 case DM_device_dpi:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
505 case DM_mouse_buttons:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
506 case DM_swap_buttons:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
507 case DM_show_sounds:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
508 case DM_slow_device:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
509 case DM_security:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
510 #endif
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
511 default: /* No such device metric property for GTK devices */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
512 return Qunbound;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
513 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
514 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
515
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
516 DEFUN ("gtk-keysym-on-keyboard-p", Fgtk_keysym_on_keyboard_p, 1, 2, 0, /*
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
517 Return true if KEYSYM names a key on the keyboard of DEVICE.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
518 More precisely, return true if some keystroke (possibly including modifiers)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
519 on the keyboard of DEVICE keys generates KEYSYM.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
520 Valid keysyms are listed in the files /usr/include/X11/keysymdef.h and in
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
521 /usr/lib/X11/XKeysymDB, or whatever the equivalents are on your system.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
522 The keysym name can be provided in two forms:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
523 - if keysym is a string, it must be the name as known to X windows.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
524 - if keysym is a symbol, it must be the name as known to XEmacs.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
525 The two names differ in capitalization and underscoring.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
526 */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
527 (keysym, device))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
528 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
529 struct device *d = decode_device (device);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
530
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
531 if (!DEVICE_GTK_P (d))
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 545
diff changeset
532 gui_error ("Not a GTK device", device);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
533
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
534 return (NILP (Fgethash (keysym, DEVICE_GTK_DATA (d)->x_keysym_map_hashtable, Qnil)) ?
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
535 Qnil : Qt);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
536 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
537
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
538
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
539 /************************************************************************/
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
540 /* grabs and ungrabs */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
541 /************************************************************************/
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
542
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
543 DEFUN ("gtk-grab-pointer", Fgtk_grab_pointer, 0, 3, 0, /*
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
544 Grab the pointer and restrict it to its current window.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
545 If optional DEVICE argument is nil, the default device will be used.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
546 If optional CURSOR argument is non-nil, change the pointer shape to that
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
547 until `gtk-ungrab-pointer' is called (it should be an object returned by the
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
548 `make-cursor-glyph' function).
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
549 If the second optional argument IGNORE-KEYBOARD is non-nil, ignore all
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
550 keyboard events during the grab.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
551 Returns t if the grab is successful, nil otherwise.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
552 */
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2054
diff changeset
553 (device, cursor, UNUSED (ignore_keyboard)))
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
554 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
555 GdkWindow *w;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
556 int result;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
557 struct device *d = decode_gtk_device (device);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
558
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
559 if (!NILP (cursor))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
560 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
561 CHECK_POINTER_GLYPH (cursor);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
562 cursor = glyph_image_instance (cursor, device, ERROR_ME, 0);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
563 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
564
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
565 /* We should call gdk_pointer_grab() and (possibly) gdk_keyboard_grab() here instead */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
566 w = GET_GTK_WIDGET_WINDOW (FRAME_GTK_TEXT_WIDGET (device_selected_frame (d)));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
567
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
568 result = gdk_pointer_grab (w, FALSE,
2054
91d4c8c65a0f [xemacs-hg @ 2004-05-02 04:06:51 by malcolmp]
malcolmp
parents: 1726
diff changeset
569 (GdkEventMask) (GDK_POINTER_MOTION_MASK |
91d4c8c65a0f [xemacs-hg @ 2004-05-02 04:06:51 by malcolmp]
malcolmp
parents: 1726
diff changeset
570 GDK_POINTER_MOTION_HINT_MASK |
91d4c8c65a0f [xemacs-hg @ 2004-05-02 04:06:51 by malcolmp]
malcolmp
parents: 1726
diff changeset
571 GDK_BUTTON1_MOTION_MASK |
91d4c8c65a0f [xemacs-hg @ 2004-05-02 04:06:51 by malcolmp]
malcolmp
parents: 1726
diff changeset
572 GDK_BUTTON2_MOTION_MASK |
91d4c8c65a0f [xemacs-hg @ 2004-05-02 04:06:51 by malcolmp]
malcolmp
parents: 1726
diff changeset
573 GDK_BUTTON3_MOTION_MASK |
91d4c8c65a0f [xemacs-hg @ 2004-05-02 04:06:51 by malcolmp]
malcolmp
parents: 1726
diff changeset
574 GDK_BUTTON_PRESS_MASK |
91d4c8c65a0f [xemacs-hg @ 2004-05-02 04:06:51 by malcolmp]
malcolmp
parents: 1726
diff changeset
575 GDK_BUTTON_RELEASE_MASK),
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
576 w,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
577 NULL, /* #### BILL!!! Need to create a GdkCursor * as necessary! */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
578 GDK_CURRENT_TIME);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
579
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
580 return (result == 0) ? Qt : Qnil;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
581 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
582
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
583 DEFUN ("gtk-ungrab-pointer", Fgtk_ungrab_pointer, 0, 1, 0, /*
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
584 Release a pointer grab made with `gtk-grab-pointer'.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
585 If optional first arg DEVICE is nil the default device is used.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
586 If it is t the pointer will be released on all GTK devices.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
587 */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
588 (device))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
589 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
590 if (!EQ (device, Qt))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
591 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
592 gdk_pointer_ungrab (GDK_CURRENT_TIME);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
593 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
594 else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
595 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
596 Lisp_Object devcons, concons;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
597
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
598 DEVICE_LOOP_NO_BREAK (devcons, concons)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
599 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
600 struct device *d = XDEVICE (XCAR (devcons));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
601
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
602 if (DEVICE_GTK_P (d))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
603 gdk_pointer_ungrab (GDK_CURRENT_TIME);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
604 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
605 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
606 return Qnil;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
607 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
608
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
609 DEFUN ("gtk-grab-keyboard", Fgtk_grab_keyboard, 0, 1, 0, /*
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
610 Grab the keyboard on the given device (defaulting to the selected one).
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
611 So long as the keyboard is grabbed, all keyboard events will be delivered
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
612 to emacs -- it is not possible for other clients to eavesdrop on them.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
613 Ungrab the keyboard with `gtk-ungrab-keyboard' (use an unwind-protect).
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
614 Returns t if the grab is successful, nil otherwise.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
615 */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
616 (device))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
617 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
618 struct device *d = decode_gtk_device (device);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
619 GdkWindow *w = GET_GTK_WIDGET_WINDOW (FRAME_GTK_TEXT_WIDGET (device_selected_frame (d)));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
620
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
621 gdk_keyboard_grab (w, FALSE, GDK_CURRENT_TIME );
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
622
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
623 return Qt;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
624 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
625
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
626 DEFUN ("gtk-ungrab-keyboard", Fgtk_ungrab_keyboard, 0, 1, 0, /*
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
627 Release a keyboard grab made with `gtk-grab-keyboard'.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
628 */
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2054
diff changeset
629 (UNUSED (device)))
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
630 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
631 gdk_keyboard_ungrab (GDK_CURRENT_TIME);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
632 return Qnil;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
633 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
634
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
635
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
636 /************************************************************************/
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
637 /* Style Info */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
638 /************************************************************************/
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
639 DEFUN ("gtk-style-info", Fgtk_style_info, 0, 1, 0, /*
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
640 Get the style information for a Gtk device.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
641 */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
642 (device))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
643 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
644 struct device *d = decode_device (device);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
645 GtkStyle *style = NULL;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
646 Lisp_Object result = Qnil;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
647 GtkWidget *app_shell = GTK_WIDGET (DEVICE_GTK_APP_SHELL (d));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
648 GdkWindow *w = GET_GTK_WIDGET_WINDOW (app_shell);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
649
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
650 if (!DEVICE_GTK_P (d))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
651 return (Qnil);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
652
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
653 style = gtk_widget_get_style (app_shell);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
654 style = gtk_style_attach (style, w);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
655
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
656 if (!style) return (Qnil);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
657
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
658 #define FROB_COLOR(slot, name) \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
659 result = nconc2 (result, \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
660 list2 (intern (name), \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
661 list5 (xemacs_gtk_convert_color (&style->slot[GTK_STATE_NORMAL], app_shell),\
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
662 xemacs_gtk_convert_color (&style->slot[GTK_STATE_ACTIVE], app_shell),\
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
663 xemacs_gtk_convert_color (&style->slot[GTK_STATE_PRELIGHT], app_shell),\
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
664 xemacs_gtk_convert_color (&style->slot[GTK_STATE_SELECTED], app_shell),\
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
665 xemacs_gtk_convert_color (&style->slot[GTK_STATE_INSENSITIVE], app_shell))))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
666
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
667 FROB_COLOR (fg, "foreground");
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
668 FROB_COLOR (bg, "background");
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
669 FROB_COLOR (light, "light");
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
670 FROB_COLOR (dark, "dark");
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
671 FROB_COLOR (mid, "mid");
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
672 FROB_COLOR (text, "text");
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
673 FROB_COLOR (base, "base");
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
674 #undef FROB_COLOR
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
675
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
676 result = nconc2 (result, list2 (Qfont, convert_font (style->font)));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
677
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
678 #define FROB_PIXMAP(state) (style->rc_style->bg_pixmap_name[state] ? build_string (style->rc_style->bg_pixmap_name[state]) : Qnil)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
679
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
680 if (style->rc_style)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
681 result = nconc2 (result, list2 (Qbackground,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
682 list5 ( FROB_PIXMAP (GTK_STATE_NORMAL),
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
683 FROB_PIXMAP (GTK_STATE_ACTIVE),
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
684 FROB_PIXMAP (GTK_STATE_PRELIGHT),
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
685 FROB_PIXMAP (GTK_STATE_SELECTED),
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
686 FROB_PIXMAP (GTK_STATE_INSENSITIVE))));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
687 #undef FROB_PIXMAP
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
688
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
689 return (result);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
690 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
691
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
692
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
693 /************************************************************************/
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
694 /* initialization */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
695 /************************************************************************/
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
696
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
697 void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
698 syms_of_device_gtk (void)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
699 {
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2828
diff changeset
700 #ifdef NEW_GC
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2828
diff changeset
701 INIT_LRECORD_IMPLEMENTATION (gtk_device);
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2828
diff changeset
702 #endif /* NEW_GC */
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2828
diff changeset
703
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
704 DEFSUBR (Fgtk_keysym_on_keyboard_p);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
705 DEFSUBR (Fgtk_display_visual_class);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
706 DEFSUBR (Fgtk_display_visual_depth);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
707 DEFSUBR (Fgtk_style_info);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
708 DEFSUBR (Fgtk_grab_pointer);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
709 DEFSUBR (Fgtk_ungrab_pointer);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
710 DEFSUBR (Fgtk_grab_keyboard);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
711 DEFSUBR (Fgtk_ungrab_keyboard);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
712 DEFSUBR (Fgtk_init);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
713
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 545
diff changeset
714 DEFSYMBOL (Qinit_pre_gtk_win);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 545
diff changeset
715 DEFSYMBOL (Qinit_post_gtk_win);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
716 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
717
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
718 void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
719 console_type_create_device_gtk (void)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
720 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
721 CONSOLE_HAS_METHOD (gtk, init_device);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
722 CONSOLE_HAS_METHOD (gtk, finish_init_device);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
723 CONSOLE_HAS_METHOD (gtk, mark_device);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
724 CONSOLE_HAS_METHOD (gtk, delete_device);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
725 CONSOLE_HAS_METHOD (gtk, device_system_metrics);
545
9a775fb11bb7 [xemacs-hg @ 2001-05-18 04:39:39 by kkm]
kkm
parents: 462
diff changeset
726 /* CONSOLE_IMPLEMENTATION_FLAGS (gtk, XDEVIMPF_PIXEL_GEOMETRY); */
9a775fb11bb7 [xemacs-hg @ 2001-05-18 04:39:39 by kkm]
kkm
parents: 462
diff changeset
727 /* I inserted the above commented out statement, as the original
9a775fb11bb7 [xemacs-hg @ 2001-05-18 04:39:39 by kkm]
kkm
parents: 462
diff changeset
728 implementation of gtk_device_implementation_flags(), which I
9a775fb11bb7 [xemacs-hg @ 2001-05-18 04:39:39 by kkm]
kkm
parents: 462
diff changeset
729 deleted, contained commented out XDEVIMPF_PIXEL_GEOMETRY - kkm*/
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
730 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
731
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
732 void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
733 vars_of_device_gtk (void)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
734 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
735 Fprovide (Qgtk);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
736
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
737 DEFVAR_LISP ("gtk-initial-argv-list", &Vgtk_initial_argv_list /*
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
738 You don't want to know.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
739 This is used during startup to communicate the remaining arguments in
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
740 `command-line-args-left' to the C code, which passes the args to
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
741 the GTK initialization code, which removes some args, and then the
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
742 args are placed back into `gtk-initial-arg-list' and thence into
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
743 `command-line-args-left'. Perhaps `command-line-args-left' should
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
744 just reside in C.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
745 */ );
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
746
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
747 DEFVAR_LISP ("gtk-initial-geometry", &Vgtk_initial_geometry /*
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
748 You don't want to know.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
749 This is used during startup to communicate the default geometry to GTK.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
750 */ );
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
751
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
752 Vgtk_initial_geometry = Qnil;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
753 Vgtk_initial_argv_list = Qnil;
2828
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
754
a25c824ed558 [xemacs-hg @ 2005-06-26 18:04:49 by aidan]
aidan
parents: 2286
diff changeset
755 Qgtk_seen_characters = Qnil;
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
756 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
757
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
758 #include <gdk/gdkx.h>
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
759 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
760 gtk_device_init_x_specific_cruft (struct device *d)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
761 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
762 DEVICE_INFD (d) = DEVICE_OUTFD (d) = ConnectionNumber (GDK_DISPLAY ());
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
763 }