* Copyright (C) 1998-1999 Tor Lillqvist
*
* This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
+ * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
+ * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
- * Modified by the GTK+ Team and others 1997-1999. See the AUTHORS
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
#include "gdkwindow.h"
#include "gdkinternals.h"
#include "gdkprivate-win32.h"
-#include "gdkwindow-win32.h"
-#include "gdkpixmap-win32.h"
+#include "gdkinput-win32.h"
static gboolean gdk_window_gravity_works (void);
static void gdk_window_set_static_win_gravity (GdkWindow *window,
static void gdk_window_impl_win32_get_size (GdkDrawable *drawable,
gint *width,
gint *height);
+static GdkRegion* gdk_window_impl_win32_get_visible_region (GdkDrawable *drawable);
static void gdk_window_impl_win32_init (GdkWindowImplWin32 *window);
static void gdk_window_impl_win32_class_init (GdkWindowImplWin32Class *klass);
static void gdk_window_impl_win32_finalize (GObject *object);
object_type = g_type_register_static (GDK_TYPE_DRAWABLE_IMPL_WIN32,
"GdkWindowImplWin32",
- &object_info);
+ &object_info, 0);
}
return object_type;
drawable_class->set_colormap = gdk_window_impl_win32_set_colormap;
drawable_class->get_colormap = gdk_window_impl_win32_get_colormap;
drawable_class->get_size = gdk_window_impl_win32_get_size;
+
+ /* Visible and clip regions are the same */
+ drawable_class->get_clip_region = gdk_window_impl_win32_get_visible_region;
+ drawable_class->get_visible_region = gdk_window_impl_win32_get_visible_region;
}
static void
if (window_impl->hcursor != NULL)
{
- DestroyCursor (window_impl->hcursor);
+ if (!DestroyCursor (window_impl->hcursor))
+ WIN32_GDI_FAILED("DestroyCursor");
window_impl->hcursor = NULL;
}
if (!((GdkWindowObject *) drawable_impl->wrapper)->input_only &&
drawable_impl->colormap == NULL)
{
- g_assert_not_reached ();
+ drawable_impl->colormap = gdk_colormap_get_system ();
+ gdk_colormap_ref (drawable_impl->colormap);
}
return drawable_impl->colormap;
GDK_DRAWABLE_GET_CLASS (draw_impl)->set_colormap (drawable, cmap);
/* XXX */
-
+ g_print("gdk_window_impl_win32_set_colormap: XXX\n");
}
static void
*height = GDK_WINDOW_IMPL_WIN32 (drawable)->height;
}
+static GdkRegion*
+gdk_window_impl_win32_get_visible_region (GdkDrawable *drawable)
+{
+ GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (drawable);
+ GdkRectangle result_rect;
+
+ result_rect.x = 0;
+ result_rect.y = 0;
+ result_rect.width = impl->width;
+ result_rect.height = impl->height;
+
+ gdk_rectangle_intersect (&result_rect, &impl->position_info.clip_rect, &result_rect);
+
+ return gdk_region_rectangle (&result_rect);
+}
+
void
_gdk_windowing_window_init (void)
{
impl->width = width;
impl->height = height;
- gdk_win32_handle_table_insert (gdk_root_window, gdk_parent_root);
+ gdk_win32_handle_table_insert (&gdk_root_window, gdk_parent_root);
}
/* The Win API function AdjustWindowRect may return negative values
int width, height;
int x, y;
char *title;
- gint titlelen;
- wchar_t *wctitle;
- gint wlen;
char *mbtitle;
g_return_val_if_fail (attributes != NULL, NULL);
g_return_val_if_fail (GDK_IS_WINDOW (parent), NULL);
+ GDK_NOTE (MISC,
+ g_print ("gdk_window_new: %s\n",
+ (attributes->window_type == GDK_WINDOW_TOPLEVEL ? "TOPLEVEL" :
+ (attributes->window_type == GDK_WINDOW_CHILD ? "CHILD" :
+ (attributes->window_type == GDK_WINDOW_DIALOG ? "DIALOG" :
+ (attributes->window_type == GDK_WINDOW_TEMP ? "TEMP" :
+ "???"))))));
+
parent_private = (GdkWindowObject*) parent;
if (GDK_WINDOW_DESTROYED (parent))
return NULL;
title = attributes->title;
else
title = g_get_prgname ();
- if (!title)
+ if (!title || !*title)
title = "GDK client window";
impl->event_mask = GDK_STRUCTURE_MASK | attributes->event_mask;
{
if ((((GdkVisualPrivate*)gdk_visual_get_system ())->xvisual) == xvisual)
{
- draw_impl->colormap =
- gdk_colormap_get_system ();
+ draw_impl->colormap = gdk_colormap_get_system ();
gdk_colormap_ref (draw_impl->colormap);
+ GDK_NOTE (MISC, g_print ("...using system colormap %p\n",
+ draw_impl->colormap));
}
else
{
- draw_impl->colormap =
- gdk_colormap_new (visual, FALSE);
+ draw_impl->colormap = gdk_colormap_new (visual, FALSE);
+ GDK_NOTE (MISC, g_print ("...using new colormap %p\n",
+ draw_impl->colormap));
}
}
}
private->depth = 0;
private->input_only = TRUE;
draw_impl->colormap = NULL;
+ GDK_NOTE (MISC, g_print ("...GDK_INPUT_ONLY, NULL colormap\n"));
}
if (parent_private)
height = impl->height;
}
- titlelen = strlen (title);
- wctitle = g_new (wchar_t, titlelen + 1);
- mbtitle = g_new (char, 3*titlelen + 1);
- wlen = gdk_nmbstowchar_ts (wctitle, title, titlelen, titlelen);
- wctitle[wlen] = 0;
- WideCharToMultiByte (GetACP (), 0, wctitle, -1,
- mbtitle, 3*titlelen, NULL, NULL);
+ mbtitle = g_locale_from_utf8 (title, -1, NULL, NULL, NULL);
+#ifdef WITHOUT_WM_CREATE
draw_impl->handle = CreateWindowEx (dwExStyle,
MAKEINTRESOURCE(klass),
mbtitle,
NULL,
gdk_app_hmodule,
NULL);
+#else
+ {
+ HWND hwndNew =
+ CreateWindowEx (dwExStyle,
+ MAKEINTRESOURCE(klass),
+ mbtitle,
+ dwStyle,
+ x, y,
+ width, height,
+ hparent,
+ NULL,
+ gdk_app_hmodule,
+ window);
+ if (GDK_WINDOW_HWND (window) != hwndNew)
+ {
+ g_warning("gdk_window_new: gdk_event_translate::WM_CREATE (%#x, %#x) HWND mismatch.",
+ (guint) GDK_WINDOW_HWND (window),
+ (guint) hwndNew);
+
+ /* HB: IHMO due to a race condition the handle was increased by
+ * one, which causes much trouble. Because I can't find the
+ * real bug, try to workaround it ...
+ * To reproduce: compile with MSVC 5, DEBUG=1
+ */
+# if 0
+ gdk_win32_handle_table_remove (GDK_WINDOW_HWND (window));
+ GDK_WINDOW_HWND (window) = hwndNew;
+ gdk_win32_handle_table_insert (&GDK_WINDOW_HWND (window), window);
+# else
+ /* the old behaviour, but with warning */
+ GDK_WINDOW_HWND (window) = hwndNew;
+# endif
+
+ }
+ }
+ gdk_drawable_ref (window);
+ gdk_win32_handle_table_insert (&GDK_WINDOW_HWND (window), window);
+#endif
GDK_NOTE (MISC,
- g_print ("gdk_window_new: %s %s %dx%d@+%d+%d %#x = %#x\n"
- "...locale %#x codepage %d\n",
- (private->window_type == GDK_WINDOW_TOPLEVEL ? "TOPLEVEL" :
- (private->window_type == GDK_WINDOW_CHILD ? "CHILD" :
- (private->window_type == GDK_WINDOW_DIALOG ? "DIALOG" :
- (private->window_type == GDK_WINDOW_TEMP ? "TEMP" :
- "???")))),
+ g_print ("... \"%s\" %dx%d@+%d+%d %#x = %#x\n"
+ "... locale %#x codepage %d\n",
mbtitle,
width, height, (x == CW_USEDEFAULT ? -9999 : x), y,
- hparent,
- GDK_WINDOW_HWND (window),
- impl->input_locale,
- impl->charset_info.ciACP));
+ (guint) hparent,
+ (guint) GDK_WINDOW_HWND (window),
+ (guint) impl->input_locale,
+ (guint) impl->charset_info.ciACP));
g_free (mbtitle);
- g_free (wctitle);
if (draw_impl->handle == NULL)
{
return NULL;
}
+#ifdef WITHOUT_WM_CREATE
gdk_drawable_ref (window);
- gdk_win32_handle_table_insert (GDK_WINDOW_HWND (window), window);
+ gdk_win32_handle_table_insert (&GDK_WINDOW_HWND (window), window);
+#endif
gdk_window_set_cursor (window, ((attributes_mask & GDK_WA_CURSOR) ?
(attributes->cursor) :
impl = GDK_WINDOW_IMPL_WIN32 (private->impl);
draw_impl = GDK_DRAWABLE_IMPL_WIN32 (private->impl);
draw_impl->wrapper = GDK_DRAWABLE (window);
+ parent = GetParent ((HWND)anid);
- private->parent = gdk_win32_handle_table_lookup (parent);
+ private->parent = gdk_win32_handle_table_lookup ((GdkNativeWindow) parent);
parent_private = (GdkWindowObject *)private->parent;
private->depth = gdk_visual_get_system ()->depth;
gdk_drawable_ref (window);
- gdk_win32_handle_table_insert (GDK_WINDOW_HWND (window), window);
+ gdk_win32_handle_table_insert (&GDK_WINDOW_HWND (window), window);
return window;
}
g_return_if_fail (GDK_IS_WINDOW (window));
GDK_NOTE (MISC, g_print ("_gdk_windowing_window_destroy %#x\n",
- GDK_WINDOW_HWND (window)));
+ (guint) GDK_WINDOW_HWND (window)));
if (private->extension_events != 0)
gdk_input_window_destroy (window);
gdk_window_destroy_notify (GdkWindow *window)
{
g_return_if_fail (window != NULL);
+ g_return_if_fail (GDK_IS_WINDOW (window));
GDK_NOTE (EVENTS,
g_print ("gdk_window_destroy_notify: %#x %s\n",
- GDK_WINDOW_HWND (window),
+ (guint) GDK_WINDOW_HWND (window),
(GDK_WINDOW_DESTROYED (window) ? "(destroyed)" : "")));
if (!GDK_WINDOW_DESTROYED (window))
{
if (GDK_WINDOW_TYPE(window) != GDK_WINDOW_FOREIGN)
g_warning ("window %#x unexpectedly destroyed",
- GDK_WINDOW_HWND (window));
+ (guint) GDK_WINDOW_HWND (window));
_gdk_window_destroy (window, TRUE);
}
if (!private->destroyed)
{
GDK_NOTE (MISC, g_print ("gdk_window_show: %#x\n",
- GDK_WINDOW_HWND (window)));
+ (guint) GDK_WINDOW_HWND (window)));
private->mapped = TRUE;
if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_TEMP)
}
else
{
- ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWNORMAL);
- ShowWindow (GDK_WINDOW_HWND (window), SW_RESTORE);
- SetForegroundWindow (GDK_WINDOW_HWND (window));
- BringWindowToTop (GDK_WINDOW_HWND (window));
+ if (GetWindowLong (GDK_WINDOW_HWND (window), GWL_EXSTYLE) & WS_EX_TRANSPARENT)
+ {
+ SetWindowPos(GDK_WINDOW_HWND (window), HWND_TOP, 0, 0, 0, 0,
+ SWP_SHOWWINDOW | SWP_NOREDRAW | SWP_NOMOVE | SWP_NOSIZE);
+ }
+ else
+ {
+ GdkWindow *parent = private->parent;
+
+ ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWNORMAL);
+ ShowWindow (GDK_WINDOW_HWND (window), SW_RESTORE);
+ if (parent == gdk_parent_root)
+ SetForegroundWindow (GDK_WINDOW_HWND (window));
+ BringWindowToTop (GDK_WINDOW_HWND (window));
#if 0
- ShowOwnedPopups (GDK_WINDOW_HWND (window), TRUE);
+ ShowOwnedPopups (GDK_WINDOW_HWND (window), TRUE);
#endif
+ }
}
}
}
if (!private->destroyed)
{
GDK_NOTE (MISC, g_print ("gdk_window_hide: %#x\n",
- GDK_WINDOW_HWND (window)));
+ (guint) GDK_WINDOW_HWND (window)));
private->mapped = FALSE;
if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_TOPLEVEL)
ShowOwnedPopups (GDK_WINDOW_HWND (window), FALSE);
- ShowWindow (GDK_WINDOW_HWND (window), SW_HIDE);
+ if (GetWindowLong (GDK_WINDOW_HWND (window), GWL_EXSTYLE) & WS_EX_TRANSPARENT)
+ {
+ SetWindowPos(GDK_WINDOW_HWND (window), HWND_BOTTOM, 0, 0, 0, 0,
+ SWP_HIDEWINDOW | SWP_NOREDRAW | SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE);
+ }
+ else
+ {
+ ShowWindow (GDK_WINDOW_HWND (window), SW_HIDE);
+ }
}
}
if (!private->destroyed)
{
GDK_NOTE (MISC, g_print ("gdk_window_withdraw: %#x\n",
- GDK_WINDOW_HWND (window)));
+ (guint) GDK_WINDOW_HWND (window)));
gdk_window_hide (window); /* ??? */
}
if (!private->destroyed)
{
GDK_NOTE (MISC, g_print ("gdk_window_resize: %#x %dx%d\n",
- GDK_WINDOW_HWND (window), width, height));
+ (guint) GDK_WINDOW_HWND (window),
+ width, height));
if (GDK_WINDOW_TYPE (private) != GDK_WINDOW_CHILD)
{
private->resize_count += 1;
- GDK_NOTE (MISC,
- g_print ("...MoveWindow(%#x,%dx%d@+%d+%d)\n",
- GDK_WINDOW_HWND (window), width, height, x, y));
+ GDK_NOTE (MISC, g_print ("...MoveWindow(%#x,%dx%d@+%d+%d)\n",
+ (guint) GDK_WINDOW_HWND (window),
+ width, height, x, y));
if (!MoveWindow (GDK_WINDOW_HWND (window), x, y, width, height, TRUE))
WIN32_API_FAILED ("MoveWindow");
}
DWORD dwExStyle;
GDK_NOTE (MISC, g_print ("gdk_window_move_resize: %#x %dx%d@+%d+%d\n",
- GDK_WINDOW_HWND (window), width, height, x, y));
+ (guint) GDK_WINDOW_HWND (window),
+ width, height, x, y));
if (GDK_WINDOW_TYPE (private) == GDK_WINDOW_CHILD)
_gdk_window_move_resize_child (window, x, y, width, height);
if (!AdjustWindowRectEx (&rect, dwStyle, FALSE, dwExStyle))
WIN32_API_FAILED ("AdjustWindowRectEx");
- GDK_NOTE (MISC, g_print ("...MoveWindow(%#x,%dx%d@+%d+%d)\n",
- GDK_WINDOW_HWND (window),
+ GDK_NOTE (MISC, g_print ("...MoveWindow(%#x,%ldx%ld@+%ld+%ld)\n",
+ (guint) GDK_WINDOW_HWND (window),
rect.right - rect.left, rect.bottom - rect.top,
rect.left, rect.top));
if (!MoveWindow (GDK_WINDOW_HWND (window),
if (!GDK_WINDOW_DESTROYED (window) && !GDK_WINDOW_DESTROYED (new_parent))
{
GDK_NOTE (MISC, g_print ("gdk_window_reparent: %#x %#x\n",
- GDK_WINDOW_HWND (window),
- GDK_WINDOW_HWND (new_parent)));
+ (guint) GDK_WINDOW_HWND (window),
+ (guint) GDK_WINDOW_HWND (new_parent)));
if (!SetParent (GDK_WINDOW_HWND (window),
GDK_WINDOW_HWND (new_parent)))
WIN32_API_FAILED ("SetParent");
height = impl->height - y;
GDK_NOTE (MISC, g_print ("_gdk_windowing_window_clear_area: "
"%#x %dx%d@+%d+%d\n",
- GDK_WINDOW_HWND (window), width, height, x, y));
+ (guint) GDK_WINDOW_HWND (window),
+ width, height, x, y));
hdc = GetDC (GDK_WINDOW_HWND (window));
IntersectClipRect (hdc, x, y, x + width + 1, y + height + 1);
SendMessage (GDK_WINDOW_HWND (window), WM_ERASEBKGND, (WPARAM) hdc, 0);
GDK_NOTE (MISC, g_print ("_gdk_windowing_window_clear_area_e: "
"%#x %dx%d@+%d+%d\n",
- GDK_WINDOW_HWND (window), width, height, x, y));
+ (guint) GDK_WINDOW_HWND (window),
+ width, height, x, y));
rect.left = x;
rect.right = x + width + 1;
if (!GDK_WINDOW_DESTROYED (window))
{
GDK_NOTE (MISC, g_print ("gdk_window_raise: %#x\n",
- GDK_WINDOW_HWND (window)));
+ (guint) GDK_WINDOW_HWND (window)));
if (!BringWindowToTop (GDK_WINDOW_HWND (window)))
WIN32_API_FAILED ("BringWindowToTop");
if (!GDK_WINDOW_DESTROYED (window))
{
GDK_NOTE (MISC, g_print ("gdk_window_lower: %#x\n",
- GDK_WINDOW_HWND (window)));
+ (guint) GDK_WINDOW_HWND (window)));
if (!SetWindowPos (GDK_WINDOW_HWND (window), HWND_BOTTOM, 0, 0, 0, 0,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE))
impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl);
GDK_NOTE (MISC, g_print ("gdk_window_set_hints: %#x %dx%d..%dx%d @+%d+%d\n",
- GDK_WINDOW_HWND (window),
+ (guint) GDK_WINDOW_HWND (window),
min_width, min_height, max_width, max_height,
x, y));
if (flags)
{
if (flags & GDK_HINT_POS)
- if (!GetWindowPlacement (GDK_WINDOW_HWND (window), &size_hints))
- WIN32_API_FAILED ("GetWindowPlacement");
- else
- {
- GDK_NOTE (MISC, g_print ("...rcNormalPosition:"
- " (%d,%d)--(%d,%d)\n",
- size_hints.rcNormalPosition.left,
- size_hints.rcNormalPosition.top,
- size_hints.rcNormalPosition.right,
- size_hints.rcNormalPosition.bottom));
- /* What are the corresponding window coordinates for client
- * area coordinates x, y
- */
- rect.left = x;
- rect.top = y;
- rect.right = rect.left + 200; /* dummy */
- rect.bottom = rect.top + 200;
- dwStyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE);
- dwExStyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_EXSTYLE);
- AdjustWindowRectEx (&rect, dwStyle, FALSE, dwExStyle);
- size_hints.flags = 0;
- size_hints.showCmd = SW_SHOWNA;
-
- /* Set the normal position hint to that location, with unchanged
- * width and height.
- */
- diff = size_hints.rcNormalPosition.left - rect.left;
- size_hints.rcNormalPosition.left = rect.left;
- size_hints.rcNormalPosition.right -= diff;
- diff = size_hints.rcNormalPosition.top - rect.top;
- size_hints.rcNormalPosition.top = rect.top;
- size_hints.rcNormalPosition.bottom -= diff;
- GDK_NOTE (MISC, g_print ("...setting: (%d,%d)--(%d,%d)\n",
- size_hints.rcNormalPosition.left,
- size_hints.rcNormalPosition.top,
- size_hints.rcNormalPosition.right,
- size_hints.rcNormalPosition.bottom));
- if (!SetWindowPlacement (GDK_WINDOW_HWND (window), &size_hints))
- WIN32_API_FAILED ("SetWindowPlacement");
- impl->hint_x = rect.left;
- impl->hint_y = rect.top;
- }
+ {
+ if (!GetWindowPlacement (GDK_WINDOW_HWND (window), &size_hints))
+ WIN32_API_FAILED ("GetWindowPlacement");
+ else
+ {
+ GDK_NOTE (MISC, g_print ("...rcNormalPosition:"
+ " (%ld,%ld)--(%ld,%ld)\n",
+ size_hints.rcNormalPosition.left,
+ size_hints.rcNormalPosition.top,
+ size_hints.rcNormalPosition.right,
+ size_hints.rcNormalPosition.bottom));
+ /* What are the corresponding window coordinates for client
+ * area coordinates x, y
+ */
+ rect.left = x;
+ rect.top = y;
+ rect.right = rect.left + 200; /* dummy */
+ rect.bottom = rect.top + 200;
+ dwStyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE);
+ dwExStyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_EXSTYLE);
+ AdjustWindowRectEx (&rect, dwStyle, FALSE, dwExStyle);
+ size_hints.flags = 0;
+ size_hints.showCmd = SW_SHOWNA;
+
+ /* Set the normal position hint to that location, with unchanged
+ * width and height.
+ */
+ diff = size_hints.rcNormalPosition.left - rect.left;
+ size_hints.rcNormalPosition.left = rect.left;
+ size_hints.rcNormalPosition.right -= diff;
+ diff = size_hints.rcNormalPosition.top - rect.top;
+ size_hints.rcNormalPosition.top = rect.top;
+ size_hints.rcNormalPosition.bottom -= diff;
+ GDK_NOTE (MISC, g_print ("...setting: (%ld,%ld)--(%ld,%ld)\n",
+ size_hints.rcNormalPosition.left,
+ size_hints.rcNormalPosition.top,
+ size_hints.rcNormalPosition.right,
+ size_hints.rcNormalPosition.bottom));
+ if (!SetWindowPlacement (GDK_WINDOW_HWND (window), &size_hints))
+ WIN32_API_FAILED ("SetWindowPlacement");
+ impl->hint_x = rect.left;
+ impl->hint_y = rect.top;
+ }
+ }
if (flags & GDK_HINT_MIN_SIZE)
{
RECT rect;
DWORD dwStyle;
DWORD dwExStyle;
- int diff;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
rect.bottom = geometry->max_height;
dwStyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE);
dwExStyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_EXSTYLE);
- AdjustWindowRectEx (&rect, dwStyle, FALSE, dwExStyle);
+ /* HB: dont' know why AdjustWindowRectEx is called here, ... */
+ SafeAdjustWindowRectEx (&rect, dwStyle, FALSE, dwExStyle);
impl->hint_max_width = rect.right - rect.left;
impl->hint_max_height = rect.bottom - rect.top;
+ /* ... but negative sizes are always wrong */
+ if (impl->hint_max_width < 0) impl->hint_max_width = G_MAXSHORT;
+ if (impl->hint_max_height < 0) impl->hint_max_height = G_MAXSHORT;
/* Again, check if the window is too large currently. */
GetClientRect (GDK_WINDOW_HWND (window), &rect);
if (geom_mask & GDK_HINT_BASE_SIZE
&& geometry->base_width > 0
&& geometry->base_height > 0)
- if (!GetWindowPlacement (GDK_WINDOW_HWND (window), &size_hints))
- WIN32_API_FAILED ("GetWindowPlacement");
- else
- {
- GDK_NOTE (MISC, g_print ("gdk_window_set_geometry_hints:"
- " rcNormalPosition: (%d,%d)--(%d,%d)\n",
- size_hints.rcNormalPosition.left,
- size_hints.rcNormalPosition.top,
- size_hints.rcNormalPosition.right,
- size_hints.rcNormalPosition.bottom));
- size_hints.rcNormalPosition.right =
- size_hints.rcNormalPosition.left + geometry->base_width;
- size_hints.rcNormalPosition.bottom =
- size_hints.rcNormalPosition.top + geometry->base_height;
- GDK_NOTE (MISC, g_print ("...setting: rcNormal: (%d,%d)--(%d,%d)\n",
- size_hints.rcNormalPosition.left,
- size_hints.rcNormalPosition.top,
- size_hints.rcNormalPosition.right,
- size_hints.rcNormalPosition.bottom));
- if (!SetWindowPlacement (GDK_WINDOW_HWND (window), &size_hints))
- WIN32_API_FAILED ("SetWindowPlacement");
- }
+ {
+ if (!GetWindowPlacement (GDK_WINDOW_HWND (window), &size_hints))
+ WIN32_API_FAILED ("GetWindowPlacement");
+ else
+ {
+ GDK_NOTE (MISC, g_print ("gdk_window_set_geometry_hints:"
+ " rcNormalPosition: (%ld,%ld)--(%ld,%ld)\n",
+ size_hints.rcNormalPosition.left,
+ size_hints.rcNormalPosition.top,
+ size_hints.rcNormalPosition.right,
+ size_hints.rcNormalPosition.bottom));
+ size_hints.rcNormalPosition.right =
+ size_hints.rcNormalPosition.left + geometry->base_width;
+ size_hints.rcNormalPosition.bottom =
+ size_hints.rcNormalPosition.top + geometry->base_height;
+ GDK_NOTE (MISC, g_print ("...setting: rcNormal: (%ld,%ld)--(%ld,%ld)\n",
+ size_hints.rcNormalPosition.left,
+ size_hints.rcNormalPosition.top,
+ size_hints.rcNormalPosition.right,
+ size_hints.rcNormalPosition.bottom));
+ if (!SetWindowPlacement (GDK_WINDOW_HWND (window), &size_hints))
+ WIN32_API_FAILED ("SetWindowPlacement");
+ }
+ }
if (geom_mask & GDK_HINT_RESIZE_INC)
{
gdk_window_set_title (GdkWindow *window,
const gchar *title)
{
- gint titlelen;
- wchar_t *wcstr;
- gint wlen;
- char *mbstr;
+ char *mbtitle;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
g_return_if_fail (title != NULL);
+
+ /* Empty window titles not allowed, so set it to just a period. */
+ if (!title[0])
+ title = ".";
GDK_NOTE (MISC, g_print ("gdk_window_set_title: %#x %s\n",
- GDK_WINDOW_HWND (window), title));
+ (guint) GDK_WINDOW_HWND (window), title));
if (!GDK_WINDOW_DESTROYED (window))
{
/* As the title is in UTF-8 we must translate it
* to the system codepage.
*/
- titlelen = strlen (title);
- wcstr = g_new (wchar_t, titlelen + 1);
- mbstr = g_new (char, 3*titlelen + 1);
- wlen = gdk_nmbstowchar_ts (wcstr, title, titlelen, titlelen);
- wcstr[wlen] = 0;
- WideCharToMultiByte (GetACP (), 0, wcstr, -1,
- mbstr, 3*titlelen, NULL, NULL);
-
- if (!SetWindowText (GDK_WINDOW_HWND (window), mbstr))
+ mbtitle = g_locale_from_utf8 (title, -1, NULL, NULL, NULL);
+ if (!SetWindowText (GDK_WINDOW_HWND (window), mbtitle))
WIN32_API_FAILED ("SetWindowText");
- g_free (mbstr);
- g_free (wcstr);
+ g_free (mbtitle);
}
}
g_return_if_fail (GDK_IS_WINDOW (window));
GDK_NOTE (MISC, g_print ("gdk_window_set_role: %#x %s\n",
- GDK_WINDOW_HWND (window), (role ? role : "NULL")));
+ (guint) GDK_WINDOW_HWND (window),
+ (role ? role : "NULL")));
/* XXX */
}
g_return_if_fail (GDK_IS_WINDOW (window));
GDK_NOTE (MISC, g_print ("gdk_window_set_transient_for: %#x %#x\n",
- GDK_WINDOW_HWND (window),
- GDK_WINDOW_HWND (parent)));
+ (guint) GDK_WINDOW_HWND (window),
+ (guint) GDK_WINDOW_HWND (parent)));
/* XXX */
}
g_return_if_fail (GDK_IS_WINDOW (window));
GDK_NOTE (MISC, g_print ("gdk_window_set_background: %#x %s\n",
- GDK_WINDOW_HWND (window),
+ (guint) GDK_WINDOW_HWND (window),
gdk_win32_color_to_string (color)));
private->bg_color = *color;
hcursor = cursor_private->hcursor;
GDK_NOTE (MISC, g_print ("gdk_window_set_cursor: %#x %#x\n",
- GDK_WINDOW_HWND (window), hcursor));
+ (guint) GDK_WINDOW_HWND (window),
+ (guint) hcursor));
if (impl->hcursor != NULL)
{
- GDK_NOTE (MISC, g_print ("...DestroyCursor (%#x)\n", impl->hcursor));
+ GDK_NOTE (MISC, g_print ("...DestroyCursor (%#x)\n",
+ (guint) impl->hcursor));
DestroyCursor (impl->hcursor);
impl->hcursor = NULL;
*/
impl->hcursor = CopyCursor (hcursor);
GDK_NOTE (MISC, g_print ("...CopyCursor (%#x) = %#x\n",
- hcursor, impl->hcursor));
+ (guint) hcursor, (guint) impl->hcursor));
GetCursorPos (&pt);
if (ChildWindowFromPoint (GDK_WINDOW_HWND (window), pt) == GDK_WINDOW_HWND (window))
*y = ty;
GDK_NOTE (MISC, g_print ("gdk_window_get_origin: %#x: +%d+%d\n",
- GDK_WINDOW_HWND (window), tx, ty));
+ (guint) GDK_WINDOW_HWND (window),
+ tx, ty));
return return_val;
}
if (y)
*y = pt.y;
- GDK_NOTE (MISC, g_print ("gdk_window_get_root_origin: %#x: (%#x) +%d+%d\n",
- GDK_WINDOW_HWND (window),
- GDK_WINDOW_HWND (rover), pt.x, pt.y));
+ GDK_NOTE (MISC, g_print ("gdk_window_get_root_origin: %#x: (%#x) +%ld+%ld\n",
+ (guint) GDK_WINDOW_HWND (window),
+ (guint) GDK_WINDOW_HWND (rover),
+ pt.x, pt.y));
}
GdkWindow*
ScreenToClient (hwndc, &point);
} while (hwndc != hwnd && (hwnd = hwndc, 1)); /* Ouch! */
- return_val = gdk_win32_handle_table_lookup (hwnd);
+ return_val = gdk_win32_handle_table_lookup ((GdkNativeWindow) hwnd);
if (mask)
{
ScreenToClient (hwndc, &point);
} while (hwndc != hwnd && (hwnd = hwndc, 1));
- window = gdk_win32_handle_table_lookup (hwnd);
+ window = gdk_win32_handle_table_lookup ((GdkNativeWindow) hwnd);
if (window && (win_x || win_y))
{
*win_y = point.y - rect.top;
}
- GDK_NOTE (MISC, g_print ("gdk_window_at_pointer: +%d+%d %#x%s\n",
- point.x, point.y, hwnd,
+ GDK_NOTE (MISC, g_print ("gdk_window_at_pointer: +%ld+%ld %#x%s\n",
+ point.x, point.y,
+ (guint) hwnd,
(window == NULL ? " NULL" : "")));
return window;
if (!mask)
{
GDK_NOTE (MISC, g_print ("gdk_window_shape_combine_mask: %#x none\n",
- GDK_WINDOW_HWND (window)));
+ (guint) GDK_WINDOW_HWND (window)));
SetWindowRgn (GDK_WINDOW_HWND (window), NULL, TRUE);
}
else
hrgn = BitmapToRegion (GDK_WINDOW_HWND (mask));
GDK_NOTE (MISC, g_print ("gdk_window_shape_combine_mask: %#x %#x\n",
- GDK_WINDOW_HWND (window),
- GDK_WINDOW_HWND (mask)));
+ (guint) GDK_WINDOW_HWND (window),
+ (guint) GDK_WINDOW_HWND (mask)));
/* SetWindowRgn wants window (not client) coordinates */
dwStyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE);
{
RECT emptyRect;
HRGN region, childRegion;
- RECT rect;
HWND *list = NULL;
gint i, num;