New function. Factor out code from gdk_window_shape_combine_mask().

2006-02-20  Tor Lillqvist  <tml@novell.com>

	* gdk/win32/gdkwindow-win32.c (do_shape_combine_region): New
	function. Factor out code from gdk_window_shape_combine_mask().
	(gdk_window_shape_combine_region): Actually do something. Convert
	region to a HRGN and call do_shape_combine_region().
	(gdk_window_input_shape_combine_mask)
	(gdk_window_input_shape_combine_region)
	(gdk_window_set_child_input_shapes)
	(gdk_window_merge_child_input_shapes): New functions, dummy
	implementations.
This commit is contained in:
Tor Lillqvist 2006-02-20 10:08:37 +00:00 committed by Tor Lillqvist
parent 9b9a5bcee6
commit f251cf42fd
3 changed files with 131 additions and 19 deletions

View File

@ -1,3 +1,15 @@
2006-02-20 Tor Lillqvist <tml@novell.com>
* gdk/win32/gdkwindow-win32.c (do_shape_combine_region): New
function. Factor out code from gdk_window_shape_combine_mask().
(gdk_window_shape_combine_region): Actually do something. Convert
region to a HRGN and call do_shape_combine_region().
(gdk_window_input_shape_combine_mask)
(gdk_window_input_shape_combine_region)
(gdk_window_set_child_input_shapes)
(gdk_window_merge_child_input_shapes): New functions, dummy
implementations.
2006-02-20 Michael Natterer <mitch@imendio.com>
* gdk/x11/gdkdisplay-x11.h (struct _GdkDisplayX11): adding boolean

View File

@ -1,3 +1,15 @@
2006-02-20 Tor Lillqvist <tml@novell.com>
* gdk/win32/gdkwindow-win32.c (do_shape_combine_region): New
function. Factor out code from gdk_window_shape_combine_mask().
(gdk_window_shape_combine_region): Actually do something. Convert
region to a HRGN and call do_shape_combine_region().
(gdk_window_input_shape_combine_mask)
(gdk_window_input_shape_combine_region)
(gdk_window_set_child_input_shapes)
(gdk_window_merge_child_input_shapes): New functions, dummy
implementations.
2006-02-20 Michael Natterer <mitch@imendio.com>
* gdk/x11/gdkdisplay-x11.h (struct _GdkDisplayX11): adding boolean

View File

