all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#14180: PATCH Better fullscreen frame support on Windows
@ 2013-04-11  4:59 Erik Charlebois
  2013-04-12  9:28 ` martin rudalics
  2013-04-13 10:09 ` Eli Zaretskii
  0 siblings, 2 replies; 12+ messages in thread
From: Erik Charlebois @ 2013-04-11  4:59 UTC (permalink / raw)
  To: 14180


[-- Attachment #1.1: Type: text/plain, Size: 1520 bytes --]

Description

This change improves the 'fullscreen' frame support on Windows. When going
to
fullscreen, the frame gets fullscreened with no window decorations (which
causes the
Windows task bar to also disappear) on the nearest monitor.

The old fullscreen functionality was actually 'maximize' behavior so I've
moved that to
'maximize'. 'fullwidth' and 'fullheight' are now ignored because they were
buggy (at least in
Windows 8, they were not being sized correctly) and are not common Windows
idioms.
While they could be supported, I'd do it as follow on work and get it
working right on
multiple monitors as well.

I've tested corner cases such as resolution changes and disconnect
monitors; in both
cases the fullscreen window stays fullscreen (and moves to a different
monitor for the
disconnect case).

I've modified the response to WM_WINDOWPOSCHANGED to do nothing when the
frame is fullscreen. Otherwise, the size gets tuned to a multiple of the
character cells and
the fullscreen isn't perfectly matching the screen. When this happens,
Windows' special
behavior to hide the taskbar doesn't kick in.

Changelog

2013-04-11  Erik Charlebois  <erikcharlebois@gmail.com>

* src/w32fns.c (monitor_from_window_fn): New Windows API import.
(w32_monitor_rect): New function to get nearest monitor rect.
* src/w32term.c (w32_fullscreen_hook): Renamed from w32fullscreen_hook
for consistency. Rewritten for improved fullscreen support.


(I signed the FSF copyright assignment papers in January so I'm ok on that
front.)

[-- Attachment #1.2: Type: text/html, Size: 2566 bytes --]

[-- Attachment #2: W32_FULLSCREEN.txt --]
[-- Type: text/plain, Size: 14729 bytes --]

# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: erikcharlebois@gmail.com-20130411042232-\
#   o9fs13w6mjs5p1ox
# target_branch: file:///C:/Users/Erik/Source/emacs/trunk/
# testament_sha1: fb9276945e45ab5295c446c677d869c181d0d03d
# timestamp: 2013-04-11 00:34:28 -0400
# base_revision_id: rgm@gnu.org-20130410012215-0alg9spmwpmibi45
# 
# Begin patch
=== modified file 'src/w32fns.c'
--- src/w32fns.c	2013-04-07 04:41:19 +0000
+++ src/w32fns.c	2013-04-11 04:22:32 +0000
@@ -157,6 +157,8 @@
 typedef HMONITOR (WINAPI * MonitorFromPoint_Proc) (IN POINT pt, IN DWORD flags);
 typedef BOOL (WINAPI * GetMonitorInfo_Proc)
   (IN HMONITOR monitor, OUT struct MONITOR_INFO* info);
+typedef HMONITOR (WINAPI * MonitorFromWindow_Proc)
+  (IN HWND hwnd, IN DWORD dwFlags);
 
 TrackMouseEvent_Proc track_mouse_event_fn = NULL;
 ImmGetCompositionString_Proc get_composition_string_fn = NULL;
@@ -165,6 +167,7 @@
 ImmSetCompositionWindow_Proc set_ime_composition_window_fn = NULL;
 MonitorFromPoint_Proc monitor_from_point_fn = NULL;
 GetMonitorInfo_Proc get_monitor_info_fn = NULL;
+MonitorFromWindow_Proc monitor_from_window_fn = NULL;
 
 #ifdef NTGUI_UNICODE
 #define unicode_append_menu AppendMenuW
@@ -336,6 +339,34 @@
   *yptr = rect.top;
 }
 
+void
+w32_monitor_rect (struct frame *f, RECT *rect)
+{
+#ifdef HAVE_WINDOW_SYSTEM
+  if (f)
+    {
+      /* If multiple monitor support is available, make the window
+         fullscreen on the appropriate screen. */
+      if (monitor_from_window_fn && get_monitor_info_fn)
+        {
+          HWND hwnd = FRAME_W32_WINDOW (f);
+          struct MONITOR_INFO mi = { sizeof(mi) };
+          HMONITOR monitor =
+            monitor_from_window_fn (hwnd, MONITOR_DEFAULT_TO_NEAREST);
+          get_monitor_info_fn (monitor, &mi);
+          *rect = mi.rcMonitor;
+        }
+      else
+        {
+          rect->left = 0;
+          rect->right = GetSystemMetrics (SM_CXSCREEN);
+          rect->top = 0;
+          rect->bottom = GetSystemMetrics (SM_CYSCREEN);
+        }
+    }
+#endif
+}
+
 \f
 
 DEFUN ("w32-define-rgb-color", Fw32_define_rgb_color,
@@ -3691,6 +3722,10 @@
       /* Don't restrict the sizing of tip frames.  */
       if (hwnd == tip_window)
 	return 0;
+
+      f = x_window_to_frame (dpyinfo, hwnd);
+      if (f && FRAME_PREV_FSMODE (f) == FULLSCREEN_BOTH)
+        return 0;
       {
 	WINDOWPLACEMENT wp;
 	LPWINDOWPOS lppos = (WINDOWPOS *) lParam;
@@ -3838,9 +3873,13 @@
 
     case WM_EMACS_SETWINDOWPOS:
       {
-	WINDOWPOS * pos = (WINDOWPOS *) wParam;
-	return SetWindowPos (hwnd, pos->hwndInsertAfter,
-			     pos->x, pos->y, pos->cx, pos->cy, pos->flags);
+        f = x_window_to_frame (dpyinfo, hwnd);
+        if (!f || FRAME_PREV_FSMODE (f) != FULLSCREEN_BOTH)
+          {
+            WINDOWPOS * pos = (WINDOWPOS *) wParam;
+            return SetWindowPos (hwnd, pos->hwndInsertAfter,
+                                 pos->x, pos->y, pos->cx, pos->cy, pos->flags);
+          }
       }
 
     case WM_EMACS_DESTROYWINDOW:
@@ -7635,6 +7674,8 @@
     GetProcAddress (user32_lib, "MonitorFromPoint");
   get_monitor_info_fn = (GetMonitorInfo_Proc)
     GetProcAddress (user32_lib, "GetMonitorInfoA");
+  monitor_from_window_fn = (MonitorFromWindow_Proc)
+    GetProcAddress (user32_lib, "MonitorFromWindow");
 
   {
     HMODULE imm32_lib = GetModuleHandle ("imm32.dll");

=== modified file 'src/w32term.c'
--- src/w32term.c	2013-04-01 07:58:04 +0000
+++ src/w32term.c	2013-04-11 04:22:32 +0000
@@ -237,7 +237,7 @@
 #endif
 static void my_set_foreground_window (HWND);
 static void my_destroy_window (struct frame *, HWND);
-static void w32fullscreen_hook (FRAME_PTR);
+static void w32_fullscreen_hook (FRAME_PTR);
 
 #ifdef GLYPH_DEBUG
 static void x_check_font (struct frame *, struct font *);
@@ -4720,7 +4720,7 @@
 		 sets the WAIT flag.  */
 	      if ((msg.msg.message == WM_WINDOWPOSCHANGED || msg.msg.wParam)
 		  && (f->want_fullscreen & FULLSCREEN_WAIT))
-		w32fullscreen_hook (f);
+		w32_fullscreen_hook (f);
 	      x_check_fullscreen (f);
 	    }
 	  check_visibility = 1;
@@ -5659,92 +5659,63 @@
 }
 
 static void
-w32fullscreen_hook (FRAME_PTR f)
+w32_fullscreen_hook (FRAME_PTR f)
 {
   if (FRAME_VISIBLE_P (f))
     {
-      int width, height, top_pos, left_pos, pixel_height, pixel_width;
-      int cur_w = FRAME_COLS (f), cur_h = FRAME_LINES (f);
-      RECT workarea_rect;
+      HWND hwnd = FRAME_W32_WINDOW(f);
+      DWORD dwStyle = GetWindowLong (hwnd, GWL_STYLE);
+      MONITORINFO mi = { sizeof(mi) };
+      int prev_fsmode = FRAME_PREV_FSMODE (f);
 
       block_input ();
-      /* Record current "normal" dimensions for restoring later.  */
-      if (!(   FRAME_PREV_FSMODE (f) == FULLSCREEN_BOTH
-	    || FRAME_PREV_FSMODE (f) == FULLSCREEN_MAXIMIZED))
-	{
-	  if (FRAME_PREV_FSMODE (f) != FULLSCREEN_HEIGHT)
-	    {
-	      FRAME_NORMAL_HEIGHT (f) = cur_h;
-	      FRAME_NORMAL_TOP (f) = f->top_pos;
-	    }
-	  if (FRAME_PREV_FSMODE (f) != FULLSCREEN_WIDTH)
-	    {
-	      FRAME_NORMAL_WIDTH (f)  = cur_w;
-	      FRAME_NORMAL_LEFT (f) = f->left_pos;
-	    }
-	}
-      eassert (FRAME_NORMAL_HEIGHT (f) > 0);
-      eassert (FRAME_NORMAL_WIDTH (f) > 0);
-      x_real_positions (f, &f->left_pos, &f->top_pos);
-      x_fullscreen_adjust (f, &width, &height, &top_pos, &left_pos);
-
-      SystemParametersInfo (SPI_GETWORKAREA, 0, &workarea_rect, 0);
-      pixel_height = workarea_rect.bottom - workarea_rect.top;
-      pixel_width  = workarea_rect.right  - workarea_rect.left;
-      /* Need to send SC_RESTORE to the window, in case we are
-	 resizing from FULLSCREEN_MAXIMIZED.  Otherwise, the mouse
-	 resize hints will not be shown by the window manager when the
-	 mouse pointer hovers over the window edges, because the WM
-	 will still think the window is maximized.  */
-      if (f->want_fullscreen != FULLSCREEN_BOTH)
-	SendMessage (FRAME_W32_WINDOW (f), WM_SYSCOMMAND, SC_RESTORE, 0);
 
       FRAME_PREV_FSMODE (f) = f->want_fullscreen;
       switch (f->want_fullscreen)
 	{
 	case FULLSCREEN_BOTH:
-	  PostMessage (FRAME_W32_WINDOW (f), WM_SYSCOMMAND, SC_MAXIMIZE, 0);
+          if (prev_fsmode == FULLSCREEN_MAXIMIZED)
+            SendMessage (hwnd, WM_SYSCOMMAND, SC_RESTORE, 0);
+
+          if (prev_fsmode != FULLSCREEN_BOTH)
+            GetWindowPlacement (hwnd, &FRAME_NORMAL_PLACEMENT (f));
+
+          RECT rect;
+          w32_monitor_rect (f, &rect);
+          SetWindowLong (hwnd, GWL_STYLE, dwStyle & ~WS_OVERLAPPEDWINDOW);
+
+          SetWindowPos (hwnd, HWND_TOP, rect.left, rect.top,
+                        rect.right - rect.left, rect.bottom - rect.top,
+                        SWP_NOOWNERZORDER | SWP_FRAMECHANGED);
 	  break;
 	case FULLSCREEN_MAXIMIZED:
-	  height =
-	    FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, pixel_height)
-	    - XINT (Ftool_bar_lines_needed (selected_frame))
-	    + (NILP (Vmenu_bar_mode) ? 1 : 0);
-	  width  =
-	    FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, pixel_width)
-	    - FRAME_SCROLL_BAR_COLS (f);
-	  left_pos = workarea_rect.left;
-	  top_pos = workarea_rect.top;
+          if (prev_fsmode == FULLSCREEN_BOTH)
+            {
+              SetWindowLong (hwnd, GWL_STYLE, dwStyle | WS_OVERLAPPEDWINDOW);
+              SetWindowPlacement (hwnd, &FRAME_NORMAL_PLACEMENT (f));
+              SetWindowPos(hwnd, NULL, 0, 0, 0, 0,
+                           SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER |
+                           SWP_NOOWNERZORDER | SWP_FRAMECHANGED);
+            }
+
+          PostMessage (FRAME_W32_WINDOW (f), WM_SYSCOMMAND, SC_MAXIMIZE, 0);
 	  break;
 	case FULLSCREEN_WIDTH:
-	  width  =
-	    FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, pixel_width)
-	    - FRAME_SCROLL_BAR_COLS (f);
-	  height = FRAME_NORMAL_HEIGHT (f);
-	  left_pos = workarea_rect.left;
-	  break;
 	case FULLSCREEN_HEIGHT:
-	  height =
-	    FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, pixel_height)
-	    - XINT (Ftool_bar_lines_needed (selected_frame))
-	    + (NILP (Vmenu_bar_mode) ? 1 : 0);
-	  width = FRAME_NORMAL_WIDTH (f);
-	  top_pos = workarea_rect.top;
-	  break;
 	case FULLSCREEN_NONE:
-	  height = FRAME_NORMAL_HEIGHT (f);
-	  width = FRAME_NORMAL_WIDTH (f);
-	  left_pos = FRAME_NORMAL_LEFT (f);
-	  top_pos = FRAME_NORMAL_TOP (f);
+          if (prev_fsmode == FULLSCREEN_BOTH)
+            {
+              SetWindowLong (hwnd, GWL_STYLE, dwStyle | WS_OVERLAPPEDWINDOW);
+              SetWindowPlacement (hwnd, &FRAME_NORMAL_PLACEMENT (f));
+              SetWindowPos(hwnd, NULL, 0, 0, 0, 0,
+                           SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER |
+                           SWP_NOOWNERZORDER | SWP_FRAMECHANGED);
+            }
+          else if (prev_fsmode == FULLSCREEN_MAXIMIZED)
+            SendMessage (hwnd, WM_SYSCOMMAND, SC_RESTORE, 0);
 	  break;
 	}
 
-      if (cur_w != width || cur_h != height)
-	{
-	  x_set_offset (f, left_pos, top_pos, 1);
-	  x_set_window_size (f, 1, width, height);
-	  do_pending_window_change (0);
-	}
       f->want_fullscreen = FULLSCREEN_NONE;
       unblock_input ();
     }
