Mercurial > hg > xemacs-beta
comparison src/event-Xt.c @ 272:c5d627a313b1 r21-0b34
Import from CVS: tag r21-0b34
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:28:48 +0200 |
parents | 966663fcf606 |
children | c42ec1d1cded |
comparison
equal
deleted
inserted
replaced
271:c7b7086b0a39 | 272:c5d627a313b1 |
---|---|
118 static Lisp_Object x_keysym_to_emacs_keysym (KeySym keysym, int simple_p); | 118 static Lisp_Object x_keysym_to_emacs_keysym (KeySym keysym, int simple_p); |
119 void emacs_Xt_mapping_action (Widget w, XEvent *event); | 119 void emacs_Xt_mapping_action (Widget w, XEvent *event); |
120 void debug_process_finalization (struct Lisp_Process *p); | 120 void debug_process_finalization (struct Lisp_Process *p); |
121 void emacs_Xt_event_handler (Widget wid, XtPointer closure, XEvent *event, | 121 void emacs_Xt_event_handler (Widget wid, XtPointer closure, XEvent *event, |
122 Boolean *continue_to_dispatch); | 122 Boolean *continue_to_dispatch); |
123 | |
124 #ifdef EPOCH | |
125 void dispatch_epoch_event (struct frame *f, XEvent *event, Lisp_Object type); | |
126 #endif | |
127 | 123 |
128 static int last_quit_check_signal_tick_count; | 124 static int last_quit_check_signal_tick_count; |
129 | 125 |
130 Lisp_Object Qkey_mapping; | 126 Lisp_Object Qkey_mapping; |
131 Lisp_Object Qsans_modifiers; | 127 Lisp_Object Qsans_modifiers; |
710 /* This happens if there is a mismatch between the Xlib of | 706 /* This happens if there is a mismatch between the Xlib of |
711 XEmacs and the Xlib of the X server... | 707 XEmacs and the Xlib of the X server... |
712 | 708 |
713 Let's hard-code in some knowledge of common keysyms introduced | 709 Let's hard-code in some knowledge of common keysyms introduced |
714 in recent X11 releases. Snarfed from X11/keysymdef.h | 710 in recent X11 releases. Snarfed from X11/keysymdef.h |
715 | 711 |
716 Probably we should add some stuff here for X11R6. */ | 712 Probably we should add some stuff here for X11R6. */ |
717 switch (keysym) | 713 switch (keysym) |
718 { | 714 { |
719 case 0xFF95: return KEYSYM ("kp-home"); | 715 case 0xFF95: return KEYSYM ("kp-home"); |
720 case 0xFF96: return KEYSYM ("kp-left"); | 716 case 0xFF96: return KEYSYM ("kp-left"); |
1118 Extbyte *data; | 1114 Extbyte *data; |
1119 unsigned long size, dtype; | 1115 unsigned long size, dtype; |
1120 Lisp_Object l_type = Qnil, l_data = Qnil; | 1116 Lisp_Object l_type = Qnil, l_data = Qnil; |
1121 Lisp_Object l_dndlist = Qnil, l_item = Qnil; | 1117 Lisp_Object l_dndlist = Qnil, l_item = Qnil; |
1122 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; | 1118 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; |
1123 | 1119 |
1124 GCPRO4 (l_type, l_data, l_dndlist, l_item); | 1120 GCPRO4 (l_type, l_data, l_dndlist, l_item); |
1125 | 1121 |
1126 if (! frame) | 1122 if (! frame) |
1127 return 0; /* not for us */ | 1123 return 0; /* not for us */ |
1128 XSETFRAME (emacs_event->channel, frame); | 1124 XSETFRAME (emacs_event->channel, frame); |
1142 if (state & Button5Mask) button = Button5; | 1138 if (state & Button5Mask) button = Button5; |
1143 if (state & Button4Mask) button = Button4; | 1139 if (state & Button4Mask) button = Button4; |
1144 if (state & Button3Mask) button = Button3; | 1140 if (state & Button3Mask) button = Button3; |
1145 if (state & Button2Mask) button = Button2; | 1141 if (state & Button2Mask) button = Button2; |
1146 if (state & Button1Mask) button = Button1; | 1142 if (state & Button1Mask) button = Button1; |
1147 | 1143 |
1148 emacs_event->event.dnd_drop.modifiers = modifiers; | 1144 emacs_event->event.dnd_drop.modifiers = modifiers; |
1149 emacs_event->event.dnd_drop.button = button; | 1145 emacs_event->event.dnd_drop.button = button; |
1150 | 1146 |
1151 DndDropCoordinates(FRAME_X_TEXT_WIDGET(frame), x_event, | 1147 DndDropCoordinates(FRAME_X_TEXT_WIDGET(frame), x_event, |
1152 &(emacs_event->event.dnd_drop.x), | 1148 &(emacs_event->event.dnd_drop.x), |
1153 &(emacs_event->event.dnd_drop.y) ); | 1149 &(emacs_event->event.dnd_drop.y) ); |
1154 | 1150 |
1155 DndGetData(x_event,&data,&size); | 1151 DndGetData(x_event,&data,&size); |
1156 | 1152 |
1197 | 1193 |
1198 UNGCPRO; | 1194 UNGCPRO; |
1199 | 1195 |
1200 break; | 1196 break; |
1201 } | 1197 } |
1202 #endif | 1198 #endif /* HAVE_OFFIX_DND */ |
1203 if (ev->message_type == DEVICE_XATOM_WM_PROTOCOLS (d) | 1199 if (ev->message_type == DEVICE_XATOM_WM_PROTOCOLS (d) |
1204 && ev->data.l[0] == DEVICE_XATOM_WM_TAKE_FOCUS (d) | 1200 && (Atom) (ev->data.l[0]) == DEVICE_XATOM_WM_TAKE_FOCUS (d) |
1205 && ev->data.l[1] == 0) | 1201 && (Atom) (ev->data.l[1]) == 0) |
1206 { | 1202 { |
1207 ev->data.l[1] = DEVICE_X_LAST_SERVER_TIMESTAMP (d); | 1203 ev->data.l[1] = DEVICE_X_LAST_SERVER_TIMESTAMP (d); |
1208 } | 1204 } |
1209 } | 1205 } |
1210 /* fall through */ | 1206 /* fall through */ |
1320 /* both MapNotify and VisibilityNotify can cause this | 1316 /* both MapNotify and VisibilityNotify can cause this |
1321 JV is_visible has the same semantics as f->visible*/ | 1317 JV is_visible has the same semantics as f->visible*/ |
1322 static void | 1318 static void |
1323 change_frame_visibility (struct frame *f, int is_visible) | 1319 change_frame_visibility (struct frame *f, int is_visible) |
1324 { | 1320 { |
1325 Lisp_Object frame = Qnil; | 1321 Lisp_Object frame; |
1326 | 1322 |
1327 XSETFRAME (frame, f); | 1323 XSETFRAME (frame, f); |
1328 | 1324 |
1329 if (!FRAME_VISIBLE_P (f) && is_visible) | 1325 if (!FRAME_VISIBLE_P (f) && is_visible) |
1330 { | 1326 { |
1333 some. A lot of it is not showing a buffer which has changed | 1329 some. A lot of it is not showing a buffer which has changed |
1334 while the frame was iconified. To fix it further requires | 1330 while the frame was iconified. To fix it further requires |
1335 the good 'ol double redisplay structure. */ | 1331 the good 'ol double redisplay structure. */ |
1336 MARK_FRAME_WINDOWS_STRUCTURE_CHANGED (f); | 1332 MARK_FRAME_WINDOWS_STRUCTURE_CHANGED (f); |
1337 va_run_hook_with_args (Qmap_frame_hook, 1, frame); | 1333 va_run_hook_with_args (Qmap_frame_hook, 1, frame); |
1338 #ifdef EPOCH | |
1339 dispatch_epoch_event (f, event, Qx_map); | |
1340 #endif | |
1341 } | 1334 } |
1342 else if (FRAME_VISIBLE_P (f) && !is_visible) | 1335 else if (FRAME_VISIBLE_P (f) && !is_visible) |
1343 { | 1336 { |
1344 FRAME_VISIBLE_P (f) = 0; | 1337 FRAME_VISIBLE_P (f) = 0; |
1345 va_run_hook_with_args (Qunmap_frame_hook, 1, frame); | 1338 va_run_hook_with_args (Qunmap_frame_hook, 1, frame); |
1346 #ifdef EPOCH | |
1347 dispatch_epoch_event (f, event, Qx_unmap); | |
1348 #endif | |
1349 } | 1339 } |
1350 else if (FRAME_VISIBLE_P (f) * is_visible < 0) | 1340 else if (FRAME_VISIBLE_P (f) * is_visible < 0) |
1351 { | 1341 { |
1352 FRAME_VISIBLE_P(f) = - FRAME_VISIBLE_P(f); | 1342 FRAME_VISIBLE_P(f) = - FRAME_VISIBLE_P(f); |
1353 if (FRAME_REPAINT_P(f)) | 1343 if (FRAME_REPAINT_P(f)) |
1354 MARK_FRAME_WINDOWS_STRUCTURE_CHANGED (f); | 1344 MARK_FRAME_WINDOWS_STRUCTURE_CHANGED (f); |
1355 va_run_hook_with_args (Qmap_frame_hook, 1, frame); | 1345 va_run_hook_with_args (Qmap_frame_hook, 1, frame); |
1356 #ifdef EPOCH | |
1357 dispatch_epoch_event (f, event, Qx_map); | |
1358 #endif | |
1359 } | 1346 } |
1360 } | 1347 } |
1361 | 1348 |
1362 static void | 1349 static void |
1363 handle_map_event (struct frame *f, XEvent *event) | 1350 handle_map_event (struct frame *f, XEvent *event) |
1364 { | 1351 { |
1365 Lisp_Object frame = Qnil; | 1352 Lisp_Object frame; |
1366 | 1353 |
1367 XSETFRAME (frame, f); | 1354 XSETFRAME (frame, f); |
1368 if (event->type == MapNotify) | 1355 if (event->type == MapNotify) |
1369 { | 1356 { |
1370 XWindowAttributes xwa; | 1357 XWindowAttributes xwa; |
1431 | 1418 |
1432 static void | 1419 static void |
1433 handle_client_message (struct frame *f, XEvent *event) | 1420 handle_client_message (struct frame *f, XEvent *event) |
1434 { | 1421 { |
1435 struct device *d = XDEVICE (FRAME_DEVICE (f)); | 1422 struct device *d = XDEVICE (FRAME_DEVICE (f)); |
1436 Lisp_Object frame = Qnil; | 1423 Lisp_Object frame; |
1437 | 1424 |
1438 XSETFRAME (frame, f); | 1425 XSETFRAME (frame, f); |
1439 | 1426 |
1440 if (event->xclient.message_type == DEVICE_XATOM_WM_PROTOCOLS (d) && | 1427 if (event->xclient.message_type == DEVICE_XATOM_WM_PROTOCOLS (d) && |
1441 event->xclient.data.l[0] == DEVICE_XATOM_WM_DELETE_WINDOW (d)) | 1428 (Atom) (event->xclient.data.l[0]) == DEVICE_XATOM_WM_DELETE_WINDOW (d)) |
1442 { | 1429 { |
1443 /* WM_DELETE_WINDOW is a misc-user event, but other ClientMessages, | 1430 /* WM_DELETE_WINDOW is a misc-user event, but other ClientMessages, |
1444 such as WM_TAKE_FOCUS, are eval events. That's because delete-window | 1431 such as WM_TAKE_FOCUS, are eval events. That's because delete-window |
1445 was probably executed with a mouse click, while the others could | 1432 was probably executed with a mouse click, while the others could |
1446 have been sent as a result of mouse motion or some other implicit | 1433 have been sent as a result of mouse motion or some other implicit |
1451 */ | 1438 */ |
1452 enqueue_misc_user_event (frame, Qeval, | 1439 enqueue_misc_user_event (frame, Qeval, |
1453 list3 (Qdelete_frame, frame, Qt)); | 1440 list3 (Qdelete_frame, frame, Qt)); |
1454 } | 1441 } |
1455 else if (event->xclient.message_type == DEVICE_XATOM_WM_PROTOCOLS (d) && | 1442 else if (event->xclient.message_type == DEVICE_XATOM_WM_PROTOCOLS (d) && |
1456 event->xclient.data.l[0] == DEVICE_XATOM_WM_TAKE_FOCUS (d)) | 1443 (Atom) event->xclient.data.l[0] == DEVICE_XATOM_WM_TAKE_FOCUS (d)) |
1457 { | 1444 { |
1458 handle_focus_event_1 (f, 1); | 1445 handle_focus_event_1 (f, 1); |
1459 #if 0 | 1446 #if 0 |
1460 /* If there is a dialog box up, focus on it. | 1447 /* If there is a dialog box up, focus on it. |
1461 | 1448 |
1474 XSetInputFocus (XtDisplay (widget), XtWindow (widget), | 1461 XSetInputFocus (XtDisplay (widget), XtWindow (widget), |
1475 RevertToParent, take_focus_timestamp); | 1462 RevertToParent, take_focus_timestamp); |
1476 } | 1463 } |
1477 #endif | 1464 #endif |
1478 } | 1465 } |
1479 #ifdef EPOCH | |
1480 dispatch_epoch_event (f, event, Qx_client_message); | |
1481 #endif | |
1482 } | 1466 } |
1483 | 1467 |
1484 static void | 1468 static void |
1485 emacs_Xt_handle_magic_event (struct Lisp_Event *emacs_event) | 1469 emacs_Xt_handle_magic_event (struct Lisp_Event *emacs_event) |
1486 { | 1470 { |
1505 x_handle_selection_notify (&event->xselection); | 1489 x_handle_selection_notify (&event->xselection); |
1506 break; | 1490 break; |
1507 | 1491 |
1508 case PropertyNotify: | 1492 case PropertyNotify: |
1509 x_handle_property_notify (&event->xproperty); | 1493 x_handle_property_notify (&event->xproperty); |
1510 #ifdef EPOCH | |
1511 dispatch_epoch_event (f, event, Qx_property_change); | |
1512 #endif | |
1513 break; | 1494 break; |
1514 | 1495 |
1515 case Expose: | 1496 case Expose: |
1516 x_redraw_exposed_area (f, event->xexpose.x, event->xexpose.y, | 1497 x_redraw_exposed_area (f, event->xexpose.x, event->xexpose.y, |
1517 event->xexpose.width, event->xexpose.height); | 1498 event->xexpose.width, event->xexpose.height); |
1936 } | 1917 } |
1937 | 1918 |
1938 static void | 1919 static void |
1939 emacs_Xt_select_console (struct console *con) | 1920 emacs_Xt_select_console (struct console *con) |
1940 { | 1921 { |
1941 Lisp_Object console = Qnil; | 1922 Lisp_Object console; |
1942 int infd; | 1923 int infd; |
1943 #ifdef HAVE_GPM | 1924 #ifdef HAVE_GPM |
1944 int mousefd; | 1925 int mousefd; |
1945 #endif | 1926 #endif |
1946 | 1927 |
1969 } | 1950 } |
1970 | 1951 |
1971 static void | 1952 static void |
1972 emacs_Xt_unselect_console (struct console *con) | 1953 emacs_Xt_unselect_console (struct console *con) |
1973 { | 1954 { |
1974 Lisp_Object console = Qnil; | 1955 Lisp_Object console; |
1975 int infd; | 1956 int infd; |
1976 #ifdef HAVE_GPM | 1957 #ifdef HAVE_GPM |
1977 int mousefd; | 1958 int mousefd; |
1978 #endif | 1959 #endif |
1979 | 1960 |
2044 if (w) | 2025 if (w) |
2045 stderr_out (" %s", w->core.widget_class->core_class.class_name); | 2026 stderr_out (" %s", w->core.widget_class->core_class.class_name); |
2046 f = x_any_window_to_frame (get_device_from_display (display), window); | 2027 f = x_any_window_to_frame (get_device_from_display (display), window); |
2047 if (f) | 2028 if (f) |
2048 { | 2029 { |
2049 char *buf = alloca (XSTRING_LENGTH (f->name) + 4); | 2030 char *buf = alloca_array (char, XSTRING_LENGTH (f->name) + 4); |
2050 sprintf (buf, " \"%s\"", XSTRING_DATA (f->name)); | 2031 sprintf (buf, " \"%s\"", XSTRING_DATA (f->name)); |
2051 write_string_to_stdio_stream (stderr, 0, (Bufbyte *) buf, 0, | 2032 write_string_to_stdio_stream (stderr, 0, (Bufbyte *) buf, 0, |
2052 strlen (buf), FORMAT_TERMINAL); | 2033 strlen (buf), FORMAT_TERMINAL); |
2053 } | 2034 } |
2054 stderr_out ("\n"); | 2035 stderr_out ("\n"); |