aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/xterm.c93
1 files changed, 56 insertions, 37 deletions
diff --git a/src/xterm.c b/src/xterm.c
index d0ec3093334..f07c12483ca 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -1355,42 +1355,7 @@ XTframe_rehighlight ()
1355 } 1355 }
1356} 1356}
1357 1357
1358/* Mouse clicks and mouse movement. Rah. */ 1358/* Keyboard processing - modifier keys, vendor-specific keysyms, etc. */
1359#ifdef HAVE_X11
1360
1361/* Given a pixel position (PIX_X, PIX_Y) on the frame F, return
1362 glyph co-ordinates in (*X, *Y). Set *BOUNDS to the rectangle
1363 that the glyph at X, Y occupies, if BOUNDS != 0. */
1364static void
1365pixel_to_glyph_coords (f, pix_x, pix_y, x, y, bounds)
1366 FRAME_PTR f;
1367 register unsigned int pix_x, pix_y;
1368 register int *x, *y;
1369 XRectangle *bounds;
1370{
1371 pix_x = PIXEL_TO_CHAR_COL (f, pix_x);
1372 pix_y = PIXEL_TO_CHAR_ROW (f, pix_y);
1373
1374 if (bounds)
1375 {
1376 bounds->width = FONT_WIDTH (f->display.x->font);
1377 bounds->height = FONT_HEIGHT (f->display.x->font);
1378 bounds->x = CHAR_TO_PIXEL_COL (f, pix_x);
1379 bounds->y = CHAR_TO_PIXEL_ROW (f, pix_y);
1380 }
1381
1382 if (pix_x < 0) pix_x = 0;
1383 else if (pix_x > f->width) pix_x = f->width;
1384
1385 if (pix_y < 0) pix_y = 0;
1386 else if (pix_y > f->height) pix_y = f->height;
1387
1388 *x = pix_x;
1389 *y = pix_y;
1390}
1391
1392/* Any buttons grabbed. */
1393unsigned int x_mouse_grabbed;
1394 1359
1395/* Which modifier keys are on which modifier bits? 1360/* Which modifier keys are on which modifier bits?
1396 1361
@@ -1540,6 +1505,59 @@ x_emacs_to_x_modifiers (state)
1540 | ((state & meta_modifier) ? x_meta_mod_mask : 0)); 1505 | ((state & meta_modifier) ? x_meta_mod_mask : 0));
1541} 1506}
1542 1507
1508/* Return true iff KEYSYM is a vendor-specific keysym that we should
1509 return as a function key. If you add a keysym to this, you should
1510 make sure that the tables make_lispy_event uses contain a suitable
1511 name for it. */
1512static int
1513x_is_vendor_fkey (sym)
1514 KeySym sym;
1515{
1516 return 0
1517#ifdef DXK_Remove
1518 || (sym == DXK_Remove)
1519#endif
1520 ;
1521}
1522
1523
1524/* Mouse clicks and mouse movement. Rah. */
1525#ifdef HAVE_X11
1526
1527/* Given a pixel position (PIX_X, PIX_Y) on the frame F, return
1528 glyph co-ordinates in (*X, *Y). Set *BOUNDS to the rectangle
1529 that the glyph at X, Y occupies, if BOUNDS != 0. */
1530static void
1531pixel_to_glyph_coords (f, pix_x, pix_y, x, y, bounds)
1532 FRAME_PTR f;
1533 register unsigned int pix_x, pix_y;
1534 register int *x, *y;
1535 XRectangle *bounds;
1536{
1537 pix_x = PIXEL_TO_CHAR_COL (f, pix_x);
1538 pix_y = PIXEL_TO_CHAR_ROW (f, pix_y);
1539
1540 if (bounds)
1541 {
1542 bounds->width = FONT_WIDTH (f->display.x->font);
1543 bounds->height = FONT_HEIGHT (f->display.x->font);
1544 bounds->x = CHAR_TO_PIXEL_COL (f, pix_x);
1545 bounds->y = CHAR_TO_PIXEL_ROW (f, pix_y);
1546 }
1547
1548 if (pix_x < 0) pix_x = 0;
1549 else if (pix_x > f->width) pix_x = f->width;
1550
1551 if (pix_y < 0) pix_y = 0;
1552 else if (pix_y > f->height) pix_y = f->height;
1553
1554 *x = pix_x;
1555 *y = pix_y;
1556}
1557
1558/* Any buttons grabbed. */
1559unsigned int x_mouse_grabbed;
1560
1543/* Prepare a mouse-event in *RESULT for placement in the input queue. 1561/* Prepare a mouse-event in *RESULT for placement in the input queue.
1544 1562
1545 If the event is a button press, then note that we have grabbed 1563 If the event is a button press, then note that we have grabbed
@@ -2881,7 +2899,8 @@ XTread_socket (sd, bufp, numchars, waitp, expected)
2881 && (unsigned)(keysym) < XK_KP_Space) 2899 && (unsigned)(keysym) < XK_KP_Space)
2882#endif 2900#endif
2883 || IsKeypadKey (keysym) /* 0xff80 <= x < 0xffbe */ 2901 || IsKeypadKey (keysym) /* 0xff80 <= x < 0xffbe */
2884 || IsFunctionKey (keysym)) /* 0xffbe <= x < 0xffe1 */ 2902 || IsFunctionKey (keysym) /* 0xffbe <= x < 0xffe1 */
2903 || x_is_vendor_fkey (orig_keysym)) /* wherever */
2885 { 2904 {
2886 if (temp_index == sizeof temp_buffer / sizeof (short)) 2905 if (temp_index == sizeof temp_buffer / sizeof (short))
2887 temp_index = 0; 2906 temp_index = 0;