aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Djärv2003-01-25 16:25:39 +0000
committerJan Djärv2003-01-25 16:25:39 +0000
commit1fcfb866116a5d2749dd03475f9156317e540fe5 (patch)
treef3904a40300aefb59b2b30b671dc2c6232208cb7
parent54eefef1cfc4083f5407860af480ca7727f3b737 (diff)
downloademacs-1fcfb866116a5d2749dd03475f9156317e540fe5.tar.gz
emacs-1fcfb866116a5d2749dd03475f9156317e540fe5.zip
Fix input methods for GTK.
Don't right justify GTK help menu.
-rw-r--r--src/ChangeLog17
-rw-r--r--src/gtkutil.c4
-rw-r--r--src/gtkutil.h6
-rw-r--r--src/xfns.c31
-rw-r--r--src/xterm.c78
-rw-r--r--src/xterm.h2
6 files changed, 108 insertions, 30 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index bc02917930c..8339724aff3 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,20 @@
12003-01-25 Jan D. <jan.h.d@swipnet.se>
2
3 * xterm.h: Change to return value of x_dispatch_event to int.
4
5 * xterm.c (x_filter_event): New function.
6 (event_handler_gdk, XTread_socket): Call x_filter_event.
7 (x_dispatch_event): Change to return value of finish.
8 (event_handler_gdk): Use return value from x_dispatch_event.
9
10 * xfns.c (x_window): Call create_frame_xic for GTK version to
11 initialize input methods.
12
13 * gtkutil.h: Add (void) prototypes.
14
15 * gtkutil.c (create_menus): Remove code that puts the help menu to
16 the right.
17
12003-01-25 Jason Rumney <jasonr@gnu.org> 182003-01-25 Jason Rumney <jasonr@gnu.org>
2 19
3 * w32fns.c (XPutPixel): Handle monochrome images; used for masks. 20 * w32fns.c (XPutPixel): Handle monochrome images; used for masks.
diff --git a/src/gtkutil.c b/src/gtkutil.c
index e9f3d7e9117..d2acfee8c54 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -1462,10 +1462,6 @@ create_menus (data, f, select_cb, deactivate_cb, highlight_cb,
1462 0); 1462 0);
1463 gtk_menu_item_set_submenu (GTK_MENU_ITEM (w), submenu); 1463 gtk_menu_item_set_submenu (GTK_MENU_ITEM (w), submenu);
1464 } 1464 }
1465
1466 /* Assume "Help" is the last menu in the menubar. */
1467 if (menu_bar_p && ! item->next)
1468 gtk_menu_item_set_right_justified (GTK_MENU_ITEM (w), TRUE);
1469 } 1465 }
1470 1466
1471 gtk_menu_shell_append (GTK_MENU_SHELL (wmenu), w); 1467 gtk_menu_shell_append (GTK_MENU_SHELL (wmenu), w);
diff --git a/src/gtkutil.h b/src/gtkutil.h
index fa16bcdbb5f..103b9781417 100644
--- a/src/gtkutil.h
+++ b/src/gtkutil.h
@@ -123,7 +123,7 @@ typedef struct _widget_value
123 struct _widget_value *free_list; 123 struct _widget_value *free_list;
124} widget_value; 124} widget_value;
125 125
126extern widget_value *malloc_widget_value (); 126extern widget_value *malloc_widget_value P_ ((void));
127extern void free_widget_value P_ ((widget_value *)); 127extern void free_widget_value P_ ((widget_value *));
128 128
129extern char *xg_get_file_name P_ ((FRAME_PTR f, 129extern char *xg_get_file_name P_ ((FRAME_PTR f,
@@ -186,10 +186,10 @@ extern void x_wm_set_size_hint P_ ((FRAME_PTR f,
186extern void xg_set_background_color P_ ((FRAME_PTR f, unsigned long bg)); 186extern void xg_set_background_color P_ ((FRAME_PTR f, unsigned long bg));
187 187
188/* Mark all callback data that are Lisp_object:s during GC. */ 188/* Mark all callback data that are Lisp_object:s during GC. */
189extern void xg_mark_data (); 189extern void xg_mark_data P_ ((void));
190 190
191/* Initialize GTK specific parts. */ 191/* Initialize GTK specific parts. */
192extern void xg_initialize (); 192extern void xg_initialize P_ ((void));
193 193
194/* Setting scrollbar values invokes the callback. Use this variable 194/* Setting scrollbar values invokes the callback. Use this variable
195 to indicate that the callback should do nothing. */ 195 to indicate that the callback should do nothing. */
diff --git a/src/xfns.c b/src/xfns.c
index 1b9b629b366..e7f339198c8 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -4039,6 +4039,35 @@ x_window (f)
4039{ 4039{
4040 if (! xg_create_frame_widgets (f)) 4040 if (! xg_create_frame_widgets (f))
4041 error ("Unable to create window"); 4041 error ("Unable to create window");
4042
4043#ifdef HAVE_X_I18N
4044 FRAME_XIC (f) = NULL;
4045#ifdef USE_XIM
4046 BLOCK_INPUT;
4047 create_frame_xic (f);
4048 if (FRAME_XIC (f))
4049 {
4050 /* XIM server might require some X events. */
4051 unsigned long fevent = NoEventMask;
4052 XGetICValues(FRAME_XIC (f), XNFilterEvents, &fevent, NULL);
4053
4054 if (fevent != NoEventMask)
4055 {
4056 XSetWindowAttributes attributes;
4057 XWindowAttributes wattr;
4058 unsigned long attribute_mask;
4059
4060 XGetWindowAttributes (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
4061 &wattr);
4062 attributes.event_mask = wattr.your_event_mask | fevent;
4063 attribute_mask = CWEventMask;
4064 XChangeWindowAttributes (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
4065 attribute_mask, &attributes);
4066 }
4067 }
4068 UNBLOCK_INPUT;
4069#endif
4070#endif
4042} 4071}
4043 4072
4044#else /*! USE_GTK */ 4073#else /*! USE_GTK */
@@ -11761,7 +11790,7 @@ selection dialog's entry field, if MUSTMATCH is non-nil. */)
11761 { 11790 {
11762 XEvent event; 11791 XEvent event;
11763 XtAppNextEvent (Xt_app_con, &event); 11792 XtAppNextEvent (Xt_app_con, &event);
11764 x_dispatch_event (&event, FRAME_X_DISPLAY (f) ); 11793 (void) x_dispatch_event (&event, FRAME_X_DISPLAY (f) );
11765 } 11794 }
11766 11795
11767 /* Get the result. */ 11796 /* Get the result. */
diff --git a/src/xterm.c b/src/xterm.c
index 08043900468..4fa0e8bb49b 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -10214,6 +10214,32 @@ enum
10214 X_EVENT_DROP 10214 X_EVENT_DROP
10215}; 10215};
10216 10216
10217/* Filter events for the current X input method.
10218 DPYINFO is the display this event is for.
10219 EVENT is the X event to filter.
10220
10221 Returns non-zero if the event was filtered, caller shall not process
10222 this event further.
10223 Returns zero if event is wasn't filtered. */
10224
10225#ifdef HAVE_X_I18N
10226static int
10227x_filter_event (dpyinfo, event)
10228 struct x_display_info *dpyinfo;
10229 XEvent *event;
10230{
10231 /* XFilterEvent returns non-zero if the input method has
10232 consumed the event. We pass the frame's X window to
10233 XFilterEvent because that's the one for which the IC
10234 was created. */
10235
10236 struct frame *f1 = x_any_window_to_frame (dpyinfo,
10237 event->xclient.window);
10238
10239 return XFilterEvent (event, f1 ? FRAME_X_WINDOW (f1) : None);
10240}
10241#endif
10242
10217#ifdef USE_GTK 10243#ifdef USE_GTK
10218static struct x_display_info *current_dpyinfo; 10244static struct x_display_info *current_dpyinfo;
10219static struct input_event **current_bufp; 10245static struct input_event **current_bufp;
@@ -10233,13 +10259,23 @@ event_handler_gdk (gxev, ev, data)
10233 XEvent *xev = (XEvent*)gxev; 10259 XEvent *xev = (XEvent*)gxev;
10234 10260
10235 if (current_numcharsp) 10261 if (current_numcharsp)
10236 current_count += handle_one_xevent (current_dpyinfo, 10262 {
10237 xev, 10263#ifdef HAVE_X_I18N
10238 current_bufp, 10264 /* Filter events for the current X input method.
10239 current_numcharsp, 10265 GTK calls XFilterEvent but not for key press and release,
10240 &current_finish); 10266 so we do it here. */
10267 if (xev->type == KeyPress || xev->type == KeyRelease)
10268 if (x_filter_event (current_dpyinfo, xev))
10269 return GDK_FILTER_REMOVE;
10270#endif
10271 current_count += handle_one_xevent (current_dpyinfo,
10272 xev,
10273 current_bufp,
10274 current_numcharsp,
10275 &current_finish);
10276 }
10241 else 10277 else
10242 x_dispatch_event (xev, GDK_DISPLAY ()); 10278 current_finish = x_dispatch_event (xev, GDK_DISPLAY ());
10243 10279
10244 if (current_finish == X_EVENT_GOTO_OUT || current_finish == X_EVENT_DROP) 10280 if (current_finish == X_EVENT_GOTO_OUT || current_finish == X_EVENT_DROP)
10245 return GDK_FILTER_REMOVE; 10281 return GDK_FILTER_REMOVE;
@@ -11520,8 +11556,10 @@ handle_one_xevent (dpyinfo, eventp, bufp_r, numcharsp, finish)
11520 11556
11521/* Handles the XEvent EVENT on display DISPLAY. 11557/* Handles the XEvent EVENT on display DISPLAY.
11522 This is used for event loops outside the normal event handling, 11558 This is used for event loops outside the normal event handling,
11523 i.e. looping while a popup menu or a dialog is posted. */ 11559 i.e. looping while a popup menu or a dialog is posted.
11524void 11560
11561 Returns the value handle_one_xevent sets in the finish argument. */
11562int
11525x_dispatch_event (event, display) 11563x_dispatch_event (event, display)
11526 XEvent *event; 11564 XEvent *event;
11527 Display *display; 11565 Display *display;
@@ -11530,7 +11568,7 @@ x_dispatch_event (event, display)
11530 struct input_event bufp[10]; 11568 struct input_event bufp[10];
11531 struct input_event *bufpp = bufp; 11569 struct input_event *bufpp = bufp;
11532 int numchars = 10; 11570 int numchars = 10;
11533 int finish; 11571 int finish = X_EVENT_NORMAL;
11534 11572
11535 for (dpyinfo = x_display_list; dpyinfo; dpyinfo = dpyinfo->next) 11573 for (dpyinfo = x_display_list; dpyinfo; dpyinfo = dpyinfo->next)
11536 if (dpyinfo->display == display) 11574 if (dpyinfo->display == display)
@@ -11547,6 +11585,8 @@ x_dispatch_event (event, display)
11547 for (i = 0; i < events; ++i) 11585 for (i = 0; i < events; ++i)
11548 kbd_buffer_store_event (&bufp[i]); 11586 kbd_buffer_store_event (&bufp[i]);
11549 } 11587 }
11588
11589 return finish;
11550} 11590}
11551 11591
11552 11592
@@ -11667,17 +11707,9 @@ XTread_socket (sd, bufp, numchars, expected)
11667 XNextEvent (dpyinfo->display, &event); 11707 XNextEvent (dpyinfo->display, &event);
11668 11708
11669#ifdef HAVE_X_I18N 11709#ifdef HAVE_X_I18N
11670 { 11710 /* Filter events for the current X input method. */
11671 /* Filter events for the current X input method. 11711 if (x_filter_event (dpyinfo, &event))
11672 XFilterEvent returns non-zero if the input method has 11712 break;
11673 consumed the event. We pass the frame's X window to
11674 XFilterEvent because that's the one for which the IC
11675 was created. */
11676 struct frame *f1 = x_any_window_to_frame (dpyinfo,
11677 event.xclient.window);
11678 if (XFilterEvent (&event, f1 ? FRAME_X_WINDOW (f1) : None))
11679 break;
11680 }
11681#endif 11713#endif
11682 event_found = 1; 11714 event_found = 1;
11683 11715
@@ -13025,7 +13057,7 @@ struct xim_inst_t
13025}; 13057};
13026 13058
13027/* XIM instantiate callback function, which is called whenever an XIM 13059/* XIM instantiate callback function, which is called whenever an XIM
13028 server is available. DISPLAY is teh display of the XIM. 13060 server is available. DISPLAY is the display of the XIM.
13029 CLIENT_DATA contains a pointer to an xim_inst_t structure created 13061 CLIENT_DATA contains a pointer to an xim_inst_t structure created
13030 when the callback was registered. */ 13062 when the callback was registered. */
13031 13063
@@ -15167,6 +15199,10 @@ x_term_init (display_name, xrm_option, resource_name)
15167 argv[argc++] = "--name"; 15199 argv[argc++] = "--name";
15168 argv[argc++] = resource_name; 15200 argv[argc++] = resource_name;
15169 15201
15202#ifdef HAVE_X11R5
15203 XSetLocaleModifiers ("");
15204#endif
15205
15170 gtk_init (&argc, &argv2); 15206 gtk_init (&argc, &argv2);
15171 15207
15172 /* gtk_init does set_locale. We must fix locale after calling it. */ 15208 /* gtk_init does set_locale. We must fix locale after calling it. */
diff --git a/src/xterm.h b/src/xterm.h
index 7ad148c0004..129dca32f5c 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -1090,7 +1090,7 @@ extern void x_clear_area P_ ((Display *, Window, int, int, int, int, int));
1090extern void x_fullscreen_adjust P_ ((struct frame *f, int *, int *, 1090extern void x_fullscreen_adjust P_ ((struct frame *f, int *, int *,
1091 int *, int *)); 1091 int *, int *));
1092 1092
1093extern void x_dispatch_event P_ ((XEvent *, Display *)); 1093extern int x_dispatch_event P_ ((XEvent *, Display *));
1094 1094
1095/* Defined in xselect.c */ 1095/* Defined in xselect.c */
1096 1096