#include "gdkevents.h"
#include "gdkpixmap.h"
#include "gdkwindow.h"
+#include "gdkinternals.h"
+#include "gdkprivate.h"
#include "gdkprivate-win32.h"
#include "gdkinputprivate.h"
#include "gdkwin32.h"
DWORD dwExStyle)
{
if (!AdjustWindowRectEx(lpRect, dwStyle, bMenu, dwExStyle))
- return FALSE;
+ {
+ WIN32_API_FAILED ("AdjustWindowRectEx");
+ return FALSE;
+ }
if (lpRect->left < 0)
{
lpRect->right -= lpRect->left;
return TRUE;
}
+GdkDrawableClass _gdk_windowing_window_class;
+
static void
gdk_win32_window_destroy (GdkDrawable *drawable)
{
GdkWindow *window;
GdkWindowPrivate *private;
- static GdkDrawableClass klass;
static gboolean initialized = FALSE;
if (!initialized)
{
initialized = TRUE;
- klass = _gdk_win32_drawable_class;
- klass.destroy = gdk_win32_window_destroy;
+ _gdk_windowing_window_class = _gdk_win32_drawable_class;
+ _gdk_win32_drawable_class.destroy = gdk_win32_window_destroy;
}
window = _gdk_window_alloc ();
private = (GdkWindowPrivate *) window;
- private->drawable.klass = &klass;
+ private->drawable.klass = &_gdk_windowing_window_class;
private->drawable.klass_data = g_new (GdkWindowWin32Data, 1);
GDK_WINDOW_WIN32DATA (window)->event_mask = 0;
break;
}
+ if (klass == 0)
+ {
+ WIN32_API_FAILED ("RegisterClassEx");
+ g_error ("That is a fatal error");
+ }
return klass;
}
}
klass = RegisterGdkClass (private->drawable.window_type);
- if (!klass)
- g_error ("RegisterClassEx failed");
if (private->drawable.window_type != GDK_WINDOW_CHILD)
{
rect.right = rect.left + private->drawable.width;
rect.bottom = rect.top + private->drawable.height;
- if (!SafeAdjustWindowRectEx (&rect, dwStyle, FALSE, dwExStyle))
- g_warning ("gdk_window_new: AdjustWindowRectEx failed");
+ SafeAdjustWindowRectEx (&rect, dwStyle, FALSE, dwExStyle);
if (x != CW_USEDEFAULT)
{
NULL);
GDK_NOTE (MISC,
- g_print ("gdk_window_create: %s %s %dx%d@+%d+%d %#x = %#x\n"
+ g_print ("gdk_window_new: %s %s %dx%d@+%d+%d %#x = %#x\n"
"...locale %#x codepage %d\n",
(private->drawable.window_type == GDK_WINDOW_TOPLEVEL ? "TOPLEVEL" :
(private->drawable.window_type == GDK_WINDOW_CHILD ? "CHILD" :
if (GDK_DRAWABLE_XID (window) == NULL)
{
- g_warning ("gdk_window_create: CreateWindowEx failed");
+ WIN32_API_FAILED ("CreateWindowEx");
g_free (GDK_DRAWABLE_WIN32DATA (window));
g_free (private);
return NULL;
dwStyle = GetWindowLong (GDK_DRAWABLE_XID (window), GWL_STYLE);
dwExStyle = GetWindowLong (GDK_DRAWABLE_XID (window), GWL_EXSTYLE);
- if (!SafeAdjustWindowRectEx (&rect, dwStyle, FALSE, dwExStyle))
- g_warning ("gdk_window_move: AdjustWindowRectEx failed");
+ SafeAdjustWindowRectEx (&rect, dwStyle, FALSE, dwExStyle);
x = rect.left;
y = rect.top;
if (!MoveWindow (GDK_DRAWABLE_XID (window),
x, y, rect.right - rect.left, rect.bottom - rect.top,
TRUE))
- g_warning ("gdk_window_move: MoveWindow failed");
+ WIN32_API_FAILED ("MoveWindow");
}
}
dwStyle = GetWindowLong (GDK_DRAWABLE_XID (window), GWL_STYLE);
dwExStyle = GetWindowLong (GDK_DRAWABLE_XID (window), GWL_EXSTYLE);
if (!AdjustWindowRectEx (&rect, dwStyle, FALSE, dwExStyle))
- g_warning ("gdk_window_resize: AdjustWindowRectEx failed");
+ WIN32_API_FAILED ("AdjustWindowRectEx");
x = rect.left;
y = rect.top;
if (!MoveWindow (GDK_DRAWABLE_XID (window),
x, y, width, height,
TRUE))
- g_warning ("gdk_window_resize: MoveWindow failed");
+ WIN32_API_FAILED ("MoveWindow");
}
}
dwStyle = GetWindowLong (GDK_DRAWABLE_XID (window), GWL_STYLE);
dwExStyle = GetWindowLong (GDK_DRAWABLE_XID (window), GWL_EXSTYLE);
if (!AdjustWindowRectEx (&rect, dwStyle, FALSE, dwExStyle))
- g_warning ("gdk_window_move_resize: AdjustWindowRectEx failed");
+ WIN32_API_FAILED ("AdjustWindowRectEx");
if (private->drawable.window_type == GDK_WINDOW_CHILD)
{
rect.left, rect.top,
rect.right - rect.left, rect.bottom - rect.top,
TRUE))
- g_warning ("gdk_window_move_resize: MoveWindow failed");
+ WIN32_API_FAILED ("MoveWindow");
if (private->guffaw_gravity)
{
GDK_DRAWABLE_XID (new_parent)));
if (!SetParent (GDK_DRAWABLE_XID (window),
GDK_DRAWABLE_XID (new_parent)))
- g_warning ("gdk_window_reparent: SetParent failed");
+ WIN32_API_FAILED ("SetParent");
if (!MoveWindow (GDK_DRAWABLE_XID (window),
x, y,
window_private->drawable.width,
window_private->drawable.height,
TRUE))
- g_warning ("gdk_window_reparent: MoveWindow failed");
+ WIN32_API_FAILED ("MoveWindow");
}
window_private->parent = new_parent;
}
void
-gdk_window_clear (GdkWindow *window)
-{
- g_return_if_fail (window != NULL);
- g_return_if_fail (GDK_IS_WINDOW (window));
-
- if (!GDK_DRAWABLE_DESTROYED (window))
- gdk_window_clear_area (window, 0, 0, -1, -1);
-}
-
-
-void
-gdk_window_clear_area (GdkWindow *window,
- gint x,
- gint y,
- gint width,
- gint height)
+_gdk_windowing_window_clear_area (GdkWindow *window,
+ gint x,
+ gint y,
+ gint width,
+ gint height)
{
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
width = ((GdkDrawablePrivate *) window)->width - x;
if (height == 0)
height = ((GdkDrawablePrivate *) window)->height - y;
- GDK_NOTE (MISC, g_print ("gdk_window_clear_area: %#x %dx%d@+%d+%d\n",
+ GDK_NOTE (MISC, g_print ("_gdk_windowing_window_clear_area: "
+ "%#x %dx%d@+%d+%d\n",
GDK_DRAWABLE_XID (window), width, height, x, y));
hdc = GetDC (GDK_DRAWABLE_XID (window));
- IntersectClipRect (hdc, x, y, x + width, y + height);
+ IntersectClipRect (hdc, x, y, x + width + 1, y + height + 1);
SendMessage (GDK_DRAWABLE_XID (window), WM_ERASEBKGND, (WPARAM) hdc, 0);
ReleaseDC (GDK_DRAWABLE_XID (window), hdc);
}
}
void
-gdk_window_clear_area_e (GdkWindow *window,
- gint x,
- gint y,
- gint width,
- gint height)
+_gdk_windowing_window_clear_area_e (GdkWindow *window,
+ gint x,
+ gint y,
+ gint width,
+ gint height)
{
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
{
RECT rect;
- GDK_NOTE (MISC, g_print ("gdk_window_clear_area_e: %#x %dx%d@+%d+%d\n",
+ GDK_NOTE (MISC, g_print ("_gdk_windowing_window_clear_area_e: "
+ "%#x %dx%d@+%d+%d\n",
GDK_DRAWABLE_XID (window), width, height, x, y));
rect.left = x;
- rect.right = x + width;
+ rect.right = x + width + 1;
rect.top = y;
- rect.bottom = y + height;
+ rect.bottom = y + height + 1;
if (!InvalidateRect (GDK_DRAWABLE_XID (window), &rect, TRUE))
- g_warning ("gdk_window_clear_area_e: InvalidateRect failed");
+ WIN32_GDI_FAILED ("InvalidateRect");
UpdateWindow (GDK_DRAWABLE_XID (window));
}
}
GDK_DRAWABLE_XID (window)));
if (!BringWindowToTop (GDK_DRAWABLE_XID (window)))
- g_warning ("gdk_window_raise: BringWindowToTop failed");
+ WIN32_API_FAILED ("BringWindowToTop");
}
}
if (!SetWindowPos (GDK_DRAWABLE_XID (window), HWND_BOTTOM, 0, 0, 0, 0,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE))
- g_warning ("gdk_window_lower: SetWindowPos failed");
+ WIN32_API_FAILED ("SetWindowPos");
}
}
{
if (flags & GDK_HINT_POS)
if (!GetWindowPlacement (GDK_DRAWABLE_XID (window), &size_hints))
- g_warning ("gdk_window_set_hints: GetWindowPlacement failed");
+ WIN32_API_FAILED ("GetWindowPlacement");
else
{
GDK_NOTE (MISC, g_print ("...rcNormalPosition:"
size_hints.rcNormalPosition.right,
size_hints.rcNormalPosition.bottom));
if (!SetWindowPlacement (GDK_DRAWABLE_XID (window), &size_hints))
- g_warning ("gdk_window_set_hints: SetWindowPlacement failed");
+ WIN32_API_FAILED ("SetWindowPlacement");
GDK_WINDOW_WIN32DATA (window)->hint_x = rect.left;
GDK_WINDOW_WIN32DATA (window)->hint_y = rect.top;
}
&& geometry->base_width > 0
&& geometry->base_height > 0)
if (!GetWindowPlacement (GDK_DRAWABLE_XID (window), &size_hints))
- g_warning ("gdk_window_set_hints: GetWindowPlacement failed");
+ WIN32_API_FAILED ("GetWindowPlacement");
else
{
GDK_NOTE (MISC, g_print ("gdk_window_set_geometry_hints:"
size_hints.rcNormalPosition.right,
size_hints.rcNormalPosition.bottom));
if (!SetWindowPlacement (GDK_DRAWABLE_XID (window), &size_hints))
- g_warning ("gdk_window_set_hints: SetWindowPlacement failed");
+ WIN32_API_FAILED ("SetWindowPlacement");
}
if (geom_mask & GDK_HINT_RESIZE_INC)
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
+ g_return_if_fail (title != NULL);
+ g_return_if_fail (strlen (title) > 0);
GDK_NOTE (MISC, g_print ("gdk_window_set_title: %#x %s\n",
GDK_DRAWABLE_XID (window), title));
mbstr, 3*titlelen, NULL, NULL);
if (!SetWindowText (GDK_DRAWABLE_XID (window), mbstr))
- g_warning ("gdk_window_set_title: SetWindowText failed");
+ WIN32_API_FAILED ("SetWindowText");
g_free (mbstr);
g_free (wcstr);
GDK_WINDOW_WIN32DATA (window)->bg_type = GDK_WIN32_BG_NORMAL;
}
GDK_WINDOW_WIN32DATA (window)->bg_type = GDK_WIN32_BG_PIXEL;
- GDK_WINDOW_WIN32DATA (window)->bg_pixel = *color;
+ GDK_WINDOW_WIN32DATA (window)->bg_pixel = color->pixel;
}
}
{
GdkCursorPrivate *cursor_private;
HCURSOR xcursor;
+ POINT pt;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
GDK_NOTE (MISC, g_print ("gdk_window_set_cursor: %#x %#x\n",
GDK_DRAWABLE_XID (window), xcursor));
GDK_WINDOW_WIN32DATA (window)->xcursor = xcursor;
+
+ GetCursorPos (&pt);
+ if (ChildWindowFromPoint (GDK_DRAWABLE_XID (window), pt) == GDK_DRAWABLE_XID (window))
+ SetCursor (xcursor);
}
}
RECT rect;
if (!GetClientRect (GDK_DRAWABLE_XID (window), &rect))
- g_warning ("gdk_window_get_geometry: GetClientRect failed");
+ WIN32_API_FAILED ("GetClientRect");
if (x)
*x = rect.left;
if (GDK_DRAWABLE_DESTROYED (window))
return;
- g_warning ("gdk_window_set_icon not implemented");
+ /* Nothing to do, really. As we share window classes between windows
+ * we can't have window-specific icons, sorry. Don't print any warning
+ * either.
+ */
}
void
-gdk_window_set_icon_name (GdkWindow *window,
- gchar *name)
+gdk_window_set_icon_name (GdkWindow *window,
+ const gchar *name)
{
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
return;
if (!SetWindowText (GDK_DRAWABLE_XID (window), name))
- g_warning ("gdk_window_set_icon_name: SetWindowText failed");
+ WIN32_API_FAILED ("SetWindowText");
}
void
for (i = 0; i < num; i++)
{
GetWindowPlacement (list[i], &placement);
- if (placement.showCmd = SW_SHOWNORMAL)
+ if (placement.showCmd == SW_SHOWNORMAL)
{
childRegion = CreateRectRgnIndirect (&emptyRect);
GetWindowRgn (list[i], childRegion);