21.4
This is a port of the patch applied to 21.5. I've included the
`wedge-metacity' variable because in 21.5 I've been seeing undesired
resizing (frames shrink at random intervals in Gnus). This allows
people unaffected by the resizing bug that wedges XEmacs when
maximized by metacity to defeat the patch and return to the old broken
behavior as a workaround.
"wedge-metacity" defaults to nil (ie, XEmacs is well-behaved with
metacity and similar window managers). At least for me the rare
undesirable resizing decreases height only a line at a time, and
doesn't affect width, so this is annoying but not really going to get
in the way of work.
Built for me with no warnings in any of the affected files on Mac OS X
10.3.9 "Panther", PPC architecture.
Index: src/ChangeLog
===================================================================
RCS file: /Users/steve/Software/Repositories/cvs.xemacs.org/XEmacs/xemacs/src/ChangeLog,v
retrieving revision 1.290.2.111
diff -u -U 0 -r1.290.2.111 ChangeLog
--- src/ChangeLog 4 Jul 2006 13:14:11 -0000 1.290.2.111
+++ src/ChangeLog 26 Jul 2006 08:22:30 -0000
@@ -0,0 +1,19 @@
+2006-07-26 Stephen J. Turnbull <stephen(a)xemacs.org>
+
+ Fix the "metacity maximization" bug.
+
+ * EmacsFrame.c (EmacsFrameResize): Don't change EmacsManager size.
+ * frame-x.c (x_set_frame_size): Handle EmacsManager sizing.
+
+ Unfortunately, the change may be implicated in new geometry
+ management problems (unrequested frame size changes). If you're
+ not using a window-manager that gets wedged by maximizing XEmacs,
+ setting `wedge-metacity' non-nil alleviates some geometry
+ management problems.
+
+ * console-x.h (wedge-metacity): New Lisp variable.
+ * console-x.c (wedge-metacity): Initialize it.
+ (vars_of_console_x): New function. Initialize wedge-metacity.
+ * symsinit.h (vars_of_console_x): Declare it.
+ * emacs.c (main_1): Call vars_of_console_x.
+
Index: src/EmacsFrame.c
===================================================================
RCS file:
/Users/steve/Software/Repositories/cvs.xemacs.org/XEmacs/xemacs/src/EmacsFrame.c,v
retrieving revision 1.17.2.4
diff -u -r1.17.2.4 EmacsFrame.c
--- src/EmacsFrame.c 31 Jan 2005 02:55:01 -0000 1.17.2.4
+++ src/EmacsFrame.c 26 Jul 2006 08:15:20 -0000
@@ -390,19 +390,33 @@
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);
-
- /* 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);
+ /* #### 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.
+ Unfortunately, in 21.5 with Xft this may be causing undesired frame
+ resizing. So 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.
+ #### 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
Index: src/console-x.c
===================================================================
RCS file:
/Users/steve/Software/Repositories/cvs.xemacs.org/XEmacs/xemacs/src/console-x.c,v
retrieving revision 1.4
diff -u -r1.4 console-x.c
--- src/console-x.c 12 Apr 2001 18:23:30 -0000 1.4
+++ src/console-x.c 26 Jul 2006 07:59:37 -0000
@@ -37,6 +37,8 @@
DEFINE_CONSOLE_TYPE (x);
+int wedge_metacity; /* nonzero means update WM_HINTS always */
+
static int
x_initially_selected_for_input (struct console *con)
{
@@ -311,6 +313,22 @@
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)
{
REINITIALIZE_CONSOLE_TYPE (x);
Index: src/console-x.h
===================================================================
RCS file:
/Users/steve/Software/Repositories/cvs.xemacs.org/XEmacs/xemacs/src/console-x.h,v
retrieving revision 1.12.2.1
diff -u -r1.12.2.1 console-x.h
--- src/console-x.h 18 Jan 2005 03:31:15 -0000 1.12.2.1
+++ src/console-x.h 26 Jul 2006 07:57:42 -0000
@@ -57,6 +57,8 @@
DECLARE_CONSOLE_TYPE (x);
+extern int wedge_metacity;
+
struct x_device
{
/* The X connection of this device. */
Index: src/emacs.c
===================================================================
RCS file: /Users/steve/Software/Repositories/cvs.xemacs.org/XEmacs/xemacs/src/emacs.c,v
retrieving revision 1.97.2.11
diff -u -r1.97.2.11 emacs.c
--- src/emacs.c 14 Feb 2005 04:15:34 -0000 1.97.2.11
+++ src/emacs.c 26 Jul 2006 08:00:51 -0000
@@ -1968,6 +1968,7 @@
#ifdef HAVE_BALLOON_HELP
vars_of_balloon_x ();
#endif
+ vars_of_console_x ();
vars_of_device_x ();
#ifdef HAVE_DIALOGS
vars_of_dialog_x ();
Index: src/frame-x.c
===================================================================
RCS file: /Users/steve/Software/Repositories/cvs.xemacs.org/XEmacs/xemacs/src/frame-x.c,v
retrieving revision 1.45.2.4
diff -u -r1.45.2.4 frame-x.c
--- src/frame-x.c 31 Jan 2005 02:55:16 -0000 1.45.2.4
+++ src/frame-x.c 26 Jul 2006 08:02:26 -0000
@@ -2360,6 +2360,17 @@
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
Index: src/symsinit.h
===================================================================
RCS file:
/Users/steve/Software/Repositories/cvs.xemacs.org/XEmacs/xemacs/src/symsinit.h,v
retrieving revision 1.35.2.2
diff -u -r1.35.2.2 symsinit.h
--- src/symsinit.h 31 Oct 2002 15:08:50 -0000 1.35.2.2
+++ src/symsinit.h 26 Jul 2006 08:03:18 -0000
@@ -259,6 +259,7 @@
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);
--
Graduate School of Systems and Information Engineering University of Tsukuba
http://turnbull.sk.tsukuba.ac.jp/ Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
Economics of Information Communication and Computation Systems
Experimental Economics, Microeconomic Theory, Game Theory