forked from AuroraMiddleware/gtk
GDK-Win32: Make surface ready for updates
Make the toplevel surface respond to size computations unless it is just being created, or maximized, made fullscreen or underwent an AeroSnap operation. This will ensure that the surface size is properly computed in time, so that surfaces can be resized as needed. This will fix issues 3728 and 3799.
This commit is contained in:
parent
2611a996ff
commit
82d9570ed4
@ -652,6 +652,7 @@ _gdk_win32_display_create_surface (GdkDisplay *display,
|
|||||||
|
|
||||||
g_object_unref (frame_clock);
|
g_object_unref (frame_clock);
|
||||||
impl->hdc = GetDC (impl->handle);
|
impl->hdc = GetDC (impl->handle);
|
||||||
|
impl->inhibit_configure = TRUE;
|
||||||
|
|
||||||
return surface;
|
return surface;
|
||||||
}
|
}
|
||||||
@ -1077,6 +1078,7 @@ gdk_win32_surface_resize (GdkSurface *window,
|
|||||||
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER));
|
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER));
|
||||||
window->resize_count += 1;
|
window->resize_count += 1;
|
||||||
|
|
||||||
|
if (!GDK_WIN32_SURFACE (window)->force_recompute_size)
|
||||||
gdk_surface_request_layout (window);
|
gdk_surface_request_layout (window);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2522,6 +2524,12 @@ apply_snap (GdkSurface *window,
|
|||||||
snap_up (window);
|
snap_up (window);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (snap != GDK_WIN32_AEROSNAP_STATE_UNDETERMINED)
|
||||||
|
{
|
||||||
|
GDK_WIN32_SURFACE (window)->inhibit_configure = TRUE;
|
||||||
|
GDK_WIN32_SURFACE (window)->force_recompute_size = FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Registers a dumb window class. This window
|
/* Registers a dumb window class. This window
|
||||||
@ -3417,6 +3425,7 @@ setup_drag_move_resize_context (GdkSurface *window,
|
|||||||
GdkWin32Surface *impl = GDK_WIN32_SURFACE (window);
|
GdkWin32Surface *impl = GDK_WIN32_SURFACE (window);
|
||||||
gboolean maximized = gdk_toplevel_get_state (GDK_TOPLEVEL (window)) & GDK_TOPLEVEL_STATE_MAXIMIZED;
|
gboolean maximized = gdk_toplevel_get_state (GDK_TOPLEVEL (window)) & GDK_TOPLEVEL_STATE_MAXIMIZED;
|
||||||
int root_x, root_y;
|
int root_x, root_y;
|
||||||
|
gboolean restore_configure = FALSE;
|
||||||
|
|
||||||
gdk_win32_surface_get_root_coords (window, x, y, &root_x, &root_y);
|
gdk_win32_surface_get_root_coords (window, x, y, &root_x, &root_y);
|
||||||
|
|
||||||
@ -3465,6 +3474,7 @@ setup_drag_move_resize_context (GdkSurface *window,
|
|||||||
impl->snap_state == GDK_WIN32_AEROSNAP_STATE_FULLUP))
|
impl->snap_state == GDK_WIN32_AEROSNAP_STATE_FULLUP))
|
||||||
{
|
{
|
||||||
discard_snapinfo (window);
|
discard_snapinfo (window);
|
||||||
|
restore_configure = TRUE;
|
||||||
}
|
}
|
||||||
else if (maximized ||
|
else if (maximized ||
|
||||||
(impl->snap_state == GDK_WIN32_AEROSNAP_STATE_HALFRIGHT ||
|
(impl->snap_state == GDK_WIN32_AEROSNAP_STATE_HALFRIGHT ||
|
||||||
@ -3479,6 +3489,7 @@ setup_drag_move_resize_context (GdkSurface *window,
|
|||||||
gboolean left_half;
|
gboolean left_half;
|
||||||
GdkDisplay *display;
|
GdkDisplay *display;
|
||||||
|
|
||||||
|
restore_configure = TRUE;
|
||||||
display = gdk_surface_get_display (window);
|
display = gdk_surface_get_display (window);
|
||||||
monitor = gdk_display_get_monitor_at_surface (display, window);
|
monitor = gdk_display_get_monitor_at_surface (display, window);
|
||||||
gdk_surface_get_geometry (window, &wx, &wy, &wwidth, &wheight);
|
gdk_surface_get_geometry (window, &wx, &wy, &wwidth, &wheight);
|
||||||
@ -3645,6 +3656,9 @@ setup_drag_move_resize_context (GdkSurface *window,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (restore_configure)
|
||||||
|
impl->inhibit_configure = FALSE;
|
||||||
|
|
||||||
_gdk_win32_get_window_rect (window, &rect);
|
_gdk_win32_get_window_rect (window, &rect);
|
||||||
|
|
||||||
cursor_name = get_cursor_name_from_op (op, edge);
|
cursor_name = get_cursor_name_from_op (op, edge);
|
||||||
@ -4084,6 +4098,8 @@ gdk_win32_surface_minimize (GdkSurface *window)
|
|||||||
static void
|
static void
|
||||||
gdk_win32_surface_maximize (GdkSurface *window)
|
gdk_win32_surface_maximize (GdkSurface *window)
|
||||||
{
|
{
|
||||||
|
GdkWin32Surface *impl;
|
||||||
|
|
||||||
g_return_if_fail (GDK_IS_SURFACE (window));
|
g_return_if_fail (GDK_IS_SURFACE (window));
|
||||||
|
|
||||||
if (GDK_SURFACE_DESTROYED (window))
|
if (GDK_SURFACE_DESTROYED (window))
|
||||||
@ -4093,6 +4109,10 @@ gdk_win32_surface_maximize (GdkSurface *window)
|
|||||||
GDK_SURFACE_HWND (window),
|
GDK_SURFACE_HWND (window),
|
||||||
_gdk_win32_surface_state_to_string (window->state)));
|
_gdk_win32_surface_state_to_string (window->state)));
|
||||||
|
|
||||||
|
impl = GDK_WIN32_SURFACE (window);
|
||||||
|
impl->inhibit_configure = TRUE;
|
||||||
|
impl->force_recompute_size = FALSE;
|
||||||
|
|
||||||
if (GDK_SURFACE_IS_MAPPED (window))
|
if (GDK_SURFACE_IS_MAPPED (window))
|
||||||
GtkShowWindow (window, SW_MAXIMIZE);
|
GtkShowWindow (window, SW_MAXIMIZE);
|
||||||
else
|
else
|
||||||
@ -4104,6 +4124,8 @@ gdk_win32_surface_maximize (GdkSurface *window)
|
|||||||
static void
|
static void
|
||||||
gdk_win32_surface_unmaximize (GdkSurface *window)
|
gdk_win32_surface_unmaximize (GdkSurface *window)
|
||||||
{
|
{
|
||||||
|
GdkWin32Surface *impl;
|
||||||
|
|
||||||
g_return_if_fail (GDK_IS_SURFACE (window));
|
g_return_if_fail (GDK_IS_SURFACE (window));
|
||||||
|
|
||||||
if (GDK_SURFACE_DESTROYED (window))
|
if (GDK_SURFACE_DESTROYED (window))
|
||||||
@ -4121,6 +4143,14 @@ gdk_win32_surface_unmaximize (GdkSurface *window)
|
|||||||
gdk_synthesize_surface_state (window,
|
gdk_synthesize_surface_state (window,
|
||||||
GDK_TOPLEVEL_STATE_MAXIMIZED,
|
GDK_TOPLEVEL_STATE_MAXIMIZED,
|
||||||
0);
|
0);
|
||||||
|
|
||||||
|
impl = GDK_WIN32_SURFACE (window);
|
||||||
|
|
||||||
|
if (impl->inhibit_configure)
|
||||||
|
{
|
||||||
|
impl->inhibit_configure = FALSE;
|
||||||
|
impl->force_recompute_size = TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -4545,6 +4575,9 @@ _gdk_win32_surface_request_layout (GdkSurface *surface)
|
|||||||
&surface->x, &surface->y,
|
&surface->x, &surface->y,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!impl->inhibit_configure)
|
||||||
|
impl->force_recompute_size = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4558,9 +4591,19 @@ _gdk_win32_surface_compute_size (GdkSurface *surface)
|
|||||||
compute_toplevel_size (surface, TRUE, &width, &height);
|
compute_toplevel_size (surface, TRUE, &width, &height);
|
||||||
|
|
||||||
if (!impl->drag_move_resize_context.native_move_resize_pending)
|
if (!impl->drag_move_resize_context.native_move_resize_pending)
|
||||||
|
{
|
||||||
|
if (GDK_IS_TOPLEVEL (surface) && impl->force_recompute_size)
|
||||||
|
{
|
||||||
|
surface->width = width;
|
||||||
|
surface->height = height;
|
||||||
|
gdk_win32_surface_resize (surface, width, height);
|
||||||
|
impl->force_recompute_size = FALSE;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
surface->width = impl->next_layout.configured_width;
|
surface->width = impl->next_layout.configured_width;
|
||||||
surface->height = impl->next_layout.configured_height;
|
surface->height = impl->next_layout.configured_height;
|
||||||
|
}
|
||||||
|
|
||||||
_gdk_surface_update_size (surface);
|
_gdk_surface_update_size (surface);
|
||||||
}
|
}
|
||||||
|
@ -337,6 +337,7 @@ struct _GdkWin32Surface
|
|||||||
int configured_height;
|
int configured_height;
|
||||||
RECT configured_rect;
|
RECT configured_rect;
|
||||||
} next_layout;
|
} next_layout;
|
||||||
|
gboolean force_recompute_size;
|
||||||
|
|
||||||
#ifdef HAVE_EGL
|
#ifdef HAVE_EGL
|
||||||
guint egl_force_redraw_all : 1;
|
guint egl_force_redraw_all : 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user