aboutsummaryrefslogtreecommitdiffstats
path: root/src/xterm.c
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 /src/xterm.c
parent54eefef1cfc4083f5407860af480ca7727f3b737 (diff)
downloademacs-1fcfb866116a5d2749dd03475f9156317e540fe5.tar.gz
emacs-1fcfb866116a5d2749dd03475f9156317e540fe5.zip
Fix input methods for GTK.
Don't right justify GTK help menu.
Diffstat (limited to 'src/xterm.c')
-rw-r--r--src/xterm.c78
1 files changed, 57 insertions, 21 deletions
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. */