Mercurial > hg > xemacs-beta
comparison src/frame-x.c @ 5178:97eb4942aec8
merge
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Mon, 29 Mar 2010 21:28:13 -0500 |
parents | 8b2f75cecb89 7be849cb8828 |
children | 6466bc9ebf15 |
comparison
equal
deleted
inserted
replaced
5177:b785049378e3 | 5178:97eb4942aec8 |
---|---|
1 /* Functions for the X window system. | 1 /* Functions for the X window system. |
2 Copyright (C) 1989, 1992-5, 1997 Free Software Foundation, Inc. | 2 Copyright (C) 1989, 1992-5, 1997 Free Software Foundation, Inc. |
3 Copyright (C) 1995, 1996, 2001, 2002, 2004, 2010 Ben Wing. | 3 Copyright (C) 1995, 1996, 2001, 2002, 2004, 2010 Ben Wing. |
4 Copyright (C) 2010 Didier Verna | |
4 | 5 |
5 This file is part of XEmacs. | 6 This file is part of XEmacs. |
6 | 7 |
7 XEmacs is free software; you can redistribute it and/or modify it | 8 XEmacs is free software; you can redistribute it and/or modify it |
8 under the terms of the GNU General Public License as published by the | 9 under the terms of the GNU General Public License as published by the |
72 { XD_LISP_OBJECT, offsetof (struct x_frame, icon_pixmap_mask) }, | 73 { XD_LISP_OBJECT, offsetof (struct x_frame, icon_pixmap_mask) }, |
73 { XD_END } | 74 { XD_END } |
74 }; | 75 }; |
75 | 76 |
76 #ifdef NEW_GC | 77 #ifdef NEW_GC |
77 DEFINE_LRECORD_IMPLEMENTATION ("x-frame", x_frame, | 78 DEFINE_DUMPABLE_INTERNAL_LISP_OBJECT ("x-frame", x_frame, |
78 1, /*dumpable-flag*/ | 79 0, x_frame_data_description_1, |
79 0, 0, 0, 0, 0, | 80 Lisp_X_Frame); |
80 x_frame_data_description_1, | |
81 Lisp_X_Frame); | |
82 #else /* not NEW_GC */ | 81 #else /* not NEW_GC */ |
83 extern const struct sized_memory_description x_frame_data_description; | 82 extern const struct sized_memory_description x_frame_data_description; |
84 | 83 |
85 const struct sized_memory_description x_frame_data_description = { | 84 const struct sized_memory_description x_frame_data_description = { |
86 sizeof (struct x_frame), x_frame_data_description_1 | 85 sizeof (struct x_frame), x_frame_data_description_1 |
533 } | 532 } |
534 while (root != parent); | 533 while (root != parent); |
535 XGetWindowAttributes (d, w, &xwa); | 534 XGetWindowAttributes (d, w, &xwa); |
536 *x = xwa.x; | 535 *x = xwa.x; |
537 *y = xwa.y; | 536 *y = xwa.y; |
537 } | |
538 | |
539 void x_get_frame_text_position (struct frame *f) | |
540 { | |
541 Display *dpy = DEVICE_X_DISPLAY (XDEVICE (FRAME_DEVICE (f))); | |
542 Window window = XtWindow (FRAME_X_TEXT_WIDGET (f)); | |
543 Window root, child; | |
544 int x, y; | |
545 unsigned int width, height, border_width; | |
546 unsigned int depth; | |
547 | |
548 XGetGeometry (dpy, window, &root, &x, &y, &width, &height, &border_width, | |
549 &depth); | |
550 XTranslateCoordinates (dpy, window, root, 0, 0, &x, &y, &child); | |
551 | |
552 FRAME_X_X (f) = x; | |
553 FRAME_X_Y (f) = y; | |
538 } | 554 } |
539 | 555 |
540 #if 0 | 556 #if 0 |
541 static void | 557 static void |
542 x_smash_bastardly_shell_position (Widget shell) | 558 x_smash_bastardly_shell_position (Widget shell) |
1432 /* set the position of the frame's root window now. When the | 1448 /* set the position of the frame's root window now. When the |
1433 frame was created, the position was initialized to (0,0). */ | 1449 frame was created, the position was initialized to (0,0). */ |
1434 { | 1450 { |
1435 struct window *win = XWINDOW (f->root_window); | 1451 struct window *win = XWINDOW (f->root_window); |
1436 | 1452 |
1437 WINDOW_LEFT (win) = FRAME_LEFT_BORDER_END (f) | 1453 WINDOW_LEFT (win) = FRAME_PANED_LEFT_EDGE (f); |
1438 + FRAME_LEFT_GUTTER_BOUNDS (f); | 1454 WINDOW_TOP (win) = FRAME_PANED_TOP_EDGE (f); |
1439 WINDOW_TOP (win) = FRAME_TOP_BORDER_END (f) | |
1440 + FRAME_TOP_GUTTER_BOUNDS (f); | |
1441 | 1455 |
1442 if (!NILP (f->minibuffer_window)) | 1456 if (!NILP (f->minibuffer_window)) |
1443 { | 1457 { |
1444 win = XWINDOW (f->minibuffer_window); | 1458 win = XWINDOW (f->minibuffer_window); |
1445 WINDOW_LEFT (win) = FRAME_LEFT_BORDER_END (f) | 1459 WINDOW_LEFT (win) = FRAME_PANED_LEFT_EDGE (f); |
1446 + FRAME_LEFT_GUTTER_BOUNDS (f); | |
1447 } | 1460 } |
1448 } | 1461 } |
1449 | 1462 |
1450 #ifdef EXTERNAL_WIDGET | 1463 #ifdef EXTERNAL_WIDGET |
1451 /* If we're an external widget, then the size of the frame is predetermined | 1464 /* If we're an external widget, then the size of the frame is predetermined |
2033 static void | 2046 static void |
2034 allocate_x_frame_struct (struct frame *f) | 2047 allocate_x_frame_struct (struct frame *f) |
2035 { | 2048 { |
2036 /* zero out all slots. */ | 2049 /* zero out all slots. */ |
2037 #ifdef NEW_GC | 2050 #ifdef NEW_GC |
2038 f->frame_data = alloc_lrecord_type (struct x_frame, &lrecord_x_frame); | 2051 f->frame_data = XX_FRAME (ALLOC_NORMAL_LISP_OBJECT (x_frame)); |
2039 #else /* not NEW_GC */ | 2052 #else /* not NEW_GC */ |
2040 f->frame_data = xnew_and_zero (struct x_frame); | 2053 f->frame_data = xnew_and_zero (struct x_frame); |
2041 #endif /* not NEW_GC */ | 2054 #endif /* not NEW_GC */ |
2042 | 2055 |
2043 /* yeah, except the lisp ones */ | 2056 /* yeah, except the lisp ones */ |
2117 } | 2130 } |
2118 | 2131 |
2119 static void | 2132 static void |
2120 x_init_frame_3 (struct frame *f) | 2133 x_init_frame_3 (struct frame *f) |
2121 { | 2134 { |
2122 /* Pop up the frame. */ | 2135 /* #### NOTE: This whole business of splitting frame initialization into |
2123 | 2136 #### different functions is somewhat messy. The latest one seems a good |
2137 #### place to initialize the edit widget's position because we're sure | |
2138 #### that the frame is now relalized. -- dvl */ | |
2139 | |
2124 x_popup_frame (f); | 2140 x_popup_frame (f); |
2141 x_get_frame_text_position (f); | |
2125 } | 2142 } |
2126 | 2143 |
2127 static void | 2144 static void |
2128 x_mark_frame (struct frame *f) | 2145 x_mark_frame (struct frame *f) |
2129 { | 2146 { |
2746 | 2763 |
2747 void | 2764 void |
2748 syms_of_frame_x (void) | 2765 syms_of_frame_x (void) |
2749 { | 2766 { |
2750 #ifdef NEW_GC | 2767 #ifdef NEW_GC |
2751 INIT_LRECORD_IMPLEMENTATION (x_frame); | 2768 INIT_LISP_OBJECT (x_frame); |
2752 #endif /* NEW_GC */ | 2769 #endif /* NEW_GC */ |
2753 | 2770 |
2754 DEFSYMBOL (Qoverride_redirect); | 2771 DEFSYMBOL (Qoverride_redirect); |
2755 DEFSYMBOL (Qx_resource_name); | 2772 DEFSYMBOL (Qx_resource_name); |
2756 | 2773 |