@ -2325,6 +2325,30 @@ gdk_window_set_events (GdkWindow *window,
GDK_WINDOW_OBJECT (window)->event_mask = GDK_STRUCTURE_MASK | event_mask;
}
static void
do_shape_combine_region (GdkWindow *window,
HRGN hrgn,
gint x, gint y)
{
RECT rect;
GetClientRect (GDK_WINDOW_HWND (window), &rect);
_gdk_win32_adjust_client_rect (window, &rect);
OffsetRgn (hrgn, -rect.left, -rect.top);
OffsetRgn (hrgn, x, y);
/* If this is a top-level window, add the title bar to the region */
if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_TOPLEVEL)
{
HRGN tmp = CreateRectRgn (0, 0, rect.right - rect.left, -rect.top);
CombineRgn (hrgn, hrgn, tmp, RGN_OR);
DeleteObject (tmp);
}
SetWindowRgn (GDK_WINDOW_HWND (window), hrgn, TRUE);
}
void
gdk_window_shape_combine_mask (GdkWindow *window,
GdkBitmap *mask,
@ -2345,35 +2369,41 @@ gdk_window_shape_combine_mask (GdkWindow *window,
else
{
HRGN hrgn;
RECT rect;
/* Convert mask bitmap to region */
hrgn = _gdk_win32_bitmap_to_hrgn (mask);
GDK_NOTE (MISC, g_print ("gdk_window_shape_combine_mask: %p: %p\n",
GDK_WINDOW_HWND (window),
GDK_WINDOW_HWND (mask)));
GetClientRect (GDK_WINDOW_HWND (window), &rect);
_gdk_win32_adjust_client_rect (window, &rect);
/* Convert mask bitmap to region */
hrgn = _gdk_win32_bitmap_to_hrgn (mask);
OffsetRgn (hrgn, -rect.left, -rect.top);
OffsetRgn (hrgn, x, y);
/* If this is a top-level window, add the title bar to the region */
if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_TOPLEVEL)
{
HRGN tmp = CreateRectRgn (0, 0, rect.right - rect.left, -rect.top);
CombineRgn (hrgn, hrgn, tmp, RGN_OR);
DeleteObject (tmp);
}
SetWindowRgn (GDK_WINDOW_HWND (window), hrgn, TRUE);
do_shape_combine_region (window, hrgn, x, y);
private->shaped = TRUE;
}
}
void
gdk_window_input_shape_combine_mask (GdkWindow *window,
GdkBitmap *mask,
gint x,
gint y)
{
g_return_if_fail (GDK_IS_WINDOW (window));
/* Not yet implemented
*
* I don't think there is anything in the Win32 API to directly
* support this. And anyway, as we don't currently support RGBA
* windows, it doesn't really matter.
*
* When we do support RGBA, input shape functionality could probably
* be implemented by saving the input shape region in the per-window
* private data, and then simply checking before generating an input
* event whether the event's coordinates are inside the region.
*/
}
void
gdk_window_set_override_redirect (GdkWindow *window,
gboolean override_redirect)
@ -2820,6 +2850,26 @@ gdk_window_merge_child_shapes (GdkWindow *window)
gdk_propagate_shapes (GDK_WINDOW_HWND (window), TRUE);
}
void
gdk_window_set_child_input_shapes (GdkWindow *window)
{
g_return_if_fail (GDK_IS_WINDOW (window));
/* Not yet implemented. See comment in
* gdk_window_input_shape_combine_mask().
*/
}
void
gdk_window_merge_child_input_shapes (GdkWindow *window)
{
g_return_if_fail (GDK_IS_WINDOW (window));
/* Not yet implemented. See comment in
* gdk_window_input_shape_combine_mask().
*/
}
gboolean
gdk_window_set_static_gravities (GdkWindow *window,
gboolean use_static)
@ -3287,12 +3337,48 @@ gdk_window_shape_combine_region (GdkWindow *window,
gint offset_x,
gint offset_y)
{
GdkWindowObject *private = (GdkWindowObject *)window;
g_return_if_fail (GDK_IS_WINDOW (window));
if (GDK_WINDOW_DESTROYED (window))
return;
/* XXX: even on X implemented conditional ... */
if (!shape_region)
{
GDK_NOTE (MISC, g_print ("gdk_window_shape_combine_region: %p: none\n",
GDK_WINDOW_HWND (window)));
SetWindowRgn (GDK_WINDOW_HWND (window), NULL, TRUE);
private->shaped = FALSE;
}
else
{
HRGN hrgn;
hrgn = _gdk_win32_gdkregion_to_hrgn (shape_region, 0, 0);
GDK_NOTE (MISC, g_print ("gdk_window_shape_combine_region: %p: %p\n",
GDK_WINDOW_HWND (window),
hrgn));
do_shape_combine_region (window, hrgn, offset_x, offset_y);
private->shaped = TRUE;
}
}
void
gdk_window_input_shape_combine_region (GdkWindow *window,
GdkRegion *shape_region,
gint offset_x,
gint offset_y)
{
g_return_if_fail (GDK_IS_WINDOW (window));
/* Not yet implemented. See comment in
* gdk_window_input_shape_combine_mask().
*/
}
GdkWindow *
@ -3306,9 +3392,11 @@ gdk_window_lookup_for_display (GdkDisplay *display, GdkNativeWindow anid)
void
gdk_window_enable_synchronized_configure (GdkWindow *window)
{
g_return_if_fail (GDK_IS_WINDOW (window));
}
void
gdk_window_configure_finished (GdkWindow *window)
{
g_return_if_fail (GDK_IS_WINDOW (window));
}