1999-11-11 22:12:27 +00:00
|
|
|
/* GDK - The GIMP Drawing Kit
|
|
|
|
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
|
|
|
* Copyright (C) 1998-1999 Tor Lillqvist
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
2000-07-26 11:33:08 +00:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
1999-11-11 22:12:27 +00:00
|
|
|
* 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
|
2000-07-26 11:33:08 +00:00
|
|
|
* Lesser General Public License for more details.
|
1999-11-11 22:12:27 +00:00
|
|
|
*
|
2000-07-26 11:33:08 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
1999-11-11 22:12:27 +00:00
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2000-07-26 11:33:08 +00:00
|
|
|
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
1999-11-11 22:12:27 +00:00
|
|
|
* 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 <stdlib.h>
|
|
|
|
|
|
|
|
#include "gdkevents.h"
|
|
|
|
#include "gdkpixmap.h"
|
|
|
|
#include "gdkwindow.h"
|
Large changes to the Win32 backend, partially made necessary by the
2000-05-02 Tor Lillqvist <tml@iki.fi>
Large changes to the Win32 backend, partially made necessary by
the changes to the backend-independent internal
structures. Attempts to implement similar backing store stuff as
on X11. The current (CVS) version of the Win32 backend is *not* as
stable as it was before the no-flicker branch was merged. A
zipfile with that version is available from
http://www.gimp.org/win32/. That should be use by "production"
code until this CVS version is usable. (But note, the Win32
backend has never been claimed to be "production quality".)
* README.win32: Add the above comment about versions.
* gdk/gdkwindow.c: Don't use backing store for now on Win32.
* gdk/gdk.def: Update.
* gdk/gdkfont.h: Declare temporary Win32-only functions. Will
presumably be replaced by some more better mechanism as 1.4 gets
closer to release shape.
* gdk/makefile.{cygwin,msc}: Update.
* gdk/win32/*.c: Correct inclusions of the backend-specific and
internal headers. Change code according to changes in these. Use
gdk_drawable_*, not gdk_window_* where necessary.
* gdk/win32/gdkdnd-win32.c: Use MISC selector for GDK_NOTE, not
our old DND.
* gdk/win32/gdkdrawable-win32.c (gdk_win32_draw_text): Don't try
to interpret single characters as UTF-8. Thanks to Hans Breuer.
Use correct function name in warning messages.
* gdk/win32/gdkevents-win32.c: Use correct parameter lists for the
GSourceFuncs gdk_event_prepare and gdk_event_check.
(gdk_event_get_graphics_expose): Do implement, use
PeekMessage. Thanks to Hans Breuer.
(event_mask_string): Debugging function to print an GdkEventMask.
(gdk_pointer_grab): Use it.
* gdk/win32/gdkfont-win32.c: The Unicode subrange that the
(old) book I used claimed was Hangul actually is CJK Unified
Ideographs Extension A. Also, Hangul Syllables were missing.
Improve logging.
* gdk/win32/gdkgc-win32.c: Largish changes.
* gdk/win32/gdkim-win32.c (gdk_set_locale): Use
g_win32_getlocale() from GLib, and not setlocale() to get current
locale name.
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkwin32.h: Move stuff from gdkprivate-win32.h to
gdkwin32.h, similarily as in the X11 backend.
* gdk/win32/gdkwindow-win32.c (gdk_propagate_shapes): Bugfix,
assignment was used instead of equals in if test. Thanks to Hans
Breuer.
* gdk/win32/makefile.{cygwin,msc}
* gtk/makefile.{cygwin,msc}: Updates. Better kludge to get the
path to the Win32 headers that works also with the mingw compiler.
* gtk/gtkstyle.c: Include <string.h>.
2000-05-01 22:06:49 +00:00
|
|
|
#include "gdkinternals.h"
|
1999-11-20 01:22:57 +00:00
|
|
|
#include "gdkprivate-win32.h"
|
|
|
|
|
|
|
|
static gboolean gdk_window_gravity_works (void);
|
|
|
|
static void gdk_window_set_static_win_gravity (GdkWindow *window,
|
|
|
|
gboolean on);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
static GdkColormap* gdk_window_impl_win32_get_colormap (GdkDrawable *drawable);
|
|
|
|
static void gdk_window_impl_win32_set_colormap (GdkDrawable *drawable,
|
|
|
|
GdkColormap *cmap);
|
|
|
|
static void gdk_window_impl_win32_get_size (GdkDrawable *drawable,
|
|
|
|
gint *width,
|
|
|
|
gint *height);
|
|
|
|
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);
|
|
|
|
|
|
|
|
static gpointer parent_class = NULL;
|
|
|
|
|
|
|
|
GType
|
|
|
|
gdk_window_impl_win32_get_type (void)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
static GType object_type = 0;
|
|
|
|
|
|
|
|
if (!object_type)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
static const GTypeInfo object_info =
|
|
|
|
{
|
|
|
|
sizeof (GdkWindowImplWin32Class),
|
|
|
|
(GBaseInitFunc) NULL,
|
|
|
|
(GBaseFinalizeFunc) NULL,
|
|
|
|
(GClassInitFunc) gdk_window_impl_win32_class_init,
|
|
|
|
NULL, /* class_finalize */
|
|
|
|
NULL, /* class_data */
|
|
|
|
sizeof (GdkWindowImplWin32),
|
|
|
|
0, /* n_preallocs */
|
|
|
|
(GInstanceInitFunc) gdk_window_impl_win32_init,
|
|
|
|
};
|
|
|
|
|
|
|
|
object_type = g_type_register_static (GDK_TYPE_DRAWABLE_IMPL_WIN32,
|
|
|
|
"GdkWindowImplWin32",
|
|
|
|
&object_info);
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
2000-07-25 17:31:05 +00:00
|
|
|
|
|
|
|
return object_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
GType
|
|
|
|
_gdk_window_impl_get_type (void)
|
|
|
|
{
|
|
|
|
return gdk_window_impl_win32_get_type ();
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
static void
|
|
|
|
gdk_window_impl_win32_init (GdkWindowImplWin32 *impl)
|
|
|
|
{
|
|
|
|
impl->width = 1;
|
|
|
|
impl->height = 1;
|
|
|
|
|
|
|
|
impl->event_mask = 0;
|
|
|
|
impl->hcursor = NULL;
|
|
|
|
impl->hint_flags = 0;
|
|
|
|
impl->extension_events_selected = FALSE;
|
|
|
|
impl->input_locale = GetKeyboardLayout (0);
|
|
|
|
TranslateCharsetInfo ((DWORD FAR *) GetACP (), &impl->charset_info,
|
|
|
|
TCI_SRCCODEPAGE);
|
|
|
|
}
|
Large changes to the Win32 backend, partially made necessary by the
2000-05-02 Tor Lillqvist <tml@iki.fi>
Large changes to the Win32 backend, partially made necessary by
the changes to the backend-independent internal
structures. Attempts to implement similar backing store stuff as
on X11. The current (CVS) version of the Win32 backend is *not* as
stable as it was before the no-flicker branch was merged. A
zipfile with that version is available from
http://www.gimp.org/win32/. That should be use by "production"
code until this CVS version is usable. (But note, the Win32
backend has never been claimed to be "production quality".)
* README.win32: Add the above comment about versions.
* gdk/gdkwindow.c: Don't use backing store for now on Win32.
* gdk/gdk.def: Update.
* gdk/gdkfont.h: Declare temporary Win32-only functions. Will
presumably be replaced by some more better mechanism as 1.4 gets
closer to release shape.
* gdk/makefile.{cygwin,msc}: Update.
* gdk/win32/*.c: Correct inclusions of the backend-specific and
internal headers. Change code according to changes in these. Use
gdk_drawable_*, not gdk_window_* where necessary.
* gdk/win32/gdkdnd-win32.c: Use MISC selector for GDK_NOTE, not
our old DND.
* gdk/win32/gdkdrawable-win32.c (gdk_win32_draw_text): Don't try
to interpret single characters as UTF-8. Thanks to Hans Breuer.
Use correct function name in warning messages.
* gdk/win32/gdkevents-win32.c: Use correct parameter lists for the
GSourceFuncs gdk_event_prepare and gdk_event_check.
(gdk_event_get_graphics_expose): Do implement, use
PeekMessage. Thanks to Hans Breuer.
(event_mask_string): Debugging function to print an GdkEventMask.
(gdk_pointer_grab): Use it.
* gdk/win32/gdkfont-win32.c: The Unicode subrange that the
(old) book I used claimed was Hangul actually is CJK Unified
Ideographs Extension A. Also, Hangul Syllables were missing.
Improve logging.
* gdk/win32/gdkgc-win32.c: Largish changes.
* gdk/win32/gdkim-win32.c (gdk_set_locale): Use
g_win32_getlocale() from GLib, and not setlocale() to get current
locale name.
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkwin32.h: Move stuff from gdkprivate-win32.h to
gdkwin32.h, similarily as in the X11 backend.
* gdk/win32/gdkwindow-win32.c (gdk_propagate_shapes): Bugfix,
assignment was used instead of equals in if test. Thanks to Hans
Breuer.
* gdk/win32/makefile.{cygwin,msc}
* gtk/makefile.{cygwin,msc}: Updates. Better kludge to get the
path to the Win32 headers that works also with the mingw compiler.
* gtk/gtkstyle.c: Include <string.h>.
2000-05-01 22:06:49 +00:00
|
|
|
|
1999-11-20 01:22:57 +00:00
|
|
|
static void
|
2000-07-25 17:31:05 +00:00
|
|
|
gdk_window_impl_win32_class_init (GdkWindowImplWin32Class *klass)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass);
|
|
|
|
|
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
|
|
|
|
|
|
|
object_class->finalize = gdk_window_impl_win32_finalize;
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gdk_window_impl_win32_finalize (GObject *object)
|
|
|
|
{
|
|
|
|
GdkWindowObject *wrapper;
|
|
|
|
GdkDrawableImplWin32 *draw_impl;
|
|
|
|
GdkWindowImplWin32 *window_impl;
|
|
|
|
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW_IMPL_WIN32 (object));
|
|
|
|
|
|
|
|
draw_impl = GDK_DRAWABLE_IMPL_WIN32 (object);
|
|
|
|
window_impl = GDK_WINDOW_IMPL_WIN32 (object);
|
|
|
|
|
|
|
|
wrapper = (GdkWindowObject*) draw_impl->wrapper;
|
|
|
|
|
|
|
|
if (!GDK_WINDOW_DESTROYED (wrapper))
|
1999-11-20 01:22:57 +00:00
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
gdk_win32_handle_table_remove (draw_impl->handle);
|
1999-11-20 01:22:57 +00:00
|
|
|
}
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
if (window_impl->hcursor != NULL)
|
|
|
|
{
|
|
|
|
DestroyCursor (window_impl->hcursor);
|
|
|
|
window_impl->hcursor = NULL;
|
|
|
|
}
|
2000-07-04 06:12:54 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
1999-11-20 01:22:57 +00:00
|
|
|
}
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
static GdkColormap*
|
|
|
|
gdk_window_impl_win32_get_colormap (GdkDrawable *drawable)
|
1999-11-20 01:22:57 +00:00
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
GdkDrawableImplWin32 *drawable_impl;
|
|
|
|
GdkWindowImplWin32 *window_impl;
|
1999-11-20 01:22:57 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
g_return_val_if_fail (GDK_IS_WINDOW_IMPL_WIN32 (drawable), NULL);
|
|
|
|
|
|
|
|
drawable_impl = GDK_DRAWABLE_IMPL_WIN32 (drawable);
|
|
|
|
window_impl = GDK_WINDOW_IMPL_WIN32 (drawable);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
if (!((GdkWindowObject *) drawable_impl->wrapper)->input_only &&
|
|
|
|
drawable_impl->colormap == NULL)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2000-07-25 20:38:35 +00:00
|
|
|
drawable_impl->colormap = gdk_colormap_get_system ();
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
2000-07-25 17:31:05 +00:00
|
|
|
|
|
|
|
return drawable_impl->colormap;
|
|
|
|
}
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
static void
|
|
|
|
gdk_window_impl_win32_set_colormap (GdkDrawable *drawable,
|
|
|
|
GdkColormap *cmap)
|
|
|
|
{
|
|
|
|
GdkWindowImplWin32 *impl;
|
|
|
|
GdkDrawableImplWin32 *draw_impl;
|
|
|
|
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW_IMPL_WIN32 (drawable));
|
|
|
|
g_return_if_fail (gdk_colormap_get_visual (cmap) != gdk_drawable_get_visual (drawable));
|
1999-11-20 01:22:57 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (drawable);
|
|
|
|
draw_impl = GDK_DRAWABLE_IMPL_WIN32 (drawable);
|
1999-11-20 01:22:57 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
GDK_DRAWABLE_GET_CLASS (draw_impl)->set_colormap (drawable, cmap);
|
1999-11-20 01:22:57 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
/* XXX */
|
1999-11-20 01:22:57 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gdk_window_impl_win32_get_size (GdkDrawable *drawable,
|
|
|
|
gint *width,
|
|
|
|
gint *height)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW_IMPL_WIN32 (drawable));
|
|
|
|
|
|
|
|
if (width)
|
|
|
|
*width = GDK_WINDOW_IMPL_WIN32 (drawable)->width;
|
|
|
|
if (height)
|
|
|
|
*height = GDK_WINDOW_IMPL_WIN32 (drawable)->height;
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2000-07-25 17:31:05 +00:00
|
|
|
_gdk_windowing_window_init (void)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
GdkWindowObject *private;
|
|
|
|
GdkWindowImplWin32 *impl;
|
|
|
|
GdkDrawableImplWin32 *draw_impl;
|
|
|
|
RECT rect;
|
1999-11-11 22:12:27 +00:00
|
|
|
guint width;
|
|
|
|
guint height;
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
g_assert (gdk_parent_root == NULL);
|
|
|
|
|
|
|
|
SystemParametersInfo(SPI_GETWORKAREA, 0, &rect, 0);
|
|
|
|
width = rect.right - rect.left;
|
|
|
|
height = rect.bottom - rect.top;
|
|
|
|
|
|
|
|
gdk_parent_root = g_object_new (GDK_TYPE_WINDOW, NULL);
|
|
|
|
private = (GdkWindowObject *)gdk_parent_root;
|
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (private->impl);
|
|
|
|
draw_impl = GDK_DRAWABLE_IMPL_WIN32 (private->impl);
|
1999-11-20 01:22:57 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
draw_impl->handle = gdk_root_window;
|
|
|
|
draw_impl->wrapper = GDK_DRAWABLE (private);
|
|
|
|
|
|
|
|
private->window_type = GDK_WINDOW_ROOT;
|
|
|
|
private->depth = gdk_visual_get_system ()->depth;
|
|
|
|
impl->width = width;
|
|
|
|
impl->height = height;
|
1999-11-20 01:22:57 +00:00
|
|
|
|
2000-10-09 19:49:42 +00:00
|
|
|
gdk_win32_handle_table_insert (&gdk_root_window, gdk_parent_root);
|
2000-07-25 17:31:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* The Win API function AdjustWindowRect may return negative values
|
|
|
|
* resulting in obscured title bars. This helper function is coreccting it.
|
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
SafeAdjustWindowRectEx (RECT* lpRect,
|
|
|
|
DWORD dwStyle,
|
|
|
|
BOOL bMenu,
|
|
|
|
DWORD dwExStyle)
|
|
|
|
{
|
|
|
|
if (!AdjustWindowRectEx(lpRect, dwStyle, bMenu, dwExStyle))
|
|
|
|
{
|
|
|
|
WIN32_API_FAILED ("AdjustWindowRectEx");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
if (lpRect->left < 0)
|
|
|
|
{
|
|
|
|
lpRect->right -= lpRect->left;
|
|
|
|
lpRect->left = 0;
|
|
|
|
}
|
|
|
|
if (lpRect->top < 0)
|
|
|
|
{
|
|
|
|
lpRect->bottom -= lpRect->top;
|
|
|
|
lpRect->top = 0;
|
|
|
|
}
|
|
|
|
return TRUE;
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* RegisterGdkClass
|
|
|
|
* is a wrapper function for RegisterWindowClassEx.
|
|
|
|
* It creates at least one unique class for every
|
|
|
|
* GdkWindowType. If support for single window-specific icons
|
|
|
|
* is ever needed (e.g Dialog specific), every such window should
|
|
|
|
* get its own class
|
|
|
|
*/
|
|
|
|
ATOM
|
2000-07-25 17:31:05 +00:00
|
|
|
RegisterGdkClass (GdkWindowType wtype)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
static ATOM klassTOPLEVEL = 0;
|
|
|
|
static ATOM klassDIALOG = 0;
|
|
|
|
static ATOM klassCHILD = 0;
|
|
|
|
static ATOM klassTEMP = 0;
|
|
|
|
static HICON hAppIcon = NULL;
|
|
|
|
static WNDCLASSEX wcl;
|
|
|
|
ATOM klass = 0;
|
|
|
|
|
|
|
|
wcl.cbSize = sizeof(WNDCLASSEX);
|
|
|
|
wcl.style = 0; /* DON'T set CS_<H,V>REDRAW. It causes total redraw
|
|
|
|
* on WM_SIZE and WM_MOVE. Flicker, Performance!
|
|
|
|
*/
|
2000-07-23 21:43:23 +00:00
|
|
|
wcl.lpfnWndProc = gdk_window_procedure;
|
1999-11-11 22:12:27 +00:00
|
|
|
wcl.cbClsExtra = 0;
|
|
|
|
wcl.cbWndExtra = 0;
|
2000-07-23 21:43:23 +00:00
|
|
|
wcl.hInstance = gdk_app_hmodule;
|
1999-11-11 22:12:27 +00:00
|
|
|
wcl.hIcon = 0;
|
|
|
|
/* initialize once! */
|
|
|
|
if (0 == hAppIcon)
|
|
|
|
{
|
|
|
|
gchar sLoc [_MAX_PATH+1];
|
|
|
|
|
2000-07-23 21:43:23 +00:00
|
|
|
if (0 != GetModuleFileName (gdk_app_hmodule, sLoc, _MAX_PATH))
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2000-07-23 21:43:23 +00:00
|
|
|
hAppIcon = ExtractIcon (gdk_app_hmodule, sLoc, 0);
|
1999-11-11 22:12:27 +00:00
|
|
|
if (0 == hAppIcon)
|
|
|
|
{
|
|
|
|
char *gdklibname = g_strdup_printf ("gdk-%s.dll", GDK_VERSION);
|
|
|
|
|
2000-07-23 21:43:23 +00:00
|
|
|
hAppIcon = ExtractIcon (gdk_app_hmodule, gdklibname, 0);
|
1999-11-11 22:12:27 +00:00
|
|
|
g_free (gdklibname);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (0 == hAppIcon)
|
|
|
|
hAppIcon = LoadIcon (NULL, IDI_APPLICATION);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
wcl.lpszMenuName = NULL;
|
|
|
|
wcl.hIconSm = 0;
|
|
|
|
|
|
|
|
/* initialize once per class */
|
|
|
|
#define ONCE_PER_CLASS() \
|
|
|
|
wcl.hIcon = CopyIcon (hAppIcon); \
|
|
|
|
wcl.hIconSm = CopyIcon (hAppIcon); \
|
2000-07-23 21:43:23 +00:00
|
|
|
wcl.hbrBackground = CreateSolidBrush (RGB (0,0,0)); \
|
1999-11-11 22:12:27 +00:00
|
|
|
wcl.hCursor = LoadCursor (NULL, IDC_ARROW);
|
|
|
|
|
|
|
|
switch (wtype)
|
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
case GDK_WINDOW_TOPLEVEL:
|
|
|
|
if (0 == klassTOPLEVEL)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
wcl.lpszClassName = "gdkWindowToplevel";
|
2000-07-25 17:31:05 +00:00
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
ONCE_PER_CLASS();
|
2000-07-23 21:43:23 +00:00
|
|
|
klassTOPLEVEL = RegisterClassEx (&wcl);
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
2000-07-25 17:31:05 +00:00
|
|
|
klass = klassTOPLEVEL;
|
|
|
|
break;
|
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
case GDK_WINDOW_CHILD:
|
|
|
|
if (0 == klassCHILD)
|
2000-07-25 17:31:05 +00:00
|
|
|
{
|
|
|
|
wcl.lpszClassName = "gdkWindowChild";
|
|
|
|
|
|
|
|
wcl.style |= CS_PARENTDC; /* MSDN: ... enhances system performance. */
|
|
|
|
ONCE_PER_CLASS();
|
|
|
|
klassCHILD = RegisterClassEx (&wcl);
|
|
|
|
}
|
1999-11-11 22:12:27 +00:00
|
|
|
klass = klassCHILD;
|
|
|
|
break;
|
2000-07-25 17:31:05 +00:00
|
|
|
|
|
|
|
case GDK_WINDOW_DIALOG:
|
|
|
|
if (0 == klassDIALOG)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
wcl.lpszClassName = "gdkWindowDialog";
|
|
|
|
wcl.style |= CS_SAVEBITS;
|
|
|
|
ONCE_PER_CLASS();
|
2000-07-23 21:43:23 +00:00
|
|
|
klassDIALOG = RegisterClassEx (&wcl);
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
2000-07-25 17:31:05 +00:00
|
|
|
klass = klassDIALOG;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_WINDOW_TEMP:
|
|
|
|
if (0 == klassTEMP)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
wcl.lpszClassName = "gdkWindowTemp";
|
|
|
|
wcl.style |= CS_SAVEBITS;
|
|
|
|
ONCE_PER_CLASS();
|
2000-07-23 21:43:23 +00:00
|
|
|
klassTEMP = RegisterClassEx (&wcl);
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
2000-07-25 17:31:05 +00:00
|
|
|
klass = klassTEMP;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
g_assert_not_reached ();
|
|
|
|
break;
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
2000-02-13 14:52:47 +00:00
|
|
|
if (klass == 0)
|
|
|
|
{
|
|
|
|
WIN32_API_FAILED ("RegisterClassEx");
|
|
|
|
g_error ("That is a fatal error");
|
|
|
|
}
|
1999-11-11 22:12:27 +00:00
|
|
|
return klass;
|
1999-11-20 01:22:57 +00:00
|
|
|
}
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
GdkWindow*
|
|
|
|
gdk_window_new (GdkWindow *parent,
|
|
|
|
GdkWindowAttr *attributes,
|
|
|
|
gint attributes_mask)
|
|
|
|
{
|
|
|
|
GdkWindow *window;
|
2000-07-25 17:31:05 +00:00
|
|
|
GdkWindowObject *private;
|
|
|
|
GdkWindowObject *parent_private;
|
|
|
|
GdkWindowImplWin32 *impl;
|
|
|
|
GdkDrawableImplWin32 *draw_impl;
|
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
GdkVisual *visual;
|
2000-07-25 17:31:05 +00:00
|
|
|
|
|
|
|
HANDLE hparent;
|
1999-11-11 22:12:27 +00:00
|
|
|
ATOM klass = 0;
|
|
|
|
DWORD dwStyle, dwExStyle;
|
|
|
|
RECT rect;
|
2000-07-25 17:31:05 +00:00
|
|
|
Visual *xvisual;
|
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
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);
|
|
|
|
|
|
|
|
if (!parent)
|
1999-11-20 01:22:57 +00:00
|
|
|
parent = gdk_parent_root;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
g_return_val_if_fail (GDK_IS_WINDOW (parent), NULL);
|
|
|
|
|
|
|
|
parent_private = (GdkWindowObject*) parent;
|
|
|
|
if (GDK_WINDOW_DESTROYED (parent))
|
1999-11-11 22:12:27 +00:00
|
|
|
return NULL;
|
2000-07-25 17:31:05 +00:00
|
|
|
|
|
|
|
hparent = GDK_WINDOW_HWND (parent);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
window = g_object_new (GDK_TYPE_WINDOW, NULL);
|
|
|
|
private = (GdkWindowObject *)window;
|
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (private->impl);
|
|
|
|
draw_impl = GDK_DRAWABLE_IMPL_WIN32 (private->impl);
|
|
|
|
draw_impl->wrapper = GDK_DRAWABLE (window);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
private->parent = (GdkWindowObject *)parent;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
if (attributes_mask & GDK_WA_X)
|
|
|
|
x = attributes->x;
|
|
|
|
else
|
|
|
|
x = CW_USEDEFAULT;
|
|
|
|
|
|
|
|
if (attributes_mask & GDK_WA_Y)
|
|
|
|
y = attributes->y;
|
|
|
|
else if (attributes_mask & GDK_WA_X)
|
|
|
|
y = 100; /* ??? We must put it somewhere... */
|
|
|
|
else
|
|
|
|
y = 0; /* x is CW_USEDEFAULT, y doesn't matter then */
|
|
|
|
|
|
|
|
private->x = x;
|
|
|
|
private->y = y;
|
|
|
|
impl->width = (attributes->width > 1) ? (attributes->width) : (1);
|
|
|
|
impl->height = (attributes->height > 1) ? (attributes->height) : (1);
|
|
|
|
impl->extension_events_selected = FALSE;
|
|
|
|
private->window_type = attributes->window_type;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
_gdk_window_init_position (GDK_WINDOW (private));
|
|
|
|
if (impl->position_info.big)
|
|
|
|
private->guffaw_gravity = TRUE;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
if (attributes_mask & GDK_WA_VISUAL)
|
|
|
|
visual = attributes->visual;
|
|
|
|
else
|
|
|
|
visual = gdk_visual_get_system ();
|
|
|
|
xvisual = ((GdkVisualPrivate*) visual)->xvisual;
|
|
|
|
|
|
|
|
if (attributes_mask & GDK_WA_TITLE)
|
|
|
|
title = attributes->title;
|
|
|
|
else
|
|
|
|
title = g_get_prgname ();
|
1999-12-11 23:04:55 +00:00
|
|
|
if (!title)
|
|
|
|
title = "GDK client window";
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
impl->event_mask = GDK_STRUCTURE_MASK | attributes->event_mask;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
if (parent_private && parent_private->guffaw_gravity)
|
|
|
|
{
|
|
|
|
/* XXX ??? */
|
|
|
|
}
|
|
|
|
|
|
|
|
if (attributes->wclass == GDK_INPUT_OUTPUT)
|
|
|
|
{
|
|
|
|
dwExStyle = 0;
|
2000-07-25 17:31:05 +00:00
|
|
|
|
|
|
|
private->input_only = FALSE;
|
|
|
|
private->depth = visual->depth;
|
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
if (attributes_mask & GDK_WA_COLORMAP)
|
2000-07-25 17:31:05 +00:00
|
|
|
{
|
|
|
|
draw_impl->colormap = attributes->colormap;
|
|
|
|
gdk_colormap_ref (attributes->colormap);
|
|
|
|
}
|
1999-11-11 22:12:27 +00:00
|
|
|
else
|
2000-07-25 17:31:05 +00:00
|
|
|
{
|
|
|
|
if ((((GdkVisualPrivate*)gdk_visual_get_system ())->xvisual) == xvisual)
|
|
|
|
{
|
|
|
|
draw_impl->colormap =
|
|
|
|
gdk_colormap_get_system ();
|
|
|
|
gdk_colormap_ref (draw_impl->colormap);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
draw_impl->colormap =
|
|
|
|
gdk_colormap_new (visual, FALSE);
|
|
|
|
}
|
|
|
|
}
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
dwExStyle = WS_EX_TRANSPARENT;
|
2000-07-25 17:31:05 +00:00
|
|
|
private->depth = 0;
|
|
|
|
private->input_only = TRUE;
|
|
|
|
draw_impl->colormap = NULL;
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (parent_private)
|
|
|
|
parent_private->children = g_list_prepend (parent_private->children, window);
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
switch (private->window_type)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
case GDK_WINDOW_TOPLEVEL:
|
|
|
|
dwStyle = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN;
|
2000-07-25 17:31:05 +00:00
|
|
|
hparent = gdk_root_window;
|
1999-11-11 22:12:27 +00:00
|
|
|
break;
|
2000-07-25 17:31:05 +00:00
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
case GDK_WINDOW_CHILD:
|
|
|
|
dwStyle = WS_CHILDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
|
|
|
|
break;
|
2000-07-25 17:31:05 +00:00
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
case GDK_WINDOW_DIALOG:
|
|
|
|
dwStyle = WS_OVERLAPPED | WS_MINIMIZEBOX | WS_SYSMENU | WS_CAPTION | WS_THICKFRAME | WS_CLIPCHILDREN;
|
2000-01-18 22:03:59 +00:00
|
|
|
#if 0
|
1999-11-11 22:12:27 +00:00
|
|
|
dwExStyle |= WS_EX_TOPMOST; /* //HB: want this? */
|
2000-01-18 22:03:59 +00:00
|
|
|
#endif
|
2000-07-25 17:31:05 +00:00
|
|
|
hparent = gdk_root_window;
|
1999-11-11 22:12:27 +00:00
|
|
|
break;
|
2000-07-25 17:31:05 +00:00
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
case GDK_WINDOW_TEMP:
|
|
|
|
dwStyle = WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
|
|
|
|
dwExStyle |= WS_EX_TOOLWINDOW;
|
|
|
|
break;
|
2000-07-25 17:31:05 +00:00
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
case GDK_WINDOW_ROOT:
|
|
|
|
g_error ("cannot make windows of type GDK_WINDOW_ROOT");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
klass = RegisterGdkClass (private->window_type);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
if (private->window_type != GDK_WINDOW_CHILD)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
if (x == CW_USEDEFAULT)
|
|
|
|
{
|
|
|
|
rect.left = 100;
|
|
|
|
rect.top = 100;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
rect.left = x;
|
|
|
|
rect.top = y;
|
|
|
|
}
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
rect.right = rect.left + impl->width;
|
|
|
|
rect.bottom = rect.top + impl->height;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-02-13 14:52:47 +00:00
|
|
|
SafeAdjustWindowRectEx (&rect, dwStyle, FALSE, dwExStyle);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
if (x != CW_USEDEFAULT)
|
|
|
|
{
|
|
|
|
x = rect.left;
|
|
|
|
y = rect.top;
|
|
|
|
}
|
|
|
|
width = rect.right - rect.left;
|
|
|
|
height = rect.bottom - rect.top;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
width = impl->width;
|
|
|
|
height = impl->height;
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
2000-10-09 19:49:42 +00:00
|
|
|
#ifdef WITHOUT_WM_CREATE
|
2000-07-25 17:31:05 +00:00
|
|
|
draw_impl->handle = CreateWindowEx (dwExStyle,
|
|
|
|
MAKEINTRESOURCE(klass),
|
|
|
|
mbtitle,
|
|
|
|
dwStyle,
|
|
|
|
x, y,
|
|
|
|
width, height,
|
|
|
|
hparent,
|
|
|
|
NULL,
|
|
|
|
gdk_app_hmodule,
|
|
|
|
NULL);
|
2000-10-09 19:49:42 +00:00
|
|
|
#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.",
|
|
|
|
GDK_WINDOW_HWND (window), 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
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
GDK_NOTE (MISC,
|
2000-02-13 14:52:47 +00:00
|
|
|
g_print ("gdk_window_new: %s %s %dx%d@+%d+%d %#x = %#x\n"
|
1999-11-11 22:12:27 +00:00
|
|
|
"...locale %#x codepage %d\n",
|
2000-07-25 17:31:05 +00:00
|
|
|
(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" :
|
1999-11-11 22:12:27 +00:00
|
|
|
"???")))),
|
|
|
|
mbtitle,
|
|
|
|
width, height, (x == CW_USEDEFAULT ? -9999 : x), y,
|
2000-07-25 17:31:05 +00:00
|
|
|
hparent,
|
|
|
|
GDK_WINDOW_HWND (window),
|
|
|
|
impl->input_locale,
|
|
|
|
impl->charset_info.ciACP));
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
g_free (mbtitle);
|
|
|
|
g_free (wctitle);
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
if (draw_impl->handle == NULL)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2000-02-13 14:52:47 +00:00
|
|
|
WIN32_API_FAILED ("CreateWindowEx");
|
2000-07-25 17:31:05 +00:00
|
|
|
g_object_unref ((GObject *) window);
|
1999-11-11 22:12:27 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2000-10-09 19:49:42 +00:00
|
|
|
#ifdef WITHOUT_WM_CREATE
|
1999-11-20 01:22:57 +00:00
|
|
|
gdk_drawable_ref (window);
|
2000-10-09 19:49:42 +00:00
|
|
|
gdk_win32_handle_table_insert (&GDK_WINDOW_HWND (window), window);
|
|
|
|
#endif
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
gdk_window_set_cursor (window, ((attributes_mask & GDK_WA_CURSOR) ?
|
|
|
|
(attributes->cursor) :
|
|
|
|
NULL));
|
|
|
|
|
|
|
|
return window;
|
|
|
|
}
|
|
|
|
|
|
|
|
GdkWindow *
|
2000-07-25 17:31:05 +00:00
|
|
|
gdk_window_foreign_new (GdkNativeWindow anid)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
GdkWindow *window;
|
2000-07-25 17:31:05 +00:00
|
|
|
GdkWindowObject *private;
|
|
|
|
GdkWindowObject *parent_private;
|
|
|
|
GdkWindowImplWin32 *impl;
|
|
|
|
GdkDrawableImplWin32 *draw_impl;
|
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
HANDLE parent;
|
|
|
|
RECT rect;
|
|
|
|
POINT point;
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
window = g_object_new (GDK_TYPE_WINDOW, NULL);
|
|
|
|
private = (GdkWindowObject *)window;
|
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (private->impl);
|
|
|
|
draw_impl = GDK_DRAWABLE_IMPL_WIN32 (private->impl);
|
|
|
|
draw_impl->wrapper = GDK_DRAWABLE (window);
|
|
|
|
|
2000-07-25 20:38:35 +00:00
|
|
|
private->parent = gdk_win32_handle_table_lookup ((GdkNativeWindow) parent);
|
2000-07-25 17:31:05 +00:00
|
|
|
|
|
|
|
parent_private = (GdkWindowObject *)private->parent;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
if (parent_private)
|
|
|
|
parent_private->children = g_list_prepend (parent_private->children, window);
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
draw_impl->handle = (HWND) anid;
|
1999-11-11 22:12:27 +00:00
|
|
|
GetClientRect ((HWND) anid, &rect);
|
|
|
|
point.x = rect.left;
|
|
|
|
point.y = rect.right;
|
|
|
|
ClientToScreen ((HWND) anid, &point);
|
2000-07-25 17:31:05 +00:00
|
|
|
if (parent != gdk_root_window)
|
1999-11-11 22:12:27 +00:00
|
|
|
ScreenToClient (parent, &point);
|
|
|
|
private->x = point.x;
|
|
|
|
private->y = point.y;
|
2000-07-25 17:31:05 +00:00
|
|
|
impl->width = rect.right - rect.left;
|
|
|
|
impl->height = rect.bottom - rect.top;
|
|
|
|
private->window_type = GDK_WINDOW_FOREIGN;
|
|
|
|
private->destroyed = FALSE;
|
|
|
|
private->mapped = IsWindowVisible ((HWND) anid);
|
|
|
|
private->depth = gdk_visual_get_system ()->depth;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
1999-11-20 01:22:57 +00:00
|
|
|
gdk_drawable_ref (window);
|
2000-10-09 19:49:42 +00:00
|
|
|
gdk_win32_handle_table_insert (&GDK_WINDOW_HWND (window), window);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
return window;
|
|
|
|
}
|
|
|
|
|
2000-05-16 21:27:10 +00:00
|
|
|
void
|
|
|
|
_gdk_windowing_window_destroy (GdkWindow *window,
|
|
|
|
gboolean recursing,
|
|
|
|
gboolean foreign_destroy)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
GdkWindowObject *private = (GdkWindowObject *)window;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
2000-05-16 21:27:10 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("_gdk_windowing_window_destroy %#x\n",
|
2000-07-25 17:31:05 +00:00
|
|
|
GDK_WINDOW_HWND (window)));
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-05-16 21:27:10 +00:00
|
|
|
if (private->extension_events != 0)
|
|
|
|
gdk_input_window_destroy (window);
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
if (private->window_type == GDK_WINDOW_FOREIGN)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2000-05-16 21:27:10 +00:00
|
|
|
if (!foreign_destroy && (private->parent != NULL))
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
/* It's somebody else's window, but in our hierarchy,
|
2000-05-16 21:27:10 +00:00
|
|
|
* so reparent it to the root window, and then call
|
|
|
|
* DestroyWindow() on it.
|
|
|
|
*/
|
|
|
|
gdk_window_hide (window);
|
|
|
|
gdk_window_reparent (window, NULL, 0, 0);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-05-16 21:27:10 +00:00
|
|
|
/* Is this too drastic? Many (most?) applications
|
|
|
|
* quit if any window receives WM_QUIT I think.
|
|
|
|
* OTOH, I don't think foreign windows are much
|
|
|
|
* used, so the question is maybe academic.
|
|
|
|
*/
|
2000-07-25 17:31:05 +00:00
|
|
|
PostMessage (GDK_WINDOW_HWND (window), WM_QUIT, 0, 0);
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
}
|
2000-05-16 21:27:10 +00:00
|
|
|
else if (!recursing && !foreign_destroy)
|
2000-07-25 17:31:05 +00:00
|
|
|
DestroyWindow (GDK_WINDOW_HWND (window));
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
2000-05-16 21:27:10 +00:00
|
|
|
/* This function is called when the window really gone.
|
|
|
|
*/
|
1999-11-11 22:12:27 +00:00
|
|
|
void
|
|
|
|
gdk_window_destroy_notify (GdkWindow *window)
|
|
|
|
{
|
|
|
|
g_return_if_fail (window != NULL);
|
|
|
|
|
1999-11-20 01:22:57 +00:00
|
|
|
GDK_NOTE (EVENTS,
|
|
|
|
g_print ("gdk_window_destroy_notify: %#x %s\n",
|
2000-07-25 17:31:05 +00:00
|
|
|
GDK_WINDOW_HWND (window),
|
|
|
|
(GDK_WINDOW_DESTROYED (window) ? "(destroyed)" : "")));
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
if (!GDK_WINDOW_DESTROYED (window))
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
if (GDK_WINDOW_TYPE(window) != GDK_WINDOW_FOREIGN)
|
1999-11-20 01:22:57 +00:00
|
|
|
g_warning ("window %#x unexpectedly destroyed",
|
2000-07-25 17:31:05 +00:00
|
|
|
GDK_WINDOW_HWND (window));
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-05-16 21:27:10 +00:00
|
|
|
_gdk_window_destroy (window, TRUE);
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
gdk_win32_handle_table_remove (GDK_WINDOW_HWND (window));
|
1999-11-20 01:22:57 +00:00
|
|
|
gdk_drawable_unref (window);
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_show (GdkWindow *window)
|
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
GdkWindowObject *private;
|
|
|
|
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
|
|
|
private = (GdkWindowObject*) window;
|
|
|
|
if (!private->destroyed)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_show: %#x\n",
|
2000-07-25 17:31:05 +00:00
|
|
|
GDK_WINDOW_HWND (window)));
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
private->mapped = TRUE;
|
|
|
|
if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_TEMP)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWNOACTIVATE);
|
|
|
|
SetWindowPos (GDK_WINDOW_HWND (window), HWND_TOPMOST, 0, 0, 0, 0,
|
1999-11-11 22:12:27 +00:00
|
|
|
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
|
|
|
|
#if 0
|
1999-11-20 01:22:57 +00:00
|
|
|
/* Don't put on toolbar */
|
2000-07-25 17:31:05 +00:00
|
|
|
ShowWindow (GDK_WINDOW_HWND (window), SW_HIDE);
|
1999-11-11 22:12:27 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWNORMAL);
|
|
|
|
ShowWindow (GDK_WINDOW_HWND (window), SW_RESTORE);
|
|
|
|
SetForegroundWindow (GDK_WINDOW_HWND (window));
|
|
|
|
BringWindowToTop (GDK_WINDOW_HWND (window));
|
1999-11-11 22:12:27 +00:00
|
|
|
#if 0
|
2000-07-25 17:31:05 +00:00
|
|
|
ShowOwnedPopups (GDK_WINDOW_HWND (window), TRUE);
|
1999-11-11 22:12:27 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_hide (GdkWindow *window)
|
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
GdkWindowObject *private;
|
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
g_return_if_fail (window != NULL);
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
private = (GdkWindowObject*) window;
|
|
|
|
if (!private->destroyed)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_hide: %#x\n",
|
2000-07-25 17:31:05 +00:00
|
|
|
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);
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_withdraw (GdkWindow *window)
|
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
GdkWindowObject *private;
|
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
g_return_if_fail (window != NULL);
|
2000-07-25 17:31:05 +00:00
|
|
|
|
|
|
|
private = (GdkWindowObject*) window;
|
|
|
|
if (!private->destroyed)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_withdraw: %#x\n",
|
2000-07-25 17:31:05 +00:00
|
|
|
GDK_WINDOW_HWND (window)));
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
gdk_window_hide (window); /* ??? */
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_move (GdkWindow *window,
|
|
|
|
gint x,
|
|
|
|
gint y)
|
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
GdkWindowObject *private = (GdkWindowObject *)window;
|
|
|
|
GdkWindowImplWin32 *impl;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
g_return_if_fail (window != NULL);
|
2000-07-25 17:31:05 +00:00
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (private->impl);
|
|
|
|
|
|
|
|
gdk_window_move_resize (window, x, y, impl->width, impl->height);
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_resize (GdkWindow *window,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
GdkWindowObject *private = (GdkWindowObject*) window;
|
|
|
|
GdkWindowImplWin32 *impl;
|
|
|
|
int x, y;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
g_return_if_fail (window != NULL);
|
2000-07-25 17:31:05 +00:00
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
if (width < 1)
|
1999-11-11 22:12:27 +00:00
|
|
|
width = 1;
|
2000-07-25 17:31:05 +00:00
|
|
|
if (height < 1)
|
1999-11-11 22:12:27 +00:00
|
|
|
height = 1;
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (private->impl);
|
|
|
|
|
|
|
|
if (!private->destroyed)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_resize: %#x %dx%d\n",
|
2000-07-25 17:31:05 +00:00
|
|
|
GDK_WINDOW_HWND (window), width, height));
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
if (GDK_WINDOW_TYPE (private) != GDK_WINDOW_CHILD)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
POINT pt;
|
|
|
|
RECT rect;
|
|
|
|
DWORD dwStyle;
|
|
|
|
DWORD dwExStyle;
|
|
|
|
|
|
|
|
pt.x = 0;
|
|
|
|
pt.y = 0;
|
2000-07-25 17:31:05 +00:00
|
|
|
ClientToScreen (GDK_WINDOW_HWND (window), &pt);
|
1999-11-11 22:12:27 +00:00
|
|
|
rect.left = pt.x;
|
|
|
|
rect.top = pt.y;
|
|
|
|
rect.right = pt.x + width;
|
|
|
|
rect.bottom = pt.y + height;
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
dwStyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE);
|
|
|
|
dwExStyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_EXSTYLE);
|
1999-11-11 22:12:27 +00:00
|
|
|
if (!AdjustWindowRectEx (&rect, dwStyle, FALSE, dwExStyle))
|
2000-02-13 14:52:47 +00:00
|
|
|
WIN32_API_FAILED ("AdjustWindowRectEx");
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
x = rect.left;
|
|
|
|
y = rect.top;
|
|
|
|
width = rect.right - rect.left;
|
|
|
|
height = rect.bottom - rect.top;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
x = private->x;
|
|
|
|
y = private->y;
|
2000-07-25 17:31:05 +00:00
|
|
|
impl->width = width;
|
|
|
|
impl->height = height;
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private->resize_count += 1;
|
|
|
|
|
1999-11-20 01:22:57 +00:00
|
|
|
GDK_NOTE (MISC,
|
|
|
|
g_print ("...MoveWindow(%#x,%dx%d@+%d+%d)\n",
|
2000-07-25 17:31:05 +00:00
|
|
|
GDK_WINDOW_HWND (window), width, height, x, y));
|
|
|
|
if (!MoveWindow (GDK_WINDOW_HWND (window), x, y, width, height, TRUE))
|
2000-02-13 14:52:47 +00:00
|
|
|
WIN32_API_FAILED ("MoveWindow");
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_move_resize (GdkWindow *window,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
GdkWindowObject *private = (GdkWindowObject*) window;
|
|
|
|
GdkWindowImplWin32 *impl;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
g_return_if_fail (window != NULL);
|
2000-07-25 17:31:05 +00:00
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
if (width < 1)
|
1999-11-11 22:12:27 +00:00
|
|
|
width = 1;
|
2000-07-25 17:31:05 +00:00
|
|
|
if (height < 1)
|
1999-11-11 22:12:27 +00:00
|
|
|
height = 1;
|
2000-07-25 17:31:05 +00:00
|
|
|
|
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (private->impl);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
if (!private->destroyed)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
RECT rect;
|
|
|
|
DWORD dwStyle;
|
|
|
|
DWORD dwExStyle;
|
|
|
|
|
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_move_resize: %#x %dx%d@+%d+%d\n",
|
2000-07-25 17:31:05 +00:00
|
|
|
GDK_WINDOW_HWND (window), width, height, x, y));
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
if (GDK_WINDOW_TYPE (private) == GDK_WINDOW_CHILD)
|
|
|
|
_gdk_window_move_resize_child (window, x, y, width, height);
|
|
|
|
else
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
rect.left = x;
|
|
|
|
rect.top = y;
|
|
|
|
rect.right = x + width;
|
|
|
|
rect.bottom = y + height;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
dwStyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE);
|
|
|
|
dwExStyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_EXSTYLE);
|
|
|
|
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),
|
|
|
|
rect.right - rect.left, rect.bottom - rect.top,
|
|
|
|
rect.left, rect.top));
|
|
|
|
if (!MoveWindow (GDK_WINDOW_HWND (window),
|
|
|
|
rect.left, rect.top,
|
|
|
|
rect.right - rect.left, rect.bottom - rect.top,
|
|
|
|
TRUE))
|
|
|
|
WIN32_API_FAILED ("MoveWindow");
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_reparent (GdkWindow *window,
|
|
|
|
GdkWindow *new_parent,
|
|
|
|
gint x,
|
|
|
|
gint y)
|
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
GdkWindowObject *window_private;
|
|
|
|
GdkWindowObject *parent_private;
|
|
|
|
GdkWindowObject *old_parent_private;
|
|
|
|
GdkWindowImplWin32 *impl;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
g_return_if_fail (window != NULL);
|
|
|
|
|
|
|
|
if (!new_parent)
|
1999-11-20 01:22:57 +00:00
|
|
|
new_parent = gdk_parent_root;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
window_private = (GdkWindowObject*) window;
|
|
|
|
old_parent_private = (GdkWindowObject *) window_private->parent;
|
|
|
|
parent_private = (GdkWindowObject*) new_parent;
|
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (window_private->impl);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
if (!GDK_WINDOW_DESTROYED (window) && !GDK_WINDOW_DESTROYED (new_parent))
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_reparent: %#x %#x\n",
|
2000-07-25 17:31:05 +00:00
|
|
|
GDK_WINDOW_HWND (window),
|
|
|
|
GDK_WINDOW_HWND (new_parent)));
|
|
|
|
if (!SetParent (GDK_WINDOW_HWND (window),
|
|
|
|
GDK_WINDOW_HWND (new_parent)))
|
2000-02-13 14:52:47 +00:00
|
|
|
WIN32_API_FAILED ("SetParent");
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
if (!MoveWindow (GDK_WINDOW_HWND (window),
|
|
|
|
x, y, impl->width, impl->height, TRUE))
|
2000-02-13 14:52:47 +00:00
|
|
|
WIN32_API_FAILED ("MoveWindow");
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
window_private->parent = (GdkWindowObject *)new_parent;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
if (old_parent_private)
|
1999-11-20 01:22:57 +00:00
|
|
|
old_parent_private->children =
|
|
|
|
g_list_remove (old_parent_private->children, window);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
if ((old_parent_private &&
|
|
|
|
(!old_parent_private->guffaw_gravity != !parent_private->guffaw_gravity)) ||
|
|
|
|
(!old_parent_private && parent_private->guffaw_gravity))
|
|
|
|
gdk_window_set_static_win_gravity (window, parent_private->guffaw_gravity);
|
|
|
|
|
|
|
|
parent_private->children = g_list_prepend (parent_private->children, window);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
Large changes to the Win32 backend, partially made necessary by the
2000-05-02 Tor Lillqvist <tml@iki.fi>
Large changes to the Win32 backend, partially made necessary by
the changes to the backend-independent internal
structures. Attempts to implement similar backing store stuff as
on X11. The current (CVS) version of the Win32 backend is *not* as
stable as it was before the no-flicker branch was merged. A
zipfile with that version is available from
http://www.gimp.org/win32/. That should be use by "production"
code until this CVS version is usable. (But note, the Win32
backend has never been claimed to be "production quality".)
* README.win32: Add the above comment about versions.
* gdk/gdkwindow.c: Don't use backing store for now on Win32.
* gdk/gdk.def: Update.
* gdk/gdkfont.h: Declare temporary Win32-only functions. Will
presumably be replaced by some more better mechanism as 1.4 gets
closer to release shape.
* gdk/makefile.{cygwin,msc}: Update.
* gdk/win32/*.c: Correct inclusions of the backend-specific and
internal headers. Change code according to changes in these. Use
gdk_drawable_*, not gdk_window_* where necessary.
* gdk/win32/gdkdnd-win32.c: Use MISC selector for GDK_NOTE, not
our old DND.
* gdk/win32/gdkdrawable-win32.c (gdk_win32_draw_text): Don't try
to interpret single characters as UTF-8. Thanks to Hans Breuer.
Use correct function name in warning messages.
* gdk/win32/gdkevents-win32.c: Use correct parameter lists for the
GSourceFuncs gdk_event_prepare and gdk_event_check.
(gdk_event_get_graphics_expose): Do implement, use
PeekMessage. Thanks to Hans Breuer.
(event_mask_string): Debugging function to print an GdkEventMask.
(gdk_pointer_grab): Use it.
* gdk/win32/gdkfont-win32.c: The Unicode subrange that the
(old) book I used claimed was Hangul actually is CJK Unified
Ideographs Extension A. Also, Hangul Syllables were missing.
Improve logging.
* gdk/win32/gdkgc-win32.c: Largish changes.
* gdk/win32/gdkim-win32.c (gdk_set_locale): Use
g_win32_getlocale() from GLib, and not setlocale() to get current
locale name.
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkwin32.h: Move stuff from gdkprivate-win32.h to
gdkwin32.h, similarily as in the X11 backend.
* gdk/win32/gdkwindow-win32.c (gdk_propagate_shapes): Bugfix,
assignment was used instead of equals in if test. Thanks to Hans
Breuer.
* gdk/win32/makefile.{cygwin,msc}
* gtk/makefile.{cygwin,msc}: Updates. Better kludge to get the
path to the Win32 headers that works also with the mingw compiler.
* gtk/gtkstyle.c: Include <string.h>.
2000-05-01 22:06:49 +00:00
|
|
|
_gdk_windowing_window_clear_area (GdkWindow *window,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
GdkWindowImplWin32 *impl;
|
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
g_return_if_fail (window != NULL);
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl);
|
|
|
|
|
|
|
|
if (!GDK_WINDOW_DESTROYED (window))
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
HDC hdc;
|
|
|
|
|
2000-01-18 22:03:59 +00:00
|
|
|
if (width == 0)
|
2000-07-25 17:31:05 +00:00
|
|
|
width = impl->width - x;
|
2000-01-18 22:03:59 +00:00
|
|
|
if (height == 0)
|
2000-07-25 17:31:05 +00:00
|
|
|
height = impl->height - y;
|
Large changes to the Win32 backend, partially made necessary by the
2000-05-02 Tor Lillqvist <tml@iki.fi>
Large changes to the Win32 backend, partially made necessary by
the changes to the backend-independent internal
structures. Attempts to implement similar backing store stuff as
on X11. The current (CVS) version of the Win32 backend is *not* as
stable as it was before the no-flicker branch was merged. A
zipfile with that version is available from
http://www.gimp.org/win32/. That should be use by "production"
code until this CVS version is usable. (But note, the Win32
backend has never been claimed to be "production quality".)
* README.win32: Add the above comment about versions.
* gdk/gdkwindow.c: Don't use backing store for now on Win32.
* gdk/gdk.def: Update.
* gdk/gdkfont.h: Declare temporary Win32-only functions. Will
presumably be replaced by some more better mechanism as 1.4 gets
closer to release shape.
* gdk/makefile.{cygwin,msc}: Update.
* gdk/win32/*.c: Correct inclusions of the backend-specific and
internal headers. Change code according to changes in these. Use
gdk_drawable_*, not gdk_window_* where necessary.
* gdk/win32/gdkdnd-win32.c: Use MISC selector for GDK_NOTE, not
our old DND.
* gdk/win32/gdkdrawable-win32.c (gdk_win32_draw_text): Don't try
to interpret single characters as UTF-8. Thanks to Hans Breuer.
Use correct function name in warning messages.
* gdk/win32/gdkevents-win32.c: Use correct parameter lists for the
GSourceFuncs gdk_event_prepare and gdk_event_check.
(gdk_event_get_graphics_expose): Do implement, use
PeekMessage. Thanks to Hans Breuer.
(event_mask_string): Debugging function to print an GdkEventMask.
(gdk_pointer_grab): Use it.
* gdk/win32/gdkfont-win32.c: The Unicode subrange that the
(old) book I used claimed was Hangul actually is CJK Unified
Ideographs Extension A. Also, Hangul Syllables were missing.
Improve logging.
* gdk/win32/gdkgc-win32.c: Largish changes.
* gdk/win32/gdkim-win32.c (gdk_set_locale): Use
g_win32_getlocale() from GLib, and not setlocale() to get current
locale name.
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkwin32.h: Move stuff from gdkprivate-win32.h to
gdkwin32.h, similarily as in the X11 backend.
* gdk/win32/gdkwindow-win32.c (gdk_propagate_shapes): Bugfix,
assignment was used instead of equals in if test. Thanks to Hans
Breuer.
* gdk/win32/makefile.{cygwin,msc}
* gtk/makefile.{cygwin,msc}: Updates. Better kludge to get the
path to the Win32 headers that works also with the mingw compiler.
* gtk/gtkstyle.c: Include <string.h>.
2000-05-01 22:06:49 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("_gdk_windowing_window_clear_area: "
|
|
|
|
"%#x %dx%d@+%d+%d\n",
|
2000-07-25 17:31:05 +00:00
|
|
|
GDK_WINDOW_HWND (window), width, height, x, y));
|
|
|
|
hdc = GetDC (GDK_WINDOW_HWND (window));
|
Large changes to the Win32 backend, partially made necessary by the
2000-05-02 Tor Lillqvist <tml@iki.fi>
Large changes to the Win32 backend, partially made necessary by
the changes to the backend-independent internal
structures. Attempts to implement similar backing store stuff as
on X11. The current (CVS) version of the Win32 backend is *not* as
stable as it was before the no-flicker branch was merged. A
zipfile with that version is available from
http://www.gimp.org/win32/. That should be use by "production"
code until this CVS version is usable. (But note, the Win32
backend has never been claimed to be "production quality".)
* README.win32: Add the above comment about versions.
* gdk/gdkwindow.c: Don't use backing store for now on Win32.
* gdk/gdk.def: Update.
* gdk/gdkfont.h: Declare temporary Win32-only functions. Will
presumably be replaced by some more better mechanism as 1.4 gets
closer to release shape.
* gdk/makefile.{cygwin,msc}: Update.
* gdk/win32/*.c: Correct inclusions of the backend-specific and
internal headers. Change code according to changes in these. Use
gdk_drawable_*, not gdk_window_* where necessary.
* gdk/win32/gdkdnd-win32.c: Use MISC selector for GDK_NOTE, not
our old DND.
* gdk/win32/gdkdrawable-win32.c (gdk_win32_draw_text): Don't try
to interpret single characters as UTF-8. Thanks to Hans Breuer.
Use correct function name in warning messages.
* gdk/win32/gdkevents-win32.c: Use correct parameter lists for the
GSourceFuncs gdk_event_prepare and gdk_event_check.
(gdk_event_get_graphics_expose): Do implement, use
PeekMessage. Thanks to Hans Breuer.
(event_mask_string): Debugging function to print an GdkEventMask.
(gdk_pointer_grab): Use it.
* gdk/win32/gdkfont-win32.c: The Unicode subrange that the
(old) book I used claimed was Hangul actually is CJK Unified
Ideographs Extension A. Also, Hangul Syllables were missing.
Improve logging.
* gdk/win32/gdkgc-win32.c: Largish changes.
* gdk/win32/gdkim-win32.c (gdk_set_locale): Use
g_win32_getlocale() from GLib, and not setlocale() to get current
locale name.
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkwin32.h: Move stuff from gdkprivate-win32.h to
gdkwin32.h, similarily as in the X11 backend.
* gdk/win32/gdkwindow-win32.c (gdk_propagate_shapes): Bugfix,
assignment was used instead of equals in if test. Thanks to Hans
Breuer.
* gdk/win32/makefile.{cygwin,msc}
* gtk/makefile.{cygwin,msc}: Updates. Better kludge to get the
path to the Win32 headers that works also with the mingw compiler.
* gtk/gtkstyle.c: Include <string.h>.
2000-05-01 22:06:49 +00:00
|
|
|
IntersectClipRect (hdc, x, y, x + width + 1, y + height + 1);
|
2000-07-25 17:31:05 +00:00
|
|
|
SendMessage (GDK_WINDOW_HWND (window), WM_ERASEBKGND, (WPARAM) hdc, 0);
|
|
|
|
ReleaseDC (GDK_WINDOW_HWND (window), hdc);
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
Large changes to the Win32 backend, partially made necessary by the
2000-05-02 Tor Lillqvist <tml@iki.fi>
Large changes to the Win32 backend, partially made necessary by
the changes to the backend-independent internal
structures. Attempts to implement similar backing store stuff as
on X11. The current (CVS) version of the Win32 backend is *not* as
stable as it was before the no-flicker branch was merged. A
zipfile with that version is available from
http://www.gimp.org/win32/. That should be use by "production"
code until this CVS version is usable. (But note, the Win32
backend has never been claimed to be "production quality".)
* README.win32: Add the above comment about versions.
* gdk/gdkwindow.c: Don't use backing store for now on Win32.
* gdk/gdk.def: Update.
* gdk/gdkfont.h: Declare temporary Win32-only functions. Will
presumably be replaced by some more better mechanism as 1.4 gets
closer to release shape.
* gdk/makefile.{cygwin,msc}: Update.
* gdk/win32/*.c: Correct inclusions of the backend-specific and
internal headers. Change code according to changes in these. Use
gdk_drawable_*, not gdk_window_* where necessary.
* gdk/win32/gdkdnd-win32.c: Use MISC selector for GDK_NOTE, not
our old DND.
* gdk/win32/gdkdrawable-win32.c (gdk_win32_draw_text): Don't try
to interpret single characters as UTF-8. Thanks to Hans Breuer.
Use correct function name in warning messages.
* gdk/win32/gdkevents-win32.c: Use correct parameter lists for the
GSourceFuncs gdk_event_prepare and gdk_event_check.
(gdk_event_get_graphics_expose): Do implement, use
PeekMessage. Thanks to Hans Breuer.
(event_mask_string): Debugging function to print an GdkEventMask.
(gdk_pointer_grab): Use it.
* gdk/win32/gdkfont-win32.c: The Unicode subrange that the
(old) book I used claimed was Hangul actually is CJK Unified
Ideographs Extension A. Also, Hangul Syllables were missing.
Improve logging.
* gdk/win32/gdkgc-win32.c: Largish changes.
* gdk/win32/gdkim-win32.c (gdk_set_locale): Use
g_win32_getlocale() from GLib, and not setlocale() to get current
locale name.
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkwin32.h: Move stuff from gdkprivate-win32.h to
gdkwin32.h, similarily as in the X11 backend.
* gdk/win32/gdkwindow-win32.c (gdk_propagate_shapes): Bugfix,
assignment was used instead of equals in if test. Thanks to Hans
Breuer.
* gdk/win32/makefile.{cygwin,msc}
* gtk/makefile.{cygwin,msc}: Updates. Better kludge to get the
path to the Win32 headers that works also with the mingw compiler.
* gtk/gtkstyle.c: Include <string.h>.
2000-05-01 22:06:49 +00:00
|
|
|
_gdk_windowing_window_clear_area_e (GdkWindow *window,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (window != NULL);
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
if (!GDK_WINDOW_DESTROYED (window))
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
RECT rect;
|
|
|
|
|
Large changes to the Win32 backend, partially made necessary by the
2000-05-02 Tor Lillqvist <tml@iki.fi>
Large changes to the Win32 backend, partially made necessary by
the changes to the backend-independent internal
structures. Attempts to implement similar backing store stuff as
on X11. The current (CVS) version of the Win32 backend is *not* as
stable as it was before the no-flicker branch was merged. A
zipfile with that version is available from
http://www.gimp.org/win32/. That should be use by "production"
code until this CVS version is usable. (But note, the Win32
backend has never been claimed to be "production quality".)
* README.win32: Add the above comment about versions.
* gdk/gdkwindow.c: Don't use backing store for now on Win32.
* gdk/gdk.def: Update.
* gdk/gdkfont.h: Declare temporary Win32-only functions. Will
presumably be replaced by some more better mechanism as 1.4 gets
closer to release shape.
* gdk/makefile.{cygwin,msc}: Update.
* gdk/win32/*.c: Correct inclusions of the backend-specific and
internal headers. Change code according to changes in these. Use
gdk_drawable_*, not gdk_window_* where necessary.
* gdk/win32/gdkdnd-win32.c: Use MISC selector for GDK_NOTE, not
our old DND.
* gdk/win32/gdkdrawable-win32.c (gdk_win32_draw_text): Don't try
to interpret single characters as UTF-8. Thanks to Hans Breuer.
Use correct function name in warning messages.
* gdk/win32/gdkevents-win32.c: Use correct parameter lists for the
GSourceFuncs gdk_event_prepare and gdk_event_check.
(gdk_event_get_graphics_expose): Do implement, use
PeekMessage. Thanks to Hans Breuer.
(event_mask_string): Debugging function to print an GdkEventMask.
(gdk_pointer_grab): Use it.
* gdk/win32/gdkfont-win32.c: The Unicode subrange that the
(old) book I used claimed was Hangul actually is CJK Unified
Ideographs Extension A. Also, Hangul Syllables were missing.
Improve logging.
* gdk/win32/gdkgc-win32.c: Largish changes.
* gdk/win32/gdkim-win32.c (gdk_set_locale): Use
g_win32_getlocale() from GLib, and not setlocale() to get current
locale name.
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkwin32.h: Move stuff from gdkprivate-win32.h to
gdkwin32.h, similarily as in the X11 backend.
* gdk/win32/gdkwindow-win32.c (gdk_propagate_shapes): Bugfix,
assignment was used instead of equals in if test. Thanks to Hans
Breuer.
* gdk/win32/makefile.{cygwin,msc}
* gtk/makefile.{cygwin,msc}: Updates. Better kludge to get the
path to the Win32 headers that works also with the mingw compiler.
* gtk/gtkstyle.c: Include <string.h>.
2000-05-01 22:06:49 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("_gdk_windowing_window_clear_area_e: "
|
|
|
|
"%#x %dx%d@+%d+%d\n",
|
2000-07-25 17:31:05 +00:00
|
|
|
GDK_WINDOW_HWND (window), width, height, x, y));
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
rect.left = x;
|
Large changes to the Win32 backend, partially made necessary by the
2000-05-02 Tor Lillqvist <tml@iki.fi>
Large changes to the Win32 backend, partially made necessary by
the changes to the backend-independent internal
structures. Attempts to implement similar backing store stuff as
on X11. The current (CVS) version of the Win32 backend is *not* as
stable as it was before the no-flicker branch was merged. A
zipfile with that version is available from
http://www.gimp.org/win32/. That should be use by "production"
code until this CVS version is usable. (But note, the Win32
backend has never been claimed to be "production quality".)
* README.win32: Add the above comment about versions.
* gdk/gdkwindow.c: Don't use backing store for now on Win32.
* gdk/gdk.def: Update.
* gdk/gdkfont.h: Declare temporary Win32-only functions. Will
presumably be replaced by some more better mechanism as 1.4 gets
closer to release shape.
* gdk/makefile.{cygwin,msc}: Update.
* gdk/win32/*.c: Correct inclusions of the backend-specific and
internal headers. Change code according to changes in these. Use
gdk_drawable_*, not gdk_window_* where necessary.
* gdk/win32/gdkdnd-win32.c: Use MISC selector for GDK_NOTE, not
our old DND.
* gdk/win32/gdkdrawable-win32.c (gdk_win32_draw_text): Don't try
to interpret single characters as UTF-8. Thanks to Hans Breuer.
Use correct function name in warning messages.
* gdk/win32/gdkevents-win32.c: Use correct parameter lists for the
GSourceFuncs gdk_event_prepare and gdk_event_check.
(gdk_event_get_graphics_expose): Do implement, use
PeekMessage. Thanks to Hans Breuer.
(event_mask_string): Debugging function to print an GdkEventMask.
(gdk_pointer_grab): Use it.
* gdk/win32/gdkfont-win32.c: The Unicode subrange that the
(old) book I used claimed was Hangul actually is CJK Unified
Ideographs Extension A. Also, Hangul Syllables were missing.
Improve logging.
* gdk/win32/gdkgc-win32.c: Largish changes.
* gdk/win32/gdkim-win32.c (gdk_set_locale): Use
g_win32_getlocale() from GLib, and not setlocale() to get current
locale name.
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkwin32.h: Move stuff from gdkprivate-win32.h to
gdkwin32.h, similarily as in the X11 backend.
* gdk/win32/gdkwindow-win32.c (gdk_propagate_shapes): Bugfix,
assignment was used instead of equals in if test. Thanks to Hans
Breuer.
* gdk/win32/makefile.{cygwin,msc}
* gtk/makefile.{cygwin,msc}: Updates. Better kludge to get the
path to the Win32 headers that works also with the mingw compiler.
* gtk/gtkstyle.c: Include <string.h>.
2000-05-01 22:06:49 +00:00
|
|
|
rect.right = x + width + 1;
|
1999-11-11 22:12:27 +00:00
|
|
|
rect.top = y;
|
Large changes to the Win32 backend, partially made necessary by the
2000-05-02 Tor Lillqvist <tml@iki.fi>
Large changes to the Win32 backend, partially made necessary by
the changes to the backend-independent internal
structures. Attempts to implement similar backing store stuff as
on X11. The current (CVS) version of the Win32 backend is *not* as
stable as it was before the no-flicker branch was merged. A
zipfile with that version is available from
http://www.gimp.org/win32/. That should be use by "production"
code until this CVS version is usable. (But note, the Win32
backend has never been claimed to be "production quality".)
* README.win32: Add the above comment about versions.
* gdk/gdkwindow.c: Don't use backing store for now on Win32.
* gdk/gdk.def: Update.
* gdk/gdkfont.h: Declare temporary Win32-only functions. Will
presumably be replaced by some more better mechanism as 1.4 gets
closer to release shape.
* gdk/makefile.{cygwin,msc}: Update.
* gdk/win32/*.c: Correct inclusions of the backend-specific and
internal headers. Change code according to changes in these. Use
gdk_drawable_*, not gdk_window_* where necessary.
* gdk/win32/gdkdnd-win32.c: Use MISC selector for GDK_NOTE, not
our old DND.
* gdk/win32/gdkdrawable-win32.c (gdk_win32_draw_text): Don't try
to interpret single characters as UTF-8. Thanks to Hans Breuer.
Use correct function name in warning messages.
* gdk/win32/gdkevents-win32.c: Use correct parameter lists for the
GSourceFuncs gdk_event_prepare and gdk_event_check.
(gdk_event_get_graphics_expose): Do implement, use
PeekMessage. Thanks to Hans Breuer.
(event_mask_string): Debugging function to print an GdkEventMask.
(gdk_pointer_grab): Use it.
* gdk/win32/gdkfont-win32.c: The Unicode subrange that the
(old) book I used claimed was Hangul actually is CJK Unified
Ideographs Extension A. Also, Hangul Syllables were missing.
Improve logging.
* gdk/win32/gdkgc-win32.c: Largish changes.
* gdk/win32/gdkim-win32.c (gdk_set_locale): Use
g_win32_getlocale() from GLib, and not setlocale() to get current
locale name.
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkwin32.h: Move stuff from gdkprivate-win32.h to
gdkwin32.h, similarily as in the X11 backend.
* gdk/win32/gdkwindow-win32.c (gdk_propagate_shapes): Bugfix,
assignment was used instead of equals in if test. Thanks to Hans
Breuer.
* gdk/win32/makefile.{cygwin,msc}
* gtk/makefile.{cygwin,msc}: Updates. Better kludge to get the
path to the Win32 headers that works also with the mingw compiler.
* gtk/gtkstyle.c: Include <string.h>.
2000-05-01 22:06:49 +00:00
|
|
|
rect.bottom = y + height + 1;
|
2000-07-25 17:31:05 +00:00
|
|
|
if (!InvalidateRect (GDK_WINDOW_HWND (window), &rect, TRUE))
|
Internal GDK error reporting changes: (gdk_win32_gdi_failed) New function
2000-03-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkmain-win32.c: Internal GDK error reporting changes:
(gdk_win32_gdi_failed) New function for reporting errors from GDI,
for which it is no use to call GetLastError on Win9x.
(gdk_other_api_failed) New function, for
general error reporting without calling GetLastError.
(gdk_win32_api_failed) OTOH, this function always calls
GetLastError. (gdk_win32_last_error_string) Remove this function,
GLib has the equivalent now.
* gdk/win32/gdkprivate-win32.h: Declare the above, and macros to
call them with function name, file name and line number in the
arguments.
* gdk/win32/*.c: Use the new macros for reporting errors from GDI
functions.
* gtk/gtk.def: Add some missing entry points.
* gtk/gtkcompat.h.in: Define gtk_paned_gutter_size and
gtk_paned_set_gutter_size, which don't exist any longer, as void.
Fixes by Hans Breuer:
* gdk/makefile.msc: Update for debugging.
* gdk/win32/gdkgc-win32.c (gdk_win32_gc_set_dashes): Fake
implementation, just use the PS_DASH, PS_DOT, PS_DASHDOT or
PS_DASHDOTDOT or PS_DASH styles depending on the number of entries
in the dash_list.
* gdk/win32/gdkwin32.h (GDK_FONT_XFONT): New macro, similar as in
the x11 backend.
* gdk/win32/gdkprivate-win32.h (IS_WIN_NT): New macro.
* gtk/testgtk.c: Include config.h, guard inclusion of unistd.h.
2000-03-08 06:18:41 +00:00
|
|
|
WIN32_GDI_FAILED ("InvalidateRect");
|
2000-07-25 17:31:05 +00:00
|
|
|
UpdateWindow (GDK_WINDOW_HWND (window));
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_raise (GdkWindow *window)
|
|
|
|
{
|
|
|
|
g_return_if_fail (window != NULL);
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
if (!GDK_WINDOW_DESTROYED (window))
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_raise: %#x\n",
|
2000-07-25 17:31:05 +00:00
|
|
|
GDK_WINDOW_HWND (window)));
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
if (!BringWindowToTop (GDK_WINDOW_HWND (window)))
|
2000-02-13 14:52:47 +00:00
|
|
|
WIN32_API_FAILED ("BringWindowToTop");
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_lower (GdkWindow *window)
|
|
|
|
{
|
|
|
|
g_return_if_fail (window != NULL);
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
if (!GDK_WINDOW_DESTROYED (window))
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_lower: %#x\n",
|
2000-07-25 17:31:05 +00:00
|
|
|
GDK_WINDOW_HWND (window)));
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
if (!SetWindowPos (GDK_WINDOW_HWND (window), HWND_BOTTOM, 0, 0, 0, 0,
|
1999-11-11 22:12:27 +00:00
|
|
|
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE))
|
2000-02-13 14:52:47 +00:00
|
|
|
WIN32_API_FAILED ("SetWindowPos");
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_set_hints (GdkWindow *window,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint min_width,
|
|
|
|
gint min_height,
|
|
|
|
gint max_width,
|
|
|
|
gint max_height,
|
|
|
|
gint flags)
|
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
GdkWindowImplWin32 *impl;
|
1999-11-11 22:12:27 +00:00
|
|
|
WINDOWPLACEMENT size_hints;
|
|
|
|
RECT rect;
|
|
|
|
DWORD dwStyle;
|
|
|
|
DWORD dwExStyle;
|
|
|
|
int diff;
|
|
|
|
|
|
|
|
g_return_if_fail (window != NULL);
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
1999-11-11 22:12:27 +00:00
|
|
|
return;
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl);
|
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_set_hints: %#x %dx%d..%dx%d @+%d+%d\n",
|
2000-07-25 17:31:05 +00:00
|
|
|
GDK_WINDOW_HWND (window),
|
1999-11-11 22:12:27 +00:00
|
|
|
min_width, min_height, max_width, max_height,
|
|
|
|
x, y));
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
impl->hint_flags = flags;
|
1999-11-11 22:12:27 +00:00
|
|
|
size_hints.length = sizeof (size_hints);
|
|
|
|
|
|
|
|
if (flags)
|
|
|
|
{
|
|
|
|
if (flags & GDK_HINT_POS)
|
2000-07-25 17:31:05 +00:00
|
|
|
if (!GetWindowPlacement (GDK_WINDOW_HWND (window), &size_hints))
|
2000-02-13 14:52:47 +00:00
|
|
|
WIN32_API_FAILED ("GetWindowPlacement");
|
1999-11-11 22:12:27 +00:00
|
|
|
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;
|
2000-07-25 17:31:05 +00:00
|
|
|
dwStyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE);
|
|
|
|
dwExStyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_EXSTYLE);
|
1999-11-11 22:12:27 +00:00
|
|
|
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));
|
2000-07-25 17:31:05 +00:00
|
|
|
if (!SetWindowPlacement (GDK_WINDOW_HWND (window), &size_hints))
|
2000-02-13 14:52:47 +00:00
|
|
|
WIN32_API_FAILED ("SetWindowPlacement");
|
2000-07-25 17:31:05 +00:00
|
|
|
impl->hint_x = rect.left;
|
|
|
|
impl->hint_y = rect.top;
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (flags & GDK_HINT_MIN_SIZE)
|
|
|
|
{
|
|
|
|
rect.left = 0;
|
|
|
|
rect.top = 0;
|
|
|
|
rect.right = min_width;
|
|
|
|
rect.bottom = min_height;
|
2000-07-25 17:31:05 +00:00
|
|
|
dwStyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE);
|
|
|
|
dwExStyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_EXSTYLE);
|
1999-11-11 22:12:27 +00:00
|
|
|
AdjustWindowRectEx (&rect, dwStyle, FALSE, dwExStyle);
|
2000-07-25 17:31:05 +00:00
|
|
|
impl->hint_min_width = rect.right - rect.left;
|
|
|
|
impl->hint_min_height = rect.bottom - rect.top;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
/* Also chek if he current size of the window is in bounds. */
|
2000-07-25 17:31:05 +00:00
|
|
|
GetClientRect (GDK_WINDOW_HWND (window), &rect);
|
1999-11-11 22:12:27 +00:00
|
|
|
if (rect.right < min_width && rect.bottom < min_height)
|
|
|
|
gdk_window_resize (window, min_width, min_height);
|
|
|
|
else if (rect.right < min_width)
|
|
|
|
gdk_window_resize (window, min_width, rect.bottom);
|
|
|
|
else if (rect.bottom < min_height)
|
|
|
|
gdk_window_resize (window, rect.right, min_height);
|
|
|
|
}
|
1999-11-20 01:22:57 +00:00
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
if (flags & GDK_HINT_MAX_SIZE)
|
|
|
|
{
|
|
|
|
rect.left = 0;
|
|
|
|
rect.top = 0;
|
|
|
|
rect.right = max_width;
|
|
|
|
rect.bottom = max_height;
|
2000-07-25 17:31:05 +00:00
|
|
|
dwStyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE);
|
|
|
|
dwExStyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_EXSTYLE);
|
1999-11-11 22:12:27 +00:00
|
|
|
AdjustWindowRectEx (&rect, dwStyle, FALSE, dwExStyle);
|
2000-07-25 17:31:05 +00:00
|
|
|
impl->hint_max_width = rect.right - rect.left;
|
|
|
|
impl->hint_max_height = rect.bottom - rect.top;
|
1999-11-11 22:12:27 +00:00
|
|
|
/* Again, check if the window is too large currently. */
|
2000-07-25 17:31:05 +00:00
|
|
|
GetClientRect (GDK_WINDOW_HWND (window), &rect);
|
1999-11-11 22:12:27 +00:00
|
|
|
if (rect.right > max_width && rect.bottom > max_height)
|
|
|
|
gdk_window_resize (window, max_width, max_height);
|
|
|
|
else if (rect.right > max_width)
|
|
|
|
gdk_window_resize (window, max_width, rect.bottom);
|
|
|
|
else if (rect.bottom > max_height)
|
|
|
|
gdk_window_resize (window, rect.right, max_height);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_set_geometry_hints (GdkWindow *window,
|
|
|
|
GdkGeometry *geometry,
|
|
|
|
GdkWindowHints geom_mask)
|
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
GdkWindowImplWin32 *impl;
|
1999-11-11 22:12:27 +00:00
|
|
|
WINDOWPLACEMENT size_hints;
|
|
|
|
RECT rect;
|
|
|
|
DWORD dwStyle;
|
|
|
|
DWORD dwExStyle;
|
|
|
|
int diff;
|
|
|
|
|
|
|
|
g_return_if_fail (window != NULL);
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
1999-11-11 22:12:27 +00:00
|
|
|
return;
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl);
|
1999-11-11 22:12:27 +00:00
|
|
|
size_hints.length = sizeof (size_hints);
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
impl->hint_flags = geom_mask;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
if (geom_mask & GDK_HINT_POS)
|
|
|
|
; /* XXX */
|
|
|
|
|
|
|
|
if (geom_mask & GDK_HINT_MIN_SIZE)
|
|
|
|
{
|
|
|
|
rect.left = 0;
|
|
|
|
rect.top = 0;
|
|
|
|
rect.right = geometry->min_width;
|
|
|
|
rect.bottom = geometry->min_height;
|
2000-07-25 17:31:05 +00:00
|
|
|
dwStyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE);
|
|
|
|
dwExStyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_EXSTYLE);
|
1999-11-11 22:12:27 +00:00
|
|
|
AdjustWindowRectEx (&rect, dwStyle, FALSE, dwExStyle);
|
2000-07-25 17:31:05 +00:00
|
|
|
impl->hint_min_width = rect.right - rect.left;
|
|
|
|
impl->hint_min_height = rect.bottom - rect.top;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
/* Also check if he current size of the window is in bounds */
|
2000-07-25 17:31:05 +00:00
|
|
|
GetClientRect (GDK_WINDOW_HWND (window), &rect);
|
1999-11-11 22:12:27 +00:00
|
|
|
if (rect.right < geometry->min_width
|
|
|
|
&& rect.bottom < geometry->min_height)
|
|
|
|
gdk_window_resize (window, geometry->min_width, geometry->min_height);
|
|
|
|
else if (rect.right < geometry->min_width)
|
|
|
|
gdk_window_resize (window, geometry->min_width, rect.bottom);
|
|
|
|
else if (rect.bottom < geometry->min_height)
|
|
|
|
gdk_window_resize (window, rect.right, geometry->min_height);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (geom_mask & GDK_HINT_MAX_SIZE)
|
|
|
|
{
|
|
|
|
rect.left = 0;
|
|
|
|
rect.top = 0;
|
|
|
|
rect.right = geometry->max_width;
|
|
|
|
rect.bottom = geometry->max_height;
|
2000-07-25 17:31:05 +00:00
|
|
|
dwStyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE);
|
|
|
|
dwExStyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_EXSTYLE);
|
1999-11-11 22:12:27 +00:00
|
|
|
AdjustWindowRectEx (&rect, dwStyle, FALSE, dwExStyle);
|
2000-07-25 17:31:05 +00:00
|
|
|
impl->hint_max_width = rect.right - rect.left;
|
|
|
|
impl->hint_max_height = rect.bottom - rect.top;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
/* Again, check if the window is too large currently. */
|
2000-07-25 17:31:05 +00:00
|
|
|
GetClientRect (GDK_WINDOW_HWND (window), &rect);
|
1999-11-11 22:12:27 +00:00
|
|
|
if (rect.right > geometry->max_width
|
|
|
|
&& rect.bottom > geometry->max_height)
|
|
|
|
gdk_window_resize (window, geometry->max_width, geometry->max_height);
|
|
|
|
else if (rect.right > geometry->max_width)
|
|
|
|
gdk_window_resize (window, geometry->max_width, rect.bottom);
|
|
|
|
else if (rect.bottom > geometry->max_height)
|
|
|
|
gdk_window_resize (window, rect.right, geometry->max_height);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* I don't know what to do when called with zero base_width and height. */
|
|
|
|
if (geom_mask & GDK_HINT_BASE_SIZE
|
|
|
|
&& geometry->base_width > 0
|
|
|
|
&& geometry->base_height > 0)
|
2000-07-25 17:31:05 +00:00
|
|
|
if (!GetWindowPlacement (GDK_WINDOW_HWND (window), &size_hints))
|
2000-02-13 14:52:47 +00:00
|
|
|
WIN32_API_FAILED ("GetWindowPlacement");
|
1999-11-11 22:12:27 +00:00
|
|
|
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));
|
2000-07-25 17:31:05 +00:00
|
|
|
if (!SetWindowPlacement (GDK_WINDOW_HWND (window), &size_hints))
|
2000-02-13 14:52:47 +00:00
|
|
|
WIN32_API_FAILED ("SetWindowPlacement");
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (geom_mask & GDK_HINT_RESIZE_INC)
|
|
|
|
{
|
|
|
|
/* XXX */
|
|
|
|
}
|
|
|
|
|
|
|
|
if (geom_mask & GDK_HINT_ASPECT)
|
|
|
|
{
|
|
|
|
/* XXX */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_set_title (GdkWindow *window,
|
|
|
|
const gchar *title)
|
|
|
|
{
|
|
|
|
gint titlelen;
|
|
|
|
wchar_t *wcstr;
|
|
|
|
gint wlen;
|
|
|
|
char *mbstr;
|
|
|
|
|
|
|
|
g_return_if_fail (window != NULL);
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
Large changes to the Win32 backend, partially made necessary by the
2000-05-02 Tor Lillqvist <tml@iki.fi>
Large changes to the Win32 backend, partially made necessary by
the changes to the backend-independent internal
structures. Attempts to implement similar backing store stuff as
on X11. The current (CVS) version of the Win32 backend is *not* as
stable as it was before the no-flicker branch was merged. A
zipfile with that version is available from
http://www.gimp.org/win32/. That should be use by "production"
code until this CVS version is usable. (But note, the Win32
backend has never been claimed to be "production quality".)
* README.win32: Add the above comment about versions.
* gdk/gdkwindow.c: Don't use backing store for now on Win32.
* gdk/gdk.def: Update.
* gdk/gdkfont.h: Declare temporary Win32-only functions. Will
presumably be replaced by some more better mechanism as 1.4 gets
closer to release shape.
* gdk/makefile.{cygwin,msc}: Update.
* gdk/win32/*.c: Correct inclusions of the backend-specific and
internal headers. Change code according to changes in these. Use
gdk_drawable_*, not gdk_window_* where necessary.
* gdk/win32/gdkdnd-win32.c: Use MISC selector for GDK_NOTE, not
our old DND.
* gdk/win32/gdkdrawable-win32.c (gdk_win32_draw_text): Don't try
to interpret single characters as UTF-8. Thanks to Hans Breuer.
Use correct function name in warning messages.
* gdk/win32/gdkevents-win32.c: Use correct parameter lists for the
GSourceFuncs gdk_event_prepare and gdk_event_check.
(gdk_event_get_graphics_expose): Do implement, use
PeekMessage. Thanks to Hans Breuer.
(event_mask_string): Debugging function to print an GdkEventMask.
(gdk_pointer_grab): Use it.
* gdk/win32/gdkfont-win32.c: The Unicode subrange that the
(old) book I used claimed was Hangul actually is CJK Unified
Ideographs Extension A. Also, Hangul Syllables were missing.
Improve logging.
* gdk/win32/gdkgc-win32.c: Largish changes.
* gdk/win32/gdkim-win32.c (gdk_set_locale): Use
g_win32_getlocale() from GLib, and not setlocale() to get current
locale name.
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkwin32.h: Move stuff from gdkprivate-win32.h to
gdkwin32.h, similarily as in the X11 backend.
* gdk/win32/gdkwindow-win32.c (gdk_propagate_shapes): Bugfix,
assignment was used instead of equals in if test. Thanks to Hans
Breuer.
* gdk/win32/makefile.{cygwin,msc}
* gtk/makefile.{cygwin,msc}: Updates. Better kludge to get the
path to the Win32 headers that works also with the mingw compiler.
* gtk/gtkstyle.c: Include <string.h>.
2000-05-01 22:06:49 +00:00
|
|
|
g_return_if_fail (title != NULL);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_set_title: %#x %s\n",
|
2000-07-25 17:31:05 +00:00
|
|
|
GDK_WINDOW_HWND (window), title));
|
|
|
|
|
|
|
|
if (!GDK_WINDOW_DESTROYED (window))
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2000-01-18 22:03:59 +00:00
|
|
|
/* As the title is in UTF-8 we must translate it
|
1999-11-11 22:12:27 +00:00
|
|
|
* 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);
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
if (!SetWindowText (GDK_WINDOW_HWND (window), mbstr))
|
2000-02-13 14:52:47 +00:00
|
|
|
WIN32_API_FAILED ("SetWindowText");
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
g_free (mbstr);
|
|
|
|
g_free (wcstr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_set_role (GdkWindow *window,
|
|
|
|
const gchar *role)
|
|
|
|
{
|
|
|
|
g_return_if_fail (window != NULL);
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_set_role: %#x %s\n",
|
2000-07-25 17:31:05 +00:00
|
|
|
GDK_WINDOW_HWND (window), (role ? role : "NULL")));
|
1999-11-11 22:12:27 +00:00
|
|
|
/* XXX */
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_set_transient_for (GdkWindow *window,
|
|
|
|
GdkWindow *parent)
|
|
|
|
{
|
|
|
|
g_return_if_fail (window != NULL);
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_set_transient_for: %#x %#x\n",
|
2000-07-25 17:31:05 +00:00
|
|
|
GDK_WINDOW_HWND (window),
|
|
|
|
GDK_WINDOW_HWND (parent)));
|
1999-11-11 22:12:27 +00:00
|
|
|
/* XXX */
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_set_background (GdkWindow *window,
|
|
|
|
GdkColor *color)
|
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
GdkWindowObject *private = (GdkWindowObject *)window;
|
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
g_return_if_fail (window != NULL);
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_set_background: %#x %s\n",
|
|
|
|
GDK_WINDOW_HWND (window),
|
|
|
|
gdk_win32_color_to_string (color)));
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
private->bg_color = *color;
|
|
|
|
|
|
|
|
if (private->bg_pixmap &&
|
|
|
|
private->bg_pixmap != GDK_PARENT_RELATIVE_BG &&
|
|
|
|
private->bg_pixmap != GDK_NO_BG)
|
|
|
|
{
|
|
|
|
gdk_drawable_unref (private->bg_pixmap);
|
|
|
|
private->bg_pixmap = NULL;
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_set_back_pixmap (GdkWindow *window,
|
|
|
|
GdkPixmap *pixmap,
|
|
|
|
gint parent_relative)
|
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
GdkWindowObject *private = (GdkWindowObject *)window;
|
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
g_return_if_fail (window != NULL);
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
2000-07-25 17:31:05 +00:00
|
|
|
g_return_if_fail (pixmap == NULL || !parent_relative);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
if (private->bg_pixmap &&
|
|
|
|
private->bg_pixmap != GDK_PARENT_RELATIVE_BG &&
|
|
|
|
private->bg_pixmap != GDK_NO_BG)
|
|
|
|
gdk_drawable_unref (private->bg_pixmap);
|
|
|
|
|
|
|
|
if (parent_relative)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
private->bg_pixmap = GDK_PARENT_RELATIVE_BG;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (pixmap)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
gdk_drawable_ref (pixmap);
|
|
|
|
private->bg_pixmap = pixmap;
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
private->bg_pixmap = GDK_NO_BG;
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_set_cursor (GdkWindow *window,
|
|
|
|
GdkCursor *cursor)
|
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
GdkWindowImplWin32 *impl;
|
1999-11-11 22:12:27 +00:00
|
|
|
GdkCursorPrivate *cursor_private;
|
2000-07-25 17:31:05 +00:00
|
|
|
HCURSOR hcursor;
|
2000-03-03 23:21:51 +00:00
|
|
|
POINT pt;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
g_return_if_fail (window != NULL);
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl);
|
1999-11-11 22:12:27 +00:00
|
|
|
cursor_private = (GdkCursorPrivate*) cursor;
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
if (!GDK_WINDOW_DESTROYED (window))
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
if (!cursor)
|
2000-07-25 17:31:05 +00:00
|
|
|
hcursor = NULL;
|
1999-11-11 22:12:27 +00:00
|
|
|
else
|
2000-07-25 17:31:05 +00:00
|
|
|
hcursor = cursor_private->hcursor;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_set_cursor: %#x %#x\n",
|
2000-07-25 17:31:05 +00:00
|
|
|
GDK_WINDOW_HWND (window), hcursor));
|
|
|
|
if (impl->hcursor != NULL)
|
2000-07-04 06:12:54 +00:00
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("...DestroyCursor (%#x)\n", impl->hcursor));
|
2000-07-04 06:12:54 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
DestroyCursor (impl->hcursor);
|
|
|
|
impl->hcursor = NULL;
|
2000-07-04 06:12:54 +00:00
|
|
|
}
|
2000-07-25 17:31:05 +00:00
|
|
|
if (hcursor != NULL)
|
2000-07-04 06:12:54 +00:00
|
|
|
{
|
|
|
|
/* We must copy the cursor as it is OK to destroy the GdkCursor
|
|
|
|
* while still in use for some window. See for instance
|
|
|
|
* gimp_change_win_cursor() which calls
|
|
|
|
* gdk_window_set_cursor (win, cursor), and immediately
|
|
|
|
* afterwards gdk_cursor_destroy (cursor).
|
|
|
|
*/
|
2000-07-25 17:31:05 +00:00
|
|
|
impl->hcursor = CopyCursor (hcursor);
|
2000-07-04 06:12:54 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("...CopyCursor (%#x) = %#x\n",
|
2000-07-25 17:31:05 +00:00
|
|
|
hcursor, impl->hcursor));
|
2000-07-04 06:12:54 +00:00
|
|
|
|
|
|
|
GetCursorPos (&pt);
|
2000-07-25 17:31:05 +00:00
|
|
|
if (ChildWindowFromPoint (GDK_WINDOW_HWND (window), pt) == GDK_WINDOW_HWND (window))
|
|
|
|
SetCursor (impl->hcursor);
|
2000-07-04 06:12:54 +00:00
|
|
|
}
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_get_geometry (GdkWindow *window,
|
|
|
|
gint *x,
|
|
|
|
gint *y,
|
|
|
|
gint *width,
|
|
|
|
gint *height,
|
|
|
|
gint *depth)
|
|
|
|
{
|
|
|
|
g_return_if_fail (window == NULL || GDK_IS_WINDOW (window));
|
|
|
|
|
|
|
|
if (!window)
|
1999-11-20 01:22:57 +00:00
|
|
|
window = gdk_parent_root;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
if (!GDK_WINDOW_DESTROYED (window))
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
RECT rect;
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
if (!GetClientRect (GDK_WINDOW_HWND (window), &rect))
|
2000-02-13 14:52:47 +00:00
|
|
|
WIN32_API_FAILED ("GetClientRect");
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
if (x)
|
|
|
|
*x = rect.left;
|
|
|
|
if (y)
|
|
|
|
*y = rect.top;
|
|
|
|
if (width)
|
|
|
|
*width = rect.right - rect.left;
|
|
|
|
if (height)
|
|
|
|
*height = rect.bottom - rect.top;
|
|
|
|
if (depth)
|
|
|
|
*depth = gdk_drawable_get_visual (window)->depth;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gint
|
|
|
|
gdk_window_get_origin (GdkWindow *window,
|
|
|
|
gint *x,
|
|
|
|
gint *y)
|
|
|
|
{
|
|
|
|
gint return_val;
|
|
|
|
gint tx = 0;
|
|
|
|
gint ty = 0;
|
|
|
|
|
|
|
|
g_return_val_if_fail (window != NULL, 0);
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
if (!GDK_WINDOW_DESTROYED (window))
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
POINT pt;
|
|
|
|
|
|
|
|
pt.x = 0;
|
|
|
|
pt.y = 0;
|
2000-07-25 17:31:05 +00:00
|
|
|
ClientToScreen (GDK_WINDOW_HWND (window), &pt);
|
1999-11-11 22:12:27 +00:00
|
|
|
tx = pt.x;
|
|
|
|
ty = pt.y;
|
|
|
|
return_val = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return_val = 0;
|
|
|
|
|
|
|
|
if (x)
|
|
|
|
*x = tx;
|
|
|
|
if (y)
|
|
|
|
*y = ty;
|
|
|
|
|
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_get_origin: %#x: +%d+%d\n",
|
2000-07-25 17:31:05 +00:00
|
|
|
GDK_WINDOW_HWND (window), tx, ty));
|
1999-11-11 22:12:27 +00:00
|
|
|
return return_val;
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
gdk_window_get_deskrelative_origin (GdkWindow *window,
|
|
|
|
gint *x,
|
|
|
|
gint *y)
|
|
|
|
{
|
|
|
|
return gdk_window_get_origin (window, x, y);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_get_root_origin (GdkWindow *window,
|
|
|
|
gint *x,
|
|
|
|
gint *y)
|
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
GdkWindowObject *rover;
|
1999-11-11 22:12:27 +00:00
|
|
|
POINT pt;
|
|
|
|
|
|
|
|
g_return_if_fail (window != NULL);
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
rover = (GdkWindowObject*) window;
|
1999-11-11 22:12:27 +00:00
|
|
|
if (x)
|
|
|
|
*x = 0;
|
|
|
|
if (y)
|
|
|
|
*y = 0;
|
2000-07-25 17:31:05 +00:00
|
|
|
|
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
1999-11-11 22:12:27 +00:00
|
|
|
return;
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
while (rover->parent && ((GdkWindowObject*) rover->parent)->parent)
|
|
|
|
rover = (GdkWindowObject *) rover->parent;
|
|
|
|
if (rover->destroyed)
|
1999-11-11 22:12:27 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
pt.x = 0;
|
|
|
|
pt.y = 0;
|
2000-07-25 17:31:05 +00:00
|
|
|
ClientToScreen (GDK_WINDOW_HWND (rover), &pt);
|
1999-11-11 22:12:27 +00:00
|
|
|
if (x)
|
|
|
|
*x = pt.x;
|
|
|
|
if (y)
|
|
|
|
*y = pt.y;
|
|
|
|
|
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_get_root_origin: %#x: (%#x) +%d+%d\n",
|
2000-07-25 17:31:05 +00:00
|
|
|
GDK_WINDOW_HWND (window),
|
|
|
|
GDK_WINDOW_HWND (rover), pt.x, pt.y));
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GdkWindow*
|
|
|
|
gdk_window_get_pointer (GdkWindow *window,
|
|
|
|
gint *x,
|
|
|
|
gint *y,
|
|
|
|
GdkModifierType *mask)
|
|
|
|
{
|
|
|
|
GdkWindow *return_val;
|
|
|
|
POINT pointc, point;
|
|
|
|
HWND hwnd, hwndc;
|
|
|
|
|
|
|
|
g_return_val_if_fail (window == NULL || GDK_IS_WINDOW (window), NULL);
|
|
|
|
|
|
|
|
if (!window)
|
1999-11-20 01:22:57 +00:00
|
|
|
window = gdk_parent_root;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
return_val = NULL;
|
|
|
|
GetCursorPos (&pointc);
|
|
|
|
point = pointc;
|
2000-07-25 17:31:05 +00:00
|
|
|
ScreenToClient (GDK_WINDOW_HWND (window), &point);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
if (x)
|
|
|
|
*x = point.x;
|
|
|
|
if (y)
|
|
|
|
*y = point.y;
|
|
|
|
|
|
|
|
hwnd = WindowFromPoint (point);
|
|
|
|
point = pointc;
|
|
|
|
ScreenToClient (hwnd, &point);
|
|
|
|
|
|
|
|
do {
|
|
|
|
hwndc = ChildWindowFromPoint (hwnd, point);
|
|
|
|
ClientToScreen (hwnd, &point);
|
|
|
|
ScreenToClient (hwndc, &point);
|
|
|
|
} while (hwndc != hwnd && (hwnd = hwndc, 1)); /* Ouch! */
|
|
|
|
|
2000-07-25 20:38:35 +00:00
|
|
|
return_val = gdk_win32_handle_table_lookup ((GdkNativeWindow) hwnd);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
if (mask)
|
|
|
|
{
|
|
|
|
BYTE kbd[256];
|
|
|
|
|
|
|
|
GetKeyboardState (kbd);
|
|
|
|
*mask = 0;
|
|
|
|
if (kbd[VK_SHIFT] & 0x80)
|
|
|
|
*mask |= GDK_SHIFT_MASK;
|
|
|
|
if (kbd[VK_CAPITAL] & 0x80)
|
|
|
|
*mask |= GDK_LOCK_MASK;
|
|
|
|
if (kbd[VK_CONTROL] & 0x80)
|
|
|
|
*mask |= GDK_CONTROL_MASK;
|
|
|
|
if (kbd[VK_MENU] & 0x80)
|
|
|
|
*mask |= GDK_MOD1_MASK;
|
|
|
|
if (kbd[VK_LBUTTON] & 0x80)
|
|
|
|
*mask |= GDK_BUTTON1_MASK;
|
|
|
|
if (kbd[VK_MBUTTON] & 0x80)
|
|
|
|
*mask |= GDK_BUTTON2_MASK;
|
|
|
|
if (kbd[VK_RBUTTON] & 0x80)
|
|
|
|
*mask |= GDK_BUTTON3_MASK;
|
|
|
|
}
|
|
|
|
|
|
|
|
return return_val;
|
|
|
|
}
|
|
|
|
|
|
|
|
GdkWindow*
|
|
|
|
gdk_window_at_pointer (gint *win_x,
|
|
|
|
gint *win_y)
|
|
|
|
{
|
|
|
|
GdkWindow *window;
|
|
|
|
POINT point, pointc;
|
|
|
|
HWND hwnd, hwndc;
|
|
|
|
RECT rect;
|
|
|
|
|
|
|
|
GetCursorPos (&pointc);
|
|
|
|
point = pointc;
|
|
|
|
hwnd = WindowFromPoint (point);
|
|
|
|
|
|
|
|
if (hwnd == NULL)
|
|
|
|
{
|
1999-11-20 01:22:57 +00:00
|
|
|
window = gdk_parent_root;
|
1999-11-11 22:12:27 +00:00
|
|
|
if (win_x)
|
|
|
|
*win_x = pointc.x;
|
|
|
|
if (win_y)
|
|
|
|
*win_y = pointc.y;
|
|
|
|
return window;
|
|
|
|
}
|
|
|
|
|
|
|
|
ScreenToClient (hwnd, &point);
|
|
|
|
|
|
|
|
do {
|
|
|
|
hwndc = ChildWindowFromPoint (hwnd, point);
|
|
|
|
ClientToScreen (hwnd, &point);
|
|
|
|
ScreenToClient (hwndc, &point);
|
|
|
|
} while (hwndc != hwnd && (hwnd = hwndc, 1));
|
|
|
|
|
2000-07-25 20:38:35 +00:00
|
|
|
window = gdk_win32_handle_table_lookup ((GdkNativeWindow) hwnd);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
if (window && (win_x || win_y))
|
|
|
|
{
|
|
|
|
GetClientRect (hwnd, &rect);
|
|
|
|
if (win_x)
|
|
|
|
*win_x = point.x - rect.left;
|
|
|
|
if (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,
|
|
|
|
(window == NULL ? " NULL" : "")));
|
|
|
|
|
|
|
|
return window;
|
|
|
|
}
|
|
|
|
|
|
|
|
GdkEventMask
|
|
|
|
gdk_window_get_events (GdkWindow *window)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (window != NULL, 0);
|
|
|
|
g_return_val_if_fail (GDK_IS_WINDOW (window), 0);
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
1999-11-11 22:12:27 +00:00
|
|
|
return 0;
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
return GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->event_mask;
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_set_events (GdkWindow *window,
|
|
|
|
GdkEventMask event_mask)
|
|
|
|
{
|
|
|
|
g_return_if_fail (window != NULL);
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
1999-11-11 22:12:27 +00:00
|
|
|
return;
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl)->event_mask = event_mask;
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_shape_combine_mask (GdkWindow *window,
|
|
|
|
GdkBitmap *mask,
|
|
|
|
gint x, gint y)
|
|
|
|
{
|
|
|
|
g_return_if_fail (window != NULL);
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
|
|
|
if (!mask)
|
|
|
|
{
|
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_shape_combine_mask: %#x none\n",
|
2000-07-25 17:31:05 +00:00
|
|
|
GDK_WINDOW_HWND (window)));
|
|
|
|
SetWindowRgn (GDK_WINDOW_HWND (window), NULL, TRUE);
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
HRGN hrgn;
|
|
|
|
DWORD dwStyle;
|
|
|
|
DWORD dwExStyle;
|
|
|
|
RECT rect;
|
|
|
|
|
|
|
|
/* Convert mask bitmap to region */
|
2000-07-25 17:31:05 +00:00
|
|
|
hrgn = BitmapToRegion (GDK_WINDOW_HWND (mask));
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_shape_combine_mask: %#x %#x\n",
|
2000-07-25 17:31:05 +00:00
|
|
|
GDK_WINDOW_HWND (window),
|
|
|
|
GDK_WINDOW_HWND (mask)));
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
/* SetWindowRgn wants window (not client) coordinates */
|
2000-07-25 17:31:05 +00:00
|
|
|
dwStyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE);
|
|
|
|
dwExStyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_EXSTYLE);
|
|
|
|
GetClientRect (GDK_WINDOW_HWND (window), &rect);
|
1999-11-11 22:12:27 +00:00
|
|
|
AdjustWindowRectEx (&rect, dwStyle, FALSE, dwExStyle);
|
|
|
|
OffsetRgn (hrgn, -rect.left, -rect.top);
|
|
|
|
|
|
|
|
OffsetRgn (hrgn, x, y);
|
|
|
|
|
|
|
|
/* If this is a top-level window, add the title bar to the region */
|
2000-07-25 17:31:05 +00:00
|
|
|
if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_TOPLEVEL)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
CombineRgn (hrgn, hrgn,
|
|
|
|
CreateRectRgn (0, 0, rect.right - rect.left, -rect.top),
|
|
|
|
RGN_OR);
|
|
|
|
}
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
SetWindowRgn (GDK_WINDOW_HWND (window), hrgn, TRUE);
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_set_override_redirect (GdkWindow *window,
|
|
|
|
gboolean override_redirect)
|
|
|
|
{
|
|
|
|
g_return_if_fail (window != NULL);
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
|
|
|
g_warning ("gdk_window_set_override_redirect not implemented");
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_set_icon (GdkWindow *window,
|
|
|
|
GdkWindow *icon_window,
|
|
|
|
GdkPixmap *pixmap,
|
|
|
|
GdkBitmap *mask)
|
|
|
|
{
|
|
|
|
g_return_if_fail (window != NULL);
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
1999-11-11 22:12:27 +00:00
|
|
|
return;
|
|
|
|
|
2000-02-13 14:52:47 +00:00
|
|
|
/* 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.
|
|
|
|
*/
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2000-03-16 21:58:35 +00:00
|
|
|
gdk_window_set_icon_name (GdkWindow *window,
|
|
|
|
const gchar *name)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (window != NULL);
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
1999-11-11 22:12:27 +00:00
|
|
|
return;
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
if (!SetWindowText (GDK_WINDOW_HWND (window), name))
|
2000-02-13 14:52:47 +00:00
|
|
|
WIN32_API_FAILED ("SetWindowText");
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_set_group (GdkWindow *window,
|
|
|
|
GdkWindow *leader)
|
|
|
|
{
|
|
|
|
g_return_if_fail (window != NULL);
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
g_return_if_fail (leader != NULL);
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (leader));
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
if (GDK_WINDOW_DESTROYED (window) || GDK_WINDOW_DESTROYED (leader))
|
1999-11-11 22:12:27 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
g_warning ("gdk_window_set_group not implemented");
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_set_decorations (GdkWindow *window,
|
|
|
|
GdkWMDecoration decorations)
|
|
|
|
{
|
|
|
|
LONG style, exstyle;
|
|
|
|
|
|
|
|
g_return_if_fail (window != NULL);
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
style = GetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE);
|
|
|
|
exstyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_EXSTYLE);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
style &= (WS_OVERLAPPED|WS_POPUP|WS_CHILD|WS_MINIMIZE|WS_VISIBLE|WS_DISABLED
|
|
|
|
|WS_CLIPSIBLINGS|WS_CLIPCHILDREN|WS_MAXIMIZE);
|
|
|
|
|
|
|
|
exstyle &= (WS_EX_TOPMOST|WS_EX_TRANSPARENT);
|
|
|
|
|
|
|
|
if (decorations & GDK_DECOR_ALL)
|
|
|
|
style |= (WS_CAPTION|WS_SYSMENU|WS_THICKFRAME|WS_MINIMIZEBOX|WS_MAXIMIZEBOX);
|
|
|
|
if (decorations & GDK_DECOR_BORDER)
|
|
|
|
style |= (WS_BORDER);
|
|
|
|
if (decorations & GDK_DECOR_RESIZEH)
|
|
|
|
style |= (WS_THICKFRAME);
|
|
|
|
if (decorations & GDK_DECOR_TITLE)
|
|
|
|
style |= (WS_CAPTION);
|
|
|
|
if (decorations & GDK_DECOR_MENU)
|
|
|
|
style |= (WS_SYSMENU);
|
|
|
|
if (decorations & GDK_DECOR_MINIMIZE)
|
|
|
|
style |= (WS_MINIMIZEBOX);
|
|
|
|
if (decorations & GDK_DECOR_MAXIMIZE)
|
|
|
|
style |= (WS_MAXIMIZEBOX);
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
SetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE, style);
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_set_functions (GdkWindow *window,
|
|
|
|
GdkWMFunction functions)
|
|
|
|
{
|
|
|
|
LONG style, exstyle;
|
|
|
|
|
|
|
|
g_return_if_fail (window != NULL);
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
style = GetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE);
|
|
|
|
exstyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_EXSTYLE);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
style &= (WS_OVERLAPPED|WS_POPUP|WS_CHILD|WS_MINIMIZE|WS_VISIBLE|WS_DISABLED
|
|
|
|
|WS_CLIPSIBLINGS|WS_CLIPCHILDREN|WS_MAXIMIZE|WS_CAPTION|WS_BORDER
|
|
|
|
|WS_SYSMENU);
|
|
|
|
|
|
|
|
exstyle &= (WS_EX_TOPMOST|WS_EX_TRANSPARENT);
|
|
|
|
|
|
|
|
if (functions & GDK_FUNC_ALL)
|
|
|
|
style |= (WS_THICKFRAME|WS_MINIMIZEBOX|WS_MAXIMIZEBOX);
|
|
|
|
if (functions & GDK_FUNC_RESIZE)
|
|
|
|
style |= (WS_THICKFRAME);
|
|
|
|
if (functions & GDK_FUNC_MOVE)
|
|
|
|
style |= (WS_THICKFRAME);
|
|
|
|
if (functions & GDK_FUNC_MINIMIZE)
|
|
|
|
style |= (WS_MINIMIZEBOX);
|
|
|
|
if (functions & GDK_FUNC_MAXIMIZE)
|
|
|
|
style |= (WS_MAXIMIZEBOX);
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
SetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE, style);
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* propagate the shapes from all child windows of a GDK window to the parent
|
|
|
|
* window. Shamelessly ripped from Enlightenment's code
|
|
|
|
*
|
|
|
|
* - Raster
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
|
|
|
QueryTree (HWND hwnd,
|
|
|
|
HWND **children,
|
|
|
|
gint *nchildren)
|
|
|
|
{
|
|
|
|
guint i, n;
|
|
|
|
HWND child;
|
|
|
|
|
|
|
|
n = 0;
|
|
|
|
do {
|
|
|
|
if (n == 0)
|
|
|
|
child = GetWindow (hwnd, GW_CHILD);
|
|
|
|
else
|
|
|
|
child = GetWindow (child, GW_HWNDNEXT);
|
|
|
|
if (child != NULL)
|
|
|
|
n++;
|
|
|
|
} while (child != NULL);
|
|
|
|
|
|
|
|
if (n > 0)
|
|
|
|
{
|
|
|
|
*children = g_new (HWND, n);
|
|
|
|
for (i = 0; i < n; i++)
|
|
|
|
{
|
|
|
|
if (i == 0)
|
|
|
|
child = GetWindow (hwnd, GW_CHILD);
|
|
|
|
else
|
|
|
|
child = GetWindow (child, GW_HWNDNEXT);
|
|
|
|
*children[i] = child;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gdk_propagate_shapes (HANDLE win,
|
|
|
|
gboolean merge)
|
|
|
|
{
|
|
|
|
RECT emptyRect;
|
|
|
|
HRGN region, childRegion;
|
|
|
|
RECT rect;
|
|
|
|
HWND *list = NULL;
|
|
|
|
gint i, num;
|
|
|
|
|
|
|
|
SetRectEmpty (&emptyRect);
|
|
|
|
region = CreateRectRgnIndirect (&emptyRect);
|
|
|
|
if (merge)
|
|
|
|
GetWindowRgn (win, region);
|
|
|
|
|
|
|
|
QueryTree (win, &list, &num);
|
|
|
|
if (list != NULL)
|
|
|
|
{
|
|
|
|
WINDOWPLACEMENT placement;
|
|
|
|
|
|
|
|
placement.length = sizeof (WINDOWPLACEMENT);
|
|
|
|
/* go through all child windows and combine regions */
|
|
|
|
for (i = 0; i < num; i++)
|
|
|
|
{
|
|
|
|
GetWindowPlacement (list[i], &placement);
|
Large changes to the Win32 backend, partially made necessary by the
2000-05-02 Tor Lillqvist <tml@iki.fi>
Large changes to the Win32 backend, partially made necessary by
the changes to the backend-independent internal
structures. Attempts to implement similar backing store stuff as
on X11. The current (CVS) version of the Win32 backend is *not* as
stable as it was before the no-flicker branch was merged. A
zipfile with that version is available from
http://www.gimp.org/win32/. That should be use by "production"
code until this CVS version is usable. (But note, the Win32
backend has never been claimed to be "production quality".)
* README.win32: Add the above comment about versions.
* gdk/gdkwindow.c: Don't use backing store for now on Win32.
* gdk/gdk.def: Update.
* gdk/gdkfont.h: Declare temporary Win32-only functions. Will
presumably be replaced by some more better mechanism as 1.4 gets
closer to release shape.
* gdk/makefile.{cygwin,msc}: Update.
* gdk/win32/*.c: Correct inclusions of the backend-specific and
internal headers. Change code according to changes in these. Use
gdk_drawable_*, not gdk_window_* where necessary.
* gdk/win32/gdkdnd-win32.c: Use MISC selector for GDK_NOTE, not
our old DND.
* gdk/win32/gdkdrawable-win32.c (gdk_win32_draw_text): Don't try
to interpret single characters as UTF-8. Thanks to Hans Breuer.
Use correct function name in warning messages.
* gdk/win32/gdkevents-win32.c: Use correct parameter lists for the
GSourceFuncs gdk_event_prepare and gdk_event_check.
(gdk_event_get_graphics_expose): Do implement, use
PeekMessage. Thanks to Hans Breuer.
(event_mask_string): Debugging function to print an GdkEventMask.
(gdk_pointer_grab): Use it.
* gdk/win32/gdkfont-win32.c: The Unicode subrange that the
(old) book I used claimed was Hangul actually is CJK Unified
Ideographs Extension A. Also, Hangul Syllables were missing.
Improve logging.
* gdk/win32/gdkgc-win32.c: Largish changes.
* gdk/win32/gdkim-win32.c (gdk_set_locale): Use
g_win32_getlocale() from GLib, and not setlocale() to get current
locale name.
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkwin32.h: Move stuff from gdkprivate-win32.h to
gdkwin32.h, similarily as in the X11 backend.
* gdk/win32/gdkwindow-win32.c (gdk_propagate_shapes): Bugfix,
assignment was used instead of equals in if test. Thanks to Hans
Breuer.
* gdk/win32/makefile.{cygwin,msc}
* gtk/makefile.{cygwin,msc}: Updates. Better kludge to get the
path to the Win32 headers that works also with the mingw compiler.
* gtk/gtkstyle.c: Include <string.h>.
2000-05-01 22:06:49 +00:00
|
|
|
if (placement.showCmd == SW_SHOWNORMAL)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
childRegion = CreateRectRgnIndirect (&emptyRect);
|
|
|
|
GetWindowRgn (list[i], childRegion);
|
|
|
|
CombineRgn (region, region, childRegion, RGN_OR);
|
|
|
|
DeleteObject (childRegion);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SetWindowRgn (win, region, TRUE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
DeleteObject (region);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_set_child_shapes (GdkWindow *window)
|
|
|
|
{
|
|
|
|
g_return_if_fail (window != NULL);
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
1999-11-11 22:12:27 +00:00
|
|
|
return;
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
gdk_propagate_shapes (GDK_WINDOW_HWND (window), FALSE);
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_merge_child_shapes (GdkWindow *window)
|
|
|
|
{
|
|
|
|
g_return_if_fail (window != NULL);
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
1999-11-11 22:12:27 +00:00
|
|
|
return;
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
gdk_propagate_shapes (GDK_WINDOW_HWND (window), TRUE);
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Support for windows that can be guffaw-scrolled
|
|
|
|
* (See http://www.gtk.org/~otaylor/whitepapers/guffaw-scrolling.txt)
|
|
|
|
*/
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gdk_window_gravity_works (void)
|
|
|
|
{
|
|
|
|
enum { UNKNOWN, NO, YES };
|
|
|
|
static gint gravity_works = UNKNOWN;
|
|
|
|
|
|
|
|
if (gravity_works == UNKNOWN)
|
|
|
|
{
|
|
|
|
GdkWindowAttr attr;
|
|
|
|
GdkWindow *parent;
|
|
|
|
GdkWindow *child;
|
|
|
|
gint y;
|
|
|
|
|
|
|
|
attr.window_type = GDK_WINDOW_TEMP;
|
|
|
|
attr.wclass = GDK_INPUT_OUTPUT;
|
|
|
|
attr.x = 0;
|
|
|
|
attr.y = 0;
|
|
|
|
attr.width = 100;
|
|
|
|
attr.height = 100;
|
|
|
|
attr.event_mask = 0;
|
|
|
|
|
|
|
|
parent = gdk_window_new (NULL, &attr, GDK_WA_X | GDK_WA_Y);
|
|
|
|
|
|
|
|
attr.window_type = GDK_WINDOW_CHILD;
|
|
|
|
child = gdk_window_new (parent, &attr, GDK_WA_X | GDK_WA_Y);
|
|
|
|
|
|
|
|
gdk_window_set_static_win_gravity (child, TRUE);
|
|
|
|
|
|
|
|
gdk_window_resize (parent, 100, 110);
|
|
|
|
gdk_window_move (parent, 0, -10);
|
|
|
|
gdk_window_move_resize (parent, 0, 0, 100, 100);
|
|
|
|
|
|
|
|
gdk_window_resize (parent, 100, 110);
|
|
|
|
gdk_window_move (parent, 0, -10);
|
|
|
|
gdk_window_move_resize (parent, 0, 0, 100, 100);
|
|
|
|
|
|
|
|
gdk_window_get_geometry (child, NULL, &y, NULL, NULL, NULL);
|
|
|
|
|
|
|
|
gdk_window_destroy (parent);
|
|
|
|
gdk_window_destroy (child);
|
|
|
|
|
|
|
|
gravity_works = ((y == -20) ? YES : NO);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (gravity_works == YES);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gdk_window_set_static_bit_gravity (GdkWindow *window, gboolean on)
|
|
|
|
{
|
|
|
|
g_return_if_fail (window != NULL);
|
|
|
|
|
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_set_static_bit_gravity: Not implemented\n"));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gdk_window_set_static_win_gravity (GdkWindow *window, gboolean on)
|
|
|
|
{
|
|
|
|
g_return_if_fail (window != NULL);
|
|
|
|
|
|
|
|
GDK_NOTE (MISC,
|
|
|
|
g_print ("gdk_window_set_static_win_gravity: Not implemented\n"));
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************
|
|
|
|
* gdk_window_set_static_gravities:
|
|
|
|
* Set the bit gravity of the given window to static,
|
|
|
|
* and flag it so all children get static subwindow
|
|
|
|
* gravity.
|
|
|
|
* arguments:
|
|
|
|
* window: window for which to set static gravity
|
|
|
|
* use_static: Whether to turn static gravity on or off.
|
|
|
|
* results:
|
|
|
|
* Does the XServer support static gravity?
|
|
|
|
*************************************************************/
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
gdk_window_set_static_gravities (GdkWindow *window,
|
|
|
|
gboolean use_static)
|
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
GdkWindowObject *private = (GdkWindowObject *)window;
|
1999-11-11 22:12:27 +00:00
|
|
|
GList *tmp_list;
|
|
|
|
|
|
|
|
g_return_val_if_fail (window != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
|
|
|
|
|
|
|
|
if (!use_static == !private->guffaw_gravity)
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
if (use_static && !gdk_window_gravity_works ())
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
private->guffaw_gravity = use_static;
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
if (!GDK_WINDOW_DESTROYED (window))
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
gdk_window_set_static_bit_gravity (window, use_static);
|
|
|
|
|
|
|
|
tmp_list = private->children;
|
|
|
|
while (tmp_list)
|
|
|
|
{
|
|
|
|
gdk_window_set_static_win_gravity (window, use_static);
|
|
|
|
|
|
|
|
tmp_list = tmp_list->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|