Mercurial > hg > xemacs-beta
comparison src/frame-x.c @ 442:abe6d1db359e r21-2-36
Import from CVS: tag r21-2-36
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:35:02 +0200 |
parents | 8de8e3f6228a |
children | 98528da0b7fc |
comparison
equal
deleted
inserted
replaced
441:72a7cfa4a488 | 442:abe6d1db359e |
---|---|
20 Boston, MA 02111-1307, USA. */ | 20 Boston, MA 02111-1307, USA. */ |
21 | 21 |
22 /* Synched up with: Not synched with FSF. */ | 22 /* Synched up with: Not synched with FSF. */ |
23 | 23 |
24 /* Substantially rewritten for XEmacs. */ | 24 /* Substantially rewritten for XEmacs. */ |
25 | |
26 /* 7-8-00 !!#### This file needs definite Mule review. */ | |
25 | 27 |
26 #include <config.h> | 28 #include <config.h> |
27 #include "lisp.h" | 29 #include "lisp.h" |
28 | 30 |
29 #include "console-x.h" | 31 #include "console-x.h" |
48 #include "events.h" | 50 #include "events.h" |
49 #include "extents.h" | 51 #include "extents.h" |
50 #include "faces.h" | 52 #include "faces.h" |
51 #include "frame.h" | 53 #include "frame.h" |
52 #include "window.h" | 54 #include "window.h" |
55 #include "gutter.h" | |
53 | 56 |
54 #ifdef HAVE_DRAGNDROP | 57 #ifdef HAVE_DRAGNDROP |
55 #include "dragdrop.h" | 58 #include "dragdrop.h" |
56 #endif | 59 #endif |
57 | 60 |
111 if (!w) | 114 if (!w) |
112 return 0; | 115 return 0; |
113 | 116 |
114 /* We used to map over all frames here and then map over all widgets | 117 /* We used to map over all frames here and then map over all widgets |
115 belonging to that frame. However it turns out that this was very fragile | 118 belonging to that frame. However it turns out that this was very fragile |
116 as it requires our display stuctures to be in sync _and_ that the | 119 as it requires our display structures to be in sync _and_ that the |
117 loop is told about every new widget somebody adds. Therefore we | 120 loop is told about every new widget somebody adds. Therefore we |
118 now let Xt find it for us (which does a bottom-up search which | 121 now let Xt find it for us (which does a bottom-up search which |
119 could even be faster) */ | 122 could even be faster) */ |
120 return x_any_widget_or_parent_to_frame (d, w); | 123 return x_any_widget_or_parent_to_frame (d, w); |
121 } | 124 } |
657 Bufbyte *ptr; | 660 Bufbyte *ptr; |
658 /* Optimize for common ASCII case */ | 661 /* Optimize for common ASCII case */ |
659 for (ptr = value; *ptr; ptr++) | 662 for (ptr = value; *ptr; ptr++) |
660 if (!BYTE_ASCII_P (*ptr)) | 663 if (!BYTE_ASCII_P (*ptr)) |
661 { | 664 { |
662 CONST char * tmp; | 665 const char * tmp; |
663 encoding = DEVICE_XATOM_COMPOUND_TEXT (XDEVICE (FRAME_DEVICE (f))); | 666 encoding = DEVICE_XATOM_COMPOUND_TEXT (XDEVICE (FRAME_DEVICE (f))); |
664 TO_EXTERNAL_FORMAT (C_STRING, value, | 667 C_STRING_TO_EXTERNAL (value, tmp, Qctext); |
665 C_STRING_ALLOCA, tmp, | |
666 Qctext); | |
667 new_XtValue = (String) tmp; | 668 new_XtValue = (String) tmp; |
668 break; | 669 break; |
669 } | 670 } |
670 #endif /* MULE */ | 671 #endif /* MULE */ |
671 | 672 |
758 Lisp_Object prop = Fcar (tail); | 759 Lisp_Object prop = Fcar (tail); |
759 Lisp_Object val = Fcar (Fcdr (tail)); | 760 Lisp_Object val = Fcar (Fcdr (tail)); |
760 | 761 |
761 if (STRINGP (prop)) | 762 if (STRINGP (prop)) |
762 { | 763 { |
763 CONST char *extprop; | 764 const char *extprop; |
764 | 765 |
765 if (XSTRING_LENGTH (prop) == 0) | 766 if (XSTRING_LENGTH (prop) == 0) |
766 continue; | 767 continue; |
767 | 768 |
768 TO_EXTERNAL_FORMAT (LISP_STRING, prop, | 769 LISP_STRING_TO_EXTERNAL (prop, extprop, Qctext); |
769 C_STRING_ALLOCA, extprop, | |
770 Qctext); | |
771 if (STRINGP (val)) | 770 if (STRINGP (val)) |
772 { | 771 { |
773 CONST Extbyte *extval; | 772 const Extbyte *extval; |
774 Extcount extvallen; | 773 Extcount extvallen; |
775 | 774 |
776 TO_EXTERNAL_FORMAT (LISP_STRING, val, | 775 TO_EXTERNAL_FORMAT (LISP_STRING, val, |
777 ALLOCA, (extval, extvallen), | 776 ALLOCA, (extval, extvallen), |
778 Qctext); | 777 Qctext); |
1144 { | 1143 { |
1145 x_event.xbutton.x_root = lisp_event->event.button.x; /* this is wrong */ | 1144 x_event.xbutton.x_root = lisp_event->event.button.x; /* this is wrong */ |
1146 x_event.xbutton.y_root = lisp_event->event.button.y; | 1145 x_event.xbutton.y_root = lisp_event->event.button.y; |
1147 } | 1146 } |
1148 modifier = lisp_event->event.button.modifiers; | 1147 modifier = lisp_event->event.button.modifiers; |
1149 if (modifier & MOD_SHIFT) state |= ShiftMask; | 1148 if (modifier & XEMACS_MOD_SHIFT) state |= ShiftMask; |
1150 if (modifier & MOD_CONTROL) state |= ControlMask; | 1149 if (modifier & XEMACS_MOD_CONTROL) state |= ControlMask; |
1151 if (modifier & MOD_META) state |= xd->MetaMask; | 1150 if (modifier & XEMACS_MOD_META) state |= xd->MetaMask; |
1152 if (modifier & MOD_SUPER) state |= xd->SuperMask; | 1151 if (modifier & XEMACS_MOD_SUPER) state |= xd->SuperMask; |
1153 if (modifier & MOD_HYPER) state |= xd->HyperMask; | 1152 if (modifier & XEMACS_MOD_HYPER) state |= xd->HyperMask; |
1154 if (modifier & MOD_ALT) state |= xd->AltMask; | 1153 if (modifier & XEMACS_MOD_ALT) state |= xd->AltMask; |
1155 state |= Button1Mask << (lisp_event->event.button.button-1); | 1154 state |= Button1Mask << (lisp_event->event.button.button-1); |
1156 | 1155 |
1157 x_event.xbutton.state = state; | 1156 x_event.xbutton.state = state; |
1158 x_event.xbutton.button = lisp_event->event.button.button; | 1157 x_event.xbutton.button = lisp_event->event.button.button; |
1159 x_event.xkey.same_screen = True; | 1158 x_event.xkey.same_screen = True; |
1189 numItems=0; | 1188 numItems=0; |
1190 xfree(Ctext); | 1189 xfree(Ctext); |
1191 Ctext=NULL; | 1190 Ctext=NULL; |
1192 break; | 1191 break; |
1193 } | 1192 } |
1194 strcpy (Ctext+pos, (CONST char *)XSTRING_DATA (XCAR (item))); | 1193 strcpy (Ctext+pos, (const char *)XSTRING_DATA (XCAR (item))); |
1195 pos += XSTRING_LENGTH (XCAR (item)) + 1; | 1194 pos += XSTRING_LENGTH (XCAR (item)) + 1; |
1196 item = XCDR (item); | 1195 item = XCDR (item); |
1197 } | 1196 } |
1198 Ctext[pos] = 0; | 1197 Ctext[pos] = 0; |
1199 | 1198 |
1365 xfree (dnd_data); | 1364 xfree (dnd_data); |
1366 return Qnil; | 1365 return Qnil; |
1367 } | 1366 } |
1368 len = XSTRING_LENGTH (XCAR (run)) + 1; | 1367 len = XSTRING_LENGTH (XCAR (run)) + 1; |
1369 dnd_data = (char *) xrealloc (dnd_data, dnd_len + len); | 1368 dnd_data = (char *) xrealloc (dnd_data, dnd_len + len); |
1370 strcpy (dnd_data + dnd_len - 1, (CONST char *)XSTRING_DATA (XCAR (run))); | 1369 strcpy (dnd_data + dnd_len - 1, (const char *)XSTRING_DATA (XCAR (run))); |
1371 dnd_len += len; | 1370 dnd_len += len; |
1372 run = XCDR (run); | 1371 run = XCDR (run); |
1373 } | 1372 } |
1374 | 1373 |
1375 dnd_data[dnd_len - 1] = 0; /* the list-ending zero */ | 1374 dnd_data[dnd_len - 1] = 0; /* the list-ending zero */ |
1410 x_event.xbutton.x_root = lisp_event->event.button.x; /* this is wrong */ | 1409 x_event.xbutton.x_root = lisp_event->event.button.x; /* this is wrong */ |
1411 x_event.xbutton.y_root = lisp_event->event.button.y; | 1410 x_event.xbutton.y_root = lisp_event->event.button.y; |
1412 } | 1411 } |
1413 | 1412 |
1414 modifier = lisp_event->event.button.modifiers; | 1413 modifier = lisp_event->event.button.modifiers; |
1415 if (modifier & MOD_SHIFT) state |= ShiftMask; | 1414 if (modifier & XEMACS_MOD_SHIFT) state |= ShiftMask; |
1416 if (modifier & MOD_CONTROL) state |= ControlMask; | 1415 if (modifier & XEMACS_MOD_CONTROL) state |= ControlMask; |
1417 if (modifier & MOD_META) state |= xd->MetaMask; | 1416 if (modifier & XEMACS_MOD_META) state |= xd->MetaMask; |
1418 if (modifier & MOD_SUPER) state |= xd->SuperMask; | 1417 if (modifier & XEMACS_MOD_SUPER) state |= xd->SuperMask; |
1419 if (modifier & MOD_HYPER) state |= xd->HyperMask; | 1418 if (modifier & XEMACS_MOD_HYPER) state |= xd->HyperMask; |
1420 if (modifier & MOD_ALT) state |= xd->AltMask; | 1419 if (modifier & XEMACS_MOD_ALT) state |= xd->AltMask; |
1421 state |= Button1Mask << (lisp_event->event.button.button-1); | 1420 state |= Button1Mask << (lisp_event->event.button.button-1); |
1422 | 1421 |
1423 x_event.xbutton.state = state; | 1422 x_event.xbutton.state = state; |
1424 x_event.xbutton.button = lisp_event->event.button.button; | 1423 x_event.xbutton.button = lisp_event->event.button.button; |
1425 x_event.xkey.same_screen = True; | 1424 x_event.xkey.same_screen = True; |
1548 /* set the position of the frame's root window now. When the | 1547 /* set the position of the frame's root window now. When the |
1549 frame was created, the position was initialized to (0,0). */ | 1548 frame was created, the position was initialized to (0,0). */ |
1550 { | 1549 { |
1551 struct window *win = XWINDOW (f->root_window); | 1550 struct window *win = XWINDOW (f->root_window); |
1552 | 1551 |
1553 WINDOW_LEFT (win) = FRAME_LEFT_BORDER_END (f); | 1552 WINDOW_LEFT (win) = FRAME_LEFT_BORDER_END (f) |
1554 WINDOW_TOP (win) = FRAME_TOP_BORDER_END (f); | 1553 + FRAME_LEFT_GUTTER_BOUNDS (f); |
1554 WINDOW_TOP (win) = FRAME_TOP_BORDER_END (f) | |
1555 + FRAME_TOP_GUTTER_BOUNDS (f); | |
1555 | 1556 |
1556 if (!NILP (f->minibuffer_window)) | 1557 if (!NILP (f->minibuffer_window)) |
1557 { | 1558 { |
1558 win = XWINDOW (f->minibuffer_window); | 1559 win = XWINDOW (f->minibuffer_window); |
1559 WINDOW_LEFT (win) = FRAME_LEFT_BORDER_END (f); | 1560 WINDOW_LEFT (win) = FRAME_LEFT_BORDER_END (f) |
1561 + FRAME_LEFT_GUTTER_BOUNDS (f); | |
1560 } | 1562 } |
1561 } | 1563 } |
1562 | 1564 |
1563 #ifdef EXTERNAL_WIDGET | 1565 #ifdef EXTERNAL_WIDGET |
1564 /* If we're an external widget, then the size of the frame is predetermined | 1566 /* If we're an external widget, then the size of the frame is predetermined |
1859 int depth = DEVICE_X_DEPTH (d); | 1861 int depth = DEVICE_X_DEPTH (d); |
1860 Colormap cmap = DEVICE_X_COLORMAP (d); | 1862 Colormap cmap = DEVICE_X_COLORMAP (d); |
1861 #ifdef EXTERNAL_WIDGET | 1863 #ifdef EXTERNAL_WIDGET |
1862 Window window_id = 0; | 1864 Window window_id = 0; |
1863 #endif | 1865 #endif |
1864 CONST char *name; | 1866 const char *name; |
1865 Arg al [25]; | 1867 Arg al [25]; |
1866 int ac = 0; | 1868 int ac = 0; |
1867 Widget text, container, shell; | 1869 Widget text, container, shell; |
1868 Widget parentwid = 0; | 1870 Widget parentwid = 0; |
1869 #ifdef HAVE_MENUBARS | 1871 #ifdef HAVE_MENUBARS |
1870 int menubar_visible; | 1872 int menubar_visible; |
1871 Widget menubar; | 1873 Widget menubar; |
1872 #endif | 1874 #endif |
1873 | 1875 |
1874 if (STRINGP (f->name)) | 1876 if (STRINGP (f->name)) |
1875 TO_EXTERNAL_FORMAT (LISP_STRING, f->name, | 1877 LISP_STRING_TO_EXTERNAL (f->name, name, Qctext); |
1876 C_STRING_ALLOCA, name, | |
1877 Qctext); | |
1878 else | 1878 else |
1879 name = "emacs"; | 1879 name = "emacs"; |
1880 | 1880 |
1881 /* The widget hierarchy is | 1881 /* The widget hierarchy is |
1882 | 1882 |
2482 xwc.stack_mode = Below; | 2482 xwc.stack_mode = Below; |
2483 if (!XReconfigureWMWindow (display, XtWindow (FRAME_X_SHELL_WIDGET (f)), | 2483 if (!XReconfigureWMWindow (display, XtWindow (FRAME_X_SHELL_WIDGET (f)), |
2484 DefaultScreen (display), flags, &xwc)) | 2484 DefaultScreen (display), flags, &xwc)) |
2485 x_cant_notify_wm_error (); | 2485 x_cant_notify_wm_error (); |
2486 } | 2486 } |
2487 } | |
2488 | |
2489 static void | |
2490 x_enable_frame (struct frame *f) | |
2491 { | |
2492 XtSetSensitive (FRAME_X_SHELL_WIDGET (f), True); | |
2493 } | |
2494 | |
2495 static void | |
2496 x_disable_frame (struct frame *f) | |
2497 { | |
2498 XtSetSensitive (FRAME_X_SHELL_WIDGET (f), False); | |
2487 } | 2499 } |
2488 | 2500 |
2489 /* Change from withdrawn state to mapped state. */ | 2501 /* Change from withdrawn state to mapped state. */ |
2490 static void | 2502 static void |
2491 x_make_frame_visible (struct frame *f) | 2503 x_make_frame_visible (struct frame *f) |
2787 CONSOLE_HAS_METHOD (x, delete_frame); | 2799 CONSOLE_HAS_METHOD (x, delete_frame); |
2788 CONSOLE_HAS_METHOD (x, get_mouse_position); | 2800 CONSOLE_HAS_METHOD (x, get_mouse_position); |
2789 CONSOLE_HAS_METHOD (x, set_mouse_position); | 2801 CONSOLE_HAS_METHOD (x, set_mouse_position); |
2790 CONSOLE_HAS_METHOD (x, raise_frame); | 2802 CONSOLE_HAS_METHOD (x, raise_frame); |
2791 CONSOLE_HAS_METHOD (x, lower_frame); | 2803 CONSOLE_HAS_METHOD (x, lower_frame); |
2804 CONSOLE_HAS_METHOD (x, enable_frame); | |
2805 CONSOLE_HAS_METHOD (x, disable_frame); | |
2792 CONSOLE_HAS_METHOD (x, make_frame_visible); | 2806 CONSOLE_HAS_METHOD (x, make_frame_visible); |
2793 CONSOLE_HAS_METHOD (x, make_frame_invisible); | 2807 CONSOLE_HAS_METHOD (x, make_frame_invisible); |
2794 CONSOLE_HAS_METHOD (x, iconify_frame); | 2808 CONSOLE_HAS_METHOD (x, iconify_frame); |
2795 CONSOLE_HAS_METHOD (x, set_frame_size); | 2809 CONSOLE_HAS_METHOD (x, set_frame_size); |
2796 CONSOLE_HAS_METHOD (x, set_frame_position); | 2810 CONSOLE_HAS_METHOD (x, set_frame_position); |