@@ -6439,7 +6410,7 @@
   terminal->mouse_position_hook = w32_mouse_position;
   terminal->frame_rehighlight_hook = w32_frame_rehighlight;
   terminal->frame_raise_lower_hook = w32_frame_raise_lower;
-  terminal->fullscreen_hook = w32fullscreen_hook;
+  terminal->fullscreen_hook = w32_fullscreen_hook;
   terminal->set_vertical_scroll_bar_hook = w32_set_vertical_scroll_bar;
   terminal->condemn_scroll_bars_hook = w32_condemn_scroll_bars;
   terminal->redeem_scroll_bar_hook = w32_redeem_scroll_bar;

=== modified file 'src/w32term.h'
--- src/w32term.h	2013-04-07 04:41:19 +0000
+++ src/w32term.h	2013-04-11 04:22:32 +0000
@@ -71,6 +71,7 @@
 };
 
 extern void w32_regenerate_palette (struct frame *f);
+extern void w32_monitor_rect (struct frame *f, RECT *rect);
 
 \f
 /* For each display (currently only one on w32), we have a structure that
@@ -362,7 +363,7 @@
   /* Frame geometry and full-screen mode before it was resized by
      specifying the 'fullscreen' frame parameter.  Used to restore the
      geometry when 'fullscreen' is reset to nil.  */
