aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1994-09-16 09:23:15 +0000
committerRichard M. Stallman1994-09-16 09:23:15 +0000
commit6ccf47d10f6a4b178217b576a8aec4d2a1513c67 (patch)
treedcb2fe015e07e8375d43816405e79260264552a9 /src
parent3f8600ae72e5ddf899f611475fd72603e2430645 (diff)
downloademacs-6ccf47d10f6a4b178217b576a8aec4d2a1513c67.tar.gz
emacs-6ccf47d10f6a4b178217b576a8aec4d2a1513c67.zip
Delete X11 conditionals.
(XTupdate_end, XTupdate_begin, XTclear_end_of_line) (XTclear_frame, XRINGBELL, stufflines, scraplines, dumprectangle) (XTread_socket, x_draw_box, clear_cursor, refreshicon, x_iconify_frame) (x_bitmap_icon, x_text_icon, x_new_font, x_term_init) (x_calc_absolute_position, x_set_window_size) (x_make_frame_visible, x_make_frame_invisible): Delete X10 code. (dumpqueue, x_do_pending_expose, dumpborder, XEvent, x_read_exposes) (enqueue_event, dequeue_event, queue_event_count) (mouse_event_pending_p, x_set_resize_hint): Delete X10 versions.
Diffstat (limited to 'src')
-rw-r--r--src/xterm.c886
1 files changed, 16 insertions, 870 deletions
diff --git a/src/xterm.c b/src/xterm.c
index ac7033544ac..21e9ab7f63a 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -99,12 +99,7 @@ extern void _XEditResCheckMessages ();
99#endif 99#endif
100#endif 100#endif
101 101
102#ifdef HAVE_X11
103#define XMapWindow XMapRaised /* Raise them when mapping. */ 102#define XMapWindow XMapRaised /* Raise them when mapping. */
104#else /* ! defined (HAVE_X11) */
105#include <X/Xkeyboard.h>
106/*#include <X/Xproto.h> */
107#endif /* ! defined (HAVE_X11) */
108 103
109#ifdef FD_SET 104#ifdef FD_SET
110/* We could get this from param.h, but better not to depend on finding that. 105/* We could get this from param.h, but better not to depend on finding that.
@@ -144,18 +139,6 @@ static int expose_all_windows;
144 139
145static int expose_all_icons; 140static int expose_all_icons;
146 141
147#ifndef HAVE_X11
148/* ExposeRegion events, when received, are copied into this queue
149 for later processing. */
150
151static struct event_queue x_expose_queue;
152
153/* ButtonPress and ButtonReleased events, when received,
154 are copied into this queue for later processing. */
155
156struct event_queue x_mouse_queue;
157#endif /* HAVE_X11 */
158
159#if defined (SIGIO) && defined (FIONREAD) 142#if defined (SIGIO) && defined (FIONREAD)
160int BLOCK_INPUT_mask; 143int BLOCK_INPUT_mask;
161#endif /* ! defined (SIGIO) && defined (FIONREAD) */ 144#endif /* ! defined (SIGIO) && defined (FIONREAD) */
@@ -304,7 +287,6 @@ static int mouse_face_mouse_x, mouse_face_mouse_y;
304/* Nonzero means defer mouse-motion highlighting. */ 287/* Nonzero means defer mouse-motion highlighting. */
305static int mouse_face_defer; 288static int mouse_face_defer;
306 289
307#ifdef HAVE_X11
308/* `t' if a mouse button is depressed. */ 290/* `t' if a mouse button is depressed. */
309 291
310extern Lisp_Object Vmouse_depressed; 292extern Lisp_Object Vmouse_depressed;
@@ -324,28 +306,6 @@ extern int _Xdebug;
324 306
325extern Lisp_Object Qface, Qmouse_face; 307extern Lisp_Object Qface, Qmouse_face;
326 308
327#else /* ! defined (HAVE_X11) */
328
329/* Bit patterns for the mouse cursor. */
330
331short MouseCursor[] = {
332 0x0000, 0x0008, 0x0018, 0x0038,
333 0x0078, 0x00f8, 0x01f8, 0x03f8,
334 0x07f8, 0x00f8, 0x00d8, 0x0188,
335 0x0180, 0x0300, 0x0300, 0x0000};
336
337short MouseMask[] = {
338 0x000c, 0x001c, 0x003c, 0x007c,
339 0x00fc, 0x01fc, 0x03fc, 0x07fc,
340 0x0ffc, 0x0ffc, 0x01fc, 0x03dc,
341 0x03cc, 0x0780, 0x0780, 0x0300};
342
343static short grey_bits[] = {
344 0x0005, 0x000a, 0x0005, 0x000a};
345
346static Pixmap GreyPixmap = 0;
347#endif /* ! defined (HAVE_X11) */
348
349static int x_noop_count; 309static int x_noop_count;
350 310
351 311
@@ -374,10 +334,6 @@ static void note_mouse_highlight ();
374static void clear_mouse_face (); 334static void clear_mouse_face ();
375static void show_mouse_face (); 335static void show_mouse_face ();
376 336
377#ifndef HAVE_X11
378static void dumpqueue ();
379#endif /* HAVE_X11 */
380
381void dumpborder (); 337void dumpborder ();
382static int XTcursor_to (); 338static int XTcursor_to ();
383static int XTclear_end_of_line (); 339static int XTclear_end_of_line ();
@@ -439,16 +395,10 @@ XTupdate_begin (f)
439 clear_mouse_face (); 395 clear_mouse_face ();
440 } 396 }
441 } 397 }
442#ifndef HAVE_X11 398
443 dumpqueue ();
444#endif /* HAVE_X11 */
445 UNBLOCK_INPUT; 399 UNBLOCK_INPUT;
446} 400}
447 401
448#ifndef HAVE_X11
449static void x_do_pending_expose ();
450#endif
451
452static 402static
453XTupdate_end (f) 403XTupdate_end (f)
454 struct frame *f; 404 struct frame *f;
@@ -456,10 +406,6 @@ XTupdate_end (f)
456 int mask; 406 int mask;
457 407
458 BLOCK_INPUT; 408 BLOCK_INPUT;
459#ifndef HAVE_X11
460 dumpqueue ();
461 x_do_pending_expose ();
462#endif /* HAVE_X11 */
463 409
464 x_display_cursor (f, 1); 410 x_display_cursor (f, 1);
465 411
@@ -884,7 +830,6 @@ XTclear_end_of_line (first_unused)
884 && f->phys_cursor_x < first_unused) 830 && f->phys_cursor_x < first_unused)
885 f->phys_cursor_x = -1; 831 f->phys_cursor_x = -1;
886 832
887#ifdef HAVE_X11
888 XClearArea (x_current_display, FRAME_X_WINDOW (f), 833 XClearArea (x_current_display, FRAME_X_WINDOW (f),
889 CHAR_TO_PIXEL_COL (f, curs_x), 834 CHAR_TO_PIXEL_COL (f, curs_x),
890 CHAR_TO_PIXEL_ROW (f, curs_y), 835 CHAR_TO_PIXEL_ROW (f, curs_y),
@@ -893,14 +838,6 @@ XTclear_end_of_line (first_unused)
893#if 0 838#if 0
894 redraw_previous_char (f, curs_x, curs_y, highlight); 839 redraw_previous_char (f, curs_x, curs_y, highlight);
895#endif 840#endif
896#else /* ! defined (HAVE_X11) */
897 XPixSet (FRAME_X_WINDOW (f),
898 CHAR_TO_PIXEL_COL (f, curs_x),
899 CHAR_TO_PIXEL_ROW (f, curs_y),
900 FONT_WIDTH (f->display.x->font) * (first_unused - curs_x),
901 f->display.x->line_height,
902 f->display.x->background_pixel);
903#endif /* ! defined (HAVE_X11) */
904 841
905 UNBLOCK_INPUT; 842 UNBLOCK_INPUT;
906} 843}
@@ -926,10 +863,6 @@ XTclear_frame ()
926 colors or something like that, then they should be notified. */ 863 colors or something like that, then they should be notified. */
927 x_scroll_bar_clear (f); 864 x_scroll_bar_clear (f);
928 865
929#ifndef HAVE_X11
930 dumpborder (f, 0);
931#endif /* HAVE_X11 */
932
933 XFlushQueue (); 866 XFlushQueue ();
934 UNBLOCK_INPUT; 867 UNBLOCK_INPUT;
935} 868}
@@ -1216,11 +1149,7 @@ XTflash (f)
1216 1149
1217/* Make audible bell. */ 1150/* Make audible bell. */
1218 1151
1219#ifdef HAVE_X11
1220#define XRINGBELL XBell (x_current_display, 0) 1152#define XRINGBELL XBell (x_current_display, 0)
1221#else /* ! defined (HAVE_X11) */
1222#define XRINGBELL XFeep (0);
1223#endif /* ! defined (HAVE_X11) */
1224 1153
1225XTring_bell () 1154XTring_bell ()
1226{ 1155{
@@ -1297,51 +1226,21 @@ stufflines (n)
1297 newtop = topregion + n; 1226 newtop = topregion + n;
1298 length = (bottomregion - topregion) + 1; 1227 length = (bottomregion - topregion) + 1;
1299 1228
1300#ifndef HAVE_X11
1301 dumpqueue ();
1302#endif /* HAVE_X11 */
1303
1304 if ((length > 0) && (newtop <= flexlines)) 1229 if ((length > 0) && (newtop <= flexlines))
1305 { 1230 XCopyArea (x_current_display, FRAME_X_WINDOW (f),
1306#ifdef HAVE_X11 1231 FRAME_X_WINDOW (f), f->display.x->normal_gc,
1307 XCopyArea (x_current_display, FRAME_X_WINDOW (f), 1232 intborder, CHAR_TO_PIXEL_ROW (f, topregion),
1308 FRAME_X_WINDOW (f), f->display.x->normal_gc, 1233 f->width * FONT_WIDTH (f->display.x->font),
1309 intborder, CHAR_TO_PIXEL_ROW (f, topregion), 1234 length * f->display.x->line_height, intborder,
1310 f->width * FONT_WIDTH (f->display.x->font), 1235 CHAR_TO_PIXEL_ROW (f, newtop));
1311 length * f->display.x->line_height, intborder,
1312 CHAR_TO_PIXEL_ROW (f, newtop));
1313#else /* ! defined (HAVE_X11) */
1314 XMoveArea (FRAME_X_WINDOW (f),
1315 intborder, CHAR_TO_PIXEL_ROW (f, topregion),
1316 intborder, CHAR_TO_PIXEL_ROW (f, newtop),
1317 f->width * FONT_WIDTH (f->display.x->font),
1318 length * f->display.x->line_height);
1319 /* Now we must process any ExposeRegion events that occur
1320 if the area being copied from is obscured.
1321 We can't let it wait because further i/d operations
1322 may want to copy this area to another area. */
1323 x_read_exposes ();
1324#endif /* ! defined (HAVE_X11) */
1325 }
1326 1236
1327 newtop = min (newtop, (flexlines - 1)); 1237 newtop = min (newtop, (flexlines - 1));
1328 length = newtop - topregion; 1238 length = newtop - topregion;
1329 if (length > 0) 1239 if (length > 0)
1330 { 1240 XClearArea (x_current_display, FRAME_X_WINDOW (f), intborder,
1331#ifdef HAVE_X11 1241 CHAR_TO_PIXEL_ROW (f, topregion),
1332 XClearArea (x_current_display, FRAME_X_WINDOW (f), intborder, 1242 f->width * FONT_WIDTH (f->display.x->font),
1333 CHAR_TO_PIXEL_ROW (f, topregion), 1243 n * f->display.x->line_height, False);
1334 f->width * FONT_WIDTH (f->display.x->font),
1335 n * f->display.x->line_height, False);
1336#else /* ! defined (HAVE_X11) */
1337 XPixSet (FRAME_X_WINDOW (f),
1338 intborder,
1339 CHAR_TO_PIXEL_ROW (f, topregion),
1340 f->width * FONT_WIDTH (f->display.x->font),
1341 n * f->display.x->line_height,
1342 f->display.x->background_pixel);
1343#endif /* ! defined (HAVE_X11) */
1344 }
1345} 1244}
1346 1245
1347/* Perform a delete-lines operation, deleting N lines 1246/* Perform a delete-lines operation, deleting N lines
@@ -1358,31 +1257,16 @@ scraplines (n)
1358 if (curs_y >= flexlines) 1257 if (curs_y >= flexlines)
1359 return; 1258 return;
1360 1259
1361#ifndef HAVE_X11
1362 dumpqueue ();
1363#endif /* HAVE_X11 */
1364
1365 if ((curs_y + n) >= flexlines) 1260 if ((curs_y + n) >= flexlines)
1366 { 1261 {
1367 if (flexlines >= (curs_y + 1)) 1262 if (flexlines >= (curs_y + 1))
1368 { 1263 XClearArea (x_current_display, FRAME_X_WINDOW (f), intborder,
1369#ifdef HAVE_X11 1264 CHAR_TO_PIXEL_ROW (f, curs_y),
1370 XClearArea (x_current_display, FRAME_X_WINDOW (f), intborder, 1265 f->width * FONT_WIDTH (f->display.x->font),
1371 CHAR_TO_PIXEL_ROW (f, curs_y), 1266 (flexlines - curs_y) * f->display.x->line_height, False);
1372 f->width * FONT_WIDTH (f->display.x->font),
1373 (flexlines - curs_y) * f->display.x->line_height, False);
1374#else /* ! defined (HAVE_X11) */
1375 XPixSet (FRAME_X_WINDOW (f),
1376 intborder, CHAR_TO_PIXEL_ROW (f, curs_y),
1377 f->width * FONT_WIDTH (f->display.x->font),
1378 (flexlines - curs_y) * f->display.x->line_height,
1379 f->display.x->background_pixel);
1380#endif /* ! defined (HAVE_X11) */
1381 }
1382 } 1267 }
1383 else 1268 else
1384 { 1269 {
1385#ifdef HAVE_X11
1386 XCopyArea (x_current_display, FRAME_X_WINDOW (f), 1270 XCopyArea (x_current_display, FRAME_X_WINDOW (f),
1387 FRAME_X_WINDOW (f), f->display.x->normal_gc, 1271 FRAME_X_WINDOW (f), f->display.x->normal_gc,
1388 intborder, 1272 intborder,
@@ -1395,23 +1279,6 @@ scraplines (n)
1395 CHAR_TO_PIXEL_ROW (f, flexlines - n), 1279 CHAR_TO_PIXEL_ROW (f, flexlines - n),
1396 f->width * FONT_WIDTH (f->display.x->font), 1280 f->width * FONT_WIDTH (f->display.x->font),
1397 n * f->display.x->line_height, False); 1281 n * f->display.x->line_height, False);
1398#else /* ! defined (HAVE_X11) */
1399 XMoveArea (FRAME_X_WINDOW (f),
1400 intborder,
1401 CHAR_TO_PIXEL_ROW (f, curs_y + n),
1402 intborder, CHAR_TO_PIXEL_ROW (f, curs_y),
1403 f->width * FONT_WIDTH (f->display.x->font),
1404 (flexlines - (curs_y + n)) * f->display.x->line_height);
1405 /* Now we must process any ExposeRegion events that occur
1406 if the area being copied from is obscured.
1407 We can't let it wait because further i/d operations
1408 may want to copy this area to another area. */
1409 x_read_exposes ();
1410 XPixSet (FRAME_X_WINDOW (f), intborder,
1411 CHAR_TO_PIXEL_ROW (f, flexlines - n),
1412 f->width * FONT_WIDTH (f->display.x->font),
1413 n * f->display.x->line_height, f->display.x->background_pixel);
1414#endif /* ! defined (HAVE_X11) */
1415 } 1282 }
1416} 1283}
1417 1284
@@ -1463,19 +1330,6 @@ dumprectangle (f, left, top, cols, rows)
1463 /* Express rectangle as four edges, instead of position-and-size. */ 1330 /* Express rectangle as four edges, instead of position-and-size. */
1464 bottom = top + rows; 1331 bottom = top + rows;
1465 right = left + cols; 1332 right = left + cols;
1466
1467#ifndef HAVE_X11 /* Window manger does this for X11. */
1468 {
1469 int intborder = f->display.x->internal_border_width;
1470
1471 /* If the rectangle includes any of the internal border area,
1472 redisplay the border emphasis. */
1473 if (top < intborder || left < intborder
1474 || bottom > intborder + f->height * f->display.x->line_height
1475 || right > intborder + f->width * f->display.x->line_height)
1476 dumpborder (f, 0);
1477 }
1478#endif /* not HAVE_X11 Window manger does this for X11. */
1479 1333
1480 /* Convert rectangle edges in pixels to edges in chars. 1334 /* Convert rectangle edges in pixels to edges in chars.
1481 Round down for left and top, up for right and bottom. */ 1335 Round down for left and top, up for right and bottom. */
@@ -1534,99 +1388,7 @@ dumprectangle (f, left, top, cols, rows)
1534 if (cursor_cleared) 1388 if (cursor_cleared)
1535 x_display_cursor (f, 1); 1389 x_display_cursor (f, 1);
1536} 1390}
1537
1538#ifndef HAVE_X11
1539/* Process all queued ExposeRegion events. */
1540
1541static void
1542dumpqueue ()
1543{
1544 register int i;
1545 XExposeRegionEvent r;
1546
1547 while (dequeue_event (&r, &x_expose_queue))
1548 {
1549 struct frame *f = x_window_to_frame (r.window);
1550 if (f->display.x->icon_desc == r.window)
1551 refreshicon (f);
1552 else
1553 dumprectangle (f, r.x, r.y, r.width, r.height);
1554 }
1555 XFlushQueue ();
1556}
1557#endif /* HAVE_X11 */
1558 1391
1559/* Process all expose events that are pending, for X10.
1560 Redraws the cursor if necessary on any frame that
1561 is not in the process of being updated with update_frame. */
1562
1563#ifndef HAVE_X11
1564static void
1565x_do_pending_expose ()
1566{
1567 int mask;
1568 struct frame *f;
1569 Lisp_Object tail, frame;
1570
1571 if (expose_all_windows)
1572 {
1573 expose_all_windows = 0;
1574 for (tail = Vframe_list; CONSP (tail); tail = XCONS (tail)->cdr)
1575 {
1576 register int temp_width, temp_height;
1577 int intborder;
1578
1579 frame = XCONS (tail)->car;
1580 if (XGCTYPE (frame) != Lisp_Frame)
1581 continue;
1582 f = XFRAME (frame);
1583 if (! FRAME_X_P (f))
1584 continue;
1585 if (!f->async_visible)
1586 continue;
1587 if (!f->display.x->needs_exposure)
1588 continue;
1589
1590 intborder = f->display.x->internal_border_width;
1591
1592 clear_cursor (f);
1593 XGetWindowInfo (FRAME_X_WINDOW (f), &windowinfo);
1594 temp_width = ((windowinfo.width - 2 * intborder
1595 - f->display.x->v_scroll_bar_width)
1596 / FONT_WIDTH (f->display.x->font));
1597 temp_height = ((windowinfo.height- 2 * intborder
1598 - f->display.x->h_scroll_bar_height)
1599 / f->display.x->line_height);
1600 if (temp_width != f->width || temp_height != f->height)
1601 {
1602 change_frame_size (f, max (1, temp_height),
1603 max (1, temp_width), 0, 1);
1604 x_resize_scroll_bars (f);
1605 }
1606 f->display.x->left_pos = windowinfo.x;
1607 f->display.x->top_pos = windowinfo.y;
1608 dumprectangle (f, 0, 0, PIXEL_WIDTH (f), PIXEL_HEIGHT (f));
1609#if 0
1610 dumpborder (f, 0);
1611#endif /* ! 0 */
1612 f->display.x->needs_exposure = 0;
1613 if (updating_frame != f)
1614 x_display_cursor (f, 1);
1615 XFlushQueue ();
1616 }
1617 }
1618 else
1619 /* Handle any individual-rectangle expose events queued
1620 for various windows. */
1621#ifdef HAVE_X11
1622 ;
1623#else /* ! defined (HAVE_X11) */
1624 dumpqueue ();
1625#endif /* ! defined (HAVE_X11) */
1626}
1627#endif
1628
1629#ifdef HAVE_X11
1630static void 1392static void
1631frame_highlight (frame) 1393frame_highlight (frame)
1632 struct frame *frame; 1394 struct frame *frame;
@@ -1656,50 +1418,6 @@ frame_unhighlight (frame)
1656 UNBLOCK_INPUT; 1418 UNBLOCK_INPUT;
1657 x_display_cursor (frame, 1); 1419 x_display_cursor (frame, 1);
1658} 1420}
1659#else /* ! defined (HAVE_X11) */
1660/* Dump the border-emphasis of frame F.
1661 If F is selected, this is a lining of the same color as the border,
1662 just within the border, occupying a portion of the internal border.
1663 If F is not selected, it is background in the same place.
1664 If ALWAYS is 0, don't bother explicitly drawing if it's background.
1665
1666 ALWAYS = 1 is used when a frame becomes selected or deselected.
1667 In that case, we also turn the cursor off and on again
1668 so it will appear in the proper shape (solid if selected; else hollow.) */
1669
1670static void
1671dumpborder (f, always)
1672 struct frame *f;
1673 int always;
1674{
1675 int thickness = f->display.x->internal_border_width / 2;
1676 int width = PIXEL_WIDTH (f);
1677 int height = PIXEL_HEIGHT (f);
1678 int pixel;
1679
1680 if (f != selected_frame)
1681 {
1682 if (!always)
1683 return;
1684
1685 pixel = f->display.x->background_pixel;
1686 }
1687 else
1688 {
1689 pixel = f->display.x->border_pixel;
1690 }
1691
1692 XPixSet (FRAME_X_WINDOW (f), 0, 0, width, thickness, pixel);
1693 XPixSet (FRAME_X_WINDOW (f), 0, 0, thickness, height, pixel);
1694 XPixSet (FRAME_X_WINDOW (f), 0, height - thickness, width,
1695 thickness, pixel);
1696 XPixSet (FRAME_X_WINDOW (f), width - thickness, 0, thickness,
1697 height, pixel);
1698
1699 if (always)
1700 x_display_cursor (f, 1);
1701}
1702#endif /* ! defined (HAVE_X11) */
1703 1421
1704static void XTframe_rehighlight (); 1422static void XTframe_rehighlight ();
1705 1423
@@ -1929,7 +1647,6 @@ x_emacs_to_x_modifiers (state)
1929} 1647}
1930 1648
1931/* Mouse clicks and mouse movement. Rah. */ 1649/* Mouse clicks and mouse movement. Rah. */
1932#ifdef HAVE_X11
1933 1650
1934/* Given a pixel position (PIX_X, PIX_Y) on the frame F, return 1651/* Given a pixel position (PIX_X, PIX_Y) on the frame F, return
1935 glyph co-ordinates in (*X, *Y). Set *BOUNDS to the rectangle 1652 glyph co-ordinates in (*X, *Y). Set *BOUNDS to the rectangle
@@ -2602,10 +2319,6 @@ XTmouse_position (f, bar_window, part, x, y, time)
2602 2319
2603 UNBLOCK_INPUT; 2320 UNBLOCK_INPUT;
2604} 2321}
2605
2606#else /* ! defined (HAVE_X11) */
2607#define XEvent XKeyPressedEvent
2608#endif /* ! defined (HAVE_X11) */
2609 2322
2610/* Scroll bar support. */ 2323/* Scroll bar support. */
2611 2324
@@ -3480,7 +3193,6 @@ XTread_socket (sd, bufp, numchars, waitp, expected)
3480 3193
3481 switch (event.type) 3194 switch (event.type)
3482 { 3195 {
3483#ifdef HAVE_X11
3484 case ClientMessage: 3196 case ClientMessage:
3485 { 3197 {
3486 if (event.xclient.message_type == Xatom_wm_protocols 3198 if (event.xclient.message_type == Xatom_wm_protocols
@@ -3694,55 +3406,7 @@ XTread_socket (sd, bufp, numchars, waitp, expected)
3694 source area was completely 3406 source area was completely
3695 available */ 3407 available */
3696 break; 3408 break;
3697#else /* ! defined (HAVE_X11) */
3698 case ExposeWindow:
3699 if (event.subwindow != 0)
3700 break; /* duplicate event */
3701 f = x_window_to_frame (event.window);
3702 if (event.window == f->display.x->icon_desc)
3703 {
3704 refreshicon (f);
3705 f->async_iconified = 1;
3706 }
3707 if (event.window == FRAME_X_WINDOW (f))
3708 {
3709 /* Say must check all windows' needs_exposure flags. */
3710 expose_all_windows = 1;
3711 f->display.x->needs_exposure = 1;
3712 f->async_visible = 1;
3713 }
3714 break;
3715
3716 case ExposeRegion:
3717 if (event.subwindow != 0)
3718 break; /* duplicate event */
3719 f = x_window_to_frame (event.window);
3720 if (event.window == f->display.x->icon_desc)
3721 {
3722 refreshicon (f);
3723 break;
3724 }
3725 /* If window already needs full redraw, ignore this rectangle. */
3726 if (expose_all_windows && f->display.x->needs_exposure)
3727 break;
3728 /* Put the event on the queue of rectangles to redraw. */
3729 if (enqueue_event (&event, &x_expose_queue))
3730 /* If it is full, we can't record the rectangle,
3731 so redraw this entire window. */
3732 {
3733 /* Say must check all windows' needs_exposure flags. */
3734 expose_all_windows = 1;
3735 f->display.x->needs_exposure = 1;
3736 }
3737 break;
3738
3739 case ExposeCopy:
3740 /* This should happen only when we are expecting it,
3741 in x_read_exposes. */
3742 abort ();
3743#endif /* ! defined (HAVE_X11) */
3744 3409
3745#ifdef HAVE_X11
3746 case UnmapNotify: 3410 case UnmapNotify:
3747 f = x_any_window_to_frame (event.xunmap.window); 3411 f = x_any_window_to_frame (event.xunmap.window);
3748 if (f) /* F may no longer exist if 3412 if (f) /* F may no longer exist if
@@ -3786,17 +3450,6 @@ XTread_socket (sd, bufp, numchars, waitp, expected)
3786 case VisibilityNotify: 3450 case VisibilityNotify:
3787 break; 3451 break;
3788 3452
3789#else /* ! defined (HAVE_X11) */
3790 case UnmapWindow:
3791 f = x_window_to_frame (event.window);
3792 if (event.window == f->display.x->icon_desc)
3793 f->async_iconified = 0;
3794 if (event.window == FRAME_X_WINDOW (f))
3795 f->async_visible = 0;
3796 break;
3797#endif /* ! defined (HAVE_X11) */
3798
3799#ifdef HAVE_X11
3800 case KeyPress: 3453 case KeyPress:
3801 f = x_any_window_to_frame (event.xkey.window); 3454 f = x_any_window_to_frame (event.xkey.window);
3802 3455
@@ -3930,56 +3583,6 @@ XTread_socket (sd, bufp, numchars, waitp, expected)
3930 abort (); 3583 abort ();
3931 } 3584 }
3932 break; 3585 break;
3933#else /* ! defined (HAVE_X11) */
3934 case KeyPressed:
3935 {
3936 register char *where_mapping;
3937
3938 f = x_window_to_frame (event.window);
3939 /* Ignore keys typed on icon windows. */
3940 if (f != 0 && event.window == f->display.x->icon_desc)
3941 break;
3942 where_mapping = XLookupMapping (&event, &nbytes);
3943 /* Nasty fix for arrow keys */
3944 if (!nbytes && IsCursorKey (event.detail & 0xff))
3945 {
3946 switch (event.detail & 0xff)
3947 {
3948 case KC_CURSOR_LEFT:
3949 where_mapping = "\002";
3950 break;
3951 case KC_CURSOR_RIGHT:
3952 where_mapping = "\006";
3953 break;
3954 case KC_CURSOR_UP:
3955 where_mapping = "\020";
3956 break;
3957 case KC_CURSOR_DOWN:
3958 where_mapping = "\016";
3959 break;
3960 }
3961 nbytes = 1;
3962 }
3963 if (numchars - nbytes > 0)
3964 {
3965 register int i;
3966
3967 for (i = 0; i < nbytes; i++)
3968 {
3969 bufp->kind = ascii_keystroke;
3970 bufp->code = where_mapping[i];
3971 XSET (bufp->time, Lisp_Int, event.xkey.time);
3972 XSET (bufp->frame_or_window, Lisp_Frame, f);
3973 bufp++;
3974 }
3975 count += nbytes;
3976 numchars -= nbytes;
3977 }
3978 }
3979 break;
3980#endif /* ! defined (HAVE_X11) */
3981
3982#ifdef HAVE_X11
3983 3586
3984 /* Here's a possible interpretation of the whole 3587 /* Here's a possible interpretation of the whole
3985 FocusIn-EnterNotify FocusOut-LeaveNotify mess. If you get a 3588 FocusIn-EnterNotify FocusOut-LeaveNotify mess. If you get a
@@ -4065,43 +3668,6 @@ XTread_socket (sd, bufp, numchars, waitp, expected)
4065#endif /* USE_X_TOOLKIT */ 3668#endif /* USE_X_TOOLKIT */
4066 break; 3669 break;
4067 3670
4068#else /* ! defined (HAVE_X11) */
4069
4070 case EnterWindow:
4071 if ((event.detail & 0xFF) == 1)
4072 break; /* Coming from our own subwindow */
4073 if (event.subwindow != 0)
4074 break; /* Entering our own subwindow. */
4075
4076 {
4077 f = x_window_to_frame (event.window);
4078 x_mouse_frame = f;
4079
4080 x_new_focus_frame (f);
4081 }
4082 break;
4083
4084 case LeaveWindow:
4085 if ((event.detail & 0xFF) == 1)
4086 break; /* Entering our own subwindow */
4087 if (event.subwindow != 0)
4088 break; /* Leaving our own subwindow. */
4089
4090 x_mouse_frame = 0;
4091 if (x_focus_frame == 0
4092 && x_input_frame != 0
4093 && x_input_frame == x_window_to_frame (event.window)
4094 && event.window == FRAME_X_WINDOW (x_input_frame))
4095 {
4096 f = x_input_frame;
4097 x_input_frame = 0;
4098 if (f)
4099 frame_unhighlight (f);
4100 }
4101 break;
4102#endif /* ! defined (HAVE_X11) */
4103
4104#ifdef HAVE_X11
4105 case MotionNotify: 3671 case MotionNotify:
4106 { 3672 {
4107 if (x_mouse_grabbed && last_mouse_frame 3673 if (x_mouse_grabbed && last_mouse_frame
@@ -4312,56 +3878,11 @@ XTread_socket (sd, bufp, numchars, waitp, expected)
4312 } 3878 }
4313 break; 3879 break;
4314 3880
4315#else /* ! defined (HAVE_X11) */
4316 case ButtonPressed:
4317 case ButtonReleased:
4318 f = x_window_to_frame (event.window);
4319 if (f)
4320 {
4321 if (event.window == f->display.x->icon_desc)
4322 {
4323 x_make_frame_visible (f);
4324
4325 if (warp_mouse_on_deiconify)
4326 XWarpMouse (FRAME_X_WINDOW (f), 10, 10);
4327 break;
4328 }
4329 if (event.window == FRAME_X_WINDOW (f))
4330 {
4331 if (f->auto_raise)
4332 x_raise_frame (f);
4333 }
4334 }
4335 enqueue_event (&event, &x_mouse_queue);
4336 if (numchars >= 2)
4337 {
4338 bufp->kind = ascii_keystroke;
4339 bufp->code = 'X' & 037; /* C-x */
4340 XSET (bufp->frame_or_window, Lisp_Frame, f);
4341 XSET (bufp->time, Lisp_Int, event.xkey.time);
4342 bufp++;
4343
4344 bufp->kind = ascii_keystroke;
4345 bufp->code = 0; /* C-@ */
4346 XSET (bufp->frame_or_window, Lisp_Frame, f);
4347 XSET (bufp->time, Lisp_Int, event.xkey.time);
4348 bufp++;
4349
4350 count += 2;
4351 numchars -= 2;
4352 }
4353 break;
4354#endif /* ! defined (HAVE_X11) */
4355
4356#ifdef HAVE_X11
4357
4358 case CirculateNotify: 3881 case CirculateNotify:
4359 break; 3882 break;
4360 case CirculateRequest: 3883 case CirculateRequest:
4361 break; 3884 break;
4362 3885
4363#endif /* ! defined (HAVE_X11) */
4364
4365 case MappingNotify: 3886 case MappingNotify:
4366 /* Someone has changed the keyboard mapping - update the 3887 /* Someone has changed the keyboard mapping - update the
4367 local cache. */ 3888 local cache. */
@@ -4431,90 +3952,17 @@ XTread_socket (sd, bufp, numchars, waitp, expected)
4431#endif /* HAVE_SELECT */ 3952#endif /* HAVE_SELECT */
4432#endif /* 0 */ 3953#endif /* 0 */
4433 3954
4434#ifndef HAVE_X11
4435 if (updating_frame == 0)
4436 x_do_pending_expose ();
4437#endif
4438
4439 /* If the focus was just given to an autoraising frame, 3955 /* If the focus was just given to an autoraising frame,
4440 raise it now. */ 3956 raise it now. */
4441#ifdef HAVE_X11
4442 if (pending_autoraise_frame) 3957 if (pending_autoraise_frame)
4443 { 3958 {
4444 x_raise_frame (pending_autoraise_frame); 3959 x_raise_frame (pending_autoraise_frame);
4445 pending_autoraise_frame = 0; 3960 pending_autoraise_frame = 0;
4446 } 3961 }
4447#endif
4448 3962
4449 UNBLOCK_INPUT; 3963 UNBLOCK_INPUT;
4450 return count; 3964 return count;
4451} 3965}
4452
4453#ifndef HAVE_X11
4454/* Read and process only Expose events
4455 until we get an ExposeCopy event; then return.
4456 This is used in insert/delete line.
4457 We assume input is already blocked. */
4458
4459static void
4460x_read_exposes ()
4461{
4462 struct frame *f;
4463 XKeyPressedEvent event;
4464
4465 while (1)
4466 {
4467 /* while there are more events*/
4468 XMaskEvent (ExposeWindow | ExposeRegion | ExposeCopy, &event);
4469 switch (event.type)
4470 {
4471 case ExposeWindow:
4472 if (event.subwindow != 0)
4473 break; /* duplicate event */
4474 f = x_window_to_frame (event.window);
4475 if (event.window == f->display.x->icon_desc)
4476 {
4477 refreshicon (f);
4478 break;
4479 }
4480 if (event.window == FRAME_X_WINDOW (f))
4481 {
4482 expose_all_windows = 1;
4483 f->display.x->needs_exposure = 1;
4484 break;
4485 }
4486 break;
4487
4488 case ExposeRegion:
4489 if (event.subwindow != 0)
4490 break; /* duplicate event */
4491 f = x_window_to_frame (event.window);
4492 if (event.window == f->display.x->icon_desc)
4493 {
4494 refreshicon (f);
4495 break;
4496 }
4497 /* If window already needs full redraw, ignore this rectangle. */
4498 if (expose_all_windows && f->display.x->needs_exposure)
4499 break;
4500 /* Put the event on the queue of rectangles to redraw. */
4501 if (enqueue_event (&event, &x_expose_queue))
4502 /* If it is full, we can't record the rectangle,
4503 so redraw this entire window. */
4504 {
4505 /* Say must check all windows' needs_exposure flags. */
4506 expose_all_windows = 1;
4507 f->display.x->needs_exposure = 1;
4508 }
4509 break;
4510
4511 case ExposeCopy:
4512 return;
4513 }
4514 }
4515}
4516#endif /* HAVE_X11 */
4517
4518 3966
4519/* Drawing the cursor. */ 3967/* Drawing the cursor. */
4520 3968
@@ -4530,27 +3978,9 @@ x_draw_box (f)
4530 int width = FONT_WIDTH (f->display.x->font); 3978 int width = FONT_WIDTH (f->display.x->font);
4531 int height = f->display.x->line_height; 3979 int height = f->display.x->line_height;
4532 3980
4533#ifdef HAVE_X11
4534 XDrawRectangle (x_current_display, FRAME_X_WINDOW (f), 3981 XDrawRectangle (x_current_display, FRAME_X_WINDOW (f),
4535 f->display.x->cursor_gc, 3982 f->display.x->cursor_gc,
4536 left, top, width - 1, height - 1); 3983 left, top, width - 1, height - 1);
4537#else /* ! defined (HAVE_X11) */
4538 XPixSet (FRAME_X_WINDOW (f),
4539 left, top, width, 1,
4540 f->display.x->cursor_pixel);
4541
4542 XPixSet (FRAME_X_WINDOW (f),
4543 left, top, 1, height,
4544 f->display.x->cursor_pixel);
4545
4546 XPixSet (FRAME_X_WINDOW (f),
4547 left+width-1, top, 1, height,
4548 f->display.x->cursor_pixel);
4549
4550 XPixSet (FRAME_X_WINDOW (f),
4551 left, top+height-1, width, 1,
4552 f->display.x->cursor_pixel);
4553#endif /* ! defined (HAVE_X11) */
4554} 3984}
4555 3985
4556/* Clear the cursor of frame F to background color, 3986/* Clear the cursor of frame F to background color,
@@ -4568,15 +3998,7 @@ clear_cursor (f)
4568 || f->phys_cursor_x < 0) 3998 || f->phys_cursor_x < 0)
4569 return; 3999 return;
4570 4000
4571#ifdef HAVE_X11
4572 x_display_cursor (f, 0); 4001 x_display_cursor (f, 0);
4573#else /* ! defined (HAVE_X11) */
4574 XPixSet (FRAME_X_WINDOW (f),
4575 CHAR_TO_PIXEL_COL (f, f->phys_cursor_x),
4576 CHAR_TO_PIXEL_ROW (f, f->phys_cursor_y),
4577 FONT_WIDTH (f->display.x->font), f->display.x->line_height,
4578 f->display.x->background_pixel);
4579#endif /* ! defined (HAVE_X11) */
4580 f->phys_cursor_x = -1; 4002 f->phys_cursor_x = -1;
4581} 4003}
4582 4004
@@ -4792,38 +4214,7 @@ x_display_cursor (f, on)
4792refreshicon (f) 4214refreshicon (f)
4793 struct frame *f; 4215 struct frame *f;
4794{ 4216{
4795#ifdef HAVE_X11
4796 /* Normally, the window manager handles this function. */ 4217 /* Normally, the window manager handles this function. */
4797#else /* ! defined (HAVE_X11) */
4798 int mask;
4799
4800 if (f->display.x->icon_bitmap_flag)
4801 XBitmapBitsPut (f->display.x->icon_desc, 0, 0, sink_width, sink_height,
4802 sink_bits, BlackPixel, WHITE_PIX_DEFAULT,
4803 icon_bitmap, GXcopy, AllPlanes);
4804 else
4805 {
4806 extern struct frame *selected_frame;
4807 struct Lisp_String *str;
4808 unsigned char *string;
4809
4810 string
4811 = XSTRING (XBUFFER (XWINDOW (f->selected_window)->buffer)->name)->data;
4812
4813 if (f->display.x->icon_label != string)
4814 {
4815 f->display.x->icon_label = string;
4816 XChangeWindow (f->display.x->icon_desc,
4817 XQueryWidth (string, icon_font_info->id) + 10,
4818 icon_font_info->height + 10);
4819 }
4820
4821 XText (f->display.x->icon_desc, 5, 5, string,
4822 str->size, icon_font_info->id,
4823 BLACK_PIX_DEFAULT, WHITE_PIX_DEFAULT);
4824 }
4825 XFlushQueue ();
4826#endif /* ! defined (HAVE_X11) */
4827} 4218}
4828 4219
4829/* Make the x-window of frame F use the gnu icon bitmap. */ 4220/* Make the x-window of frame F use the gnu icon bitmap. */
@@ -4838,37 +4229,12 @@ x_bitmap_icon (f)
4838 if (FRAME_X_WINDOW (f) == 0) 4229 if (FRAME_X_WINDOW (f) == 0)
4839 return 1; 4230 return 1;
4840 4231
4841#ifdef HAVE_X11
4842 if (! icon_bitmap) 4232 if (! icon_bitmap)
4843 icon_bitmap = 4233 icon_bitmap =
4844 XCreateBitmapFromData (x_current_display, FRAME_X_WINDOW (f), 4234 XCreateBitmapFromData (x_current_display, FRAME_X_WINDOW (f),
4845 gnu_bits, gnu_width, gnu_height); 4235 gnu_bits, gnu_width, gnu_height);
4846 x_wm_set_icon_pixmap (f, icon_bitmap); 4236 x_wm_set_icon_pixmap (f, icon_bitmap);
4847 f->display.x->icon_bitmap_flag = 1; 4237 f->display.x->icon_bitmap_flag = 1;
4848#else /* ! defined (HAVE_X11) */
4849 if (f->display.x->icon_desc)
4850 {
4851 XClearIconWindow (FRAME_X_WINDOW (f));
4852 XDestroyWindow (f->display.x->icon_desc);
4853 }
4854
4855 icon_window = XCreateWindow (f->display.x->parent_desc,
4856 0, 0, sink_width, sink_height,
4857 2, WhitePixmap, (Pixmap) NULL);
4858
4859 if (icon_window == 0)
4860 return 1;
4861
4862 XSetIconWindow (FRAME_X_WINDOW (f), icon_window);
4863 XSelectInput (icon_window, ExposeWindow | UnmapWindow);
4864
4865 f->display.x->icon_desc = icon_window;
4866 f->display.x->icon_bitmap_flag = 1;
4867
4868 if (icon_bitmap == 0)
4869 icon_bitmap
4870 = XStoreBitmap (sink_mask_width, sink_mask_height, sink_mask_bits);
4871#endif /* ! defined (HAVE_X11) */
4872 4238
4873 return 0; 4239 return 0;
4874} 4240}
@@ -4881,26 +4247,9 @@ x_text_icon (f, icon_name)
4881 struct frame *f; 4247 struct frame *f;
4882 char *icon_name; 4248 char *icon_name;
4883{ 4249{
4884#ifndef HAVE_X11
4885 int mask;
4886 int width;
4887 Window icon_window;
4888 char *X_DefaultValue;
4889 Bitmap b1;
4890
4891#ifndef WhitePixel
4892#define WhitePixel 1
4893#endif /* WhitePixel */
4894
4895#ifndef BlackPixel
4896#define BlackPixel 0
4897#endif /* BlackPixel */
4898#endif /* HAVE_X11 */
4899
4900 if (FRAME_X_WINDOW (f) == 0) 4250 if (FRAME_X_WINDOW (f) == 0)
4901 return 1; 4251 return 1;
4902 4252
4903#ifdef HAVE_X11
4904 if (icon_name) 4253 if (icon_name)
4905 f->display.x->icon_label = icon_name; 4254 f->display.x->icon_label = icon_name;
4906 else 4255 else
@@ -4914,42 +4263,6 @@ x_text_icon (f, icon_name)
4914 4263
4915 f->display.x->icon_bitmap_flag = 0; 4264 f->display.x->icon_bitmap_flag = 0;
4916 x_wm_set_icon_pixmap (f, 0); 4265 x_wm_set_icon_pixmap (f, 0);
4917#else /* ! defined (HAVE_X11) */
4918 if (icon_font_info == 0)
4919 icon_font_info
4920 = XGetFont (XGetDefault (XDISPLAY
4921 (char *) XSTRING (Vinvocation_name)->data,
4922 "BodyFont"));
4923
4924 if (f->display.x->icon_desc)
4925 {
4926 XClearIconWindow (XDISPLAY FRAME_X_WINDOW (f));
4927 XDestroyWindow (XDISPLAY f->display.x->icon_desc);
4928 }
4929
4930 if (icon_name)
4931 f->display.x->icon_label = (unsigned char *) icon_name;
4932 else
4933 if (! f->display.x->icon_label)
4934 f->display.x->icon_label = XSTRING (f->name)->data;
4935
4936 width = XStringWidth (f->display.x->icon_label, icon_font_info, 0, 0);
4937 icon_window = XCreateWindow (f->display.x->parent_desc,
4938 f->display.x->left_pos,
4939 f->display.x->top_pos,
4940 width + 10, icon_font_info->height + 10,
4941 2, BlackPixmap, WhitePixmap);
4942
4943 if (icon_window == 0)
4944 return 1;
4945
4946 XSetIconWindow (FRAME_X_WINDOW (f), icon_window);
4947 XSelectInput (icon_window, ExposeWindow | ExposeRegion | UnmapWindow | ButtonPressed);
4948
4949 f->display.x->icon_desc = icon_window;
4950 f->display.x->icon_bitmap_flag = 0;
4951 f->display.x->icon_label = 0;
4952#endif /* ! defined (HAVE_X11) */
4953 4266
4954 return 0; 4267 return 0;
4955} 4268}
@@ -5116,8 +4429,6 @@ x_trace_wire ()
5116 to the font named NEWNAME. This is safe to use 4429 to the font named NEWNAME. This is safe to use
5117 even before F has an actual x-window. */ 4430 even before F has an actual x-window. */
5118 4431
5119#ifdef HAVE_X11
5120
5121struct font_info 4432struct font_info
5122{ 4433{
5123 XFontStruct *font; 4434 XFontStruct *font;
@@ -5289,34 +4600,10 @@ x_new_font (f, fontname)
5289 return lispy_name; 4600 return lispy_name;
5290 } 4601 }
5291} 4602}
5292#else /* ! defined (HAVE_X11) */
5293x_new_font (f, newname)
5294 struct frame *f;
5295 register char *newname;
5296{
5297 FONT_TYPE *temp;
5298 int mask;
5299
5300 temp = XGetFont (newname);
5301 if (temp == (FONT_TYPE *) 0)
5302 return 1;
5303
5304 if (f->display.x->font)
5305 XLoseFont (f->display.x->font);
5306
5307 f->display.x->font = temp;
5308
5309 if (FRAME_X_WINDOW (f) != 0)
5310 x_set_window_size (f, 0, f->width, f->height);
5311
5312 return 0;
5313}
5314#endif /* ! defined (HAVE_X11) */
5315 4603
5316x_calc_absolute_position (f) 4604x_calc_absolute_position (f)
5317 struct frame *f; 4605 struct frame *f;
5318{ 4606{
5319#ifdef HAVE_X11
5320 Window win, child; 4607 Window win, child;
5321 int win_x = 0, win_y = 0; 4608 int win_x = 0, win_y = 0;
5322 int flags = f->display.x->size_hint_flags; 4609 int flags = f->display.x->size_hint_flags;
@@ -5357,19 +4644,6 @@ x_calc_absolute_position (f)
5357 are now relative to the top and left screen edges, 4644 are now relative to the top and left screen edges,
5358 so the flags should correspond. */ 4645 so the flags should correspond. */
5359 f->display.x->size_hint_flags &= ~ (XNegative | YNegative); 4646 f->display.x->size_hint_flags &= ~ (XNegative | YNegative);
5360#else /* ! defined (HAVE_X11) */
5361 WINDOWINFO_TYPE parentinfo;
5362
5363 XGetWindowInfo (FRAME_X_WINDOW (f), &parentinfo);
5364
5365 if (f->display.x->left_pos < 0)
5366 f->display.x->left_pos = parentinfo.width + (f->display.x->left_pos + 1)
5367 - PIXEL_WIDTH (f) - 2 * f->display.x->internal_border_width;
5368
5369 if (f->display.x->top_pos < 0)
5370 f->display.x->top_pos = parentinfo.height + (f->display.x->top_pos + 1)
5371 - PIXEL_HEIGHT (f) - 2 * f->display.x->internal_border_width;
5372#endif /* ! defined (HAVE_X11) */
5373} 4647}
5374 4648
5375/* CHANGE_GRAVITY is 1 when calling from Fset_frame_position, 4649/* CHANGE_GRAVITY is 1 when calling from Fset_frame_position,
@@ -5448,10 +4722,9 @@ x_set_window_size (f, change_gravity, cols, rows)
5448 pixelwidth = CHAR_TO_PIXEL_WIDTH (f, cols); 4722 pixelwidth = CHAR_TO_PIXEL_WIDTH (f, cols);
5449 pixelheight = CHAR_TO_PIXEL_HEIGHT (f, rows); 4723 pixelheight = CHAR_TO_PIXEL_HEIGHT (f, rows);
5450 4724
5451#ifdef HAVE_X11
5452 f->display.x->win_gravity = NorthWestGravity; 4725 f->display.x->win_gravity = NorthWestGravity;
5453 x_wm_set_size_hint (f, 0, 0); 4726 x_wm_set_size_hint (f, 0, 0);
5454#endif /* ! defined (HAVE_X11) */ 4727
5455 XSync (x_current_display, False); 4728 XSync (x_current_display, False);
5456 XChangeWindowSize (FRAME_X_WINDOW (f), pixelwidth, pixelheight); 4729 XChangeWindowSize (FRAME_X_WINDOW (f), pixelwidth, pixelheight);
5457 4730
@@ -5487,18 +4760,6 @@ x_set_window_size (f, change_gravity, cols, rows)
5487 UNBLOCK_INPUT; 4760 UNBLOCK_INPUT;
5488#endif /* not USE_X_TOOLKIT */ 4761#endif /* not USE_X_TOOLKIT */
5489} 4762}
5490
5491#ifndef HAVE_X11
5492x_set_resize_hint (f)
5493 struct frame *f;
5494{
5495 XSetResizeHint (FRAME_X_WINDOW (f),
5496 2 * f->display.x->internal_border_width,
5497 2 * f->display.x->internal_border_width,
5498 FONT_WIDTH (f->display.x->font),
5499 f->display.x->line_height);
5500}
5501#endif /* HAVE_X11 */
5502 4763
5503/* Mouse warping, focus shifting, raising and lowering. */ 4764/* Mouse warping, focus shifting, raising and lowering. */
5504 4765
@@ -5537,7 +4798,6 @@ x_set_mouse_pixel_position (f, pix_x, pix_y)
5537 UNBLOCK_INPUT; 4798 UNBLOCK_INPUT;
5538} 4799}
5539 4800
5540#ifdef HAVE_X11
5541x_focus_on_frame (f) 4801x_focus_on_frame (f)
5542 struct frame *f; 4802 struct frame *f;
5543{ 4803{
@@ -5564,8 +4824,6 @@ x_unfocus_frame (f)
5564#endif /* ! 0 */ 4824#endif /* ! 0 */
5565} 4825}
5566 4826
5567#endif /* ! defined (HAVE_X11) */
5568
5569/* Raise frame F. */ 4827/* Raise frame F. */
5570 4828
5571x_raise_frame (f) 4829x_raise_frame (f)
@@ -5626,7 +4884,6 @@ x_make_frame_visible (f)
5626 4884
5627 if (! FRAME_VISIBLE_P (f)) 4885 if (! FRAME_VISIBLE_P (f))
5628 { 4886 {
5629#ifdef HAVE_X11
5630#ifndef USE_X_TOOLKIT 4887#ifndef USE_X_TOOLKIT
5631 if (! FRAME_ICONIFIED_P (f)) 4888 if (! FRAME_ICONIFIED_P (f))
5632 x_set_offset (f, f->display.x->left_pos, f->display.x->top_pos, 0); 4889 x_set_offset (f, f->display.x->left_pos, f->display.x->top_pos, 0);
@@ -5646,18 +4903,6 @@ x_make_frame_visible (f)
5646 if (FRAME_HAS_VERTICAL_SCROLL_BARS (f)) 4903 if (FRAME_HAS_VERTICAL_SCROLL_BARS (f))
5647 XMapSubwindows (x_current_display, FRAME_X_WINDOW (f)); 4904 XMapSubwindows (x_current_display, FRAME_X_WINDOW (f));
5648#endif 4905#endif
5649#else /* ! defined (HAVE_X11) */
5650 XMapWindow (XDISPLAY FRAME_X_WINDOW (f));
5651 if (f->display.x->icon_desc != 0)
5652 XUnmapWindow (f->display.x->icon_desc);
5653
5654 /* Handled by the MapNotify event for X11 */
5655 f->async_visible = 1;
5656 f->async_iconified = 0;
5657
5658 /* NOTE: this may cause problems for the first frame. */
5659 XTcursor_to (0, 0);
5660#endif /* ! defined (HAVE_X11) */
5661 } 4906 }
5662 4907
5663 XFlushQueue (); 4908 XFlushQueue ();
@@ -5732,7 +4977,6 @@ x_make_frame_invisible (f)
5732 error ("Can't notify window manager of window withdrawal"); 4977 error ("Can't notify window manager of window withdrawal");
5733 } 4978 }
5734#else /* ! defined (HAVE_X11R4) */ 4979#else /* ! defined (HAVE_X11R4) */
5735#ifdef HAVE_X11
5736 4980
5737 /* Tell the window manager what we're going to do. */ 4981 /* Tell the window manager what we're going to do. */
5738 if (! EQ (Vx_no_window_manager, Qt)) 4982 if (! EQ (Vx_no_window_manager, Qt))
@@ -5756,13 +5000,6 @@ x_make_frame_invisible (f)
5756 5000
5757 /* Unmap the window ourselves. Cheeky! */ 5001 /* Unmap the window ourselves. Cheeky! */
5758 XUnmapWindow (x_current_display, window); 5002 XUnmapWindow (x_current_display, window);
5759#else /* ! defined (HAVE_X11) */
5760
5761 XUnmapWindow (FRAME_X_WINDOW (f));
5762 if (f->display.x->icon_desc != 0)
5763 XUnmapWindow (f->display.x->icon_desc);
5764
5765#endif /* ! defined (HAVE_X11) */
5766#endif /* ! defined (HAVE_X11R4) */ 5003#endif /* ! defined (HAVE_X11R4) */
5767 5004
5768 /* We can't distinguish this from iconification 5005 /* We can't distinguish this from iconification
@@ -5825,7 +5062,6 @@ x_iconify_frame (f)
5825 5062
5826 BLOCK_INPUT; 5063 BLOCK_INPUT;
5827 5064
5828#ifdef HAVE_X11
5829 /* Make sure the X server knows where the window should be positioned, 5065 /* Make sure the X server knows where the window should be positioned,
5830 in case the user deiconifies with the window manager. */ 5066 in case the user deiconifies with the window manager. */
5831 if (! FRAME_VISIBLE_P (f) && !FRAME_ICONIFIED_P (f)) 5067 if (! FRAME_VISIBLE_P (f) && !FRAME_ICONIFIED_P (f))
@@ -5871,16 +5107,6 @@ x_iconify_frame (f)
5871 } 5107 }
5872 5108
5873 f->async_iconified = 1; 5109 f->async_iconified = 1;
5874#else /* ! defined (HAVE_X11) */
5875 XUnmapWindow (XDISPLAY FRAME_X_WINDOW (f));
5876
5877 f->async_visible = 0; /* Handled in the UnMap event for X11. */
5878 if (f->display.x->icon_desc != 0)
5879 {
5880 XMapWindow (XDISPLAY f->display.x->icon_desc);
5881 refreshicon (f);
5882 }
5883#endif /* ! defined (HAVE_X11) */
5884 5110
5885 XFlushQueue (); 5111 XFlushQueue ();
5886 UNBLOCK_INPUT; 5112 UNBLOCK_INPUT;
@@ -5922,84 +5148,8 @@ x_destroy_window (f)
5922 UNBLOCK_INPUT; 5148 UNBLOCK_INPUT;
5923} 5149}
5924 5150
5925/* Manage event queues for X10. */
5926
5927#ifndef HAVE_X11
5928
5929/* Manage event queues.
5930
5931 This code is only used by the X10 support.
5932
5933 We cannot leave events in the X queue and get them when we are ready
5934 because X does not provide a subroutine to get only a certain kind
5935 of event but not block if there are no queued events of that kind.
5936
5937 Therefore, we must examine events as they come in and copy events
5938 of certain kinds into our private queues.
5939
5940 All ExposeRegion events are put in x_expose_queue.
5941 All ButtonPress and ButtonRelease events are put in x_mouse_queue. */
5942
5943
5944/* Write the event *P_XREP into the event queue *QUEUE.
5945 If the queue is full, do nothing, but return nonzero. */
5946
5947int
5948enqueue_event (p_xrep, queue)
5949 register XEvent *p_xrep;
5950 register struct event_queue *queue;
5951{
5952 int newindex = queue->windex + 1;
5953 if (newindex == EVENT_BUFFER_SIZE)
5954 newindex = 0;
5955 if (newindex == queue->rindex)
5956 return -1;
5957 queue->xrep[queue->windex] = *p_xrep;
5958 queue->windex = newindex;
5959 return 0;
5960}
5961
5962/* Fetch the next event from queue *QUEUE and store it in *P_XREP.
5963 If *QUEUE is empty, do nothing and return 0. */
5964
5965int
5966dequeue_event (p_xrep, queue)
5967 register XEvent *p_xrep;
5968 register struct event_queue *queue;
5969{
5970 if (queue->windex == queue->rindex)
5971 return 0;
5972 *p_xrep = queue->xrep[queue->rindex++];
5973 if (queue->rindex == EVENT_BUFFER_SIZE)
5974 queue->rindex = 0;
5975 return 1;
5976}
5977
5978/* Return the number of events buffered in *QUEUE. */
5979
5980int
5981queue_event_count (queue)
5982 register struct event_queue *queue;
5983{
5984 int tem = queue->windex - queue->rindex;
5985 if (tem >= 0)
5986 return tem;
5987 return EVENT_BUFFER_SIZE + tem;
5988}
5989
5990/* Return nonzero if mouse input is pending. */
5991
5992int
5993mouse_event_pending_p ()
5994{
5995 return queue_event_count (&x_mouse_queue);
5996}
5997#endif /* HAVE_X11 */
5998
5999/* Setting window manager hints. */ 5151/* Setting window manager hints. */
6000 5152
6001#ifdef HAVE_X11
6002
6003/* Set the normal size hints for the window manager, for frame F. 5153/* Set the normal size hints for the window manager, for frame F.
6004 FLAGS is the flags word to use--or 0 meaning preserve the flags 5154 FLAGS is the flags word to use--or 0 meaning preserve the flags
6005 that the window now has. 5155 that the window now has.
@@ -6251,7 +5401,6 @@ x_term_init (display_name, xrm_option, resource_name)
6251Check the DISPLAY environment variable or use \"-d\"\n", 5401Check the DISPLAY environment variable or use \"-d\"\n",
6252 display_name); 5402 display_name);
6253 5403
6254#ifdef HAVE_X11
6255 { 5404 {
6256#if 0 5405#if 0
6257 XSetAfterFunction (x_current_display, x_trace_wire); 5406 XSetAfterFunction (x_current_display, x_trace_wire);
@@ -6280,8 +5429,6 @@ Check the DISPLAY environment variable or use \"-d\"\n",
6280 change_keyboard_wait_descriptor (ConnectionNumber (x_current_display)); 5429 change_keyboard_wait_descriptor (ConnectionNumber (x_current_display));
6281 change_input_fd (ConnectionNumber (x_current_display)); 5430 change_input_fd (ConnectionNumber (x_current_display));
6282 5431
6283#endif /* HAVE_X11 */
6284
6285#ifndef F_SETOWN_BUG 5432#ifndef F_SETOWN_BUG
6286#ifdef F_SETOWN 5433#ifdef F_SETOWN
6287 old_fcntl_owner = fcntl (ConnectionNumber (x_current_display), F_GETOWN, 0); 5434 old_fcntl_owner = fcntl (ConnectionNumber (x_current_display), F_GETOWN, 0);
@@ -6357,5 +5504,4 @@ syms_of_xterm ()
6357 staticpro (&mouse_face_window); 5504 staticpro (&mouse_face_window);
6358 mouse_face_window = Qnil; 5505 mouse_face_window = Qnil;
6359} 5506}
6360#endif /* ! defined (HAVE_X11) */
6361#endif /* ! defined (HAVE_X_WINDOWS) */ 5507#endif /* ! defined (HAVE_X_WINDOWS) */