Mercurial > hg > xemacs-beta
comparison src/event-Xt.c @ 406:b8cc9ab3f761 r21-2-33
Import from CVS: tag r21-2-33
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:17:09 +0200 |
parents | 2f8bb876ab1d |
children | 501cfd01ee6d |
comparison
equal
deleted
inserted
replaced
405:0e08f63c74d2 | 406:b8cc9ab3f761 |
---|---|
65 #include "offix.h" | 65 #include "offix.h" |
66 #endif | 66 #endif |
67 | 67 |
68 #include "events-mod.h" | 68 #include "events-mod.h" |
69 | 69 |
70 static void enqueue_Xt_dispatch_event (Lisp_Object event); | |
71 static void handle_focus_event_1 (struct frame *f, int in_p); | 70 static void handle_focus_event_1 (struct frame *f, int in_p); |
72 | 71 |
73 static struct event_stream *Xt_event_stream; | 72 static struct event_stream *Xt_event_stream; |
74 | 73 |
75 /* With the new event model, all events go through XtDispatchEvent() | 74 /* With the new event model, all events go through XtDispatchEvent() |
1489 Widget focus_widget = XtGetKeyboardFocusWidget (FRAME_X_TEXT_WIDGET (f)); | 1488 Widget focus_widget = XtGetKeyboardFocusWidget (FRAME_X_TEXT_WIDGET (f)); |
1490 #endif | 1489 #endif |
1491 #ifdef HAVE_XIM | 1490 #ifdef HAVE_XIM |
1492 XIM_focus_event (f, in_p); | 1491 XIM_focus_event (f, in_p); |
1493 #endif /* HAVE_XIM */ | 1492 #endif /* HAVE_XIM */ |
1494 | |
1495 /* On focus change, clear all memory of sticky modifiers | 1493 /* On focus change, clear all memory of sticky modifiers |
1496 to avoid non-intuitive behavior. */ | 1494 to avoid non-intuitive behavior. */ |
1497 clear_sticky_modifiers (XDEVICE (FRAME_DEVICE (f))); | 1495 clear_sticky_modifiers (XDEVICE (FRAME_DEVICE (f))); |
1498 | 1496 |
1499 /* We don't want to handle the focus change now, because we might | 1497 /* We don't want to handle the focus change now, because we might |
1845 XIM_SetGeometry (f); | 1843 XIM_SetGeometry (f); |
1846 #endif | 1844 #endif |
1847 break; | 1845 break; |
1848 | 1846 |
1849 case CreateNotify: | 1847 case CreateNotify: |
1850 printf ("window created\n"); | 1848 break; |
1851 break; | 1849 |
1852 default: | 1850 default: |
1853 break; | 1851 break; |
1854 } | 1852 } |
1855 } | 1853 } |
1856 | 1854 |
2511 /* get the next event from Xt */ | 2509 /* get the next event from Xt */ |
2512 /************************************************************************/ | 2510 /************************************************************************/ |
2513 | 2511 |
2514 static Lisp_Object dispatch_event_queue, dispatch_event_queue_tail; | 2512 static Lisp_Object dispatch_event_queue, dispatch_event_queue_tail; |
2515 | 2513 |
2516 static void | 2514 void |
2517 enqueue_Xt_dispatch_event (Lisp_Object event) | 2515 enqueue_Xt_dispatch_event (Lisp_Object event) |
2518 { | 2516 { |
2519 enqueue_event (event, &dispatch_event_queue, &dispatch_event_queue_tail); | 2517 enqueue_event (event, &dispatch_event_queue, &dispatch_event_queue_tail); |
2520 } | 2518 } |
2521 | 2519 |
3077 } | 3075 } |
3078 } | 3076 } |
3079 | 3077 |
3080 | 3078 |
3081 /************************************************************************/ | 3079 /************************************************************************/ |
3080 /* handle focus changes for native widgets */ | |
3081 /************************************************************************/ | |
3082 static void | |
3083 emacs_Xt_event_widget_focus_in (Widget w, | |
3084 XEvent *event, | |
3085 String *params, | |
3086 Cardinal *num_params) | |
3087 { | |
3088 struct frame* f = | |
3089 x_any_widget_or_parent_to_frame (get_device_from_display (event->xany.display), w); | |
3090 | |
3091 XtSetKeyboardFocus (FRAME_X_SHELL_WIDGET (f), w); | |
3092 } | |
3093 | |
3094 static void | |
3095 emacs_Xt_event_widget_focus_out (Widget w, | |
3096 XEvent *event, | |
3097 String *params, | |
3098 Cardinal *num_params) | |
3099 { | |
3100 } | |
3101 | |
3102 static XtActionsRec widgetActionsList[] = | |
3103 { | |
3104 {"widget-focus-in", emacs_Xt_event_widget_focus_in }, | |
3105 {"widget-focus-out", emacs_Xt_event_widget_focus_out }, | |
3106 }; | |
3107 | |
3108 static void | |
3109 emacs_Xt_event_add_widget_actions (XtAppContext ctx) | |
3110 { | |
3111 XtAppAddActions (ctx, widgetActionsList, 2); | |
3112 } | |
3113 | |
3114 | |
3115 /************************************************************************/ | |
3082 /* initialization */ | 3116 /* initialization */ |
3083 /************************************************************************/ | 3117 /************************************************************************/ |
3084 | 3118 |
3085 void | 3119 void |
3086 syms_of_event_Xt (void) | 3120 syms_of_event_Xt (void) |
3212 XtAppSetTypeConverter (Xt_app_con, XtRString, XtRXimStyles, | 3246 XtAppSetTypeConverter (Xt_app_con, XtRString, XtRXimStyles, |
3213 EmacsXtCvtStringToXIMStyles, | 3247 EmacsXtCvtStringToXIMStyles, |
3214 NULL, 0, | 3248 NULL, 0, |
3215 XtCacheByDisplay, EmacsFreeXIMStyles); | 3249 XtCacheByDisplay, EmacsFreeXIMStyles); |
3216 #endif /* XIM_XLIB */ | 3250 #endif /* XIM_XLIB */ |
3251 /* Add extra actions to native widgets to handle focus and friends. */ | |
3252 emacs_Xt_event_add_widget_actions (Xt_app_con); | |
3217 | 3253 |
3218 /* insert the visual inheritance patch/hack described above */ | 3254 /* insert the visual inheritance patch/hack described above */ |
3219 orig_shell_init_proc = shellClassRec.core_class.initialize; | 3255 orig_shell_init_proc = shellClassRec.core_class.initialize; |
3220 shellClassRec.core_class.initialize = ShellVisualPatch; | 3256 shellClassRec.core_class.initialize = ShellVisualPatch; |
3221 | 3257 |