-  int normal_width, normal_height, normal_top, normal_left;
+  WINDOWPLACEMENT normal_placement;
   int prev_fsmode;
 };
 
@@ -396,11 +397,8 @@
 #define FRAME_SMALLEST_FONT_HEIGHT(F) \
      FRAME_W32_DISPLAY_INFO(F)->smallest_font_height
 
-#define FRAME_NORMAL_WIDTH(F)  ((F)->output_data.w32->normal_width)
-#define FRAME_NORMAL_HEIGHT(F) ((F)->output_data.w32->normal_height)
-#define FRAME_NORMAL_TOP(F)    ((F)->output_data.w32->normal_top)
-#define FRAME_NORMAL_LEFT(F)   ((F)->output_data.w32->normal_left)
-#define FRAME_PREV_FSMODE(F)   ((F)->output_data.w32->prev_fsmode)
+#define FRAME_NORMAL_PLACEMENT(F) ((F)->output_data.w32->normal_placement)
+#define FRAME_PREV_FSMODE(F)      ((F)->output_data.w32->prev_fsmode)
 
 \f
 /* W32-specific scroll bar stuff.  */

# Begin bundle
IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWZwBSbsABa5/gFdwBIJ59///
f+ff8L////9gC65r0Y4PvQAeh7OPeaKXurm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WuDBXcoqnqyGAwpHb+JxltBUz3M4YGQhzxN
mhDCjPE9iDVL7Rm2dYVrxZfNMaBKZBC+x6d1iWPfILKC0lpxDbs/pNIrkCdJ0N2jeKua3L4gYMJK
sohMi8UZ21RGvlyRjeBFYtaZvDuNOZkYs0xH3CLJGGAeQcRgLMbzje7h696uFV0x13nay4ErnrX5
KQejAzreY4BQNPKRqHTZhTG69U55SxlI+uHXKcohQYHYTNWpyzErE05+cUzKYzPByNuHT9Yq0q4u
nM7IAR1bPeUH01lHUhzLZjdXh3GaQcEmssCnAlFlk6J6Ejz/xDt61wsOKyhjFevuv7El6E1QYTHX
g28ZlnCtKTegfNfUIhYZyNPZF8hD/qXapPB8NxKE6EuyMa1oTTM4JgzX5NqJsYyM4MOrQPxqULk6
BwtOnCPUg1weItpdHJD627zhMqNBxFGpBR/e8zby3AHkwhz4RDo4l/4u5IpwoSE4ApN2

^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#14180: PATCH Better fullscreen frame support on Windows
  2013-04-11  4:59 bug#14180: PATCH Better fullscreen frame support on Windows Erik Charlebois
@ 2013-04-12  9:28 ` martin rudalics
  2013-04-12 19:32   ` Erik Charlebois
  2013-04-13 10:09 ` Eli Zaretskii
  1 sibling, 1 reply; 12+ messages in thread
From: martin rudalics @ 2013-04-12  9:28 UTC (permalink / raw)
  To: Erik Charlebois; +Cc: 14180

 > I've modified the response to WM_WINDOWPOSCHANGED to do nothing when the
 > frame is fullscreen. Otherwise, the size gets tuned to a multiple of the
 > character cells and
 > the fullscreen isn't perfectly matching the screen. When this happens,
 > Windows' special
 > behavior to hide the taskbar doesn't kick in.

I suppose that any remaining pixels go to the mode line which will have
a slightly shorter scrollbar if the pixel height of your monitor is not
a multiple of FRAME_LINE_HEIGHT.  Can you observe that?

martin





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#14180: PATCH Better fullscreen frame support on Windows
  2013-04-12  9:28 ` martin rudalics
@ 2013-04-12 19:32   ` Erik Charlebois
  2013-04-13  8:03     ` martin rudalics
  0 siblings, 1 reply; 12+ messages in thread
From: Erik Charlebois @ 2013-04-12 19:32 UTC (permalink / raw)
  To: martin rudalics; +Cc: 14180

[-- Attachment #1: Type: text/plain, Size: 885 bytes --]

That's correct. The modeline scrollbar is slightly clipped.

I just doubled checked toggling scrollbars, menubar and toolbar on and off
while in fullscreen and it all works as expected.

Thanks for the reminder since I usually run with all those elements off :).


