]> source.dussan.org Git - tigervnc.git/commitdiff
Do maximize more properly on macOS
authorPierre Ossman <ossman@cendio.se>
Thu, 26 Mar 2020 08:39:36 +0000 (09:39 +0100)
committerPierre Ossman <ossman@cendio.se>
Thu, 26 Mar 2020 08:39:56 +0000 (09:39 +0100)
vncviewer/DesktopWindow.cxx
vncviewer/cocoa.h
vncviewer/cocoa.mm

index 78893925c3fe1af0dd258fd44694f6c207541c08..2ca13eea1270bb4b1663d0fa7e3716a35d30b371 100644 (file)
@@ -1023,15 +1023,9 @@ void DesktopWindow::maximizeWindow()
   } else
     ShowWindow(fl_xid(this), SW_MAXIMIZE);
 #elif defined(__APPLE__)
-  // OS X is somewhat strange and does not really have a concept of a
-  // maximized window, so we can simply resize the window to the workarea.
-  // Note that we shouldn't do this whilst in full screen as that will
-  // incorrectly adjust things.
   if (fullscreen_active())
     return;
-  int X, Y, W, H;
-  Fl::screen_work_area(X, Y, W, H, this->x(), this->y());
-  size(W, H);
+  cocoa_win_zoom(this);
 #else
   // X11
   fl_open_display();
index c65e19eb3417b6782e4254179a5cb502bbc47ef6..98e5fafd40e054c7cc5f8e7daacb03bceaa4c982 100644 (file)
@@ -27,6 +27,7 @@ typedef struct CGColorSpace *CGColorSpaceRef;
 CGColorSpaceRef cocoa_win_color_space(Fl_Window *win);
 
 bool cocoa_win_is_zoomed(Fl_Window *win);
+void cocoa_win_zoom(Fl_Window *win);
 
 int cocoa_is_keyboard_event(const void *event);
 
index bd0e08009cc7e87aca848e456ca6ac35b355be99..9fa5470fc65fd423cb926e12d2cd9435e440626b 100644 (file)
@@ -145,6 +145,13 @@ bool cocoa_win_is_zoomed(Fl_Window *win)
   return [nsw isZoomed];
 }
 
+void cocoa_win_zoom(Fl_Window *win)
+{
+  NSWindow *nsw;
+  nsw = (NSWindow*)fl_xid(win);
+  [nsw zoom:nsw];
+}
+
 int cocoa_is_keyboard_event(const void *event)
 {
   NSEvent *nsevent;