Mercurial > hg > xemacs-beta
comparison src/event-Xt.c @ 934:c925bacdda60
[xemacs-hg @ 2002-07-29 09:21:12 by michaels]
2002-07-17 Marcus Crestani <crestani@informatik.uni-tuebingen.de>
Markus Kaltenbach <makalten@informatik.uni-tuebingen.de>
Mike Sperber <mike@xemacs.org>
configure flag to turn these changes on: --use-kkcc
First we added a dumpable flag to lrecord_implementation. It shows,
if the object is dumpable and should be processed by the dumper.
* lrecord.h (struct lrecord_implementation): added dumpable flag
(MAKE_LRECORD_IMPLEMENTATION): fitted the different makro definitions
to the new lrecord_implementation and their calls.
Then we changed mark_object, that it no longer needs a mark method for
those types that have pdump descritions.
* alloc.c:
(mark_object): If the object has a description, the new mark algorithm
is called, and the object is marked according to its description.
Otherwise it uses the mark method like before.
These procedures mark objects according to their descriptions. They
are modeled on the corresponding pdumper procedures.
(mark_with_description):
(get_indirect_count):
(structure_size):
(mark_struct_contents):
These procedures still call mark_object, this is needed while there are
Lisp_Objects without descriptions left.
We added pdump descriptions for many Lisp_Objects:
* extents.c: extent_auxiliary_description
* database.c: database_description
* gui.c: gui_item_description
* scrollbar.c: scrollbar_instance_description
* toolbar.c: toolbar_button_description
* event-stream.c: command_builder_description
* mule-charset.c: charset_description
* device-msw.c: devmode_description
* dialog-msw.c: mswindows_dialog_id_description
* eldap.c: ldap_description
* postgresql.c: pgconn_description
pgresult_description
* tooltalk.c: tooltalk_message_description
tooltalk_pattern_description
* ui-gtk.c: emacs_ffi_description
emacs_gtk_object_description
* events.c:
* events.h:
* event-stream.c:
* event-Xt.c:
* event-gtk.c:
* event-tty.c:
To write a pdump description for Lisp_Event, we converted every struct
in the union event to a Lisp_Object. So we created nine new
Lisp_Objects: Lisp_Key_Data, Lisp_Button_Data, Lisp_Motion_Data,
Lisp_Process_Data, Lisp_Timeout_Data, Lisp_Eval_Data,
Lisp_Misc_User_Data, Lisp_Magic_Data, Lisp_Magic_Eval_Data.
We also wrote makro selectors and mutators for the fields of the new
designed Lisp_Event and added everywhere these new abstractions.
We implemented XD_UNION support in (mark_with_description), so
we can describe exspecially console/device specific data with XD_UNION.
To describe with XD_UNION, we added a field to these objects, which
holds the variant type of the object. This field is initialized in
the appendant constructor. The variant is an integer, it has also to
be described in an description, if XD_UNION is used.
XD_UNION is used in following descriptions:
* console.c: console_description
(get_console_variant): returns the variant
(create_console): added variant initialization
* console.h (console_variant): the different console types
* console-impl.h (struct console): added enum console_variant contype
* device.c: device_description
(Fmake_device): added variant initialization
* device-impl.h (struct device): added enum console_variant devtype
* objects.c: image_instance_description
font_instance_description
(Fmake_color_instance): added variant initialization
(Fmake_font_instance): added variant initialization
* objects-impl.h (struct Lisp_Color_Instance): added color_instance_type
* objects-impl.h (struct Lisp_Font_Instance): added font_instance_type
* process.c: process_description
(make_process_internal): added variant initialization
* process.h (process_variant): the different process types
author | michaels |
---|---|
date | Mon, 29 Jul 2002 09:21:25 +0000 |
parents | 79c6ff3eef26 |
children | 345b7d75cab4 |
comparison
equal
deleted
inserted
replaced
933:f6bc42928b34 | 934:c925bacdda60 |
---|---|
1128 set_last_server_timestamp (d, x_event); | 1128 set_last_server_timestamp (d, x_event); |
1129 | 1129 |
1130 switch (x_event->type) | 1130 switch (x_event->type) |
1131 { | 1131 { |
1132 case KeyRelease: | 1132 case KeyRelease: |
1133 x_handle_sticky_modifiers (x_event, d); | 1133 { |
1134 return 0; | 1134 x_handle_sticky_modifiers (x_event, d); |
1135 | 1135 return 0; |
1136 } | |
1136 case KeyPress: | 1137 case KeyPress: |
1137 case ButtonPress: | 1138 case ButtonPress: |
1138 case ButtonRelease: | 1139 case ButtonRelease: |
1139 { | 1140 { |
1140 int modifiers = 0; | 1141 int modifiers = 0; |
1206 { | 1207 { |
1207 Lisp_Object keysym; | 1208 Lisp_Object keysym; |
1208 XKeyEvent *ev = &x_event->xkey; | 1209 XKeyEvent *ev = &x_event->xkey; |
1209 /* This used to compute the frame from the given X window and | 1210 /* This used to compute the frame from the given X window and |
1210 store it here, but we really don't care about the frame. */ | 1211 store it here, but we really don't care about the frame. */ |
1212 #ifdef USE_KKCC | |
1213 SET_EVENT_CHANNEL (emacs_event, DEVICE_CONSOLE (d)); | |
1214 #else /* not USE_KKCC */ | |
1211 emacs_event->channel = DEVICE_CONSOLE (d); | 1215 emacs_event->channel = DEVICE_CONSOLE (d); |
1216 #endif /* not USE_KKCC */ | |
1212 keysym = x_to_emacs_keysym (&x_event->xkey, 0); | 1217 keysym = x_to_emacs_keysym (&x_event->xkey, 0); |
1213 | 1218 |
1214 /* If the emacs keysym is nil, then that means that the X | 1219 /* If the emacs keysym is nil, then that means that the X |
1215 keysym was either a Modifier or NoSymbol, which | 1220 keysym was either a Modifier or NoSymbol, which |
1216 probably means that we're in the midst of reading a | 1221 probably means that we're in the midst of reading a |
1250 KeySym bot = XLookupKeysym (ev, Mode_switch_p ? 2 : 0); | 1255 KeySym bot = XLookupKeysym (ev, Mode_switch_p ? 2 : 0); |
1251 KeySym top = XLookupKeysym (ev, Mode_switch_p ? 3 : 1); | 1256 KeySym top = XLookupKeysym (ev, Mode_switch_p ? 3 : 1); |
1252 if (top && bot && top != bot) | 1257 if (top && bot && top != bot) |
1253 modifiers &= ~XEMACS_MOD_SHIFT; | 1258 modifiers &= ~XEMACS_MOD_SHIFT; |
1254 } | 1259 } |
1260 #ifdef USE_KKCC | |
1261 set_event_type (emacs_event, key_press_event); | |
1262 SET_EVENT_TIMESTAMP (emacs_event, ev->time); | |
1263 XSET_KEY_DATA_MODIFIERS (EVENT_DATA (emacs_event), modifiers); | |
1264 XSET_KEY_DATA_KEYSYM (EVENT_DATA (emacs_event), keysym); | |
1265 #else /* not USE_KKCC */ | |
1255 emacs_event->event_type = key_press_event; | 1266 emacs_event->event_type = key_press_event; |
1256 emacs_event->timestamp = ev->time; | 1267 emacs_event->timestamp = ev->time; |
1257 emacs_event->event.key.modifiers = modifiers; | 1268 emacs_event->event.key.modifiers = modifiers; |
1258 emacs_event->event.key.keysym = keysym; | 1269 emacs_event->event.key.keysym = keysym; |
1270 #endif /* not USE_KKCC */ | |
1259 } | 1271 } |
1260 else /* Mouse press/release event */ | 1272 else /* Mouse press/release event */ |
1261 { | 1273 { |
1262 XButtonEvent *ev = &x_event->xbutton; | 1274 XButtonEvent *ev = &x_event->xbutton; |
1263 struct frame *frame = x_window_to_frame (d, ev->window); | 1275 struct frame *frame = x_window_to_frame (d, ev->window); |
1264 | 1276 |
1265 if (! frame) | 1277 if (! frame) |
1266 return 0; /* not for us */ | 1278 return 0; /* not for us */ |
1279 #ifdef USE_KKCC | |
1280 set_event_type (emacs_event, (x_event->type == ButtonPress) ? | |
1281 button_press_event : button_release_event); | |
1282 SET_EVENT_CHANNEL (emacs_event, wrap_frame(frame)); | |
1283 | |
1284 XSET_BUTTON_DATA_MODIFIERS (EVENT_DATA (emacs_event), modifiers); | |
1285 SET_EVENT_TIMESTAMP (emacs_event, ev->time); | |
1286 XSET_BUTTON_DATA_BUTTON (EVENT_DATA (emacs_event), ev->button); | |
1287 XSET_BUTTON_DATA_X (EVENT_DATA (emacs_event), ev->x); | |
1288 XSET_BUTTON_DATA_Y (EVENT_DATA (emacs_event), ev->y); | |
1289 #else /* not USE_KKCC */ | |
1267 emacs_event->channel = wrap_frame (frame); | 1290 emacs_event->channel = wrap_frame (frame); |
1268 | |
1269 emacs_event->event_type = (x_event->type == ButtonPress) ? | 1291 emacs_event->event_type = (x_event->type == ButtonPress) ? |
1270 button_press_event : button_release_event; | 1292 button_press_event : button_release_event; |
1271 | 1293 |
1272 emacs_event->event.button.modifiers = modifiers; | 1294 emacs_event->event.button.modifiers = modifiers; |
1273 emacs_event->timestamp = ev->time; | 1295 emacs_event->timestamp = ev->time; |
1274 emacs_event->event.button.button = ev->button; | 1296 emacs_event->event.button.button = ev->button; |
1275 emacs_event->event.button.x = ev->x; | 1297 emacs_event->event.button.x = ev->x; |
1276 emacs_event->event.button.y = ev->y; | 1298 emacs_event->event.button.y = ev->y; |
1299 #endif /* not USE_KKCC */ | |
1277 /* because we don't seem to get a FocusIn event for button clicks | 1300 /* because we don't seem to get a FocusIn event for button clicks |
1278 when a widget-glyph is selected we will assume that we want the | 1301 when a widget-glyph is selected we will assume that we want the |
1279 focus if a button gets pressed. */ | 1302 focus if a button gets pressed. */ |
1280 if (x_event->type == ButtonPress) | 1303 if (x_event->type == ButtonPress) |
1281 handle_focus_event_1 (frame, 1); | 1304 handle_focus_event_1 (frame, 1); |
1308 &event2.x, &event2.y, | 1331 &event2.x, &event2.y, |
1309 &event2.state)) | 1332 &event2.state)) |
1310 ev = &event2; /* only one structure copy */ | 1333 ev = &event2; /* only one structure copy */ |
1311 | 1334 |
1312 DEVICE_X_MOUSE_TIMESTAMP (d) = ev->time; | 1335 DEVICE_X_MOUSE_TIMESTAMP (d) = ev->time; |
1313 | 1336 #ifdef USE_KKCC |
1337 SET_EVENT_CHANNEL (emacs_event, wrap_frame(frame)); | |
1338 set_event_type (emacs_event, pointer_motion_event); | |
1339 SET_EVENT_TIMESTAMP (emacs_event, ev->time); | |
1340 XSET_MOTION_DATA_X (EVENT_DATA (emacs_event), ev->x); | |
1341 XSET_MOTION_DATA_Y (EVENT_DATA (emacs_event), ev->y); | |
1342 #else /* not USE_KKCC */ | |
1314 emacs_event->channel = wrap_frame (frame); | 1343 emacs_event->channel = wrap_frame (frame); |
1315 emacs_event->event_type = pointer_motion_event; | 1344 emacs_event->event_type = pointer_motion_event; |
1316 emacs_event->timestamp = ev->time; | 1345 emacs_event->timestamp = ev->time; |
1317 emacs_event->event.motion.x = ev->x; | 1346 emacs_event->event.motion.x = ev->x; |
1318 emacs_event->event.motion.y = ev->y; | 1347 emacs_event->event.motion.y = ev->y; |
1348 #endif /* not USE_KKCC */ | |
1319 if (ev->state & ShiftMask) modifiers |= XEMACS_MOD_SHIFT; | 1349 if (ev->state & ShiftMask) modifiers |= XEMACS_MOD_SHIFT; |
1320 if (ev->state & ControlMask) modifiers |= XEMACS_MOD_CONTROL; | 1350 if (ev->state & ControlMask) modifiers |= XEMACS_MOD_CONTROL; |
1321 if (ev->state & xd->MetaMask) modifiers |= XEMACS_MOD_META; | 1351 if (ev->state & xd->MetaMask) modifiers |= XEMACS_MOD_META; |
1322 if (ev->state & xd->SuperMask) modifiers |= XEMACS_MOD_SUPER; | 1352 if (ev->state & xd->SuperMask) modifiers |= XEMACS_MOD_SUPER; |
1323 if (ev->state & xd->HyperMask) modifiers |= XEMACS_MOD_HYPER; | 1353 if (ev->state & xd->HyperMask) modifiers |= XEMACS_MOD_HYPER; |
1327 if (ev->state & Button3Mask) modifiers |= XEMACS_MOD_BUTTON3; | 1357 if (ev->state & Button3Mask) modifiers |= XEMACS_MOD_BUTTON3; |
1328 if (ev->state & Button4Mask) modifiers |= XEMACS_MOD_BUTTON4; | 1358 if (ev->state & Button4Mask) modifiers |= XEMACS_MOD_BUTTON4; |
1329 if (ev->state & Button5Mask) modifiers |= XEMACS_MOD_BUTTON5; | 1359 if (ev->state & Button5Mask) modifiers |= XEMACS_MOD_BUTTON5; |
1330 /* Currently ignores Shift_Lock but probably shouldn't | 1360 /* Currently ignores Shift_Lock but probably shouldn't |
1331 (but it definitely should ignore Caps_Lock). */ | 1361 (but it definitely should ignore Caps_Lock). */ |
1362 #ifdef USE_KKCC | |
1363 XSET_MOTION_DATA_MODIFIERS (EVENT_DATA (emacs_event), modifiers); | |
1364 #else /* not USE_KKCC */ | |
1332 emacs_event->event.motion.modifiers = modifiers; | 1365 emacs_event->event.motion.modifiers = modifiers; |
1366 #endif /* not USE_KKCC */ | |
1333 } | 1367 } |
1334 break; | 1368 break; |
1335 | 1369 |
1336 case ClientMessage: | 1370 case ClientMessage: |
1337 { | 1371 { |
1354 | 1388 |
1355 if (! frame) | 1389 if (! frame) |
1356 return 0; /* not for us */ | 1390 return 0; /* not for us */ |
1357 | 1391 |
1358 GCPRO4 (l_type, l_data, l_dndlist, l_item); | 1392 GCPRO4 (l_type, l_data, l_dndlist, l_item); |
1393 #ifdef USE_KKCC | |
1394 set_event_type (emacs_event, misc_user_event); | |
1395 SET_EVENT_CHANNEL (emacs_event, wrap_frame(frame)); | |
1396 SET_EVENT_TIMESTAMP (emacs_event, DEVICE_X_LAST_SERVER_TIMESTAMP (d)); | |
1397 #else /* not USE_KKCC */ | |
1359 emacs_event->channel = wrap_frame (frame); | 1398 emacs_event->channel = wrap_frame (frame); |
1360 | |
1361 emacs_event->event_type = misc_user_event; | 1399 emacs_event->event_type = misc_user_event; |
1362 emacs_event->timestamp = DEVICE_X_LAST_SERVER_TIMESTAMP (d); | 1400 emacs_event->timestamp = DEVICE_X_LAST_SERVER_TIMESTAMP (d); |
1363 | 1401 #endif /* not USE_KKCC */ |
1364 state=DndDragButtons(x_event); | 1402 state=DndDragButtons(x_event); |
1365 | 1403 |
1366 if (state & ShiftMask) modifiers |= XEMACS_MOD_SHIFT; | 1404 if (state & ShiftMask) modifiers |= XEMACS_MOD_SHIFT; |
1367 if (state & ControlMask) modifiers |= XEMACS_MOD_CONTROL; | 1405 if (state & ControlMask) modifiers |= XEMACS_MOD_CONTROL; |
1368 if (state & xd->MetaMask) modifiers |= XEMACS_MOD_META; | 1406 if (state & xd->MetaMask) modifiers |= XEMACS_MOD_META; |
1379 if (state & Button4Mask) button = Button4; | 1417 if (state & Button4Mask) button = Button4; |
1380 if (state & Button3Mask) button = Button3; | 1418 if (state & Button3Mask) button = Button3; |
1381 if (state & Button2Mask) button = Button2; | 1419 if (state & Button2Mask) button = Button2; |
1382 if (state & Button1Mask) button = Button1; | 1420 if (state & Button1Mask) button = Button1; |
1383 | 1421 |
1422 #ifdef USE_KKCC | |
1423 XSET_MISC_USER_DATA_MODIFIERS (EVENT_DATA (emacs_event), modifiers); | |
1424 XSET_MISC_USER_DATA_BUTTON (EVENT_DATA (emacs_event), button); | |
1425 | |
1426 DndDropCoordinates(FRAME_X_TEXT_WIDGET(frame), x_event, | |
1427 &(XMISC_USER_DATA_X (EVENT_DATA (emacs_event))), | |
1428 &(XMISC_USER_DATA_Y (EVENT_DATA (emacs_event))) ); | |
1429 #else /* not USE_KKCC */ | |
1384 emacs_event->event.misc.modifiers = modifiers; | 1430 emacs_event->event.misc.modifiers = modifiers; |
1385 emacs_event->event.misc.button = button; | 1431 emacs_event->event.misc.button = button; |
1386 | 1432 |
1387 DndDropCoordinates(FRAME_X_TEXT_WIDGET(frame), x_event, | 1433 DndDropCoordinates(FRAME_X_TEXT_WIDGET(frame), x_event, |
1388 &(emacs_event->event.misc.x), | 1434 &(emacs_event->event.misc.x), |
1389 &(emacs_event->event.misc.y) ); | 1435 &(emacs_event->event.misc.y) ); |
1390 | 1436 #endif /* not USE_KKCC */ |
1391 DndGetData(x_event,&data,&size); | 1437 DndGetData(x_event,&data,&size); |
1392 | 1438 |
1393 dtype=DndDataType(x_event); | 1439 dtype=DndDataType(x_event); |
1394 switch (dtype) | 1440 switch (dtype) |
1395 { | 1441 { |
1461 Qbinary) ) ); | 1507 Qbinary) ) ); |
1462 l_type = Qdragdrop_MIME; | 1508 l_type = Qdragdrop_MIME; |
1463 break; | 1509 break; |
1464 } | 1510 } |
1465 | 1511 |
1512 #ifdef USE_KKCC | |
1513 XSET_MISC_USER_DATA_FUNCTION (EVENT_DATA (emacs_event), Qdragdrop_drop_dispatch); | |
1514 XSET_MISC_USER_DATA_OBJECT (EVENT_DATA (emacs_event), Fcons (l_type, l_dndlist)); | |
1515 #else /* not USE_KKCC */ | |
1466 emacs_event->event.misc.function = Qdragdrop_drop_dispatch; | 1516 emacs_event->event.misc.function = Qdragdrop_drop_dispatch; |
1467 emacs_event->event.misc.object = Fcons (l_type, l_dndlist); | 1517 emacs_event->event.misc.object = Fcons (l_type, l_dndlist); |
1518 #endif /* not USE_KKCC */ | |
1468 | 1519 |
1469 UNGCPRO; | 1520 UNGCPRO; |
1470 | 1521 |
1471 break; | 1522 break; |
1472 } | 1523 } |
1482 | 1533 |
1483 default: /* it's a magic event */ | 1534 default: /* it's a magic event */ |
1484 { | 1535 { |
1485 struct frame *frame; | 1536 struct frame *frame; |
1486 Window w; | 1537 Window w; |
1538 #ifdef USE_KKCC | |
1539 XEvent *x_event_copy; | |
1540 SET_EVENT_TYPE (emacs_event, magic_event); | |
1541 x_event_copy = &XMAGIC_DATA_X_EVENT (EVENT_DATA (emacs_event)); | |
1542 #else /* not USE_KKCC */ | |
1487 XEvent *x_event_copy = &emacs_event->event.magic.underlying_x_event; | 1543 XEvent *x_event_copy = &emacs_event->event.magic.underlying_x_event; |
1544 #endif /* not USE_KKCC */ | |
1488 | 1545 |
1489 #define FROB(event_member, window_member) \ | 1546 #define FROB(event_member, window_member) \ |
1490 x_event_copy->event_member = x_event->event_member; \ | 1547 x_event_copy->event_member = x_event->event_member; \ |
1491 w = x_event->event_member.window_member | 1548 w = x_event->event_member.window_member |
1492 | 1549 |
1517 frame = x_any_window_to_frame (d, w); | 1574 frame = x_any_window_to_frame (d, w); |
1518 | 1575 |
1519 if (!frame) | 1576 if (!frame) |
1520 return 0; | 1577 return 0; |
1521 | 1578 |
1579 #ifdef USE_KKCC | |
1580 SET_EVENT_TYPE (emacs_event, magic_event); | |
1581 SET_EVENT_CHANNEL (emacs_event, wrap_frame(frame)); | |
1582 XSET_MAGIC_DATA_X_EVENT (EVENT_DATA(emacs_event), *x_event_copy); | |
1583 #else /* not USE_KKCC */ | |
1522 emacs_event->event_type = magic_event; | 1584 emacs_event->event_type = magic_event; |
1523 emacs_event->channel = wrap_frame (frame); | 1585 emacs_event->channel = wrap_frame (frame); |
1524 | 1586 #endif /* not USE_KKCC */ |
1525 break; | 1587 break; |
1526 } | 1588 } |
1527 } | 1589 } |
1528 return 1; | 1590 return 1; |
1529 } | 1591 } |
1615 void | 1677 void |
1616 enqueue_focus_event (Widget wants_it, Lisp_Object frame, int in_p) | 1678 enqueue_focus_event (Widget wants_it, Lisp_Object frame, int in_p) |
1617 { | 1679 { |
1618 Lisp_Object emacs_event = Fmake_event (Qnil, Qnil); | 1680 Lisp_Object emacs_event = Fmake_event (Qnil, Qnil); |
1619 Lisp_Event *ev = XEVENT (emacs_event); | 1681 Lisp_Event *ev = XEVENT (emacs_event); |
1682 #ifdef USE_KKCC | |
1683 XEvent *x_event = &XMAGIC_DATA_X_EVENT(EVENT_DATA(ev)); | |
1684 #else /* not USE_KKCC */ | |
1620 XEvent *x_event = &ev->event.magic.underlying_x_event; | 1685 XEvent *x_event = &ev->event.magic.underlying_x_event; |
1686 #endif /* not USE_KKCC */ | |
1621 | 1687 |
1622 x_event->type = in_p ? FocusIn : FocusOut; | 1688 x_event->type = in_p ? FocusIn : FocusOut; |
1623 x_event->xfocus.window = XtWindow (wants_it); | 1689 x_event->xfocus.window = XtWindow (wants_it); |
1624 | 1690 |
1691 #ifdef USE_KKCC | |
1692 SET_EVENT_CHANNEL(ev, frame); | |
1693 /* SET_EVENT_TYPE(ev, magic_event); */ | |
1694 #else /* not USE_KKCC */ | |
1625 ev->channel = frame; | 1695 ev->channel = frame; |
1626 ev->event_type = magic_event; | 1696 ev->event_type = magic_event; |
1697 #endif /* not USE_KKCC */ | |
1627 | 1698 |
1628 enqueue_Xt_dispatch_event (emacs_event); | 1699 enqueue_Xt_dispatch_event (emacs_event); |
1629 } | 1700 } |
1630 | 1701 |
1631 /* The idea here is that when a widget glyph gets unmapped we don't | 1702 /* The idea here is that when a widget glyph gets unmapped we don't |
1902 emacs_Xt_format_magic_event (Lisp_Event *event, Lisp_Object pstream) | 1973 emacs_Xt_format_magic_event (Lisp_Event *event, Lisp_Object pstream) |
1903 { | 1974 { |
1904 Lisp_Object console = CDFW_CONSOLE (EVENT_CHANNEL (event)); | 1975 Lisp_Object console = CDFW_CONSOLE (EVENT_CHANNEL (event)); |
1905 if (CONSOLE_X_P (XCONSOLE (console))) | 1976 if (CONSOLE_X_P (XCONSOLE (console))) |
1906 write_c_string | 1977 write_c_string |
1978 #ifdef USE_KKCC | |
1979 (pstream, x_event_name ((XMAGIC_DATA_X_EVENT (EVENT_DATA(event))).type)); | |
1980 #else /* not USE_KKCC */ | |
1907 (pstream, x_event_name (event->event.magic.underlying_x_event.type)); | 1981 (pstream, x_event_name (event->event.magic.underlying_x_event.type)); |
1982 #endif /* not USE_KKCC */ | |
1908 } | 1983 } |
1909 | 1984 |
1910 static int | 1985 static int |
1911 emacs_Xt_compare_magic_event (Lisp_Event *e1, Lisp_Event *e2) | 1986 emacs_Xt_compare_magic_event (Lisp_Event *e1, Lisp_Event *e2) |
1912 { | 1987 { |
1913 if (CONSOLE_X_P (XCONSOLE (CDFW_CONSOLE (EVENT_CHANNEL (e1)))) && | 1988 if (CONSOLE_X_P (XCONSOLE (CDFW_CONSOLE (EVENT_CHANNEL (e1)))) && |
1914 CONSOLE_X_P (XCONSOLE (CDFW_CONSOLE (EVENT_CHANNEL (e2))))) | 1989 CONSOLE_X_P (XCONSOLE (CDFW_CONSOLE (EVENT_CHANNEL (e2))))) |
1990 #ifdef USE_KKCC | |
1991 return ((XMAGIC_DATA_X_EVENT (EVENT_DATA(e1))).xany.serial == | |
1992 (XMAGIC_DATA_X_EVENT (EVENT_DATA(e2))).xany.serial); | |
1993 #else /* not USE_KKCC */ | |
1915 return (e1->event.magic.underlying_x_event.xany.serial == | 1994 return (e1->event.magic.underlying_x_event.xany.serial == |
1916 e2->event.magic.underlying_x_event.xany.serial); | 1995 e2->event.magic.underlying_x_event.xany.serial); |
1996 #endif /* not USE_KKCC */ | |
1917 if (CONSOLE_X_P (XCONSOLE (CDFW_CONSOLE (EVENT_CHANNEL (e1)))) || | 1997 if (CONSOLE_X_P (XCONSOLE (CDFW_CONSOLE (EVENT_CHANNEL (e1)))) || |
1918 CONSOLE_X_P (XCONSOLE (CDFW_CONSOLE (EVENT_CHANNEL (e2))))) | 1998 CONSOLE_X_P (XCONSOLE (CDFW_CONSOLE (EVENT_CHANNEL (e2))))) |
1919 return 0; | 1999 return 0; |
1920 return 1; | 2000 return 1; |
1921 } | 2001 } |
1923 static Hashcode | 2003 static Hashcode |
1924 emacs_Xt_hash_magic_event (Lisp_Event *e) | 2004 emacs_Xt_hash_magic_event (Lisp_Event *e) |
1925 { | 2005 { |
1926 Lisp_Object console = CDFW_CONSOLE (EVENT_CHANNEL (e)); | 2006 Lisp_Object console = CDFW_CONSOLE (EVENT_CHANNEL (e)); |
1927 if (CONSOLE_X_P (XCONSOLE (console))) | 2007 if (CONSOLE_X_P (XCONSOLE (console))) |
2008 #ifdef USE_KKCC | |
2009 return (XMAGIC_DATA_X_EVENT (EVENT_DATA(e))).xany.serial; | |
2010 #else /* not USE_KKCC */ | |
1928 return e->event.magic.underlying_x_event.xany.serial; | 2011 return e->event.magic.underlying_x_event.xany.serial; |
2012 #endif /* not USE_KKCC */ | |
1929 return 0; | 2013 return 0; |
1930 } | 2014 } |
1931 | 2015 |
1932 static void | 2016 static void |
1933 emacs_Xt_handle_magic_event (Lisp_Event *emacs_event) | 2017 emacs_Xt_handle_magic_event (Lisp_Event *emacs_event) |
1934 { | 2018 { |
1935 /* This function can GC */ | 2019 /* This function can GC */ |
2020 #ifdef USE_KKCC | |
2021 XEvent *event = &XMAGIC_DATA_X_EVENT (EVENT_DATA(emacs_event)); | |
2022 #else /* not USE_KKCC */ | |
1936 XEvent *event = &emacs_event->event.magic.underlying_x_event; | 2023 XEvent *event = &emacs_event->event.magic.underlying_x_event; |
2024 #endif /* not USE_KKCC */ | |
1937 struct frame *f = XFRAME (EVENT_CHANNEL (emacs_event)); | 2025 struct frame *f = XFRAME (EVENT_CHANNEL (emacs_event)); |
1938 | 2026 |
1939 if (!FRAME_LIVE_P (f) || DEVICE_X_BEING_DELETED (XDEVICE (FRAME_DEVICE (f)))) | 2027 if (!FRAME_LIVE_P (f) || DEVICE_X_BEING_DELETED (XDEVICE (FRAME_DEVICE (f)))) |
1940 return; | 2028 return; |
1941 | 2029 |
1942 switch (event->type) | 2030 switch (event->type) |
1943 { | 2031 { |
1944 case SelectionRequest: | 2032 case SelectionRequest: |
1945 x_handle_selection_request (&event->xselectionrequest); | 2033 x_handle_selection_request (&event->xselectionrequest); |
1946 break; | 2034 break; |
1947 | 2035 |
1948 case SelectionClear: | 2036 case SelectionClear: |
1949 x_handle_selection_clear (&event->xselectionclear); | 2037 x_handle_selection_clear (&event->xselectionclear); |
1950 break; | 2038 break; |
1951 | 2039 |
1952 case SelectionNotify: | 2040 case SelectionNotify: |
1953 x_handle_selection_notify (&event->xselection); | 2041 x_handle_selection_notify (&event->xselection); |
1954 break; | 2042 break; |
1955 | 2043 |
1956 case PropertyNotify: | 2044 case PropertyNotify: |
1957 x_handle_property_notify (&event->xproperty); | 2045 x_handle_property_notify (&event->xproperty); |
1958 break; | 2046 break; |
1959 | 2047 |
1960 case Expose: | 2048 case Expose: |
1961 if (!check_for_ignored_expose (f, event->xexpose.x, event->xexpose.y, | 2049 if (!check_for_ignored_expose (f, event->xexpose.x, event->xexpose.y, |
1962 event->xexpose.width, event->xexpose.height) | 2050 event->xexpose.width, event->xexpose.height) |
1963 && | 2051 && |
1964 !find_matching_subwindow (f, event->xexpose.x, event->xexpose.y, | 2052 !find_matching_subwindow (f, event->xexpose.x, event->xexpose.y, |
2180 Xt_timeout_to_emacs_event (Lisp_Event *emacs_event) | 2268 Xt_timeout_to_emacs_event (Lisp_Event *emacs_event) |
2181 { | 2269 { |
2182 struct Xt_timeout *timeout = completed_timeouts; | 2270 struct Xt_timeout *timeout = completed_timeouts; |
2183 assert (timeout); | 2271 assert (timeout); |
2184 completed_timeouts = completed_timeouts->next; | 2272 completed_timeouts = completed_timeouts->next; |
2273 /* timeout events have nil as channel */ | |
2274 #ifdef USE_KKCC | |
2275 set_event_type(emacs_event, timeout_event); | |
2276 SET_EVENT_TIMESTAMP_ZERO (emacs_event); /* #### wrong!! */ | |
2277 XSET_TIMEOUT_DATA_INTERVAL_ID (EVENT_DATA (emacs_event), timeout->id); | |
2278 XSET_TIMEOUT_DATA_FUNCTION (EVENT_DATA (emacs_event), Qnil); | |
2279 XSET_TIMEOUT_DATA_OBJECT (EVENT_DATA (emacs_event), Qnil); | |
2280 #else /* not USE_KKCC */ | |
2185 emacs_event->event_type = timeout_event; | 2281 emacs_event->event_type = timeout_event; |
2186 /* timeout events have nil as channel */ | |
2187 emacs_event->timestamp = 0; /* #### wrong!! */ | 2282 emacs_event->timestamp = 0; /* #### wrong!! */ |
2188 emacs_event->event.timeout.interval_id = timeout->id; | 2283 emacs_event->event.timeout.interval_id = timeout->id; |
2189 emacs_event->event.timeout.function = Qnil; | 2284 emacs_event->event.timeout.function = Qnil; |
2190 emacs_event->event.timeout.object = Qnil; | 2285 emacs_event->event.timeout.object = Qnil; |
2286 #endif /* not USE_KKCC */ | |
2191 Blocktype_free (the_Xt_timeout_blocktype, timeout); | 2287 Blocktype_free (the_Xt_timeout_blocktype, timeout); |
2192 } | 2288 } |
2193 | 2289 |
2194 | 2290 |
2195 /************************************************************************/ | 2291 /************************************************************************/ |
2439 if (PROCESSP (process)) | 2535 if (PROCESSP (process)) |
2440 { | 2536 { |
2441 filedesc_with_input[i] = Qnil; | 2537 filedesc_with_input[i] = Qnil; |
2442 process_events_occurred--; | 2538 process_events_occurred--; |
2443 /* process events have nil as channel */ | 2539 /* process events have nil as channel */ |
2540 #ifdef USE_KKCC | |
2541 set_event_type (emacs_event, process_event); | |
2542 SET_EVENT_TIMESTAMP_ZERO (emacs_event); /* #### */ | |
2543 XSET_PROCESS_DATA_PROCESS (EVENT_DATA (emacs_event), process); | |
2544 #else /* not USE_KKCC */ | |
2444 emacs_event->event_type = process_event; | 2545 emacs_event->event_type = process_event; |
2445 emacs_event->timestamp = 0; /* #### */ | 2546 emacs_event->timestamp = 0; /* #### */ |
2446 emacs_event->event.process.process = process; | 2547 emacs_event->event.process.process = process; |
2548 #endif /* not USE_KKCC */ | |
2447 return; | 2549 return; |
2448 } | 2550 } |
2449 } | 2551 } |
2450 abort (); | 2552 abort (); |
2451 } | 2553 } |
2767 signal_special_Xt_user_event (Lisp_Object channel, Lisp_Object function, | 2869 signal_special_Xt_user_event (Lisp_Object channel, Lisp_Object function, |
2768 Lisp_Object object) | 2870 Lisp_Object object) |
2769 { | 2871 { |
2770 Lisp_Object event = Fmake_event (Qnil, Qnil); | 2872 Lisp_Object event = Fmake_event (Qnil, Qnil); |
2771 | 2873 |
2874 #ifdef USE_KKCC | |
2875 XSET_EVENT_TYPE (event, misc_user_event); | |
2876 XSET_EVENT_CHANNEL (event, channel); | |
2877 XSET_MISC_USER_DATA_FUNCTION (XEVENT_DATA (event), function); | |
2878 XSET_MISC_USER_DATA_OBJECT (XEVENT_DATA (event), object); | |
2879 #else /* not USE_KKCC */ | |
2772 XEVENT (event)->event_type = misc_user_event; | 2880 XEVENT (event)->event_type = misc_user_event; |
2773 XEVENT (event)->channel = channel; | 2881 XEVENT (event)->channel = channel; |
2774 XEVENT (event)->event.eval.function = function; | 2882 XEVENT (event)->event.eval.function = function; |
2775 XEVENT (event)->event.eval.object = object; | 2883 XEVENT (event)->event.eval.object = object; |
2776 | 2884 #endif /* not USE_KKCC */ |
2777 enqueue_Xt_dispatch_event (event); | 2885 enqueue_Xt_dispatch_event (event); |
2778 } | 2886 } |
2779 | 2887 |
2780 static void | 2888 static void |
2781 emacs_Xt_next_event (Lisp_Event *emacs_event) | 2889 emacs_Xt_next_event (Lisp_Event *emacs_event) |
2842 else if (fake_event_occurred) | 2950 else if (fake_event_occurred) |
2843 { | 2951 { |
2844 /* A dummy event, so that a cycle of the command loop will occur. */ | 2952 /* A dummy event, so that a cycle of the command loop will occur. */ |
2845 fake_event_occurred = 0; | 2953 fake_event_occurred = 0; |
2846 /* eval events have nil as channel */ | 2954 /* eval events have nil as channel */ |
2955 #ifdef USE_KKCC | |
2956 set_event_type (emacs_event, eval_event); | |
2957 XSET_EVAL_DATA_FUNCTION (EVENT_DATA (emacs_event), Qidentity); | |
2958 XSET_EVAL_DATA_OBJECT (EVENT_DATA (emacs_event), Qnil); | |
2959 #else /* not USE_KKCC */ | |
2847 emacs_event->event_type = eval_event; | 2960 emacs_event->event_type = eval_event; |
2848 emacs_event->event.eval.function = Qidentity; | 2961 emacs_event->event.eval.function = Qidentity; |
2849 emacs_event->event.eval.object = Qnil; | 2962 emacs_event->event.eval.object = Qnil; |
2963 #endif /* not USE_KKCC */ | |
2850 } | 2964 } |
2851 else /* if (process_events_occurred) */ | 2965 else /* if (process_events_occurred) */ |
2852 Xt_process_to_emacs_event (emacs_event); | 2966 Xt_process_to_emacs_event (emacs_event); |
2853 | 2967 |
2854 /* No need to call XFilterEvent; Xt does it for us */ | 2968 /* No need to call XFilterEvent; Xt does it for us */ |