On Fri, Apr 12, 2013 at 5:28 AM, martin rudalics <rudalics@gmx.at> wrote:

> > I've modified the response to WM_WINDOWPOSCHANGED to do nothing when the
> > frame is fullscreen. Otherwise, the size gets tuned to a multiple of the
> > character cells and
> > the fullscreen isn't perfectly matching the screen. When this happens,
> > Windows' special
> > behavior to hide the taskbar doesn't kick in.
>
> I suppose that any remaining pixels go to the mode line which will have
> a slightly shorter scrollbar if the pixel height of your monitor is not
> a multiple of FRAME_LINE_HEIGHT.  Can you observe that?
>
> martin
>

[-- Attachment #2: Type: text/html, Size: 1402 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#14180: PATCH Better fullscreen frame support on Windows
  2013-04-12 19:32   ` Erik Charlebois
@ 2013-04-13  8:03     ` martin rudalics
  0 siblings, 0 replies; 12+ messages in thread
From: martin rudalics @ 2013-04-13  8:03 UTC (permalink / raw)
  To: Erik Charlebois; +Cc: 14180

 > That's correct. The modeline scrollbar is slightly clipped.

It's because we currently do not distribute spare pixel lines to other
windows but simply append them at the end of the mode-line without,
however, storing the pixel height in the window.  The display engine
doesn't know anything about this and therefore cannot draw the scroll
bar long enough.  I suppose the remaining pixel lines of the screen are
cleared by Windows using FRAME_BACKGROUND_PIXEL but never checked that.
Here I changed the behavior by appending the extra pixel lines to the
windows that "most need it".

 > I just doubled checked toggling scrollbars, menubar and toolbar on and off
 > while in fullscreen and it all works as expected.
 >
 > Thanks for the reminder since I usually run with all those elements off :).

I intended to ask you that too.  At least some of these can have very
nasty delayed effects (at least with the old maximized/fullscreen mode).
In particular, independently setting margin widths and scrollbar widths
and the internal border widths of frames.

martin





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#14180: PATCH Better fullscreen frame support on Windows
  2013-04-11  4:59 bug#14180: PATCH Better fullscreen frame support on Windows Erik Charlebois
  2013-04-12  9:28 ` martin rudalics
@ 2013-04-13 10:09 ` Eli Zaretskii
  2013-04-13 11:33   ` Jan Djärv
  1 sibling, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2013-04-13 10:09 UTC (permalink / raw)
  To: Erik Charlebois; +Cc: 14180

> Date: Thu, 11 Apr 2013 00:59:54 -0400
> From: Erik Charlebois <erikcharlebois@gmail.com>
> 
> This change improves the 'fullscreen' frame support on Windows. When
> going to fullscreen, the frame gets fullscreened with no window
> decorations (which causes the Windows task bar to also disappear) on
> the nearest monitor.

Thank you for doing this.

Jan, does the fullscreen functionality on X also maximizes the frame
to one of the monitors, when several monitors are available?  I don't
want to introduce differences in behavior here.

> The old fullscreen functionality was actually 'maximize' behavior so
> I've moved that to 'maximize'.

Sorry, I don't understand.  The value of the 'fullscreen' frame
parameter can be either 'maximize' or 'fullboth' (the latter also has
a confusing alias 'fullscreen').  The current trunk code handles both,
and it does so in accordance with the documentation (the last sentence
below):

  `fullscreen'
       Specify that width, height or both shall be maximized.  The value
       `fullwidth' specifies that width shall be as wide as possible.
       The value `fullheight' specifies that height shall be as tall as
       possible.  The value `fullboth' specifies that both the width and
       the height shall be set to the size of the screen.  The value
       `maximized' specifies that the frame shall be maximized.  The
       difference between `maximized' and `fullboth' is that the former
       can still be resized by dragging window manager decorations with
       the mouse, while the latter really covers the whole screen and
       does not allow resizing by mouse dragging.

It looks like your patch swaps the meaning of 'fullboth' and
'maximize', so that Emacs on MS-Windows will behave differently from
its behavior on other platforms.  Is my understanding correct?  If so,
please don't make that swap, it is wrong.

> 'fullwidth' and 'fullheight' are now ignored because they were buggy
> (at least in Windows 8, they were not being sized correctly) and are
> not common Windows idioms.

Please don't ignore these two values.  They do work reasonably well on
XP and on Windows 7.  If they are buggy and/or don't work on Windows
8, let's fix them if we can, and leave them as they are if we can't
fix them.  Removing them is too drastic, IMO; I see no justification
for that.

> While they could be supported, I'd do it as follow on work and get
> it working right on multiple monitors as well.

Thanks, but in the meantime please don't remove the current code that
attempts to support these two values.

> I've modified the response to WM_WINDOWPOSCHANGED to do nothing when
> the frame is fullscreen. Otherwise, the size gets tuned to a
> multiple of the character cells and the fullscreen isn't perfectly
> matching the screen. When this happens, Windows' special behavior to
> hide the taskbar doesn't kick in.

During debugging the new code, I saw that w32_fullscreen_hook is
called with f->want_fullscreen set to the value FULLSCREEN_WAIT; I'm
not sure your code expects that value and/or handles it correctly.
Please double-check that.

> (I signed the FSF copyright assignment papers in January so I'm ok on that
> front.)

Unfortunately, the FSF records still don't reflect your assignment, as
of this writing.  Could you please write to the FSF clerk with whom
you were in touch, and ask him to expedite the update?  Thanks.

A few comments about your patch:

> 2013-04-11  Erik Charlebois  <erikcharlebois@gmail.com>
> 
> * src/w32fns.c (monitor_from_window_fn): New Windows API import.
> (w32_monitor_rect): New function to get nearest monitor rect.
> * src/w32term.c (w32_fullscreen_hook): Renamed from w32fullscreen_hook
> for consistency. Rewritten for improved fullscreen support.

Please leave 2 spaces after a period that ends a sentence (we use the
US conventions in ChangeLogs and in the docs.)

Also, please don't rename w32fullscreen_hook, I see no reason for
consistency in naming functions that are private to the w32 build.

