emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 1f45d27388: Make sure `update_wm_hints' finds the WMShell


From: Po Lu
Subject: master 1f45d27388: Make sure `update_wm_hints' finds the WMShell
Date: Mon, 7 Feb 2022 19:49:09 -0500 (EST)

branch: master
commit 1f45d273884a648f47abea919a5246452f542aa9
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Make sure `update_wm_hints' finds the WMShell
    
    * src/widget.c (update_wm_hints): Accept frame separately from
    the shell widget.
    (widget_update_wm_size_hints): Require WM shell to be explictly
    specified.
    (EmacsFrameRealize):
    (EmacsFrameResize): Update callers to `update_wm_hints'.
    * src/widget.h: Update prototypes.
    * src/xterm.c (x_wm_set_size_hint): Pass frame widget
    (ApplicationShell) and the edit widget (EmacsFrame) to
    `widget_update_wm_size_hints'.  (bug#53839)
---
 src/widget.c | 17 +++++++----------
 src/widget.h |  2 +-
 src/xterm.c  |  3 ++-
 3 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/src/widget.c b/src/widget.c
index c13ec50498..4231aa71b5 100644
--- a/src/widget.c
+++ b/src/widget.c
@@ -260,9 +260,8 @@ set_frame_size (EmacsFrame ew)
 }
 
 static void
-update_wm_hints (EmacsFrame ew)
+update_wm_hints (Widget wmshell, EmacsFrame ew)
 {
-  Widget wmshell = get_wm_shell ((Widget) ew);
   int cw;
   int ch;
   Dimension rounded_width;
@@ -272,9 +271,6 @@ update_wm_hints (EmacsFrame ew)
   int base_width;
   int base_height;
 
-  /* This happens when the frame is just created.  */
-  if (! wmshell) return;
-
   pixel_to_char_size (ew, ew->core.width, ew->core.height,
                      &char_width, &char_height);
   char_to_pixel_size (ew, char_width, char_height,
@@ -302,10 +298,9 @@ update_wm_hints (EmacsFrame ew)
 }
 
 void
-widget_update_wm_size_hints (Widget widget)
+widget_update_wm_size_hints (Widget widget, Widget frame)
 {
-  EmacsFrame ew = (EmacsFrame) widget;
-  update_wm_hints (ew);
+  update_wm_hints (widget, (EmacsFrame) frame);
 }
 
 static void
@@ -386,7 +381,8 @@ EmacsFrameRealize (Widget widget, XtValueMask *mask, 
XSetWindowAttributes *attrs
     frame_size_history_plain
       (f, build_string ("EmacsFrameRealize"));
 
-  update_wm_hints (ew);
+  if (get_wm_shell (widget))
+    update_wm_hints (get_wm_shell (widget), ew);
 }
 
 static void
@@ -410,7 +406,8 @@ EmacsFrameResize (Widget widget)
 
   change_frame_size (f, ew->core.width, ew->core.height, false, true, false);
 
-  update_wm_hints (ew);
+  if (get_wm_shell (widget))
+    update_wm_hints (get_wm_shell (widget), ew);
   update_various_frame_slots (ew);
 
   cancel_mouse_face (f);
diff --git a/src/widget.h b/src/widget.h
index dbf21a64cb..2906d5ff9e 100644
--- a/src/widget.h
+++ b/src/widget.h
@@ -97,6 +97,6 @@ extern struct _DisplayContext *display_context;
 /* Special entry points */
 void EmacsFrameSetCharSize (Widget, int, int);
 void widget_store_internal_border (Widget widget);
-void widget_update_wm_size_hints (Widget widget);
+void widget_update_wm_size_hints (Widget widget, Widget frame);
 
 #endif /* _EmacsFrame_h */
diff --git a/src/xterm.c b/src/xterm.c
index 940ee347d5..38f181e5df 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -14959,7 +14959,8 @@ x_wm_set_size_hint (struct frame *f, long flags, bool 
user_position)
 #ifdef USE_X_TOOLKIT
   if (f->output_data.x->widget)
     {
-      widget_update_wm_size_hints (f->output_data.x->widget);
+      widget_update_wm_size_hints (f->output_data.x->widget,
+                                  f->output_data.x->edit_widget);
       return;
     }
 #endif



reply via email to

[Prev in Thread] Current Thread [Next in Thread]