Explorar el Código

Don't resize viewer window when maximized

Most window managers won't like this, and it tends to provoke bugs in
FLTK, so let's avoid it. It's probably not what the user wants anyway.
tags/v1.10.90
Pierre Ossman hace 4 años
padre
commit
aaeee37f0a
Se han modificado 3 ficheros con 47 adiciones y 1 borrados
  1. 38
    1
      vncviewer/DesktopWindow.cxx
  2. 2
    0
      vncviewer/cocoa.h
  3. 7
    0
      vncviewer/cocoa.mm

+ 38
- 1
vncviewer/DesktopWindow.cxx Ver fichero

@@ -252,13 +252,50 @@ void DesktopWindow::updateWindow()

void DesktopWindow::resizeFramebuffer(int new_w, int new_h)
{
bool maximized;

if ((new_w == viewport->w()) && (new_h == viewport->h()))
return;

maximized = false;

#ifdef WIN32
WINDOWPLACEMENT wndpl;
memset(&wndpl, 0, sizeof(WINDOWPLACEMENT));
wndpl.length = sizeof(WINDOWPLACEMENT);
GetWindowPlacement(fl_xid(this), &wndpl);
if (wndpl.showCmd == SW_SHOWMAXIMIZED)
maximized = true;
#elif defined(__APPLE__)
if (cocoa_win_is_zoomed(this))
maximized = true;
#else
Atom net_wm_state = XInternAtom (fl_display, "_NET_WM_STATE", 0);
Atom net_wm_state_maximized_vert = XInternAtom (fl_display, "_NET_WM_STATE_MAXIMIZED_VERT", 0);
Atom net_wm_state_maximized_horz = XInternAtom (fl_display, "_NET_WM_STATE_MAXIMIZED_HORZ", 0);

Atom type;
int format;
unsigned long nitems, remain;
Atom *atoms;

XGetWindowProperty(fl_display, fl_xid(this), net_wm_state, 0, 1024, False, XA_ATOM, &type, &format, &nitems, &remain, (unsigned char**)&atoms);

for (unsigned long i = 0;i < nitems;i++) {
if ((atoms[i] == net_wm_state_maximized_vert) ||
(atoms[i] == net_wm_state_maximized_horz)) {
maximized = true;
break;
}
}

XFree(atoms);
#endif

// If we're letting the viewport match the window perfectly, then
// keep things that way for the new size, otherwise just keep things
// like they are.
if (!fullscreen_active()) {
if (!fullscreen_active() && !maximized) {
if ((w() == viewport->w()) && (h() == viewport->h()))
size(new_w, new_h);
else {

+ 2
- 0
vncviewer/cocoa.h Ver fichero

@@ -26,6 +26,8 @@ typedef struct CGColorSpace *CGColorSpaceRef;

CGColorSpaceRef cocoa_win_color_space(Fl_Window *win);

bool cocoa_win_is_zoomed(Fl_Window *win);

int cocoa_is_keyboard_event(const void *event);

int cocoa_is_key_press(const void *event);

+ 7
- 0
vncviewer/cocoa.mm Ver fichero

@@ -138,6 +138,13 @@ CGColorSpaceRef cocoa_win_color_space(Fl_Window *win)
return lut;
}

bool cocoa_win_is_zoomed(Fl_Window *win)
{
NSWindow *nsw;
nsw = (NSWindow*)fl_xid(win);
return [nsw isZoomed];
}

int cocoa_is_keyboard_event(const void *event)
{
NSEvent *nsevent;

Cargando…
Cancelar
Guardar