User: stephent
Date: 06/05/06 19:56:04
Modified: xemacs/src ChangeLog EmacsFrame.c EmacsFrameP.h
EmacsManager.c EmacsShell-sub.c console-x-impl.h
console-x.c emacs.c frame-x.c symsinit.h
Log:
metacity maximization fix, see src/ChangeLog.
<87ejz7t57b.fsf_-_(a)tleepslib.sk.tsukuba.ac.jp>
Revision Changes Path
1.955 +26 -0 XEmacs/xemacs/src/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/ChangeLog,v
retrieving revision 1.954
retrieving revision 1.955
diff -u -p -r1.954 -r1.955
--- ChangeLog 2006/05/06 08:46:38 1.954
+++ ChangeLog 2006/05/06 17:55:58 1.955
@@ -1,3 +1,29 @@
+2006-04-30 Stephen J. Turnbull <stephen(a)xemacs.org>
+
+ Move geometry management from EmacsFrameResize to x_set_frame_size.
+ Should fix "metacity maximization" bug.
+ Provide (deprecated, temporary) backward compatibility option.
+
+ * EmacsFrame.c (EmacsFrameResize):
+ * frame-x.c (x_set_frame_size):
+ Move call of EmacsManagerChangeSize.
+ Don't bogusly notify WM about size changes the WM asked for.
+
+ * console-x.c (wedge-metacity): New builtin Boolean Lisp variable.
+ * console-x-impl.h (wedge_metacity): Declare C variable.
+ * console-x.c (vars_of_console_x): New function to initialize it.
+ * symsinit.h (vars_of_console_x): declare it.
+ * emacs.c (main_1): Call vars_of_console_x.
+
+ * EmacsFrameP.h (struct EmacsFrame):
+ * EmacsManager.c (EmacsManagerChangeSize):
+ * EmacsShell-sub.c (SuperClassRootGeometryManager):
+ * console-x-impl.h (wedge_metacity):
+ Various comments, some improved documentation, mostly sad comments
+ on the state of the art of Xt programming.
+
+ * frame-x.c (defi): #undef it. (Random code cleanliness.)
+
2006-05-06 Aidan Kehoe <kehoea(a)parhasard.net>
* lisp.h (struct Lisp_Subr):
1.29 +25 -12 XEmacs/xemacs/src/EmacsFrame.c
Index: EmacsFrame.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/EmacsFrame.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -p -r1.28 -r1.29
--- EmacsFrame.c 2005/10/25 11:16:20 1.28
+++ EmacsFrame.c 2006/05/06 17:55:59 1.29
@@ -360,19 +360,32 @@ EmacsFrameResize (Widget widget)
pixel_to_char_size (f, ew->core.width, ew->core.height, &columns, &rows);
change_frame_size (f, rows, columns, 0);
- /* Now we tell the EmacsShell that we've changed the size of the non-fixed
- portion of the frame. Note that, if we the resize occurred as a result
- of EmacsFrameSetCharSize(), this information will be stored twice.
- This is not a big deal, as storing this information doesn't actually
- do anything until the next resize. */
- if (FRAME_X_TOP_LEVEL_FRAME_P (f))
- x_wm_set_variable_size (FRAME_X_SHELL_WIDGET (f), columns, rows);
+ /* The code below is just plain wrong. If the EmacsShell or EmacsManager
+ needs to know, they should just ask. If needed information is being
+ updated here, then we should set a dirty flag and have it updated on an
+ as-needed basis.
+ For now, conditionalize so people can get work done if this breaks
+ something. */
+ if (wedge_metacity) /* cf. x_set_frame_size */
+ {
+ /* Now we tell the EmacsShell that we've changed the size of the
+ non-fixed portion of the frame. Note that, if the resize occurred
+ as a result of EmacsFrameSetCharSize(), this information will be
+ stored twice. This is not a big deal, as storing this information
+ doesn't actually do anything until the next resize. */
+ if (FRAME_X_TOP_LEVEL_FRAME_P (f))
+ x_wm_set_variable_size (FRAME_X_SHELL_WIDGET (f), columns, rows);
- /* Kick the manager so that it knows we've changed size. */
- req.request_mode = 0;
- XtQueryGeometry (FRAME_X_CONTAINER_WIDGET (f), &req, &repl);
- EmacsManagerChangeSize (FRAME_X_CONTAINER_WIDGET (f), repl.width,
- repl.height);
+ /* Kick the manager so that it knows we've changed size.
+ #### No, no, no! If this does anything at all, it will involve
+ changing the manager's size. That's not something that a child
+ widget should initialize as part of a purely informational
+ method!! */
+ req.request_mode = 0;
+ XtQueryGeometry (FRAME_X_CONTAINER_WIDGET (f), &req, &repl);
+ EmacsManagerChangeSize (FRAME_X_CONTAINER_WIDGET (f),
+ repl.width, repl.height);
+ }
}
static Boolean
1.8 +7 -4 XEmacs/xemacs/src/EmacsFrameP.h
Index: EmacsFrameP.h
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/EmacsFrameP.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -p -r1.7 -r1.8
--- EmacsFrameP.h 2003/05/04 02:34:35 1.7
+++ EmacsFrameP.h 2006/05/06 17:55:59 1.8
@@ -65,13 +65,16 @@ typedef struct {
Boolean iconic; /* whether this frame is iconic */
/* The rest of this is crap and should be deleted.
+ #### Comments that start with + are fields that actually get referred
+ to somewhere aside from the init function.
+ I guess the "crap" has mostly moved to specifiers?
*/
Boolean minibuffer; /* 0: normal frames with minibuffers.
* 1: frames without minibuffers
* 2: minibuffer only. */
Boolean unsplittable; /* frame can only have one window */
- int internal_border_width; /* internal borders */
+ int internal_border_width; /* + internal borders */
int scrollbar_width; /* width of frame vertical sb's */
int scrollbar_height; /* height of frame horizontal sb's */
int top_toolbar_height; /* height of top toolbar */
@@ -82,9 +85,9 @@ typedef struct {
int bottom_toolbar_border_width; /* ... of bottom toolbar */
int left_toolbar_border_width; /* ... of left toolbar */
int right_toolbar_border_width; /* ... of right toolbar */
- Dimension toolbar_shadow_thickness;
+ Dimension toolbar_shadow_thickness; /* + of shadows */
unsigned char scrollbar_placement;
- int interline; /* skips between lines */
+ int interline; /* + skips between lines */
XFontStruct* font; /* font */
Pixel foreground_pixel; /* foreground */
@@ -97,7 +100,7 @@ typedef struct {
int bell_volume; /* how loud is beep */
Boolean menubar_p; /* initially show a menubar? */
- Boolean initially_unmapped; /* inhibit initial window mapping */
+ Boolean initially_unmapped; /* + inhibit initial window mapping */
Boolean use_backing_store; /* backing store for menubar & ew? */
Dimension preferred_width; /* if non-zero, preferred size for */
1.8 +6 -0 XEmacs/xemacs/src/EmacsManager.c
Index: EmacsManager.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/EmacsManager.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -p -r1.7 -r1.8
--- EmacsManager.c 2004/12/22 10:59:09 1.7
+++ EmacsManager.c 2006/05/06 17:55:59 1.8
@@ -241,6 +241,12 @@ EmacsManagerChangeSize (Widget w, Dimens
if (height == 0)
height = w->core.height;
+ /* #### AFAICT this gets called in two places. One is in ChangeManaged(),
+ above. The other is in EmacsFrameResize(). Perhaps ChangeManaged()
+ should initiate resize requests, but EmacsFrameResize() should not.
+ Unfortunately, I've tried making this conditional on whether we're
+ called from EmacsFrameResize() or not, but that results in an infloop
+ via the callback to x_layout_widgets() in Resize(). Whee! */
/* do nothing if we're already that size */
if (w->core.width != width || w->core.height != height)
{
1.8 +5 -1 XEmacs/xemacs/src/EmacsShell-sub.c
Index: EmacsShell-sub.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/EmacsShell-sub.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -p -r1.7 -r1.8
--- EmacsShell-sub.c 2005/01/24 23:33:46 1.7
+++ EmacsShell-sub.c 2006/05/06 17:55:59 1.8
@@ -278,7 +278,8 @@ SuperClassRootGeometryManager (Widget gw
GenericClassExtRec *gcer;
/* find the shell extension record that specifies the
- root geometry manager method */
+ root geometry manager method
+ #### We could use XtGetClassExtension here. */
for (gcer = (GenericClassExtRec *) swc->shell_class.extension;
gcer;
gcer = (GenericClassExtRec *) gcer->next_extension)
@@ -287,6 +288,9 @@ SuperClassRootGeometryManager (Widget gw
break;
}
+ /* #### The R11.6.4 Xt specification says if we don't find NULLQUARK here,
+ we should assume root_geometry_manager = XtInheritRootGeometryManager.
+ Is that actually callable? */
if (!gcer)
ABORT ();
1.6 +12 -4 XEmacs/xemacs/src/console-x-impl.h
Index: console-x-impl.h
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/console-x-impl.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -p -r1.5 -r1.6
--- console-x-impl.h 2005/11/26 11:46:07 1.5
+++ console-x-impl.h 2006/05/06 17:55:59 1.6
@@ -40,6 +40,8 @@ Boston, MA 02111-1307, USA. */
DECLARE_CONSOLE_TYPE (x);
+extern int wedge_metacity;
+
struct x_device
{
#ifdef NEW_GC
@@ -234,7 +236,8 @@ DECLARE_LRECORD (x_device, Lisp_X_Device
/* The maximum number of widgets that can be displayed above the text
area at one time. Currently no more than 3 will ever actually be
- displayed (menubar, psheet, debugger panel). */
+ displayed (menubar, psheet, debugger panel).
+ #### Are "psheet" and "debugger panel" relevant any more? */
#define MAX_CONCURRENT_TOP_WIDGETS 8
struct x_frame
@@ -243,12 +246,17 @@ struct x_frame
struct lrecord_header header;
#endif /* NEW_GC */
- /* The widget of this frame. This is an EmacsShell or an
- ExternalShell. */
+ /* The widget of this frame.
+ This is an EmacsShell or an ExternalShell.
+ It negotiates with the window manager or containing app on behalf of
+ the container widget. Should be (but isn't) invisible to Emacs. */
Widget widget;
/* The parent of the EmacsFrame, the menubar, and the scrollbars.
- This is an EmacsManager. */
+ This is an EmacsManager.
+ It is responsible for managing the geometry of the frame. This is what
+ Emacs mostly talks to. Anything that affects its geometry will be
+ reflected in the Shell widget, and thus cause WM interaction. */
Widget container;
/* The widget of the menubar, of whatever widget class it happens to be. */
1.17 +18 -0 XEmacs/xemacs/src/console-x.c
Index: console-x.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/console-x.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -p -r1.16 -r1.17
--- console-x.c 2005/12/17 19:47:02 1.16
+++ console-x.c 2006/05/06 17:55:59 1.17
@@ -41,6 +41,8 @@ Boston, MA 02111-1307, USA. */
DEFINE_CONSOLE_TYPE (x);
+int wedge_metacity; /* nonzero means update WM_HINTS always */
+
extern void x_has_keysym (KeySym, Lisp_Object, int);
static int
@@ -399,6 +401,22 @@ console_type_create_x (void)
CONSOLE_HAS_METHOD (x, perhaps_init_unseen_key_defaults);
}
+
+void
+vars_of_console_x (void)
+{
+ DEFVAR_BOOL ("wedge-metacity", &wedge_metacity /*
+When non-nil, frame geometry management is backward-compatible.
+This is known to create inflooping window jitter in metacity, et al.
+It also does not conform to Xt conventions for geometry management.
+Specifically, all frame resizes, XEmacs-initiated or not, update WM_HINTS.
+Furthermore, geometry changes occur in the widget resize method.
+
+The default is nil. This probably gives correct behavior regardless of the
+window manager used.
+This variable is deprecated and will be removed.
+*/ );
+}
void
reinit_console_type_create_x (void)
1.167 +1 -0 XEmacs/xemacs/src/emacs.c
Index: emacs.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/emacs.c,v
retrieving revision 1.166
retrieving revision 1.167
diff -u -p -r1.166 -r1.167
--- emacs.c 2006/04/25 14:02:08 1.166
+++ emacs.c 2006/05/06 17:55:59 1.167
@@ -2186,6 +2186,7 @@ main_1 (int argc, Wexttext **argv, Wextt
#ifdef HAVE_BALLOON_HELP
vars_of_balloon_x ();
#endif
+ vars_of_console_x ();
vars_of_device_x ();
#ifdef HAVE_X_DIALOGS
vars_of_dialog_x ();
1.73 +12 -0 XEmacs/xemacs/src/frame-x.c
Index: frame-x.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/frame-x.c,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -p -r1.72 -r1.73
--- frame-x.c 2005/11/26 11:46:08 1.72
+++ frame-x.c 2006/05/06 17:56:00 1.73
@@ -507,6 +507,7 @@ init_x_prop_symbols (void)
defi(Qtop, XtNy);
#undef def
+#undef defi
}
static Lisp_Object
@@ -2307,6 +2308,17 @@ static void
x_set_frame_size (struct frame *f, int cols, int rows)
{
EmacsFrameSetCharSize (FRAME_X_TEXT_WIDGET (f), cols, rows);
+
+ if (!wedge_metacity) /* cf. EmacsFrameResize */
+ {
+ /* Kick the manager so that it knows we've changed size. */
+ XtWidgetGeometry req, repl;
+ req.request_mode = 0;
+ XtQueryGeometry (FRAME_X_CONTAINER_WIDGET (f), &req, &repl);
+ EmacsManagerChangeSize (FRAME_X_CONTAINER_WIDGET (f),
+ repl.width, repl.height);
+ }
+
#if 0
/* this is not correct. x_set_frame_size() is called from
Fset_frame_size(), which may or may not have been called
1.58 +1 -0 XEmacs/xemacs/src/symsinit.h
Index: symsinit.h
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/symsinit.h,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -p -r1.57 -r1.58
--- symsinit.h 2006/04/25 14:02:09 1.57
+++ symsinit.h 2006/05/06 17:56:00 1.58
@@ -306,6 +306,7 @@ void reinit_vars_of_console (void);
void vars_of_console_stream (void);
void vars_of_console_mswindows (void);
void vars_of_console_tty (void);
+void vars_of_console_x (void);
void vars_of_data (void);
void vars_of_database (void);
void vars_of_debug (void);