Remove this two-line function which was used only in one place.
2005-11-09 Tor Lillqvist <tml@novell.com> * gdk/win32/gdkwindow-win32.c (_gdk_win32_get_adjusted_client_rect): Remove this two-line function which was used only in one place. (get_outer_rect): Use _gdk_win32_adjust_client_rect(). (gdk_window_set_geometry_hints): If we have identical minimum and maximum size hints, remove the resize and maximize decorations/functions. (#104514) If we have a maximum size hint, remove the maximize decoration/function but ensure the resize decoration/function is available. Otherwise ensure both resize and maximize decorations/functions are there. (set_or_clear_style_bits): Factored out common code from gdk_window_set_decorations() and gdk_window_set_functions(). Hack the window style setting once more: Only touch the window style bits corresponding to the GdkWMDecoration or GdkWMFunction parameter bitmasks. Hopefully this finally is the correct thing to do. We used to clear all other bits than those that were being set, or set all other bits than those that were being cleared. Take into account that adding or removing decorations leaves the window's outer size unchanged, i.e., the client area's size and position change. This is apparently not what we want, so change also the window's (outer) position and size appropriately so that the client area's position and size stay constant. gtk-demo's color selector dialog is now non-resizable like on X11 (I tested with metacity in GNOME). Torn off menus are shrinkable vertically but have a maximum size, and are not maximizable or minimizable, like on X11. (gdk_window_set_decorations, gdk_window_set_functions): Let set_or_clear_decorations() do most of the job. * gdk/win32/gdkprivate-win32.h: Remove declaration of _gdk_win32_get_adjusted_client_rect().
This commit is contained in:
committed by
Tor Lillqvist
parent
856280b3a2
commit
6659bc7689
43
ChangeLog
43
ChangeLog
@@ -1,3 +1,46 @@
|
||||
2005-11-09 Tor Lillqvist <tml@novell.com>
|
||||
|
||||
* gdk/win32/gdkwindow-win32.c
|
||||
(_gdk_win32_get_adjusted_client_rect): Remove this two-line
|
||||
function which was used only in one place.
|
||||
|
||||
(get_outer_rect): Use _gdk_win32_adjust_client_rect().
|
||||
|
||||
(gdk_window_set_geometry_hints): If we have identical minimum and
|
||||
maximum size hints, remove the resize and maximize
|
||||
decorations/functions. (#104514)
|
||||
|
||||
If we have a maximum size hint, remove the maximize
|
||||
decoration/function but ensure the resize decoration/function is
|
||||
available. Otherwise ensure both resize and maximize
|
||||
decorations/functions are there.
|
||||
|
||||
(set_or_clear_style_bits): Factored out common code from
|
||||
gdk_window_set_decorations() and gdk_window_set_functions().
|
||||
|
||||
Hack the window style setting once more: Only touch the window
|
||||
style bits corresponding to the GdkWMDecoration or GdkWMFunction
|
||||
parameter bitmasks. Hopefully this finally is the correct thing to
|
||||
do. We used to clear all other bits than those that were being
|
||||
set, or set all other bits than those that were being cleared.
|
||||
|
||||
Take into account that adding or removing decorations leaves the
|
||||
window's outer size unchanged, i.e., the client area's size and
|
||||
position change. This is apparently not what we want, so change
|
||||
also the window's (outer) position and size appropriately so that
|
||||
the client area's position and size stay constant.
|
||||
|
||||
gtk-demo's color selector dialog is now non-resizable like on X11
|
||||
(I tested with metacity in GNOME). Torn off menus are shrinkable
|
||||
vertically but have a maximum size, and are not maximizable or
|
||||
minimizable, like on X11.
|
||||
|
||||
(gdk_window_set_decorations, gdk_window_set_functions): Let
|
||||
set_or_clear_decorations() do most of the job.
|
||||
|
||||
* gdk/win32/gdkprivate-win32.h: Remove declaration of
|
||||
_gdk_win32_get_adjusted_client_rect().
|
||||
|
||||
2005-11-09 Tor Lillqvist <tml@novell.com>
|
||||
|
||||
* gdk/win32/gdkwindow-win32.c: Remove unnecessary includes.
|
||||
|
||||
@@ -1,3 +1,46 @@
|
||||
2005-11-09 Tor Lillqvist <tml@novell.com>
|
||||
|
||||
* gdk/win32/gdkwindow-win32.c
|
||||
(_gdk_win32_get_adjusted_client_rect): Remove this two-line
|
||||
function which was used only in one place.
|
||||
|
||||
(get_outer_rect): Use _gdk_win32_adjust_client_rect().
|
||||
|
||||
(gdk_window_set_geometry_hints): If we have identical minimum and
|
||||
maximum size hints, remove the resize and maximize
|
||||
decorations/functions. (#104514)
|
||||
|
||||
If we have a maximum size hint, remove the maximize
|
||||
decoration/function but ensure the resize decoration/function is
|
||||
available. Otherwise ensure both resize and maximize
|
||||
decorations/functions are there.
|
||||
|
||||
(set_or_clear_style_bits): Factored out common code from
|
||||
gdk_window_set_decorations() and gdk_window_set_functions().
|
||||
|
||||
Hack the window style setting once more: Only touch the window
|
||||
style bits corresponding to the GdkWMDecoration or GdkWMFunction
|
||||
parameter bitmasks. Hopefully this finally is the correct thing to
|
||||
do. We used to clear all other bits than those that were being
|
||||
set, or set all other bits than those that were being cleared.
|
||||
|
||||
Take into account that adding or removing decorations leaves the
|
||||
window's outer size unchanged, i.e., the client area's size and
|
||||
position change. This is apparently not what we want, so change
|
||||
also the window's (outer) position and size appropriately so that
|
||||
the client area's position and size stay constant.
|
||||
|
||||
gtk-demo's color selector dialog is now non-resizable like on X11
|
||||
(I tested with metacity in GNOME). Torn off menus are shrinkable
|
||||
vertically but have a maximum size, and are not maximizable or
|
||||
minimizable, like on X11.
|
||||
|
||||
(gdk_window_set_decorations, gdk_window_set_functions): Let
|
||||
set_or_clear_decorations() do most of the job.
|
||||
|
||||
* gdk/win32/gdkprivate-win32.h: Remove declaration of
|
||||
_gdk_win32_get_adjusted_client_rect().
|
||||
|
||||
2005-11-09 Tor Lillqvist <tml@novell.com>
|
||||
|
||||
* gdk/win32/gdkwindow-win32.c: Remove unnecessary includes.
|
||||
|
||||
@@ -356,9 +356,6 @@ HRGN _gdk_win32_gdkregion_to_hrgn (GdkRegion *region,
|
||||
void _gdk_win32_adjust_client_rect (GdkWindow *window,
|
||||
RECT *RECT);
|
||||
|
||||
void _gdk_win32_get_adjusted_client_rect (GdkWindow *window,
|
||||
RECT *RECT);
|
||||
|
||||
void _gdk_selection_property_delete (GdkWindow *);
|
||||
|
||||
void _gdk_dropfiles_store (gchar *data);
|
||||
|
||||
@@ -204,14 +204,6 @@ _gdk_win32_adjust_client_rect (GdkWindow *window,
|
||||
API_CALL (AdjustWindowRectEx, (rect, style, FALSE, exstyle));
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_win32_get_adjusted_client_rect (GdkWindow *window,
|
||||
RECT *rect)
|
||||
{
|
||||
GetClientRect (GDK_WINDOW_HWND (window), rect);
|
||||
_gdk_win32_adjust_client_rect (window, rect);
|
||||
}
|
||||
|
||||
static GdkColormap*
|
||||
gdk_window_impl_win32_get_colormap (GdkDrawable *drawable)
|
||||
{
|
||||
@@ -899,16 +891,11 @@ get_outer_rect (GdkWindow *window,
|
||||
gint height,
|
||||
RECT *rect)
|
||||
{
|
||||
LONG style, exstyle;
|
||||
|
||||
style = GetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE);
|
||||
exstyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_EXSTYLE);
|
||||
|
||||
rect->left = rect->top = 0;
|
||||
rect->right = width;
|
||||
rect->bottom = height;
|
||||
|
||||
API_CALL (AdjustWindowRectEx, (rect, style, FALSE, exstyle));
|
||||
_gdk_win32_adjust_client_rect (window, rect);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1238,6 +1225,7 @@ gdk_window_resize (GdkWindow *window,
|
||||
else
|
||||
{
|
||||
RECT outer_rect;
|
||||
|
||||
get_outer_rect (window, width, height, &outer_rect);
|
||||
|
||||
GDK_NOTE (MISC, g_print ("... SetWindowPos(%p,NULL,0,0,%ld,%ld,"
|
||||
@@ -1608,6 +1596,27 @@ gdk_window_set_geometry_hints (GdkWindow *window,
|
||||
geometry->max_width, geometry->max_height));
|
||||
}
|
||||
|
||||
if ((geom_mask & GDK_HINT_MIN_SIZE) &&
|
||||
(geom_mask & GDK_HINT_MAX_SIZE) &&
|
||||
geometry->min_width == geometry->max_width &&
|
||||
geometry->min_height == geometry->max_height)
|
||||
gdk_window_set_decorations (window,
|
||||
GDK_DECOR_ALL |
|
||||
GDK_DECOR_RESIZEH |
|
||||
GDK_DECOR_MAXIMIZE);
|
||||
else if (geom_mask & GDK_HINT_MAX_SIZE)
|
||||
{
|
||||
gdk_window_set_decorations (window,
|
||||
GDK_DECOR_ALL |
|
||||
GDK_DECOR_MAXIMIZE);
|
||||
gdk_window_set_decorations (window,
|
||||
GDK_DECOR_RESIZEH);
|
||||
}
|
||||
else
|
||||
gdk_window_set_decorations (window,
|
||||
GDK_DECOR_RESIZEH |
|
||||
GDK_DECOR_MAXIMIZE);
|
||||
|
||||
if (geom_mask & GDK_HINT_BASE_SIZE)
|
||||
{
|
||||
GDK_NOTE (MISC, g_print ("... BASE_SIZE: %dx%d\n",
|
||||
@@ -2253,7 +2262,8 @@ gdk_window_shape_combine_mask (GdkWindow *window,
|
||||
GDK_WINDOW_HWND (window),
|
||||
GDK_WINDOW_HWND (mask)));
|
||||
|
||||
_gdk_win32_get_adjusted_client_rect (window, &rect);
|
||||
GetClientRect (GDK_WINDOW_HWND (window), &rect);
|
||||
_gdk_win32_adjust_client_rect (window, &rect);
|
||||
|
||||
OffsetRgn (hrgn, -rect.left, -rect.top);
|
||||
OffsetRgn (hrgn, x, y);
|
||||
@@ -2455,18 +2465,54 @@ gdk_window_set_group (GdkWindow *window,
|
||||
g_warning ("gdk_window_set_group not implemented");
|
||||
}
|
||||
|
||||
static void
|
||||
set_or_clear_style_bits (GdkWindow *window,
|
||||
gboolean clear_bits,
|
||||
int bits)
|
||||
{
|
||||
LONG style, exstyle;
|
||||
RECT rect, before, after;
|
||||
|
||||
style = GetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE);
|
||||
exstyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_EXSTYLE);
|
||||
|
||||
GetClientRect (GDK_WINDOW_HWND (window), &before);
|
||||
after = before;
|
||||
AdjustWindowRectEx (&before, style, FALSE, exstyle);
|
||||
|
||||
if (clear_bits)
|
||||
style &= ~bits;
|
||||
else
|
||||
style |= bits;
|
||||
|
||||
SetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE, style);
|
||||
|
||||
AdjustWindowRectEx (&after, style, FALSE, exstyle);
|
||||
|
||||
GetWindowRect (GDK_WINDOW_HWND (window), &rect);
|
||||
rect.left += after.left - before.left;
|
||||
rect.top += after.top - before.top;
|
||||
rect.right += after.right - before.right;
|
||||
rect.bottom += after.bottom - before.bottom;
|
||||
|
||||
SetWindowPos (GDK_WINDOW_HWND (window), NULL,
|
||||
rect.left, rect.top,
|
||||
rect.right - rect.left, rect.bottom - rect.top,
|
||||
SWP_FRAMECHANGED | SWP_NOACTIVATE |
|
||||
SWP_NOREPOSITION | SWP_NOZORDER);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_window_set_decorations (GdkWindow *window,
|
||||
GdkWMDecoration decorations)
|
||||
{
|
||||
LONG style, bits;
|
||||
const LONG settable_bits = WS_BORDER|WS_THICKFRAME|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_MAXIMIZEBOX;
|
||||
int bits;
|
||||
|
||||
g_return_if_fail (GDK_IS_WINDOW (window));
|
||||
|
||||
GDK_NOTE (MISC, g_print ("gdk_window_set_decorations: %p: %s%s%s%s%s%s%s\n",
|
||||
GDK_NOTE (MISC, g_print ("gdk_window_set_decorations: %p: %s %s%s%s%s%s%s\n",
|
||||
GDK_WINDOW_HWND (window),
|
||||
(decorations & GDK_DECOR_ALL ? "ALL " : ""),
|
||||
(decorations & GDK_DECOR_ALL ? "clearing" : "setting"),
|
||||
(decorations & GDK_DECOR_BORDER ? "BORDER " : ""),
|
||||
(decorations & GDK_DECOR_RESIZEH ? "RESIZEH " : ""),
|
||||
(decorations & GDK_DECOR_TITLE ? "TITLE " : ""),
|
||||
@@ -2474,8 +2520,6 @@ gdk_window_set_decorations (GdkWindow *window,
|
||||
(decorations & GDK_DECOR_MINIMIZE ? "MINIMIZE " : ""),
|
||||
(decorations & GDK_DECOR_MAXIMIZE ? "MAXIMIZE " : "")));
|
||||
|
||||
style = GetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE);
|
||||
|
||||
bits = 0;
|
||||
|
||||
if (decorations & GDK_DECOR_BORDER)
|
||||
@@ -2491,16 +2535,7 @@ gdk_window_set_decorations (GdkWindow *window,
|
||||
if (decorations & GDK_DECOR_MAXIMIZE)
|
||||
bits |= WS_MAXIMIZEBOX;
|
||||
|
||||
if (decorations & GDK_DECOR_ALL)
|
||||
style |= settable_bits, style &= ~bits;
|
||||
else
|
||||
style &= ~settable_bits, style |= bits;
|
||||
|
||||
SetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE, style);
|
||||
SetWindowPos (GDK_WINDOW_HWND (window), NULL,
|
||||
0, 0, 0, 0,
|
||||
SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOMOVE |
|
||||
SWP_NOREPOSITION | SWP_NOSIZE | SWP_NOZORDER);
|
||||
set_or_clear_style_bits (window, (decorations & GDK_DECOR_ALL), bits);
|
||||
}
|
||||
|
||||
gboolean
|
||||
@@ -2534,22 +2569,19 @@ void
|
||||
gdk_window_set_functions (GdkWindow *window,
|
||||
GdkWMFunction functions)
|
||||
{
|
||||
LONG style, bits;
|
||||
const LONG settable_bits = (WS_THICKFRAME|WS_MINIMIZEBOX|WS_MAXIMIZEBOX|WS_SYSMENU);
|
||||
int bits;
|
||||
|
||||
g_return_if_fail (GDK_IS_WINDOW (window));
|
||||
|
||||
GDK_NOTE (MISC, g_print ("gdk_window_set_functions: %p: %s%s%s%s%s%s\n",
|
||||
GDK_NOTE (MISC, g_print ("gdk_window_set_functions: %p: %s %s%s%s%s%s\n",
|
||||
GDK_WINDOW_HWND (window),
|
||||
(functions & GDK_FUNC_ALL ? "ALL " : ""),
|
||||
(functions & GDK_FUNC_ALL ? "clearing" : "setting"),
|
||||
(functions & GDK_FUNC_RESIZE ? "RESIZE " : ""),
|
||||
(functions & GDK_FUNC_MOVE ? "MOVE " : ""),
|
||||
(functions & GDK_FUNC_MINIMIZE ? "MINIMIZE " : ""),
|
||||
(functions & GDK_FUNC_MAXIMIZE ? "MAXIMIZE " : ""),
|
||||
(functions & GDK_FUNC_CLOSE ? "CLOSE " : "")));
|
||||
|
||||
style = GetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE);
|
||||
|
||||
bits = 0;
|
||||
|
||||
if (functions & GDK_FUNC_RESIZE)
|
||||
@@ -2563,16 +2595,7 @@ gdk_window_set_functions (GdkWindow *window,
|
||||
if (functions & GDK_FUNC_CLOSE)
|
||||
bits |= WS_SYSMENU;
|
||||
|
||||
if (functions & GDK_FUNC_ALL)
|
||||
style |= settable_bits, style &= ~bits;
|
||||
else
|
||||
style &= ~settable_bits, style |= bits;
|
||||
|
||||
SetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE, style);
|
||||
SetWindowPos (GDK_WINDOW_HWND (window), NULL,
|
||||
0, 0, 0, 0,
|
||||
SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOMOVE |
|
||||
SWP_NOREPOSITION | SWP_NOSIZE | SWP_NOZORDER);
|
||||
set_or_clear_style_bits (window, (functions & GDK_FUNC_ALL), bits);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
Reference in New Issue
Block a user