> +void
> +w32_monitor_rect (struct frame *f, RECT *rect)
> +{
> +#ifdef HAVE_WINDOW_SYSTEM
> +  if (f)
> +    {
> +      /* If multiple monitor support is available, make the window
> +         fullscreen on the appropriate screen. */
                                                 ^
Two spaces here.

Also, is there really a reason for the ifdef?  I don't think this code
could possibly be called in a -nw session, could it?





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#14180: PATCH Better fullscreen frame support on Windows
  2013-04-13 10:09 ` Eli Zaretskii
@ 2013-04-13 11:33   ` Jan Djärv
  2013-04-13 11:56     ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: Jan Djärv @ 2013-04-13 11:33 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 14180

2013-04-13 12:09, Eli Zaretskii skrev:

>
> Jan, does the fullscreen functionality on X also maximizes the frame
> to one of the monitors, when several monitors are available?  I don't
> want to introduce differences in behavior here.
>

If there is a window manager running, we just tell the window manager to make 
Emacs fullscreen, so it is really up to the WM.  The window managers I worked 
with do maximize on one monitor only.

When no WM is running we maximize to the whole display, i.e. all monitors. 
But that is more or less just for debugging when you want to see Emacs <-> 
Xserver interractions without a WM getting in the way.  It is nothing a user 
ever encounters.

	Jan D.






^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#14180: PATCH Better fullscreen frame support on Windows
  2013-04-13 11:33   ` Jan Djärv
@ 2013-04-13 11:56     ` Eli Zaretskii
  2013-04-14  1:23       ` Erik Charlebois
  0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2013-04-13 11:56 UTC (permalink / raw)
  To: Jan Djärv; +Cc: 14180

> Date: Sat, 13 Apr 2013 13:33:56 +0200
> From: Jan Djärv <jan.h.d@swipnet.se>
> CC: Erik Charlebois <erikcharlebois@gmail.com>, 14180@debbugs.gnu.org
> 
> 2013-04-13 12:09, Eli Zaretskii skrev:
> 
> >
> > Jan, does the fullscreen functionality on X also maximizes the frame
> > to one of the monitors, when several monitors are available?  I don't
> > want to introduce differences in behavior here.
> >
> 
> If there is a window manager running, we just tell the window manager to make 
> Emacs fullscreen, so it is really up to the WM.  The window managers I worked 
> with do maximize on one monitor only.
> 
> When no WM is running we maximize to the whole display, i.e. all monitors. 
> But that is more or less just for debugging when you want to see Emacs <-> 
> Xserver interractions without a WM getting in the way.  It is nothing a user 
> ever encounters.

OK, thanks.  So I guess that part of Erik's patch is fine.






^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#14180: PATCH Better fullscreen frame support on Windows
  2013-04-13 11:56     ` Eli Zaretskii
@ 2013-04-14  1:23       ` Erik Charlebois
  2013-04-14  6:41         ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: Erik Charlebois @ 2013-04-14  1:23 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 14180


[-- Attachment #1.1: Type: text/plain, Size: 1938 bytes --]

I've rewritten the patch to preserve the maximized, fullwidth and
fullheight functionality and fix them
on Windows 8; came out cleaner in the end too.

The FULLSCREEN_WAIT flag now gets cleared prior to using want_fullscreen
(was a bug in the
existing implementation too I believe).

I've contacted the FSF clerk. Hopefully that can get cleared up soon.

2013-04-11  Erik Charlebois  <erikcharlebois@gmail.com>

* src/w32fns.c (w32_fullscreen_rect): New function to compute the
window rectangle for the given fullscreen mode.
(w32_wnd_proc): When in a fullscreen mode, WM_WINDOWPOSCHANGING
no longer tunes the window size.  This keeps the window's edges
flush with the screen and allows the taskbar to hide itself in
fullboth.
* src/w32term.c (w32fullscreen_hook): fullboth now shows without
window decorations and uses the entire screen.


On Sat, Apr 13, 2013 at 7:56 AM, Eli Zaretskii <eliz@gnu.org> wrote:

> > Date: Sat, 13 Apr 2013 13:33:56 +0200
> > From: Jan Djärv <jan.h.d@swipnet.se>
> > CC: Erik Charlebois <erikcharlebois@gmail.com>, 14180@debbugs.gnu.org
> >
> > 2013-04-13 12:09, Eli Zaretskii skrev:
> >
> > >
> > > Jan, does the fullscreen functionality on X also maximizes the frame
> > > to one of the monitors, when several monitors are available?  I don't
> > > want to introduce differences in behavior here.
> > >
> >
> > If there is a window manager running, we just tell the window manager to
> make
> > Emacs fullscreen, so it is really up to the WM.  The window managers I
> worked
> > with do maximize on one monitor only.
> >
> > When no WM is running we maximize to the whole display, i.e. all
> monitors.
> > But that is more or less just for debugging when you want to see Emacs
> <->
> > Xserver interractions without a WM getting in the way.  It is nothing a
> user
> > ever encounters.
>
> OK, thanks.  So I guess that part of Erik's patch is fine.
>

[-- Attachment #1.2: Type: text/html, Size: 4026 bytes --]

[-- Attachment #2: W32_FULLSCREEN_2.txt --]
[-- Type: text/plain, Size: 13471 bytes --]

# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: erikcharlebois@gmail.com-20130414005845-\
#   watpsk8w1701j22x
# target_branch: file:///C:/Users/Erik/Source/emacs/trunk/
# testament_sha1: 9d1bc31821b315ab0286031e20ed7c9d457a6e98
# timestamp: 2013-04-13 20:59:05 -0400
# base_revision_id: rgm@gnu.org-20130410012215-0alg9spmwpmibi45
# 
# Begin patch
=== modified file 'src/w32fns.c'
--- src/w32fns.c	2013-04-07 04:41:19 +0000
+++ src/w32fns.c	2013-04-14 00:58:45 +0000
@@ -157,6 +157,8 @@
 typedef HMONITOR (WINAPI * MonitorFromPoint_Proc) (IN POINT pt, IN DWORD flags);
 typedef BOOL (WINAPI * GetMonitorInfo_Proc)
   (IN HMONITOR monitor, OUT struct MONITOR_INFO* info);
+typedef HMONITOR (WINAPI * MonitorFromWindow_Proc)
+  (IN HWND hwnd, IN DWORD dwFlags);
 
 TrackMouseEvent_Proc track_mouse_event_fn = NULL;
 ImmGetCompositionString_Proc get_composition_string_fn = NULL;
@@ -165,6 +167,7 @@
 ImmSetCompositionWindow_Proc set_ime_composition_window_fn = NULL;
 MonitorFromPoint_Proc monitor_from_point_fn = NULL;
 GetMonitorInfo_Proc get_monitor_info_fn = NULL;
+MonitorFromWindow_Proc monitor_from_window_fn = NULL;
 
 #ifdef NTGUI_UNICODE
 #define unicode_append_menu AppendMenuW
@@ -336,6 +339,66 @@
   *yptr = rect.top;
 }
 
+/* Returns the window rectangle appropriate for the given fullscreen mode.
+   The normal rect parameter was the window's rectangle prior to entering
+   fullscreen mode.  If multiple monitor support is available, the nearest
+   monitor to the window is chosen.  */
+
+void
+w32_fullscreen_rect (HWND hwnd, int fsmode, RECT normal, RECT *rect)
+{
+  struct MONITOR_INFO mi = { sizeof(mi) };
+  if (monitor_from_window_fn && get_monitor_info_fn)
+    {
+      HMONITOR monitor =
+        monitor_from_window_fn (hwnd, MONITOR_DEFAULT_TO_NEAREST);
+      get_monitor_info_fn (monitor, &mi);
+    }
+  else
+    {
+      mi.rcMonitor.left = 0;
+      mi.rcMonitor.top = 0;
+      mi.rcMonitor.right = GetSystemMetrics (SM_CXSCREEN);
+      mi.rcMonitor.bottom = GetSystemMetrics (SM_CYSCREEN);
+      mi.rcWork.left = 0;
+      mi.rcWork.top = 0;
+      mi.rcWork.right = GetSystemMetrics (SM_CXMAXIMIZED);
+      mi.rcWork.bottom = GetSystemMetrics (SM_CYMAXIMIZED);
+    }
+
+  switch (fsmode)
+    {
+    case FULLSCREEN_BOTH:
+      rect->left = mi.rcMonitor.left;
+      rect->top = mi.rcMonitor.top;
+      rect->right = mi.rcMonitor.right;
+      rect->bottom = mi.rcMonitor.bottom;
+      break;
+    case FULLSCREEN_MAXIMIZED:
+      rect->left = mi.rcWork.left;
+      rect->top = mi.rcWork.top;
+      rect->right = mi.rcWork.right;
+      rect->bottom = mi.rcWork.bottom;
+      break;
+    case FULLSCREEN_WIDTH:
+      rect->left = mi.rcWork.left;
+      rect->top = normal.top;
+      rect->right = mi.rcWork.right;
+      rect->bottom = normal.bottom;
+      break;
+    case FULLSCREEN_HEIGHT:
+      rect->left = normal.left;
+      rect->top = mi.rcWork.top;
+      rect->right = normal.right;
+      rect->bottom = mi.rcWork.bottom;
+      break;
+    case FULLSCREEN_NONE:
+    default:
+      *rect = normal;
+      break;
+    }
+}
+
 \f
 
 DEFUN ("w32-define-rgb-color", Fw32_define_rgb_color,
@@ -3691,6 +3754,13 @@
       /* Don't restrict the sizing of tip frames.  */
       if (hwnd == tip_window)
 	return 0;
+
+      /* Don't restrict the sizing of fullscreened frames, allowing them to be
+         flush with the sides of the screen.  */
+      f = x_window_to_frame (dpyinfo, hwnd);
+      if (f && FRAME_PREV_FSMODE (f) != FULLSCREEN_NONE)
+        return 0;
+
       {
 	WINDOWPLACEMENT wp;
 	LPWINDOWPOS lppos = (WINDOWPOS *) lParam;
@@ -7635,6 +7705,8 @@
     GetProcAddress (user32_lib, "MonitorFromPoint");
   get_monitor_info_fn = (GetMonitorInfo_Proc)
     GetProcAddress (user32_lib, "GetMonitorInfoA");
+  monitor_from_window_fn = (MonitorFromWindow_Proc)
+    GetProcAddress (user32_lib, "MonitorFromWindow");
 
   {
     HMODULE imm32_lib = GetModuleHandle ("imm32.dll");

=== modified file 'src/w32term.c'
--- src/w32term.c	2013-04-01 07:58:04 +0000
+++ src/w32term.c	2013-04-14 00:58:45 +0000
@@ -5663,88 +5663,40 @@
 {
   if (FRAME_VISIBLE_P (f))
     {
-      int width, height, top_pos, left_pos, pixel_height, pixel_width;
-      int cur_w = FRAME_COLS (f), cur_h = FRAME_LINES (f);
-      RECT workarea_rect;
-
-      block_input ();
-      /* Record current "normal" dimensions for restoring later.  */
-      if (!(   FRAME_PREV_FSMODE (f) == FULLSCREEN_BOTH
-	    || FRAME_PREV_FSMODE (f) == FULLSCREEN_MAXIMIZED))
-	{
-	  if (FRAME_PREV_FSMODE (f) != FULLSCREEN_HEIGHT)
-	    {
-	      FRAME_NORMAL_HEIGHT (f) = cur_h;
-	      FRAME_NORMAL_TOP (f) = f->top_pos;
-	    }
-	  if (FRAME_PREV_FSMODE (f) != FULLSCREEN_WIDTH)
-	    {
-	      FRAME_NORMAL_WIDTH (f)  = cur_w;
-	      FRAME_NORMAL_LEFT (f) = f->left_pos;
-	    }
-	}
-      eassert (FRAME_NORMAL_HEIGHT (f) > 0);
-      eassert (FRAME_NORMAL_WIDTH (f) > 0);
-      x_real_positions (f, &f->left_pos, &f->top_pos);
-      x_fullscreen_adjust (f, &width, &height, &top_pos, &left_pos);
-
-      SystemParametersInfo (SPI_GETWORKAREA, 0, &workarea_rect, 0);
-      pixel_height = workarea_rect.bottom - workarea_rect.top;
-      pixel_width  = workarea_rect.right  - workarea_rect.left;
-      /* Need to send SC_RESTORE to the window, in case we are
-	 resizing from FULLSCREEN_MAXIMIZED.  Otherwise, the mouse
-	 resize hints will not be shown by the window manager when the
-	 mouse pointer hovers over the window edges, because the WM
-	 will still think the window is maximized.  */
-      if (f->want_fullscreen != FULLSCREEN_BOTH)
-	SendMessage (FRAME_W32_WINDOW (f), WM_SYSCOMMAND, SC_RESTORE, 0);
-
+      HWND hwnd = FRAME_W32_WINDOW(f);
+      DWORD dwStyle = GetWindowLong (hwnd, GWL_STYLE);
+      RECT rect;
+
+      block_input();
+      f->want_fullscreen &= ~FULLSCREEN_WAIT;
+
+      if (FRAME_PREV_FSMODE (f) == FULLSCREEN_NONE)
+        GetWindowPlacement (hwnd, &FRAME_NORMAL_PLACEMENT (f));
+
+      if (FRAME_PREV_FSMODE (f) == FULLSCREEN_BOTH)
+        {
+          SetWindowLong (hwnd, GWL_STYLE, dwStyle | WS_OVERLAPPEDWINDOW);
+          SetWindowPos (hwnd, NULL, 0, 0, 0, 0,
+                        SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER |
+                        SWP_NOOWNERZORDER | SWP_FRAMECHANGED);
+        }
+
+      w32_fullscreen_rect (hwnd, f->want_fullscreen,
+                           FRAME_NORMAL_PLACEMENT (f).rcNormalPosition, &rect);
       FRAME_PREV_FSMODE (f) = f->want_fullscreen;
-      switch (f->want_fullscreen)
-	{
-	case FULLSCREEN_BOTH:
-	  PostMessage (FRAME_W32_WINDOW (f), WM_SYSCOMMAND, SC_MAXIMIZE, 0);
-	  break;
-	case FULLSCREEN_MAXIMIZED:
-	  height =
-	    FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, pixel_height)
-	    - XINT (Ftool_bar_lines_needed (selected_frame))
-	    + (NILP (Vmenu_bar_mode) ? 1 : 0);
-	  width  =
-	    FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, pixel_width)
-	    - FRAME_SCROLL_BAR_COLS (f);
-	  left_pos = workarea_rect.left;
-	  top_pos = workarea_rect.top;
-	  break;
-	case FULLSCREEN_WIDTH:
-	  width  =
-	    FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, pixel_width)
-	    - FRAME_SCROLL_BAR_COLS (f);
-	  height = FRAME_NORMAL_HEIGHT (f);
-	  left_pos = workarea_rect.left;
-	  break;
-	case FULLSCREEN_HEIGHT:
-	  height =
-	    FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, pixel_height)
-	    - XINT (Ftool_bar_lines_needed (selected_frame))
-	    + (NILP (Vmenu_bar_mode) ? 1 : 0);
-	  width = FRAME_NORMAL_WIDTH (f);
-	  top_pos = workarea_rect.top;
-	  break;
-	case FULLSCREEN_NONE:
-	  height = FRAME_NORMAL_HEIGHT (f);
-	  width = FRAME_NORMAL_WIDTH (f);
-	  left_pos = FRAME_NORMAL_LEFT (f);
-	  top_pos = FRAME_NORMAL_TOP (f);
-	  break;
-	}
+      if (f->want_fullscreen == FULLSCREEN_BOTH)
+        {
+          SetWindowLong (hwnd, GWL_STYLE, dwStyle & ~WS_OVERLAPPEDWINDOW);
+          SetWindowPos (hwnd, HWND_TOP, rect.left, rect.top,
+                        rect.right - rect.left, rect.bottom - rect.top,
+                        SWP_NOOWNERZORDER | SWP_FRAMECHANGED);
+        }
+      else
+        {
+          SetWindowPos (hwnd, HWND_TOP, rect.left, rect.top,
+                        rect.right - rect.left, rect.bottom - rect.top, 0);
+        }
 
-      if (cur_w != width || cur_h != height)
-	{
-	  x_set_offset (f, left_pos, top_pos, 1);
-	  x_set_window_size (f, 1, width, height);
-	  do_pending_window_change (0);
-	}
       f->want_fullscreen = FULLSCREEN_NONE;
       unblock_input ();
     }

=== modified file 'src/w32term.h'
--- src/w32term.h	2013-04-07 04:41:19 +0000
+++ src/w32term.h	2013-04-14 00:58:45 +0000
@@ -71,6 +71,8 @@
 };
 
 extern void w32_regenerate_palette (struct frame *f);
+extern void w32_fullscreen_rect (HWND hwnd, int fsmode, RECT normal,
+                                 RECT *rect);
 
 \f
 /* For each display (currently only one on w32), we have a structure that
@@ -362,7 +364,7 @@
   /* Frame geometry and full-screen mode before it was resized by
      specifying the 'fullscreen' frame parameter.  Used to restore the
      geometry when 'fullscreen' is reset to nil.  */
-  int normal_width, normal_height, normal_top, normal_left;
+  WINDOWPLACEMENT normal_placement;
   int prev_fsmode;
 };
 
@@ -396,11 +398,8 @@
 #define FRAME_SMALLEST_FONT_HEIGHT(F) \
      FRAME_W32_DISPLAY_INFO(F)->smallest_font_height
 
-#define FRAME_NORMAL_WIDTH(F)  ((F)->output_data.w32->normal_width)
-#define FRAME_NORMAL_HEIGHT(F) ((F)->output_data.w32->normal_height)
-#define FRAME_NORMAL_TOP(F)    ((F)->output_data.w32->normal_top)
-#define FRAME_NORMAL_LEFT(F)   ((F)->output_data.w32->normal_left)
-#define FRAME_PREV_FSMODE(F)   ((F)->output_data.w32->prev_fsmode)
+#define FRAME_NORMAL_PLACEMENT(F) ((F)->output_data.w32->normal_placement)
+#define FRAME_PREV_FSMODE(F)      ((F)->output_data.w32->prev_fsmode)
 
 \f
 /* W32-specific scroll bar stuff.  */

# Begin bundle
IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWU1GFCQABXX/gFcQBIJ59///
f+ff8L////9gCy7r6Pd3j2AB5THd6AKoPXes0F1nIa6GoSSRiqfinpQ9pNT9JPaCam09UbSbKaMg
xBoBoBpoPUCUIo9GmJiUQAAGgaAGQAAAADQEpJMwUxNT0jQNNA00aaAABoDIMgNGgAkSJoFR+qae
nqJ+lGNAg0bKA0BGEGmAACYOMmCaGQyMjJoaANBkYQDQaNMhiGgAkkCaAmENBDTRHpTNTFPNKbQb
UMo8o0PU9JoPUeUmEINe3jZOMUhuSlDhztl0GPn+izLPlyZJ/7OGeQ9silhFV8SaMLIJD4XRiKwY
E7eJq6adCG+D8tFjwwtmpNlfJAtxM2GpBPatNqRPERSgHuYxWHAyJi6DXo3Kb0xX3a7ZevHLW2NA
hJKiFJpIDMpOCG2pZU9mQ9QeUlG/UH50y+1e0d8KehTLWfqfKHwPxuKiZ+x51JbqbYDabNdF5mD3
hu7l1mtoptxMb4nMVcqTdIKOp7xouiRW7GrRk3KdmP1w+mDe8zE2qokVQQEEQQ8+FW4fPz+K7wPJ
NMZnUIupJbb5VkU44UuMKKTPm6zaSXq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dwJ0RG1DnRSKtIog9IZd50hIVbggE5ezke+g3l
8k0Wf1QFoBcj1AwFtqvbd4RwySpyuAKCDm6TUBBhHKSaOYpBAEJEkjgGrgqT3NaHfu/Doybbbaiq
KoqmynEnwgeiQPmxsmUgg/FJWoo2bDnKBSbnKBptpthRWZtEDQrBOCECnVSk0QmGiuxwkZ0AbWJU
oPwJWWBZIZVpgYYHMjNOUPAHUzrkDDpo3ZgOuKus5gV0wOIhgagBinnZLd9appDxgmE+2acSYY7B
K4QqMy7wK8BxsRVhFWqhqipgUmEgZwmZILo+IjssFZ0smQ8OyHiOs1cVyVw88B1YU202z6dQjJi/
J6R6O4kbLLmBmeMgYGAHj834o3oRlBF6/5izu13aAQF/UYDpQFiDFn9uvPtgGCeso3bEYhtBg98g
UpgrAT0nCW9zcVFqfKG0LIk5jVlDk/MELPn2mfp0h6JxdrT0zqC6xIvu4TZaGNKtlyI25a2THkYx
VJWKTnpi8RTSbmWkPcvYqDQHILRGcMtq3NF55SQwqqKKrh50W4CwewawUAZgWtnUBAJzsBTJCce0
USulWa4TlIKMafuSjSK7OsZ4A6t9uBdGNFSmjOwFvOAMBMSLxUKkRgYBCDXSehtAKyRv/Ncehc1Q
4VSfdDt4bUBh2u04jHpwzMuIMGmrvQT1mKiLTVN7Ae8RkQj4sD++FuIhsb51qTTA3ttW84RdA2tx
FNmS3xKfkQblIrQVixGU2cBzLvN2wOAXm/clP3L61ptScSYyS/Yu5IpwoSCajChI

^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#14180: PATCH Better fullscreen frame support on Windows
  2013-04-14  1:23       ` Erik Charlebois
@ 2013-04-14  6:41         ` Eli Zaretskii
  2013-04-20  0:42           ` Erik Charlebois
  0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2013-04-14  6:41 UTC (permalink / raw)
  To: Erik Charlebois; +Cc: 14180

> Date: Sat, 13 Apr 2013 21:23:16 -0400
> From: Erik Charlebois <erikcharlebois@gmail.com>
> Cc: 14180@debbugs.gnu.org
> 
> I've rewritten the patch to preserve the maximized, fullwidth and
> fullheight functionality and fix them
> on Windows 8; came out cleaner in the end too.

Thank you!

> I've contacted the FSF clerk. Hopefully that can get cleared up soon.

Thanks.  The moment your assignment is on file, these changes can go
in.

Thanks again for working on this.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#14180: PATCH Better fullscreen frame support on Windows
  2013-04-14  6:41         ` Eli Zaretskii
@ 2013-04-20  0:42           ` Erik Charlebois
  2013-04-20  7:36             ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: Erik Charlebois @ 2013-04-20  0:42 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 14180

[-- Attachment #1: Type: text/plain, Size: 621 bytes --]

Hi Eli,

The assignment should be on file now.


On Sun, Apr 14, 2013 at 2:41 AM, Eli Zaretskii <eliz@gnu.org> wrote:

> > Date: Sat, 13 Apr 2013 21:23:16 -0400
> > From: Erik Charlebois <erikcharlebois@gmail.com>
> > Cc: 14180@debbugs.gnu.org
> >
> > I've rewritten the patch to preserve the maximized, fullwidth and
> > fullheight functionality and fix them
> > on Windows 8; came out cleaner in the end too.
>
> Thank you!
>
> > I've contacted the FSF clerk. Hopefully that can get cleared up soon.
>
> Thanks.  The moment your assignment is on file, these changes can go
> in.
>
> Thanks again for working on this.
>

[-- Attachment #2: Type: text/html, Size: 1159 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#14180: PATCH Better fullscreen frame support on Windows
  2013-04-20  0:42           ` Erik Charlebois
@ 2013-04-20  7:36             ` Eli Zaretskii
  2013-04-20 14:34               ` Stefan Monnier
  0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2013-04-20  7:36 UTC (permalink / raw)
  To: Erik Charlebois; +Cc: 14180-done

> Date: Fri, 19 Apr 2013 20:42:43 -0400
> From: Erik Charlebois <erikcharlebois@gmail.com>
> Cc: 14180@debbugs.gnu.org
> 
> The assignment should be on file now.

Indeed, it is.  Therefore, I committed your changes as trunk revision
112337.

A few comments on your ChangeLog entries (for the future; I fixed all
of the issues mentioned below):

  . We have a separate ChangeLog in src, so the file names should not
    include "src/".

  . The entries for different files should be separated by an empty
    line.

  . Each non-empty line should begin with a TAB.

  . You forgot to describe the changes in w32term.h.

FYI, here are the log entries I committed in your name:

  2013-04-20  Erik Charlebois  <erikcharlebois@gmail.com>

	  * w32fns.c (w32_fullscreen_rect): New function to compute the
	  window rectangle for the given fullscreen mode.
	  (w32_wnd_proc): When in a fullscreen mode, WM_WINDOWPOSCHANGING no
	  longer tunes the window size.  This keeps the window's edges flush
	  with the screen and allows the taskbar to hide itself in fullboth.

	  * w32term.c (w32fullscreen_hook): 'fullboth' now shows without
	  window decorations and uses the entire screen.

	  * w32term.h  (w32_fullscreen_rect) Add prototype.
	  (struct w32_output): Replace normal_width, normal_height,
	  normal_top, and normal_left members with a single normal_placement
	  struct.
	  (FRAME_NORMAL_WIDTH, FRAME_NORMAL_HEIGHT, FRAME_NORMAL_TOP):
	  Remove macros.
	  (FRAME_NORMAL_PLACEMENT): New macro.


Thanks again for working on this.

I'm marking this bug as done.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#14180: PATCH Better fullscreen frame support on Windows
  2013-04-20  7:36             ` Eli Zaretskii
@ 2013-04-20 14:34               ` Stefan Monnier
  0 siblings, 0 replies; 12+ messages in thread
From: Stefan Monnier @ 2013-04-20 14:34 UTC (permalink / raw)
  To: 14180

>   . The entries for different files should be separated by an empty
>     line.

BTW, while that's what we usually do, it's sometimes useful to eliminate
the line as an indication that the changes are inter-dependent.


        Stefan





^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2013-04-20 14:34 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-11  4:59 bug#14180: PATCH Better fullscreen frame support on Windows Erik Charlebois
2013-04-12  9:28 ` martin rudalics
2013-04-12 19:32   ` Erik Charlebois
2013-04-13  8:03     ` martin rudalics
2013-04-13 10:09 ` Eli Zaretskii
2013-04-13 11:33   ` Jan Djärv
2013-04-13 11:56     ` Eli Zaretskii
2013-04-14  1:23       ` Erik Charlebois
2013-04-14  6:41         ` Eli Zaretskii
2013-04-20  0:42           ` Erik Charlebois
2013-04-20  7:36             ` Eli Zaretskii
2013-04-20 14:34               ` Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.