After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 720357 - csd not working on Mac OS
csd not working on Mac OS
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: Quartz
unspecified
Other Mac OS
: Normal normal
: ---
Assigned To: gtk-quartz maintainers
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2013-12-12 22:01 UTC by Allison Karlitskaya (desrt)
Modified: 2014-01-06 20:27 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
screenshot (225.03 KB, image/png)
2013-12-12 22:02 UTC, Allison Karlitskaya (desrt)
  Details
GtkWindow: disable csd on Quartz for now (999 bytes, patch)
2013-12-12 22:06 UTC, Allison Karlitskaya (desrt)
none Details | Review
quartz: fix manual window move (973 bytes, patch)
2013-12-13 01:19 UTC, Allison Karlitskaya (desrt)
reviewed Details | Review
quartz: fix manual window move (2.20 KB, patch)
2014-01-06 19:15 UTC, Allison Karlitskaya (desrt)
committed Details | Review

Description Allison Karlitskaya (desrt) 2013-12-12 22:01:35 UTC
I have a machine running Mac OS 10.8.5.  I just managed to get jhbuild up and running on it.  First thing I noticed is that the newly-added client side decorations in gtk-demo are not working out.

Problems:

 - the window's initial position is underneath the menubar at the top of the screen
 - it's not possible to move the window from this position
 - resizing is also not possible
 - attempting to resize from a corner other than SE emits a warning

See the attached screenshot.
Comment 1 Allison Karlitskaya (desrt) 2013-12-12 22:02:08 UTC
Created attachment 264102 [details]
screenshot
Comment 2 Allison Karlitskaya (desrt) 2013-12-12 22:06:42 UTC
Created attachment 264103 [details] [review]
GtkWindow: disable csd on Quartz for now

Client side decorations are not working properly on quartz, so disable
them until someone who knows what they are doing can fix them.
Comment 3 Allison Karlitskaya (desrt) 2013-12-12 22:17:20 UTC
Note: the active app in the screenshot is finder, not because gtk-demo is incapable of becoming focused, but because I had clicked on the desktop just before taking the screenshot...
Comment 4 Allison Karlitskaya (desrt) 2013-12-12 23:32:57 UTC
Some notes:

I was able to get resize working again with this:

   if (decorations == 0 || GDK_WINDOW_TYPE (window) == GDK_WINDOW_TEMP ||
       impl->type_hint == GDK_WINDOW_TYPE_HINT_SPLASHSCREEN )
     {
-      new_mask = NSBorderlessWindowMask;
+      new_mask = NSBorderlessWindowMask | NSResizableWindowMask;
     }
   else
     {
       /* FIXME: Honor other GDK_DECOR_* flags. */
       new_mask = (NSTitledWindowMask | NSClosableWindowMask |
                     NSMiniaturizableWindowMask | NSResizableWindowMask);
     }

but note that this is a bit misleading because apparently NSBorderlessWindowMask is 0 (ie: it's the 'None' case of the flags.  It seems that 'TitledWindowMask' is the way to get a titlebar shown or not.


Meanwhile, not so much luck with moves.  I can see that beginManualMove() is called and sets inManualMove to YES.  After that we see two calls to sendEvent():

 - NSLeftMouseDown (1)
 - NSMouseEntered (8)

followed by nothing else.  inManualMove is never unset.

After that, no additional attempt to manually move the window is successful.
Comment 5 Allison Karlitskaya (desrt) 2013-12-13 00:26:17 UTC
More notes: when I apply the patch above I get a titlebar, but the headerbar is still there.

First issue: the header bar has a close button in it.  We should probably take that out in the case that CSD is not supported.

Secondly: if I try to drag on the headerbar that doesn't work (ie: app-initiated window movement is clearly not dependent on the decorations being there or not -- it never works).  The weird thing about this is that after I try to drag by the headerbar (and see that fail), trying to drag by the normal titlebar will reposition the window so that the mouse cursor is over the position that I tried to drag from on the headerbar.

ie: although the headerbar drag does not succeed, clicking on the OS-provided titlebar seems to 'resume' the drag I attempted to start on the headerbar.
Comment 6 Allison Karlitskaya (desrt) 2013-12-13 00:37:56 UTC
setMovableByWindowBackground on the GtkQuartzNSWindow and removing all of the sendEvent machinery makes everything work very nicely (and much more smoothly than our code ever did), but unfortunately "window background" seems to be the entire app and it's not possible to interact with anything at all anymore...
Comment 7 Allison Karlitskaya (desrt) 2013-12-13 01:19:30 UTC
Created attachment 264108 [details] [review]
quartz: fix manual window move

We need to have gdk skip standard processing of events when we are in
manual move in addition to manual resize.
Comment 8 Allison Karlitskaya (desrt) 2013-12-13 01:21:44 UTC
This seems to fix the move issue, but there are additional problems.  Resizing is extremely jerky and unreliable (which is why I thought it didn't work before) and occasionally produces a result where the display server's idea of the window size is larger than Gtk's idea (resulting in the bottom few pixels of the window not being painted).  Additionally, gtk seems to count the width of the client-side shadows when ensuring that the window cannot be dragged under the menubar resulting in the window having to stay the width of the shadow away from the menubar.
Comment 9 Matthias Clasen 2013-12-13 03:49:17 UTC
Review of attachment 264108 [details] [review]:

::: gdk/quartz/GdkQuartzNSWindow.c
@@ +365,3 @@
 -(BOOL)isInManualResize
 {
+  return inManualResize || inManualMove;

Makes the function name somewhat misleading. Maybe rename it to match ?
Comment 10 Allison Karlitskaya (desrt) 2014-01-06 19:15:40 UTC
Created attachment 265468 [details] [review]
quartz: fix manual window move

We need to have gdk skip standard processing of events when we are in
manual move in addition to manual resize.
Comment 11 Allison Karlitskaya (desrt) 2014-01-06 20:27:41 UTC
Attachment 265468 [details] pushed as 394fe4b - quartz: fix manual window move