mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-12-18 10:16:51 +00:00
Fix input methods for GTK.
Don't right justify GTK help menu.
This commit is contained in:
parent
54eefef1cf
commit
1fcfb86611
@ -1,3 +1,20 @@
|
||||
2003-01-25 Jan D. <jan.h.d@swipnet.se>
|
||||
|
||||
* xterm.h: Change to return value of x_dispatch_event to int.
|
||||
|
||||
* xterm.c (x_filter_event): New function.
|
||||
(event_handler_gdk, XTread_socket): Call x_filter_event.
|
||||
(x_dispatch_event): Change to return value of finish.
|
||||
(event_handler_gdk): Use return value from x_dispatch_event.
|
||||
|
||||
* xfns.c (x_window): Call create_frame_xic for GTK version to
|
||||
initialize input methods.
|
||||
|
||||
* gtkutil.h: Add (void) prototypes.
|
||||
|
||||
* gtkutil.c (create_menus): Remove code that puts the help menu to
|
||||
the right.
|
||||
|
||||
2003-01-25 Jason Rumney <jasonr@gnu.org>
|
||||
|
||||
* w32fns.c (XPutPixel): Handle monochrome images; used for masks.
|
||||
|
@ -1462,10 +1462,6 @@ create_menus (data, f, select_cb, deactivate_cb, highlight_cb,
|
||||
0);
|
||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (w), submenu);
|
||||
}
|
||||
|
||||
/* Assume "Help" is the last menu in the menubar. */
|
||||
if (menu_bar_p && ! item->next)
|
||||
gtk_menu_item_set_right_justified (GTK_MENU_ITEM (w), TRUE);
|
||||
}
|
||||
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (wmenu), w);
|
||||
|
@ -123,7 +123,7 @@ typedef struct _widget_value
|
||||
struct _widget_value *free_list;
|
||||
} widget_value;
|
||||
|
||||
extern widget_value *malloc_widget_value ();
|
||||
extern widget_value *malloc_widget_value P_ ((void));
|
||||
extern void free_widget_value P_ ((widget_value *));
|
||||
|
||||
extern char *xg_get_file_name P_ ((FRAME_PTR f,
|
||||
@ -186,10 +186,10 @@ extern void x_wm_set_size_hint P_ ((FRAME_PTR f,
|
||||
extern void xg_set_background_color P_ ((FRAME_PTR f, unsigned long bg));
|
||||
|
||||
/* Mark all callback data that are Lisp_object:s during GC. */
|
||||
extern void xg_mark_data ();
|
||||
extern void xg_mark_data P_ ((void));
|
||||
|
||||
/* Initialize GTK specific parts. */
|
||||
extern void xg_initialize ();
|
||||
extern void xg_initialize P_ ((void));
|
||||
|
||||
/* Setting scrollbar values invokes the callback. Use this variable
|
||||
to indicate that the callback should do nothing. */
|
||||
|
31
src/xfns.c
31
src/xfns.c
@ -4039,6 +4039,35 @@ x_window (f)
|
||||
{
|
||||
if (! xg_create_frame_widgets (f))
|
||||
error ("Unable to create window");
|
||||
|
||||
#ifdef HAVE_X_I18N
|
||||
FRAME_XIC (f) = NULL;
|
||||
#ifdef USE_XIM
|
||||
BLOCK_INPUT;
|
||||
create_frame_xic (f);
|
||||
if (FRAME_XIC (f))
|
||||
{
|
||||
/* XIM server might require some X events. */
|
||||
unsigned long fevent = NoEventMask;
|
||||
XGetICValues(FRAME_XIC (f), XNFilterEvents, &fevent, NULL);
|
||||
|
||||
if (fevent != NoEventMask)
|
||||
{
|
||||
XSetWindowAttributes attributes;
|
||||
XWindowAttributes wattr;
|
||||
unsigned long attribute_mask;
|
||||
|
||||
XGetWindowAttributes (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
|
||||
&wattr);
|
||||
attributes.event_mask = wattr.your_event_mask | fevent;
|
||||
attribute_mask = CWEventMask;
|
||||
XChangeWindowAttributes (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
|
||||
attribute_mask, &attributes);
|
||||
}
|
||||
}
|
||||
UNBLOCK_INPUT;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#else /*! USE_GTK */
|
||||
@ -11761,7 +11790,7 @@ selection dialog's entry field, if MUSTMATCH is non-nil. */)
|
||||
{
|
||||
XEvent event;
|
||||
XtAppNextEvent (Xt_app_con, &event);
|
||||
x_dispatch_event (&event, FRAME_X_DISPLAY (f) );
|
||||
(void) x_dispatch_event (&event, FRAME_X_DISPLAY (f) );
|
||||
}
|
||||
|
||||
/* Get the result. */
|
||||
|
78
src/xterm.c
78
src/xterm.c
@ -10214,6 +10214,32 @@ enum
|
||||
X_EVENT_DROP
|
||||
};
|
||||
|
||||
/* Filter events for the current X input method.
|
||||
DPYINFO is the display this event is for.
|
||||
EVENT is the X event to filter.
|
||||
|
||||
Returns non-zero if the event was filtered, caller shall not process
|
||||
this event further.
|
||||
Returns zero if event is wasn't filtered. */
|
||||
|
||||
#ifdef HAVE_X_I18N
|
||||
static int
|
||||
x_filter_event (dpyinfo, event)
|
||||
struct x_display_info *dpyinfo;
|
||||
XEvent *event;
|
||||
{
|
||||
/* XFilterEvent returns non-zero if the input method has
|
||||
consumed the event. We pass the frame's X window to
|
||||
XFilterEvent because that's the one for which the IC
|
||||
was created. */
|
||||
|
||||
struct frame *f1 = x_any_window_to_frame (dpyinfo,
|
||||
event->xclient.window);
|
||||
|
||||
return XFilterEvent (event, f1 ? FRAME_X_WINDOW (f1) : None);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef USE_GTK
|
||||
static struct x_display_info *current_dpyinfo;
|
||||
static struct input_event **current_bufp;
|
||||
@ -10233,13 +10259,23 @@ event_handler_gdk (gxev, ev, data)
|
||||
XEvent *xev = (XEvent*)gxev;
|
||||
|
||||
if (current_numcharsp)
|
||||
current_count += handle_one_xevent (current_dpyinfo,
|
||||
xev,
|
||||
current_bufp,
|
||||
current_numcharsp,
|
||||
¤t_finish);
|
||||
{
|
||||
#ifdef HAVE_X_I18N
|
||||
/* Filter events for the current X input method.
|
||||
GTK calls XFilterEvent but not for key press and release,
|
||||
so we do it here. */
|
||||
if (xev->type == KeyPress || xev->type == KeyRelease)
|
||||
if (x_filter_event (current_dpyinfo, xev))
|
||||
return GDK_FILTER_REMOVE;
|
||||
#endif
|
||||
current_count += handle_one_xevent (current_dpyinfo,
|
||||
xev,
|
||||
current_bufp,
|
||||
current_numcharsp,
|
||||
¤t_finish);
|
||||
}
|
||||
else
|
||||
x_dispatch_event (xev, GDK_DISPLAY ());
|
||||
current_finish = x_dispatch_event (xev, GDK_DISPLAY ());
|
||||
|
||||
if (current_finish == X_EVENT_GOTO_OUT || current_finish == X_EVENT_DROP)
|
||||
return GDK_FILTER_REMOVE;
|
||||
@ -11520,8 +11556,10 @@ handle_one_xevent (dpyinfo, eventp, bufp_r, numcharsp, finish)
|
||||
|
||||
/* Handles the XEvent EVENT on display DISPLAY.
|
||||
This is used for event loops outside the normal event handling,
|
||||
i.e. looping while a popup menu or a dialog is posted. */
|
||||
void
|
||||
i.e. looping while a popup menu or a dialog is posted.
|
||||
|
||||
Returns the value handle_one_xevent sets in the finish argument. */
|
||||
int
|
||||
x_dispatch_event (event, display)
|
||||
XEvent *event;
|
||||
Display *display;
|
||||
@ -11530,7 +11568,7 @@ x_dispatch_event (event, display)
|
||||
struct input_event bufp[10];
|
||||
struct input_event *bufpp = bufp;
|
||||
int numchars = 10;
|
||||
int finish;
|
||||
int finish = X_EVENT_NORMAL;
|
||||
|
||||
for (dpyinfo = x_display_list; dpyinfo; dpyinfo = dpyinfo->next)
|
||||
if (dpyinfo->display == display)
|
||||
@ -11547,6 +11585,8 @@ x_dispatch_event (event, display)
|
||||
for (i = 0; i < events; ++i)
|
||||
kbd_buffer_store_event (&bufp[i]);
|
||||
}
|
||||
|
||||
return finish;
|
||||
}
|
||||
|
||||
|
||||
@ -11667,17 +11707,9 @@ XTread_socket (sd, bufp, numchars, expected)
|
||||
XNextEvent (dpyinfo->display, &event);
|
||||
|
||||
#ifdef HAVE_X_I18N
|
||||
{
|
||||
/* Filter events for the current X input method.
|
||||
XFilterEvent returns non-zero if the input method has
|
||||
consumed the event. We pass the frame's X window to
|
||||
XFilterEvent because that's the one for which the IC
|
||||
was created. */
|
||||
struct frame *f1 = x_any_window_to_frame (dpyinfo,
|
||||
event.xclient.window);
|
||||
if (XFilterEvent (&event, f1 ? FRAME_X_WINDOW (f1) : None))
|
||||
break;
|
||||
}
|
||||
/* Filter events for the current X input method. */
|
||||
if (x_filter_event (dpyinfo, &event))
|
||||
break;
|
||||
#endif
|
||||
event_found = 1;
|
||||
|
||||
@ -13025,7 +13057,7 @@ struct xim_inst_t
|
||||
};
|
||||
|
||||
/* XIM instantiate callback function, which is called whenever an XIM
|
||||
server is available. DISPLAY is teh display of the XIM.
|
||||
server is available. DISPLAY is the display of the XIM.
|
||||
CLIENT_DATA contains a pointer to an xim_inst_t structure created
|
||||
when the callback was registered. */
|
||||
|
||||
@ -15167,6 +15199,10 @@ x_term_init (display_name, xrm_option, resource_name)
|
||||
argv[argc++] = "--name";
|
||||
argv[argc++] = resource_name;
|
||||
|
||||
#ifdef HAVE_X11R5
|
||||
XSetLocaleModifiers ("");
|
||||
#endif
|
||||
|
||||
gtk_init (&argc, &argv2);
|
||||
|
||||
/* gtk_init does set_locale. We must fix locale after calling it. */
|
||||
|
@ -1090,7 +1090,7 @@ extern void x_clear_area P_ ((Display *, Window, int, int, int, int, int));
|
||||
extern void x_fullscreen_adjust P_ ((struct frame *f, int *, int *,
|
||||
int *, int *));
|
||||
|
||||
extern void x_dispatch_event P_ ((XEvent *, Display *));
|
||||
extern int x_dispatch_event P_ ((XEvent *, Display *));
|
||||
|
||||
/* Defined in xselect.c */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user