emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs-24 r117524: Fix creation of frames on MS-Windows: do


From: Eli Zaretskii
Subject: [Emacs-diffs] emacs-24 r117524: Fix creation of frames on MS-Windows: don't cons Lisp objects in input thread.
Date: Tue, 30 Sep 2014 13:54:23 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117524
revision-id: address@hidden
parent: address@hidden
committer: Eli Zaretskii <address@hidden>
branch nick: emacs-24
timestamp: Tue 2014-09-30 16:53:24 +0300
message:
  Fix creation of frames on MS-Windows: don't cons Lisp objects in input thread.
  
   src/w32fns.c (w32_createwindow): Accept an additional argument, an
   array of 2 values specifying the coordinates of the frame's
   top-left corner.  Use these values instead of calling x_get_arg,
   which can cons Lisp objects, and therefore cannot be called except
   from the main thread.  Remove redundant tests for the default
   values.
   (my_create_window): Move the calculation of the coordinates of the
   frame's top-left edge here.  Pass them to the input thread via the
   second parameter of the WM_EMACS_CREATEWINDOW message.  See
   http://lists.gnu.org/archive/html/emacs-devel/2014-09/msg00892.html
   for the details.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/w32fns.c                   w32fns.c-20091113204419-o5vbwnq5f7feedwu-945
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-09-29 19:10:28 +0000
+++ b/src/ChangeLog     2014-09-30 13:53:24 +0000
@@ -1,3 +1,17 @@
+2014-09-30  Eli Zaretskii  <address@hidden>
+
+       * w32fns.c (w32_createwindow): Accept an additional argument, an
+       array of 2 values specifying the coordinates of the frame's
+       top-left corner.  Use these values instead of calling x_get_arg,
+       which can cons Lisp objects, and therefore cannot be called except
+       from the main thread.  Remove redundant tests for the default
+       values.
+       (my_create_window): Move the calculation of the coordinates of the
+       frame's top-left edge here.  Pass them to the input thread via the
+       second parameter of the WM_EMACS_CREATEWINDOW message.  See
+       http://lists.gnu.org/archive/html/emacs-devel/2014-09/msg00892.html
+       for the details.
+
 2014-09-29  Eli Zaretskii  <address@hidden>
 
        * xdisp.c (cursor_row_fully_visible_p): Update commentary.

=== modified file 'src/w32fns.c'
--- a/src/w32fns.c      2014-07-12 09:25:29 +0000
+++ b/src/w32fns.c      2014-09-30 13:53:24 +0000
@@ -1911,13 +1911,12 @@
 }
 
 static void
-w32_createwindow (struct frame *f)
+w32_createwindow (struct frame *f, int *coords)
 {
   HWND hwnd;
   RECT rect;
-  Lisp_Object top = Qunbound;
-  Lisp_Object left = Qunbound;
-  struct w32_display_info *dpyinfo = &one_w32_display_info;
+  int top;
+  int left;
 
   rect.left = rect.top = 0;
   rect.right = FRAME_PIXEL_WIDTH (f);
@@ -1932,25 +1931,21 @@
 
   if (f->size_hint_flags & USPosition || f->size_hint_flags & PPosition)
     {
-      XSETINT (left, f->left_pos);
-      XSETINT (top, f->top_pos);
+      left = f->left_pos;
+      top = f->top_pos;
     }
-  else if (EQ (left, Qunbound) && EQ (top, Qunbound))
+  else
     {
-      /* When called with RES_TYPE_NUMBER, w32_get_arg will return zero
-        for anything that is not a number and is not Qunbound.  */
-      left = x_get_arg (dpyinfo, Qnil, Qleft, "left", "Left", RES_TYPE_NUMBER);
-      top = x_get_arg (dpyinfo, Qnil, Qtop, "top", "Top", RES_TYPE_NUMBER);
+      left = coords[0];
+      top = coords[1];
     }
 
   FRAME_W32_WINDOW (f) = hwnd
     = CreateWindow (EMACS_CLASS,
                    f->namebuf,
                    f->output_data.w32->dwStyle | WS_CLIPCHILDREN,
-                   EQ (left, Qunbound) ? CW_USEDEFAULT : XINT (left),
-                   EQ (top, Qunbound) ? CW_USEDEFAULT : XINT (top),
-                   rect.right - rect.left,
-                   rect.bottom - rect.top,
+                   left, top,
+                   rect.right - rect.left, rect.bottom - rect.top,
                    NULL,
                    NULL,
                    hinst,
@@ -2468,7 +2463,8 @@
                  the patch for XP is not publicly available until XP SP3,
                  and older versions will never be patched.  */
               CoInitialize (NULL);
-             w32_createwindow ((struct frame *) msg.wParam);
+             w32_createwindow ((struct frame *) msg.wParam,
+                               (int *) msg.lParam);
              if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, 0, 0))
                emacs_abort ();
              break;
@@ -4069,8 +4065,25 @@
 my_create_window (struct frame * f)
 {
   MSG msg;
-
-  if (!PostThreadMessage (dwWindowsThreadId, WM_EMACS_CREATEWINDOW, (WPARAM)f, 
0))
+  static int coords[2];
+  Lisp_Object left, top;
+  struct w32_display_info *dpyinfo = &one_w32_display_info;
+
+  /* When called with RES_TYPE_NUMBER, x_get_arg will return zero for
+     anything that is not a number and is not Qunbound.  */
+  left = x_get_arg (dpyinfo, Qnil, Qleft, "left", "Left", RES_TYPE_NUMBER);
+  top = x_get_arg (dpyinfo, Qnil, Qtop, "top", "Top", RES_TYPE_NUMBER);
+  if (EQ (left, Qunbound))
+    coords[0] = CW_USEDEFAULT;
+  else
+    coords[0] = XINT (left);
+  if (EQ (top, Qunbound))
+    coords[1] = CW_USEDEFAULT;
+  else
+    coords[1] = XINT (top);
+
+  if (!PostThreadMessage (dwWindowsThreadId, WM_EMACS_CREATEWINDOW,
+                         (WPARAM)f, (LPARAM)coords))
     emacs_abort ();
   GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE);
 }


reply via email to

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