[gtk/wip.win32.fixes: 42/44] gdk/win32: Rename 'margins' to 'shadow'
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip.win32.fixes: 42/44] gdk/win32: Rename 'margins' to 'shadow'
- Date: Tue, 5 Jan 2021 09:32:00 +0000 (UTC)
commit a13b1f533a1cf5c7994b903cf7eba9c719d25784
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Thu Dec 31 17:27:40 2020 +0800
gdk/win32: Rename 'margins' to 'shadow'
This improves consistency for the code.
gdk/win32/gdkevents-win32.c | 4 +--
gdk/win32/gdksurface-win32.c | 78 ++++++++++++++++++++++----------------------
gdk/win32/gdksurface-win32.h | 14 ++++----
3 files changed, 48 insertions(+), 48 deletions(-)
---
diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c
index 8a03433742..37b4f54ee6 100644
--- a/gdk/win32/gdkevents-win32.c
+++ b/gdk/win32/gdkevents-win32.c
@@ -1712,8 +1712,8 @@ _gdk_win32_surface_fill_min_max_info (GdkSurface *window,
mmi->ptMaxSize.y = nearest_info.rcWork.bottom - nearest_info.rcWork.top;
}
- mmi->ptMaxTrackSize.x = GetSystemMetrics (SM_CXVIRTUALSCREEN) + impl->margins_x * impl->surface_scale;
- mmi->ptMaxTrackSize.y = GetSystemMetrics (SM_CYVIRTUALSCREEN) + impl->margins_y * impl->surface_scale;
+ mmi->ptMaxTrackSize.x = GetSystemMetrics (SM_CXVIRTUALSCREEN) + impl->shadow_x * impl->surface_scale;
+ mmi->ptMaxTrackSize.y = GetSystemMetrics (SM_CYVIRTUALSCREEN) + impl->shadow_y * impl->surface_scale;
}
return TRUE;
diff --git a/gdk/win32/gdksurface-win32.c b/gdk/win32/gdksurface-win32.c
index d2cae761aa..b581c2a4ca 100644
--- a/gdk/win32/gdksurface-win32.c
+++ b/gdk/win32/gdksurface-win32.c
@@ -1218,10 +1218,10 @@ gdk_win32_surface_layout_popup (GdkSurface *surface,
gdk_surface_layout_popup_helper (surface,
width,
height,
- impl->margins.left,
- impl->margins.right,
- impl->margins.top,
- impl->margins.bottom,
+ impl->shadow.left,
+ impl->shadow.right,
+ impl->shadow.top,
+ impl->shadow.bottom,
monitor,
&bounds,
layout,
@@ -2281,10 +2281,10 @@ snap_up (GdkSurface *window)
y = 0;
height = maxysize;
- x = x - impl->margins.left;
- y = y - impl->margins.top;
- width += impl->margins_x;
- height += impl->margins_y;
+ x = x - impl->shadow.left;
+ y = y - impl->shadow.top;
+ width += impl->shadow_x;
+ height += impl->shadow_y;
gdk_win32_surface_move_resize (window, x, y, width, height);
}
@@ -2307,10 +2307,10 @@ snap_left (GdkSurface *window,
rect.width = rect.width / 2;
- rect.x = rect.x - impl->margins.left;
- rect.y = rect.y - impl->margins.top;
- rect.width = rect.width + impl->margins_x;
- rect.height = rect.height + impl->margins_y;
+ rect.x = rect.x - impl->shadow.left;
+ rect.y = rect.y - impl->shadow.top;
+ rect.width = rect.width + impl->shadow_x;
+ rect.height = rect.height + impl->shadow_y;
gdk_win32_surface_move_resize (window,
rect.x, rect.y,
@@ -2336,10 +2336,10 @@ snap_right (GdkSurface *window,
rect.width = rect.width / 2;
rect.x += rect.width;
- rect.x = rect.x - impl->margins.left;
- rect.y = rect.y - impl->margins.top;
- rect.width = rect.width + impl->margins_x;
- rect.height = rect.height + impl->margins_y;
+ rect.x = rect.x - impl->shadow.left;
+ rect.y = rect.y - impl->shadow.top;
+ rect.width = rect.width + impl->shadow_x;
+ rect.height = rect.height + impl->shadow_y;
gdk_win32_surface_move_resize (window,
rect.x, rect.y,
@@ -3479,10 +3479,10 @@ setup_drag_move_resize_context (GdkSurface *window,
*/
if (op == GDK_WIN32_DRAGOP_MOVE && !maximized)
{
- swx += impl->margins.left / impl->surface_scale;
- swy += impl->margins.top / impl->surface_scale;
- swwidth -= impl->margins_x;
- swheight -= impl->margins_y;
+ swx += impl->shadow.left / impl->surface_scale;
+ swy += impl->shadow.top / impl->surface_scale;
+ swwidth -= impl->shadow_x;
+ swheight -= impl->shadow_y;
}
pointer_outside_of_window = root_x < swx || root_x > swx + swwidth ||
@@ -3532,23 +3532,23 @@ setup_drag_move_resize_context (GdkSurface *window,
unmax_width = placement.rcNormalPosition.right - placement.rcNormalPosition.left;
unmax_height = placement.rcNormalPosition.bottom - placement.rcNormalPosition.top;
- shadow_unmax_width = unmax_width - impl->margins_x * impl->surface_scale;
- shadow_unmax_height = unmax_height - impl->margins_y * impl->surface_scale;
+ shadow_unmax_width = unmax_width - impl->shadow_x * impl->surface_scale;
+ shadow_unmax_height = unmax_height - impl->shadow_y * impl->surface_scale;
if (offsetx * impl->surface_scale < (shadow_unmax_width / 2) &&
offsety * impl->surface_scale < (shadow_unmax_height / 2))
{
- placement.rcNormalPosition.top = (root_y - offsety + impl->margins.top - _gdk_offset_y) *
impl->surface_scale;
+ placement.rcNormalPosition.top = (root_y - offsety + impl->shadow.top - _gdk_offset_y) *
impl->surface_scale;
placement.rcNormalPosition.bottom = placement.rcNormalPosition.top + unmax_height;
if (left_half)
{
- placement.rcNormalPosition.left = (root_x - offsetx + impl->margins.left - _gdk_offset_x)
* impl->surface_scale;
+ placement.rcNormalPosition.left = (root_x - offsetx + impl->shadow.left - _gdk_offset_x) *
impl->surface_scale;
placement.rcNormalPosition.right = placement.rcNormalPosition.left + unmax_width;
}
else
{
- placement.rcNormalPosition.right = (root_x + offsetx + impl->margins.right -
_gdk_offset_x) * impl->surface_scale;
+ placement.rcNormalPosition.right = (root_x + offsetx + impl->shadow.right - _gdk_offset_x)
* impl->surface_scale;
placement.rcNormalPosition.left = placement.rcNormalPosition.right - unmax_width;
}
}
@@ -3559,7 +3559,7 @@ setup_drag_move_resize_context (GdkSurface *window,
(_gdk_offset_x * impl->surface_scale);
if (offsety * impl->surface_scale < shadow_unmax_height / 2)
- placement.rcNormalPosition.top = (root_y - offsety + impl->margins.top - _gdk_offset_y) *
impl->surface_scale;
+ placement.rcNormalPosition.top = (root_y - offsety + impl->shadow.top - _gdk_offset_y) *
impl->surface_scale;
else
placement.rcNormalPosition.top = (root_y * impl->surface_scale) -
(unmax_height / 2) -
@@ -3586,18 +3586,18 @@ setup_drag_move_resize_context (GdkSurface *window,
if (op == GDK_WIN32_DRAGOP_MOVE)
{
- snew_pos.width -= impl->margins_x;
- snew_pos.height -= impl->margins_y;
+ snew_pos.width -= impl->shadow_x;
+ snew_pos.height -= impl->shadow_y;
}
if (offsetx < snew_pos.width / 2 && offsety < snew_pos.height / 2)
{
- new_pos.y = root_y - offsety + impl->margins.top / impl->surface_scale;
+ new_pos.y = root_y - offsety + impl->shadow.top / impl->surface_scale;
if (left_half)
- new_pos.x = root_x - offsetx + impl->margins.left / impl->surface_scale;
+ new_pos.x = root_x - offsetx + impl->shadow.left / impl->surface_scale;
else
- new_pos.x = root_x + offsetx + impl->margins.left / impl->surface_scale - new_pos.width;
+ new_pos.x = root_x + offsetx + impl->shadow.left / impl->surface_scale - new_pos.width;
}
else
{
@@ -4365,17 +4365,17 @@ gdk_win32_surface_set_shadow_width (GdkSurface *window,
"left %d, top %d, right %d, bottom %d\n",
window, left, top, right, bottom));
- impl->zero_margins = left == 0 && right == 0 && top == 0 && bottom == 0;
+ impl->zero_shadow = left == 0 && right == 0 && top == 0 && bottom == 0;
- if (impl->zero_margins)
+ if (impl->zero_shadow)
return;
- impl->margins.left = left;
- impl->margins.right = right * impl->surface_scale;
- impl->margins.top = top;
- impl->margins.bottom = bottom * impl->surface_scale;
- impl->margins_x = left + right;
- impl->margins_y = top + bottom;
+ impl->shadow.left = left;
+ impl->shadow.right = right * impl->surface_scale;
+ impl->shadow.top = top;
+ impl->shadow.bottom = bottom * impl->surface_scale;
+ impl->shadow_x = left + right;
+ impl->shadow_y = top + bottom;
}
diff --git a/gdk/win32/gdksurface-win32.h b/gdk/win32/gdksurface-win32.h
index 7d429d8b63..a8def428e0 100644
--- a/gdk/win32/gdksurface-win32.h
+++ b/gdk/win32/gdksurface-win32.h
@@ -265,16 +265,16 @@ struct _GdkWin32Surface
int initial_y;
/* left/right/top/bottom width of the shadow/resize-grip around the window */
- RECT margins;
+ RECT shadow;
- /* left+right and top+bottom from @margins */
- int margins_x;
- int margins_y;
+ /* left+right and top+bottom from @shadow */
+ int shadow_x;
+ int shadow_y;
- /* Set to TRUE when GTK tells us that margins are 0 everywhere.
- * We don't actually set margins to 0, we just set this bit.
+ /* Set to TRUE when GTK tells us that shadow are 0 everywhere.
+ * We don't actually set shadow to 0, we just set this bit.
*/
- guint zero_margins : 1;
+ guint zero_shadow : 1;
guint inhibit_configure : 1;
/* If TRUE, the @temp_styles is set to the styles that were temporarily
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]