1999-11-11 22:12:27 +00:00
|
|
|
/* GDK - The GIMP Drawing Kit
|
|
|
|
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
2004-05-08 16:25:15 +00:00
|
|
|
* Copyright (C) 1998-2004 Tor Lillqvist
|
|
|
|
* Copyright (C) 2001-2004 Hans Breuer
|
2007-07-12 23:38:30 +00:00
|
|
|
* Copyright (C) 2007 Cody Russell
|
1999-11-11 22:12:27 +00:00
|
|
|
*
|
|
|
|
* 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/.
|
|
|
|
*/
|
|
|
|
|
2004-03-06 03:38:59 +00:00
|
|
|
#include <config.h>
|
1999-11-11 22:12:27 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
2005-11-09 12:35:56 +00:00
|
|
|
#include "gdk.h"
|
1999-11-20 01:22:57 +00:00
|
|
|
#include "gdkprivate-win32.h"
|
2000-11-11 18:39:57 +00:00
|
|
|
#include "gdkinput-win32.h"
|
1999-11-20 01:22:57 +00:00
|
|
|
|
2003-12-14 01:06:56 +00:00
|
|
|
#if 0
|
2003-08-06 21:01:00 +00:00
|
|
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
2003-12-14 01:06:56 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#endif
|
2003-08-06 21:01:00 +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);
|
2002-10-28 20:48:40 +00:00
|
|
|
static GdkRegion* gdk_window_impl_win32_get_visible_region (GdkDrawable *drawable);
|
2000-07-25 17:31:05 +00:00
|
|
|
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;
|
|
|
|
|
2006-02-09 02:58:45 +00:00
|
|
|
static void update_style_bits (GdkWindow *window);
|
|
|
|
static gboolean _gdk_window_get_functions (GdkWindow *window,
|
|
|
|
GdkWMFunction *functions);
|
|
|
|
|
2005-03-16 02:21:14 +00:00
|
|
|
#define WINDOW_IS_TOPLEVEL(window) \
|
|
|
|
(GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD && \
|
|
|
|
GDK_WINDOW_TYPE (window) != GDK_WINDOW_FOREIGN)
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
GType
|
2001-10-28 21:28:51 +00:00
|
|
|
_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",
|
2000-11-11 18:39:57 +00:00
|
|
|
&object_info, 0);
|
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)
|
|
|
|
{
|
2001-10-28 21:28:51 +00:00
|
|
|
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;
|
2005-03-16 02:21:14 +00:00
|
|
|
impl->toplevel_window_type = -1;
|
2000-07-25 17:31:05 +00:00
|
|
|
impl->hcursor = NULL;
|
2003-12-14 01:06:56 +00:00
|
|
|
impl->hicon_big = NULL;
|
|
|
|
impl->hicon_small = NULL;
|
2000-07-25 17:31:05 +00:00
|
|
|
impl->hint_flags = 0;
|
2005-11-09 02:13:35 +00:00
|
|
|
impl->type_hint = GDK_WINDOW_TYPE_HINT_NORMAL;
|
2000-07-25 17:31:05 +00:00
|
|
|
impl->extension_events_selected = FALSE;
|
2007-07-12 23:38:30 +00:00
|
|
|
impl->transient_owner = NULL;
|
2000-07-25 17:31:05 +00:00
|
|
|
}
|
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;
|
2000-12-30 20:06:14 +00:00
|
|
|
|
|
|
|
/* Visible and clip regions are the same */
|
|
|
|
drawable_class->get_clip_region = gdk_window_impl_win32_get_visible_region;
|
|
|
|
drawable_class->get_visible_region = gdk_window_impl_win32_get_visible_region;
|
2000-07-25 17:31:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
2002-01-11 23:56:28 +00:00
|
|
|
if (GetCursor () == window_impl->hcursor)
|
|
|
|
SetCursor (NULL);
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
GDI_CALL (DestroyCursor, (window_impl->hcursor));
|
2000-07-25 17:31:05 +00:00
|
|
|
window_impl->hcursor = NULL;
|
|
|
|
}
|
2003-12-14 01:06:56 +00:00
|
|
|
if (window_impl->hicon_big != NULL)
|
|
|
|
{
|
|
|
|
GDI_CALL (DestroyIcon, (window_impl->hicon_big));
|
|
|
|
window_impl->hicon_big = NULL;
|
|
|
|
}
|
|
|
|
if (window_impl->hicon_small != NULL)
|
2003-08-05 22:24:35 +00:00
|
|
|
{
|
2003-12-14 01:06:56 +00:00
|
|
|
GDI_CALL (DestroyIcon, (window_impl->hicon_small));
|
|
|
|
window_impl->hicon_small = NULL;
|
2003-08-05 22:24:35 +00:00
|
|
|
}
|
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
|
|
|
|
gdk/win32/gdkinput-win32.h Drop the GdkEvent* parameter, it wasn't used.
2003-08-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkinput-win32.h
* gdk/win32/gdkinput-win32.c (_gdk_input_configure_event,
_gdk_input_enter_event): Drop the GdkEvent* parameter, it wasn't
used.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): Adapt caller
accordingly, in fact an uninitialised variable was dereferenced.
[Win32] Add support for multiple monitors.
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkglobals-win32.c: New global variables for
multiple-monitor info: _gdk_num_monitors, _gdk_monitors, and
_gdk_offset_x and _gdk_offset_y.
* gdk/win32/gdkdisplay-win32.c (count_monitor, enum_monitor): New
functions, enumeration functions passed to EnumDisplayMonitors().
(gdk_display_open): If the EnumDisplayMonitors() and
GetMonitorInfo() API is present (on Win98, Win2000 and newer), use
if to find out monitor info.
Calculate the offset between Win32 coordinates (relative to the
primary monitor's origin (and thus negative on monitors to the
left of or above it), and GDK's (visible coordinates should be
non-negative).
* gdk/win32/gdkscreen-win32 (gdk_screen_get_n_monitors,
gdk_screen_get_monitor_geometry): Use information collected above.
(gdk_window_move, gdk_window_move_resize_window_get_geometry):
Subtract _gdk_offset_{x,y} from GDK root window coordinates.
(gdk_window_get_geometry, gdk_window_get_origin,
gdk_window_get_frame_extents): For top-level windows, add
_gdk_offset_{x,y} to GDK root window coordinates
Still need to handle multiple monitors in
gdk_window_fullscreen(). Probably should make the window
fullscreen on the monitor where the cursor is?
* gdk/win32/gdkevents-win32.c: Add _gdk_offset_{x,y} to all GDK
root window coordinates in GdkEvents.
[Win32] Fix geometry hint handling. Add support for resize
increment and base size, and aspect ratio geometry hints. The
"gridded geometry" test in testgtk now works beautifully.
* gdk/win32/gdkwindow-win32.c (gdk_window_set_geometry_hints):
Turns out this function shouldn't actually ever modify the
window's size, just store the hints. (Old code kept for a while
inside #if 0.)
(gdk_window_set_hints): Remove presumably broken code that handles
the position hints, this function is obsolete anyway.
* gdk/win32/gdkevents-win32.c: Drop the current_{x,y}_root
variables, not used.
(adjust_drag): New function, used to implement resize increment
hints.
(gdk_event_translate): Handle WM_SIZING, implement resize
increment and base size, and aspect ratio geometry hints here. The
WM_GETMINMAXINFO handler takes care of the minimum and maximum
size hints as before. Fix the WM_GETMINMAXINFO handler to take
into account window decorations. No need to modify the
ptMaxPosition and ptMaxSize fields in the MINMAXINFO struct,
the defaults are fine.
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkwindow-win32.c (_gdk_win32_adjust_client_rect,
_gdk_win32_get_adjusted_client_rect): New helper functions.
2003-08-07 22:17:18 +00:00
|
|
|
void
|
|
|
|
_gdk_win32_adjust_client_rect (GdkWindow *window,
|
|
|
|
RECT *rect)
|
|
|
|
{
|
|
|
|
LONG style, exstyle;
|
|
|
|
|
|
|
|
style = GetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE);
|
|
|
|
exstyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_EXSTYLE);
|
|
|
|
API_CALL (AdjustWindowRectEx, (rect, style, FALSE, exstyle));
|
|
|
|
}
|
|
|
|
|
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;
|
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);
|
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
|
|
|
{
|
2005-11-02 13:33:27 +00:00
|
|
|
drawable_impl->colormap = gdk_screen_get_system_colormap (_gdk_screen);
|
gdk/win32/gdkprivate-win32.h New flags _gdk_input_locale_is_ime and
2003-07-25 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkglobals-win32.c: New flags _gdk_input_locale_is_ime
and _gdk_keyboard_has_altgr.
* gdk/win32/gdkevents-win32.c: Lots of changes. Most important
ones detailled here.
Code that has been ifdeffed out for a long time removed. Remove
some really old doc comments that were left behind for some public
functions, the official ones are in the X11 backend anyway. Change
GDK_WINDOW_OBJECT() calls to GdkWindowObject casts. Reformat
multi-line boolean expressions to have the operators at ends of
lines.
As mouse capture with SetCapture() indeed seems to work OK, no
need to have the correspoinding macro USE_SETCAPTURE and ifdefs.
Ifdef out the gdk-ping-msg stuff. I don't remember why it was
needed at some time, and things seem to work fine now without
(knock on wood).
Ifdef out the search for some Latin locale keyboard layout being
loaded. Not used currently, but might be needed after all, if we
decide that we want to be able to generate ASCII control character
events with a non-Latin keyboard.
(assign_object): New helper function, handles the g_object_ref()
and unref() calls when assigning GObject pointers.
(generate_crossing_events): Also generate the GDK_NOTIFY_INTERIOR
enter event when the pointer has moved to an ancestor window. Was
left out by mistake.
(gdk_window_is_ancestor): Renamed from gdk_window_is_child().
(gdk_pointer_grab, gdk_pointer_ungrab): Implement the confine_to
functionality, using ClipCursor().
(find_window_for_mouse_event): Splice part of code into new
function find_real_window_for_grabbed_mouse_event().
(fixup_event, append_event, apply_filters): New functions, code
refactored out from elsewhere.
(synthesize_enter_or_leave_event, synthesize_leave_event,
synthesize_enter_event,
synthesize_leave_events,synthesize_enter_events): Also take a
GdkCrossingMode parameter, in preparation to generating
GDK_CROSSING_GRAB and GDK_CROSSING_UNGRAB events.
(fixup_event, append_event, fill_key_event_string): New functions,
code refactoring.
(vk_from_char, build_keypress_event, build_keyrelease_event):
Removed as part of dropping WM_CHAR handling.
(build_key_event_state,gdk_event_translate): Call
GetKeyboardState(), once, for each keyboard message, instead of
several calls to GetKeyState() here and there.
(gdk_event_translate): Fix bugs #104516, #104662, #115902. While
at it, do some major refactoring, and some fixes for potential
problems noticed while going through the code.
Don't handle WM_CHAR at all. Only handle WM_KEYDOWN and
WM_KEYUP. Don't need the state variables related to whether to
wait for WM_CHAR or not, and whether the current key is
AltGr. Remove lots of complexity. Thus don't need the
use_ime_composition flag.
Not handling WM_CHAR means dead key handling will have to be taken
care of by GTK, but that seems to work fine, so no worry.
Another side-effect is that Alt+keypad digits don't work any
longer, but it's better to learn to use GTK's ISO14755 support is
anyway.
Be more careful in checking whether AltGr is involved. Only
attempt to handle it if the keyboard actually has it. And
explicitly check for *left* Control plus *right* Alt being
pressed. Still, allow (left) Alt and/or (right) Control with AltGr
chars.
Handle keys using similar code as in the X11 backend. As we have
built a keymap in gdkkeys-win32.c anyway, use it by calling
gdk_keymap_translate_keyboard_state() to look up the keysym from
the virtual key code and keyboard state. Build the key event
string in exactly the same way as the X11 backend.
If an IME is being used, don't generate GDK events for keys
between receiving WM_IME_STARTCOMPOSITION and
WM_IME_ENDCOMPOSITION, as those keys are for the IME.
For WM_IME_COMPOSITION, handle all the Unicode chars returned from
the IME, not just the first one.
gdk_event_translate() is still quite complex, could split the
message handler cases out into separate functions.
On mouse events, when the mouse is grabbed, use
find_real_window_for_grabbed_mouse_event() in order to be able to
generate correct crossing events.
No longer take a pre-allocated GdkEvent as parameter. Instead,
allocate events as needed and append them to the queue. (This is
different from how gdk_event_translate() in the X11 backend
works.) This change made the code much clearer, especially in the
cases where we have to generate several GDK events for one Windows
message. Return FALSE if DefWindowProc() should be called, TRUE
if not. If DefWindowProc() should not be called, also return the
value to be returned from the window procedure.
(Previously, the interaction with gdk_event_translate()'s caller
was much more complex, when we had to indicate whether the
already-queued event should be left in the queue or removed, and
in addition also had to indicate whether to call DefWindowProc()
or not, and what value to return from the window procedure if
not.)
Don't use a separate "private" variable required to be pointing to
the GdkWindowObject of the "window" variable at all times. Just
use casts, even if looks a bit uglier.
Notice destroyed windows as early as possible, and break out of
the messsage switch.
Use _gdk_pointer_root as current_window when the pointer is
outside GDK's top-level windows.
On WM_INPUTLANGCHANGE, set _gdk_input_locale_is_ime as
appropriate, based on ImmIsIME().
(gdk_event_translate, gdk_event_send_client_message_for_display,
gdk_screen_broadcast_client_message): Implement client messages.
Use a registered Windows message to pass GDK client messages. Note
that the amount of user data is restricted to four bytes, as it is
carried in the LPARAM. (The WPARAM is used for the message type
"atom".)
(real_window_procedure): Adapt for new gdk_event_translate()
interface.
* gdk/win32/gdkmain-win32.c (_gdk_windowing_init): Set
_gdk_input_locale_is_ime initially.
* gdk/win32/gdkwindow-win32.c: Use g_object_ref()/unref() instead
of g_colormap_ref()/unref().
(gdk_window_new): Made code a bit more like the X11 one, pretend
to handle screens (although we just have one for now).
* gdk/x11/gdkevents-x11.c
(gdk_event_send_client_message_for_display,
gdk_screen_broadcast_client_message): Document the user data
limitation on Win32.
* gdk/win32/gdkevents-win32.c (print_event): More complete enter
and leave notify detail output.
* gdk/win32/gdkkeys-win32.c (update_keymap): Make dead keys
visible to GDK and GTK. Store the corresponding GDK_dead_* keysym
for those, so that the GtkIMContextCimple compose tables will
work. Deduce if the keyboard layout has the AltGr key, and set the
above flag accordingly.
2003-07-26 01:54:59 +00:00
|
|
|
g_object_ref (drawable_impl->colormap);
|
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));
|
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
|
|
|
|
2001-11-09 21:52:52 +00:00
|
|
|
/* chain up */
|
|
|
|
GDK_DRAWABLE_CLASS (parent_class)->set_colormap (drawable, cmap);
|
1999-11-20 01:22:57 +00:00
|
|
|
|
2001-11-09 21:52:52 +00:00
|
|
|
if (cmap)
|
|
|
|
{
|
|
|
|
/* XXX */
|
2005-11-02 13:33:27 +00:00
|
|
|
g_print ("gdk_window_impl_win32_set_colormap: XXX\n");
|
2001-11-09 21:52:52 +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
|
|
|
}
|
|
|
|
|
2000-12-30 20:06:14 +00:00
|
|
|
static GdkRegion*
|
|
|
|
gdk_window_impl_win32_get_visible_region (GdkDrawable *drawable)
|
|
|
|
{
|
|
|
|
GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (drawable);
|
|
|
|
GdkRectangle result_rect;
|
|
|
|
|
|
|
|
result_rect.x = 0;
|
|
|
|
result_rect.y = 0;
|
|
|
|
result_rect.width = impl->width;
|
|
|
|
result_rect.height = impl->height;
|
|
|
|
|
|
|
|
gdk_rectangle_intersect (&result_rect, &impl->position_info.clip_rect, &result_rect);
|
|
|
|
|
|
|
|
return gdk_region_rectangle (&result_rect);
|
|
|
|
}
|
|
|
|
|
2004-09-03 01:27:57 +00:00
|
|
|
void
|
|
|
|
_gdk_root_window_size_init (void)
|
|
|
|
{
|
|
|
|
GdkWindowImplWin32 *impl;
|
|
|
|
GdkRectangle rect;
|
|
|
|
int i;
|
|
|
|
|
2005-03-16 02:21:14 +00:00
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (((GdkWindowObject *) _gdk_root)->impl);
|
2004-09-03 01:27:57 +00:00
|
|
|
rect = _gdk_monitors[0];
|
|
|
|
for (i = 1; i < _gdk_num_monitors; i++)
|
|
|
|
gdk_rectangle_union (&rect, _gdk_monitors+i, &rect);
|
|
|
|
|
|
|
|
impl->width = rect.width;
|
|
|
|
impl->height = rect.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;
|
|
|
|
GdkDrawableImplWin32 *draw_impl;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2005-03-16 02:21:14 +00:00
|
|
|
g_assert (_gdk_root == NULL);
|
2000-07-25 17:31:05 +00:00
|
|
|
|
2005-03-16 02:21:14 +00:00
|
|
|
_gdk_root = g_object_new (GDK_TYPE_WINDOW, NULL);
|
|
|
|
private = (GdkWindowObject *)_gdk_root;
|
2000-07-25 17:31:05 +00:00
|
|
|
draw_impl = GDK_DRAWABLE_IMPL_WIN32 (private->impl);
|
1999-11-20 01:22:57 +00:00
|
|
|
|
2005-03-16 02:21:14 +00:00
|
|
|
draw_impl->handle = GetDesktopWindow ();
|
2000-07-25 17:31:05 +00:00
|
|
|
draw_impl->wrapper = GDK_DRAWABLE (private);
|
2005-11-02 13:33:27 +00:00
|
|
|
draw_impl->colormap = gdk_screen_get_default_colormap (_gdk_screen);
|
gdk/win32/gdkprivate-win32.h New flags _gdk_input_locale_is_ime and
2003-07-25 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkglobals-win32.c: New flags _gdk_input_locale_is_ime
and _gdk_keyboard_has_altgr.
* gdk/win32/gdkevents-win32.c: Lots of changes. Most important
ones detailled here.
Code that has been ifdeffed out for a long time removed. Remove
some really old doc comments that were left behind for some public
functions, the official ones are in the X11 backend anyway. Change
GDK_WINDOW_OBJECT() calls to GdkWindowObject casts. Reformat
multi-line boolean expressions to have the operators at ends of
lines.
As mouse capture with SetCapture() indeed seems to work OK, no
need to have the correspoinding macro USE_SETCAPTURE and ifdefs.
Ifdef out the gdk-ping-msg stuff. I don't remember why it was
needed at some time, and things seem to work fine now without
(knock on wood).
Ifdef out the search for some Latin locale keyboard layout being
loaded. Not used currently, but might be needed after all, if we
decide that we want to be able to generate ASCII control character
events with a non-Latin keyboard.
(assign_object): New helper function, handles the g_object_ref()
and unref() calls when assigning GObject pointers.
(generate_crossing_events): Also generate the GDK_NOTIFY_INTERIOR
enter event when the pointer has moved to an ancestor window. Was
left out by mistake.
(gdk_window_is_ancestor): Renamed from gdk_window_is_child().
(gdk_pointer_grab, gdk_pointer_ungrab): Implement the confine_to
functionality, using ClipCursor().
(find_window_for_mouse_event): Splice part of code into new
function find_real_window_for_grabbed_mouse_event().
(fixup_event, append_event, apply_filters): New functions, code
refactored out from elsewhere.
(synthesize_enter_or_leave_event, synthesize_leave_event,
synthesize_enter_event,
synthesize_leave_events,synthesize_enter_events): Also take a
GdkCrossingMode parameter, in preparation to generating
GDK_CROSSING_GRAB and GDK_CROSSING_UNGRAB events.
(fixup_event, append_event, fill_key_event_string): New functions,
code refactoring.
(vk_from_char, build_keypress_event, build_keyrelease_event):
Removed as part of dropping WM_CHAR handling.
(build_key_event_state,gdk_event_translate): Call
GetKeyboardState(), once, for each keyboard message, instead of
several calls to GetKeyState() here and there.
(gdk_event_translate): Fix bugs #104516, #104662, #115902. While
at it, do some major refactoring, and some fixes for potential
problems noticed while going through the code.
Don't handle WM_CHAR at all. Only handle WM_KEYDOWN and
WM_KEYUP. Don't need the state variables related to whether to
wait for WM_CHAR or not, and whether the current key is
AltGr. Remove lots of complexity. Thus don't need the
use_ime_composition flag.
Not handling WM_CHAR means dead key handling will have to be taken
care of by GTK, but that seems to work fine, so no worry.
Another side-effect is that Alt+keypad digits don't work any
longer, but it's better to learn to use GTK's ISO14755 support is
anyway.
Be more careful in checking whether AltGr is involved. Only
attempt to handle it if the keyboard actually has it. And
explicitly check for *left* Control plus *right* Alt being
pressed. Still, allow (left) Alt and/or (right) Control with AltGr
chars.
Handle keys using similar code as in the X11 backend. As we have
built a keymap in gdkkeys-win32.c anyway, use it by calling
gdk_keymap_translate_keyboard_state() to look up the keysym from
the virtual key code and keyboard state. Build the key event
string in exactly the same way as the X11 backend.
If an IME is being used, don't generate GDK events for keys
between receiving WM_IME_STARTCOMPOSITION and
WM_IME_ENDCOMPOSITION, as those keys are for the IME.
For WM_IME_COMPOSITION, handle all the Unicode chars returned from
the IME, not just the first one.
gdk_event_translate() is still quite complex, could split the
message handler cases out into separate functions.
On mouse events, when the mouse is grabbed, use
find_real_window_for_grabbed_mouse_event() in order to be able to
generate correct crossing events.
No longer take a pre-allocated GdkEvent as parameter. Instead,
allocate events as needed and append them to the queue. (This is
different from how gdk_event_translate() in the X11 backend
works.) This change made the code much clearer, especially in the
cases where we have to generate several GDK events for one Windows
message. Return FALSE if DefWindowProc() should be called, TRUE
if not. If DefWindowProc() should not be called, also return the
value to be returned from the window procedure.
(Previously, the interaction with gdk_event_translate()'s caller
was much more complex, when we had to indicate whether the
already-queued event should be left in the queue or removed, and
in addition also had to indicate whether to call DefWindowProc()
or not, and what value to return from the window procedure if
not.)
Don't use a separate "private" variable required to be pointing to
the GdkWindowObject of the "window" variable at all times. Just
use casts, even if looks a bit uglier.
Notice destroyed windows as early as possible, and break out of
the messsage switch.
Use _gdk_pointer_root as current_window when the pointer is
outside GDK's top-level windows.
On WM_INPUTLANGCHANGE, set _gdk_input_locale_is_ime as
appropriate, based on ImmIsIME().
(gdk_event_translate, gdk_event_send_client_message_for_display,
gdk_screen_broadcast_client_message): Implement client messages.
Use a registered Windows message to pass GDK client messages. Note
that the amount of user data is restricted to four bytes, as it is
carried in the LPARAM. (The WPARAM is used for the message type
"atom".)
(real_window_procedure): Adapt for new gdk_event_translate()
interface.
* gdk/win32/gdkmain-win32.c (_gdk_windowing_init): Set
_gdk_input_locale_is_ime initially.
* gdk/win32/gdkwindow-win32.c: Use g_object_ref()/unref() instead
of g_colormap_ref()/unref().
(gdk_window_new): Made code a bit more like the X11 one, pretend
to handle screens (although we just have one for now).
* gdk/x11/gdkevents-x11.c
(gdk_event_send_client_message_for_display,
gdk_screen_broadcast_client_message): Document the user data
limitation on Win32.
* gdk/win32/gdkevents-win32.c (print_event): More complete enter
and leave notify detail output.
* gdk/win32/gdkkeys-win32.c (update_keymap): Make dead keys
visible to GDK and GTK. Store the corresponding GDK_dead_* keysym
for those, so that the GtkIMContextCimple compose tables will
work. Deduce if the keyboard layout has the AltGr key, and set the
above flag accordingly.
2003-07-26 01:54:59 +00:00
|
|
|
g_object_ref (draw_impl->colormap);
|
2000-07-25 17:31:05 +00:00
|
|
|
|
|
|
|
private->window_type = GDK_WINDOW_ROOT;
|
|
|
|
private->depth = gdk_visual_get_system ()->depth;
|
gdk/win32/gdkprivate-win32.h New flags _gdk_input_locale_is_ime and
2003-07-25 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkglobals-win32.c: New flags _gdk_input_locale_is_ime
and _gdk_keyboard_has_altgr.
* gdk/win32/gdkevents-win32.c: Lots of changes. Most important
ones detailled here.
Code that has been ifdeffed out for a long time removed. Remove
some really old doc comments that were left behind for some public
functions, the official ones are in the X11 backend anyway. Change
GDK_WINDOW_OBJECT() calls to GdkWindowObject casts. Reformat
multi-line boolean expressions to have the operators at ends of
lines.
As mouse capture with SetCapture() indeed seems to work OK, no
need to have the correspoinding macro USE_SETCAPTURE and ifdefs.
Ifdef out the gdk-ping-msg stuff. I don't remember why it was
needed at some time, and things seem to work fine now without
(knock on wood).
Ifdef out the search for some Latin locale keyboard layout being
loaded. Not used currently, but might be needed after all, if we
decide that we want to be able to generate ASCII control character
events with a non-Latin keyboard.
(assign_object): New helper function, handles the g_object_ref()
and unref() calls when assigning GObject pointers.
(generate_crossing_events): Also generate the GDK_NOTIFY_INTERIOR
enter event when the pointer has moved to an ancestor window. Was
left out by mistake.
(gdk_window_is_ancestor): Renamed from gdk_window_is_child().
(gdk_pointer_grab, gdk_pointer_ungrab): Implement the confine_to
functionality, using ClipCursor().
(find_window_for_mouse_event): Splice part of code into new
function find_real_window_for_grabbed_mouse_event().
(fixup_event, append_event, apply_filters): New functions, code
refactored out from elsewhere.
(synthesize_enter_or_leave_event, synthesize_leave_event,
synthesize_enter_event,
synthesize_leave_events,synthesize_enter_events): Also take a
GdkCrossingMode parameter, in preparation to generating
GDK_CROSSING_GRAB and GDK_CROSSING_UNGRAB events.
(fixup_event, append_event, fill_key_event_string): New functions,
code refactoring.
(vk_from_char, build_keypress_event, build_keyrelease_event):
Removed as part of dropping WM_CHAR handling.
(build_key_event_state,gdk_event_translate): Call
GetKeyboardState(), once, for each keyboard message, instead of
several calls to GetKeyState() here and there.
(gdk_event_translate): Fix bugs #104516, #104662, #115902. While
at it, do some major refactoring, and some fixes for potential
problems noticed while going through the code.
Don't handle WM_CHAR at all. Only handle WM_KEYDOWN and
WM_KEYUP. Don't need the state variables related to whether to
wait for WM_CHAR or not, and whether the current key is
AltGr. Remove lots of complexity. Thus don't need the
use_ime_composition flag.
Not handling WM_CHAR means dead key handling will have to be taken
care of by GTK, but that seems to work fine, so no worry.
Another side-effect is that Alt+keypad digits don't work any
longer, but it's better to learn to use GTK's ISO14755 support is
anyway.
Be more careful in checking whether AltGr is involved. Only
attempt to handle it if the keyboard actually has it. And
explicitly check for *left* Control plus *right* Alt being
pressed. Still, allow (left) Alt and/or (right) Control with AltGr
chars.
Handle keys using similar code as in the X11 backend. As we have
built a keymap in gdkkeys-win32.c anyway, use it by calling
gdk_keymap_translate_keyboard_state() to look up the keysym from
the virtual key code and keyboard state. Build the key event
string in exactly the same way as the X11 backend.
If an IME is being used, don't generate GDK events for keys
between receiving WM_IME_STARTCOMPOSITION and
WM_IME_ENDCOMPOSITION, as those keys are for the IME.
For WM_IME_COMPOSITION, handle all the Unicode chars returned from
the IME, not just the first one.
gdk_event_translate() is still quite complex, could split the
message handler cases out into separate functions.
On mouse events, when the mouse is grabbed, use
find_real_window_for_grabbed_mouse_event() in order to be able to
generate correct crossing events.
No longer take a pre-allocated GdkEvent as parameter. Instead,
allocate events as needed and append them to the queue. (This is
different from how gdk_event_translate() in the X11 backend
works.) This change made the code much clearer, especially in the
cases where we have to generate several GDK events for one Windows
message. Return FALSE if DefWindowProc() should be called, TRUE
if not. If DefWindowProc() should not be called, also return the
value to be returned from the window procedure.
(Previously, the interaction with gdk_event_translate()'s caller
was much more complex, when we had to indicate whether the
already-queued event should be left in the queue or removed, and
in addition also had to indicate whether to call DefWindowProc()
or not, and what value to return from the window procedure if
not.)
Don't use a separate "private" variable required to be pointing to
the GdkWindowObject of the "window" variable at all times. Just
use casts, even if looks a bit uglier.
Notice destroyed windows as early as possible, and break out of
the messsage switch.
Use _gdk_pointer_root as current_window when the pointer is
outside GDK's top-level windows.
On WM_INPUTLANGCHANGE, set _gdk_input_locale_is_ime as
appropriate, based on ImmIsIME().
(gdk_event_translate, gdk_event_send_client_message_for_display,
gdk_screen_broadcast_client_message): Implement client messages.
Use a registered Windows message to pass GDK client messages. Note
that the amount of user data is restricted to four bytes, as it is
carried in the LPARAM. (The WPARAM is used for the message type
"atom".)
(real_window_procedure): Adapt for new gdk_event_translate()
interface.
* gdk/win32/gdkmain-win32.c (_gdk_windowing_init): Set
_gdk_input_locale_is_ime initially.
* gdk/win32/gdkwindow-win32.c: Use g_object_ref()/unref() instead
of g_colormap_ref()/unref().
(gdk_window_new): Made code a bit more like the X11 one, pretend
to handle screens (although we just have one for now).
* gdk/x11/gdkevents-x11.c
(gdk_event_send_client_message_for_display,
gdk_screen_broadcast_client_message): Document the user data
limitation on Win32.
* gdk/win32/gdkevents-win32.c (print_event): More complete enter
and leave notify detail output.
* gdk/win32/gdkkeys-win32.c (update_keymap): Make dead keys
visible to GDK and GTK. Store the corresponding GDK_dead_* keysym
for those, so that the GtkIMContextCimple compose tables will
work. Deduce if the keyboard layout has the AltGr key, and set the
above flag accordingly.
2003-07-26 01:54:59 +00:00
|
|
|
|
2004-09-03 01:27:57 +00:00
|
|
|
_gdk_root_window_size_init ();
|
|
|
|
|
gdk/win32/gdkprivate-win32.h Rename all global variables and functions to
2002-11-12 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate-win32.h
* gdk/win32/*.c: Rename all global variables and functions to
start with underscore.
Merge from stable:
More work on the Win32 backend. The cause of some scrolling
problems was that SetWindowPos() and ScrollWindowEx() don't blit
those parts of the window they think are invalid. As we didn't
keep Windows's update region in synch with GDK's, Windows thought
those areas that in fact had been updated were invalid. Calling
ValidateRgn() in _gdk_windowing_window_queue_antiexpose() seems to
be an elegant and efficient solution, removing from Windows's
update region those areas we are about to repaint proactively.
In some cases garbage leftover values were used for the clip
origin in GdkGCWin32. This showed up as odd blank areas around the
pixmaps included in the Text Widget in gtk-demo.
Having the clip region either as a GdkRegion or a HRGN in
GdkGCWin32 was unnecessary, it's better to just use a HRGN.
The translation and antiexpose queue handling in
gdkgeometry-win32.c seems unnecessary (and not implementable in
the same way as on X11 anyway, no serial numbers) on Windows,
ifdeffed out.
Don't (try to) do guffaw scrolling as there is no static window
gravity on Windows. Guffaw scrolling would be unnecessary anyway,
as there is the ScrollWindow() API. This improves the behaviour of
the Text Widget demo in gtk-demo a lot. But I have no idea how the
lack of static win gravity should be handled in other places where
the X11 code uses it. Especially _gdk_window_move_resize_child().
There is still some problem in expose handling. By moving an
obscuring window back and forth over testgtk's main window, for
instance, every now and then you typically get narrow vertical or
horizontal strips of pixels that haven't been properly redrawn
after being exposed. A fencepost error somewhere?
Otherwise, all of testgtk and gtk-demo except "big windows" now
seem to work pretty well.
Bug #79720 should be fixed now.
* gdk/win32/gdkcolor-win32.c (gdk_win32_color_to_string,
gdk_win32_print_paletteentries, gdk_win32_print_system_palette,
gdk_win32_print_hpalette)
* gdk/win32/gdkdrawable-win32.c (gdk_win32_drawable_description)
* gdk/win32/gdkevents-win32.c (gdk_win32_message_name):
Move all debugging helper functions to gdkmain-win32.c.
* gdk/win32/gdkdrawable-win32.c (_gdk_win32_draw_tiles):
Rewrite. Make static. Must take tile origin parameters, too.
(gdk_win32_draw_rectangle): Pass the tile/stipple origin to
_gdk_win32_draw_tiles(). Remove #if 0 code.
(blit_inside_window): Don't call ScrollDC(), that didn't work at
all like I thought. A simple call to BitBlt() is enough.
* gdk/win32/gdkevents-win32.c (gdk_event_translate) Remove unused
latin_locale_loaded variable.
(_gdk_win32_get_next_tick): New function. Used to make sure
timestamps of events are always increasing, both in events
generated from the window procedure and in events gotten via
PeekMessage(). Not sure whether this is actually useful, but it
seemed as a good idea.
(real_window_procedure): Don't use a local GdkEventPrivate
variable. Don't attempt any compression of configure or expose
events here, handled elsewhere.
(erase_background): Accumulate window offsets when traversing up
the parent chain for GDK_PARENT_RELATIVE_BG, in order to get
correct alignment of background pixmaps. Don't fill with
BLACK_BRUSH if GDK_NO_BG.
(gdk_event_get_graphics_expose): A bit more verbose debugging output.
(gdk_event_translate): Use _gdk_win32_get_next_tick(). In the
WM_PAINT handler, don't check for empty update rect. When we get a
WM_PAINT, the update region isn't empty. And if it for some
strange reason is, that will be handled later anyway. Call
GetUpdateRgn() before calling BeginPaint() and EndPaint() (which
empty the update region).
* gdk/win32/gdkdnd-win32.c
* gdk/win32/gdkinput-win32.c:
Use _gdk_win32_get_next_tick().
* gdk/win32/gdkfont-win32.c: Use %p to print HFONTs.
(gdk_text_size): Remove, unused.
* gdk/win32/gdkgc-win32.c: Set clip origins to zero
when appropriate.
(gdk_gc_copy): Increase refcount on colormap if present.
(gdk_win32_hdc_get): Handle just hcliprgn. If we have a stipple,
combine it with clip region after selecting into the DC.
(_gdk_win32_bitmap_to_hrgn): Rename from _gdk_win32_bitmap_to_region.
(_gdk_win3_gdkregion_to_hrgn): New function, code snippet
extracted from gdk_win32_hdc_get().
* gdk/win32/gdkgeometry-win32.c: Ifdef out the translate_queue
handling.
(gdk_window_copy_area_scroll): Increase clipRect to avoid
ScrollWindowEx() not scrolling pixels it thinks are invalid.
Scroll also children with the ScrollWindowEx() call. No need to
call gdk_window_move() on the children.
(gdk_window_scroll): Don't do guffaw scrolling.
(gdk_window_compute_position): Fix typo, used win32_y where x was
intended.
(gdk_window_premove, gdk_window_postmove,
gdk_window_clip_changed): Add debugging output.
(_gdk_windowing_window_queue_antiexpose): Just call ValidateRgn()
on the region.
(_gdk_window_process_expose): No use for the serial number
parameter now. Instead of a rectangle, take a region parameter, as
Windows gives us one in WM_PAINT.
* gdk/win32/gdkmain-win32.c (_gdk_win32_lbstyle_to_string,
_gdk_win32_pstype_to_string, _gdk_win32_psstyle_to_string,
_gdk_win32_psendcap_to_string, _gdk_win32_psjoin_to_string,
_gdk_win32_rect_to_string, _gdk_win32_gdkrectangle_to_string,
_gdk_win32_gdkregion_to_string): New debugging functions.
(static_printf): Helper function for the above. sprintfs into a
static circular buffer, return value should be used "soon".
* gdk/win32/gdkwindow-win32.c (gdk_propagate_shapes): Plug memory
leak, free list after use.
(gdk_window_gravity_works): Remove, we know that there is no such
thing on Windows.
(gdk_window_set_static_bit_gravity,
gdk_window_set_static_win_gravity): Ditto, remove, they didn't do
anything anyway.
(_gdk_windowing_window_init, gdk_window_foreign_new): Call
_gdk_window_init_position() like in the X11 backend.
(gdk_window_reparent): Don't call the now nonexistent
gdk_window_set_static_win_gravity(). No idea what should be done
instead.
(gdk_window_get_geometry): The returned x and y should be relative
to parent. Used to be always zero..
(gdk_window_set_static_gravities): Return FALSE if trying to set
static gravity.
* gdk/win32/gdkprivate-win32.h: Drop the clip_region field from
GdkGCWin32. Only use the HRGN hcliprgn. Declare new
functions.
* gdk/win32/*.c: Use new debugging functions.
* gdk/win32/rc/gdk.rc.in: Update copyright year.
2002-11-12 22:17:48 +00:00
|
|
|
_gdk_window_init_position (GDK_WINDOW (private));
|
|
|
|
|
2005-03-16 02:21:14 +00:00
|
|
|
gdk_win32_handle_table_insert ((HANDLE *) &draw_impl->handle, _gdk_root);
|
gdk/win32/gdkprivate-win32.h New flags _gdk_input_locale_is_ime and
2003-07-25 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkglobals-win32.c: New flags _gdk_input_locale_is_ime
and _gdk_keyboard_has_altgr.
* gdk/win32/gdkevents-win32.c: Lots of changes. Most important
ones detailled here.
Code that has been ifdeffed out for a long time removed. Remove
some really old doc comments that were left behind for some public
functions, the official ones are in the X11 backend anyway. Change
GDK_WINDOW_OBJECT() calls to GdkWindowObject casts. Reformat
multi-line boolean expressions to have the operators at ends of
lines.
As mouse capture with SetCapture() indeed seems to work OK, no
need to have the correspoinding macro USE_SETCAPTURE and ifdefs.
Ifdef out the gdk-ping-msg stuff. I don't remember why it was
needed at some time, and things seem to work fine now without
(knock on wood).
Ifdef out the search for some Latin locale keyboard layout being
loaded. Not used currently, but might be needed after all, if we
decide that we want to be able to generate ASCII control character
events with a non-Latin keyboard.
(assign_object): New helper function, handles the g_object_ref()
and unref() calls when assigning GObject pointers.
(generate_crossing_events): Also generate the GDK_NOTIFY_INTERIOR
enter event when the pointer has moved to an ancestor window. Was
left out by mistake.
(gdk_window_is_ancestor): Renamed from gdk_window_is_child().
(gdk_pointer_grab, gdk_pointer_ungrab): Implement the confine_to
functionality, using ClipCursor().
(find_window_for_mouse_event): Splice part of code into new
function find_real_window_for_grabbed_mouse_event().
(fixup_event, append_event, apply_filters): New functions, code
refactored out from elsewhere.
(synthesize_enter_or_leave_event, synthesize_leave_event,
synthesize_enter_event,
synthesize_leave_events,synthesize_enter_events): Also take a
GdkCrossingMode parameter, in preparation to generating
GDK_CROSSING_GRAB and GDK_CROSSING_UNGRAB events.
(fixup_event, append_event, fill_key_event_string): New functions,
code refactoring.
(vk_from_char, build_keypress_event, build_keyrelease_event):
Removed as part of dropping WM_CHAR handling.
(build_key_event_state,gdk_event_translate): Call
GetKeyboardState(), once, for each keyboard message, instead of
several calls to GetKeyState() here and there.
(gdk_event_translate): Fix bugs #104516, #104662, #115902. While
at it, do some major refactoring, and some fixes for potential
problems noticed while going through the code.
Don't handle WM_CHAR at all. Only handle WM_KEYDOWN and
WM_KEYUP. Don't need the state variables related to whether to
wait for WM_CHAR or not, and whether the current key is
AltGr. Remove lots of complexity. Thus don't need the
use_ime_composition flag.
Not handling WM_CHAR means dead key handling will have to be taken
care of by GTK, but that seems to work fine, so no worry.
Another side-effect is that Alt+keypad digits don't work any
longer, but it's better to learn to use GTK's ISO14755 support is
anyway.
Be more careful in checking whether AltGr is involved. Only
attempt to handle it if the keyboard actually has it. And
explicitly check for *left* Control plus *right* Alt being
pressed. Still, allow (left) Alt and/or (right) Control with AltGr
chars.
Handle keys using similar code as in the X11 backend. As we have
built a keymap in gdkkeys-win32.c anyway, use it by calling
gdk_keymap_translate_keyboard_state() to look up the keysym from
the virtual key code and keyboard state. Build the key event
string in exactly the same way as the X11 backend.
If an IME is being used, don't generate GDK events for keys
between receiving WM_IME_STARTCOMPOSITION and
WM_IME_ENDCOMPOSITION, as those keys are for the IME.
For WM_IME_COMPOSITION, handle all the Unicode chars returned from
the IME, not just the first one.
gdk_event_translate() is still quite complex, could split the
message handler cases out into separate functions.
On mouse events, when the mouse is grabbed, use
find_real_window_for_grabbed_mouse_event() in order to be able to
generate correct crossing events.
No longer take a pre-allocated GdkEvent as parameter. Instead,
allocate events as needed and append them to the queue. (This is
different from how gdk_event_translate() in the X11 backend
works.) This change made the code much clearer, especially in the
cases where we have to generate several GDK events for one Windows
message. Return FALSE if DefWindowProc() should be called, TRUE
if not. If DefWindowProc() should not be called, also return the
value to be returned from the window procedure.
(Previously, the interaction with gdk_event_translate()'s caller
was much more complex, when we had to indicate whether the
already-queued event should be left in the queue or removed, and
in addition also had to indicate whether to call DefWindowProc()
or not, and what value to return from the window procedure if
not.)
Don't use a separate "private" variable required to be pointing to
the GdkWindowObject of the "window" variable at all times. Just
use casts, even if looks a bit uglier.
Notice destroyed windows as early as possible, and break out of
the messsage switch.
Use _gdk_pointer_root as current_window when the pointer is
outside GDK's top-level windows.
On WM_INPUTLANGCHANGE, set _gdk_input_locale_is_ime as
appropriate, based on ImmIsIME().
(gdk_event_translate, gdk_event_send_client_message_for_display,
gdk_screen_broadcast_client_message): Implement client messages.
Use a registered Windows message to pass GDK client messages. Note
that the amount of user data is restricted to four bytes, as it is
carried in the LPARAM. (The WPARAM is used for the message type
"atom".)
(real_window_procedure): Adapt for new gdk_event_translate()
interface.
* gdk/win32/gdkmain-win32.c (_gdk_windowing_init): Set
_gdk_input_locale_is_ime initially.
* gdk/win32/gdkwindow-win32.c: Use g_object_ref()/unref() instead
of g_colormap_ref()/unref().
(gdk_window_new): Made code a bit more like the X11 one, pretend
to handle screens (although we just have one for now).
* gdk/x11/gdkevents-x11.c
(gdk_event_send_client_message_for_display,
gdk_screen_broadcast_client_message): Document the user data
limitation on Win32.
* gdk/win32/gdkevents-win32.c (print_event): More complete enter
and leave notify detail output.
* gdk/win32/gdkkeys-win32.c (update_keymap): Make dead keys
visible to GDK and GTK. Store the corresponding GDK_dead_* keysym
for those, so that the GtkIMContextCimple compose tables will
work. Deduce if the keyboard layout has the AltGr key, and set the
above flag accordingly.
2003-07-26 01:54:59 +00:00
|
|
|
|
2005-03-16 02:21:14 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("_gdk_root=%p\n", GDK_WINDOW_HWND (_gdk_root)));
|
gdk/win32/gdkprivate-win32.h Rename all global variables and functions to
2002-11-12 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate-win32.h
* gdk/win32/*.c: Rename all global variables and functions to
start with underscore.
Merge from stable:
More work on the Win32 backend. The cause of some scrolling
problems was that SetWindowPos() and ScrollWindowEx() don't blit
those parts of the window they think are invalid. As we didn't
keep Windows's update region in synch with GDK's, Windows thought
those areas that in fact had been updated were invalid. Calling
ValidateRgn() in _gdk_windowing_window_queue_antiexpose() seems to
be an elegant and efficient solution, removing from Windows's
update region those areas we are about to repaint proactively.
In some cases garbage leftover values were used for the clip
origin in GdkGCWin32. This showed up as odd blank areas around the
pixmaps included in the Text Widget in gtk-demo.
Having the clip region either as a GdkRegion or a HRGN in
GdkGCWin32 was unnecessary, it's better to just use a HRGN.
The translation and antiexpose queue handling in
gdkgeometry-win32.c seems unnecessary (and not implementable in
the same way as on X11 anyway, no serial numbers) on Windows,
ifdeffed out.
Don't (try to) do guffaw scrolling as there is no static window
gravity on Windows. Guffaw scrolling would be unnecessary anyway,
as there is the ScrollWindow() API. This improves the behaviour of
the Text Widget demo in gtk-demo a lot. But I have no idea how the
lack of static win gravity should be handled in other places where
the X11 code uses it. Especially _gdk_window_move_resize_child().
There is still some problem in expose handling. By moving an
obscuring window back and forth over testgtk's main window, for
instance, every now and then you typically get narrow vertical or
horizontal strips of pixels that haven't been properly redrawn
after being exposed. A fencepost error somewhere?
Otherwise, all of testgtk and gtk-demo except "big windows" now
seem to work pretty well.
Bug #79720 should be fixed now.
* gdk/win32/gdkcolor-win32.c (gdk_win32_color_to_string,
gdk_win32_print_paletteentries, gdk_win32_print_system_palette,
gdk_win32_print_hpalette)
* gdk/win32/gdkdrawable-win32.c (gdk_win32_drawable_description)
* gdk/win32/gdkevents-win32.c (gdk_win32_message_name):
Move all debugging helper functions to gdkmain-win32.c.
* gdk/win32/gdkdrawable-win32.c (_gdk_win32_draw_tiles):
Rewrite. Make static. Must take tile origin parameters, too.
(gdk_win32_draw_rectangle): Pass the tile/stipple origin to
_gdk_win32_draw_tiles(). Remove #if 0 code.
(blit_inside_window): Don't call ScrollDC(), that didn't work at
all like I thought. A simple call to BitBlt() is enough.
* gdk/win32/gdkevents-win32.c (gdk_event_translate) Remove unused
latin_locale_loaded variable.
(_gdk_win32_get_next_tick): New function. Used to make sure
timestamps of events are always increasing, both in events
generated from the window procedure and in events gotten via
PeekMessage(). Not sure whether this is actually useful, but it
seemed as a good idea.
(real_window_procedure): Don't use a local GdkEventPrivate
variable. Don't attempt any compression of configure or expose
events here, handled elsewhere.
(erase_background): Accumulate window offsets when traversing up
the parent chain for GDK_PARENT_RELATIVE_BG, in order to get
correct alignment of background pixmaps. Don't fill with
BLACK_BRUSH if GDK_NO_BG.
(gdk_event_get_graphics_expose): A bit more verbose debugging output.
(gdk_event_translate): Use _gdk_win32_get_next_tick(). In the
WM_PAINT handler, don't check for empty update rect. When we get a
WM_PAINT, the update region isn't empty. And if it for some
strange reason is, that will be handled later anyway. Call
GetUpdateRgn() before calling BeginPaint() and EndPaint() (which
empty the update region).
* gdk/win32/gdkdnd-win32.c
* gdk/win32/gdkinput-win32.c:
Use _gdk_win32_get_next_tick().
* gdk/win32/gdkfont-win32.c: Use %p to print HFONTs.
(gdk_text_size): Remove, unused.
* gdk/win32/gdkgc-win32.c: Set clip origins to zero
when appropriate.
(gdk_gc_copy): Increase refcount on colormap if present.
(gdk_win32_hdc_get): Handle just hcliprgn. If we have a stipple,
combine it with clip region after selecting into the DC.
(_gdk_win32_bitmap_to_hrgn): Rename from _gdk_win32_bitmap_to_region.
(_gdk_win3_gdkregion_to_hrgn): New function, code snippet
extracted from gdk_win32_hdc_get().
* gdk/win32/gdkgeometry-win32.c: Ifdef out the translate_queue
handling.
(gdk_window_copy_area_scroll): Increase clipRect to avoid
ScrollWindowEx() not scrolling pixels it thinks are invalid.
Scroll also children with the ScrollWindowEx() call. No need to
call gdk_window_move() on the children.
(gdk_window_scroll): Don't do guffaw scrolling.
(gdk_window_compute_position): Fix typo, used win32_y where x was
intended.
(gdk_window_premove, gdk_window_postmove,
gdk_window_clip_changed): Add debugging output.
(_gdk_windowing_window_queue_antiexpose): Just call ValidateRgn()
on the region.
(_gdk_window_process_expose): No use for the serial number
parameter now. Instead of a rectangle, take a region parameter, as
Windows gives us one in WM_PAINT.
* gdk/win32/gdkmain-win32.c (_gdk_win32_lbstyle_to_string,
_gdk_win32_pstype_to_string, _gdk_win32_psstyle_to_string,
_gdk_win32_psendcap_to_string, _gdk_win32_psjoin_to_string,
_gdk_win32_rect_to_string, _gdk_win32_gdkrectangle_to_string,
_gdk_win32_gdkregion_to_string): New debugging functions.
(static_printf): Helper function for the above. sprintfs into a
static circular buffer, return value should be used "soon".
* gdk/win32/gdkwindow-win32.c (gdk_propagate_shapes): Plug memory
leak, free list after use.
(gdk_window_gravity_works): Remove, we know that there is no such
thing on Windows.
(gdk_window_set_static_bit_gravity,
gdk_window_set_static_win_gravity): Ditto, remove, they didn't do
anything anyway.
(_gdk_windowing_window_init, gdk_window_foreign_new): Call
_gdk_window_init_position() like in the X11 backend.
(gdk_window_reparent): Don't call the now nonexistent
gdk_window_set_static_win_gravity(). No idea what should be done
instead.
(gdk_window_get_geometry): The returned x and y should be relative
to parent. Used to be always zero..
(gdk_window_set_static_gravities): Return FALSE if trying to set
static gravity.
* gdk/win32/gdkprivate-win32.h: Drop the clip_region field from
GdkGCWin32. Only use the HRGN hcliprgn. Declare new
functions.
* gdk/win32/*.c: Use new debugging functions.
* gdk/win32/rc/gdk.rc.in: Update copyright year.
2002-11-12 22:17:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static const gchar *
|
|
|
|
get_default_title (void)
|
|
|
|
{
|
|
|
|
const char *title;
|
|
|
|
title = g_get_application_name ();
|
|
|
|
if (!title)
|
|
|
|
title = g_get_prgname ();
|
|
|
|
|
|
|
|
return title;
|
2000-07-25 17:31:05 +00:00
|
|
|
}
|
|
|
|
|
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
|
|
|
|
*/
|
2001-10-28 21:28:51 +00:00
|
|
|
static ATOM
|
2007-04-25 23:44:54 +00:00
|
|
|
RegisterGdkClass (GdkWindowType wtype, GdkWindowTypeHint wtype_hint)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2007-04-25 23:44:54 +00:00
|
|
|
static ATOM klassTOPLEVEL = 0;
|
|
|
|
static ATOM klassDIALOG = 0;
|
|
|
|
static ATOM klassCHILD = 0;
|
|
|
|
static ATOM klassTEMP = 0;
|
|
|
|
static ATOM klassTEMPSHADOW = 0;
|
1999-11-11 22:12:27 +00:00
|
|
|
static HICON hAppIcon = NULL;
|
2006-10-28 23:58:30 +00:00
|
|
|
static HICON hAppIconSm = NULL;
|
2006-09-03 22:50:00 +00:00
|
|
|
static WNDCLASSEXW wcl;
|
1999-11-11 22:12:27 +00:00
|
|
|
ATOM klass = 0;
|
|
|
|
|
Massive changes. Too many to list here, but I'll try a summary:
2002-02-17 Tor Lillqvist <tml@iki.fi>
* gdk/win32/*.c: Massive changes. Too many to list here, but I'll
try a summary:
1) Unify GdkPixmap and GdkImage implementation: For each
GdkPixmap, allocate a GdkImage, and vice versa.
GdkPixmapImplWin32Data has a pointer to the GdkImage.
GdkImage::windowing_data is a pointer to the GdkPixmap.
This simplifies many pixmap and image related functions a lot, and
reduces duplicated code snippets. For instance, there is only one
place in gdk/win32 where CreateDIBSection() is called, in the
function _gdk_win32_new_pixmap(). Converting a bitmap (GdkPixmap)
to a Windows region is almost trivial, with the bitmap bits being
readily accessible in the associated GdkImage.
All blitting between GdkPixmaps, GdkWindows and GdkImages goes
through handled the _gdk_win32_blit() function, which calls
different functions to handle the cases of blitting from pixmaps,
inside windows (scrolling), or from windows, which all require
somewhat different handling.
2) Support 256-color mode. This has long been very broken, now it
works more or less OK. Keep the logical palette for each colormap
as small as possible while allocating and freeing colors. Select
and realize the logical palette associated with a GdkColormap into
a DC before drawing or blitting.
When the display is in 256-color mode, make it possible for the
user to override the size of the palette(s) used with either the
GDK_WIN32_MAX_COLORS environment variable, or a -max-colors
command line option. It is possible to reduce the palette size all
the way down to using just the 16 static colors (which causes the
system visual to be of type GDK_VISUAL_STATIC_COLOR. This could
possibly be useful if one desperately wants to avoid color
flashing. (Note that in order for this to work properly, an as of
yet not commited fix to gdkrgb.c is needed.)
Handle the palette messages. On WM_PALETTECHANGED, call
UpdateColors() for the given window hierarchy. Do this only if a
window in some other top-level window hierarchy caused the palette
change (realized a palette). Do this max five times in a row (an
arbitrarily chosen limit), though, otherwise redraw by generating
expose events. On WM_QUERYNEWPALETTE, cause a redraw of the whole
window hierarchy by generating GDK_EXPOSE events.
3) Code cleanup in general. For instance, remove the "emulated"
X11 structs ColormapStruct, Visual and XStandardColormap. Use the
new GDK_DEBUG_* flags for debugging output in the relevant source
files. Remove the unused colormap hash table in gdkcolor-win32.c
4) Plug some resource leaks.
2002-02-14 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkdnd-win32.c (gdk_dropfiles_filter): Use
g_filename_to_uri() to actually create legal URIs in the
text/uri-list data.
2002-02-17 00:25:05 +00:00
|
|
|
wcl.cbSize = sizeof (WNDCLASSEX);
|
1999-11-11 22:12:27 +00:00
|
|
|
wcl.style = 0; /* DON'T set CS_<H,V>REDRAW. It causes total redraw
|
|
|
|
* on WM_SIZE and WM_MOVE. Flicker, Performance!
|
|
|
|
*/
|
2001-10-28 21:28:51 +00:00
|
|
|
wcl.lpfnWndProc = _gdk_win32_window_procedure;
|
1999-11-11 22:12:27 +00:00
|
|
|
wcl.cbClsExtra = 0;
|
|
|
|
wcl.cbWndExtra = 0;
|
gdk/win32/gdkprivate-win32.h Rename all global variables and functions to
2002-11-12 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate-win32.h
* gdk/win32/*.c: Rename all global variables and functions to
start with underscore.
Merge from stable:
More work on the Win32 backend. The cause of some scrolling
problems was that SetWindowPos() and ScrollWindowEx() don't blit
those parts of the window they think are invalid. As we didn't
keep Windows's update region in synch with GDK's, Windows thought
those areas that in fact had been updated were invalid. Calling
ValidateRgn() in _gdk_windowing_window_queue_antiexpose() seems to
be an elegant and efficient solution, removing from Windows's
update region those areas we are about to repaint proactively.
In some cases garbage leftover values were used for the clip
origin in GdkGCWin32. This showed up as odd blank areas around the
pixmaps included in the Text Widget in gtk-demo.
Having the clip region either as a GdkRegion or a HRGN in
GdkGCWin32 was unnecessary, it's better to just use a HRGN.
The translation and antiexpose queue handling in
gdkgeometry-win32.c seems unnecessary (and not implementable in
the same way as on X11 anyway, no serial numbers) on Windows,
ifdeffed out.
Don't (try to) do guffaw scrolling as there is no static window
gravity on Windows. Guffaw scrolling would be unnecessary anyway,
as there is the ScrollWindow() API. This improves the behaviour of
the Text Widget demo in gtk-demo a lot. But I have no idea how the
lack of static win gravity should be handled in other places where
the X11 code uses it. Especially _gdk_window_move_resize_child().
There is still some problem in expose handling. By moving an
obscuring window back and forth over testgtk's main window, for
instance, every now and then you typically get narrow vertical or
horizontal strips of pixels that haven't been properly redrawn
after being exposed. A fencepost error somewhere?
Otherwise, all of testgtk and gtk-demo except "big windows" now
seem to work pretty well.
Bug #79720 should be fixed now.
* gdk/win32/gdkcolor-win32.c (gdk_win32_color_to_string,
gdk_win32_print_paletteentries, gdk_win32_print_system_palette,
gdk_win32_print_hpalette)
* gdk/win32/gdkdrawable-win32.c (gdk_win32_drawable_description)
* gdk/win32/gdkevents-win32.c (gdk_win32_message_name):
Move all debugging helper functions to gdkmain-win32.c.
* gdk/win32/gdkdrawable-win32.c (_gdk_win32_draw_tiles):
Rewrite. Make static. Must take tile origin parameters, too.
(gdk_win32_draw_rectangle): Pass the tile/stipple origin to
_gdk_win32_draw_tiles(). Remove #if 0 code.
(blit_inside_window): Don't call ScrollDC(), that didn't work at
all like I thought. A simple call to BitBlt() is enough.
* gdk/win32/gdkevents-win32.c (gdk_event_translate) Remove unused
latin_locale_loaded variable.
(_gdk_win32_get_next_tick): New function. Used to make sure
timestamps of events are always increasing, both in events
generated from the window procedure and in events gotten via
PeekMessage(). Not sure whether this is actually useful, but it
seemed as a good idea.
(real_window_procedure): Don't use a local GdkEventPrivate
variable. Don't attempt any compression of configure or expose
events here, handled elsewhere.
(erase_background): Accumulate window offsets when traversing up
the parent chain for GDK_PARENT_RELATIVE_BG, in order to get
correct alignment of background pixmaps. Don't fill with
BLACK_BRUSH if GDK_NO_BG.
(gdk_event_get_graphics_expose): A bit more verbose debugging output.
(gdk_event_translate): Use _gdk_win32_get_next_tick(). In the
WM_PAINT handler, don't check for empty update rect. When we get a
WM_PAINT, the update region isn't empty. And if it for some
strange reason is, that will be handled later anyway. Call
GetUpdateRgn() before calling BeginPaint() and EndPaint() (which
empty the update region).
* gdk/win32/gdkdnd-win32.c
* gdk/win32/gdkinput-win32.c:
Use _gdk_win32_get_next_tick().
* gdk/win32/gdkfont-win32.c: Use %p to print HFONTs.
(gdk_text_size): Remove, unused.
* gdk/win32/gdkgc-win32.c: Set clip origins to zero
when appropriate.
(gdk_gc_copy): Increase refcount on colormap if present.
(gdk_win32_hdc_get): Handle just hcliprgn. If we have a stipple,
combine it with clip region after selecting into the DC.
(_gdk_win32_bitmap_to_hrgn): Rename from _gdk_win32_bitmap_to_region.
(_gdk_win3_gdkregion_to_hrgn): New function, code snippet
extracted from gdk_win32_hdc_get().
* gdk/win32/gdkgeometry-win32.c: Ifdef out the translate_queue
handling.
(gdk_window_copy_area_scroll): Increase clipRect to avoid
ScrollWindowEx() not scrolling pixels it thinks are invalid.
Scroll also children with the ScrollWindowEx() call. No need to
call gdk_window_move() on the children.
(gdk_window_scroll): Don't do guffaw scrolling.
(gdk_window_compute_position): Fix typo, used win32_y where x was
intended.
(gdk_window_premove, gdk_window_postmove,
gdk_window_clip_changed): Add debugging output.
(_gdk_windowing_window_queue_antiexpose): Just call ValidateRgn()
on the region.
(_gdk_window_process_expose): No use for the serial number
parameter now. Instead of a rectangle, take a region parameter, as
Windows gives us one in WM_PAINT.
* gdk/win32/gdkmain-win32.c (_gdk_win32_lbstyle_to_string,
_gdk_win32_pstype_to_string, _gdk_win32_psstyle_to_string,
_gdk_win32_psendcap_to_string, _gdk_win32_psjoin_to_string,
_gdk_win32_rect_to_string, _gdk_win32_gdkrectangle_to_string,
_gdk_win32_gdkregion_to_string): New debugging functions.
(static_printf): Helper function for the above. sprintfs into a
static circular buffer, return value should be used "soon".
* gdk/win32/gdkwindow-win32.c (gdk_propagate_shapes): Plug memory
leak, free list after use.
(gdk_window_gravity_works): Remove, we know that there is no such
thing on Windows.
(gdk_window_set_static_bit_gravity,
gdk_window_set_static_win_gravity): Ditto, remove, they didn't do
anything anyway.
(_gdk_windowing_window_init, gdk_window_foreign_new): Call
_gdk_window_init_position() like in the X11 backend.
(gdk_window_reparent): Don't call the now nonexistent
gdk_window_set_static_win_gravity(). No idea what should be done
instead.
(gdk_window_get_geometry): The returned x and y should be relative
to parent. Used to be always zero..
(gdk_window_set_static_gravities): Return FALSE if trying to set
static gravity.
* gdk/win32/gdkprivate-win32.h: Drop the clip_region field from
GdkGCWin32. Only use the HRGN hcliprgn. Declare new
functions.
* gdk/win32/*.c: Use new debugging functions.
* gdk/win32/rc/gdk.rc.in: Update copyright year.
2002-11-12 22:17:48 +00:00
|
|
|
wcl.hInstance = _gdk_app_hmodule;
|
1999-11-11 22:12:27 +00:00
|
|
|
wcl.hIcon = 0;
|
2006-10-28 23:58:30 +00:00
|
|
|
wcl.hIconSm = 0;
|
1999-11-11 22:12:27 +00:00
|
|
|
/* initialize once! */
|
2006-10-28 23:58:30 +00:00
|
|
|
if (0 == hAppIcon && 0 == hAppIconSm)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2002-08-26 20:00:36 +00:00
|
|
|
gchar sLoc [MAX_PATH+1];
|
1999-11-11 22:12:27 +00:00
|
|
|
|
gdk/win32/gdkprivate-win32.h Rename all global variables and functions to
2002-11-12 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate-win32.h
* gdk/win32/*.c: Rename all global variables and functions to
start with underscore.
Merge from stable:
More work on the Win32 backend. The cause of some scrolling
problems was that SetWindowPos() and ScrollWindowEx() don't blit
those parts of the window they think are invalid. As we didn't
keep Windows's update region in synch with GDK's, Windows thought
those areas that in fact had been updated were invalid. Calling
ValidateRgn() in _gdk_windowing_window_queue_antiexpose() seems to
be an elegant and efficient solution, removing from Windows's
update region those areas we are about to repaint proactively.
In some cases garbage leftover values were used for the clip
origin in GdkGCWin32. This showed up as odd blank areas around the
pixmaps included in the Text Widget in gtk-demo.
Having the clip region either as a GdkRegion or a HRGN in
GdkGCWin32 was unnecessary, it's better to just use a HRGN.
The translation and antiexpose queue handling in
gdkgeometry-win32.c seems unnecessary (and not implementable in
the same way as on X11 anyway, no serial numbers) on Windows,
ifdeffed out.
Don't (try to) do guffaw scrolling as there is no static window
gravity on Windows. Guffaw scrolling would be unnecessary anyway,
as there is the ScrollWindow() API. This improves the behaviour of
the Text Widget demo in gtk-demo a lot. But I have no idea how the
lack of static win gravity should be handled in other places where
the X11 code uses it. Especially _gdk_window_move_resize_child().
There is still some problem in expose handling. By moving an
obscuring window back and forth over testgtk's main window, for
instance, every now and then you typically get narrow vertical or
horizontal strips of pixels that haven't been properly redrawn
after being exposed. A fencepost error somewhere?
Otherwise, all of testgtk and gtk-demo except "big windows" now
seem to work pretty well.
Bug #79720 should be fixed now.
* gdk/win32/gdkcolor-win32.c (gdk_win32_color_to_string,
gdk_win32_print_paletteentries, gdk_win32_print_system_palette,
gdk_win32_print_hpalette)
* gdk/win32/gdkdrawable-win32.c (gdk_win32_drawable_description)
* gdk/win32/gdkevents-win32.c (gdk_win32_message_name):
Move all debugging helper functions to gdkmain-win32.c.
* gdk/win32/gdkdrawable-win32.c (_gdk_win32_draw_tiles):
Rewrite. Make static. Must take tile origin parameters, too.
(gdk_win32_draw_rectangle): Pass the tile/stipple origin to
_gdk_win32_draw_tiles(). Remove #if 0 code.
(blit_inside_window): Don't call ScrollDC(), that didn't work at
all like I thought. A simple call to BitBlt() is enough.
* gdk/win32/gdkevents-win32.c (gdk_event_translate) Remove unused
latin_locale_loaded variable.
(_gdk_win32_get_next_tick): New function. Used to make sure
timestamps of events are always increasing, both in events
generated from the window procedure and in events gotten via
PeekMessage(). Not sure whether this is actually useful, but it
seemed as a good idea.
(real_window_procedure): Don't use a local GdkEventPrivate
variable. Don't attempt any compression of configure or expose
events here, handled elsewhere.
(erase_background): Accumulate window offsets when traversing up
the parent chain for GDK_PARENT_RELATIVE_BG, in order to get
correct alignment of background pixmaps. Don't fill with
BLACK_BRUSH if GDK_NO_BG.
(gdk_event_get_graphics_expose): A bit more verbose debugging output.
(gdk_event_translate): Use _gdk_win32_get_next_tick(). In the
WM_PAINT handler, don't check for empty update rect. When we get a
WM_PAINT, the update region isn't empty. And if it for some
strange reason is, that will be handled later anyway. Call
GetUpdateRgn() before calling BeginPaint() and EndPaint() (which
empty the update region).
* gdk/win32/gdkdnd-win32.c
* gdk/win32/gdkinput-win32.c:
Use _gdk_win32_get_next_tick().
* gdk/win32/gdkfont-win32.c: Use %p to print HFONTs.
(gdk_text_size): Remove, unused.
* gdk/win32/gdkgc-win32.c: Set clip origins to zero
when appropriate.
(gdk_gc_copy): Increase refcount on colormap if present.
(gdk_win32_hdc_get): Handle just hcliprgn. If we have a stipple,
combine it with clip region after selecting into the DC.
(_gdk_win32_bitmap_to_hrgn): Rename from _gdk_win32_bitmap_to_region.
(_gdk_win3_gdkregion_to_hrgn): New function, code snippet
extracted from gdk_win32_hdc_get().
* gdk/win32/gdkgeometry-win32.c: Ifdef out the translate_queue
handling.
(gdk_window_copy_area_scroll): Increase clipRect to avoid
ScrollWindowEx() not scrolling pixels it thinks are invalid.
Scroll also children with the ScrollWindowEx() call. No need to
call gdk_window_move() on the children.
(gdk_window_scroll): Don't do guffaw scrolling.
(gdk_window_compute_position): Fix typo, used win32_y where x was
intended.
(gdk_window_premove, gdk_window_postmove,
gdk_window_clip_changed): Add debugging output.
(_gdk_windowing_window_queue_antiexpose): Just call ValidateRgn()
on the region.
(_gdk_window_process_expose): No use for the serial number
parameter now. Instead of a rectangle, take a region parameter, as
Windows gives us one in WM_PAINT.
* gdk/win32/gdkmain-win32.c (_gdk_win32_lbstyle_to_string,
_gdk_win32_pstype_to_string, _gdk_win32_psstyle_to_string,
_gdk_win32_psendcap_to_string, _gdk_win32_psjoin_to_string,
_gdk_win32_rect_to_string, _gdk_win32_gdkrectangle_to_string,
_gdk_win32_gdkregion_to_string): New debugging functions.
(static_printf): Helper function for the above. sprintfs into a
static circular buffer, return value should be used "soon".
* gdk/win32/gdkwindow-win32.c (gdk_propagate_shapes): Plug memory
leak, free list after use.
(gdk_window_gravity_works): Remove, we know that there is no such
thing on Windows.
(gdk_window_set_static_bit_gravity,
gdk_window_set_static_win_gravity): Ditto, remove, they didn't do
anything anyway.
(_gdk_windowing_window_init, gdk_window_foreign_new): Call
_gdk_window_init_position() like in the X11 backend.
(gdk_window_reparent): Don't call the now nonexistent
gdk_window_set_static_win_gravity(). No idea what should be done
instead.
(gdk_window_get_geometry): The returned x and y should be relative
to parent. Used to be always zero..
(gdk_window_set_static_gravities): Return FALSE if trying to set
static gravity.
* gdk/win32/gdkprivate-win32.h: Drop the clip_region field from
GdkGCWin32. Only use the HRGN hcliprgn. Declare new
functions.
* gdk/win32/*.c: Use new debugging functions.
* gdk/win32/rc/gdk.rc.in: Update copyright year.
2002-11-12 22:17:48 +00:00
|
|
|
if (0 != GetModuleFileName (_gdk_app_hmodule, sLoc, MAX_PATH))
|
2006-10-28 23:58:30 +00:00
|
|
|
{
|
|
|
|
ExtractIconEx (sLoc, 0, &hAppIcon, &hAppIconSm, 1);
|
|
|
|
if (0 == hAppIcon && 0 == hAppIconSm)
|
|
|
|
{
|
|
|
|
if (0 != GetModuleFileName (_gdk_dll_hinstance, sLoc, MAX_PATH))
|
|
|
|
ExtractIconEx (sLoc, 0, &hAppIcon, &hAppIconSm, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (0 == hAppIcon && 0 == hAppIconSm)
|
|
|
|
{
|
|
|
|
hAppIcon = LoadImage (NULL, IDI_APPLICATION, IMAGE_ICON,
|
|
|
|
GetSystemMetrics (SM_CXICON),
|
|
|
|
GetSystemMetrics (SM_CYICON), 0);
|
|
|
|
hAppIconSm = LoadImage (NULL, IDI_APPLICATION, IMAGE_ICON,
|
|
|
|
GetSystemMetrics (SM_CXSMICON),
|
|
|
|
GetSystemMetrics (SM_CYSMICON), 0);
|
|
|
|
}
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
2006-10-28 23:58:30 +00:00
|
|
|
if (0 == hAppIcon)
|
|
|
|
hAppIcon = hAppIconSm;
|
|
|
|
else if (0 == hAppIconSm)
|
|
|
|
hAppIconSm = hAppIcon;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
wcl.lpszMenuName = NULL;
|
|
|
|
|
|
|
|
/* initialize once per class */
|
2001-03-10 18:13:03 +00:00
|
|
|
/*
|
|
|
|
* HB: Setting the background brush leads to flicker, because we
|
|
|
|
* don't get asked how to clear the background. This is not what
|
|
|
|
* we want, at least not for input_only windows ...
|
|
|
|
*/
|
1999-11-11 22:12:27 +00:00
|
|
|
#define ONCE_PER_CLASS() \
|
|
|
|
wcl.hIcon = CopyIcon (hAppIcon); \
|
2006-10-28 23:58:30 +00:00
|
|
|
wcl.hIconSm = CopyIcon (hAppIconSm); \
|
Massive changes. Too many to list here, but I'll try a summary:
2002-02-17 Tor Lillqvist <tml@iki.fi>
* gdk/win32/*.c: Massive changes. Too many to list here, but I'll
try a summary:
1) Unify GdkPixmap and GdkImage implementation: For each
GdkPixmap, allocate a GdkImage, and vice versa.
GdkPixmapImplWin32Data has a pointer to the GdkImage.
GdkImage::windowing_data is a pointer to the GdkPixmap.
This simplifies many pixmap and image related functions a lot, and
reduces duplicated code snippets. For instance, there is only one
place in gdk/win32 where CreateDIBSection() is called, in the
function _gdk_win32_new_pixmap(). Converting a bitmap (GdkPixmap)
to a Windows region is almost trivial, with the bitmap bits being
readily accessible in the associated GdkImage.
All blitting between GdkPixmaps, GdkWindows and GdkImages goes
through handled the _gdk_win32_blit() function, which calls
different functions to handle the cases of blitting from pixmaps,
inside windows (scrolling), or from windows, which all require
somewhat different handling.
2) Support 256-color mode. This has long been very broken, now it
works more or less OK. Keep the logical palette for each colormap
as small as possible while allocating and freeing colors. Select
and realize the logical palette associated with a GdkColormap into
a DC before drawing or blitting.
When the display is in 256-color mode, make it possible for the
user to override the size of the palette(s) used with either the
GDK_WIN32_MAX_COLORS environment variable, or a -max-colors
command line option. It is possible to reduce the palette size all
the way down to using just the 16 static colors (which causes the
system visual to be of type GDK_VISUAL_STATIC_COLOR. This could
possibly be useful if one desperately wants to avoid color
flashing. (Note that in order for this to work properly, an as of
yet not commited fix to gdkrgb.c is needed.)
Handle the palette messages. On WM_PALETTECHANGED, call
UpdateColors() for the given window hierarchy. Do this only if a
window in some other top-level window hierarchy caused the palette
change (realized a palette). Do this max five times in a row (an
arbitrarily chosen limit), though, otherwise redraw by generating
expose events. On WM_QUERYNEWPALETTE, cause a redraw of the whole
window hierarchy by generating GDK_EXPOSE events.
3) Code cleanup in general. For instance, remove the "emulated"
X11 structs ColormapStruct, Visual and XStandardColormap. Use the
new GDK_DEBUG_* flags for debugging output in the relevant source
files. Remove the unused colormap hash table in gdkcolor-win32.c
4) Plug some resource leaks.
2002-02-14 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkdnd-win32.c (gdk_dropfiles_filter): Use
g_filename_to_uri() to actually create legal URIs in the
text/uri-list data.
2002-02-17 00:25:05 +00:00
|
|
|
wcl.hbrBackground = NULL; \
|
1999-11-11 22:12:27 +00:00
|
|
|
wcl.hCursor = LoadCursor (NULL, IDC_ARROW);
|
|
|
|
|
|
|
|
switch (wtype)
|
Massive changes. Too many to list here, but I'll try a summary:
2002-02-17 Tor Lillqvist <tml@iki.fi>
* gdk/win32/*.c: Massive changes. Too many to list here, but I'll
try a summary:
1) Unify GdkPixmap and GdkImage implementation: For each
GdkPixmap, allocate a GdkImage, and vice versa.
GdkPixmapImplWin32Data has a pointer to the GdkImage.
GdkImage::windowing_data is a pointer to the GdkPixmap.
This simplifies many pixmap and image related functions a lot, and
reduces duplicated code snippets. For instance, there is only one
place in gdk/win32 where CreateDIBSection() is called, in the
function _gdk_win32_new_pixmap(). Converting a bitmap (GdkPixmap)
to a Windows region is almost trivial, with the bitmap bits being
readily accessible in the associated GdkImage.
All blitting between GdkPixmaps, GdkWindows and GdkImages goes
through handled the _gdk_win32_blit() function, which calls
different functions to handle the cases of blitting from pixmaps,
inside windows (scrolling), or from windows, which all require
somewhat different handling.
2) Support 256-color mode. This has long been very broken, now it
works more or less OK. Keep the logical palette for each colormap
as small as possible while allocating and freeing colors. Select
and realize the logical palette associated with a GdkColormap into
a DC before drawing or blitting.
When the display is in 256-color mode, make it possible for the
user to override the size of the palette(s) used with either the
GDK_WIN32_MAX_COLORS environment variable, or a -max-colors
command line option. It is possible to reduce the palette size all
the way down to using just the 16 static colors (which causes the
system visual to be of type GDK_VISUAL_STATIC_COLOR. This could
possibly be useful if one desperately wants to avoid color
flashing. (Note that in order for this to work properly, an as of
yet not commited fix to gdkrgb.c is needed.)
Handle the palette messages. On WM_PALETTECHANGED, call
UpdateColors() for the given window hierarchy. Do this only if a
window in some other top-level window hierarchy caused the palette
change (realized a palette). Do this max five times in a row (an
arbitrarily chosen limit), though, otherwise redraw by generating
expose events. On WM_QUERYNEWPALETTE, cause a redraw of the whole
window hierarchy by generating GDK_EXPOSE events.
3) Code cleanup in general. For instance, remove the "emulated"
X11 structs ColormapStruct, Visual and XStandardColormap. Use the
new GDK_DEBUG_* flags for debugging output in the relevant source
files. Remove the unused colormap hash table in gdkcolor-win32.c
4) Plug some resource leaks.
2002-02-14 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkdnd-win32.c (gdk_dropfiles_filter): Use
g_filename_to_uri() to actually create legal URIs in the
text/uri-list data.
2002-02-17 00:25:05 +00:00
|
|
|
{
|
|
|
|
case GDK_WINDOW_TOPLEVEL:
|
|
|
|
if (0 == klassTOPLEVEL)
|
|
|
|
{
|
2006-09-03 22:50:00 +00:00
|
|
|
wcl.lpszClassName = L"gdkWindowToplevel";
|
Massive changes. Too many to list here, but I'll try a summary:
2002-02-17 Tor Lillqvist <tml@iki.fi>
* gdk/win32/*.c: Massive changes. Too many to list here, but I'll
try a summary:
1) Unify GdkPixmap and GdkImage implementation: For each
GdkPixmap, allocate a GdkImage, and vice versa.
GdkPixmapImplWin32Data has a pointer to the GdkImage.
GdkImage::windowing_data is a pointer to the GdkPixmap.
This simplifies many pixmap and image related functions a lot, and
reduces duplicated code snippets. For instance, there is only one
place in gdk/win32 where CreateDIBSection() is called, in the
function _gdk_win32_new_pixmap(). Converting a bitmap (GdkPixmap)
to a Windows region is almost trivial, with the bitmap bits being
readily accessible in the associated GdkImage.
All blitting between GdkPixmaps, GdkWindows and GdkImages goes
through handled the _gdk_win32_blit() function, which calls
different functions to handle the cases of blitting from pixmaps,
inside windows (scrolling), or from windows, which all require
somewhat different handling.
2) Support 256-color mode. This has long been very broken, now it
works more or less OK. Keep the logical palette for each colormap
as small as possible while allocating and freeing colors. Select
and realize the logical palette associated with a GdkColormap into
a DC before drawing or blitting.
When the display is in 256-color mode, make it possible for the
user to override the size of the palette(s) used with either the
GDK_WIN32_MAX_COLORS environment variable, or a -max-colors
command line option. It is possible to reduce the palette size all
the way down to using just the 16 static colors (which causes the
system visual to be of type GDK_VISUAL_STATIC_COLOR. This could
possibly be useful if one desperately wants to avoid color
flashing. (Note that in order for this to work properly, an as of
yet not commited fix to gdkrgb.c is needed.)
Handle the palette messages. On WM_PALETTECHANGED, call
UpdateColors() for the given window hierarchy. Do this only if a
window in some other top-level window hierarchy caused the palette
change (realized a palette). Do this max five times in a row (an
arbitrarily chosen limit), though, otherwise redraw by generating
expose events. On WM_QUERYNEWPALETTE, cause a redraw of the whole
window hierarchy by generating GDK_EXPOSE events.
3) Code cleanup in general. For instance, remove the "emulated"
X11 structs ColormapStruct, Visual and XStandardColormap. Use the
new GDK_DEBUG_* flags for debugging output in the relevant source
files. Remove the unused colormap hash table in gdkcolor-win32.c
4) Plug some resource leaks.
2002-02-14 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkdnd-win32.c (gdk_dropfiles_filter): Use
g_filename_to_uri() to actually create legal URIs in the
text/uri-list data.
2002-02-17 00:25:05 +00:00
|
|
|
|
2005-11-02 13:33:27 +00:00
|
|
|
ONCE_PER_CLASS ();
|
2006-09-03 22:50:00 +00:00
|
|
|
klassTOPLEVEL = RegisterClassExW (&wcl);
|
Massive changes. Too many to list here, but I'll try a summary:
2002-02-17 Tor Lillqvist <tml@iki.fi>
* gdk/win32/*.c: Massive changes. Too many to list here, but I'll
try a summary:
1) Unify GdkPixmap and GdkImage implementation: For each
GdkPixmap, allocate a GdkImage, and vice versa.
GdkPixmapImplWin32Data has a pointer to the GdkImage.
GdkImage::windowing_data is a pointer to the GdkPixmap.
This simplifies many pixmap and image related functions a lot, and
reduces duplicated code snippets. For instance, there is only one
place in gdk/win32 where CreateDIBSection() is called, in the
function _gdk_win32_new_pixmap(). Converting a bitmap (GdkPixmap)
to a Windows region is almost trivial, with the bitmap bits being
readily accessible in the associated GdkImage.
All blitting between GdkPixmaps, GdkWindows and GdkImages goes
through handled the _gdk_win32_blit() function, which calls
different functions to handle the cases of blitting from pixmaps,
inside windows (scrolling), or from windows, which all require
somewhat different handling.
2) Support 256-color mode. This has long been very broken, now it
works more or less OK. Keep the logical palette for each colormap
as small as possible while allocating and freeing colors. Select
and realize the logical palette associated with a GdkColormap into
a DC before drawing or blitting.
When the display is in 256-color mode, make it possible for the
user to override the size of the palette(s) used with either the
GDK_WIN32_MAX_COLORS environment variable, or a -max-colors
command line option. It is possible to reduce the palette size all
the way down to using just the 16 static colors (which causes the
system visual to be of type GDK_VISUAL_STATIC_COLOR. This could
possibly be useful if one desperately wants to avoid color
flashing. (Note that in order for this to work properly, an as of
yet not commited fix to gdkrgb.c is needed.)
Handle the palette messages. On WM_PALETTECHANGED, call
UpdateColors() for the given window hierarchy. Do this only if a
window in some other top-level window hierarchy caused the palette
change (realized a palette). Do this max five times in a row (an
arbitrarily chosen limit), though, otherwise redraw by generating
expose events. On WM_QUERYNEWPALETTE, cause a redraw of the whole
window hierarchy by generating GDK_EXPOSE events.
3) Code cleanup in general. For instance, remove the "emulated"
X11 structs ColormapStruct, Visual and XStandardColormap. Use the
new GDK_DEBUG_* flags for debugging output in the relevant source
files. Remove the unused colormap hash table in gdkcolor-win32.c
4) Plug some resource leaks.
2002-02-14 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkdnd-win32.c (gdk_dropfiles_filter): Use
g_filename_to_uri() to actually create legal URIs in the
text/uri-list data.
2002-02-17 00:25: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
|
|
|
{
|
2006-09-03 22:50:00 +00:00
|
|
|
wcl.lpszClassName = L"gdkWindowChild";
|
2000-07-25 17:31:05 +00:00
|
|
|
|
|
|
|
wcl.style |= CS_PARENTDC; /* MSDN: ... enhances system performance. */
|
2005-11-02 13:33:27 +00:00
|
|
|
ONCE_PER_CLASS ();
|
2006-09-03 22:50:00 +00:00
|
|
|
klassCHILD = RegisterClassExW (&wcl);
|
2000-07-25 17:31:05 +00:00
|
|
|
}
|
1999-11-11 22:12:27 +00:00
|
|
|
klass = klassCHILD;
|
|
|
|
break;
|
Massive changes. Too many to list here, but I'll try a summary:
2002-02-17 Tor Lillqvist <tml@iki.fi>
* gdk/win32/*.c: Massive changes. Too many to list here, but I'll
try a summary:
1) Unify GdkPixmap and GdkImage implementation: For each
GdkPixmap, allocate a GdkImage, and vice versa.
GdkPixmapImplWin32Data has a pointer to the GdkImage.
GdkImage::windowing_data is a pointer to the GdkPixmap.
This simplifies many pixmap and image related functions a lot, and
reduces duplicated code snippets. For instance, there is only one
place in gdk/win32 where CreateDIBSection() is called, in the
function _gdk_win32_new_pixmap(). Converting a bitmap (GdkPixmap)
to a Windows region is almost trivial, with the bitmap bits being
readily accessible in the associated GdkImage.
All blitting between GdkPixmaps, GdkWindows and GdkImages goes
through handled the _gdk_win32_blit() function, which calls
different functions to handle the cases of blitting from pixmaps,
inside windows (scrolling), or from windows, which all require
somewhat different handling.
2) Support 256-color mode. This has long been very broken, now it
works more or less OK. Keep the logical palette for each colormap
as small as possible while allocating and freeing colors. Select
and realize the logical palette associated with a GdkColormap into
a DC before drawing or blitting.
When the display is in 256-color mode, make it possible for the
user to override the size of the palette(s) used with either the
GDK_WIN32_MAX_COLORS environment variable, or a -max-colors
command line option. It is possible to reduce the palette size all
the way down to using just the 16 static colors (which causes the
system visual to be of type GDK_VISUAL_STATIC_COLOR. This could
possibly be useful if one desperately wants to avoid color
flashing. (Note that in order for this to work properly, an as of
yet not commited fix to gdkrgb.c is needed.)
Handle the palette messages. On WM_PALETTECHANGED, call
UpdateColors() for the given window hierarchy. Do this only if a
window in some other top-level window hierarchy caused the palette
change (realized a palette). Do this max five times in a row (an
arbitrarily chosen limit), though, otherwise redraw by generating
expose events. On WM_QUERYNEWPALETTE, cause a redraw of the whole
window hierarchy by generating GDK_EXPOSE events.
3) Code cleanup in general. For instance, remove the "emulated"
X11 structs ColormapStruct, Visual and XStandardColormap. Use the
new GDK_DEBUG_* flags for debugging output in the relevant source
files. Remove the unused colormap hash table in gdkcolor-win32.c
4) Plug some resource leaks.
2002-02-14 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkdnd-win32.c (gdk_dropfiles_filter): Use
g_filename_to_uri() to actually create legal URIs in the
text/uri-list data.
2002-02-17 00:25:05 +00:00
|
|
|
|
|
|
|
case GDK_WINDOW_DIALOG:
|
|
|
|
if (0 == klassDIALOG)
|
|
|
|
{
|
2006-09-03 22:50:00 +00:00
|
|
|
wcl.lpszClassName = L"gdkWindowDialog";
|
Massive changes. Too many to list here, but I'll try a summary:
2002-02-17 Tor Lillqvist <tml@iki.fi>
* gdk/win32/*.c: Massive changes. Too many to list here, but I'll
try a summary:
1) Unify GdkPixmap and GdkImage implementation: For each
GdkPixmap, allocate a GdkImage, and vice versa.
GdkPixmapImplWin32Data has a pointer to the GdkImage.
GdkImage::windowing_data is a pointer to the GdkPixmap.
This simplifies many pixmap and image related functions a lot, and
reduces duplicated code snippets. For instance, there is only one
place in gdk/win32 where CreateDIBSection() is called, in the
function _gdk_win32_new_pixmap(). Converting a bitmap (GdkPixmap)
to a Windows region is almost trivial, with the bitmap bits being
readily accessible in the associated GdkImage.
All blitting between GdkPixmaps, GdkWindows and GdkImages goes
through handled the _gdk_win32_blit() function, which calls
different functions to handle the cases of blitting from pixmaps,
inside windows (scrolling), or from windows, which all require
somewhat different handling.
2) Support 256-color mode. This has long been very broken, now it
works more or less OK. Keep the logical palette for each colormap
as small as possible while allocating and freeing colors. Select
and realize the logical palette associated with a GdkColormap into
a DC before drawing or blitting.
When the display is in 256-color mode, make it possible for the
user to override the size of the palette(s) used with either the
GDK_WIN32_MAX_COLORS environment variable, or a -max-colors
command line option. It is possible to reduce the palette size all
the way down to using just the 16 static colors (which causes the
system visual to be of type GDK_VISUAL_STATIC_COLOR. This could
possibly be useful if one desperately wants to avoid color
flashing. (Note that in order for this to work properly, an as of
yet not commited fix to gdkrgb.c is needed.)
Handle the palette messages. On WM_PALETTECHANGED, call
UpdateColors() for the given window hierarchy. Do this only if a
window in some other top-level window hierarchy caused the palette
change (realized a palette). Do this max five times in a row (an
arbitrarily chosen limit), though, otherwise redraw by generating
expose events. On WM_QUERYNEWPALETTE, cause a redraw of the whole
window hierarchy by generating GDK_EXPOSE events.
3) Code cleanup in general. For instance, remove the "emulated"
X11 structs ColormapStruct, Visual and XStandardColormap. Use the
new GDK_DEBUG_* flags for debugging output in the relevant source
files. Remove the unused colormap hash table in gdkcolor-win32.c
4) Plug some resource leaks.
2002-02-14 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkdnd-win32.c (gdk_dropfiles_filter): Use
g_filename_to_uri() to actually create legal URIs in the
text/uri-list data.
2002-02-17 00:25:05 +00:00
|
|
|
wcl.style |= CS_SAVEBITS;
|
2005-11-02 13:33:27 +00:00
|
|
|
ONCE_PER_CLASS ();
|
2006-09-03 22:50:00 +00:00
|
|
|
klassDIALOG = RegisterClassExW (&wcl);
|
Massive changes. Too many to list here, but I'll try a summary:
2002-02-17 Tor Lillqvist <tml@iki.fi>
* gdk/win32/*.c: Massive changes. Too many to list here, but I'll
try a summary:
1) Unify GdkPixmap and GdkImage implementation: For each
GdkPixmap, allocate a GdkImage, and vice versa.
GdkPixmapImplWin32Data has a pointer to the GdkImage.
GdkImage::windowing_data is a pointer to the GdkPixmap.
This simplifies many pixmap and image related functions a lot, and
reduces duplicated code snippets. For instance, there is only one
place in gdk/win32 where CreateDIBSection() is called, in the
function _gdk_win32_new_pixmap(). Converting a bitmap (GdkPixmap)
to a Windows region is almost trivial, with the bitmap bits being
readily accessible in the associated GdkImage.
All blitting between GdkPixmaps, GdkWindows and GdkImages goes
through handled the _gdk_win32_blit() function, which calls
different functions to handle the cases of blitting from pixmaps,
inside windows (scrolling), or from windows, which all require
somewhat different handling.
2) Support 256-color mode. This has long been very broken, now it
works more or less OK. Keep the logical palette for each colormap
as small as possible while allocating and freeing colors. Select
and realize the logical palette associated with a GdkColormap into
a DC before drawing or blitting.
When the display is in 256-color mode, make it possible for the
user to override the size of the palette(s) used with either the
GDK_WIN32_MAX_COLORS environment variable, or a -max-colors
command line option. It is possible to reduce the palette size all
the way down to using just the 16 static colors (which causes the
system visual to be of type GDK_VISUAL_STATIC_COLOR. This could
possibly be useful if one desperately wants to avoid color
flashing. (Note that in order for this to work properly, an as of
yet not commited fix to gdkrgb.c is needed.)
Handle the palette messages. On WM_PALETTECHANGED, call
UpdateColors() for the given window hierarchy. Do this only if a
window in some other top-level window hierarchy caused the palette
change (realized a palette). Do this max five times in a row (an
arbitrarily chosen limit), though, otherwise redraw by generating
expose events. On WM_QUERYNEWPALETTE, cause a redraw of the whole
window hierarchy by generating GDK_EXPOSE events.
3) Code cleanup in general. For instance, remove the "emulated"
X11 structs ColormapStruct, Visual and XStandardColormap. Use the
new GDK_DEBUG_* flags for debugging output in the relevant source
files. Remove the unused colormap hash table in gdkcolor-win32.c
4) Plug some resource leaks.
2002-02-14 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkdnd-win32.c (gdk_dropfiles_filter): Use
g_filename_to_uri() to actually create legal URIs in the
text/uri-list data.
2002-02-17 00:25:05 +00:00
|
|
|
}
|
|
|
|
klass = klassDIALOG;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_WINDOW_TEMP:
|
2007-04-25 23:44:54 +00:00
|
|
|
if ((wtype_hint == GDK_WINDOW_TYPE_HINT_MENU) ||
|
|
|
|
(wtype_hint == GDK_WINDOW_TYPE_HINT_DROPDOWN_MENU) ||
|
|
|
|
(wtype_hint == GDK_WINDOW_TYPE_HINT_POPUP_MENU) ||
|
|
|
|
(wtype_hint == GDK_WINDOW_TYPE_HINT_TOOLTIP))
|
|
|
|
{
|
|
|
|
if (klassTEMPSHADOW == 0)
|
|
|
|
{
|
2007-06-15 15:25:50 +00:00
|
|
|
wcl.lpszClassName = L"gdkWindowTempShadow";
|
2007-04-25 23:44:54 +00:00
|
|
|
wcl.style |= CS_SAVEBITS;
|
2007-06-14 09:41:08 +00:00
|
|
|
if (LOBYTE (g_win32_get_windows_version()) > 0x05 ||
|
|
|
|
LOWORD (g_win32_get_windows_version()) == 0x0105)
|
|
|
|
{
|
|
|
|
/* Windows XP (5.1) or above */
|
|
|
|
wcl.style |= 0x00020000; /* CS_DROPSHADOW */
|
|
|
|
}
|
2007-04-25 23:44:54 +00:00
|
|
|
ONCE_PER_CLASS ();
|
2007-06-15 15:25:50 +00:00
|
|
|
klassTEMPSHADOW = RegisterClassExW (&wcl);
|
2007-04-25 23:44:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
klass = klassTEMPSHADOW;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (klassTEMP == 0)
|
|
|
|
{
|
2007-06-15 15:25:50 +00:00
|
|
|
wcl.lpszClassName = L"gdkWindowTemp";
|
2007-04-25 23:44:54 +00:00
|
|
|
wcl.style |= CS_SAVEBITS;
|
|
|
|
ONCE_PER_CLASS ();
|
2007-06-15 15:25:50 +00:00
|
|
|
klassTEMP = RegisterClassExW (&wcl);
|
2007-04-25 23:44:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
klass = klassTEMP;
|
|
|
|
}
|
Massive changes. Too many to list here, but I'll try a summary:
2002-02-17 Tor Lillqvist <tml@iki.fi>
* gdk/win32/*.c: Massive changes. Too many to list here, but I'll
try a summary:
1) Unify GdkPixmap and GdkImage implementation: For each
GdkPixmap, allocate a GdkImage, and vice versa.
GdkPixmapImplWin32Data has a pointer to the GdkImage.
GdkImage::windowing_data is a pointer to the GdkPixmap.
This simplifies many pixmap and image related functions a lot, and
reduces duplicated code snippets. For instance, there is only one
place in gdk/win32 where CreateDIBSection() is called, in the
function _gdk_win32_new_pixmap(). Converting a bitmap (GdkPixmap)
to a Windows region is almost trivial, with the bitmap bits being
readily accessible in the associated GdkImage.
All blitting between GdkPixmaps, GdkWindows and GdkImages goes
through handled the _gdk_win32_blit() function, which calls
different functions to handle the cases of blitting from pixmaps,
inside windows (scrolling), or from windows, which all require
somewhat different handling.
2) Support 256-color mode. This has long been very broken, now it
works more or less OK. Keep the logical palette for each colormap
as small as possible while allocating and freeing colors. Select
and realize the logical palette associated with a GdkColormap into
a DC before drawing or blitting.
When the display is in 256-color mode, make it possible for the
user to override the size of the palette(s) used with either the
GDK_WIN32_MAX_COLORS environment variable, or a -max-colors
command line option. It is possible to reduce the palette size all
the way down to using just the 16 static colors (which causes the
system visual to be of type GDK_VISUAL_STATIC_COLOR. This could
possibly be useful if one desperately wants to avoid color
flashing. (Note that in order for this to work properly, an as of
yet not commited fix to gdkrgb.c is needed.)
Handle the palette messages. On WM_PALETTECHANGED, call
UpdateColors() for the given window hierarchy. Do this only if a
window in some other top-level window hierarchy caused the palette
change (realized a palette). Do this max five times in a row (an
arbitrarily chosen limit), though, otherwise redraw by generating
expose events. On WM_QUERYNEWPALETTE, cause a redraw of the whole
window hierarchy by generating GDK_EXPOSE events.
3) Code cleanup in general. For instance, remove the "emulated"
X11 structs ColormapStruct, Visual and XStandardColormap. Use the
new GDK_DEBUG_* flags for debugging output in the relevant source
files. Remove the unused colormap hash table in gdkcolor-win32.c
4) Plug some resource leaks.
2002-02-14 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkdnd-win32.c (gdk_dropfiles_filter): Use
g_filename_to_uri() to actually create legal URIs in the
text/uri-list data.
2002-02-17 00:25:05 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
g_assert_not_reached ();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2000-02-13 14:52:47 +00:00
|
|
|
if (klass == 0)
|
|
|
|
{
|
2006-09-03 22:50:00 +00:00
|
|
|
WIN32_API_FAILED ("RegisterClassExW");
|
2000-02-13 14:52:47 +00:00
|
|
|
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
|
|
|
|
2004-08-22 19:16:22 +00:00
|
|
|
static GdkWindow*
|
|
|
|
gdk_window_new_internal (GdkWindow *parent,
|
|
|
|
GdkWindowAttr *attributes,
|
|
|
|
gint attributes_mask,
|
|
|
|
gboolean from_set_skip_taskbar_hint)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2005-03-16 01:38:57 +00:00
|
|
|
HWND hwndNew;
|
Massive changes. Too many to list here, but I'll try a summary:
2002-02-17 Tor Lillqvist <tml@iki.fi>
* gdk/win32/*.c: Massive changes. Too many to list here, but I'll
try a summary:
1) Unify GdkPixmap and GdkImage implementation: For each
GdkPixmap, allocate a GdkImage, and vice versa.
GdkPixmapImplWin32Data has a pointer to the GdkImage.
GdkImage::windowing_data is a pointer to the GdkPixmap.
This simplifies many pixmap and image related functions a lot, and
reduces duplicated code snippets. For instance, there is only one
place in gdk/win32 where CreateDIBSection() is called, in the
function _gdk_win32_new_pixmap(). Converting a bitmap (GdkPixmap)
to a Windows region is almost trivial, with the bitmap bits being
readily accessible in the associated GdkImage.
All blitting between GdkPixmaps, GdkWindows and GdkImages goes
through handled the _gdk_win32_blit() function, which calls
different functions to handle the cases of blitting from pixmaps,
inside windows (scrolling), or from windows, which all require
somewhat different handling.
2) Support 256-color mode. This has long been very broken, now it
works more or less OK. Keep the logical palette for each colormap
as small as possible while allocating and freeing colors. Select
and realize the logical palette associated with a GdkColormap into
a DC before drawing or blitting.
When the display is in 256-color mode, make it possible for the
user to override the size of the palette(s) used with either the
GDK_WIN32_MAX_COLORS environment variable, or a -max-colors
command line option. It is possible to reduce the palette size all
the way down to using just the 16 static colors (which causes the
system visual to be of type GDK_VISUAL_STATIC_COLOR. This could
possibly be useful if one desperately wants to avoid color
flashing. (Note that in order for this to work properly, an as of
yet not commited fix to gdkrgb.c is needed.)
Handle the palette messages. On WM_PALETTECHANGED, call
UpdateColors() for the given window hierarchy. Do this only if a
window in some other top-level window hierarchy caused the palette
change (realized a palette). Do this max five times in a row (an
arbitrarily chosen limit), though, otherwise redraw by generating
expose events. On WM_QUERYNEWPALETTE, cause a redraw of the whole
window hierarchy by generating GDK_EXPOSE events.
3) Code cleanup in general. For instance, remove the "emulated"
X11 structs ColormapStruct, Visual and XStandardColormap. Use the
new GDK_DEBUG_* flags for debugging output in the relevant source
files. Remove the unused colormap hash table in gdkcolor-win32.c
4) Plug some resource leaks.
2002-02-14 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkdnd-win32.c (gdk_dropfiles_filter): Use
g_filename_to_uri() to actually create legal URIs in the
text/uri-list data.
2002-02-17 00:25:05 +00:00
|
|
|
HANDLE hparent;
|
|
|
|
ATOM klass = 0;
|
Move the code that sets the window style and extended window style, and
2002-12-21 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkwindow-win32.c (gdk_window_new): Move the code that
sets the window style and extended window style, and adjusts the
width and height to take the window decorations into account
earlier. The adjusted width and height used to be ignored. Remove
the local x, y, width and height variables, no need to further
confuse the code by having local copies. (Partial fix, I hope, for
#101588)
(gdk_window_move): When moving top-level windows, take title bar
and border width into account, offsetting the coordinates before
calling SetWindowPos().
(gdk_window_set_decorations, gdk_window_set_functions):
Reimplement, taking into account the peculiar semantics of
GDK_DECOR_ALL and GDK_FUNC_ALL. (#79036)
(gdk_window_get_decorations): Implement. (#98981)
(gdk_window_set_type_hint): When setting
GDK_WINDOW_TYPE_HINT_MENU, call gdk_window_set_decorations().
(#79036)
* gdk/gdk.def: Add gdk_window_get_decorations. (#98981)
2002-12-21 23:32:20 +00:00
|
|
|
DWORD dwStyle = 0, dwExStyle;
|
Massive changes. Too many to list here, but I'll try a summary:
2002-02-17 Tor Lillqvist <tml@iki.fi>
* gdk/win32/*.c: Massive changes. Too many to list here, but I'll
try a summary:
1) Unify GdkPixmap and GdkImage implementation: For each
GdkPixmap, allocate a GdkImage, and vice versa.
GdkPixmapImplWin32Data has a pointer to the GdkImage.
GdkImage::windowing_data is a pointer to the GdkPixmap.
This simplifies many pixmap and image related functions a lot, and
reduces duplicated code snippets. For instance, there is only one
place in gdk/win32 where CreateDIBSection() is called, in the
function _gdk_win32_new_pixmap(). Converting a bitmap (GdkPixmap)
to a Windows region is almost trivial, with the bitmap bits being
readily accessible in the associated GdkImage.
All blitting between GdkPixmaps, GdkWindows and GdkImages goes
through handled the _gdk_win32_blit() function, which calls
different functions to handle the cases of blitting from pixmaps,
inside windows (scrolling), or from windows, which all require
somewhat different handling.
2) Support 256-color mode. This has long been very broken, now it
works more or less OK. Keep the logical palette for each colormap
as small as possible while allocating and freeing colors. Select
and realize the logical palette associated with a GdkColormap into
a DC before drawing or blitting.
When the display is in 256-color mode, make it possible for the
user to override the size of the palette(s) used with either the
GDK_WIN32_MAX_COLORS environment variable, or a -max-colors
command line option. It is possible to reduce the palette size all
the way down to using just the 16 static colors (which causes the
system visual to be of type GDK_VISUAL_STATIC_COLOR. This could
possibly be useful if one desperately wants to avoid color
flashing. (Note that in order for this to work properly, an as of
yet not commited fix to gdkrgb.c is needed.)
Handle the palette messages. On WM_PALETTECHANGED, call
UpdateColors() for the given window hierarchy. Do this only if a
window in some other top-level window hierarchy caused the palette
change (realized a palette). Do this max five times in a row (an
arbitrarily chosen limit), though, otherwise redraw by generating
expose events. On WM_QUERYNEWPALETTE, cause a redraw of the whole
window hierarchy by generating GDK_EXPOSE events.
3) Code cleanup in general. For instance, remove the "emulated"
X11 structs ColormapStruct, Visual and XStandardColormap. Use the
new GDK_DEBUG_* flags for debugging output in the relevant source
files. Remove the unused colormap hash table in gdkcolor-win32.c
4) Plug some resource leaks.
2002-02-14 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkdnd-win32.c (gdk_dropfiles_filter): Use
g_filename_to_uri() to actually create legal URIs in the
text/uri-list data.
2002-02-17 00:25:05 +00:00
|
|
|
RECT rect;
|
1999-11-11 22:12:27 +00:00
|
|
|
GdkWindow *window;
|
2005-03-15 02:07:08 +00:00
|
|
|
GdkWindow *orig_parent;
|
2000-07-25 17:31:05 +00:00
|
|
|
GdkWindowObject *private;
|
|
|
|
GdkWindowImplWin32 *impl;
|
|
|
|
GdkDrawableImplWin32 *draw_impl;
|
1999-11-11 22:12:27 +00:00
|
|
|
GdkVisual *visual;
|
Move the code that sets the window style and extended window style, and
2002-12-21 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkwindow-win32.c (gdk_window_new): Move the code that
sets the window style and extended window style, and adjusts the
width and height to take the window decorations into account
earlier. The adjusted width and height used to be ignored. Remove
the local x, y, width and height variables, no need to further
confuse the code by having local copies. (Partial fix, I hope, for
#101588)
(gdk_window_move): When moving top-level windows, take title bar
and border width into account, offsetting the coordinates before
calling SetWindowPos().
(gdk_window_set_decorations, gdk_window_set_functions):
Reimplement, taking into account the peculiar semantics of
GDK_DECOR_ALL and GDK_FUNC_ALL. (#79036)
(gdk_window_get_decorations): Implement. (#98981)
(gdk_window_set_type_hint): When setting
GDK_WINDOW_TYPE_HINT_MENU, call gdk_window_set_decorations().
(#79036)
* gdk/gdk.def: Add gdk_window_get_decorations. (#98981)
2002-12-21 23:32:20 +00:00
|
|
|
const gchar *title;
|
2006-09-03 22:50:00 +00:00
|
|
|
wchar_t *wtitle;
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
gint window_width, window_height;
|
2003-08-08 07:16:16 +00:00
|
|
|
gint offset_x = 0, offset_y = 0;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (attributes != NULL, NULL);
|
|
|
|
|
|
|
|
if (!parent)
|
2005-11-02 13:33:27 +00:00
|
|
|
parent = _gdk_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);
|
|
|
|
|
2005-03-15 02:07:08 +00:00
|
|
|
orig_parent = parent;
|
|
|
|
|
2000-12-30 20:06:14 +00:00
|
|
|
GDK_NOTE (MISC,
|
|
|
|
g_print ("gdk_window_new: %s\n",
|
|
|
|
(attributes->window_type == GDK_WINDOW_TOPLEVEL ? "TOPLEVEL" :
|
|
|
|
(attributes->window_type == GDK_WINDOW_CHILD ? "CHILD" :
|
|
|
|
(attributes->window_type == GDK_WINDOW_DIALOG ? "DIALOG" :
|
|
|
|
(attributes->window_type == GDK_WINDOW_TEMP ? "TEMP" :
|
|
|
|
"???"))))));
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
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
|
|
|
|
2001-10-24 14:15:50 +00:00
|
|
|
/* Windows with a foreign parent are treated as if they are children
|
|
|
|
* of the root window, except for actual creation.
|
|
|
|
*/
|
|
|
|
if (GDK_WINDOW_TYPE (parent) == GDK_WINDOW_FOREIGN)
|
2005-03-16 02:21:14 +00:00
|
|
|
parent = _gdk_root;
|
2001-10-24 14:15:50 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
private->parent = (GdkWindowObject *)parent;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2003-12-10 23:58:23 +00:00
|
|
|
private->accept_focus = TRUE;
|
2004-05-06 02:57:01 +00:00
|
|
|
private->focus_on_map = TRUE;
|
2003-12-10 23:58:23 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
if (attributes_mask & GDK_WA_X)
|
Move the code that sets the window style and extended window style, and
2002-12-21 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkwindow-win32.c (gdk_window_new): Move the code that
sets the window style and extended window style, and adjusts the
width and height to take the window decorations into account
earlier. The adjusted width and height used to be ignored. Remove
the local x, y, width and height variables, no need to further
confuse the code by having local copies. (Partial fix, I hope, for
#101588)
(gdk_window_move): When moving top-level windows, take title bar
and border width into account, offsetting the coordinates before
calling SetWindowPos().
(gdk_window_set_decorations, gdk_window_set_functions):
Reimplement, taking into account the peculiar semantics of
GDK_DECOR_ALL and GDK_FUNC_ALL. (#79036)
(gdk_window_get_decorations): Implement. (#98981)
(gdk_window_set_type_hint): When setting
GDK_WINDOW_TYPE_HINT_MENU, call gdk_window_set_decorations().
(#79036)
* gdk/gdk.def: Add gdk_window_get_decorations. (#98981)
2002-12-21 23:32:20 +00:00
|
|
|
private->x = attributes->x;
|
2000-07-25 17:31:05 +00:00
|
|
|
else
|
Move the code that sets the window style and extended window style, and
2002-12-21 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkwindow-win32.c (gdk_window_new): Move the code that
sets the window style and extended window style, and adjusts the
width and height to take the window decorations into account
earlier. The adjusted width and height used to be ignored. Remove
the local x, y, width and height variables, no need to further
confuse the code by having local copies. (Partial fix, I hope, for
#101588)
(gdk_window_move): When moving top-level windows, take title bar
and border width into account, offsetting the coordinates before
calling SetWindowPos().
(gdk_window_set_decorations, gdk_window_set_functions):
Reimplement, taking into account the peculiar semantics of
GDK_DECOR_ALL and GDK_FUNC_ALL. (#79036)
(gdk_window_get_decorations): Implement. (#98981)
(gdk_window_set_type_hint): When setting
GDK_WINDOW_TYPE_HINT_MENU, call gdk_window_set_decorations().
(#79036)
* gdk/gdk.def: Add gdk_window_get_decorations. (#98981)
2002-12-21 23:32:20 +00:00
|
|
|
private->x = 0;
|
2000-07-25 17:31:05 +00:00
|
|
|
|
|
|
|
if (attributes_mask & GDK_WA_Y)
|
Move the code that sets the window style and extended window style, and
2002-12-21 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkwindow-win32.c (gdk_window_new): Move the code that
sets the window style and extended window style, and adjusts the
width and height to take the window decorations into account
earlier. The adjusted width and height used to be ignored. Remove
the local x, y, width and height variables, no need to further
confuse the code by having local copies. (Partial fix, I hope, for
#101588)
(gdk_window_move): When moving top-level windows, take title bar
and border width into account, offsetting the coordinates before
calling SetWindowPos().
(gdk_window_set_decorations, gdk_window_set_functions):
Reimplement, taking into account the peculiar semantics of
GDK_DECOR_ALL and GDK_FUNC_ALL. (#79036)
(gdk_window_get_decorations): Implement. (#98981)
(gdk_window_set_type_hint): When setting
GDK_WINDOW_TYPE_HINT_MENU, call gdk_window_set_decorations().
(#79036)
* gdk/gdk.def: Add gdk_window_get_decorations. (#98981)
2002-12-21 23:32:20 +00:00
|
|
|
private->y = attributes->y;
|
2000-07-25 17:31:05 +00:00
|
|
|
else if (attributes_mask & GDK_WA_X)
|
Move the code that sets the window style and extended window style, and
2002-12-21 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkwindow-win32.c (gdk_window_new): Move the code that
sets the window style and extended window style, and adjusts the
width and height to take the window decorations into account
earlier. The adjusted width and height used to be ignored. Remove
the local x, y, width and height variables, no need to further
confuse the code by having local copies. (Partial fix, I hope, for
#101588)
(gdk_window_move): When moving top-level windows, take title bar
and border width into account, offsetting the coordinates before
calling SetWindowPos().
(gdk_window_set_decorations, gdk_window_set_functions):
Reimplement, taking into account the peculiar semantics of
GDK_DECOR_ALL and GDK_FUNC_ALL. (#79036)
(gdk_window_get_decorations): Implement. (#98981)
(gdk_window_set_type_hint): When setting
GDK_WINDOW_TYPE_HINT_MENU, call gdk_window_set_decorations().
(#79036)
* gdk/gdk.def: Add gdk_window_get_decorations. (#98981)
2002-12-21 23:32:20 +00:00
|
|
|
private->y = 100; /* ??? We must put it somewhere... */
|
2000-07-25 17:31:05 +00:00
|
|
|
else
|
Move the code that sets the window style and extended window style, and
2002-12-21 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkwindow-win32.c (gdk_window_new): Move the code that
sets the window style and extended window style, and adjusts the
width and height to take the window decorations into account
earlier. The adjusted width and height used to be ignored. Remove
the local x, y, width and height variables, no need to further
confuse the code by having local copies. (Partial fix, I hope, for
#101588)
(gdk_window_move): When moving top-level windows, take title bar
and border width into account, offsetting the coordinates before
calling SetWindowPos().
(gdk_window_set_decorations, gdk_window_set_functions):
Reimplement, taking into account the peculiar semantics of
GDK_DECOR_ALL and GDK_FUNC_ALL. (#79036)
(gdk_window_get_decorations): Implement. (#98981)
(gdk_window_set_type_hint): When setting
GDK_WINDOW_TYPE_HINT_MENU, call gdk_window_set_decorations().
(#79036)
* gdk/gdk.def: Add gdk_window_get_decorations. (#98981)
2002-12-21 23:32:20 +00:00
|
|
|
private->y = 0;
|
2000-07-25 17:31:05 +00:00
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
if (attributes_mask & GDK_WA_VISUAL)
|
|
|
|
visual = attributes->visual;
|
|
|
|
else
|
|
|
|
visual = gdk_visual_get_system ();
|
|
|
|
|
Move the code that sets the window style and extended window style, and
2002-12-21 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkwindow-win32.c (gdk_window_new): Move the code that
sets the window style and extended window style, and adjusts the
width and height to take the window decorations into account
earlier. The adjusted width and height used to be ignored. Remove
the local x, y, width and height variables, no need to further
confuse the code by having local copies. (Partial fix, I hope, for
#101588)
(gdk_window_move): When moving top-level windows, take title bar
and border width into account, offsetting the coordinates before
calling SetWindowPos().
(gdk_window_set_decorations, gdk_window_set_functions):
Reimplement, taking into account the peculiar semantics of
GDK_DECOR_ALL and GDK_FUNC_ALL. (#79036)
(gdk_window_get_decorations): Implement. (#98981)
(gdk_window_set_type_hint): When setting
GDK_WINDOW_TYPE_HINT_MENU, call gdk_window_set_decorations().
(#79036)
* gdk/gdk.def: Add gdk_window_get_decorations. (#98981)
2002-12-21 23:32:20 +00:00
|
|
|
impl->width = (attributes->width > 1) ? (attributes->width) : (1);
|
|
|
|
impl->height = (attributes->height > 1) ? (attributes->height) : (1);
|
|
|
|
impl->extension_events_selected = FALSE;
|
2004-08-06 19:20:42 +00:00
|
|
|
if (attributes->wclass == GDK_INPUT_ONLY)
|
|
|
|
{
|
|
|
|
/* Backwards compatiblity - we've always ignored
|
|
|
|
* attributes->window_type for input-only windows
|
|
|
|
* before
|
|
|
|
*/
|
2005-03-16 02:21:14 +00:00
|
|
|
if (parent == _gdk_root)
|
2004-08-06 19:20:42 +00:00
|
|
|
private->window_type = GDK_WINDOW_TEMP;
|
|
|
|
else
|
|
|
|
private->window_type = GDK_WINDOW_CHILD;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
private->window_type = attributes->window_type;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
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/win32/gdkprivate-win32.h New flags _gdk_input_locale_is_ime and
2003-07-25 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkglobals-win32.c: New flags _gdk_input_locale_is_ime
and _gdk_keyboard_has_altgr.
* gdk/win32/gdkevents-win32.c: Lots of changes. Most important
ones detailled here.
Code that has been ifdeffed out for a long time removed. Remove
some really old doc comments that were left behind for some public
functions, the official ones are in the X11 backend anyway. Change
GDK_WINDOW_OBJECT() calls to GdkWindowObject casts. Reformat
multi-line boolean expressions to have the operators at ends of
lines.
As mouse capture with SetCapture() indeed seems to work OK, no
need to have the correspoinding macro USE_SETCAPTURE and ifdefs.
Ifdef out the gdk-ping-msg stuff. I don't remember why it was
needed at some time, and things seem to work fine now without
(knock on wood).
Ifdef out the search for some Latin locale keyboard layout being
loaded. Not used currently, but might be needed after all, if we
decide that we want to be able to generate ASCII control character
events with a non-Latin keyboard.
(assign_object): New helper function, handles the g_object_ref()
and unref() calls when assigning GObject pointers.
(generate_crossing_events): Also generate the GDK_NOTIFY_INTERIOR
enter event when the pointer has moved to an ancestor window. Was
left out by mistake.
(gdk_window_is_ancestor): Renamed from gdk_window_is_child().
(gdk_pointer_grab, gdk_pointer_ungrab): Implement the confine_to
functionality, using ClipCursor().
(find_window_for_mouse_event): Splice part of code into new
function find_real_window_for_grabbed_mouse_event().
(fixup_event, append_event, apply_filters): New functions, code
refactored out from elsewhere.
(synthesize_enter_or_leave_event, synthesize_leave_event,
synthesize_enter_event,
synthesize_leave_events,synthesize_enter_events): Also take a
GdkCrossingMode parameter, in preparation to generating
GDK_CROSSING_GRAB and GDK_CROSSING_UNGRAB events.
(fixup_event, append_event, fill_key_event_string): New functions,
code refactoring.
(vk_from_char, build_keypress_event, build_keyrelease_event):
Removed as part of dropping WM_CHAR handling.
(build_key_event_state,gdk_event_translate): Call
GetKeyboardState(), once, for each keyboard message, instead of
several calls to GetKeyState() here and there.
(gdk_event_translate): Fix bugs #104516, #104662, #115902. While
at it, do some major refactoring, and some fixes for potential
problems noticed while going through the code.
Don't handle WM_CHAR at all. Only handle WM_KEYDOWN and
WM_KEYUP. Don't need the state variables related to whether to
wait for WM_CHAR or not, and whether the current key is
AltGr. Remove lots of complexity. Thus don't need the
use_ime_composition flag.
Not handling WM_CHAR means dead key handling will have to be taken
care of by GTK, but that seems to work fine, so no worry.
Another side-effect is that Alt+keypad digits don't work any
longer, but it's better to learn to use GTK's ISO14755 support is
anyway.
Be more careful in checking whether AltGr is involved. Only
attempt to handle it if the keyboard actually has it. And
explicitly check for *left* Control plus *right* Alt being
pressed. Still, allow (left) Alt and/or (right) Control with AltGr
chars.
Handle keys using similar code as in the X11 backend. As we have
built a keymap in gdkkeys-win32.c anyway, use it by calling
gdk_keymap_translate_keyboard_state() to look up the keysym from
the virtual key code and keyboard state. Build the key event
string in exactly the same way as the X11 backend.
If an IME is being used, don't generate GDK events for keys
between receiving WM_IME_STARTCOMPOSITION and
WM_IME_ENDCOMPOSITION, as those keys are for the IME.
For WM_IME_COMPOSITION, handle all the Unicode chars returned from
the IME, not just the first one.
gdk_event_translate() is still quite complex, could split the
message handler cases out into separate functions.
On mouse events, when the mouse is grabbed, use
find_real_window_for_grabbed_mouse_event() in order to be able to
generate correct crossing events.
No longer take a pre-allocated GdkEvent as parameter. Instead,
allocate events as needed and append them to the queue. (This is
different from how gdk_event_translate() in the X11 backend
works.) This change made the code much clearer, especially in the
cases where we have to generate several GDK events for one Windows
message. Return FALSE if DefWindowProc() should be called, TRUE
if not. If DefWindowProc() should not be called, also return the
value to be returned from the window procedure.
(Previously, the interaction with gdk_event_translate()'s caller
was much more complex, when we had to indicate whether the
already-queued event should be left in the queue or removed, and
in addition also had to indicate whether to call DefWindowProc()
or not, and what value to return from the window procedure if
not.)
Don't use a separate "private" variable required to be pointing to
the GdkWindowObject of the "window" variable at all times. Just
use casts, even if looks a bit uglier.
Notice destroyed windows as early as possible, and break out of
the messsage switch.
Use _gdk_pointer_root as current_window when the pointer is
outside GDK's top-level windows.
On WM_INPUTLANGCHANGE, set _gdk_input_locale_is_ime as
appropriate, based on ImmIsIME().
(gdk_event_translate, gdk_event_send_client_message_for_display,
gdk_screen_broadcast_client_message): Implement client messages.
Use a registered Windows message to pass GDK client messages. Note
that the amount of user data is restricted to four bytes, as it is
carried in the LPARAM. (The WPARAM is used for the message type
"atom".)
(real_window_procedure): Adapt for new gdk_event_translate()
interface.
* gdk/win32/gdkmain-win32.c (_gdk_windowing_init): Set
_gdk_input_locale_is_ime initially.
* gdk/win32/gdkwindow-win32.c: Use g_object_ref()/unref() instead
of g_colormap_ref()/unref().
(gdk_window_new): Made code a bit more like the X11 one, pretend
to handle screens (although we just have one for now).
* gdk/x11/gdkevents-x11.c
(gdk_event_send_client_message_for_display,
gdk_screen_broadcast_client_message): Document the user data
limitation on Win32.
* gdk/win32/gdkevents-win32.c (print_event): More complete enter
and leave notify detail output.
* gdk/win32/gdkkeys-win32.c (update_keymap): Make dead keys
visible to GDK and GTK. Store the corresponding GDK_dead_* keysym
for those, so that the GtkIMContextCimple compose tables will
work. Deduce if the keyboard layout has the AltGr key, and set the
above flag accordingly.
2003-07-26 01:54:59 +00:00
|
|
|
g_object_ref (attributes->colormap);
|
2000-07-25 17:31:05 +00:00
|
|
|
}
|
1999-11-11 22:12:27 +00:00
|
|
|
else
|
2000-07-25 17:31:05 +00:00
|
|
|
{
|
2005-11-02 13:33:27 +00:00
|
|
|
draw_impl->colormap = gdk_screen_get_system_colormap (_gdk_screen);
|
gdk/win32/gdkprivate-win32.h New flags _gdk_input_locale_is_ime and
2003-07-25 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkglobals-win32.c: New flags _gdk_input_locale_is_ime
and _gdk_keyboard_has_altgr.
* gdk/win32/gdkevents-win32.c: Lots of changes. Most important
ones detailled here.
Code that has been ifdeffed out for a long time removed. Remove
some really old doc comments that were left behind for some public
functions, the official ones are in the X11 backend anyway. Change
GDK_WINDOW_OBJECT() calls to GdkWindowObject casts. Reformat
multi-line boolean expressions to have the operators at ends of
lines.
As mouse capture with SetCapture() indeed seems to work OK, no
need to have the correspoinding macro USE_SETCAPTURE and ifdefs.
Ifdef out the gdk-ping-msg stuff. I don't remember why it was
needed at some time, and things seem to work fine now without
(knock on wood).
Ifdef out the search for some Latin locale keyboard layout being
loaded. Not used currently, but might be needed after all, if we
decide that we want to be able to generate ASCII control character
events with a non-Latin keyboard.
(assign_object): New helper function, handles the g_object_ref()
and unref() calls when assigning GObject pointers.
(generate_crossing_events): Also generate the GDK_NOTIFY_INTERIOR
enter event when the pointer has moved to an ancestor window. Was
left out by mistake.
(gdk_window_is_ancestor): Renamed from gdk_window_is_child().
(gdk_pointer_grab, gdk_pointer_ungrab): Implement the confine_to
functionality, using ClipCursor().
(find_window_for_mouse_event): Splice part of code into new
function find_real_window_for_grabbed_mouse_event().
(fixup_event, append_event, apply_filters): New functions, code
refactored out from elsewhere.
(synthesize_enter_or_leave_event, synthesize_leave_event,
synthesize_enter_event,
synthesize_leave_events,synthesize_enter_events): Also take a
GdkCrossingMode parameter, in preparation to generating
GDK_CROSSING_GRAB and GDK_CROSSING_UNGRAB events.
(fixup_event, append_event, fill_key_event_string): New functions,
code refactoring.
(vk_from_char, build_keypress_event, build_keyrelease_event):
Removed as part of dropping WM_CHAR handling.
(build_key_event_state,gdk_event_translate): Call
GetKeyboardState(), once, for each keyboard message, instead of
several calls to GetKeyState() here and there.
(gdk_event_translate): Fix bugs #104516, #104662, #115902. While
at it, do some major refactoring, and some fixes for potential
problems noticed while going through the code.
Don't handle WM_CHAR at all. Only handle WM_KEYDOWN and
WM_KEYUP. Don't need the state variables related to whether to
wait for WM_CHAR or not, and whether the current key is
AltGr. Remove lots of complexity. Thus don't need the
use_ime_composition flag.
Not handling WM_CHAR means dead key handling will have to be taken
care of by GTK, but that seems to work fine, so no worry.
Another side-effect is that Alt+keypad digits don't work any
longer, but it's better to learn to use GTK's ISO14755 support is
anyway.
Be more careful in checking whether AltGr is involved. Only
attempt to handle it if the keyboard actually has it. And
explicitly check for *left* Control plus *right* Alt being
pressed. Still, allow (left) Alt and/or (right) Control with AltGr
chars.
Handle keys using similar code as in the X11 backend. As we have
built a keymap in gdkkeys-win32.c anyway, use it by calling
gdk_keymap_translate_keyboard_state() to look up the keysym from
the virtual key code and keyboard state. Build the key event
string in exactly the same way as the X11 backend.
If an IME is being used, don't generate GDK events for keys
between receiving WM_IME_STARTCOMPOSITION and
WM_IME_ENDCOMPOSITION, as those keys are for the IME.
For WM_IME_COMPOSITION, handle all the Unicode chars returned from
the IME, not just the first one.
gdk_event_translate() is still quite complex, could split the
message handler cases out into separate functions.
On mouse events, when the mouse is grabbed, use
find_real_window_for_grabbed_mouse_event() in order to be able to
generate correct crossing events.
No longer take a pre-allocated GdkEvent as parameter. Instead,
allocate events as needed and append them to the queue. (This is
different from how gdk_event_translate() in the X11 backend
works.) This change made the code much clearer, especially in the
cases where we have to generate several GDK events for one Windows
message. Return FALSE if DefWindowProc() should be called, TRUE
if not. If DefWindowProc() should not be called, also return the
value to be returned from the window procedure.
(Previously, the interaction with gdk_event_translate()'s caller
was much more complex, when we had to indicate whether the
already-queued event should be left in the queue or removed, and
in addition also had to indicate whether to call DefWindowProc()
or not, and what value to return from the window procedure if
not.)
Don't use a separate "private" variable required to be pointing to
the GdkWindowObject of the "window" variable at all times. Just
use casts, even if looks a bit uglier.
Notice destroyed windows as early as possible, and break out of
the messsage switch.
Use _gdk_pointer_root as current_window when the pointer is
outside GDK's top-level windows.
On WM_INPUTLANGCHANGE, set _gdk_input_locale_is_ime as
appropriate, based on ImmIsIME().
(gdk_event_translate, gdk_event_send_client_message_for_display,
gdk_screen_broadcast_client_message): Implement client messages.
Use a registered Windows message to pass GDK client messages. Note
that the amount of user data is restricted to four bytes, as it is
carried in the LPARAM. (The WPARAM is used for the message type
"atom".)
(real_window_procedure): Adapt for new gdk_event_translate()
interface.
* gdk/win32/gdkmain-win32.c (_gdk_windowing_init): Set
_gdk_input_locale_is_ime initially.
* gdk/win32/gdkwindow-win32.c: Use g_object_ref()/unref() instead
of g_colormap_ref()/unref().
(gdk_window_new): Made code a bit more like the X11 one, pretend
to handle screens (although we just have one for now).
* gdk/x11/gdkevents-x11.c
(gdk_event_send_client_message_for_display,
gdk_screen_broadcast_client_message): Document the user data
limitation on Win32.
* gdk/win32/gdkevents-win32.c (print_event): More complete enter
and leave notify detail output.
* gdk/win32/gdkkeys-win32.c (update_keymap): Make dead keys
visible to GDK and GTK. Store the corresponding GDK_dead_* keysym
for those, so that the GtkIMContextCimple compose tables will
work. Deduce if the keyboard layout has the AltGr key, and set the
above flag accordingly.
2003-07-26 01:54:59 +00:00
|
|
|
g_object_ref (draw_impl->colormap);
|
2000-07-25 17:31:05 +00:00
|
|
|
}
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-08-30 00:39:01 +00:00
|
|
|
/* I very much doubt using WS_EX_TRANSPARENT actually
|
|
|
|
* corresponds to how X11 InputOnly windows work, but it appears
|
|
|
|
* to work well enough for the actual use cases in gtk.
|
|
|
|
*/
|
1999-11-11 22:12:27 +00:00
|
|
|
dwExStyle = WS_EX_TRANSPARENT;
|
2000-07-25 17:31:05 +00:00
|
|
|
private->depth = 0;
|
|
|
|
private->input_only = TRUE;
|
2005-11-02 13:33:27 +00:00
|
|
|
draw_impl->colormap = gdk_screen_get_system_colormap (_gdk_screen);
|
gdk/win32/gdkprivate-win32.h New flags _gdk_input_locale_is_ime and
2003-07-25 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkglobals-win32.c: New flags _gdk_input_locale_is_ime
and _gdk_keyboard_has_altgr.
* gdk/win32/gdkevents-win32.c: Lots of changes. Most important
ones detailled here.
Code that has been ifdeffed out for a long time removed. Remove
some really old doc comments that were left behind for some public
functions, the official ones are in the X11 backend anyway. Change
GDK_WINDOW_OBJECT() calls to GdkWindowObject casts. Reformat
multi-line boolean expressions to have the operators at ends of
lines.
As mouse capture with SetCapture() indeed seems to work OK, no
need to have the correspoinding macro USE_SETCAPTURE and ifdefs.
Ifdef out the gdk-ping-msg stuff. I don't remember why it was
needed at some time, and things seem to work fine now without
(knock on wood).
Ifdef out the search for some Latin locale keyboard layout being
loaded. Not used currently, but might be needed after all, if we
decide that we want to be able to generate ASCII control character
events with a non-Latin keyboard.
(assign_object): New helper function, handles the g_object_ref()
and unref() calls when assigning GObject pointers.
(generate_crossing_events): Also generate the GDK_NOTIFY_INTERIOR
enter event when the pointer has moved to an ancestor window. Was
left out by mistake.
(gdk_window_is_ancestor): Renamed from gdk_window_is_child().
(gdk_pointer_grab, gdk_pointer_ungrab): Implement the confine_to
functionality, using ClipCursor().
(find_window_for_mouse_event): Splice part of code into new
function find_real_window_for_grabbed_mouse_event().
(fixup_event, append_event, apply_filters): New functions, code
refactored out from elsewhere.
(synthesize_enter_or_leave_event, synthesize_leave_event,
synthesize_enter_event,
synthesize_leave_events,synthesize_enter_events): Also take a
GdkCrossingMode parameter, in preparation to generating
GDK_CROSSING_GRAB and GDK_CROSSING_UNGRAB events.
(fixup_event, append_event, fill_key_event_string): New functions,
code refactoring.
(vk_from_char, build_keypress_event, build_keyrelease_event):
Removed as part of dropping WM_CHAR handling.
(build_key_event_state,gdk_event_translate): Call
GetKeyboardState(), once, for each keyboard message, instead of
several calls to GetKeyState() here and there.
(gdk_event_translate): Fix bugs #104516, #104662, #115902. While
at it, do some major refactoring, and some fixes for potential
problems noticed while going through the code.
Don't handle WM_CHAR at all. Only handle WM_KEYDOWN and
WM_KEYUP. Don't need the state variables related to whether to
wait for WM_CHAR or not, and whether the current key is
AltGr. Remove lots of complexity. Thus don't need the
use_ime_composition flag.
Not handling WM_CHAR means dead key handling will have to be taken
care of by GTK, but that seems to work fine, so no worry.
Another side-effect is that Alt+keypad digits don't work any
longer, but it's better to learn to use GTK's ISO14755 support is
anyway.
Be more careful in checking whether AltGr is involved. Only
attempt to handle it if the keyboard actually has it. And
explicitly check for *left* Control plus *right* Alt being
pressed. Still, allow (left) Alt and/or (right) Control with AltGr
chars.
Handle keys using similar code as in the X11 backend. As we have
built a keymap in gdkkeys-win32.c anyway, use it by calling
gdk_keymap_translate_keyboard_state() to look up the keysym from
the virtual key code and keyboard state. Build the key event
string in exactly the same way as the X11 backend.
If an IME is being used, don't generate GDK events for keys
between receiving WM_IME_STARTCOMPOSITION and
WM_IME_ENDCOMPOSITION, as those keys are for the IME.
For WM_IME_COMPOSITION, handle all the Unicode chars returned from
the IME, not just the first one.
gdk_event_translate() is still quite complex, could split the
message handler cases out into separate functions.
On mouse events, when the mouse is grabbed, use
find_real_window_for_grabbed_mouse_event() in order to be able to
generate correct crossing events.
No longer take a pre-allocated GdkEvent as parameter. Instead,
allocate events as needed and append them to the queue. (This is
different from how gdk_event_translate() in the X11 backend
works.) This change made the code much clearer, especially in the
cases where we have to generate several GDK events for one Windows
message. Return FALSE if DefWindowProc() should be called, TRUE
if not. If DefWindowProc() should not be called, also return the
value to be returned from the window procedure.
(Previously, the interaction with gdk_event_translate()'s caller
was much more complex, when we had to indicate whether the
already-queued event should be left in the queue or removed, and
in addition also had to indicate whether to call DefWindowProc()
or not, and what value to return from the window procedure if
not.)
Don't use a separate "private" variable required to be pointing to
the GdkWindowObject of the "window" variable at all times. Just
use casts, even if looks a bit uglier.
Notice destroyed windows as early as possible, and break out of
the messsage switch.
Use _gdk_pointer_root as current_window when the pointer is
outside GDK's top-level windows.
On WM_INPUTLANGCHANGE, set _gdk_input_locale_is_ime as
appropriate, based on ImmIsIME().
(gdk_event_translate, gdk_event_send_client_message_for_display,
gdk_screen_broadcast_client_message): Implement client messages.
Use a registered Windows message to pass GDK client messages. Note
that the amount of user data is restricted to four bytes, as it is
carried in the LPARAM. (The WPARAM is used for the message type
"atom".)
(real_window_procedure): Adapt for new gdk_event_translate()
interface.
* gdk/win32/gdkmain-win32.c (_gdk_windowing_init): Set
_gdk_input_locale_is_ime initially.
* gdk/win32/gdkwindow-win32.c: Use g_object_ref()/unref() instead
of g_colormap_ref()/unref().
(gdk_window_new): Made code a bit more like the X11 one, pretend
to handle screens (although we just have one for now).
* gdk/x11/gdkevents-x11.c
(gdk_event_send_client_message_for_display,
gdk_screen_broadcast_client_message): Document the user data
limitation on Win32.
* gdk/win32/gdkevents-win32.c (print_event): More complete enter
and leave notify detail output.
* gdk/win32/gdkkeys-win32.c (update_keymap): Make dead keys
visible to GDK and GTK. Store the corresponding GDK_dead_* keysym
for those, so that the GtkIMContextCimple compose tables will
work. Deduce if the keyboard layout has the AltGr key, and set the
above flag accordingly.
2003-07-26 01:54:59 +00:00
|
|
|
g_object_ref (draw_impl->colormap);
|
2005-03-16 01:38:57 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("... GDK_INPUT_ONLY, system colormap"));
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
switch (private->window_type)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
case GDK_WINDOW_TOPLEVEL:
|
2005-03-15 02:07:08 +00:00
|
|
|
case GDK_WINDOW_DIALOG:
|
2005-03-16 02:21:14 +00:00
|
|
|
if (parent != _gdk_root)
|
2005-03-15 02:07:08 +00:00
|
|
|
{
|
|
|
|
g_warning (G_STRLOC ": Toplevel windows must be created as children\n"
|
|
|
|
"of a window of type GDK_WINDOW_ROOT or GDK_WINDOW_FOREIGN");
|
2005-03-16 02:21:14 +00:00
|
|
|
hparent = GetDesktopWindow ();
|
2005-03-15 02:07:08 +00:00
|
|
|
}
|
|
|
|
/* Children of foreign windows aren't toplevel windows */
|
|
|
|
if (GDK_WINDOW_TYPE (orig_parent) == GDK_WINDOW_FOREIGN)
|
|
|
|
{
|
|
|
|
dwStyle = WS_CHILDWINDOW | WS_CLIPCHILDREN;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (private->window_type == GDK_WINDOW_TOPLEVEL)
|
|
|
|
dwStyle = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN;
|
|
|
|
else
|
|
|
|
dwStyle = WS_OVERLAPPED | WS_MINIMIZEBOX | WS_SYSMENU | WS_CAPTION | WS_THICKFRAME | WS_CLIPCHILDREN;
|
|
|
|
|
|
|
|
offset_x = _gdk_offset_x;
|
|
|
|
offset_y = _gdk_offset_y;
|
|
|
|
}
|
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_TEMP:
|
2005-03-15 02:07:08 +00:00
|
|
|
/* A temp window is not necessarily a top level window */
|
2005-03-16 02:21:14 +00:00
|
|
|
dwStyle = (_gdk_root == parent ? WS_POPUP : WS_CHILDWINDOW);
|
2005-03-15 02:07:08 +00:00
|
|
|
dwStyle |= WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
|
1999-11-11 22:12:27 +00:00
|
|
|
dwExStyle |= WS_EX_TOOLWINDOW;
|
2003-08-08 07:16:16 +00:00
|
|
|
offset_x = _gdk_offset_x;
|
|
|
|
offset_y = _gdk_offset_y;
|
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_ROOT:
|
|
|
|
g_error ("cannot make windows of type GDK_WINDOW_ROOT");
|
|
|
|
break;
|
|
|
|
|
Move the code that sets the window style and extended window style, and
2002-12-21 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkwindow-win32.c (gdk_window_new): Move the code that
sets the window style and extended window style, and adjusts the
width and height to take the window decorations into account
earlier. The adjusted width and height used to be ignored. Remove
the local x, y, width and height variables, no need to further
confuse the code by having local copies. (Partial fix, I hope, for
#101588)
(gdk_window_move): When moving top-level windows, take title bar
and border width into account, offsetting the coordinates before
calling SetWindowPos().
(gdk_window_set_decorations, gdk_window_set_functions):
Reimplement, taking into account the peculiar semantics of
GDK_DECOR_ALL and GDK_FUNC_ALL. (#79036)
(gdk_window_get_decorations): Implement. (#98981)
(gdk_window_set_type_hint): When setting
GDK_WINDOW_TYPE_HINT_MENU, call gdk_window_set_decorations().
(#79036)
* gdk/gdk.def: Add gdk_window_get_decorations. (#98981)
2002-12-21 23:32:20 +00:00
|
|
|
default:
|
|
|
|
g_assert_not_reached ();
|
|
|
|
}
|
1999-11-11 22:12:27 +00:00
|
|
|
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
_gdk_window_init_position (GDK_WINDOW (private));
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
if (private->window_type != GDK_WINDOW_CHILD)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
rect.left = rect.top = 0;
|
|
|
|
rect.right = impl->position_info.width;
|
|
|
|
rect.bottom = impl->position_info.height;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
AdjustWindowRectEx (&rect, dwStyle, FALSE, dwExStyle);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
window_width = rect.right - rect.left;
|
|
|
|
window_height = rect.bottom - rect.top;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
window_width = impl->position_info.width;
|
|
|
|
window_height = impl->position_info.height;
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
Move the code that sets the window style and extended window style, and
2002-12-21 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkwindow-win32.c (gdk_window_new): Move the code that
sets the window style and extended window style, and adjusts the
width and height to take the window decorations into account
earlier. The adjusted width and height used to be ignored. Remove
the local x, y, width and height variables, no need to further
confuse the code by having local copies. (Partial fix, I hope, for
#101588)
(gdk_window_move): When moving top-level windows, take title bar
and border width into account, offsetting the coordinates before
calling SetWindowPos().
(gdk_window_set_decorations, gdk_window_set_functions):
Reimplement, taking into account the peculiar semantics of
GDK_DECOR_ALL and GDK_FUNC_ALL. (#79036)
(gdk_window_get_decorations): Implement. (#98981)
(gdk_window_set_type_hint): When setting
GDK_WINDOW_TYPE_HINT_MENU, call gdk_window_set_decorations().
(#79036)
* gdk/gdk.def: Add gdk_window_get_decorations. (#98981)
2002-12-21 23:32:20 +00:00
|
|
|
|
|
|
|
if (attributes_mask & GDK_WA_TITLE)
|
|
|
|
title = attributes->title;
|
1999-11-11 22:12:27 +00:00
|
|
|
else
|
Move the code that sets the window style and extended window style, and
2002-12-21 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkwindow-win32.c (gdk_window_new): Move the code that
sets the window style and extended window style, and adjusts the
width and height to take the window decorations into account
earlier. The adjusted width and height used to be ignored. Remove
the local x, y, width and height variables, no need to further
confuse the code by having local copies. (Partial fix, I hope, for
#101588)
(gdk_window_move): When moving top-level windows, take title bar
and border width into account, offsetting the coordinates before
calling SetWindowPos().
(gdk_window_set_decorations, gdk_window_set_functions):
Reimplement, taking into account the peculiar semantics of
GDK_DECOR_ALL and GDK_FUNC_ALL. (#79036)
(gdk_window_get_decorations): Implement. (#98981)
(gdk_window_set_type_hint): When setting
GDK_WINDOW_TYPE_HINT_MENU, call gdk_window_set_decorations().
(#79036)
* gdk/gdk.def: Add gdk_window_get_decorations. (#98981)
2002-12-21 23:32:20 +00:00
|
|
|
title = get_default_title ();
|
|
|
|
if (!title || !*title)
|
2005-03-15 02:07:08 +00:00
|
|
|
title = "";
|
Move the code that sets the window style and extended window style, and
2002-12-21 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkwindow-win32.c (gdk_window_new): Move the code that
sets the window style and extended window style, and adjusts the
width and height to take the window decorations into account
earlier. The adjusted width and height used to be ignored. Remove
the local x, y, width and height variables, no need to further
confuse the code by having local copies. (Partial fix, I hope, for
#101588)
(gdk_window_move): When moving top-level windows, take title bar
and border width into account, offsetting the coordinates before
calling SetWindowPos().
(gdk_window_set_decorations, gdk_window_set_functions):
Reimplement, taking into account the peculiar semantics of
GDK_DECOR_ALL and GDK_FUNC_ALL. (#79036)
(gdk_window_get_decorations): Implement. (#98981)
(gdk_window_set_type_hint): When setting
GDK_WINDOW_TYPE_HINT_MENU, call gdk_window_set_decorations().
(#79036)
* gdk/gdk.def: Add gdk_window_get_decorations. (#98981)
2002-12-21 23:32:20 +00:00
|
|
|
|
|
|
|
private->event_mask = GDK_STRUCTURE_MASK | attributes->event_mask;
|
|
|
|
|
2007-04-25 23:44:54 +00:00
|
|
|
if (attributes_mask & GDK_WA_TYPE_HINT)
|
|
|
|
impl->type_hint = attributes->type_hint;
|
|
|
|
else
|
|
|
|
impl->type_hint = GDK_WINDOW_TYPE_HINT_NORMAL;
|
|
|
|
|
Move the code that sets the window style and extended window style, and
2002-12-21 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkwindow-win32.c (gdk_window_new): Move the code that
sets the window style and extended window style, and adjusts the
width and height to take the window decorations into account
earlier. The adjusted width and height used to be ignored. Remove
the local x, y, width and height variables, no need to further
confuse the code by having local copies. (Partial fix, I hope, for
#101588)
(gdk_window_move): When moving top-level windows, take title bar
and border width into account, offsetting the coordinates before
calling SetWindowPos().
(gdk_window_set_decorations, gdk_window_set_functions):
Reimplement, taking into account the peculiar semantics of
GDK_DECOR_ALL and GDK_FUNC_ALL. (#79036)
(gdk_window_get_decorations): Implement. (#98981)
(gdk_window_set_type_hint): When setting
GDK_WINDOW_TYPE_HINT_MENU, call gdk_window_set_decorations().
(#79036)
* gdk/gdk.def: Add gdk_window_get_decorations. (#98981)
2002-12-21 23:32:20 +00:00
|
|
|
if (private->parent)
|
|
|
|
private->parent->children = g_list_prepend (private->parent->children, window);
|
|
|
|
|
2007-04-25 23:44:54 +00:00
|
|
|
klass = RegisterGdkClass (private->window_type, impl->type_hint);
|
Move the code that sets the window style and extended window style, and
2002-12-21 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkwindow-win32.c (gdk_window_new): Move the code that
sets the window style and extended window style, and adjusts the
width and height to take the window decorations into account
earlier. The adjusted width and height used to be ignored. Remove
the local x, y, width and height variables, no need to further
confuse the code by having local copies. (Partial fix, I hope, for
#101588)
(gdk_window_move): When moving top-level windows, take title bar
and border width into account, offsetting the coordinates before
calling SetWindowPos().
(gdk_window_set_decorations, gdk_window_set_functions):
Reimplement, taking into account the peculiar semantics of
GDK_DECOR_ALL and GDK_FUNC_ALL. (#79036)
(gdk_window_get_decorations): Implement. (#98981)
(gdk_window_set_type_hint): When setting
GDK_WINDOW_TYPE_HINT_MENU, call gdk_window_set_decorations().
(#79036)
* gdk/gdk.def: Add gdk_window_get_decorations. (#98981)
2002-12-21 23:32:20 +00:00
|
|
|
|
2006-09-03 22:50:00 +00:00
|
|
|
wtitle = g_utf8_to_utf16 (title, -1, NULL, NULL, NULL);
|
|
|
|
|
|
|
|
hwndNew = CreateWindowExW (dwExStyle,
|
|
|
|
MAKEINTRESOURCEW (klass),
|
|
|
|
wtitle,
|
|
|
|
dwStyle,
|
|
|
|
((attributes_mask & GDK_WA_X) ?
|
|
|
|
impl->position_info.x - offset_x : CW_USEDEFAULT),
|
|
|
|
impl->position_info.y - offset_y,
|
|
|
|
window_width, window_height,
|
|
|
|
hparent,
|
|
|
|
NULL,
|
|
|
|
_gdk_app_hmodule,
|
|
|
|
window);
|
2000-10-09 19:49:42 +00:00
|
|
|
if (GDK_WINDOW_HWND (window) != hwndNew)
|
|
|
|
{
|
2005-11-02 13:33:27 +00:00
|
|
|
g_warning ("gdk_window_new: gdk_event_translate::WM_CREATE (%p, %p) HWND mismatch.",
|
|
|
|
GDK_WINDOW_HWND (window),
|
|
|
|
hwndNew);
|
2000-10-09 19:49:42 +00:00
|
|
|
|
|
|
|
/* 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/win32/gdkprivate-win32.h New flags _gdk_input_locale_is_ime and
2003-07-25 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkglobals-win32.c: New flags _gdk_input_locale_is_ime
and _gdk_keyboard_has_altgr.
* gdk/win32/gdkevents-win32.c: Lots of changes. Most important
ones detailled here.
Code that has been ifdeffed out for a long time removed. Remove
some really old doc comments that were left behind for some public
functions, the official ones are in the X11 backend anyway. Change
GDK_WINDOW_OBJECT() calls to GdkWindowObject casts. Reformat
multi-line boolean expressions to have the operators at ends of
lines.
As mouse capture with SetCapture() indeed seems to work OK, no
need to have the correspoinding macro USE_SETCAPTURE and ifdefs.
Ifdef out the gdk-ping-msg stuff. I don't remember why it was
needed at some time, and things seem to work fine now without
(knock on wood).
Ifdef out the search for some Latin locale keyboard layout being
loaded. Not used currently, but might be needed after all, if we
decide that we want to be able to generate ASCII control character
events with a non-Latin keyboard.
(assign_object): New helper function, handles the g_object_ref()
and unref() calls when assigning GObject pointers.
(generate_crossing_events): Also generate the GDK_NOTIFY_INTERIOR
enter event when the pointer has moved to an ancestor window. Was
left out by mistake.
(gdk_window_is_ancestor): Renamed from gdk_window_is_child().
(gdk_pointer_grab, gdk_pointer_ungrab): Implement the confine_to
functionality, using ClipCursor().
(find_window_for_mouse_event): Splice part of code into new
function find_real_window_for_grabbed_mouse_event().
(fixup_event, append_event, apply_filters): New functions, code
refactored out from elsewhere.
(synthesize_enter_or_leave_event, synthesize_leave_event,
synthesize_enter_event,
synthesize_leave_events,synthesize_enter_events): Also take a
GdkCrossingMode parameter, in preparation to generating
GDK_CROSSING_GRAB and GDK_CROSSING_UNGRAB events.
(fixup_event, append_event, fill_key_event_string): New functions,
code refactoring.
(vk_from_char, build_keypress_event, build_keyrelease_event):
Removed as part of dropping WM_CHAR handling.
(build_key_event_state,gdk_event_translate): Call
GetKeyboardState(), once, for each keyboard message, instead of
several calls to GetKeyState() here and there.
(gdk_event_translate): Fix bugs #104516, #104662, #115902. While
at it, do some major refactoring, and some fixes for potential
problems noticed while going through the code.
Don't handle WM_CHAR at all. Only handle WM_KEYDOWN and
WM_KEYUP. Don't need the state variables related to whether to
wait for WM_CHAR or not, and whether the current key is
AltGr. Remove lots of complexity. Thus don't need the
use_ime_composition flag.
Not handling WM_CHAR means dead key handling will have to be taken
care of by GTK, but that seems to work fine, so no worry.
Another side-effect is that Alt+keypad digits don't work any
longer, but it's better to learn to use GTK's ISO14755 support is
anyway.
Be more careful in checking whether AltGr is involved. Only
attempt to handle it if the keyboard actually has it. And
explicitly check for *left* Control plus *right* Alt being
pressed. Still, allow (left) Alt and/or (right) Control with AltGr
chars.
Handle keys using similar code as in the X11 backend. As we have
built a keymap in gdkkeys-win32.c anyway, use it by calling
gdk_keymap_translate_keyboard_state() to look up the keysym from
the virtual key code and keyboard state. Build the key event
string in exactly the same way as the X11 backend.
If an IME is being used, don't generate GDK events for keys
between receiving WM_IME_STARTCOMPOSITION and
WM_IME_ENDCOMPOSITION, as those keys are for the IME.
For WM_IME_COMPOSITION, handle all the Unicode chars returned from
the IME, not just the first one.
gdk_event_translate() is still quite complex, could split the
message handler cases out into separate functions.
On mouse events, when the mouse is grabbed, use
find_real_window_for_grabbed_mouse_event() in order to be able to
generate correct crossing events.
No longer take a pre-allocated GdkEvent as parameter. Instead,
allocate events as needed and append them to the queue. (This is
different from how gdk_event_translate() in the X11 backend
works.) This change made the code much clearer, especially in the
cases where we have to generate several GDK events for one Windows
message. Return FALSE if DefWindowProc() should be called, TRUE
if not. If DefWindowProc() should not be called, also return the
value to be returned from the window procedure.
(Previously, the interaction with gdk_event_translate()'s caller
was much more complex, when we had to indicate whether the
already-queued event should be left in the queue or removed, and
in addition also had to indicate whether to call DefWindowProc()
or not, and what value to return from the window procedure if
not.)
Don't use a separate "private" variable required to be pointing to
the GdkWindowObject of the "window" variable at all times. Just
use casts, even if looks a bit uglier.
Notice destroyed windows as early as possible, and break out of
the messsage switch.
Use _gdk_pointer_root as current_window when the pointer is
outside GDK's top-level windows.
On WM_INPUTLANGCHANGE, set _gdk_input_locale_is_ime as
appropriate, based on ImmIsIME().
(gdk_event_translate, gdk_event_send_client_message_for_display,
gdk_screen_broadcast_client_message): Implement client messages.
Use a registered Windows message to pass GDK client messages. Note
that the amount of user data is restricted to four bytes, as it is
carried in the LPARAM. (The WPARAM is used for the message type
"atom".)
(real_window_procedure): Adapt for new gdk_event_translate()
interface.
* gdk/win32/gdkmain-win32.c (_gdk_windowing_init): Set
_gdk_input_locale_is_ime initially.
* gdk/win32/gdkwindow-win32.c: Use g_object_ref()/unref() instead
of g_colormap_ref()/unref().
(gdk_window_new): Made code a bit more like the X11 one, pretend
to handle screens (although we just have one for now).
* gdk/x11/gdkevents-x11.c
(gdk_event_send_client_message_for_display,
gdk_screen_broadcast_client_message): Document the user data
limitation on Win32.
* gdk/win32/gdkevents-win32.c (print_event): More complete enter
and leave notify detail output.
* gdk/win32/gdkkeys-win32.c (update_keymap): Make dead keys
visible to GDK and GTK. Store the corresponding GDK_dead_* keysym
for those, so that the GtkIMContextCimple compose tables will
work. Deduce if the keyboard layout has the AltGr key, and set the
above flag accordingly.
2003-07-26 01:54:59 +00:00
|
|
|
draw_impl->handle = hwndNew;
|
2000-10-09 19:49:42 +00:00
|
|
|
# endif
|
|
|
|
|
|
|
|
}
|
2005-03-16 01:38:57 +00:00
|
|
|
|
2003-06-30 21:58:24 +00:00
|
|
|
g_object_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
|
|
|
|
2005-03-16 01:38:57 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("... \"%s\" %dx%d@%+d%+d %p = %p\n",
|
2006-09-03 22:50:00 +00:00
|
|
|
title,
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
window_width, window_height,
|
|
|
|
((attributes_mask & GDK_WA_X) ?
|
2003-08-08 07:16:16 +00:00
|
|
|
impl->position_info.x - offset_x: CW_USEDEFAULT),
|
|
|
|
impl->position_info.y - offset_y,
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
hparent,
|
|
|
|
GDK_WINDOW_HWND (window)));
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2006-09-03 22:50:00 +00:00
|
|
|
g_free (wtitle);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
if (draw_impl->handle == NULL)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2006-09-03 22:50:00 +00:00
|
|
|
WIN32_API_FAILED ("CreateWindowExW");
|
gdk/win32/gdkprivate-win32.h New flags _gdk_input_locale_is_ime and
2003-07-25 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkglobals-win32.c: New flags _gdk_input_locale_is_ime
and _gdk_keyboard_has_altgr.
* gdk/win32/gdkevents-win32.c: Lots of changes. Most important
ones detailled here.
Code that has been ifdeffed out for a long time removed. Remove
some really old doc comments that were left behind for some public
functions, the official ones are in the X11 backend anyway. Change
GDK_WINDOW_OBJECT() calls to GdkWindowObject casts. Reformat
multi-line boolean expressions to have the operators at ends of
lines.
As mouse capture with SetCapture() indeed seems to work OK, no
need to have the correspoinding macro USE_SETCAPTURE and ifdefs.
Ifdef out the gdk-ping-msg stuff. I don't remember why it was
needed at some time, and things seem to work fine now without
(knock on wood).
Ifdef out the search for some Latin locale keyboard layout being
loaded. Not used currently, but might be needed after all, if we
decide that we want to be able to generate ASCII control character
events with a non-Latin keyboard.
(assign_object): New helper function, handles the g_object_ref()
and unref() calls when assigning GObject pointers.
(generate_crossing_events): Also generate the GDK_NOTIFY_INTERIOR
enter event when the pointer has moved to an ancestor window. Was
left out by mistake.
(gdk_window_is_ancestor): Renamed from gdk_window_is_child().
(gdk_pointer_grab, gdk_pointer_ungrab): Implement the confine_to
functionality, using ClipCursor().
(find_window_for_mouse_event): Splice part of code into new
function find_real_window_for_grabbed_mouse_event().
(fixup_event, append_event, apply_filters): New functions, code
refactored out from elsewhere.
(synthesize_enter_or_leave_event, synthesize_leave_event,
synthesize_enter_event,
synthesize_leave_events,synthesize_enter_events): Also take a
GdkCrossingMode parameter, in preparation to generating
GDK_CROSSING_GRAB and GDK_CROSSING_UNGRAB events.
(fixup_event, append_event, fill_key_event_string): New functions,
code refactoring.
(vk_from_char, build_keypress_event, build_keyrelease_event):
Removed as part of dropping WM_CHAR handling.
(build_key_event_state,gdk_event_translate): Call
GetKeyboardState(), once, for each keyboard message, instead of
several calls to GetKeyState() here and there.
(gdk_event_translate): Fix bugs #104516, #104662, #115902. While
at it, do some major refactoring, and some fixes for potential
problems noticed while going through the code.
Don't handle WM_CHAR at all. Only handle WM_KEYDOWN and
WM_KEYUP. Don't need the state variables related to whether to
wait for WM_CHAR or not, and whether the current key is
AltGr. Remove lots of complexity. Thus don't need the
use_ime_composition flag.
Not handling WM_CHAR means dead key handling will have to be taken
care of by GTK, but that seems to work fine, so no worry.
Another side-effect is that Alt+keypad digits don't work any
longer, but it's better to learn to use GTK's ISO14755 support is
anyway.
Be more careful in checking whether AltGr is involved. Only
attempt to handle it if the keyboard actually has it. And
explicitly check for *left* Control plus *right* Alt being
pressed. Still, allow (left) Alt and/or (right) Control with AltGr
chars.
Handle keys using similar code as in the X11 backend. As we have
built a keymap in gdkkeys-win32.c anyway, use it by calling
gdk_keymap_translate_keyboard_state() to look up the keysym from
the virtual key code and keyboard state. Build the key event
string in exactly the same way as the X11 backend.
If an IME is being used, don't generate GDK events for keys
between receiving WM_IME_STARTCOMPOSITION and
WM_IME_ENDCOMPOSITION, as those keys are for the IME.
For WM_IME_COMPOSITION, handle all the Unicode chars returned from
the IME, not just the first one.
gdk_event_translate() is still quite complex, could split the
message handler cases out into separate functions.
On mouse events, when the mouse is grabbed, use
find_real_window_for_grabbed_mouse_event() in order to be able to
generate correct crossing events.
No longer take a pre-allocated GdkEvent as parameter. Instead,
allocate events as needed and append them to the queue. (This is
different from how gdk_event_translate() in the X11 backend
works.) This change made the code much clearer, especially in the
cases where we have to generate several GDK events for one Windows
message. Return FALSE if DefWindowProc() should be called, TRUE
if not. If DefWindowProc() should not be called, also return the
value to be returned from the window procedure.
(Previously, the interaction with gdk_event_translate()'s caller
was much more complex, when we had to indicate whether the
already-queued event should be left in the queue or removed, and
in addition also had to indicate whether to call DefWindowProc()
or not, and what value to return from the window procedure if
not.)
Don't use a separate "private" variable required to be pointing to
the GdkWindowObject of the "window" variable at all times. Just
use casts, even if looks a bit uglier.
Notice destroyed windows as early as possible, and break out of
the messsage switch.
Use _gdk_pointer_root as current_window when the pointer is
outside GDK's top-level windows.
On WM_INPUTLANGCHANGE, set _gdk_input_locale_is_ime as
appropriate, based on ImmIsIME().
(gdk_event_translate, gdk_event_send_client_message_for_display,
gdk_screen_broadcast_client_message): Implement client messages.
Use a registered Windows message to pass GDK client messages. Note
that the amount of user data is restricted to four bytes, as it is
carried in the LPARAM. (The WPARAM is used for the message type
"atom".)
(real_window_procedure): Adapt for new gdk_event_translate()
interface.
* gdk/win32/gdkmain-win32.c (_gdk_windowing_init): Set
_gdk_input_locale_is_ime initially.
* gdk/win32/gdkwindow-win32.c: Use g_object_ref()/unref() instead
of g_colormap_ref()/unref().
(gdk_window_new): Made code a bit more like the X11 one, pretend
to handle screens (although we just have one for now).
* gdk/x11/gdkevents-x11.c
(gdk_event_send_client_message_for_display,
gdk_screen_broadcast_client_message): Document the user data
limitation on Win32.
* gdk/win32/gdkevents-win32.c (print_event): More complete enter
and leave notify detail output.
* gdk/win32/gdkkeys-win32.c (update_keymap): Make dead keys
visible to GDK and GTK. Store the corresponding GDK_dead_* keysym
for those, so that the GtkIMContextCimple compose tables will
work. Deduce if the keyboard layout has the AltGr key, and set the
above flag accordingly.
2003-07-26 01:54:59 +00:00
|
|
|
g_object_unref (window);
|
1999-11-11 22:12:27 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2004-08-22 19:16:22 +00:00
|
|
|
if (!from_set_skip_taskbar_hint && private->window_type == GDK_WINDOW_TEMP)
|
|
|
|
gdk_window_set_skip_taskbar_hint (window, TRUE);
|
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
gdk_window_set_cursor (window, ((attributes_mask & GDK_WA_CURSOR) ?
|
|
|
|
(attributes->cursor) :
|
|
|
|
NULL));
|
|
|
|
|
|
|
|
return window;
|
|
|
|
}
|
|
|
|
|
2004-08-22 19:16:22 +00:00
|
|
|
GdkWindow*
|
|
|
|
gdk_window_new (GdkWindow *parent,
|
|
|
|
GdkWindowAttr *attributes,
|
|
|
|
gint attributes_mask)
|
|
|
|
{
|
|
|
|
return gdk_window_new_internal (parent, attributes, attributes_mask, FALSE);
|
|
|
|
}
|
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
GdkWindow *
|
Changes multihead reorganizing code for win32 support, mostly from a patch
Wed Jun 5 18:34:47 2002 Owen Taylor <otaylor@redhat.com>
Changes multihead reorganizing code for win32 support,
mostly from a patch by Hans Breuer.
* gdk/gdkcolor.c gdk/x11/gdkcolor-x11.c gdk/gdkcursor.c
gdk/x11/gdkcursor-x11.c gdk/gdkevents.c gdk/x11/gdkevents-x11.c
gdk/gdkfont.c gdk/x11/gdkfont-x11.c gdk/gdkkeys.c
gdk/x11/gdkkeys-x11.c gdk/gdkimage.c gdk/x11/gdkimage-x11.c
gdk/gdkscreen.c gdk/x11/gdkmain-x11.c
gdk/gdkdisplay.c gdk/gdkevents-x11.c gdk/gdkpango.c
gdk/x11/gdkpango-x11.c gdk/gdkselection.c
gdk/x11/gdkselection-x11.c gdk/gdkwindow.c
gdk/x11/gdkwindow-x11.c gdk/gdkvisual.c gdk/x11/gdkvisual-x11.c:
Move port-independent singlehead wrapper functions into
port-independent part of GDK. (#80009)
* gdk/win32/gdkcolor-win32.c gdk/win32/gdkcursor-win32.c
gdk/win32/gdkevents-win32.c gdk/win32/gdkfont-win32.c
gdk/win32/gdkimage-win32.c gdk/win32/gdkkeys-win32.c
gdk/win32/gdkmain-win32.c gdk/win32/gdkproperty-win32.c
gdk/win32/gdkselection-win32.c gdk/win32/gkwindow-win32.c:
Turn singlehead functions into "multihead" functions that ignore
their GdkDisplay or GdkScreen arguments.
* gdk/win32/gdkdrawable-win32.c gdk/win32/gdkevents-win32.c
gdk/win32/gdkinput-win32.c gdk/win32/gdkprivate-win32.h:
Misc multihead-compatibility changes.
* gtk/gtk.def gdk/gdk.def: Update for multihead functions.
* gdk/gdkcolormap.h gdk/gdkvisual.h gdk/x11/gdkcolormap-x11.c
gdk/x11/gdkvisual-x11.c: Remove the screen fields
from the public parts of the colormap/visual structures, add accessors
instead.
* gdk/gdkpixbuf-render.c gdk/gdkpixmap.c gdk/gdkrgb.c
gdk/x11/gdkcolormap-x11.c gdk/x11/gdkimage-x11.c
gdk/x11/gdkimage-x11.c gdk/x11/gdkprivate-x11.h gtk/gtkgc.c
gtk/gtkstyle.c gtk/gtkwidget.c: Use accessors to get the screen
for colormaps, visuals; move the fields into the private
structures for the x11 backend.
* gdk/gdkdisplay.[ch] gdk/x11/gdkdisplay-x11.[ch]
gdk/gdkscreen.[ch] gdk/x11/gdkscreen-x11.c:
Remove virtualization of screen and display functions.
(#79990, patch from Erwann Chenede)
* gdk/win32/gdkdisplay-x11.c gdk/win32/gdkscreen-win32.c
gdk/win32/{Makefile.am, makefile.msc, makefile.mingw}:
New files containing stub implementations of Display,
Screen functions.
* gdk/x11/gdkscreen-x11.[ch] gdk/x11/gdkdisplay-x11.[ch]
gdk/x11/gdkx.h: Clean up function exports and what
headers they are in. (#79954)
* gdk/x11/gdkx.h: Fix macro that was referring to a non-existant
screen->screen_num. (In the patch for #79972, Erwann Chenede)
* gdk/gdkscreen.c gdk/gdkwindow.c gdk/x11/gdkinternals.h
gdk/x11/gdkscreen-x11.c: Fix gdk_screen_get_window_at_pointer()
to use window hooks. (#79972, patch partly from Erwann Chenede)
* gdk/x11/gdkdisplay-x11.c gdk/x11/gdkevents-x11.c: Fix
some warnings.
2002-06-06 00:26:42 +00:00
|
|
|
gdk_window_foreign_new_for_display (GdkDisplay *display,
|
|
|
|
GdkNativeWindow anid)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
GdkWindow *window;
|
2000-07-25 17:31:05 +00:00
|
|
|
GdkWindowObject *private;
|
|
|
|
GdkWindowImplWin32 *impl;
|
|
|
|
GdkDrawableImplWin32 *draw_impl;
|
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
HANDLE parent;
|
|
|
|
RECT rect;
|
|
|
|
POINT point;
|
|
|
|
|
2005-11-02 13:33:27 +00:00
|
|
|
g_return_val_if_fail (display == _gdk_display, NULL);
|
Changes multihead reorganizing code for win32 support, mostly from a patch
Wed Jun 5 18:34:47 2002 Owen Taylor <otaylor@redhat.com>
Changes multihead reorganizing code for win32 support,
mostly from a patch by Hans Breuer.
* gdk/gdkcolor.c gdk/x11/gdkcolor-x11.c gdk/gdkcursor.c
gdk/x11/gdkcursor-x11.c gdk/gdkevents.c gdk/x11/gdkevents-x11.c
gdk/gdkfont.c gdk/x11/gdkfont-x11.c gdk/gdkkeys.c
gdk/x11/gdkkeys-x11.c gdk/gdkimage.c gdk/x11/gdkimage-x11.c
gdk/gdkscreen.c gdk/x11/gdkmain-x11.c
gdk/gdkdisplay.c gdk/gdkevents-x11.c gdk/gdkpango.c
gdk/x11/gdkpango-x11.c gdk/gdkselection.c
gdk/x11/gdkselection-x11.c gdk/gdkwindow.c
gdk/x11/gdkwindow-x11.c gdk/gdkvisual.c gdk/x11/gdkvisual-x11.c:
Move port-independent singlehead wrapper functions into
port-independent part of GDK. (#80009)
* gdk/win32/gdkcolor-win32.c gdk/win32/gdkcursor-win32.c
gdk/win32/gdkevents-win32.c gdk/win32/gdkfont-win32.c
gdk/win32/gdkimage-win32.c gdk/win32/gdkkeys-win32.c
gdk/win32/gdkmain-win32.c gdk/win32/gdkproperty-win32.c
gdk/win32/gdkselection-win32.c gdk/win32/gkwindow-win32.c:
Turn singlehead functions into "multihead" functions that ignore
their GdkDisplay or GdkScreen arguments.
* gdk/win32/gdkdrawable-win32.c gdk/win32/gdkevents-win32.c
gdk/win32/gdkinput-win32.c gdk/win32/gdkprivate-win32.h:
Misc multihead-compatibility changes.
* gtk/gtk.def gdk/gdk.def: Update for multihead functions.
* gdk/gdkcolormap.h gdk/gdkvisual.h gdk/x11/gdkcolormap-x11.c
gdk/x11/gdkvisual-x11.c: Remove the screen fields
from the public parts of the colormap/visual structures, add accessors
instead.
* gdk/gdkpixbuf-render.c gdk/gdkpixmap.c gdk/gdkrgb.c
gdk/x11/gdkcolormap-x11.c gdk/x11/gdkimage-x11.c
gdk/x11/gdkimage-x11.c gdk/x11/gdkprivate-x11.h gtk/gtkgc.c
gtk/gtkstyle.c gtk/gtkwidget.c: Use accessors to get the screen
for colormaps, visuals; move the fields into the private
structures for the x11 backend.
* gdk/gdkdisplay.[ch] gdk/x11/gdkdisplay-x11.[ch]
gdk/gdkscreen.[ch] gdk/x11/gdkscreen-x11.c:
Remove virtualization of screen and display functions.
(#79990, patch from Erwann Chenede)
* gdk/win32/gdkdisplay-x11.c gdk/win32/gdkscreen-win32.c
gdk/win32/{Makefile.am, makefile.msc, makefile.mingw}:
New files containing stub implementations of Display,
Screen functions.
* gdk/x11/gdkscreen-x11.[ch] gdk/x11/gdkdisplay-x11.[ch]
gdk/x11/gdkx.h: Clean up function exports and what
headers they are in. (#79954)
* gdk/x11/gdkx.h: Fix macro that was referring to a non-existant
screen->screen_num. (In the patch for #79972, Erwann Chenede)
* gdk/gdkscreen.c gdk/gdkwindow.c gdk/x11/gdkinternals.h
gdk/x11/gdkscreen-x11.c: Fix gdk_screen_get_window_at_pointer()
to use window hooks. (#79972, patch partly from Erwann Chenede)
* gdk/x11/gdkdisplay-x11.c gdk/x11/gdkevents-x11.c: Fix
some warnings.
2002-06-06 00:26:42 +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);
|
2000-11-12 15:46:55 +00:00
|
|
|
parent = GetParent ((HWND)anid);
|
2000-07-25 17:31:05 +00:00
|
|
|
|
2000-07-25 20:38:35 +00:00
|
|
|
private->parent = gdk_win32_handle_table_lookup ((GdkNativeWindow) parent);
|
2001-10-24 14:15:50 +00:00
|
|
|
if (!private->parent || GDK_WINDOW_TYPE (private->parent) == GDK_WINDOW_FOREIGN)
|
2005-03-16 02:21:14 +00:00
|
|
|
private->parent = (GdkWindowObject *)_gdk_root;
|
2000-07-25 17:31:05 +00:00
|
|
|
|
2001-10-24 14:15:50 +00:00
|
|
|
private->parent->children = g_list_prepend (private->parent->children, window);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
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);
|
2005-03-16 02:21:14 +00:00
|
|
|
if (parent != GetDesktopWindow ())
|
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;
|
Remove the event_mask, it is now in GdkWindowObject.
2002-03-01 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkwindow-win32.h (struct _GdkWindowImplWin32): Remove
the event_mask, it is now in GdkWindowObject.
* gdk/win32/gdkwindow-win32.c: Change accordingly. Set the
GDK_STRUCTURE_MASK in gdk_window_set_events(), as it is always set
in gdk_window_new(), too. (Bug#72921)
* gdk/win32/gdkevents-win32.c: Change accordingly here, too.
(vk_from_char): New function, calculates the virtual keycode
corresponding to the char in a WM_CHAR message.
(build_keypress_event, build_keyrelease_event): Use it.
(build_keypress_event): Call ImmReleaseContext() after using the
input context. This might plug a memory or resource leak.
(build_key_event_state): Remove #if 0 code.
(gdk_event_translate): Actually, it would be preferrable to always
handle just the WM_KEYDOWN and WM_KEYUP messages, not WM_CHAR at
all, and thus drop the contorted logic with ignore_wm_char etc.
* gdk/win32/gdkkeys-win32.c: (gdk_keymap_get_entries_for_keyval):
Debugging output.
(gdk_keymap_translate_keyboard_state): Return correct value. (But
_gtk_key_hash_lookup() doesn't check the return value...)
2002-02-28 23:38:55 +00:00
|
|
|
private->event_mask = GDK_ALL_EVENTS_MASK; /* XXX */
|
2001-03-09 16:43:19 +00:00
|
|
|
if (IsWindowVisible ((HWND) anid))
|
|
|
|
private->state &= (~GDK_WINDOW_STATE_WITHDRAWN);
|
|
|
|
else
|
|
|
|
private->state |= GDK_WINDOW_STATE_WITHDRAWN;
|
2003-11-15 20:35:55 +00:00
|
|
|
if (GetWindowLong ((HWND)anid, GWL_EXSTYLE) & WS_EX_TOPMOST)
|
|
|
|
private->state |= GDK_WINDOW_STATE_ABOVE;
|
|
|
|
else
|
|
|
|
private->state &= (~GDK_WINDOW_STATE_ABOVE);
|
|
|
|
private->state &= (~GDK_WINDOW_STATE_BELOW);
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
private->depth = gdk_visual_get_system ()->depth;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
gdk/win32/gdkprivate-win32.h Rename all global variables and functions to
2002-11-12 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate-win32.h
* gdk/win32/*.c: Rename all global variables and functions to
start with underscore.
Merge from stable:
More work on the Win32 backend. The cause of some scrolling
problems was that SetWindowPos() and ScrollWindowEx() don't blit
those parts of the window they think are invalid. As we didn't
keep Windows's update region in synch with GDK's, Windows thought
those areas that in fact had been updated were invalid. Calling
ValidateRgn() in _gdk_windowing_window_queue_antiexpose() seems to
be an elegant and efficient solution, removing from Windows's
update region those areas we are about to repaint proactively.
In some cases garbage leftover values were used for the clip
origin in GdkGCWin32. This showed up as odd blank areas around the
pixmaps included in the Text Widget in gtk-demo.
Having the clip region either as a GdkRegion or a HRGN in
GdkGCWin32 was unnecessary, it's better to just use a HRGN.
The translation and antiexpose queue handling in
gdkgeometry-win32.c seems unnecessary (and not implementable in
the same way as on X11 anyway, no serial numbers) on Windows,
ifdeffed out.
Don't (try to) do guffaw scrolling as there is no static window
gravity on Windows. Guffaw scrolling would be unnecessary anyway,
as there is the ScrollWindow() API. This improves the behaviour of
the Text Widget demo in gtk-demo a lot. But I have no idea how the
lack of static win gravity should be handled in other places where
the X11 code uses it. Especially _gdk_window_move_resize_child().
There is still some problem in expose handling. By moving an
obscuring window back and forth over testgtk's main window, for
instance, every now and then you typically get narrow vertical or
horizontal strips of pixels that haven't been properly redrawn
after being exposed. A fencepost error somewhere?
Otherwise, all of testgtk and gtk-demo except "big windows" now
seem to work pretty well.
Bug #79720 should be fixed now.
* gdk/win32/gdkcolor-win32.c (gdk_win32_color_to_string,
gdk_win32_print_paletteentries, gdk_win32_print_system_palette,
gdk_win32_print_hpalette)
* gdk/win32/gdkdrawable-win32.c (gdk_win32_drawable_description)
* gdk/win32/gdkevents-win32.c (gdk_win32_message_name):
Move all debugging helper functions to gdkmain-win32.c.
* gdk/win32/gdkdrawable-win32.c (_gdk_win32_draw_tiles):
Rewrite. Make static. Must take tile origin parameters, too.
(gdk_win32_draw_rectangle): Pass the tile/stipple origin to
_gdk_win32_draw_tiles(). Remove #if 0 code.
(blit_inside_window): Don't call ScrollDC(), that didn't work at
all like I thought. A simple call to BitBlt() is enough.
* gdk/win32/gdkevents-win32.c (gdk_event_translate) Remove unused
latin_locale_loaded variable.
(_gdk_win32_get_next_tick): New function. Used to make sure
timestamps of events are always increasing, both in events
generated from the window procedure and in events gotten via
PeekMessage(). Not sure whether this is actually useful, but it
seemed as a good idea.
(real_window_procedure): Don't use a local GdkEventPrivate
variable. Don't attempt any compression of configure or expose
events here, handled elsewhere.
(erase_background): Accumulate window offsets when traversing up
the parent chain for GDK_PARENT_RELATIVE_BG, in order to get
correct alignment of background pixmaps. Don't fill with
BLACK_BRUSH if GDK_NO_BG.
(gdk_event_get_graphics_expose): A bit more verbose debugging output.
(gdk_event_translate): Use _gdk_win32_get_next_tick(). In the
WM_PAINT handler, don't check for empty update rect. When we get a
WM_PAINT, the update region isn't empty. And if it for some
strange reason is, that will be handled later anyway. Call
GetUpdateRgn() before calling BeginPaint() and EndPaint() (which
empty the update region).
* gdk/win32/gdkdnd-win32.c
* gdk/win32/gdkinput-win32.c:
Use _gdk_win32_get_next_tick().
* gdk/win32/gdkfont-win32.c: Use %p to print HFONTs.
(gdk_text_size): Remove, unused.
* gdk/win32/gdkgc-win32.c: Set clip origins to zero
when appropriate.
(gdk_gc_copy): Increase refcount on colormap if present.
(gdk_win32_hdc_get): Handle just hcliprgn. If we have a stipple,
combine it with clip region after selecting into the DC.
(_gdk_win32_bitmap_to_hrgn): Rename from _gdk_win32_bitmap_to_region.
(_gdk_win3_gdkregion_to_hrgn): New function, code snippet
extracted from gdk_win32_hdc_get().
* gdk/win32/gdkgeometry-win32.c: Ifdef out the translate_queue
handling.
(gdk_window_copy_area_scroll): Increase clipRect to avoid
ScrollWindowEx() not scrolling pixels it thinks are invalid.
Scroll also children with the ScrollWindowEx() call. No need to
call gdk_window_move() on the children.
(gdk_window_scroll): Don't do guffaw scrolling.
(gdk_window_compute_position): Fix typo, used win32_y where x was
intended.
(gdk_window_premove, gdk_window_postmove,
gdk_window_clip_changed): Add debugging output.
(_gdk_windowing_window_queue_antiexpose): Just call ValidateRgn()
on the region.
(_gdk_window_process_expose): No use for the serial number
parameter now. Instead of a rectangle, take a region parameter, as
Windows gives us one in WM_PAINT.
* gdk/win32/gdkmain-win32.c (_gdk_win32_lbstyle_to_string,
_gdk_win32_pstype_to_string, _gdk_win32_psstyle_to_string,
_gdk_win32_psendcap_to_string, _gdk_win32_psjoin_to_string,
_gdk_win32_rect_to_string, _gdk_win32_gdkrectangle_to_string,
_gdk_win32_gdkregion_to_string): New debugging functions.
(static_printf): Helper function for the above. sprintfs into a
static circular buffer, return value should be used "soon".
* gdk/win32/gdkwindow-win32.c (gdk_propagate_shapes): Plug memory
leak, free list after use.
(gdk_window_gravity_works): Remove, we know that there is no such
thing on Windows.
(gdk_window_set_static_bit_gravity,
gdk_window_set_static_win_gravity): Ditto, remove, they didn't do
anything anyway.
(_gdk_windowing_window_init, gdk_window_foreign_new): Call
_gdk_window_init_position() like in the X11 backend.
(gdk_window_reparent): Don't call the now nonexistent
gdk_window_set_static_win_gravity(). No idea what should be done
instead.
(gdk_window_get_geometry): The returned x and y should be relative
to parent. Used to be always zero..
(gdk_window_set_static_gravities): Return FALSE if trying to set
static gravity.
* gdk/win32/gdkprivate-win32.h: Drop the clip_region field from
GdkGCWin32. Only use the HRGN hcliprgn. Declare new
functions.
* gdk/win32/*.c: Use new debugging functions.
* gdk/win32/rc/gdk.rc.in: Update copyright year.
2002-11-12 22:17:48 +00:00
|
|
|
_gdk_window_init_position (GDK_WINDOW (private));
|
|
|
|
|
2003-06-30 21:58:24 +00:00
|
|
|
g_object_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
|
|
|
|
2005-03-16 01:38:57 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_foreign_new_for_display: %p: %s@%+d%+d\n",
|
|
|
|
(HWND) anid,
|
|
|
|
_gdk_win32_drawable_description (window),
|
|
|
|
private->x, private->y));
|
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
return window;
|
|
|
|
}
|
|
|
|
|
Add gdk_window_lookup, gdk_window_foreign_new, gdk_pixmap_lookup and
* gdk/gdkwindow.h, gdk/gdkpixmap.h, gdk/x11/gdkx.h,
gdk/x11/gdkwindow-x11.c, gdk/x11/gdkpixmap-x11.c,
gdk/win32/gdkwin32.h, gdk/win32/gdkwindow-win32.c,
gdk/win32/gdkpixmap-win32.c, gdk/linux-fb/gdkfb.h,
gdk/linux-fb/gdkwindow-fb.c, gdk/linux-fb/gdkpixmap-fb.c:
Add gdk_window_lookup, gdk_window_foreign_new, gdk_pixmap_lookup
and gkd_pixmap_foreign_new to the gdk frontend api. (#62063)
* gtk/gtkselection.c: Remove gdk backend dependencies. (#62063)
2001-10-18 20:23:17 +00:00
|
|
|
GdkWindow*
|
|
|
|
gdk_window_lookup (GdkNativeWindow hwnd)
|
|
|
|
{
|
|
|
|
return (GdkWindow*) gdk_win32_handle_table_lookup (hwnd);
|
|
|
|
}
|
|
|
|
|
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;
|
2007-07-12 23:38:30 +00:00
|
|
|
GdkWindowImplWin32 *window_impl = GDK_WINDOW_IMPL_WIN32 (private->impl);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("_gdk_windowing_window_destroy: %p\n",
|
Massive changes. Too many to list here, but I'll try a summary:
2002-02-17 Tor Lillqvist <tml@iki.fi>
* gdk/win32/*.c: Massive changes. Too many to list here, but I'll
try a summary:
1) Unify GdkPixmap and GdkImage implementation: For each
GdkPixmap, allocate a GdkImage, and vice versa.
GdkPixmapImplWin32Data has a pointer to the GdkImage.
GdkImage::windowing_data is a pointer to the GdkPixmap.
This simplifies many pixmap and image related functions a lot, and
reduces duplicated code snippets. For instance, there is only one
place in gdk/win32 where CreateDIBSection() is called, in the
function _gdk_win32_new_pixmap(). Converting a bitmap (GdkPixmap)
to a Windows region is almost trivial, with the bitmap bits being
readily accessible in the associated GdkImage.
All blitting between GdkPixmaps, GdkWindows and GdkImages goes
through handled the _gdk_win32_blit() function, which calls
different functions to handle the cases of blitting from pixmaps,
inside windows (scrolling), or from windows, which all require
somewhat different handling.
2) Support 256-color mode. This has long been very broken, now it
works more or less OK. Keep the logical palette for each colormap
as small as possible while allocating and freeing colors. Select
and realize the logical palette associated with a GdkColormap into
a DC before drawing or blitting.
When the display is in 256-color mode, make it possible for the
user to override the size of the palette(s) used with either the
GDK_WIN32_MAX_COLORS environment variable, or a -max-colors
command line option. It is possible to reduce the palette size all
the way down to using just the 16 static colors (which causes the
system visual to be of type GDK_VISUAL_STATIC_COLOR. This could
possibly be useful if one desperately wants to avoid color
flashing. (Note that in order for this to work properly, an as of
yet not commited fix to gdkrgb.c is needed.)
Handle the palette messages. On WM_PALETTECHANGED, call
UpdateColors() for the given window hierarchy. Do this only if a
window in some other top-level window hierarchy caused the palette
change (realized a palette). Do this max five times in a row (an
arbitrarily chosen limit), though, otherwise redraw by generating
expose events. On WM_QUERYNEWPALETTE, cause a redraw of the whole
window hierarchy by generating GDK_EXPOSE events.
3) Code cleanup in general. For instance, remove the "emulated"
X11 structs ColormapStruct, Visual and XStandardColormap. Use the
new GDK_DEBUG_* flags for debugging output in the relevant source
files. Remove the unused colormap hash table in gdkcolor-win32.c
4) Plug some resource leaks.
2002-02-14 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkdnd-win32.c (gdk_dropfiles_filter): Use
g_filename_to_uri() to actually create legal URIs in the
text/uri-list data.
2002-02-17 00:25: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)
|
2002-08-02 20:22:49 +00:00
|
|
|
_gdk_input_window_destroy (window);
|
2000-05-16 21:27:10 +00:00
|
|
|
|
2007-07-12 23:38:30 +00:00
|
|
|
/* Remove ourself from our transient owner */
|
|
|
|
if (window_impl->transient_owner != NULL)
|
|
|
|
{
|
|
|
|
gdk_window_set_transient_for (window, NULL);
|
|
|
|
}
|
2004-03-13 18:27:56 +00:00
|
|
|
|
|
|
|
if (!recursing && !foreign_destroy)
|
2001-07-28 23:02:02 +00:00
|
|
|
{
|
2005-03-18 01:23:23 +00:00
|
|
|
_gdk_win32_drawable_finish (private->impl);
|
|
|
|
|
2001-07-28 23:02:02 +00:00
|
|
|
private->destroyed = TRUE;
|
|
|
|
DestroyWindow (GDK_WINDOW_HWND (window));
|
|
|
|
}
|
2007-07-12 23:38:30 +00:00
|
|
|
|
2004-08-06 19:20:42 +00:00
|
|
|
gdk_win32_handle_table_remove (GDK_WINDOW_HWND (window));
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
2004-03-13 18:27:56 +00:00
|
|
|
void
|
|
|
|
_gdk_windowing_window_destroy_foreign (GdkWindow *window)
|
|
|
|
{
|
2005-03-16 02:21:14 +00:00
|
|
|
/* It's somebody else's window, but in our hierarchy, so reparent it
|
|
|
|
* to the desktop, and then try to destroy it.
|
2004-03-13 18:27:56 +00:00
|
|
|
*/
|
|
|
|
gdk_window_hide (window);
|
|
|
|
gdk_window_reparent (window, NULL, 0, 0);
|
|
|
|
|
2005-03-16 02:21:14 +00:00
|
|
|
PostMessage (GDK_WINDOW_HWND (window), WM_CLOSE, 0, 0);
|
2004-03-13 18:27:56 +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)
|
|
|
|
{
|
2000-11-12 15:46:55 +00:00
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
1999-11-11 22:12:27 +00:00
|
|
|
|
1999-11-20 01:22:57 +00:00
|
|
|
GDK_NOTE (EVENTS,
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
g_print ("gdk_window_destroy_notify: %p%s\n",
|
Massive changes. Too many to list here, but I'll try a summary:
2002-02-17 Tor Lillqvist <tml@iki.fi>
* gdk/win32/*.c: Massive changes. Too many to list here, but I'll
try a summary:
1) Unify GdkPixmap and GdkImage implementation: For each
GdkPixmap, allocate a GdkImage, and vice versa.
GdkPixmapImplWin32Data has a pointer to the GdkImage.
GdkImage::windowing_data is a pointer to the GdkPixmap.
This simplifies many pixmap and image related functions a lot, and
reduces duplicated code snippets. For instance, there is only one
place in gdk/win32 where CreateDIBSection() is called, in the
function _gdk_win32_new_pixmap(). Converting a bitmap (GdkPixmap)
to a Windows region is almost trivial, with the bitmap bits being
readily accessible in the associated GdkImage.
All blitting between GdkPixmaps, GdkWindows and GdkImages goes
through handled the _gdk_win32_blit() function, which calls
different functions to handle the cases of blitting from pixmaps,
inside windows (scrolling), or from windows, which all require
somewhat different handling.
2) Support 256-color mode. This has long been very broken, now it
works more or less OK. Keep the logical palette for each colormap
as small as possible while allocating and freeing colors. Select
and realize the logical palette associated with a GdkColormap into
a DC before drawing or blitting.
When the display is in 256-color mode, make it possible for the
user to override the size of the palette(s) used with either the
GDK_WIN32_MAX_COLORS environment variable, or a -max-colors
command line option. It is possible to reduce the palette size all
the way down to using just the 16 static colors (which causes the
system visual to be of type GDK_VISUAL_STATIC_COLOR. This could
possibly be useful if one desperately wants to avoid color
flashing. (Note that in order for this to work properly, an as of
yet not commited fix to gdkrgb.c is needed.)
Handle the palette messages. On WM_PALETTECHANGED, call
UpdateColors() for the given window hierarchy. Do this only if a
window in some other top-level window hierarchy caused the palette
change (realized a palette). Do this max five times in a row (an
arbitrarily chosen limit), though, otherwise redraw by generating
expose events. On WM_QUERYNEWPALETTE, cause a redraw of the whole
window hierarchy by generating GDK_EXPOSE events.
3) Code cleanup in general. For instance, remove the "emulated"
X11 structs ColormapStruct, Visual and XStandardColormap. Use the
new GDK_DEBUG_* flags for debugging output in the relevant source
files. Remove the unused colormap hash table in gdkcolor-win32.c
4) Plug some resource leaks.
2002-02-14 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkdnd-win32.c (gdk_dropfiles_filter): Use
g_filename_to_uri() to actually create legal URIs in the
text/uri-list data.
2002-02-17 00:25:05 +00:00
|
|
|
GDK_WINDOW_HWND (window),
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
(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
|
|
|
{
|
2005-11-02 13:33:27 +00:00
|
|
|
if (GDK_WINDOW_TYPE (window) != GDK_WINDOW_FOREIGN)
|
Massive changes. Too many to list here, but I'll try a summary:
2002-02-17 Tor Lillqvist <tml@iki.fi>
* gdk/win32/*.c: Massive changes. Too many to list here, but I'll
try a summary:
1) Unify GdkPixmap and GdkImage implementation: For each
GdkPixmap, allocate a GdkImage, and vice versa.
GdkPixmapImplWin32Data has a pointer to the GdkImage.
GdkImage::windowing_data is a pointer to the GdkPixmap.
This simplifies many pixmap and image related functions a lot, and
reduces duplicated code snippets. For instance, there is only one
place in gdk/win32 where CreateDIBSection() is called, in the
function _gdk_win32_new_pixmap(). Converting a bitmap (GdkPixmap)
to a Windows region is almost trivial, with the bitmap bits being
readily accessible in the associated GdkImage.
All blitting between GdkPixmaps, GdkWindows and GdkImages goes
through handled the _gdk_win32_blit() function, which calls
different functions to handle the cases of blitting from pixmaps,
inside windows (scrolling), or from windows, which all require
somewhat different handling.
2) Support 256-color mode. This has long been very broken, now it
works more or less OK. Keep the logical palette for each colormap
as small as possible while allocating and freeing colors. Select
and realize the logical palette associated with a GdkColormap into
a DC before drawing or blitting.
When the display is in 256-color mode, make it possible for the
user to override the size of the palette(s) used with either the
GDK_WIN32_MAX_COLORS environment variable, or a -max-colors
command line option. It is possible to reduce the palette size all
the way down to using just the 16 static colors (which causes the
system visual to be of type GDK_VISUAL_STATIC_COLOR. This could
possibly be useful if one desperately wants to avoid color
flashing. (Note that in order for this to work properly, an as of
yet not commited fix to gdkrgb.c is needed.)
Handle the palette messages. On WM_PALETTECHANGED, call
UpdateColors() for the given window hierarchy. Do this only if a
window in some other top-level window hierarchy caused the palette
change (realized a palette). Do this max five times in a row (an
arbitrarily chosen limit), though, otherwise redraw by generating
expose events. On WM_QUERYNEWPALETTE, cause a redraw of the whole
window hierarchy by generating GDK_EXPOSE events.
3) Code cleanup in general. For instance, remove the "emulated"
X11 structs ColormapStruct, Visual and XStandardColormap. Use the
new GDK_DEBUG_* flags for debugging output in the relevant source
files. Remove the unused colormap hash table in gdkcolor-win32.c
4) Plug some resource leaks.
2002-02-14 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkdnd-win32.c (gdk_dropfiles_filter): Use
g_filename_to_uri() to actually create legal URIs in the
text/uri-list data.
2002-02-17 00:25:05 +00:00
|
|
|
g_warning ("window %p unexpectedly destroyed",
|
|
|
|
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));
|
2003-06-30 21:58:24 +00:00
|
|
|
g_object_unref (window);
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
2003-08-02 02:05:12 +00:00
|
|
|
static void
|
|
|
|
get_outer_rect (GdkWindow *window,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
RECT *rect)
|
|
|
|
{
|
|
|
|
rect->left = rect->top = 0;
|
|
|
|
rect->right = width;
|
|
|
|
rect->bottom = height;
|
|
|
|
|
2005-11-09 12:35:56 +00:00
|
|
|
_gdk_win32_adjust_client_rect (window, rect);
|
2003-08-02 02:05:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
adjust_for_gravity_hints (GdkWindowImplWin32 *impl,
|
|
|
|
RECT *outer_rect,
|
|
|
|
gint *x,
|
|
|
|
gint *y)
|
|
|
|
{
|
|
|
|
if (impl->hint_flags & GDK_HINT_WIN_GRAVITY)
|
|
|
|
{
|
|
|
|
gint orig_x = *x, orig_y = *y;
|
|
|
|
|
|
|
|
switch (impl->hints.win_gravity)
|
|
|
|
{
|
|
|
|
case GDK_GRAVITY_NORTH:
|
|
|
|
case GDK_GRAVITY_CENTER:
|
|
|
|
case GDK_GRAVITY_SOUTH:
|
|
|
|
*x -= (outer_rect->right - outer_rect->left) / 2;
|
|
|
|
*x += impl->width / 2;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_GRAVITY_SOUTH_EAST:
|
|
|
|
case GDK_GRAVITY_EAST:
|
|
|
|
case GDK_GRAVITY_NORTH_EAST:
|
|
|
|
*x -= outer_rect->right - outer_rect->left;
|
|
|
|
*x += impl->width;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_GRAVITY_STATIC:
|
|
|
|
*x += outer_rect->left;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (impl->hints.win_gravity)
|
|
|
|
{
|
|
|
|
case GDK_GRAVITY_WEST:
|
|
|
|
case GDK_GRAVITY_CENTER:
|
|
|
|
case GDK_GRAVITY_EAST:
|
|
|
|
*y -= (outer_rect->bottom - outer_rect->top) / 2;
|
|
|
|
*y += impl->height / 2;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_GRAVITY_SOUTH_WEST:
|
|
|
|
case GDK_GRAVITY_SOUTH:
|
|
|
|
case GDK_GRAVITY_SOUTH_EAST:
|
|
|
|
*y -= outer_rect->bottom - outer_rect->top;
|
|
|
|
*y += impl->height;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_GRAVITY_STATIC:
|
|
|
|
*y += outer_rect->top;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
GDK_NOTE (MISC,
|
|
|
|
(orig_x != *x || orig_y != *y) ?
|
|
|
|
g_print ("adjust_for_gravity_hints: x: %d->%d, y: %d->%d\n",
|
|
|
|
orig_x, *x, orig_y, *y)
|
|
|
|
: (void) 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-08-19 18:34:59 +00:00
|
|
|
static void
|
|
|
|
show_window_internal (GdkWindow *window,
|
Merge from stable:
2002-12-09 Tor Lillqvist <tml@iki.fi>
Merge from stable:
* gdk/win32/gdkdrawable-win32.c (generic_draw): Don't leak
stipple_gc. More checks for errors. Use correct ternary ROP when
blitting the foreground into the tile pixmap onto those pixels
where the stipple is set. (I didn't notice that I had used the
wrong one, as it didn't matter on Win2k, where DIB sections
apparently are zeroed upon creation. But on Win98 they have random
initial contents. Thanks to Hans Breuer for reporting this.)
(gdk_win32_draw_rectangle, gdk_win32_draw_arc,
gdk_win32_draw_polygon): Don't pass the LINE_ATTRIBUTES bits to
generic_draw() if drawing a filled figure.
* gdk/win32/gdkmain-win32.c (_gdk_win32_print_dc): Minor cosmetics.
(_gdk_win32_gcvalues_mask_to_string): Initialize buffer as empty.
(_gdk_win32_window_state_to_string): New debugging output helper
function.
* gdk/win32/gdkevents-win32.c: Minor debugging output changes.
(gdk_event_translate): Ignore the WM_SHOWWINDOW/SW_OTHERUNZOOM or
SW_OTHERZOOM messages. Do not generate a GDK_UNMAP event for
WM_SIZE/SIZE_MINIMIZED messages, they do not really corrspond to
unmapping on X11. Set window state correctly for all three of
SIZE_{MINIMIZED,MAXIMIZED,RESTORED}. A maximized and then iconified
("minimized" in Windows terminology) window still has the
"maximized" property, i.e. when deiconified, it will reappear as
maximized. (#10557)
* gdk/win32/gdkprivate-win32.h: Declare new function.
(WIN32_API_FAILED, WIN32_GDI_FAILED, OTHER_API_FAILED): Don't use
__PRETTY_FUNCTION__ if __GNUC__ >= 3, to avoid warning message.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Handle more
situations. Add parameter to tell whether deiconifying. Code
reorg: Return early when appropriate instead of using nested if
statements. If just deiconifying without raising, restore active
window. (#10557)
(gdk_window_hide, gdk_window_withdraw, gdk_window_iconify,
gdk_window_deiconify, gdk_window_maximize, gdk_window_unmaximize,
gdk_window_focus): Use _gdk_win32_window_state_to_string() in
debugging output.
(gdk_window_iconify): Restore active window after calling
ShowWindow(). Otherwise the "next" window gets activated.
(gdk_window_stick, gdk_window_unstick): Don't output any warnings.
(gdk_window_set_transient_for): Rewrite. Just call SetWindowLong()
with GWL_HWNDPARENT, which despite its name sets the *owner*
window, which should be exactly what we want. The PSDK
documentation is said to be misleading. testgtk's modal window
test now works much better. (#50586)
2002-12-09 00:43:42 +00:00
|
|
|
gboolean raise,
|
|
|
|
gboolean deiconify)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
GdkWindowObject *private;
|
Merge from stable:
2002-12-09 Tor Lillqvist <tml@iki.fi>
Merge from stable:
* gdk/win32/gdkdrawable-win32.c (generic_draw): Don't leak
stipple_gc. More checks for errors. Use correct ternary ROP when
blitting the foreground into the tile pixmap onto those pixels
where the stipple is set. (I didn't notice that I had used the
wrong one, as it didn't matter on Win2k, where DIB sections
apparently are zeroed upon creation. But on Win98 they have random
initial contents. Thanks to Hans Breuer for reporting this.)
(gdk_win32_draw_rectangle, gdk_win32_draw_arc,
gdk_win32_draw_polygon): Don't pass the LINE_ATTRIBUTES bits to
generic_draw() if drawing a filled figure.
* gdk/win32/gdkmain-win32.c (_gdk_win32_print_dc): Minor cosmetics.
(_gdk_win32_gcvalues_mask_to_string): Initialize buffer as empty.
(_gdk_win32_window_state_to_string): New debugging output helper
function.
* gdk/win32/gdkevents-win32.c: Minor debugging output changes.
(gdk_event_translate): Ignore the WM_SHOWWINDOW/SW_OTHERUNZOOM or
SW_OTHERZOOM messages. Do not generate a GDK_UNMAP event for
WM_SIZE/SIZE_MINIMIZED messages, they do not really corrspond to
unmapping on X11. Set window state correctly for all three of
SIZE_{MINIMIZED,MAXIMIZED,RESTORED}. A maximized and then iconified
("minimized" in Windows terminology) window still has the
"maximized" property, i.e. when deiconified, it will reappear as
maximized. (#10557)
* gdk/win32/gdkprivate-win32.h: Declare new function.
(WIN32_API_FAILED, WIN32_GDI_FAILED, OTHER_API_FAILED): Don't use
__PRETTY_FUNCTION__ if __GNUC__ >= 3, to avoid warning message.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Handle more
situations. Add parameter to tell whether deiconifying. Code
reorg: Return early when appropriate instead of using nested if
statements. If just deiconifying without raising, restore active
window. (#10557)
(gdk_window_hide, gdk_window_withdraw, gdk_window_iconify,
gdk_window_deiconify, gdk_window_maximize, gdk_window_unmaximize,
gdk_window_focus): Use _gdk_win32_window_state_to_string() in
debugging output.
(gdk_window_iconify): Restore active window after calling
ShowWindow(). Otherwise the "next" window gets activated.
(gdk_window_stick, gdk_window_unstick): Don't output any warnings.
(gdk_window_set_transient_for): Rewrite. Just call SetWindowLong()
with GWL_HWNDPARENT, which despite its name sets the *owner*
window, which should be exactly what we want. The PSDK
documentation is said to be misleading. testgtk's modal window
test now works much better. (#50586)
2002-12-09 00:43:42 +00:00
|
|
|
HWND old_active_window;
|
2004-05-08 16:25:15 +00:00
|
|
|
gboolean focus_on_map = TRUE;
|
|
|
|
|
gdk/win32/gdkprivate-win32.h New flags _gdk_input_locale_is_ime and
2003-07-25 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkglobals-win32.c: New flags _gdk_input_locale_is_ime
and _gdk_keyboard_has_altgr.
* gdk/win32/gdkevents-win32.c: Lots of changes. Most important
ones detailled here.
Code that has been ifdeffed out for a long time removed. Remove
some really old doc comments that were left behind for some public
functions, the official ones are in the X11 backend anyway. Change
GDK_WINDOW_OBJECT() calls to GdkWindowObject casts. Reformat
multi-line boolean expressions to have the operators at ends of
lines.
As mouse capture with SetCapture() indeed seems to work OK, no
need to have the correspoinding macro USE_SETCAPTURE and ifdefs.
Ifdef out the gdk-ping-msg stuff. I don't remember why it was
needed at some time, and things seem to work fine now without
(knock on wood).
Ifdef out the search for some Latin locale keyboard layout being
loaded. Not used currently, but might be needed after all, if we
decide that we want to be able to generate ASCII control character
events with a non-Latin keyboard.
(assign_object): New helper function, handles the g_object_ref()
and unref() calls when assigning GObject pointers.
(generate_crossing_events): Also generate the GDK_NOTIFY_INTERIOR
enter event when the pointer has moved to an ancestor window. Was
left out by mistake.
(gdk_window_is_ancestor): Renamed from gdk_window_is_child().
(gdk_pointer_grab, gdk_pointer_ungrab): Implement the confine_to
functionality, using ClipCursor().
(find_window_for_mouse_event): Splice part of code into new
function find_real_window_for_grabbed_mouse_event().
(fixup_event, append_event, apply_filters): New functions, code
refactored out from elsewhere.
(synthesize_enter_or_leave_event, synthesize_leave_event,
synthesize_enter_event,
synthesize_leave_events,synthesize_enter_events): Also take a
GdkCrossingMode parameter, in preparation to generating
GDK_CROSSING_GRAB and GDK_CROSSING_UNGRAB events.
(fixup_event, append_event, fill_key_event_string): New functions,
code refactoring.
(vk_from_char, build_keypress_event, build_keyrelease_event):
Removed as part of dropping WM_CHAR handling.
(build_key_event_state,gdk_event_translate): Call
GetKeyboardState(), once, for each keyboard message, instead of
several calls to GetKeyState() here and there.
(gdk_event_translate): Fix bugs #104516, #104662, #115902. While
at it, do some major refactoring, and some fixes for potential
problems noticed while going through the code.
Don't handle WM_CHAR at all. Only handle WM_KEYDOWN and
WM_KEYUP. Don't need the state variables related to whether to
wait for WM_CHAR or not, and whether the current key is
AltGr. Remove lots of complexity. Thus don't need the
use_ime_composition flag.
Not handling WM_CHAR means dead key handling will have to be taken
care of by GTK, but that seems to work fine, so no worry.
Another side-effect is that Alt+keypad digits don't work any
longer, but it's better to learn to use GTK's ISO14755 support is
anyway.
Be more careful in checking whether AltGr is involved. Only
attempt to handle it if the keyboard actually has it. And
explicitly check for *left* Control plus *right* Alt being
pressed. Still, allow (left) Alt and/or (right) Control with AltGr
chars.
Handle keys using similar code as in the X11 backend. As we have
built a keymap in gdkkeys-win32.c anyway, use it by calling
gdk_keymap_translate_keyboard_state() to look up the keysym from
the virtual key code and keyboard state. Build the key event
string in exactly the same way as the X11 backend.
If an IME is being used, don't generate GDK events for keys
between receiving WM_IME_STARTCOMPOSITION and
WM_IME_ENDCOMPOSITION, as those keys are for the IME.
For WM_IME_COMPOSITION, handle all the Unicode chars returned from
the IME, not just the first one.
gdk_event_translate() is still quite complex, could split the
message handler cases out into separate functions.
On mouse events, when the mouse is grabbed, use
find_real_window_for_grabbed_mouse_event() in order to be able to
generate correct crossing events.
No longer take a pre-allocated GdkEvent as parameter. Instead,
allocate events as needed and append them to the queue. (This is
different from how gdk_event_translate() in the X11 backend
works.) This change made the code much clearer, especially in the
cases where we have to generate several GDK events for one Windows
message. Return FALSE if DefWindowProc() should be called, TRUE
if not. If DefWindowProc() should not be called, also return the
value to be returned from the window procedure.
(Previously, the interaction with gdk_event_translate()'s caller
was much more complex, when we had to indicate whether the
already-queued event should be left in the queue or removed, and
in addition also had to indicate whether to call DefWindowProc()
or not, and what value to return from the window procedure if
not.)
Don't use a separate "private" variable required to be pointing to
the GdkWindowObject of the "window" variable at all times. Just
use casts, even if looks a bit uglier.
Notice destroyed windows as early as possible, and break out of
the messsage switch.
Use _gdk_pointer_root as current_window when the pointer is
outside GDK's top-level windows.
On WM_INPUTLANGCHANGE, set _gdk_input_locale_is_ime as
appropriate, based on ImmIsIME().
(gdk_event_translate, gdk_event_send_client_message_for_display,
gdk_screen_broadcast_client_message): Implement client messages.
Use a registered Windows message to pass GDK client messages. Note
that the amount of user data is restricted to four bytes, as it is
carried in the LPARAM. (The WPARAM is used for the message type
"atom".)
(real_window_procedure): Adapt for new gdk_event_translate()
interface.
* gdk/win32/gdkmain-win32.c (_gdk_windowing_init): Set
_gdk_input_locale_is_ime initially.
* gdk/win32/gdkwindow-win32.c: Use g_object_ref()/unref() instead
of g_colormap_ref()/unref().
(gdk_window_new): Made code a bit more like the X11 one, pretend
to handle screens (although we just have one for now).
* gdk/x11/gdkevents-x11.c
(gdk_event_send_client_message_for_display,
gdk_screen_broadcast_client_message): Document the user data
limitation on Win32.
* gdk/win32/gdkevents-win32.c (print_event): More complete enter
and leave notify detail output.
* gdk/win32/gdkkeys-win32.c (update_keymap): Make dead keys
visible to GDK and GTK. Store the corresponding GDK_dead_* keysym
for those, so that the GtkIMContextCimple compose tables will
work. Deduce if the keyboard layout has the AltGr key, and set the
above flag accordingly.
2003-07-26 01:54:59 +00:00
|
|
|
private = (GdkWindowObject *) window;
|
2001-08-19 18:34:59 +00:00
|
|
|
|
Merge from stable:
2002-12-09 Tor Lillqvist <tml@iki.fi>
Merge from stable:
* gdk/win32/gdkdrawable-win32.c (generic_draw): Don't leak
stipple_gc. More checks for errors. Use correct ternary ROP when
blitting the foreground into the tile pixmap onto those pixels
where the stipple is set. (I didn't notice that I had used the
wrong one, as it didn't matter on Win2k, where DIB sections
apparently are zeroed upon creation. But on Win98 they have random
initial contents. Thanks to Hans Breuer for reporting this.)
(gdk_win32_draw_rectangle, gdk_win32_draw_arc,
gdk_win32_draw_polygon): Don't pass the LINE_ATTRIBUTES bits to
generic_draw() if drawing a filled figure.
* gdk/win32/gdkmain-win32.c (_gdk_win32_print_dc): Minor cosmetics.
(_gdk_win32_gcvalues_mask_to_string): Initialize buffer as empty.
(_gdk_win32_window_state_to_string): New debugging output helper
function.
* gdk/win32/gdkevents-win32.c: Minor debugging output changes.
(gdk_event_translate): Ignore the WM_SHOWWINDOW/SW_OTHERUNZOOM or
SW_OTHERZOOM messages. Do not generate a GDK_UNMAP event for
WM_SIZE/SIZE_MINIMIZED messages, they do not really corrspond to
unmapping on X11. Set window state correctly for all three of
SIZE_{MINIMIZED,MAXIMIZED,RESTORED}. A maximized and then iconified
("minimized" in Windows terminology) window still has the
"maximized" property, i.e. when deiconified, it will reappear as
maximized. (#10557)
* gdk/win32/gdkprivate-win32.h: Declare new function.
(WIN32_API_FAILED, WIN32_GDI_FAILED, OTHER_API_FAILED): Don't use
__PRETTY_FUNCTION__ if __GNUC__ >= 3, to avoid warning message.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Handle more
situations. Add parameter to tell whether deiconifying. Code
reorg: Return early when appropriate instead of using nested if
statements. If just deiconifying without raising, restore active
window. (#10557)
(gdk_window_hide, gdk_window_withdraw, gdk_window_iconify,
gdk_window_deiconify, gdk_window_maximize, gdk_window_unmaximize,
gdk_window_focus): Use _gdk_win32_window_state_to_string() in
debugging output.
(gdk_window_iconify): Restore active window after calling
ShowWindow(). Otherwise the "next" window gets activated.
(gdk_window_stick, gdk_window_unstick): Don't output any warnings.
(gdk_window_set_transient_for): Rewrite. Just call SetWindowLong()
with GWL_HWNDPARENT, which despite its name sets the *owner*
window, which should be exactly what we want. The PSDK
documentation is said to be misleading. testgtk's modal window
test now works much better. (#50586)
2002-12-09 00:43:42 +00:00
|
|
|
if (private->destroyed)
|
|
|
|
return;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("show_window_internal: %p: %s%s%s\n",
|
Merge from stable:
2002-12-09 Tor Lillqvist <tml@iki.fi>
Merge from stable:
* gdk/win32/gdkdrawable-win32.c (generic_draw): Don't leak
stipple_gc. More checks for errors. Use correct ternary ROP when
blitting the foreground into the tile pixmap onto those pixels
where the stipple is set. (I didn't notice that I had used the
wrong one, as it didn't matter on Win2k, where DIB sections
apparently are zeroed upon creation. But on Win98 they have random
initial contents. Thanks to Hans Breuer for reporting this.)
(gdk_win32_draw_rectangle, gdk_win32_draw_arc,
gdk_win32_draw_polygon): Don't pass the LINE_ATTRIBUTES bits to
generic_draw() if drawing a filled figure.
* gdk/win32/gdkmain-win32.c (_gdk_win32_print_dc): Minor cosmetics.
(_gdk_win32_gcvalues_mask_to_string): Initialize buffer as empty.
(_gdk_win32_window_state_to_string): New debugging output helper
function.
* gdk/win32/gdkevents-win32.c: Minor debugging output changes.
(gdk_event_translate): Ignore the WM_SHOWWINDOW/SW_OTHERUNZOOM or
SW_OTHERZOOM messages. Do not generate a GDK_UNMAP event for
WM_SIZE/SIZE_MINIMIZED messages, they do not really corrspond to
unmapping on X11. Set window state correctly for all three of
SIZE_{MINIMIZED,MAXIMIZED,RESTORED}. A maximized and then iconified
("minimized" in Windows terminology) window still has the
"maximized" property, i.e. when deiconified, it will reappear as
maximized. (#10557)
* gdk/win32/gdkprivate-win32.h: Declare new function.
(WIN32_API_FAILED, WIN32_GDI_FAILED, OTHER_API_FAILED): Don't use
__PRETTY_FUNCTION__ if __GNUC__ >= 3, to avoid warning message.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Handle more
situations. Add parameter to tell whether deiconifying. Code
reorg: Return early when appropriate instead of using nested if
statements. If just deiconifying without raising, restore active
window. (#10557)
(gdk_window_hide, gdk_window_withdraw, gdk_window_iconify,
gdk_window_deiconify, gdk_window_maximize, gdk_window_unmaximize,
gdk_window_focus): Use _gdk_win32_window_state_to_string() in
debugging output.
(gdk_window_iconify): Restore active window after calling
ShowWindow(). Otherwise the "next" window gets activated.
(gdk_window_stick, gdk_window_unstick): Don't output any warnings.
(gdk_window_set_transient_for): Rewrite. Just call SetWindowLong()
with GWL_HWNDPARENT, which despite its name sets the *owner*
window, which should be exactly what we want. The PSDK
documentation is said to be misleading. testgtk's modal window
test now works much better. (#50586)
2002-12-09 00:43:42 +00:00
|
|
|
GDK_WINDOW_HWND (window),
|
|
|
|
_gdk_win32_window_state_to_string (private->state),
|
|
|
|
(raise ? " raise" : ""),
|
|
|
|
(deiconify ? " deiconify" : "")));
|
|
|
|
|
|
|
|
/* If asked to show (not deiconify) an withdrawn and iconified
|
|
|
|
* window, do that.
|
|
|
|
*/
|
|
|
|
if (!deiconify &&
|
|
|
|
!GDK_WINDOW_IS_MAPPED (window) &&
|
|
|
|
(private->state & GDK_WINDOW_STATE_ICONIFIED))
|
|
|
|
{
|
|
|
|
ShowWindow (GDK_WINDOW_HWND (window), SW_MINIMIZE);
|
|
|
|
return;
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
Merge from stable:
2002-12-09 Tor Lillqvist <tml@iki.fi>
Merge from stable:
* gdk/win32/gdkdrawable-win32.c (generic_draw): Don't leak
stipple_gc. More checks for errors. Use correct ternary ROP when
blitting the foreground into the tile pixmap onto those pixels
where the stipple is set. (I didn't notice that I had used the
wrong one, as it didn't matter on Win2k, where DIB sections
apparently are zeroed upon creation. But on Win98 they have random
initial contents. Thanks to Hans Breuer for reporting this.)
(gdk_win32_draw_rectangle, gdk_win32_draw_arc,
gdk_win32_draw_polygon): Don't pass the LINE_ATTRIBUTES bits to
generic_draw() if drawing a filled figure.
* gdk/win32/gdkmain-win32.c (_gdk_win32_print_dc): Minor cosmetics.
(_gdk_win32_gcvalues_mask_to_string): Initialize buffer as empty.
(_gdk_win32_window_state_to_string): New debugging output helper
function.
* gdk/win32/gdkevents-win32.c: Minor debugging output changes.
(gdk_event_translate): Ignore the WM_SHOWWINDOW/SW_OTHERUNZOOM or
SW_OTHERZOOM messages. Do not generate a GDK_UNMAP event for
WM_SIZE/SIZE_MINIMIZED messages, they do not really corrspond to
unmapping on X11. Set window state correctly for all three of
SIZE_{MINIMIZED,MAXIMIZED,RESTORED}. A maximized and then iconified
("minimized" in Windows terminology) window still has the
"maximized" property, i.e. when deiconified, it will reappear as
maximized. (#10557)
* gdk/win32/gdkprivate-win32.h: Declare new function.
(WIN32_API_FAILED, WIN32_GDI_FAILED, OTHER_API_FAILED): Don't use
__PRETTY_FUNCTION__ if __GNUC__ >= 3, to avoid warning message.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Handle more
situations. Add parameter to tell whether deiconifying. Code
reorg: Return early when appropriate instead of using nested if
statements. If just deiconifying without raising, restore active
window. (#10557)
(gdk_window_hide, gdk_window_withdraw, gdk_window_iconify,
gdk_window_deiconify, gdk_window_maximize, gdk_window_unmaximize,
gdk_window_focus): Use _gdk_win32_window_state_to_string() in
debugging output.
(gdk_window_iconify): Restore active window after calling
ShowWindow(). Otherwise the "next" window gets activated.
(gdk_window_stick, gdk_window_unstick): Don't output any warnings.
(gdk_window_set_transient_for): Rewrite. Just call SetWindowLong()
with GWL_HWNDPARENT, which despite its name sets the *owner*
window, which should be exactly what we want. The PSDK
documentation is said to be misleading. testgtk's modal window
test now works much better. (#50586)
2002-12-09 00:43:42 +00:00
|
|
|
|
|
|
|
/* If asked to just show an iconified window, do nothing. */
|
|
|
|
if (!deiconify && (private->state & GDK_WINDOW_STATE_ICONIFIED))
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* If asked to deiconify an already noniconified window, do
|
|
|
|
* nothing. (Especially, don't cause the window to rise and
|
|
|
|
* activate. There are different calls for that.)
|
|
|
|
*/
|
|
|
|
if (deiconify && !(private->state & GDK_WINDOW_STATE_ICONIFIED))
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* If asked to show (but not raise) a window that is already
|
|
|
|
* visible, do nothing.
|
|
|
|
*/
|
|
|
|
if (!deiconify && !raise && IsWindowVisible (GDK_WINDOW_HWND (window)))
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* Other cases */
|
|
|
|
|
|
|
|
if (!GDK_WINDOW_IS_MAPPED (window))
|
2004-05-08 16:25:15 +00:00
|
|
|
{
|
|
|
|
gdk_synthesize_window_state (window,
|
|
|
|
GDK_WINDOW_STATE_WITHDRAWN,
|
|
|
|
0);
|
|
|
|
focus_on_map = private->focus_on_map;
|
|
|
|
}
|
Merge from stable:
2002-12-09 Tor Lillqvist <tml@iki.fi>
Merge from stable:
* gdk/win32/gdkdrawable-win32.c (generic_draw): Don't leak
stipple_gc. More checks for errors. Use correct ternary ROP when
blitting the foreground into the tile pixmap onto those pixels
where the stipple is set. (I didn't notice that I had used the
wrong one, as it didn't matter on Win2k, where DIB sections
apparently are zeroed upon creation. But on Win98 they have random
initial contents. Thanks to Hans Breuer for reporting this.)
(gdk_win32_draw_rectangle, gdk_win32_draw_arc,
gdk_win32_draw_polygon): Don't pass the LINE_ATTRIBUTES bits to
generic_draw() if drawing a filled figure.
* gdk/win32/gdkmain-win32.c (_gdk_win32_print_dc): Minor cosmetics.
(_gdk_win32_gcvalues_mask_to_string): Initialize buffer as empty.
(_gdk_win32_window_state_to_string): New debugging output helper
function.
* gdk/win32/gdkevents-win32.c: Minor debugging output changes.
(gdk_event_translate): Ignore the WM_SHOWWINDOW/SW_OTHERUNZOOM or
SW_OTHERZOOM messages. Do not generate a GDK_UNMAP event for
WM_SIZE/SIZE_MINIMIZED messages, they do not really corrspond to
unmapping on X11. Set window state correctly for all three of
SIZE_{MINIMIZED,MAXIMIZED,RESTORED}. A maximized and then iconified
("minimized" in Windows terminology) window still has the
"maximized" property, i.e. when deiconified, it will reappear as
maximized. (#10557)
* gdk/win32/gdkprivate-win32.h: Declare new function.
(WIN32_API_FAILED, WIN32_GDI_FAILED, OTHER_API_FAILED): Don't use
__PRETTY_FUNCTION__ if __GNUC__ >= 3, to avoid warning message.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Handle more
situations. Add parameter to tell whether deiconifying. Code
reorg: Return early when appropriate instead of using nested if
statements. If just deiconifying without raising, restore active
window. (#10557)
(gdk_window_hide, gdk_window_withdraw, gdk_window_iconify,
gdk_window_deiconify, gdk_window_maximize, gdk_window_unmaximize,
gdk_window_focus): Use _gdk_win32_window_state_to_string() in
debugging output.
(gdk_window_iconify): Restore active window after calling
ShowWindow(). Otherwise the "next" window gets activated.
(gdk_window_stick, gdk_window_unstick): Don't output any warnings.
(gdk_window_set_transient_for): Rewrite. Just call SetWindowLong()
with GWL_HWNDPARENT, which despite its name sets the *owner*
window, which should be exactly what we want. The PSDK
documentation is said to be misleading. testgtk's modal window
test now works much better. (#50586)
2002-12-09 00:43:42 +00:00
|
|
|
|
2004-03-10 22:20:36 +00:00
|
|
|
/* Use SetWindowPos to show transparent windows so automatic redraws
|
|
|
|
* in other windows can be suppressed.
|
|
|
|
*/
|
|
|
|
if (GetWindowLong (GDK_WINDOW_HWND (window), GWL_EXSTYLE) & WS_EX_TRANSPARENT)
|
|
|
|
{
|
|
|
|
UINT flags = SWP_SHOWWINDOW | SWP_NOREDRAW | SWP_NOMOVE | SWP_NOSIZE;
|
|
|
|
if (!raise)
|
|
|
|
flags |= SWP_NOZORDER;
|
2004-05-08 16:25:15 +00:00
|
|
|
if (!raise || GDK_WINDOW_TYPE (window) == GDK_WINDOW_TEMP || !focus_on_map)
|
2004-03-10 22:20:36 +00:00
|
|
|
flags |= SWP_NOACTIVATE;
|
|
|
|
|
|
|
|
SetWindowPos (GDK_WINDOW_HWND (window), HWND_TOP, 0, 0, 0, 0, flags);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
Merge from stable:
2002-12-09 Tor Lillqvist <tml@iki.fi>
Merge from stable:
* gdk/win32/gdkdrawable-win32.c (generic_draw): Don't leak
stipple_gc. More checks for errors. Use correct ternary ROP when
blitting the foreground into the tile pixmap onto those pixels
where the stipple is set. (I didn't notice that I had used the
wrong one, as it didn't matter on Win2k, where DIB sections
apparently are zeroed upon creation. But on Win98 they have random
initial contents. Thanks to Hans Breuer for reporting this.)
(gdk_win32_draw_rectangle, gdk_win32_draw_arc,
gdk_win32_draw_polygon): Don't pass the LINE_ATTRIBUTES bits to
generic_draw() if drawing a filled figure.
* gdk/win32/gdkmain-win32.c (_gdk_win32_print_dc): Minor cosmetics.
(_gdk_win32_gcvalues_mask_to_string): Initialize buffer as empty.
(_gdk_win32_window_state_to_string): New debugging output helper
function.
* gdk/win32/gdkevents-win32.c: Minor debugging output changes.
(gdk_event_translate): Ignore the WM_SHOWWINDOW/SW_OTHERUNZOOM or
SW_OTHERZOOM messages. Do not generate a GDK_UNMAP event for
WM_SIZE/SIZE_MINIMIZED messages, they do not really corrspond to
unmapping on X11. Set window state correctly for all three of
SIZE_{MINIMIZED,MAXIMIZED,RESTORED}. A maximized and then iconified
("minimized" in Windows terminology) window still has the
"maximized" property, i.e. when deiconified, it will reappear as
maximized. (#10557)
* gdk/win32/gdkprivate-win32.h: Declare new function.
(WIN32_API_FAILED, WIN32_GDI_FAILED, OTHER_API_FAILED): Don't use
__PRETTY_FUNCTION__ if __GNUC__ >= 3, to avoid warning message.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Handle more
situations. Add parameter to tell whether deiconifying. Code
reorg: Return early when appropriate instead of using nested if
statements. If just deiconifying without raising, restore active
window. (#10557)
(gdk_window_hide, gdk_window_withdraw, gdk_window_iconify,
gdk_window_deiconify, gdk_window_maximize, gdk_window_unmaximize,
gdk_window_focus): Use _gdk_win32_window_state_to_string() in
debugging output.
(gdk_window_iconify): Restore active window after calling
ShowWindow(). Otherwise the "next" window gets activated.
(gdk_window_stick, gdk_window_unstick): Don't output any warnings.
(gdk_window_set_transient_for): Rewrite. Just call SetWindowLong()
with GWL_HWNDPARENT, which despite its name sets the *owner*
window, which should be exactly what we want. The PSDK
documentation is said to be misleading. testgtk's modal window
test now works much better. (#50586)
2002-12-09 00:43:42 +00:00
|
|
|
old_active_window = GetActiveWindow ();
|
|
|
|
|
2003-11-15 20:35:55 +00:00
|
|
|
if (private->state & (GDK_WINDOW_STATE_BELOW | GDK_WINDOW_STATE_ABOVE))
|
|
|
|
{
|
|
|
|
DWORD exstyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_EXSTYLE);
|
|
|
|
|
|
|
|
if (private->state & GDK_WINDOW_STATE_BELOW)
|
|
|
|
exstyle &= (~WS_EX_TOPMOST);
|
|
|
|
if (private->state & GDK_WINDOW_STATE_ABOVE)
|
|
|
|
exstyle |= WS_EX_TOPMOST;
|
|
|
|
|
2005-03-16 01:38:57 +00:00
|
|
|
API_CALL (SetWindowLong, (GDK_WINDOW_HWND (window), GWL_EXSTYLE, exstyle));
|
2003-11-15 20:35:55 +00:00
|
|
|
}
|
|
|
|
|
2003-08-05 22:24:35 +00:00
|
|
|
if (private->state & GDK_WINDOW_STATE_FULLSCREEN)
|
|
|
|
gdk_window_fullscreen (window);
|
|
|
|
else if (private->state & GDK_WINDOW_STATE_MAXIMIZED)
|
Merge from stable:
2002-12-09 Tor Lillqvist <tml@iki.fi>
Merge from stable:
* gdk/win32/gdkdrawable-win32.c (generic_draw): Don't leak
stipple_gc. More checks for errors. Use correct ternary ROP when
blitting the foreground into the tile pixmap onto those pixels
where the stipple is set. (I didn't notice that I had used the
wrong one, as it didn't matter on Win2k, where DIB sections
apparently are zeroed upon creation. But on Win98 they have random
initial contents. Thanks to Hans Breuer for reporting this.)
(gdk_win32_draw_rectangle, gdk_win32_draw_arc,
gdk_win32_draw_polygon): Don't pass the LINE_ATTRIBUTES bits to
generic_draw() if drawing a filled figure.
* gdk/win32/gdkmain-win32.c (_gdk_win32_print_dc): Minor cosmetics.
(_gdk_win32_gcvalues_mask_to_string): Initialize buffer as empty.
(_gdk_win32_window_state_to_string): New debugging output helper
function.
* gdk/win32/gdkevents-win32.c: Minor debugging output changes.
(gdk_event_translate): Ignore the WM_SHOWWINDOW/SW_OTHERUNZOOM or
SW_OTHERZOOM messages. Do not generate a GDK_UNMAP event for
WM_SIZE/SIZE_MINIMIZED messages, they do not really corrspond to
unmapping on X11. Set window state correctly for all three of
SIZE_{MINIMIZED,MAXIMIZED,RESTORED}. A maximized and then iconified
("minimized" in Windows terminology) window still has the
"maximized" property, i.e. when deiconified, it will reappear as
maximized. (#10557)
* gdk/win32/gdkprivate-win32.h: Declare new function.
(WIN32_API_FAILED, WIN32_GDI_FAILED, OTHER_API_FAILED): Don't use
__PRETTY_FUNCTION__ if __GNUC__ >= 3, to avoid warning message.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Handle more
situations. Add parameter to tell whether deiconifying. Code
reorg: Return early when appropriate instead of using nested if
statements. If just deiconifying without raising, restore active
window. (#10557)
(gdk_window_hide, gdk_window_withdraw, gdk_window_iconify,
gdk_window_deiconify, gdk_window_maximize, gdk_window_unmaximize,
gdk_window_focus): Use _gdk_win32_window_state_to_string() in
debugging output.
(gdk_window_iconify): Restore active window after calling
ShowWindow(). Otherwise the "next" window gets activated.
(gdk_window_stick, gdk_window_unstick): Don't output any warnings.
(gdk_window_set_transient_for): Rewrite. Just call SetWindowLong()
with GWL_HWNDPARENT, which despite its name sets the *owner*
window, which should be exactly what we want. The PSDK
documentation is said to be misleading. testgtk's modal window
test now works much better. (#50586)
2002-12-09 00:43:42 +00:00
|
|
|
ShowWindow (GDK_WINDOW_HWND (window), SW_MAXIMIZE);
|
|
|
|
else if (private->state & GDK_WINDOW_STATE_ICONIFIED)
|
|
|
|
ShowWindow (GDK_WINDOW_HWND (window), SW_RESTORE);
|
2004-05-08 16:25:15 +00:00
|
|
|
else if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_TEMP || !focus_on_map)
|
Merge from stable:
2003-01-19 Tor Lillqvist <tml@iki.fi>
Merge from stable:
Fix for #103614 and some other problems with GtkFileSelection on
Windows:
* gtk/fnmatch.c (get_char): Need to use g_unichar_tolower(), not
g_ascii_tolower(). Windows file names are case-insensitive for all
Unicode letters.
* gtk/gtkfilesel.c: Instead of checking for G_OS_WIN32 or
G_WITH_CYGWIN, check G_PLATFORM_WIN32. Move inclusion of gtkintl.h
earlier, as it includes config.h unconditionally, and gtkprivate.h
redefines GTK_LOCALEDIR.
(struct _CompletionDirSent): Ifdef out the fields not used on
Windows.
(compare_utf8_filenames, compare_sys_filenames): Need different
comparison implementation for UTF-8 file names and system locale
file names on Win32. Cannot simply use g_ascii_strcasecmp(), but
need to casefold all Unicode letters.
(cmpl_completion_matches, open_dir, correct_parent): Ifdef out
variables not used on Win32 to avoid warnings about unused
variables.
(open_ref_dir): Use g_path_skip_root() to skip past potential
drive letter in front of the leading (back)slash.
(open_new_dir): Ifdef out use of CompletionDirSent fields not
there on Win32.
(correct_parent): Bypass inode check also on Cygwin.
Fix bug noticed by Alex Shaduri: Tooltips and other
GDK_WINDOW_TEMP windows were activated. This looked very odd, and
was a regression from earlier versions.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Fine-tune
behaviour. Don't ever activate GDK_WINDOW_TEMP windows.
(gdk_window_move, gdk_window_resize): Add debug logging.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): When we get a
WM_SIZE message for a non-visible (withdrawn) window, don't clear
the GDK_WINDOW_STATE_WITHDRAWN bit. The window is still withdrawn
even if its size changes.
2003-01-19 21:18:15 +00:00
|
|
|
ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWNOACTIVATE);
|
Merge from stable:
2002-12-09 Tor Lillqvist <tml@iki.fi>
Merge from stable:
* gdk/win32/gdkdrawable-win32.c (generic_draw): Don't leak
stipple_gc. More checks for errors. Use correct ternary ROP when
blitting the foreground into the tile pixmap onto those pixels
where the stipple is set. (I didn't notice that I had used the
wrong one, as it didn't matter on Win2k, where DIB sections
apparently are zeroed upon creation. But on Win98 they have random
initial contents. Thanks to Hans Breuer for reporting this.)
(gdk_win32_draw_rectangle, gdk_win32_draw_arc,
gdk_win32_draw_polygon): Don't pass the LINE_ATTRIBUTES bits to
generic_draw() if drawing a filled figure.
* gdk/win32/gdkmain-win32.c (_gdk_win32_print_dc): Minor cosmetics.
(_gdk_win32_gcvalues_mask_to_string): Initialize buffer as empty.
(_gdk_win32_window_state_to_string): New debugging output helper
function.
* gdk/win32/gdkevents-win32.c: Minor debugging output changes.
(gdk_event_translate): Ignore the WM_SHOWWINDOW/SW_OTHERUNZOOM or
SW_OTHERZOOM messages. Do not generate a GDK_UNMAP event for
WM_SIZE/SIZE_MINIMIZED messages, they do not really corrspond to
unmapping on X11. Set window state correctly for all three of
SIZE_{MINIMIZED,MAXIMIZED,RESTORED}. A maximized and then iconified
("minimized" in Windows terminology) window still has the
"maximized" property, i.e. when deiconified, it will reappear as
maximized. (#10557)
* gdk/win32/gdkprivate-win32.h: Declare new function.
(WIN32_API_FAILED, WIN32_GDI_FAILED, OTHER_API_FAILED): Don't use
__PRETTY_FUNCTION__ if __GNUC__ >= 3, to avoid warning message.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Handle more
situations. Add parameter to tell whether deiconifying. Code
reorg: Return early when appropriate instead of using nested if
statements. If just deiconifying without raising, restore active
window. (#10557)
(gdk_window_hide, gdk_window_withdraw, gdk_window_iconify,
gdk_window_deiconify, gdk_window_maximize, gdk_window_unmaximize,
gdk_window_focus): Use _gdk_win32_window_state_to_string() in
debugging output.
(gdk_window_iconify): Restore active window after calling
ShowWindow(). Otherwise the "next" window gets activated.
(gdk_window_stick, gdk_window_unstick): Don't output any warnings.
(gdk_window_set_transient_for): Rewrite. Just call SetWindowLong()
with GWL_HWNDPARENT, which despite its name sets the *owner*
window, which should be exactly what we want. The PSDK
documentation is said to be misleading. testgtk's modal window
test now works much better. (#50586)
2002-12-09 00:43:42 +00:00
|
|
|
else
|
|
|
|
ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWNORMAL);
|
|
|
|
|
|
|
|
if (raise)
|
2004-05-02 13:20:49 +00:00
|
|
|
{
|
|
|
|
if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_TEMP)
|
2005-03-16 01:38:57 +00:00
|
|
|
SetWindowPos (GDK_WINDOW_HWND (window), HWND_TOPMOST,
|
|
|
|
0, 0, 0, 0,
|
|
|
|
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
|
|
|
|
else if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_TOPLEVEL ||
|
|
|
|
GDK_WINDOW_TYPE (window) == GDK_WINDOW_DIALOG)
|
2006-02-09 03:20:56 +00:00
|
|
|
{
|
|
|
|
if (focus_on_map && private->accept_focus)
|
|
|
|
SetForegroundWindow (GDK_WINDOW_HWND (window));
|
|
|
|
else
|
|
|
|
SetWindowPos (GDK_WINDOW_HWND (window), HWND_TOP,
|
|
|
|
0, 0, 0, 0,
|
|
|
|
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
|
|
|
|
}
|
2004-05-02 13:20:49 +00:00
|
|
|
else
|
|
|
|
BringWindowToTop (GDK_WINDOW_HWND (window));
|
|
|
|
}
|
Merge from stable:
2002-12-09 Tor Lillqvist <tml@iki.fi>
Merge from stable:
* gdk/win32/gdkdrawable-win32.c (generic_draw): Don't leak
stipple_gc. More checks for errors. Use correct ternary ROP when
blitting the foreground into the tile pixmap onto those pixels
where the stipple is set. (I didn't notice that I had used the
wrong one, as it didn't matter on Win2k, where DIB sections
apparently are zeroed upon creation. But on Win98 they have random
initial contents. Thanks to Hans Breuer for reporting this.)
(gdk_win32_draw_rectangle, gdk_win32_draw_arc,
gdk_win32_draw_polygon): Don't pass the LINE_ATTRIBUTES bits to
generic_draw() if drawing a filled figure.
* gdk/win32/gdkmain-win32.c (_gdk_win32_print_dc): Minor cosmetics.
(_gdk_win32_gcvalues_mask_to_string): Initialize buffer as empty.
(_gdk_win32_window_state_to_string): New debugging output helper
function.
* gdk/win32/gdkevents-win32.c: Minor debugging output changes.
(gdk_event_translate): Ignore the WM_SHOWWINDOW/SW_OTHERUNZOOM or
SW_OTHERZOOM messages. Do not generate a GDK_UNMAP event for
WM_SIZE/SIZE_MINIMIZED messages, they do not really corrspond to
unmapping on X11. Set window state correctly for all three of
SIZE_{MINIMIZED,MAXIMIZED,RESTORED}. A maximized and then iconified
("minimized" in Windows terminology) window still has the
"maximized" property, i.e. when deiconified, it will reappear as
maximized. (#10557)
* gdk/win32/gdkprivate-win32.h: Declare new function.
(WIN32_API_FAILED, WIN32_GDI_FAILED, OTHER_API_FAILED): Don't use
__PRETTY_FUNCTION__ if __GNUC__ >= 3, to avoid warning message.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Handle more
situations. Add parameter to tell whether deiconifying. Code
reorg: Return early when appropriate instead of using nested if
statements. If just deiconifying without raising, restore active
window. (#10557)
(gdk_window_hide, gdk_window_withdraw, gdk_window_iconify,
gdk_window_deiconify, gdk_window_maximize, gdk_window_unmaximize,
gdk_window_focus): Use _gdk_win32_window_state_to_string() in
debugging output.
(gdk_window_iconify): Restore active window after calling
ShowWindow(). Otherwise the "next" window gets activated.
(gdk_window_stick, gdk_window_unstick): Don't output any warnings.
(gdk_window_set_transient_for): Rewrite. Just call SetWindowLong()
with GWL_HWNDPARENT, which despite its name sets the *owner*
window, which should be exactly what we want. The PSDK
documentation is said to be misleading. testgtk's modal window
test now works much better. (#50586)
2002-12-09 00:43:42 +00:00
|
|
|
else if (old_active_window != GDK_WINDOW_HWND (window))
|
|
|
|
SetActiveWindow (old_active_window);
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
2001-08-19 18:34:59 +00:00
|
|
|
void
|
|
|
|
gdk_window_show_unraised (GdkWindow *window)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
Merge from stable:
2002-12-09 Tor Lillqvist <tml@iki.fi>
Merge from stable:
* gdk/win32/gdkdrawable-win32.c (generic_draw): Don't leak
stipple_gc. More checks for errors. Use correct ternary ROP when
blitting the foreground into the tile pixmap onto those pixels
where the stipple is set. (I didn't notice that I had used the
wrong one, as it didn't matter on Win2k, where DIB sections
apparently are zeroed upon creation. But on Win98 they have random
initial contents. Thanks to Hans Breuer for reporting this.)
(gdk_win32_draw_rectangle, gdk_win32_draw_arc,
gdk_win32_draw_polygon): Don't pass the LINE_ATTRIBUTES bits to
generic_draw() if drawing a filled figure.
* gdk/win32/gdkmain-win32.c (_gdk_win32_print_dc): Minor cosmetics.
(_gdk_win32_gcvalues_mask_to_string): Initialize buffer as empty.
(_gdk_win32_window_state_to_string): New debugging output helper
function.
* gdk/win32/gdkevents-win32.c: Minor debugging output changes.
(gdk_event_translate): Ignore the WM_SHOWWINDOW/SW_OTHERUNZOOM or
SW_OTHERZOOM messages. Do not generate a GDK_UNMAP event for
WM_SIZE/SIZE_MINIMIZED messages, they do not really corrspond to
unmapping on X11. Set window state correctly for all three of
SIZE_{MINIMIZED,MAXIMIZED,RESTORED}. A maximized and then iconified
("minimized" in Windows terminology) window still has the
"maximized" property, i.e. when deiconified, it will reappear as
maximized. (#10557)
* gdk/win32/gdkprivate-win32.h: Declare new function.
(WIN32_API_FAILED, WIN32_GDI_FAILED, OTHER_API_FAILED): Don't use
__PRETTY_FUNCTION__ if __GNUC__ >= 3, to avoid warning message.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Handle more
situations. Add parameter to tell whether deiconifying. Code
reorg: Return early when appropriate instead of using nested if
statements. If just deiconifying without raising, restore active
window. (#10557)
(gdk_window_hide, gdk_window_withdraw, gdk_window_iconify,
gdk_window_deiconify, gdk_window_maximize, gdk_window_unmaximize,
gdk_window_focus): Use _gdk_win32_window_state_to_string() in
debugging output.
(gdk_window_iconify): Restore active window after calling
ShowWindow(). Otherwise the "next" window gets activated.
(gdk_window_stick, gdk_window_unstick): Don't output any warnings.
(gdk_window_set_transient_for): Rewrite. Just call SetWindowLong()
with GWL_HWNDPARENT, which despite its name sets the *owner*
window, which should be exactly what we want. The PSDK
documentation is said to be misleading. testgtk's modal window
test now works much better. (#50586)
2002-12-09 00:43:42 +00:00
|
|
|
show_window_internal (window, FALSE, FALSE);
|
2001-08-19 18:34:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_show (GdkWindow *window)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
Merge from stable:
2002-12-09 Tor Lillqvist <tml@iki.fi>
Merge from stable:
* gdk/win32/gdkdrawable-win32.c (generic_draw): Don't leak
stipple_gc. More checks for errors. Use correct ternary ROP when
blitting the foreground into the tile pixmap onto those pixels
where the stipple is set. (I didn't notice that I had used the
wrong one, as it didn't matter on Win2k, where DIB sections
apparently are zeroed upon creation. But on Win98 they have random
initial contents. Thanks to Hans Breuer for reporting this.)
(gdk_win32_draw_rectangle, gdk_win32_draw_arc,
gdk_win32_draw_polygon): Don't pass the LINE_ATTRIBUTES bits to
generic_draw() if drawing a filled figure.
* gdk/win32/gdkmain-win32.c (_gdk_win32_print_dc): Minor cosmetics.
(_gdk_win32_gcvalues_mask_to_string): Initialize buffer as empty.
(_gdk_win32_window_state_to_string): New debugging output helper
function.
* gdk/win32/gdkevents-win32.c: Minor debugging output changes.
(gdk_event_translate): Ignore the WM_SHOWWINDOW/SW_OTHERUNZOOM or
SW_OTHERZOOM messages. Do not generate a GDK_UNMAP event for
WM_SIZE/SIZE_MINIMIZED messages, they do not really corrspond to
unmapping on X11. Set window state correctly for all three of
SIZE_{MINIMIZED,MAXIMIZED,RESTORED}. A maximized and then iconified
("minimized" in Windows terminology) window still has the
"maximized" property, i.e. when deiconified, it will reappear as
maximized. (#10557)
* gdk/win32/gdkprivate-win32.h: Declare new function.
(WIN32_API_FAILED, WIN32_GDI_FAILED, OTHER_API_FAILED): Don't use
__PRETTY_FUNCTION__ if __GNUC__ >= 3, to avoid warning message.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Handle more
situations. Add parameter to tell whether deiconifying. Code
reorg: Return early when appropriate instead of using nested if
statements. If just deiconifying without raising, restore active
window. (#10557)
(gdk_window_hide, gdk_window_withdraw, gdk_window_iconify,
gdk_window_deiconify, gdk_window_maximize, gdk_window_unmaximize,
gdk_window_focus): Use _gdk_win32_window_state_to_string() in
debugging output.
(gdk_window_iconify): Restore active window after calling
ShowWindow(). Otherwise the "next" window gets activated.
(gdk_window_stick, gdk_window_unstick): Don't output any warnings.
(gdk_window_set_transient_for): Rewrite. Just call SetWindowLong()
with GWL_HWNDPARENT, which despite its name sets the *owner*
window, which should be exactly what we want. The PSDK
documentation is said to be misleading. testgtk's modal window
test now works much better. (#50586)
2002-12-09 00:43:42 +00:00
|
|
|
show_window_internal (window, TRUE, FALSE);
|
2001-08-19 18:34:59 +00:00
|
|
|
}
|
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
void
|
|
|
|
gdk_window_hide (GdkWindow *window)
|
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
GdkWindowObject *private;
|
|
|
|
|
2005-11-02 13:33:27 +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
|
|
|
private = (GdkWindowObject*) window;
|
gdk/win32/gdkprivate-win32.h New flags _gdk_input_locale_is_ime and
2003-07-25 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkglobals-win32.c: New flags _gdk_input_locale_is_ime
and _gdk_keyboard_has_altgr.
* gdk/win32/gdkevents-win32.c: Lots of changes. Most important
ones detailled here.
Code that has been ifdeffed out for a long time removed. Remove
some really old doc comments that were left behind for some public
functions, the official ones are in the X11 backend anyway. Change
GDK_WINDOW_OBJECT() calls to GdkWindowObject casts. Reformat
multi-line boolean expressions to have the operators at ends of
lines.
As mouse capture with SetCapture() indeed seems to work OK, no
need to have the correspoinding macro USE_SETCAPTURE and ifdefs.
Ifdef out the gdk-ping-msg stuff. I don't remember why it was
needed at some time, and things seem to work fine now without
(knock on wood).
Ifdef out the search for some Latin locale keyboard layout being
loaded. Not used currently, but might be needed after all, if we
decide that we want to be able to generate ASCII control character
events with a non-Latin keyboard.
(assign_object): New helper function, handles the g_object_ref()
and unref() calls when assigning GObject pointers.
(generate_crossing_events): Also generate the GDK_NOTIFY_INTERIOR
enter event when the pointer has moved to an ancestor window. Was
left out by mistake.
(gdk_window_is_ancestor): Renamed from gdk_window_is_child().
(gdk_pointer_grab, gdk_pointer_ungrab): Implement the confine_to
functionality, using ClipCursor().
(find_window_for_mouse_event): Splice part of code into new
function find_real_window_for_grabbed_mouse_event().
(fixup_event, append_event, apply_filters): New functions, code
refactored out from elsewhere.
(synthesize_enter_or_leave_event, synthesize_leave_event,
synthesize_enter_event,
synthesize_leave_events,synthesize_enter_events): Also take a
GdkCrossingMode parameter, in preparation to generating
GDK_CROSSING_GRAB and GDK_CROSSING_UNGRAB events.
(fixup_event, append_event, fill_key_event_string): New functions,
code refactoring.
(vk_from_char, build_keypress_event, build_keyrelease_event):
Removed as part of dropping WM_CHAR handling.
(build_key_event_state,gdk_event_translate): Call
GetKeyboardState(), once, for each keyboard message, instead of
several calls to GetKeyState() here and there.
(gdk_event_translate): Fix bugs #104516, #104662, #115902. While
at it, do some major refactoring, and some fixes for potential
problems noticed while going through the code.
Don't handle WM_CHAR at all. Only handle WM_KEYDOWN and
WM_KEYUP. Don't need the state variables related to whether to
wait for WM_CHAR or not, and whether the current key is
AltGr. Remove lots of complexity. Thus don't need the
use_ime_composition flag.
Not handling WM_CHAR means dead key handling will have to be taken
care of by GTK, but that seems to work fine, so no worry.
Another side-effect is that Alt+keypad digits don't work any
longer, but it's better to learn to use GTK's ISO14755 support is
anyway.
Be more careful in checking whether AltGr is involved. Only
attempt to handle it if the keyboard actually has it. And
explicitly check for *left* Control plus *right* Alt being
pressed. Still, allow (left) Alt and/or (right) Control with AltGr
chars.
Handle keys using similar code as in the X11 backend. As we have
built a keymap in gdkkeys-win32.c anyway, use it by calling
gdk_keymap_translate_keyboard_state() to look up the keysym from
the virtual key code and keyboard state. Build the key event
string in exactly the same way as the X11 backend.
If an IME is being used, don't generate GDK events for keys
between receiving WM_IME_STARTCOMPOSITION and
WM_IME_ENDCOMPOSITION, as those keys are for the IME.
For WM_IME_COMPOSITION, handle all the Unicode chars returned from
the IME, not just the first one.
gdk_event_translate() is still quite complex, could split the
message handler cases out into separate functions.
On mouse events, when the mouse is grabbed, use
find_real_window_for_grabbed_mouse_event() in order to be able to
generate correct crossing events.
No longer take a pre-allocated GdkEvent as parameter. Instead,
allocate events as needed and append them to the queue. (This is
different from how gdk_event_translate() in the X11 backend
works.) This change made the code much clearer, especially in the
cases where we have to generate several GDK events for one Windows
message. Return FALSE if DefWindowProc() should be called, TRUE
if not. If DefWindowProc() should not be called, also return the
value to be returned from the window procedure.
(Previously, the interaction with gdk_event_translate()'s caller
was much more complex, when we had to indicate whether the
already-queued event should be left in the queue or removed, and
in addition also had to indicate whether to call DefWindowProc()
or not, and what value to return from the window procedure if
not.)
Don't use a separate "private" variable required to be pointing to
the GdkWindowObject of the "window" variable at all times. Just
use casts, even if looks a bit uglier.
Notice destroyed windows as early as possible, and break out of
the messsage switch.
Use _gdk_pointer_root as current_window when the pointer is
outside GDK's top-level windows.
On WM_INPUTLANGCHANGE, set _gdk_input_locale_is_ime as
appropriate, based on ImmIsIME().
(gdk_event_translate, gdk_event_send_client_message_for_display,
gdk_screen_broadcast_client_message): Implement client messages.
Use a registered Windows message to pass GDK client messages. Note
that the amount of user data is restricted to four bytes, as it is
carried in the LPARAM. (The WPARAM is used for the message type
"atom".)
(real_window_procedure): Adapt for new gdk_event_translate()
interface.
* gdk/win32/gdkmain-win32.c (_gdk_windowing_init): Set
_gdk_input_locale_is_ime initially.
* gdk/win32/gdkwindow-win32.c: Use g_object_ref()/unref() instead
of g_colormap_ref()/unref().
(gdk_window_new): Made code a bit more like the X11 one, pretend
to handle screens (although we just have one for now).
* gdk/x11/gdkevents-x11.c
(gdk_event_send_client_message_for_display,
gdk_screen_broadcast_client_message): Document the user data
limitation on Win32.
* gdk/win32/gdkevents-win32.c (print_event): More complete enter
and leave notify detail output.
* gdk/win32/gdkkeys-win32.c (update_keymap): Make dead keys
visible to GDK and GTK. Store the corresponding GDK_dead_* keysym
for those, so that the GtkIMContextCimple compose tables will
work. Deduce if the keyboard layout has the AltGr key, and set the
above flag accordingly.
2003-07-26 01:54:59 +00:00
|
|
|
if (private->destroyed)
|
|
|
|
return;
|
2000-07-25 17:31:05 +00:00
|
|
|
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_hide: %p: %s\n",
|
gdk/win32/gdkprivate-win32.h New flags _gdk_input_locale_is_ime and
2003-07-25 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkglobals-win32.c: New flags _gdk_input_locale_is_ime
and _gdk_keyboard_has_altgr.
* gdk/win32/gdkevents-win32.c: Lots of changes. Most important
ones detailled here.
Code that has been ifdeffed out for a long time removed. Remove
some really old doc comments that were left behind for some public
functions, the official ones are in the X11 backend anyway. Change
GDK_WINDOW_OBJECT() calls to GdkWindowObject casts. Reformat
multi-line boolean expressions to have the operators at ends of
lines.
As mouse capture with SetCapture() indeed seems to work OK, no
need to have the correspoinding macro USE_SETCAPTURE and ifdefs.
Ifdef out the gdk-ping-msg stuff. I don't remember why it was
needed at some time, and things seem to work fine now without
(knock on wood).
Ifdef out the search for some Latin locale keyboard layout being
loaded. Not used currently, but might be needed after all, if we
decide that we want to be able to generate ASCII control character
events with a non-Latin keyboard.
(assign_object): New helper function, handles the g_object_ref()
and unref() calls when assigning GObject pointers.
(generate_crossing_events): Also generate the GDK_NOTIFY_INTERIOR
enter event when the pointer has moved to an ancestor window. Was
left out by mistake.
(gdk_window_is_ancestor): Renamed from gdk_window_is_child().
(gdk_pointer_grab, gdk_pointer_ungrab): Implement the confine_to
functionality, using ClipCursor().
(find_window_for_mouse_event): Splice part of code into new
function find_real_window_for_grabbed_mouse_event().
(fixup_event, append_event, apply_filters): New functions, code
refactored out from elsewhere.
(synthesize_enter_or_leave_event, synthesize_leave_event,
synthesize_enter_event,
synthesize_leave_events,synthesize_enter_events): Also take a
GdkCrossingMode parameter, in preparation to generating
GDK_CROSSING_GRAB and GDK_CROSSING_UNGRAB events.
(fixup_event, append_event, fill_key_event_string): New functions,
code refactoring.
(vk_from_char, build_keypress_event, build_keyrelease_event):
Removed as part of dropping WM_CHAR handling.
(build_key_event_state,gdk_event_translate): Call
GetKeyboardState(), once, for each keyboard message, instead of
several calls to GetKeyState() here and there.
(gdk_event_translate): Fix bugs #104516, #104662, #115902. While
at it, do some major refactoring, and some fixes for potential
problems noticed while going through the code.
Don't handle WM_CHAR at all. Only handle WM_KEYDOWN and
WM_KEYUP. Don't need the state variables related to whether to
wait for WM_CHAR or not, and whether the current key is
AltGr. Remove lots of complexity. Thus don't need the
use_ime_composition flag.
Not handling WM_CHAR means dead key handling will have to be taken
care of by GTK, but that seems to work fine, so no worry.
Another side-effect is that Alt+keypad digits don't work any
longer, but it's better to learn to use GTK's ISO14755 support is
anyway.
Be more careful in checking whether AltGr is involved. Only
attempt to handle it if the keyboard actually has it. And
explicitly check for *left* Control plus *right* Alt being
pressed. Still, allow (left) Alt and/or (right) Control with AltGr
chars.
Handle keys using similar code as in the X11 backend. As we have
built a keymap in gdkkeys-win32.c anyway, use it by calling
gdk_keymap_translate_keyboard_state() to look up the keysym from
the virtual key code and keyboard state. Build the key event
string in exactly the same way as the X11 backend.
If an IME is being used, don't generate GDK events for keys
between receiving WM_IME_STARTCOMPOSITION and
WM_IME_ENDCOMPOSITION, as those keys are for the IME.
For WM_IME_COMPOSITION, handle all the Unicode chars returned from
the IME, not just the first one.
gdk_event_translate() is still quite complex, could split the
message handler cases out into separate functions.
On mouse events, when the mouse is grabbed, use
find_real_window_for_grabbed_mouse_event() in order to be able to
generate correct crossing events.
No longer take a pre-allocated GdkEvent as parameter. Instead,
allocate events as needed and append them to the queue. (This is
different from how gdk_event_translate() in the X11 backend
works.) This change made the code much clearer, especially in the
cases where we have to generate several GDK events for one Windows
message. Return FALSE if DefWindowProc() should be called, TRUE
if not. If DefWindowProc() should not be called, also return the
value to be returned from the window procedure.
(Previously, the interaction with gdk_event_translate()'s caller
was much more complex, when we had to indicate whether the
already-queued event should be left in the queue or removed, and
in addition also had to indicate whether to call DefWindowProc()
or not, and what value to return from the window procedure if
not.)
Don't use a separate "private" variable required to be pointing to
the GdkWindowObject of the "window" variable at all times. Just
use casts, even if looks a bit uglier.
Notice destroyed windows as early as possible, and break out of
the messsage switch.
Use _gdk_pointer_root as current_window when the pointer is
outside GDK's top-level windows.
On WM_INPUTLANGCHANGE, set _gdk_input_locale_is_ime as
appropriate, based on ImmIsIME().
(gdk_event_translate, gdk_event_send_client_message_for_display,
gdk_screen_broadcast_client_message): Implement client messages.
Use a registered Windows message to pass GDK client messages. Note
that the amount of user data is restricted to four bytes, as it is
carried in the LPARAM. (The WPARAM is used for the message type
"atom".)
(real_window_procedure): Adapt for new gdk_event_translate()
interface.
* gdk/win32/gdkmain-win32.c (_gdk_windowing_init): Set
_gdk_input_locale_is_ime initially.
* gdk/win32/gdkwindow-win32.c: Use g_object_ref()/unref() instead
of g_colormap_ref()/unref().
(gdk_window_new): Made code a bit more like the X11 one, pretend
to handle screens (although we just have one for now).
* gdk/x11/gdkevents-x11.c
(gdk_event_send_client_message_for_display,
gdk_screen_broadcast_client_message): Document the user data
limitation on Win32.
* gdk/win32/gdkevents-win32.c (print_event): More complete enter
and leave notify detail output.
* gdk/win32/gdkkeys-win32.c (update_keymap): Make dead keys
visible to GDK and GTK. Store the corresponding GDK_dead_* keysym
for those, so that the GtkIMContextCimple compose tables will
work. Deduce if the keyboard layout has the AltGr key, and set the
above flag accordingly.
2003-07-26 01:54:59 +00:00
|
|
|
GDK_WINDOW_HWND (window),
|
|
|
|
_gdk_win32_window_state_to_string (private->state)));
|
|
|
|
|
|
|
|
if (GDK_WINDOW_IS_MAPPED (window))
|
|
|
|
gdk_synthesize_window_state (window,
|
|
|
|
0,
|
|
|
|
GDK_WINDOW_STATE_WITHDRAWN);
|
|
|
|
|
|
|
|
_gdk_window_clear_update_area (window);
|
|
|
|
|
|
|
|
if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_TOPLEVEL)
|
|
|
|
ShowOwnedPopups (GDK_WINDOW_HWND (window), FALSE);
|
|
|
|
|
|
|
|
if (GetWindowLong (GDK_WINDOW_HWND (window), GWL_EXSTYLE) & WS_EX_TRANSPARENT)
|
|
|
|
{
|
2005-03-16 01:38:57 +00:00
|
|
|
SetWindowPos (GDK_WINDOW_HWND (window), HWND_BOTTOM,
|
|
|
|
0, 0, 0, 0,
|
2004-03-10 22:20:36 +00:00
|
|
|
SWP_HIDEWINDOW | SWP_NOREDRAW | SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE);
|
gdk/win32/gdkprivate-win32.h New flags _gdk_input_locale_is_ime and
2003-07-25 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkglobals-win32.c: New flags _gdk_input_locale_is_ime
and _gdk_keyboard_has_altgr.
* gdk/win32/gdkevents-win32.c: Lots of changes. Most important
ones detailled here.
Code that has been ifdeffed out for a long time removed. Remove
some really old doc comments that were left behind for some public
functions, the official ones are in the X11 backend anyway. Change
GDK_WINDOW_OBJECT() calls to GdkWindowObject casts. Reformat
multi-line boolean expressions to have the operators at ends of
lines.
As mouse capture with SetCapture() indeed seems to work OK, no
need to have the correspoinding macro USE_SETCAPTURE and ifdefs.
Ifdef out the gdk-ping-msg stuff. I don't remember why it was
needed at some time, and things seem to work fine now without
(knock on wood).
Ifdef out the search for some Latin locale keyboard layout being
loaded. Not used currently, but might be needed after all, if we
decide that we want to be able to generate ASCII control character
events with a non-Latin keyboard.
(assign_object): New helper function, handles the g_object_ref()
and unref() calls when assigning GObject pointers.
(generate_crossing_events): Also generate the GDK_NOTIFY_INTERIOR
enter event when the pointer has moved to an ancestor window. Was
left out by mistake.
(gdk_window_is_ancestor): Renamed from gdk_window_is_child().
(gdk_pointer_grab, gdk_pointer_ungrab): Implement the confine_to
functionality, using ClipCursor().
(find_window_for_mouse_event): Splice part of code into new
function find_real_window_for_grabbed_mouse_event().
(fixup_event, append_event, apply_filters): New functions, code
refactored out from elsewhere.
(synthesize_enter_or_leave_event, synthesize_leave_event,
synthesize_enter_event,
synthesize_leave_events,synthesize_enter_events): Also take a
GdkCrossingMode parameter, in preparation to generating
GDK_CROSSING_GRAB and GDK_CROSSING_UNGRAB events.
(fixup_event, append_event, fill_key_event_string): New functions,
code refactoring.
(vk_from_char, build_keypress_event, build_keyrelease_event):
Removed as part of dropping WM_CHAR handling.
(build_key_event_state,gdk_event_translate): Call
GetKeyboardState(), once, for each keyboard message, instead of
several calls to GetKeyState() here and there.
(gdk_event_translate): Fix bugs #104516, #104662, #115902. While
at it, do some major refactoring, and some fixes for potential
problems noticed while going through the code.
Don't handle WM_CHAR at all. Only handle WM_KEYDOWN and
WM_KEYUP. Don't need the state variables related to whether to
wait for WM_CHAR or not, and whether the current key is
AltGr. Remove lots of complexity. Thus don't need the
use_ime_composition flag.
Not handling WM_CHAR means dead key handling will have to be taken
care of by GTK, but that seems to work fine, so no worry.
Another side-effect is that Alt+keypad digits don't work any
longer, but it's better to learn to use GTK's ISO14755 support is
anyway.
Be more careful in checking whether AltGr is involved. Only
attempt to handle it if the keyboard actually has it. And
explicitly check for *left* Control plus *right* Alt being
pressed. Still, allow (left) Alt and/or (right) Control with AltGr
chars.
Handle keys using similar code as in the X11 backend. As we have
built a keymap in gdkkeys-win32.c anyway, use it by calling
gdk_keymap_translate_keyboard_state() to look up the keysym from
the virtual key code and keyboard state. Build the key event
string in exactly the same way as the X11 backend.
If an IME is being used, don't generate GDK events for keys
between receiving WM_IME_STARTCOMPOSITION and
WM_IME_ENDCOMPOSITION, as those keys are for the IME.
For WM_IME_COMPOSITION, handle all the Unicode chars returned from
the IME, not just the first one.
gdk_event_translate() is still quite complex, could split the
message handler cases out into separate functions.
On mouse events, when the mouse is grabbed, use
find_real_window_for_grabbed_mouse_event() in order to be able to
generate correct crossing events.
No longer take a pre-allocated GdkEvent as parameter. Instead,
allocate events as needed and append them to the queue. (This is
different from how gdk_event_translate() in the X11 backend
works.) This change made the code much clearer, especially in the
cases where we have to generate several GDK events for one Windows
message. Return FALSE if DefWindowProc() should be called, TRUE
if not. If DefWindowProc() should not be called, also return the
value to be returned from the window procedure.
(Previously, the interaction with gdk_event_translate()'s caller
was much more complex, when we had to indicate whether the
already-queued event should be left in the queue or removed, and
in addition also had to indicate whether to call DefWindowProc()
or not, and what value to return from the window procedure if
not.)
Don't use a separate "private" variable required to be pointing to
the GdkWindowObject of the "window" variable at all times. Just
use casts, even if looks a bit uglier.
Notice destroyed windows as early as possible, and break out of
the messsage switch.
Use _gdk_pointer_root as current_window when the pointer is
outside GDK's top-level windows.
On WM_INPUTLANGCHANGE, set _gdk_input_locale_is_ime as
appropriate, based on ImmIsIME().
(gdk_event_translate, gdk_event_send_client_message_for_display,
gdk_screen_broadcast_client_message): Implement client messages.
Use a registered Windows message to pass GDK client messages. Note
that the amount of user data is restricted to four bytes, as it is
carried in the LPARAM. (The WPARAM is used for the message type
"atom".)
(real_window_procedure): Adapt for new gdk_event_translate()
interface.
* gdk/win32/gdkmain-win32.c (_gdk_windowing_init): Set
_gdk_input_locale_is_ime initially.
* gdk/win32/gdkwindow-win32.c: Use g_object_ref()/unref() instead
of g_colormap_ref()/unref().
(gdk_window_new): Made code a bit more like the X11 one, pretend
to handle screens (although we just have one for now).
* gdk/x11/gdkevents-x11.c
(gdk_event_send_client_message_for_display,
gdk_screen_broadcast_client_message): Document the user data
limitation on Win32.
* gdk/win32/gdkevents-win32.c (print_event): More complete enter
and leave notify detail output.
* gdk/win32/gdkkeys-win32.c (update_keymap): Make dead keys
visible to GDK and GTK. Store the corresponding GDK_dead_* keysym
for those, so that the GtkIMContextCimple compose tables will
work. Deduce if the keyboard layout has the AltGr key, and set the
above flag accordingly.
2003-07-26 01:54:59 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
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;
|
|
|
|
|
2005-11-02 13:33:27 +00:00
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
2000-07-25 17:31:05 +00:00
|
|
|
|
|
|
|
private = (GdkWindowObject*) window;
|
gdk/win32/gdkprivate-win32.h New flags _gdk_input_locale_is_ime and
2003-07-25 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkglobals-win32.c: New flags _gdk_input_locale_is_ime
and _gdk_keyboard_has_altgr.
* gdk/win32/gdkevents-win32.c: Lots of changes. Most important
ones detailled here.
Code that has been ifdeffed out for a long time removed. Remove
some really old doc comments that were left behind for some public
functions, the official ones are in the X11 backend anyway. Change
GDK_WINDOW_OBJECT() calls to GdkWindowObject casts. Reformat
multi-line boolean expressions to have the operators at ends of
lines.
As mouse capture with SetCapture() indeed seems to work OK, no
need to have the correspoinding macro USE_SETCAPTURE and ifdefs.
Ifdef out the gdk-ping-msg stuff. I don't remember why it was
needed at some time, and things seem to work fine now without
(knock on wood).
Ifdef out the search for some Latin locale keyboard layout being
loaded. Not used currently, but might be needed after all, if we
decide that we want to be able to generate ASCII control character
events with a non-Latin keyboard.
(assign_object): New helper function, handles the g_object_ref()
and unref() calls when assigning GObject pointers.
(generate_crossing_events): Also generate the GDK_NOTIFY_INTERIOR
enter event when the pointer has moved to an ancestor window. Was
left out by mistake.
(gdk_window_is_ancestor): Renamed from gdk_window_is_child().
(gdk_pointer_grab, gdk_pointer_ungrab): Implement the confine_to
functionality, using ClipCursor().
(find_window_for_mouse_event): Splice part of code into new
function find_real_window_for_grabbed_mouse_event().
(fixup_event, append_event, apply_filters): New functions, code
refactored out from elsewhere.
(synthesize_enter_or_leave_event, synthesize_leave_event,
synthesize_enter_event,
synthesize_leave_events,synthesize_enter_events): Also take a
GdkCrossingMode parameter, in preparation to generating
GDK_CROSSING_GRAB and GDK_CROSSING_UNGRAB events.
(fixup_event, append_event, fill_key_event_string): New functions,
code refactoring.
(vk_from_char, build_keypress_event, build_keyrelease_event):
Removed as part of dropping WM_CHAR handling.
(build_key_event_state,gdk_event_translate): Call
GetKeyboardState(), once, for each keyboard message, instead of
several calls to GetKeyState() here and there.
(gdk_event_translate): Fix bugs #104516, #104662, #115902. While
at it, do some major refactoring, and some fixes for potential
problems noticed while going through the code.
Don't handle WM_CHAR at all. Only handle WM_KEYDOWN and
WM_KEYUP. Don't need the state variables related to whether to
wait for WM_CHAR or not, and whether the current key is
AltGr. Remove lots of complexity. Thus don't need the
use_ime_composition flag.
Not handling WM_CHAR means dead key handling will have to be taken
care of by GTK, but that seems to work fine, so no worry.
Another side-effect is that Alt+keypad digits don't work any
longer, but it's better to learn to use GTK's ISO14755 support is
anyway.
Be more careful in checking whether AltGr is involved. Only
attempt to handle it if the keyboard actually has it. And
explicitly check for *left* Control plus *right* Alt being
pressed. Still, allow (left) Alt and/or (right) Control with AltGr
chars.
Handle keys using similar code as in the X11 backend. As we have
built a keymap in gdkkeys-win32.c anyway, use it by calling
gdk_keymap_translate_keyboard_state() to look up the keysym from
the virtual key code and keyboard state. Build the key event
string in exactly the same way as the X11 backend.
If an IME is being used, don't generate GDK events for keys
between receiving WM_IME_STARTCOMPOSITION and
WM_IME_ENDCOMPOSITION, as those keys are for the IME.
For WM_IME_COMPOSITION, handle all the Unicode chars returned from
the IME, not just the first one.
gdk_event_translate() is still quite complex, could split the
message handler cases out into separate functions.
On mouse events, when the mouse is grabbed, use
find_real_window_for_grabbed_mouse_event() in order to be able to
generate correct crossing events.
No longer take a pre-allocated GdkEvent as parameter. Instead,
allocate events as needed and append them to the queue. (This is
different from how gdk_event_translate() in the X11 backend
works.) This change made the code much clearer, especially in the
cases where we have to generate several GDK events for one Windows
message. Return FALSE if DefWindowProc() should be called, TRUE
if not. If DefWindowProc() should not be called, also return the
value to be returned from the window procedure.
(Previously, the interaction with gdk_event_translate()'s caller
was much more complex, when we had to indicate whether the
already-queued event should be left in the queue or removed, and
in addition also had to indicate whether to call DefWindowProc()
or not, and what value to return from the window procedure if
not.)
Don't use a separate "private" variable required to be pointing to
the GdkWindowObject of the "window" variable at all times. Just
use casts, even if looks a bit uglier.
Notice destroyed windows as early as possible, and break out of
the messsage switch.
Use _gdk_pointer_root as current_window when the pointer is
outside GDK's top-level windows.
On WM_INPUTLANGCHANGE, set _gdk_input_locale_is_ime as
appropriate, based on ImmIsIME().
(gdk_event_translate, gdk_event_send_client_message_for_display,
gdk_screen_broadcast_client_message): Implement client messages.
Use a registered Windows message to pass GDK client messages. Note
that the amount of user data is restricted to four bytes, as it is
carried in the LPARAM. (The WPARAM is used for the message type
"atom".)
(real_window_procedure): Adapt for new gdk_event_translate()
interface.
* gdk/win32/gdkmain-win32.c (_gdk_windowing_init): Set
_gdk_input_locale_is_ime initially.
* gdk/win32/gdkwindow-win32.c: Use g_object_ref()/unref() instead
of g_colormap_ref()/unref().
(gdk_window_new): Made code a bit more like the X11 one, pretend
to handle screens (although we just have one for now).
* gdk/x11/gdkevents-x11.c
(gdk_event_send_client_message_for_display,
gdk_screen_broadcast_client_message): Document the user data
limitation on Win32.
* gdk/win32/gdkevents-win32.c (print_event): More complete enter
and leave notify detail output.
* gdk/win32/gdkkeys-win32.c (update_keymap): Make dead keys
visible to GDK and GTK. Store the corresponding GDK_dead_* keysym
for those, so that the GtkIMContextCimple compose tables will
work. Deduce if the keyboard layout has the AltGr key, and set the
above flag accordingly.
2003-07-26 01:54:59 +00:00
|
|
|
if (private->destroyed)
|
|
|
|
return;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_withdraw: %p: %s\n",
|
gdk/win32/gdkprivate-win32.h New flags _gdk_input_locale_is_ime and
2003-07-25 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkglobals-win32.c: New flags _gdk_input_locale_is_ime
and _gdk_keyboard_has_altgr.
* gdk/win32/gdkevents-win32.c: Lots of changes. Most important
ones detailled here.
Code that has been ifdeffed out for a long time removed. Remove
some really old doc comments that were left behind for some public
functions, the official ones are in the X11 backend anyway. Change
GDK_WINDOW_OBJECT() calls to GdkWindowObject casts. Reformat
multi-line boolean expressions to have the operators at ends of
lines.
As mouse capture with SetCapture() indeed seems to work OK, no
need to have the correspoinding macro USE_SETCAPTURE and ifdefs.
Ifdef out the gdk-ping-msg stuff. I don't remember why it was
needed at some time, and things seem to work fine now without
(knock on wood).
Ifdef out the search for some Latin locale keyboard layout being
loaded. Not used currently, but might be needed after all, if we
decide that we want to be able to generate ASCII control character
events with a non-Latin keyboard.
(assign_object): New helper function, handles the g_object_ref()
and unref() calls when assigning GObject pointers.
(generate_crossing_events): Also generate the GDK_NOTIFY_INTERIOR
enter event when the pointer has moved to an ancestor window. Was
left out by mistake.
(gdk_window_is_ancestor): Renamed from gdk_window_is_child().
(gdk_pointer_grab, gdk_pointer_ungrab): Implement the confine_to
functionality, using ClipCursor().
(find_window_for_mouse_event): Splice part of code into new
function find_real_window_for_grabbed_mouse_event().
(fixup_event, append_event, apply_filters): New functions, code
refactored out from elsewhere.
(synthesize_enter_or_leave_event, synthesize_leave_event,
synthesize_enter_event,
synthesize_leave_events,synthesize_enter_events): Also take a
GdkCrossingMode parameter, in preparation to generating
GDK_CROSSING_GRAB and GDK_CROSSING_UNGRAB events.
(fixup_event, append_event, fill_key_event_string): New functions,
code refactoring.
(vk_from_char, build_keypress_event, build_keyrelease_event):
Removed as part of dropping WM_CHAR handling.
(build_key_event_state,gdk_event_translate): Call
GetKeyboardState(), once, for each keyboard message, instead of
several calls to GetKeyState() here and there.
(gdk_event_translate): Fix bugs #104516, #104662, #115902. While
at it, do some major refactoring, and some fixes for potential
problems noticed while going through the code.
Don't handle WM_CHAR at all. Only handle WM_KEYDOWN and
WM_KEYUP. Don't need the state variables related to whether to
wait for WM_CHAR or not, and whether the current key is
AltGr. Remove lots of complexity. Thus don't need the
use_ime_composition flag.
Not handling WM_CHAR means dead key handling will have to be taken
care of by GTK, but that seems to work fine, so no worry.
Another side-effect is that Alt+keypad digits don't work any
longer, but it's better to learn to use GTK's ISO14755 support is
anyway.
Be more careful in checking whether AltGr is involved. Only
attempt to handle it if the keyboard actually has it. And
explicitly check for *left* Control plus *right* Alt being
pressed. Still, allow (left) Alt and/or (right) Control with AltGr
chars.
Handle keys using similar code as in the X11 backend. As we have
built a keymap in gdkkeys-win32.c anyway, use it by calling
gdk_keymap_translate_keyboard_state() to look up the keysym from
the virtual key code and keyboard state. Build the key event
string in exactly the same way as the X11 backend.
If an IME is being used, don't generate GDK events for keys
between receiving WM_IME_STARTCOMPOSITION and
WM_IME_ENDCOMPOSITION, as those keys are for the IME.
For WM_IME_COMPOSITION, handle all the Unicode chars returned from
the IME, not just the first one.
gdk_event_translate() is still quite complex, could split the
message handler cases out into separate functions.
On mouse events, when the mouse is grabbed, use
find_real_window_for_grabbed_mouse_event() in order to be able to
generate correct crossing events.
No longer take a pre-allocated GdkEvent as parameter. Instead,
allocate events as needed and append them to the queue. (This is
different from how gdk_event_translate() in the X11 backend
works.) This change made the code much clearer, especially in the
cases where we have to generate several GDK events for one Windows
message. Return FALSE if DefWindowProc() should be called, TRUE
if not. If DefWindowProc() should not be called, also return the
value to be returned from the window procedure.
(Previously, the interaction with gdk_event_translate()'s caller
was much more complex, when we had to indicate whether the
already-queued event should be left in the queue or removed, and
in addition also had to indicate whether to call DefWindowProc()
or not, and what value to return from the window procedure if
not.)
Don't use a separate "private" variable required to be pointing to
the GdkWindowObject of the "window" variable at all times. Just
use casts, even if looks a bit uglier.
Notice destroyed windows as early as possible, and break out of
the messsage switch.
Use _gdk_pointer_root as current_window when the pointer is
outside GDK's top-level windows.
On WM_INPUTLANGCHANGE, set _gdk_input_locale_is_ime as
appropriate, based on ImmIsIME().
(gdk_event_translate, gdk_event_send_client_message_for_display,
gdk_screen_broadcast_client_message): Implement client messages.
Use a registered Windows message to pass GDK client messages. Note
that the amount of user data is restricted to four bytes, as it is
carried in the LPARAM. (The WPARAM is used for the message type
"atom".)
(real_window_procedure): Adapt for new gdk_event_translate()
interface.
* gdk/win32/gdkmain-win32.c (_gdk_windowing_init): Set
_gdk_input_locale_is_ime initially.
* gdk/win32/gdkwindow-win32.c: Use g_object_ref()/unref() instead
of g_colormap_ref()/unref().
(gdk_window_new): Made code a bit more like the X11 one, pretend
to handle screens (although we just have one for now).
* gdk/x11/gdkevents-x11.c
(gdk_event_send_client_message_for_display,
gdk_screen_broadcast_client_message): Document the user data
limitation on Win32.
* gdk/win32/gdkevents-win32.c (print_event): More complete enter
and leave notify detail output.
* gdk/win32/gdkkeys-win32.c (update_keymap): Make dead keys
visible to GDK and GTK. Store the corresponding GDK_dead_* keysym
for those, so that the GtkIMContextCimple compose tables will
work. Deduce if the keyboard layout has the AltGr key, and set the
above flag accordingly.
2003-07-26 01:54:59 +00:00
|
|
|
GDK_WINDOW_HWND (window),
|
|
|
|
_gdk_win32_window_state_to_string (private->state)));
|
|
|
|
|
|
|
|
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
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2003-08-02 02:05:12 +00:00
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
|
|
|
return;
|
|
|
|
|
2005-03-16 01:38:57 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_move: %p: %+d%+d\n",
|
Merge from stable:
2003-01-19 Tor Lillqvist <tml@iki.fi>
Merge from stable:
Fix for #103614 and some other problems with GtkFileSelection on
Windows:
* gtk/fnmatch.c (get_char): Need to use g_unichar_tolower(), not
g_ascii_tolower(). Windows file names are case-insensitive for all
Unicode letters.
* gtk/gtkfilesel.c: Instead of checking for G_OS_WIN32 or
G_WITH_CYGWIN, check G_PLATFORM_WIN32. Move inclusion of gtkintl.h
earlier, as it includes config.h unconditionally, and gtkprivate.h
redefines GTK_LOCALEDIR.
(struct _CompletionDirSent): Ifdef out the fields not used on
Windows.
(compare_utf8_filenames, compare_sys_filenames): Need different
comparison implementation for UTF-8 file names and system locale
file names on Win32. Cannot simply use g_ascii_strcasecmp(), but
need to casefold all Unicode letters.
(cmpl_completion_matches, open_dir, correct_parent): Ifdef out
variables not used on Win32 to avoid warnings about unused
variables.
(open_ref_dir): Use g_path_skip_root() to skip past potential
drive letter in front of the leading (back)slash.
(open_new_dir): Ifdef out use of CompletionDirSent fields not
there on Win32.
(correct_parent): Bypass inode check also on Cygwin.
Fix bug noticed by Alex Shaduri: Tooltips and other
GDK_WINDOW_TEMP windows were activated. This looked very odd, and
was a regression from earlier versions.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Fine-tune
behaviour. Don't ever activate GDK_WINDOW_TEMP windows.
(gdk_window_move, gdk_window_resize): Add debug logging.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): When we get a
WM_SIZE message for a non-visible (withdrawn) window, don't clear
the GDK_WINDOW_STATE_WITHDRAWN bit. The window is still withdrawn
even if its size changes.
2003-01-19 21:18:15 +00:00
|
|
|
GDK_WINDOW_HWND (window), x, y));
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (private->impl);
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
|
2003-08-05 22:24:35 +00:00
|
|
|
if (private->state & GDK_WINDOW_STATE_FULLSCREEN)
|
|
|
|
return;
|
|
|
|
|
2005-03-16 01:38:57 +00:00
|
|
|
/* Don't check GDK_WINDOW_TYPE (private) == GDK_WINDOW_CHILD.
|
|
|
|
* Foreign windows (another app's windows) might be children of our
|
|
|
|
* windows! Especially in the case of gtkplug/socket.
|
|
|
|
*/
|
2005-03-16 02:21:14 +00:00
|
|
|
if (GetAncestor (GDK_WINDOW_HWND (window), GA_PARENT) != GetDesktopWindow ())
|
2007-07-12 23:38:30 +00:00
|
|
|
{
|
|
|
|
_gdk_window_move_resize_child (window, x, y, impl->width, impl->height);
|
|
|
|
}
|
2003-08-02 02:05:12 +00:00
|
|
|
else
|
2001-08-19 18:34:59 +00:00
|
|
|
{
|
2003-08-02 02:05:12 +00:00
|
|
|
RECT outer_rect;
|
|
|
|
|
|
|
|
get_outer_rect (window, impl->width, impl->height, &outer_rect);
|
|
|
|
|
|
|
|
adjust_for_gravity_hints (impl, &outer_rect, &x, &y);
|
|
|
|
|
2005-03-16 01:38:57 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("... SetWindowPos(%p,NULL,%d,%d,0,0,"
|
|
|
|
"NOACTIVATE|NOSIZE|NOZORDER)\n",
|
|
|
|
GDK_WINDOW_HWND (window),
|
|
|
|
x - _gdk_offset_x, y - _gdk_offset_y));
|
|
|
|
|
2003-08-02 02:05:12 +00:00
|
|
|
API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window), NULL,
|
gdk/win32/gdkinput-win32.h Drop the GdkEvent* parameter, it wasn't used.
2003-08-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkinput-win32.h
* gdk/win32/gdkinput-win32.c (_gdk_input_configure_event,
_gdk_input_enter_event): Drop the GdkEvent* parameter, it wasn't
used.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): Adapt caller
accordingly, in fact an uninitialised variable was dereferenced.
[Win32] Add support for multiple monitors.
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkglobals-win32.c: New global variables for
multiple-monitor info: _gdk_num_monitors, _gdk_monitors, and
_gdk_offset_x and _gdk_offset_y.
* gdk/win32/gdkdisplay-win32.c (count_monitor, enum_monitor): New
functions, enumeration functions passed to EnumDisplayMonitors().
(gdk_display_open): If the EnumDisplayMonitors() and
GetMonitorInfo() API is present (on Win98, Win2000 and newer), use
if to find out monitor info.
Calculate the offset between Win32 coordinates (relative to the
primary monitor's origin (and thus negative on monitors to the
left of or above it), and GDK's (visible coordinates should be
non-negative).
* gdk/win32/gdkscreen-win32 (gdk_screen_get_n_monitors,
gdk_screen_get_monitor_geometry): Use information collected above.
(gdk_window_move, gdk_window_move_resize_window_get_geometry):
Subtract _gdk_offset_{x,y} from GDK root window coordinates.
(gdk_window_get_geometry, gdk_window_get_origin,
gdk_window_get_frame_extents): For top-level windows, add
_gdk_offset_{x,y} to GDK root window coordinates
Still need to handle multiple monitors in
gdk_window_fullscreen(). Probably should make the window
fullscreen on the monitor where the cursor is?
* gdk/win32/gdkevents-win32.c: Add _gdk_offset_{x,y} to all GDK
root window coordinates in GdkEvents.
[Win32] Fix geometry hint handling. Add support for resize
increment and base size, and aspect ratio geometry hints. The
"gridded geometry" test in testgtk now works beautifully.
* gdk/win32/gdkwindow-win32.c (gdk_window_set_geometry_hints):
Turns out this function shouldn't actually ever modify the
window's size, just store the hints. (Old code kept for a while
inside #if 0.)
(gdk_window_set_hints): Remove presumably broken code that handles
the position hints, this function is obsolete anyway.
* gdk/win32/gdkevents-win32.c: Drop the current_{x,y}_root
variables, not used.
(adjust_drag): New function, used to implement resize increment
hints.
(gdk_event_translate): Handle WM_SIZING, implement resize
increment and base size, and aspect ratio geometry hints here. The
WM_GETMINMAXINFO handler takes care of the minimum and maximum
size hints as before. Fix the WM_GETMINMAXINFO handler to take
into account window decorations. No need to modify the
ptMaxPosition and ptMaxSize fields in the MINMAXINFO struct,
the defaults are fine.
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkwindow-win32.c (_gdk_win32_adjust_client_rect,
_gdk_win32_get_adjusted_client_rect): New helper functions.
2003-08-07 22:17:18 +00:00
|
|
|
x - _gdk_offset_x, y - _gdk_offset_y, 0, 0,
|
2003-08-02 02:05:12 +00:00
|
|
|
SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER));
|
2001-08-19 18:34:59 +00:00
|
|
|
}
|
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;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2003-08-02 02:05:12 +00:00
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
|
|
|
return;
|
|
|
|
|
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;
|
|
|
|
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_resize: %p: %dx%d\n",
|
Merge from stable:
2003-01-19 Tor Lillqvist <tml@iki.fi>
Merge from stable:
Fix for #103614 and some other problems with GtkFileSelection on
Windows:
* gtk/fnmatch.c (get_char): Need to use g_unichar_tolower(), not
g_ascii_tolower(). Windows file names are case-insensitive for all
Unicode letters.
* gtk/gtkfilesel.c: Instead of checking for G_OS_WIN32 or
G_WITH_CYGWIN, check G_PLATFORM_WIN32. Move inclusion of gtkintl.h
earlier, as it includes config.h unconditionally, and gtkprivate.h
redefines GTK_LOCALEDIR.
(struct _CompletionDirSent): Ifdef out the fields not used on
Windows.
(compare_utf8_filenames, compare_sys_filenames): Need different
comparison implementation for UTF-8 file names and system locale
file names on Win32. Cannot simply use g_ascii_strcasecmp(), but
need to casefold all Unicode letters.
(cmpl_completion_matches, open_dir, correct_parent): Ifdef out
variables not used on Win32 to avoid warnings about unused
variables.
(open_ref_dir): Use g_path_skip_root() to skip past potential
drive letter in front of the leading (back)slash.
(open_new_dir): Ifdef out use of CompletionDirSent fields not
there on Win32.
(correct_parent): Bypass inode check also on Cygwin.
Fix bug noticed by Alex Shaduri: Tooltips and other
GDK_WINDOW_TEMP windows were activated. This looked very odd, and
was a regression from earlier versions.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Fine-tune
behaviour. Don't ever activate GDK_WINDOW_TEMP windows.
(gdk_window_move, gdk_window_resize): Add debug logging.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): When we get a
WM_SIZE message for a non-visible (withdrawn) window, don't clear
the GDK_WINDOW_STATE_WITHDRAWN bit. The window is still withdrawn
even if its size changes.
2003-01-19 21:18:15 +00:00
|
|
|
GDK_WINDOW_HWND (window), width, height));
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (private->impl);
|
|
|
|
|
2003-08-05 22:24:35 +00:00
|
|
|
if (private->state & GDK_WINDOW_STATE_FULLSCREEN)
|
|
|
|
return;
|
|
|
|
|
2005-03-16 02:21:14 +00:00
|
|
|
if (GetAncestor (GDK_WINDOW_HWND (window), GA_PARENT) != GetDesktopWindow ())
|
2007-07-12 23:38:30 +00:00
|
|
|
{
|
|
|
|
_gdk_window_move_resize_child (window, private->x, private->y, width, height);
|
|
|
|
}
|
2003-08-02 02:05:12 +00:00
|
|
|
else
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2003-08-02 02:05:12 +00:00
|
|
|
RECT outer_rect;
|
2005-11-09 12:35:56 +00:00
|
|
|
|
2003-08-02 02:05:12 +00:00
|
|
|
get_outer_rect (window, width, height, &outer_rect);
|
|
|
|
|
2005-03-16 01:38:57 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("... SetWindowPos(%p,NULL,0,0,%ld,%ld,"
|
|
|
|
"NOACTIVATE|NOMOVE|NOZORDER)\n",
|
|
|
|
GDK_WINDOW_HWND (window),
|
|
|
|
outer_rect.right - outer_rect.left,
|
|
|
|
outer_rect.bottom - outer_rect.top));
|
|
|
|
|
2003-08-02 02:05:12 +00:00
|
|
|
API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window), NULL,
|
|
|
|
0, 0,
|
|
|
|
outer_rect.right - outer_rect.left,
|
|
|
|
outer_rect.bottom - outer_rect.top,
|
|
|
|
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER));
|
1999-11-11 22:12:27 +00:00
|
|
|
private->resize_count += 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2003-08-02 02:05:12 +00:00
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
|
|
|
return;
|
|
|
|
|
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
|
|
|
|
2003-08-05 22:24:35 +00:00
|
|
|
if (private->state & GDK_WINDOW_STATE_FULLSCREEN)
|
|
|
|
return;
|
|
|
|
|
2005-03-16 01:38:57 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_move_resize: %p: %dx%d@%+d%+d\n",
|
gdk/win32/gdkprivate-win32.h New flags _gdk_input_locale_is_ime and
2003-07-25 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkglobals-win32.c: New flags _gdk_input_locale_is_ime
and _gdk_keyboard_has_altgr.
* gdk/win32/gdkevents-win32.c: Lots of changes. Most important
ones detailled here.
Code that has been ifdeffed out for a long time removed. Remove
some really old doc comments that were left behind for some public
functions, the official ones are in the X11 backend anyway. Change
GDK_WINDOW_OBJECT() calls to GdkWindowObject casts. Reformat
multi-line boolean expressions to have the operators at ends of
lines.
As mouse capture with SetCapture() indeed seems to work OK, no
need to have the correspoinding macro USE_SETCAPTURE and ifdefs.
Ifdef out the gdk-ping-msg stuff. I don't remember why it was
needed at some time, and things seem to work fine now without
(knock on wood).
Ifdef out the search for some Latin locale keyboard layout being
loaded. Not used currently, but might be needed after all, if we
decide that we want to be able to generate ASCII control character
events with a non-Latin keyboard.
(assign_object): New helper function, handles the g_object_ref()
and unref() calls when assigning GObject pointers.
(generate_crossing_events): Also generate the GDK_NOTIFY_INTERIOR
enter event when the pointer has moved to an ancestor window. Was
left out by mistake.
(gdk_window_is_ancestor): Renamed from gdk_window_is_child().
(gdk_pointer_grab, gdk_pointer_ungrab): Implement the confine_to
functionality, using ClipCursor().
(find_window_for_mouse_event): Splice part of code into new
function find_real_window_for_grabbed_mouse_event().
(fixup_event, append_event, apply_filters): New functions, code
refactored out from elsewhere.
(synthesize_enter_or_leave_event, synthesize_leave_event,
synthesize_enter_event,
synthesize_leave_events,synthesize_enter_events): Also take a
GdkCrossingMode parameter, in preparation to generating
GDK_CROSSING_GRAB and GDK_CROSSING_UNGRAB events.
(fixup_event, append_event, fill_key_event_string): New functions,
code refactoring.
(vk_from_char, build_keypress_event, build_keyrelease_event):
Removed as part of dropping WM_CHAR handling.
(build_key_event_state,gdk_event_translate): Call
GetKeyboardState(), once, for each keyboard message, instead of
several calls to GetKeyState() here and there.
(gdk_event_translate): Fix bugs #104516, #104662, #115902. While
at it, do some major refactoring, and some fixes for potential
problems noticed while going through the code.
Don't handle WM_CHAR at all. Only handle WM_KEYDOWN and
WM_KEYUP. Don't need the state variables related to whether to
wait for WM_CHAR or not, and whether the current key is
AltGr. Remove lots of complexity. Thus don't need the
use_ime_composition flag.
Not handling WM_CHAR means dead key handling will have to be taken
care of by GTK, but that seems to work fine, so no worry.
Another side-effect is that Alt+keypad digits don't work any
longer, but it's better to learn to use GTK's ISO14755 support is
anyway.
Be more careful in checking whether AltGr is involved. Only
attempt to handle it if the keyboard actually has it. And
explicitly check for *left* Control plus *right* Alt being
pressed. Still, allow (left) Alt and/or (right) Control with AltGr
chars.
Handle keys using similar code as in the X11 backend. As we have
built a keymap in gdkkeys-win32.c anyway, use it by calling
gdk_keymap_translate_keyboard_state() to look up the keysym from
the virtual key code and keyboard state. Build the key event
string in exactly the same way as the X11 backend.
If an IME is being used, don't generate GDK events for keys
between receiving WM_IME_STARTCOMPOSITION and
WM_IME_ENDCOMPOSITION, as those keys are for the IME.
For WM_IME_COMPOSITION, handle all the Unicode chars returned from
the IME, not just the first one.
gdk_event_translate() is still quite complex, could split the
message handler cases out into separate functions.
On mouse events, when the mouse is grabbed, use
find_real_window_for_grabbed_mouse_event() in order to be able to
generate correct crossing events.
No longer take a pre-allocated GdkEvent as parameter. Instead,
allocate events as needed and append them to the queue. (This is
different from how gdk_event_translate() in the X11 backend
works.) This change made the code much clearer, especially in the
cases where we have to generate several GDK events for one Windows
message. Return FALSE if DefWindowProc() should be called, TRUE
if not. If DefWindowProc() should not be called, also return the
value to be returned from the window procedure.
(Previously, the interaction with gdk_event_translate()'s caller
was much more complex, when we had to indicate whether the
already-queued event should be left in the queue or removed, and
in addition also had to indicate whether to call DefWindowProc()
or not, and what value to return from the window procedure if
not.)
Don't use a separate "private" variable required to be pointing to
the GdkWindowObject of the "window" variable at all times. Just
use casts, even if looks a bit uglier.
Notice destroyed windows as early as possible, and break out of
the messsage switch.
Use _gdk_pointer_root as current_window when the pointer is
outside GDK's top-level windows.
On WM_INPUTLANGCHANGE, set _gdk_input_locale_is_ime as
appropriate, based on ImmIsIME().
(gdk_event_translate, gdk_event_send_client_message_for_display,
gdk_screen_broadcast_client_message): Implement client messages.
Use a registered Windows message to pass GDK client messages. Note
that the amount of user data is restricted to four bytes, as it is
carried in the LPARAM. (The WPARAM is used for the message type
"atom".)
(real_window_procedure): Adapt for new gdk_event_translate()
interface.
* gdk/win32/gdkmain-win32.c (_gdk_windowing_init): Set
_gdk_input_locale_is_ime initially.
* gdk/win32/gdkwindow-win32.c: Use g_object_ref()/unref() instead
of g_colormap_ref()/unref().
(gdk_window_new): Made code a bit more like the X11 one, pretend
to handle screens (although we just have one for now).
* gdk/x11/gdkevents-x11.c
(gdk_event_send_client_message_for_display,
gdk_screen_broadcast_client_message): Document the user data
limitation on Win32.
* gdk/win32/gdkevents-win32.c (print_event): More complete enter
and leave notify detail output.
* gdk/win32/gdkkeys-win32.c (update_keymap): Make dead keys
visible to GDK and GTK. Store the corresponding GDK_dead_* keysym
for those, so that the GtkIMContextCimple compose tables will
work. Deduce if the keyboard layout has the AltGr key, and set the
above flag accordingly.
2003-07-26 01:54:59 +00:00
|
|
|
GDK_WINDOW_HWND (window),
|
|
|
|
width, height, x, y));
|
|
|
|
|
2005-03-16 02:21:14 +00:00
|
|
|
if (GetAncestor (GDK_WINDOW_HWND (window), GA_PARENT) != GetDesktopWindow ())
|
2007-07-12 23:38:30 +00:00
|
|
|
{
|
|
|
|
_gdk_window_move_resize_child (window, x, y, width, height);
|
|
|
|
}
|
2003-08-02 02:05:12 +00:00
|
|
|
else
|
gdk/win32/gdkprivate-win32.h New flags _gdk_input_locale_is_ime and
2003-07-25 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkglobals-win32.c: New flags _gdk_input_locale_is_ime
and _gdk_keyboard_has_altgr.
* gdk/win32/gdkevents-win32.c: Lots of changes. Most important
ones detailled here.
Code that has been ifdeffed out for a long time removed. Remove
some really old doc comments that were left behind for some public
functions, the official ones are in the X11 backend anyway. Change
GDK_WINDOW_OBJECT() calls to GdkWindowObject casts. Reformat
multi-line boolean expressions to have the operators at ends of
lines.
As mouse capture with SetCapture() indeed seems to work OK, no
need to have the correspoinding macro USE_SETCAPTURE and ifdefs.
Ifdef out the gdk-ping-msg stuff. I don't remember why it was
needed at some time, and things seem to work fine now without
(knock on wood).
Ifdef out the search for some Latin locale keyboard layout being
loaded. Not used currently, but might be needed after all, if we
decide that we want to be able to generate ASCII control character
events with a non-Latin keyboard.
(assign_object): New helper function, handles the g_object_ref()
and unref() calls when assigning GObject pointers.
(generate_crossing_events): Also generate the GDK_NOTIFY_INTERIOR
enter event when the pointer has moved to an ancestor window. Was
left out by mistake.
(gdk_window_is_ancestor): Renamed from gdk_window_is_child().
(gdk_pointer_grab, gdk_pointer_ungrab): Implement the confine_to
functionality, using ClipCursor().
(find_window_for_mouse_event): Splice part of code into new
function find_real_window_for_grabbed_mouse_event().
(fixup_event, append_event, apply_filters): New functions, code
refactored out from elsewhere.
(synthesize_enter_or_leave_event, synthesize_leave_event,
synthesize_enter_event,
synthesize_leave_events,synthesize_enter_events): Also take a
GdkCrossingMode parameter, in preparation to generating
GDK_CROSSING_GRAB and GDK_CROSSING_UNGRAB events.
(fixup_event, append_event, fill_key_event_string): New functions,
code refactoring.
(vk_from_char, build_keypress_event, build_keyrelease_event):
Removed as part of dropping WM_CHAR handling.
(build_key_event_state,gdk_event_translate): Call
GetKeyboardState(), once, for each keyboard message, instead of
several calls to GetKeyState() here and there.
(gdk_event_translate): Fix bugs #104516, #104662, #115902. While
at it, do some major refactoring, and some fixes for potential
problems noticed while going through the code.
Don't handle WM_CHAR at all. Only handle WM_KEYDOWN and
WM_KEYUP. Don't need the state variables related to whether to
wait for WM_CHAR or not, and whether the current key is
AltGr. Remove lots of complexity. Thus don't need the
use_ime_composition flag.
Not handling WM_CHAR means dead key handling will have to be taken
care of by GTK, but that seems to work fine, so no worry.
Another side-effect is that Alt+keypad digits don't work any
longer, but it's better to learn to use GTK's ISO14755 support is
anyway.
Be more careful in checking whether AltGr is involved. Only
attempt to handle it if the keyboard actually has it. And
explicitly check for *left* Control plus *right* Alt being
pressed. Still, allow (left) Alt and/or (right) Control with AltGr
chars.
Handle keys using similar code as in the X11 backend. As we have
built a keymap in gdkkeys-win32.c anyway, use it by calling
gdk_keymap_translate_keyboard_state() to look up the keysym from
the virtual key code and keyboard state. Build the key event
string in exactly the same way as the X11 backend.
If an IME is being used, don't generate GDK events for keys
between receiving WM_IME_STARTCOMPOSITION and
WM_IME_ENDCOMPOSITION, as those keys are for the IME.
For WM_IME_COMPOSITION, handle all the Unicode chars returned from
the IME, not just the first one.
gdk_event_translate() is still quite complex, could split the
message handler cases out into separate functions.
On mouse events, when the mouse is grabbed, use
find_real_window_for_grabbed_mouse_event() in order to be able to
generate correct crossing events.
No longer take a pre-allocated GdkEvent as parameter. Instead,
allocate events as needed and append them to the queue. (This is
different from how gdk_event_translate() in the X11 backend
works.) This change made the code much clearer, especially in the
cases where we have to generate several GDK events for one Windows
message. Return FALSE if DefWindowProc() should be called, TRUE
if not. If DefWindowProc() should not be called, also return the
value to be returned from the window procedure.
(Previously, the interaction with gdk_event_translate()'s caller
was much more complex, when we had to indicate whether the
already-queued event should be left in the queue or removed, and
in addition also had to indicate whether to call DefWindowProc()
or not, and what value to return from the window procedure if
not.)
Don't use a separate "private" variable required to be pointing to
the GdkWindowObject of the "window" variable at all times. Just
use casts, even if looks a bit uglier.
Notice destroyed windows as early as possible, and break out of
the messsage switch.
Use _gdk_pointer_root as current_window when the pointer is
outside GDK's top-level windows.
On WM_INPUTLANGCHANGE, set _gdk_input_locale_is_ime as
appropriate, based on ImmIsIME().
(gdk_event_translate, gdk_event_send_client_message_for_display,
gdk_screen_broadcast_client_message): Implement client messages.
Use a registered Windows message to pass GDK client messages. Note
that the amount of user data is restricted to four bytes, as it is
carried in the LPARAM. (The WPARAM is used for the message type
"atom".)
(real_window_procedure): Adapt for new gdk_event_translate()
interface.
* gdk/win32/gdkmain-win32.c (_gdk_windowing_init): Set
_gdk_input_locale_is_ime initially.
* gdk/win32/gdkwindow-win32.c: Use g_object_ref()/unref() instead
of g_colormap_ref()/unref().
(gdk_window_new): Made code a bit more like the X11 one, pretend
to handle screens (although we just have one for now).
* gdk/x11/gdkevents-x11.c
(gdk_event_send_client_message_for_display,
gdk_screen_broadcast_client_message): Document the user data
limitation on Win32.
* gdk/win32/gdkevents-win32.c (print_event): More complete enter
and leave notify detail output.
* gdk/win32/gdkkeys-win32.c (update_keymap): Make dead keys
visible to GDK and GTK. Store the corresponding GDK_dead_* keysym
for those, so that the GtkIMContextCimple compose tables will
work. Deduce if the keyboard layout has the AltGr key, and set the
above flag accordingly.
2003-07-26 01:54:59 +00:00
|
|
|
{
|
2003-08-02 02:05:12 +00:00
|
|
|
RECT outer_rect;
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
|
2003-08-02 02:05:12 +00:00
|
|
|
get_outer_rect (window, width, height, &outer_rect);
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
|
2003-08-02 02:05:12 +00:00
|
|
|
adjust_for_gravity_hints (impl, &outer_rect, &x, &y);
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
|
2005-03-16 01:38:57 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("... SetWindowPos(%p,NULL,%d,%d,%ld,%ld,"
|
|
|
|
"NOACTIVATE|NOZORDER)\n",
|
|
|
|
GDK_WINDOW_HWND (window),
|
|
|
|
x - _gdk_offset_x, y - _gdk_offset_y,
|
|
|
|
outer_rect.right - outer_rect.left,
|
|
|
|
outer_rect.bottom - outer_rect.top));
|
|
|
|
|
2003-08-02 02:05:12 +00:00
|
|
|
API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window), NULL,
|
gdk/win32/gdkinput-win32.h Drop the GdkEvent* parameter, it wasn't used.
2003-08-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkinput-win32.h
* gdk/win32/gdkinput-win32.c (_gdk_input_configure_event,
_gdk_input_enter_event): Drop the GdkEvent* parameter, it wasn't
used.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): Adapt caller
accordingly, in fact an uninitialised variable was dereferenced.
[Win32] Add support for multiple monitors.
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkglobals-win32.c: New global variables for
multiple-monitor info: _gdk_num_monitors, _gdk_monitors, and
_gdk_offset_x and _gdk_offset_y.
* gdk/win32/gdkdisplay-win32.c (count_monitor, enum_monitor): New
functions, enumeration functions passed to EnumDisplayMonitors().
(gdk_display_open): If the EnumDisplayMonitors() and
GetMonitorInfo() API is present (on Win98, Win2000 and newer), use
if to find out monitor info.
Calculate the offset between Win32 coordinates (relative to the
primary monitor's origin (and thus negative on monitors to the
left of or above it), and GDK's (visible coordinates should be
non-negative).
* gdk/win32/gdkscreen-win32 (gdk_screen_get_n_monitors,
gdk_screen_get_monitor_geometry): Use information collected above.
(gdk_window_move, gdk_window_move_resize_window_get_geometry):
Subtract _gdk_offset_{x,y} from GDK root window coordinates.
(gdk_window_get_geometry, gdk_window_get_origin,
gdk_window_get_frame_extents): For top-level windows, add
_gdk_offset_{x,y} to GDK root window coordinates
Still need to handle multiple monitors in
gdk_window_fullscreen(). Probably should make the window
fullscreen on the monitor where the cursor is?
* gdk/win32/gdkevents-win32.c: Add _gdk_offset_{x,y} to all GDK
root window coordinates in GdkEvents.
[Win32] Fix geometry hint handling. Add support for resize
increment and base size, and aspect ratio geometry hints. The
"gridded geometry" test in testgtk now works beautifully.
* gdk/win32/gdkwindow-win32.c (gdk_window_set_geometry_hints):
Turns out this function shouldn't actually ever modify the
window's size, just store the hints. (Old code kept for a while
inside #if 0.)
(gdk_window_set_hints): Remove presumably broken code that handles
the position hints, this function is obsolete anyway.
* gdk/win32/gdkevents-win32.c: Drop the current_{x,y}_root
variables, not used.
(adjust_drag): New function, used to implement resize increment
hints.
(gdk_event_translate): Handle WM_SIZING, implement resize
increment and base size, and aspect ratio geometry hints here. The
WM_GETMINMAXINFO handler takes care of the minimum and maximum
size hints as before. Fix the WM_GETMINMAXINFO handler to take
into account window decorations. No need to modify the
ptMaxPosition and ptMaxSize fields in the MINMAXINFO struct,
the defaults are fine.
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkwindow-win32.c (_gdk_win32_adjust_client_rect,
_gdk_win32_get_adjusted_client_rect): New helper functions.
2003-08-07 22:17:18 +00:00
|
|
|
x - _gdk_offset_x, y - _gdk_offset_y,
|
2003-08-02 02:05:12 +00:00
|
|
|
outer_rect.right - outer_rect.left,
|
|
|
|
outer_rect.bottom - outer_rect.top,
|
|
|
|
SWP_NOACTIVATE | SWP_NOZORDER));
|
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;
|
2005-03-16 02:21:14 +00:00
|
|
|
gboolean was_toplevel;
|
|
|
|
LONG style;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2001-11-09 21:52:52 +00:00
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
g_return_if_fail (new_parent == NULL || GDK_IS_WINDOW (new_parent));
|
2005-03-16 02:21:14 +00:00
|
|
|
g_return_if_fail (window != _gdk_root);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2004-08-06 19:20:42 +00:00
|
|
|
if (GDK_WINDOW_DESTROYED (window) ||
|
|
|
|
(new_parent && GDK_WINDOW_DESTROYED (new_parent)))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
if (!new_parent)
|
2005-03-16 02:21:14 +00:00
|
|
|
new_parent = _gdk_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
|
|
|
|
2005-03-16 02:21:14 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_reparent: %p: %p\n",
|
|
|
|
GDK_WINDOW_HWND (window),
|
|
|
|
GDK_WINDOW_HWND (new_parent)));
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2005-03-16 02:21:14 +00:00
|
|
|
style = GetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE);
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
|
2005-03-16 02:21:14 +00:00
|
|
|
was_toplevel = GetAncestor (GDK_WINDOW_HWND (window), GA_PARENT) == GetDesktopWindow ();
|
|
|
|
if (was_toplevel && new_parent != _gdk_root)
|
|
|
|
{
|
|
|
|
/* Reparenting from top-level (child of desktop). Clear out
|
|
|
|
* decorations.
|
|
|
|
*/
|
|
|
|
style &= ~(WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX);
|
|
|
|
style |= WS_CHILD;
|
|
|
|
SetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE, style);
|
|
|
|
}
|
|
|
|
else if (new_parent == _gdk_root)
|
|
|
|
{
|
|
|
|
/* Reparenting to top-level. Add decorations. */
|
|
|
|
style &= ~(WS_CHILD);
|
|
|
|
style |= WS_OVERLAPPEDWINDOW;
|
|
|
|
SetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE, style);
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
2001-10-24 14:15:50 +00:00
|
|
|
|
2005-03-16 02:21:14 +00:00
|
|
|
API_CALL (SetParent, (GDK_WINDOW_HWND (window),
|
|
|
|
GDK_WINDOW_HWND (new_parent)));
|
|
|
|
|
|
|
|
API_CALL (MoveWindow, (GDK_WINDOW_HWND (window),
|
|
|
|
x, y, impl->width, impl->height, TRUE));
|
|
|
|
|
2001-10-24 14:15:50 +00:00
|
|
|
/* From here on, we treat parents of type GDK_WINDOW_FOREIGN like
|
|
|
|
* the root window
|
|
|
|
*/
|
|
|
|
if (GDK_WINDOW_TYPE (new_parent) == GDK_WINDOW_FOREIGN)
|
2005-03-16 02:21:14 +00:00
|
|
|
new_parent = _gdk_root;
|
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
|
|
|
|
2005-03-16 02:21:14 +00:00
|
|
|
/* Switch the window type as appropriate */
|
|
|
|
|
|
|
|
switch (GDK_WINDOW_TYPE (new_parent))
|
|
|
|
{
|
|
|
|
case GDK_WINDOW_ROOT:
|
|
|
|
if (impl->toplevel_window_type != -1)
|
|
|
|
GDK_WINDOW_TYPE (window) = impl->toplevel_window_type;
|
|
|
|
else if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_CHILD)
|
|
|
|
GDK_WINDOW_TYPE (window) = GDK_WINDOW_TOPLEVEL;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_WINDOW_TOPLEVEL:
|
|
|
|
case GDK_WINDOW_CHILD:
|
|
|
|
case GDK_WINDOW_DIALOG:
|
|
|
|
case GDK_WINDOW_TEMP:
|
|
|
|
if (WINDOW_IS_TOPLEVEL (window))
|
|
|
|
{
|
|
|
|
/* Save the original window type so we can restore it if the
|
|
|
|
* window is reparented back to be a toplevel.
|
|
|
|
*/
|
|
|
|
impl->toplevel_window_type = GDK_WINDOW_TYPE (window);
|
|
|
|
GDK_WINDOW_TYPE (window) = GDK_WINDOW_CHILD;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
|
|
|
parent_private->children = g_list_prepend (parent_private->children, window);
|
2001-11-09 21:52:52 +00:00
|
|
|
_gdk_window_init_position (GDK_WINDOW (window_private));
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
2007-04-30 15:29:16 +00:00
|
|
|
static void
|
|
|
|
erase_background (GdkWindow *window,
|
|
|
|
HDC hdc)
|
|
|
|
{
|
|
|
|
HDC bgdc = NULL;
|
|
|
|
HBRUSH hbr = NULL;
|
|
|
|
HPALETTE holdpal = NULL;
|
|
|
|
RECT rect;
|
|
|
|
COLORREF bg;
|
|
|
|
GdkColormap *colormap;
|
|
|
|
GdkColormapPrivateWin32 *colormap_private;
|
|
|
|
int x, y;
|
|
|
|
int x_offset, y_offset;
|
|
|
|
|
|
|
|
if (((GdkWindowObject *) window)->input_only ||
|
|
|
|
((GdkWindowObject *) window)->bg_pixmap == GDK_NO_BG ||
|
|
|
|
GDK_WINDOW_IMPL_WIN32 (((GdkWindowObject *) window)->impl)->position_info.no_bg)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
colormap = gdk_drawable_get_colormap (window);
|
|
|
|
|
|
|
|
if (colormap &&
|
|
|
|
(colormap->visual->type == GDK_VISUAL_PSEUDO_COLOR ||
|
|
|
|
colormap->visual->type == GDK_VISUAL_STATIC_COLOR))
|
|
|
|
{
|
|
|
|
int k;
|
|
|
|
|
|
|
|
colormap_private = GDK_WIN32_COLORMAP_DATA (colormap);
|
|
|
|
|
|
|
|
if (!(holdpal = SelectPalette (hdc, colormap_private->hpal, FALSE)))
|
|
|
|
WIN32_GDI_FAILED ("SelectPalette");
|
|
|
|
else if ((k = RealizePalette (hdc)) == GDI_ERROR)
|
|
|
|
WIN32_GDI_FAILED ("RealizePalette");
|
|
|
|
else if (k > 0)
|
|
|
|
GDK_NOTE (COLORMAP, g_print ("erase_background: realized %p: %d colors\n",
|
|
|
|
colormap_private->hpal, k));
|
|
|
|
}
|
|
|
|
|
|
|
|
x_offset = y_offset = 0;
|
|
|
|
while (window && ((GdkWindowObject *) window)->bg_pixmap == GDK_PARENT_RELATIVE_BG)
|
|
|
|
{
|
|
|
|
/* If this window should have the same background as the parent,
|
|
|
|
* fetch the parent. (And if the same goes for the parent, fetch
|
|
|
|
* the grandparent, etc.)
|
|
|
|
*/
|
|
|
|
x_offset += ((GdkWindowObject *) window)->x;
|
|
|
|
y_offset += ((GdkWindowObject *) window)->y;
|
|
|
|
window = GDK_WINDOW (((GdkWindowObject *) window)->parent);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (GDK_WINDOW_IMPL_WIN32 (((GdkWindowObject *) window)->impl)->position_info.no_bg)
|
|
|
|
{
|
|
|
|
/* Improves scolling effect, e.g. main buttons of testgtk */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
GetClipBox (hdc, &rect);
|
|
|
|
|
|
|
|
if (((GdkWindowObject *) window)->bg_pixmap == NULL)
|
|
|
|
{
|
|
|
|
bg = _gdk_win32_colormap_color (GDK_DRAWABLE_IMPL_WIN32 (((GdkWindowObject *) window)->impl)->colormap,
|
|
|
|
((GdkWindowObject *) window)->bg_color.pixel);
|
|
|
|
|
|
|
|
if (!(hbr = CreateSolidBrush (bg)))
|
|
|
|
WIN32_GDI_FAILED ("CreateSolidBrush");
|
|
|
|
else if (!FillRect (hdc, &rect, hbr))
|
|
|
|
WIN32_GDI_FAILED ("FillRect");
|
|
|
|
if (hbr != NULL)
|
|
|
|
DeleteObject (hbr);
|
|
|
|
}
|
|
|
|
else if (((GdkWindowObject *) window)->bg_pixmap != GDK_NO_BG)
|
|
|
|
{
|
|
|
|
GdkPixmap *pixmap = ((GdkWindowObject *) window)->bg_pixmap;
|
|
|
|
GdkPixmapImplWin32 *pixmap_impl = GDK_PIXMAP_IMPL_WIN32 (GDK_PIXMAP_OBJECT (pixmap)->impl);
|
|
|
|
|
|
|
|
if (x_offset == 0 && y_offset == 0 &&
|
|
|
|
pixmap_impl->width <= 8 && pixmap_impl->height <= 8)
|
|
|
|
{
|
|
|
|
if (!(hbr = CreatePatternBrush (GDK_PIXMAP_HBITMAP (pixmap))))
|
|
|
|
WIN32_GDI_FAILED ("CreatePatternBrush");
|
|
|
|
else if (!FillRect (hdc, &rect, hbr))
|
|
|
|
WIN32_GDI_FAILED ("FillRect");
|
|
|
|
if (hbr != NULL)
|
|
|
|
DeleteObject (hbr);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
HGDIOBJ oldbitmap;
|
|
|
|
|
|
|
|
if (!(bgdc = CreateCompatibleDC (hdc)))
|
|
|
|
{
|
|
|
|
WIN32_GDI_FAILED ("CreateCompatibleDC");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (!(oldbitmap = SelectObject (bgdc, GDK_PIXMAP_HBITMAP (pixmap))))
|
|
|
|
{
|
|
|
|
WIN32_GDI_FAILED ("SelectObject");
|
|
|
|
DeleteDC (bgdc);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
x = -x_offset;
|
|
|
|
while (x < rect.right)
|
|
|
|
{
|
|
|
|
if (x + pixmap_impl->width >= rect.left)
|
|
|
|
{
|
|
|
|
y = -y_offset;
|
|
|
|
while (y < rect.bottom)
|
|
|
|
{
|
|
|
|
if (y + pixmap_impl->height >= rect.top)
|
|
|
|
{
|
|
|
|
if (!BitBlt (hdc, x, y,
|
|
|
|
pixmap_impl->width, pixmap_impl->height,
|
|
|
|
bgdc, 0, 0, SRCCOPY))
|
|
|
|
{
|
|
|
|
WIN32_GDI_FAILED ("BitBlt");
|
|
|
|
SelectObject (bgdc, oldbitmap);
|
|
|
|
DeleteDC (bgdc);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
y += pixmap_impl->height;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
x += pixmap_impl->width;
|
|
|
|
}
|
|
|
|
SelectObject (bgdc, oldbitmap);
|
|
|
|
DeleteDC (bgdc);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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 (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 (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;
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("_gdk_windowing_window_clear_area: %p: "
|
2005-03-16 01:38:57 +00:00
|
|
|
"%dx%d@%+d%+d\n",
|
Massive changes. Too many to list here, but I'll try a summary:
2002-02-17 Tor Lillqvist <tml@iki.fi>
* gdk/win32/*.c: Massive changes. Too many to list here, but I'll
try a summary:
1) Unify GdkPixmap and GdkImage implementation: For each
GdkPixmap, allocate a GdkImage, and vice versa.
GdkPixmapImplWin32Data has a pointer to the GdkImage.
GdkImage::windowing_data is a pointer to the GdkPixmap.
This simplifies many pixmap and image related functions a lot, and
reduces duplicated code snippets. For instance, there is only one
place in gdk/win32 where CreateDIBSection() is called, in the
function _gdk_win32_new_pixmap(). Converting a bitmap (GdkPixmap)
to a Windows region is almost trivial, with the bitmap bits being
readily accessible in the associated GdkImage.
All blitting between GdkPixmaps, GdkWindows and GdkImages goes
through handled the _gdk_win32_blit() function, which calls
different functions to handle the cases of blitting from pixmaps,
inside windows (scrolling), or from windows, which all require
somewhat different handling.
2) Support 256-color mode. This has long been very broken, now it
works more or less OK. Keep the logical palette for each colormap
as small as possible while allocating and freeing colors. Select
and realize the logical palette associated with a GdkColormap into
a DC before drawing or blitting.
When the display is in 256-color mode, make it possible for the
user to override the size of the palette(s) used with either the
GDK_WIN32_MAX_COLORS environment variable, or a -max-colors
command line option. It is possible to reduce the palette size all
the way down to using just the 16 static colors (which causes the
system visual to be of type GDK_VISUAL_STATIC_COLOR. This could
possibly be useful if one desperately wants to avoid color
flashing. (Note that in order for this to work properly, an as of
yet not commited fix to gdkrgb.c is needed.)
Handle the palette messages. On WM_PALETTECHANGED, call
UpdateColors() for the given window hierarchy. Do this only if a
window in some other top-level window hierarchy caused the palette
change (realized a palette). Do this max five times in a row (an
arbitrarily chosen limit), though, otherwise redraw by generating
expose events. On WM_QUERYNEWPALETTE, cause a redraw of the whole
window hierarchy by generating GDK_EXPOSE events.
3) Code cleanup in general. For instance, remove the "emulated"
X11 structs ColormapStruct, Visual and XStandardColormap. Use the
new GDK_DEBUG_* flags for debugging output in the relevant source
files. Remove the unused colormap hash table in gdkcolor-win32.c
4) Plug some resource leaks.
2002-02-14 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkdnd-win32.c (gdk_dropfiles_filter): Use
g_filename_to_uri() to actually create legal URIs in the
text/uri-list data.
2002-02-17 00:25:05 +00:00
|
|
|
GDK_WINDOW_HWND (window),
|
2000-11-11 18:39:57 +00:00
|
|
|
width, height, x, y));
|
2000-07-25 17:31:05 +00:00
|
|
|
hdc = GetDC (GDK_WINDOW_HWND (window));
|
2007-04-30 15:29:16 +00:00
|
|
|
IntersectClipRect (hdc, x, y, x + width, y + height);
|
|
|
|
erase_background (window, hdc);
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
GDI_CALL (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 (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
|
|
|
{
|
2007-04-30 15:29:16 +00:00
|
|
|
HDC hdc;
|
1999-11-11 22:12:27 +00:00
|
|
|
RECT rect;
|
|
|
|
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("_gdk_windowing_window_clear_area_e: %p: "
|
2005-03-16 01:38:57 +00:00
|
|
|
"%dx%d@%+d%+d\n",
|
Massive changes. Too many to list here, but I'll try a summary:
2002-02-17 Tor Lillqvist <tml@iki.fi>
* gdk/win32/*.c: Massive changes. Too many to list here, but I'll
try a summary:
1) Unify GdkPixmap and GdkImage implementation: For each
GdkPixmap, allocate a GdkImage, and vice versa.
GdkPixmapImplWin32Data has a pointer to the GdkImage.
GdkImage::windowing_data is a pointer to the GdkPixmap.
This simplifies many pixmap and image related functions a lot, and
reduces duplicated code snippets. For instance, there is only one
place in gdk/win32 where CreateDIBSection() is called, in the
function _gdk_win32_new_pixmap(). Converting a bitmap (GdkPixmap)
to a Windows region is almost trivial, with the bitmap bits being
readily accessible in the associated GdkImage.
All blitting between GdkPixmaps, GdkWindows and GdkImages goes
through handled the _gdk_win32_blit() function, which calls
different functions to handle the cases of blitting from pixmaps,
inside windows (scrolling), or from windows, which all require
somewhat different handling.
2) Support 256-color mode. This has long been very broken, now it
works more or less OK. Keep the logical palette for each colormap
as small as possible while allocating and freeing colors. Select
and realize the logical palette associated with a GdkColormap into
a DC before drawing or blitting.
When the display is in 256-color mode, make it possible for the
user to override the size of the palette(s) used with either the
GDK_WIN32_MAX_COLORS environment variable, or a -max-colors
command line option. It is possible to reduce the palette size all
the way down to using just the 16 static colors (which causes the
system visual to be of type GDK_VISUAL_STATIC_COLOR. This could
possibly be useful if one desperately wants to avoid color
flashing. (Note that in order for this to work properly, an as of
yet not commited fix to gdkrgb.c is needed.)
Handle the palette messages. On WM_PALETTECHANGED, call
UpdateColors() for the given window hierarchy. Do this only if a
window in some other top-level window hierarchy caused the palette
change (realized a palette). Do this max five times in a row (an
arbitrarily chosen limit), though, otherwise redraw by generating
expose events. On WM_QUERYNEWPALETTE, cause a redraw of the whole
window hierarchy by generating GDK_EXPOSE events.
3) Code cleanup in general. For instance, remove the "emulated"
X11 structs ColormapStruct, Visual and XStandardColormap. Use the
new GDK_DEBUG_* flags for debugging output in the relevant source
files. Remove the unused colormap hash table in gdkcolor-win32.c
4) Plug some resource leaks.
2002-02-14 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkdnd-win32.c (gdk_dropfiles_filter): Use
g_filename_to_uri() to actually create legal URIs in the
text/uri-list data.
2002-02-17 00:25:05 +00:00
|
|
|
GDK_WINDOW_HWND (window),
|
2000-11-11 18:39:57 +00:00
|
|
|
width, height, x, y));
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2007-04-30 15:29:16 +00:00
|
|
|
/* The background should be erased before the expose event is
|
|
|
|
generated */
|
|
|
|
hdc = GetDC (GDK_WINDOW_HWND (window));
|
|
|
|
IntersectClipRect (hdc, x, y, x + width, y + height);
|
|
|
|
erase_background (window, hdc);
|
|
|
|
GDI_CALL (ReleaseDC, (GDK_WINDOW_HWND (window), hdc));
|
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
rect.left = x;
|
2007-04-30 15:29:16 +00:00
|
|
|
rect.right = x + width;
|
1999-11-11 22:12:27 +00:00
|
|
|
rect.top = y;
|
2007-04-30 15:29:16 +00:00
|
|
|
rect.bottom = y + height;
|
|
|
|
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
GDI_CALL (InvalidateRect, (GDK_WINDOW_HWND (window), &rect, TRUE));
|
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 (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
|
|
|
{
|
Massive changes. Too many to list here, but I'll try a summary:
2002-02-17 Tor Lillqvist <tml@iki.fi>
* gdk/win32/*.c: Massive changes. Too many to list here, but I'll
try a summary:
1) Unify GdkPixmap and GdkImage implementation: For each
GdkPixmap, allocate a GdkImage, and vice versa.
GdkPixmapImplWin32Data has a pointer to the GdkImage.
GdkImage::windowing_data is a pointer to the GdkPixmap.
This simplifies many pixmap and image related functions a lot, and
reduces duplicated code snippets. For instance, there is only one
place in gdk/win32 where CreateDIBSection() is called, in the
function _gdk_win32_new_pixmap(). Converting a bitmap (GdkPixmap)
to a Windows region is almost trivial, with the bitmap bits being
readily accessible in the associated GdkImage.
All blitting between GdkPixmaps, GdkWindows and GdkImages goes
through handled the _gdk_win32_blit() function, which calls
different functions to handle the cases of blitting from pixmaps,
inside windows (scrolling), or from windows, which all require
somewhat different handling.
2) Support 256-color mode. This has long been very broken, now it
works more or less OK. Keep the logical palette for each colormap
as small as possible while allocating and freeing colors. Select
and realize the logical palette associated with a GdkColormap into
a DC before drawing or blitting.
When the display is in 256-color mode, make it possible for the
user to override the size of the palette(s) used with either the
GDK_WIN32_MAX_COLORS environment variable, or a -max-colors
command line option. It is possible to reduce the palette size all
the way down to using just the 16 static colors (which causes the
system visual to be of type GDK_VISUAL_STATIC_COLOR. This could
possibly be useful if one desperately wants to avoid color
flashing. (Note that in order for this to work properly, an as of
yet not commited fix to gdkrgb.c is needed.)
Handle the palette messages. On WM_PALETTECHANGED, call
UpdateColors() for the given window hierarchy. Do this only if a
window in some other top-level window hierarchy caused the palette
change (realized a palette). Do this max five times in a row (an
arbitrarily chosen limit), though, otherwise redraw by generating
expose events. On WM_QUERYNEWPALETTE, cause a redraw of the whole
window hierarchy by generating GDK_EXPOSE events.
3) Code cleanup in general. For instance, remove the "emulated"
X11 structs ColormapStruct, Visual and XStandardColormap. Use the
new GDK_DEBUG_* flags for debugging output in the relevant source
files. Remove the unused colormap hash table in gdkcolor-win32.c
4) Plug some resource leaks.
2002-02-14 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkdnd-win32.c (gdk_dropfiles_filter): Use
g_filename_to_uri() to actually create legal URIs in the
text/uri-list data.
2002-02-17 00:25:05 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_raise: %p\n",
|
|
|
|
GDK_WINDOW_HWND (window)));
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2006-02-09 03:20:56 +00:00
|
|
|
if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_TEMP)
|
|
|
|
API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window), HWND_TOPMOST,
|
|
|
|
0, 0, 0, 0,
|
|
|
|
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE));
|
|
|
|
else if (((GdkWindowObject *)window)->accept_focus)
|
|
|
|
API_CALL (BringWindowToTop, (GDK_WINDOW_HWND (window)));
|
|
|
|
else
|
|
|
|
API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window), HWND_TOP,
|
|
|
|
0, 0, 0, 0,
|
|
|
|
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE));
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_lower (GdkWindow *window)
|
|
|
|
{
|
|
|
|
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
|
|
|
{
|
2005-03-16 01:38:57 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_lower: %p\n"
|
|
|
|
"... SetWindowPos(%p,HWND_BOTTOM,0,0,0,0,"
|
|
|
|
"NOACTIVATE|NOMOVE|NOSIZE)\n",
|
|
|
|
GDK_WINDOW_HWND (window),
|
Massive changes. Too many to list here, but I'll try a summary:
2002-02-17 Tor Lillqvist <tml@iki.fi>
* gdk/win32/*.c: Massive changes. Too many to list here, but I'll
try a summary:
1) Unify GdkPixmap and GdkImage implementation: For each
GdkPixmap, allocate a GdkImage, and vice versa.
GdkPixmapImplWin32Data has a pointer to the GdkImage.
GdkImage::windowing_data is a pointer to the GdkPixmap.
This simplifies many pixmap and image related functions a lot, and
reduces duplicated code snippets. For instance, there is only one
place in gdk/win32 where CreateDIBSection() is called, in the
function _gdk_win32_new_pixmap(). Converting a bitmap (GdkPixmap)
to a Windows region is almost trivial, with the bitmap bits being
readily accessible in the associated GdkImage.
All blitting between GdkPixmaps, GdkWindows and GdkImages goes
through handled the _gdk_win32_blit() function, which calls
different functions to handle the cases of blitting from pixmaps,
inside windows (scrolling), or from windows, which all require
somewhat different handling.
2) Support 256-color mode. This has long been very broken, now it
works more or less OK. Keep the logical palette for each colormap
as small as possible while allocating and freeing colors. Select
and realize the logical palette associated with a GdkColormap into
a DC before drawing or blitting.
When the display is in 256-color mode, make it possible for the
user to override the size of the palette(s) used with either the
GDK_WIN32_MAX_COLORS environment variable, or a -max-colors
command line option. It is possible to reduce the palette size all
the way down to using just the 16 static colors (which causes the
system visual to be of type GDK_VISUAL_STATIC_COLOR. This could
possibly be useful if one desperately wants to avoid color
flashing. (Note that in order for this to work properly, an as of
yet not commited fix to gdkrgb.c is needed.)
Handle the palette messages. On WM_PALETTECHANGED, call
UpdateColors() for the given window hierarchy. Do this only if a
window in some other top-level window hierarchy caused the palette
change (realized a palette). Do this max five times in a row (an
arbitrarily chosen limit), though, otherwise redraw by generating
expose events. On WM_QUERYNEWPALETTE, cause a redraw of the whole
window hierarchy by generating GDK_EXPOSE events.
3) Code cleanup in general. For instance, remove the "emulated"
X11 structs ColormapStruct, Visual and XStandardColormap. Use the
new GDK_DEBUG_* flags for debugging output in the relevant source
files. Remove the unused colormap hash table in gdkcolor-win32.c
4) Plug some resource leaks.
2002-02-14 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkdnd-win32.c (gdk_dropfiles_filter): Use
g_filename_to_uri() to actually create legal URIs in the
text/uri-list data.
2002-02-17 00:25:05 +00:00
|
|
|
GDK_WINDOW_HWND (window)));
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2005-03-16 01:38:57 +00:00
|
|
|
API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window), HWND_BOTTOM,
|
|
|
|
0, 0, 0, 0,
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE));
|
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)
|
|
|
|
{
|
2003-08-02 02:05:12 +00:00
|
|
|
/* Note that this function is obsolete */
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
GdkWindowImplWin32 *impl;
|
gdk/win32/gdkinput-win32.h Drop the GdkEvent* parameter, it wasn't used.
2003-08-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkinput-win32.h
* gdk/win32/gdkinput-win32.c (_gdk_input_configure_event,
_gdk_input_enter_event): Drop the GdkEvent* parameter, it wasn't
used.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): Adapt caller
accordingly, in fact an uninitialised variable was dereferenced.
[Win32] Add support for multiple monitors.
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkglobals-win32.c: New global variables for
multiple-monitor info: _gdk_num_monitors, _gdk_monitors, and
_gdk_offset_x and _gdk_offset_y.
* gdk/win32/gdkdisplay-win32.c (count_monitor, enum_monitor): New
functions, enumeration functions passed to EnumDisplayMonitors().
(gdk_display_open): If the EnumDisplayMonitors() and
GetMonitorInfo() API is present (on Win98, Win2000 and newer), use
if to find out monitor info.
Calculate the offset between Win32 coordinates (relative to the
primary monitor's origin (and thus negative on monitors to the
left of or above it), and GDK's (visible coordinates should be
non-negative).
* gdk/win32/gdkscreen-win32 (gdk_screen_get_n_monitors,
gdk_screen_get_monitor_geometry): Use information collected above.
(gdk_window_move, gdk_window_move_resize_window_get_geometry):
Subtract _gdk_offset_{x,y} from GDK root window coordinates.
(gdk_window_get_geometry, gdk_window_get_origin,
gdk_window_get_frame_extents): For top-level windows, add
_gdk_offset_{x,y} to GDK root window coordinates
Still need to handle multiple monitors in
gdk_window_fullscreen(). Probably should make the window
fullscreen on the monitor where the cursor is?
* gdk/win32/gdkevents-win32.c: Add _gdk_offset_{x,y} to all GDK
root window coordinates in GdkEvents.
[Win32] Fix geometry hint handling. Add support for resize
increment and base size, and aspect ratio geometry hints. The
"gridded geometry" test in testgtk now works beautifully.
* gdk/win32/gdkwindow-win32.c (gdk_window_set_geometry_hints):
Turns out this function shouldn't actually ever modify the
window's size, just store the hints. (Old code kept for a while
inside #if 0.)
(gdk_window_set_hints): Remove presumably broken code that handles
the position hints, this function is obsolete anyway.
* gdk/win32/gdkevents-win32.c: Drop the current_{x,y}_root
variables, not used.
(adjust_drag): New function, used to implement resize increment
hints.
(gdk_event_translate): Handle WM_SIZING, implement resize
increment and base size, and aspect ratio geometry hints here. The
WM_GETMINMAXINFO handler takes care of the minimum and maximum
size hints as before. Fix the WM_GETMINMAXINFO handler to take
into account window decorations. No need to modify the
ptMaxPosition and ptMaxSize fields in the MINMAXINFO struct,
the defaults are fine.
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkwindow-win32.c (_gdk_win32_adjust_client_rect,
_gdk_win32_get_adjusted_client_rect): New helper functions.
2003-08-07 22:17:18 +00:00
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
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);
|
|
|
|
|
2005-03-16 01:38:57 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_set_hints: %p: %dx%d..%dx%d @%+d%+d\n",
|
Massive changes. Too many to list here, but I'll try a summary:
2002-02-17 Tor Lillqvist <tml@iki.fi>
* gdk/win32/*.c: Massive changes. Too many to list here, but I'll
try a summary:
1) Unify GdkPixmap and GdkImage implementation: For each
GdkPixmap, allocate a GdkImage, and vice versa.
GdkPixmapImplWin32Data has a pointer to the GdkImage.
GdkImage::windowing_data is a pointer to the GdkPixmap.
This simplifies many pixmap and image related functions a lot, and
reduces duplicated code snippets. For instance, there is only one
place in gdk/win32 where CreateDIBSection() is called, in the
function _gdk_win32_new_pixmap(). Converting a bitmap (GdkPixmap)
to a Windows region is almost trivial, with the bitmap bits being
readily accessible in the associated GdkImage.
All blitting between GdkPixmaps, GdkWindows and GdkImages goes
through handled the _gdk_win32_blit() function, which calls
different functions to handle the cases of blitting from pixmaps,
inside windows (scrolling), or from windows, which all require
somewhat different handling.
2) Support 256-color mode. This has long been very broken, now it
works more or less OK. Keep the logical palette for each colormap
as small as possible while allocating and freeing colors. Select
and realize the logical palette associated with a GdkColormap into
a DC before drawing or blitting.
When the display is in 256-color mode, make it possible for the
user to override the size of the palette(s) used with either the
GDK_WIN32_MAX_COLORS environment variable, or a -max-colors
command line option. It is possible to reduce the palette size all
the way down to using just the 16 static colors (which causes the
system visual to be of type GDK_VISUAL_STATIC_COLOR. This could
possibly be useful if one desperately wants to avoid color
flashing. (Note that in order for this to work properly, an as of
yet not commited fix to gdkrgb.c is needed.)
Handle the palette messages. On WM_PALETTECHANGED, call
UpdateColors() for the given window hierarchy. Do this only if a
window in some other top-level window hierarchy caused the palette
change (realized a palette). Do this max five times in a row (an
arbitrarily chosen limit), though, otherwise redraw by generating
expose events. On WM_QUERYNEWPALETTE, cause a redraw of the whole
window hierarchy by generating GDK_EXPOSE events.
3) Code cleanup in general. For instance, remove the "emulated"
X11 structs ColormapStruct, Visual and XStandardColormap. Use the
new GDK_DEBUG_* flags for debugging output in the relevant source
files. Remove the unused colormap hash table in gdkcolor-win32.c
4) Plug some resource leaks.
2002-02-14 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkdnd-win32.c (gdk_dropfiles_filter): Use
g_filename_to_uri() to actually create legal URIs in the
text/uri-list data.
2002-02-17 00:25: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));
|
|
|
|
|
|
|
|
if (flags)
|
|
|
|
{
|
2001-11-09 21:52:52 +00:00
|
|
|
GdkGeometry geom;
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
gint geom_mask = 0;
|
2001-11-09 21:52:52 +00:00
|
|
|
|
|
|
|
geom.min_width = min_width;
|
|
|
|
geom.min_height = min_height;
|
|
|
|
geom.max_width = max_width;
|
|
|
|
geom.max_height = max_height;
|
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
if (flags & GDK_HINT_MIN_SIZE)
|
2001-11-09 21:52:52 +00:00
|
|
|
geom_mask |= GDK_HINT_MIN_SIZE;
|
1999-11-20 01:22:57 +00:00
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
if (flags & GDK_HINT_MAX_SIZE)
|
2001-11-09 21:52:52 +00:00
|
|
|
geom_mask |= GDK_HINT_MAX_SIZE;
|
|
|
|
|
|
|
|
gdk_window_set_geometry_hints (window, &geom, geom_mask);
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-07-03 15:47:42 +00:00
|
|
|
void
|
|
|
|
gdk_window_set_urgency_hint (GdkWindow *window,
|
|
|
|
gboolean urgent)
|
|
|
|
{
|
2005-08-01 07:19:15 +00:00
|
|
|
FLASHWINFO flashwinfo;
|
2005-11-28 08:40:56 +00:00
|
|
|
typedef BOOL (*PFN_FlashWindowEx) (FLASHWINFO*);
|
2005-09-18 12:28:42 +00:00
|
|
|
PFN_FlashWindowEx flashWindowEx = NULL;
|
|
|
|
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
g_return_if_fail (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD);
|
|
|
|
|
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
|
|
|
return;
|
|
|
|
|
2005-11-28 08:40:56 +00:00
|
|
|
flashWindowEx = (PFN_FlashWindowEx) GetProcAddress (GetModuleHandle ("user32.dll"), "FlashWindowEx");
|
|
|
|
|
|
|
|
if (flashWindowEx)
|
2005-09-18 12:28:42 +00:00
|
|
|
{
|
2005-11-28 08:40:56 +00:00
|
|
|
flashwinfo.cbSize = sizeof (flashwinfo);
|
|
|
|
flashwinfo.hwnd = GDK_WINDOW_HWND (window);
|
|
|
|
if (urgent)
|
|
|
|
flashwinfo.dwFlags = FLASHW_ALL | FLASHW_TIMER;
|
|
|
|
else
|
|
|
|
flashwinfo.dwFlags = FLASHW_STOP;
|
|
|
|
flashwinfo.uCount = 0;
|
|
|
|
flashwinfo.dwTimeout = 0;
|
|
|
|
|
|
|
|
flashWindowEx (&flashwinfo);
|
2005-09-18 12:28:42 +00:00
|
|
|
}
|
|
|
|
else
|
2005-11-28 08:40:56 +00:00
|
|
|
{
|
|
|
|
FlashWindow (GDK_WINDOW_HWND (window), urgent);
|
|
|
|
}
|
2005-07-03 15:47:42 +00:00
|
|
|
}
|
|
|
|
|
2006-02-09 02:58:45 +00:00
|
|
|
static gboolean
|
|
|
|
get_effective_window_decorations (GdkWindow *window,
|
|
|
|
GdkWMDecoration *decoration)
|
2005-11-27 02:58:09 +00:00
|
|
|
{
|
|
|
|
GdkWindowImplWin32 *impl;
|
|
|
|
|
|
|
|
impl = (GdkWindowImplWin32 *)((GdkWindowObject *)window)->impl;
|
|
|
|
|
2006-02-09 02:58:45 +00:00
|
|
|
if (gdk_window_get_decorations (window, decoration))
|
|
|
|
return TRUE;
|
|
|
|
|
2005-11-27 02:58:09 +00:00
|
|
|
if (((GdkWindowObject *) window)->window_type != GDK_WINDOW_TOPLEVEL &&
|
|
|
|
((GdkWindowObject *) window)->window_type != GDK_WINDOW_DIALOG)
|
2006-02-09 02:58:45 +00:00
|
|
|
return FALSE;
|
2005-11-27 02:58:09 +00:00
|
|
|
|
|
|
|
if ((impl->hint_flags & GDK_HINT_MIN_SIZE) &&
|
|
|
|
(impl->hint_flags & GDK_HINT_MAX_SIZE) &&
|
|
|
|
impl->hints.min_width == impl->hints.max_width &&
|
|
|
|
impl->hints.min_height == impl->hints.max_height)
|
|
|
|
{
|
2006-02-09 02:58:45 +00:00
|
|
|
*decoration = GDK_DECOR_ALL | GDK_DECOR_RESIZEH | GDK_DECOR_MAXIMIZE;
|
2005-11-27 02:58:09 +00:00
|
|
|
if (impl->type_hint == GDK_WINDOW_TYPE_HINT_DIALOG ||
|
|
|
|
impl->type_hint == GDK_WINDOW_TYPE_HINT_MENU ||
|
|
|
|
impl->type_hint == GDK_WINDOW_TYPE_HINT_TOOLBAR)
|
2006-02-09 02:58:45 +00:00
|
|
|
*decoration |= GDK_DECOR_MINIMIZE;
|
2005-11-27 02:58:09 +00:00
|
|
|
else if (impl->type_hint == GDK_WINDOW_TYPE_HINT_SPLASHSCREEN)
|
2006-02-09 02:58:45 +00:00
|
|
|
*decoration |= GDK_DECOR_MENU | GDK_DECOR_MINIMIZE;
|
2005-11-27 02:58:09 +00:00
|
|
|
|
2006-02-09 02:58:45 +00:00
|
|
|
return TRUE;
|
2005-11-27 02:58:09 +00:00
|
|
|
}
|
|
|
|
else if (impl->hint_flags & GDK_HINT_MAX_SIZE)
|
|
|
|
{
|
2006-02-09 02:58:45 +00:00
|
|
|
*decoration = GDK_DECOR_ALL | GDK_DECOR_MAXIMIZE;
|
2005-11-27 02:58:09 +00:00
|
|
|
if (impl->type_hint == GDK_WINDOW_TYPE_HINT_DIALOG ||
|
|
|
|
impl->type_hint == GDK_WINDOW_TYPE_HINT_MENU ||
|
|
|
|
impl->type_hint == GDK_WINDOW_TYPE_HINT_TOOLBAR)
|
2006-02-09 02:58:45 +00:00
|
|
|
*decoration |= GDK_DECOR_MINIMIZE;
|
|
|
|
return TRUE;
|
2005-11-27 02:58:09 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
switch (impl->type_hint)
|
|
|
|
{
|
|
|
|
case GDK_WINDOW_TYPE_HINT_DIALOG:
|
2006-02-09 02:58:45 +00:00
|
|
|
*decoration = (GDK_DECOR_ALL | GDK_DECOR_MINIMIZE | GDK_DECOR_MAXIMIZE);
|
|
|
|
return TRUE;
|
|
|
|
|
2005-11-27 02:58:09 +00:00
|
|
|
case GDK_WINDOW_TYPE_HINT_MENU:
|
2006-02-09 02:58:45 +00:00
|
|
|
*decoration = (GDK_DECOR_ALL | GDK_DECOR_RESIZEH | GDK_DECOR_MINIMIZE | GDK_DECOR_MAXIMIZE);
|
|
|
|
return TRUE;
|
|
|
|
|
2005-11-27 02:58:09 +00:00
|
|
|
case GDK_WINDOW_TYPE_HINT_TOOLBAR:
|
|
|
|
gdk_window_set_skip_taskbar_hint (window, TRUE);
|
2006-02-09 02:58:45 +00:00
|
|
|
*decoration = GDK_DECOR_ALL | GDK_DECOR_MINIMIZE | GDK_DECOR_MAXIMIZE;
|
|
|
|
return TRUE;
|
|
|
|
|
2005-11-27 02:58:09 +00:00
|
|
|
case GDK_WINDOW_TYPE_HINT_UTILITY:
|
2006-02-09 02:58:45 +00:00
|
|
|
return FALSE;
|
|
|
|
|
2005-11-27 02:58:09 +00:00
|
|
|
case GDK_WINDOW_TYPE_HINT_SPLASHSCREEN:
|
2006-02-09 02:58:45 +00:00
|
|
|
*decoration = (GDK_DECOR_ALL | GDK_DECOR_RESIZEH | GDK_DECOR_MENU
|
|
|
|
| GDK_DECOR_MINIMIZE | GDK_DECOR_MAXIMIZE);
|
|
|
|
return TRUE;
|
|
|
|
|
2005-11-27 02:58:09 +00:00
|
|
|
case GDK_WINDOW_TYPE_HINT_DOCK:
|
2006-02-09 02:58:45 +00:00
|
|
|
return FALSE;
|
|
|
|
|
2005-11-27 02:58:09 +00:00
|
|
|
case GDK_WINDOW_TYPE_HINT_DESKTOP:
|
2006-02-09 02:58:45 +00:00
|
|
|
return FALSE;
|
|
|
|
|
2005-11-27 02:58:09 +00:00
|
|
|
default:
|
|
|
|
/* Fall thru */
|
|
|
|
case GDK_WINDOW_TYPE_HINT_NORMAL:
|
2006-02-09 02:58:45 +00:00
|
|
|
*decoration = GDK_DECOR_ALL;
|
|
|
|
return TRUE;
|
2005-11-27 02:58:09 +00:00
|
|
|
}
|
|
|
|
}
|
2006-02-09 02:58:45 +00:00
|
|
|
|
|
|
|
return FALSE;
|
2005-11-27 02:58:09 +00:00
|
|
|
}
|
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
void
|
|
|
|
gdk_window_set_geometry_hints (GdkWindow *window,
|
|
|
|
GdkGeometry *geometry,
|
|
|
|
GdkWindowHints geom_mask)
|
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
GdkWindowImplWin32 *impl;
|
gdk/win32/gdkinput-win32.h Drop the GdkEvent* parameter, it wasn't used.
2003-08-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkinput-win32.h
* gdk/win32/gdkinput-win32.c (_gdk_input_configure_event,
_gdk_input_enter_event): Drop the GdkEvent* parameter, it wasn't
used.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): Adapt caller
accordingly, in fact an uninitialised variable was dereferenced.
[Win32] Add support for multiple monitors.
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkglobals-win32.c: New global variables for
multiple-monitor info: _gdk_num_monitors, _gdk_monitors, and
_gdk_offset_x and _gdk_offset_y.
* gdk/win32/gdkdisplay-win32.c (count_monitor, enum_monitor): New
functions, enumeration functions passed to EnumDisplayMonitors().
(gdk_display_open): If the EnumDisplayMonitors() and
GetMonitorInfo() API is present (on Win98, Win2000 and newer), use
if to find out monitor info.
Calculate the offset between Win32 coordinates (relative to the
primary monitor's origin (and thus negative on monitors to the
left of or above it), and GDK's (visible coordinates should be
non-negative).
* gdk/win32/gdkscreen-win32 (gdk_screen_get_n_monitors,
gdk_screen_get_monitor_geometry): Use information collected above.
(gdk_window_move, gdk_window_move_resize_window_get_geometry):
Subtract _gdk_offset_{x,y} from GDK root window coordinates.
(gdk_window_get_geometry, gdk_window_get_origin,
gdk_window_get_frame_extents): For top-level windows, add
_gdk_offset_{x,y} to GDK root window coordinates
Still need to handle multiple monitors in
gdk_window_fullscreen(). Probably should make the window
fullscreen on the monitor where the cursor is?
* gdk/win32/gdkevents-win32.c: Add _gdk_offset_{x,y} to all GDK
root window coordinates in GdkEvents.
[Win32] Fix geometry hint handling. Add support for resize
increment and base size, and aspect ratio geometry hints. The
"gridded geometry" test in testgtk now works beautifully.
* gdk/win32/gdkwindow-win32.c (gdk_window_set_geometry_hints):
Turns out this function shouldn't actually ever modify the
window's size, just store the hints. (Old code kept for a while
inside #if 0.)
(gdk_window_set_hints): Remove presumably broken code that handles
the position hints, this function is obsolete anyway.
* gdk/win32/gdkevents-win32.c: Drop the current_{x,y}_root
variables, not used.
(adjust_drag): New function, used to implement resize increment
hints.
(gdk_event_translate): Handle WM_SIZING, implement resize
increment and base size, and aspect ratio geometry hints here. The
WM_GETMINMAXINFO handler takes care of the minimum and maximum
size hints as before. Fix the WM_GETMINMAXINFO handler to take
into account window decorations. No need to modify the
ptMaxPosition and ptMaxSize fields in the MINMAXINFO struct,
the defaults are fine.
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkwindow-win32.c (_gdk_win32_adjust_client_rect,
_gdk_win32_get_adjusted_client_rect): New helper functions.
2003-08-07 22:17:18 +00:00
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
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;
|
|
|
|
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_set_geometry_hints: %p\n",
|
|
|
|
GDK_WINDOW_HWND (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
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
impl->hint_flags = geom_mask;
|
2003-08-02 02:05:12 +00:00
|
|
|
impl->hints = *geometry;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
if (geom_mask & GDK_HINT_POS)
|
2001-08-04 13:17:33 +00:00
|
|
|
; /* even the X11 mplementation doesn't care */
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
if (geom_mask & GDK_HINT_MIN_SIZE)
|
|
|
|
{
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("... MIN_SIZE: %dx%d\n",
|
|
|
|
geometry->min_width, geometry->min_height));
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (geom_mask & GDK_HINT_MAX_SIZE)
|
|
|
|
{
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("... MAX_SIZE: %dx%d\n",
|
|
|
|
geometry->max_width, geometry->max_height));
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
2001-11-09 21:52:52 +00:00
|
|
|
|
gdk/win32/gdkinput-win32.h Drop the GdkEvent* parameter, it wasn't used.
2003-08-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkinput-win32.h
* gdk/win32/gdkinput-win32.c (_gdk_input_configure_event,
_gdk_input_enter_event): Drop the GdkEvent* parameter, it wasn't
used.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): Adapt caller
accordingly, in fact an uninitialised variable was dereferenced.
[Win32] Add support for multiple monitors.
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkglobals-win32.c: New global variables for
multiple-monitor info: _gdk_num_monitors, _gdk_monitors, and
_gdk_offset_x and _gdk_offset_y.
* gdk/win32/gdkdisplay-win32.c (count_monitor, enum_monitor): New
functions, enumeration functions passed to EnumDisplayMonitors().
(gdk_display_open): If the EnumDisplayMonitors() and
GetMonitorInfo() API is present (on Win98, Win2000 and newer), use
if to find out monitor info.
Calculate the offset between Win32 coordinates (relative to the
primary monitor's origin (and thus negative on monitors to the
left of or above it), and GDK's (visible coordinates should be
non-negative).
* gdk/win32/gdkscreen-win32 (gdk_screen_get_n_monitors,
gdk_screen_get_monitor_geometry): Use information collected above.
(gdk_window_move, gdk_window_move_resize_window_get_geometry):
Subtract _gdk_offset_{x,y} from GDK root window coordinates.
(gdk_window_get_geometry, gdk_window_get_origin,
gdk_window_get_frame_extents): For top-level windows, add
_gdk_offset_{x,y} to GDK root window coordinates
Still need to handle multiple monitors in
gdk_window_fullscreen(). Probably should make the window
fullscreen on the monitor where the cursor is?
* gdk/win32/gdkevents-win32.c: Add _gdk_offset_{x,y} to all GDK
root window coordinates in GdkEvents.
[Win32] Fix geometry hint handling. Add support for resize
increment and base size, and aspect ratio geometry hints. The
"gridded geometry" test in testgtk now works beautifully.
* gdk/win32/gdkwindow-win32.c (gdk_window_set_geometry_hints):
Turns out this function shouldn't actually ever modify the
window's size, just store the hints. (Old code kept for a while
inside #if 0.)
(gdk_window_set_hints): Remove presumably broken code that handles
the position hints, this function is obsolete anyway.
* gdk/win32/gdkevents-win32.c: Drop the current_{x,y}_root
variables, not used.
(adjust_drag): New function, used to implement resize increment
hints.
(gdk_event_translate): Handle WM_SIZING, implement resize
increment and base size, and aspect ratio geometry hints here. The
WM_GETMINMAXINFO handler takes care of the minimum and maximum
size hints as before. Fix the WM_GETMINMAXINFO handler to take
into account window decorations. No need to modify the
ptMaxPosition and ptMaxSize fields in the MINMAXINFO struct,
the defaults are fine.
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkwindow-win32.c (_gdk_win32_adjust_client_rect,
_gdk_win32_get_adjusted_client_rect): New helper functions.
2003-08-07 22:17:18 +00:00
|
|
|
if (geom_mask & GDK_HINT_BASE_SIZE)
|
2000-11-11 18:39:57 +00:00
|
|
|
{
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("... BASE_SIZE: %dx%d\n",
|
|
|
|
geometry->base_width, geometry->base_height));
|
2000-11-11 18:39:57 +00:00
|
|
|
}
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
if (geom_mask & GDK_HINT_RESIZE_INC)
|
|
|
|
{
|
2003-08-02 02:05:12 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("... RESIZE_INC: (%d,%d)\n",
|
|
|
|
geometry->width_inc, geometry->height_inc));
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (geom_mask & GDK_HINT_ASPECT)
|
|
|
|
{
|
2003-08-02 02:05:12 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("... ASPECT: %g--%g\n",
|
|
|
|
geometry->min_aspect, geometry->max_aspect));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (geom_mask & GDK_HINT_WIN_GRAVITY)
|
|
|
|
{
|
|
|
|
GDK_NOTE (MISC, g_print ("... GRAVITY: %d\n", geometry->win_gravity));
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
2005-11-27 02:58:09 +00:00
|
|
|
|
2006-02-09 02:58:45 +00:00
|
|
|
update_style_bits (window);
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_set_title (GdkWindow *window,
|
|
|
|
const gchar *title)
|
|
|
|
{
|
2006-08-30 00:39:01 +00:00
|
|
|
wchar_t *wtitle;
|
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
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);
|
2000-10-22 17:16:42 +00:00
|
|
|
|
2005-07-21 07:29:36 +00:00
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
|
|
|
return;
|
|
|
|
|
2000-10-22 17:16:42 +00:00
|
|
|
/* Empty window titles not allowed, so set it to just a period. */
|
|
|
|
if (!title[0])
|
|
|
|
title = ".";
|
1999-11-11 22:12:27 +00:00
|
|
|
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_set_title: %p: %s\n",
|
Massive changes. Too many to list here, but I'll try a summary:
2002-02-17 Tor Lillqvist <tml@iki.fi>
* gdk/win32/*.c: Massive changes. Too many to list here, but I'll
try a summary:
1) Unify GdkPixmap and GdkImage implementation: For each
GdkPixmap, allocate a GdkImage, and vice versa.
GdkPixmapImplWin32Data has a pointer to the GdkImage.
GdkImage::windowing_data is a pointer to the GdkPixmap.
This simplifies many pixmap and image related functions a lot, and
reduces duplicated code snippets. For instance, there is only one
place in gdk/win32 where CreateDIBSection() is called, in the
function _gdk_win32_new_pixmap(). Converting a bitmap (GdkPixmap)
to a Windows region is almost trivial, with the bitmap bits being
readily accessible in the associated GdkImage.
All blitting between GdkPixmaps, GdkWindows and GdkImages goes
through handled the _gdk_win32_blit() function, which calls
different functions to handle the cases of blitting from pixmaps,
inside windows (scrolling), or from windows, which all require
somewhat different handling.
2) Support 256-color mode. This has long been very broken, now it
works more or less OK. Keep the logical palette for each colormap
as small as possible while allocating and freeing colors. Select
and realize the logical palette associated with a GdkColormap into
a DC before drawing or blitting.
When the display is in 256-color mode, make it possible for the
user to override the size of the palette(s) used with either the
GDK_WIN32_MAX_COLORS environment variable, or a -max-colors
command line option. It is possible to reduce the palette size all
the way down to using just the 16 static colors (which causes the
system visual to be of type GDK_VISUAL_STATIC_COLOR. This could
possibly be useful if one desperately wants to avoid color
flashing. (Note that in order for this to work properly, an as of
yet not commited fix to gdkrgb.c is needed.)
Handle the palette messages. On WM_PALETTECHANGED, call
UpdateColors() for the given window hierarchy. Do this only if a
window in some other top-level window hierarchy caused the palette
change (realized a palette). Do this max five times in a row (an
arbitrarily chosen limit), though, otherwise redraw by generating
expose events. On WM_QUERYNEWPALETTE, cause a redraw of the whole
window hierarchy by generating GDK_EXPOSE events.
3) Code cleanup in general. For instance, remove the "emulated"
X11 structs ColormapStruct, Visual and XStandardColormap. Use the
new GDK_DEBUG_* flags for debugging output in the relevant source
files. Remove the unused colormap hash table in gdkcolor-win32.c
4) Plug some resource leaks.
2002-02-14 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkdnd-win32.c (gdk_dropfiles_filter): Use
g_filename_to_uri() to actually create legal URIs in the
text/uri-list data.
2002-02-17 00:25:05 +00:00
|
|
|
GDK_WINDOW_HWND (window), title));
|
2000-07-25 17:31:05 +00:00
|
|
|
|
2006-08-30 00:39:01 +00:00
|
|
|
wtitle = g_utf8_to_utf16 (title, -1, NULL, NULL, NULL);
|
|
|
|
API_CALL (SetWindowTextW, (GDK_WINDOW_HWND (window), wtitle));
|
|
|
|
g_free (wtitle);
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_set_role (GdkWindow *window,
|
|
|
|
const gchar *role)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_set_role: %p: %s\n",
|
Massive changes. Too many to list here, but I'll try a summary:
2002-02-17 Tor Lillqvist <tml@iki.fi>
* gdk/win32/*.c: Massive changes. Too many to list here, but I'll
try a summary:
1) Unify GdkPixmap and GdkImage implementation: For each
GdkPixmap, allocate a GdkImage, and vice versa.
GdkPixmapImplWin32Data has a pointer to the GdkImage.
GdkImage::windowing_data is a pointer to the GdkPixmap.
This simplifies many pixmap and image related functions a lot, and
reduces duplicated code snippets. For instance, there is only one
place in gdk/win32 where CreateDIBSection() is called, in the
function _gdk_win32_new_pixmap(). Converting a bitmap (GdkPixmap)
to a Windows region is almost trivial, with the bitmap bits being
readily accessible in the associated GdkImage.
All blitting between GdkPixmaps, GdkWindows and GdkImages goes
through handled the _gdk_win32_blit() function, which calls
different functions to handle the cases of blitting from pixmaps,
inside windows (scrolling), or from windows, which all require
somewhat different handling.
2) Support 256-color mode. This has long been very broken, now it
works more or less OK. Keep the logical palette for each colormap
as small as possible while allocating and freeing colors. Select
and realize the logical palette associated with a GdkColormap into
a DC before drawing or blitting.
When the display is in 256-color mode, make it possible for the
user to override the size of the palette(s) used with either the
GDK_WIN32_MAX_COLORS environment variable, or a -max-colors
command line option. It is possible to reduce the palette size all
the way down to using just the 16 static colors (which causes the
system visual to be of type GDK_VISUAL_STATIC_COLOR. This could
possibly be useful if one desperately wants to avoid color
flashing. (Note that in order for this to work properly, an as of
yet not commited fix to gdkrgb.c is needed.)
Handle the palette messages. On WM_PALETTECHANGED, call
UpdateColors() for the given window hierarchy. Do this only if a
window in some other top-level window hierarchy caused the palette
change (realized a palette). Do this max five times in a row (an
arbitrarily chosen limit), though, otherwise redraw by generating
expose events. On WM_QUERYNEWPALETTE, cause a redraw of the whole
window hierarchy by generating GDK_EXPOSE events.
3) Code cleanup in general. For instance, remove the "emulated"
X11 structs ColormapStruct, Visual and XStandardColormap. Use the
new GDK_DEBUG_* flags for debugging output in the relevant source
files. Remove the unused colormap hash table in gdkcolor-win32.c
4) Plug some resource leaks.
2002-02-14 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkdnd-win32.c (gdk_dropfiles_filter): Use
g_filename_to_uri() to actually create legal URIs in the
text/uri-list data.
2002-02-17 00:25:05 +00:00
|
|
|
GDK_WINDOW_HWND (window),
|
2000-11-11 18:39:57 +00:00
|
|
|
(role ? role : "NULL")));
|
1999-11-11 22:12:27 +00:00
|
|
|
/* XXX */
|
|
|
|
}
|
|
|
|
|
2007-07-12 23:38:30 +00:00
|
|
|
void
|
1999-11-11 22:12:27 +00:00
|
|
|
gdk_window_set_transient_for (GdkWindow *window,
|
|
|
|
GdkWindow *parent)
|
|
|
|
{
|
2001-08-04 13:17:33 +00:00
|
|
|
HWND window_id, parent_id;
|
2007-07-12 23:38:30 +00:00
|
|
|
GdkWindowImplWin32 *window_impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl);
|
2001-08-04 13:17:33 +00:00
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
2001-08-04 13:17:33 +00:00
|
|
|
|
2007-07-12 23:38:30 +00:00
|
|
|
window_id = GDK_WINDOW_HWND (window);
|
|
|
|
parent_id = parent != NULL ? GDK_WINDOW_HWND (parent) : NULL;
|
|
|
|
|
|
|
|
if (GDK_WINDOW_DESTROYED (window) || (parent && GDK_WINDOW_DESTROYED (parent)))
|
|
|
|
{
|
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
|
|
|
GDK_NOTE (MISC, g_print ("... destroyed!\n"));
|
|
|
|
else
|
|
|
|
GDK_NOTE (MISC, g_print ("... owner destroyed!\n"));
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
2001-08-04 13:17:33 +00:00
|
|
|
|
Merge from stable:
2002-12-09 Tor Lillqvist <tml@iki.fi>
Merge from stable:
* gdk/win32/gdkdrawable-win32.c (generic_draw): Don't leak
stipple_gc. More checks for errors. Use correct ternary ROP when
blitting the foreground into the tile pixmap onto those pixels
where the stipple is set. (I didn't notice that I had used the
wrong one, as it didn't matter on Win2k, where DIB sections
apparently are zeroed upon creation. But on Win98 they have random
initial contents. Thanks to Hans Breuer for reporting this.)
(gdk_win32_draw_rectangle, gdk_win32_draw_arc,
gdk_win32_draw_polygon): Don't pass the LINE_ATTRIBUTES bits to
generic_draw() if drawing a filled figure.
* gdk/win32/gdkmain-win32.c (_gdk_win32_print_dc): Minor cosmetics.
(_gdk_win32_gcvalues_mask_to_string): Initialize buffer as empty.
(_gdk_win32_window_state_to_string): New debugging output helper
function.
* gdk/win32/gdkevents-win32.c: Minor debugging output changes.
(gdk_event_translate): Ignore the WM_SHOWWINDOW/SW_OTHERUNZOOM or
SW_OTHERZOOM messages. Do not generate a GDK_UNMAP event for
WM_SIZE/SIZE_MINIMIZED messages, they do not really corrspond to
unmapping on X11. Set window state correctly for all three of
SIZE_{MINIMIZED,MAXIMIZED,RESTORED}. A maximized and then iconified
("minimized" in Windows terminology) window still has the
"maximized" property, i.e. when deiconified, it will reappear as
maximized. (#10557)
* gdk/win32/gdkprivate-win32.h: Declare new function.
(WIN32_API_FAILED, WIN32_GDI_FAILED, OTHER_API_FAILED): Don't use
__PRETTY_FUNCTION__ if __GNUC__ >= 3, to avoid warning message.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Handle more
situations. Add parameter to tell whether deiconifying. Code
reorg: Return early when appropriate instead of using nested if
statements. If just deiconifying without raising, restore active
window. (#10557)
(gdk_window_hide, gdk_window_withdraw, gdk_window_iconify,
gdk_window_deiconify, gdk_window_maximize, gdk_window_unmaximize,
gdk_window_focus): Use _gdk_win32_window_state_to_string() in
debugging output.
(gdk_window_iconify): Restore active window after calling
ShowWindow(). Otherwise the "next" window gets activated.
(gdk_window_stick, gdk_window_unstick): Don't output any warnings.
(gdk_window_set_transient_for): Rewrite. Just call SetWindowLong()
with GWL_HWNDPARENT, which despite its name sets the *owner*
window, which should be exactly what we want. The PSDK
documentation is said to be misleading. testgtk's modal window
test now works much better. (#50586)
2002-12-09 00:43:42 +00:00
|
|
|
if (((GdkWindowObject *) window)->window_type == GDK_WINDOW_CHILD)
|
|
|
|
{
|
2005-03-16 01:38:57 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("... a child window!\n"));
|
Merge from stable:
2002-12-09 Tor Lillqvist <tml@iki.fi>
Merge from stable:
* gdk/win32/gdkdrawable-win32.c (generic_draw): Don't leak
stipple_gc. More checks for errors. Use correct ternary ROP when
blitting the foreground into the tile pixmap onto those pixels
where the stipple is set. (I didn't notice that I had used the
wrong one, as it didn't matter on Win2k, where DIB sections
apparently are zeroed upon creation. But on Win98 they have random
initial contents. Thanks to Hans Breuer for reporting this.)
(gdk_win32_draw_rectangle, gdk_win32_draw_arc,
gdk_win32_draw_polygon): Don't pass the LINE_ATTRIBUTES bits to
generic_draw() if drawing a filled figure.
* gdk/win32/gdkmain-win32.c (_gdk_win32_print_dc): Minor cosmetics.
(_gdk_win32_gcvalues_mask_to_string): Initialize buffer as empty.
(_gdk_win32_window_state_to_string): New debugging output helper
function.
* gdk/win32/gdkevents-win32.c: Minor debugging output changes.
(gdk_event_translate): Ignore the WM_SHOWWINDOW/SW_OTHERUNZOOM or
SW_OTHERZOOM messages. Do not generate a GDK_UNMAP event for
WM_SIZE/SIZE_MINIMIZED messages, they do not really corrspond to
unmapping on X11. Set window state correctly for all three of
SIZE_{MINIMIZED,MAXIMIZED,RESTORED}. A maximized and then iconified
("minimized" in Windows terminology) window still has the
"maximized" property, i.e. when deiconified, it will reappear as
maximized. (#10557)
* gdk/win32/gdkprivate-win32.h: Declare new function.
(WIN32_API_FAILED, WIN32_GDI_FAILED, OTHER_API_FAILED): Don't use
__PRETTY_FUNCTION__ if __GNUC__ >= 3, to avoid warning message.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Handle more
situations. Add parameter to tell whether deiconifying. Code
reorg: Return early when appropriate instead of using nested if
statements. If just deiconifying without raising, restore active
window. (#10557)
(gdk_window_hide, gdk_window_withdraw, gdk_window_iconify,
gdk_window_deiconify, gdk_window_maximize, gdk_window_unmaximize,
gdk_window_focus): Use _gdk_win32_window_state_to_string() in
debugging output.
(gdk_window_iconify): Restore active window after calling
ShowWindow(). Otherwise the "next" window gets activated.
(gdk_window_stick, gdk_window_unstick): Don't output any warnings.
(gdk_window_set_transient_for): Rewrite. Just call SetWindowLong()
with GWL_HWNDPARENT, which despite its name sets the *owner*
window, which should be exactly what we want. The PSDK
documentation is said to be misleading. testgtk's modal window
test now works much better. (#50586)
2002-12-09 00:43:42 +00:00
|
|
|
return;
|
|
|
|
}
|
2007-07-12 23:38:30 +00:00
|
|
|
|
|
|
|
window_impl->transient_owner = parent;
|
2001-08-04 13:17:33 +00:00
|
|
|
|
Merge from stable:
2002-12-09 Tor Lillqvist <tml@iki.fi>
Merge from stable:
* gdk/win32/gdkdrawable-win32.c (generic_draw): Don't leak
stipple_gc. More checks for errors. Use correct ternary ROP when
blitting the foreground into the tile pixmap onto those pixels
where the stipple is set. (I didn't notice that I had used the
wrong one, as it didn't matter on Win2k, where DIB sections
apparently are zeroed upon creation. But on Win98 they have random
initial contents. Thanks to Hans Breuer for reporting this.)
(gdk_win32_draw_rectangle, gdk_win32_draw_arc,
gdk_win32_draw_polygon): Don't pass the LINE_ATTRIBUTES bits to
generic_draw() if drawing a filled figure.
* gdk/win32/gdkmain-win32.c (_gdk_win32_print_dc): Minor cosmetics.
(_gdk_win32_gcvalues_mask_to_string): Initialize buffer as empty.
(_gdk_win32_window_state_to_string): New debugging output helper
function.
* gdk/win32/gdkevents-win32.c: Minor debugging output changes.
(gdk_event_translate): Ignore the WM_SHOWWINDOW/SW_OTHERUNZOOM or
SW_OTHERZOOM messages. Do not generate a GDK_UNMAP event for
WM_SIZE/SIZE_MINIMIZED messages, they do not really corrspond to
unmapping on X11. Set window state correctly for all three of
SIZE_{MINIMIZED,MAXIMIZED,RESTORED}. A maximized and then iconified
("minimized" in Windows terminology) window still has the
"maximized" property, i.e. when deiconified, it will reappear as
maximized. (#10557)
* gdk/win32/gdkprivate-win32.h: Declare new function.
(WIN32_API_FAILED, WIN32_GDI_FAILED, OTHER_API_FAILED): Don't use
__PRETTY_FUNCTION__ if __GNUC__ >= 3, to avoid warning message.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Handle more
situations. Add parameter to tell whether deiconifying. Code
reorg: Return early when appropriate instead of using nested if
statements. If just deiconifying without raising, restore active
window. (#10557)
(gdk_window_hide, gdk_window_withdraw, gdk_window_iconify,
gdk_window_deiconify, gdk_window_maximize, gdk_window_unmaximize,
gdk_window_focus): Use _gdk_win32_window_state_to_string() in
debugging output.
(gdk_window_iconify): Restore active window after calling
ShowWindow(). Otherwise the "next" window gets activated.
(gdk_window_stick, gdk_window_unstick): Don't output any warnings.
(gdk_window_set_transient_for): Rewrite. Just call SetWindowLong()
with GWL_HWNDPARENT, which despite its name sets the *owner*
window, which should be exactly what we want. The PSDK
documentation is said to be misleading. testgtk's modal window
test now works much better. (#50586)
2002-12-09 00:43:42 +00:00
|
|
|
/* This changes the *owner* of the window, despite the misleading
|
|
|
|
* name. (Owner and parent are unrelated concepts.) At least that's
|
|
|
|
* what people who seem to know what they talk about say on
|
|
|
|
* USENET. Search on Google.
|
|
|
|
*/
|
|
|
|
SetLastError (0);
|
|
|
|
if (SetWindowLong (window_id, GWL_HWNDPARENT, (long) parent_id) == 0 &&
|
|
|
|
GetLastError () != 0)
|
2001-08-04 13:17:33 +00:00
|
|
|
WIN32_API_FAILED ("SetWindowLong");
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-01-26 20:21:09 +00:00
|
|
|
gdk_window_set_background (GdkWindow *window,
|
|
|
|
const GdkColor *color)
|
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
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_set_background: %p: %s\n",
|
Massive changes. Too many to list here, but I'll try a summary:
2002-02-17 Tor Lillqvist <tml@iki.fi>
* gdk/win32/*.c: Massive changes. Too many to list here, but I'll
try a summary:
1) Unify GdkPixmap and GdkImage implementation: For each
GdkPixmap, allocate a GdkImage, and vice versa.
GdkPixmapImplWin32Data has a pointer to the GdkImage.
GdkImage::windowing_data is a pointer to the GdkPixmap.
This simplifies many pixmap and image related functions a lot, and
reduces duplicated code snippets. For instance, there is only one
place in gdk/win32 where CreateDIBSection() is called, in the
function _gdk_win32_new_pixmap(). Converting a bitmap (GdkPixmap)
to a Windows region is almost trivial, with the bitmap bits being
readily accessible in the associated GdkImage.
All blitting between GdkPixmaps, GdkWindows and GdkImages goes
through handled the _gdk_win32_blit() function, which calls
different functions to handle the cases of blitting from pixmaps,
inside windows (scrolling), or from windows, which all require
somewhat different handling.
2) Support 256-color mode. This has long been very broken, now it
works more or less OK. Keep the logical palette for each colormap
as small as possible while allocating and freeing colors. Select
and realize the logical palette associated with a GdkColormap into
a DC before drawing or blitting.
When the display is in 256-color mode, make it possible for the
user to override the size of the palette(s) used with either the
GDK_WIN32_MAX_COLORS environment variable, or a -max-colors
command line option. It is possible to reduce the palette size all
the way down to using just the 16 static colors (which causes the
system visual to be of type GDK_VISUAL_STATIC_COLOR. This could
possibly be useful if one desperately wants to avoid color
flashing. (Note that in order for this to work properly, an as of
yet not commited fix to gdkrgb.c is needed.)
Handle the palette messages. On WM_PALETTECHANGED, call
UpdateColors() for the given window hierarchy. Do this only if a
window in some other top-level window hierarchy caused the palette
change (realized a palette). Do this max five times in a row (an
arbitrarily chosen limit), though, otherwise redraw by generating
expose events. On WM_QUERYNEWPALETTE, cause a redraw of the whole
window hierarchy by generating GDK_EXPOSE events.
3) Code cleanup in general. For instance, remove the "emulated"
X11 structs ColormapStruct, Visual and XStandardColormap. Use the
new GDK_DEBUG_* flags for debugging output in the relevant source
files. Remove the unused colormap hash table in gdkcolor-win32.c
4) Plug some resource leaks.
2002-02-14 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkdnd-win32.c (gdk_dropfiles_filter): Use
g_filename_to_uri() to actually create legal URIs in the
text/uri-list data.
2002-02-17 00:25:05 +00:00
|
|
|
GDK_WINDOW_HWND (window),
|
gdk/win32/gdkprivate-win32.h Rename all global variables and functions to
2002-11-12 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate-win32.h
* gdk/win32/*.c: Rename all global variables and functions to
start with underscore.
Merge from stable:
More work on the Win32 backend. The cause of some scrolling
problems was that SetWindowPos() and ScrollWindowEx() don't blit
those parts of the window they think are invalid. As we didn't
keep Windows's update region in synch with GDK's, Windows thought
those areas that in fact had been updated were invalid. Calling
ValidateRgn() in _gdk_windowing_window_queue_antiexpose() seems to
be an elegant and efficient solution, removing from Windows's
update region those areas we are about to repaint proactively.
In some cases garbage leftover values were used for the clip
origin in GdkGCWin32. This showed up as odd blank areas around the
pixmaps included in the Text Widget in gtk-demo.
Having the clip region either as a GdkRegion or a HRGN in
GdkGCWin32 was unnecessary, it's better to just use a HRGN.
The translation and antiexpose queue handling in
gdkgeometry-win32.c seems unnecessary (and not implementable in
the same way as on X11 anyway, no serial numbers) on Windows,
ifdeffed out.
Don't (try to) do guffaw scrolling as there is no static window
gravity on Windows. Guffaw scrolling would be unnecessary anyway,
as there is the ScrollWindow() API. This improves the behaviour of
the Text Widget demo in gtk-demo a lot. But I have no idea how the
lack of static win gravity should be handled in other places where
the X11 code uses it. Especially _gdk_window_move_resize_child().
There is still some problem in expose handling. By moving an
obscuring window back and forth over testgtk's main window, for
instance, every now and then you typically get narrow vertical or
horizontal strips of pixels that haven't been properly redrawn
after being exposed. A fencepost error somewhere?
Otherwise, all of testgtk and gtk-demo except "big windows" now
seem to work pretty well.
Bug #79720 should be fixed now.
* gdk/win32/gdkcolor-win32.c (gdk_win32_color_to_string,
gdk_win32_print_paletteentries, gdk_win32_print_system_palette,
gdk_win32_print_hpalette)
* gdk/win32/gdkdrawable-win32.c (gdk_win32_drawable_description)
* gdk/win32/gdkevents-win32.c (gdk_win32_message_name):
Move all debugging helper functions to gdkmain-win32.c.
* gdk/win32/gdkdrawable-win32.c (_gdk_win32_draw_tiles):
Rewrite. Make static. Must take tile origin parameters, too.
(gdk_win32_draw_rectangle): Pass the tile/stipple origin to
_gdk_win32_draw_tiles(). Remove #if 0 code.
(blit_inside_window): Don't call ScrollDC(), that didn't work at
all like I thought. A simple call to BitBlt() is enough.
* gdk/win32/gdkevents-win32.c (gdk_event_translate) Remove unused
latin_locale_loaded variable.
(_gdk_win32_get_next_tick): New function. Used to make sure
timestamps of events are always increasing, both in events
generated from the window procedure and in events gotten via
PeekMessage(). Not sure whether this is actually useful, but it
seemed as a good idea.
(real_window_procedure): Don't use a local GdkEventPrivate
variable. Don't attempt any compression of configure or expose
events here, handled elsewhere.
(erase_background): Accumulate window offsets when traversing up
the parent chain for GDK_PARENT_RELATIVE_BG, in order to get
correct alignment of background pixmaps. Don't fill with
BLACK_BRUSH if GDK_NO_BG.
(gdk_event_get_graphics_expose): A bit more verbose debugging output.
(gdk_event_translate): Use _gdk_win32_get_next_tick(). In the
WM_PAINT handler, don't check for empty update rect. When we get a
WM_PAINT, the update region isn't empty. And if it for some
strange reason is, that will be handled later anyway. Call
GetUpdateRgn() before calling BeginPaint() and EndPaint() (which
empty the update region).
* gdk/win32/gdkdnd-win32.c
* gdk/win32/gdkinput-win32.c:
Use _gdk_win32_get_next_tick().
* gdk/win32/gdkfont-win32.c: Use %p to print HFONTs.
(gdk_text_size): Remove, unused.
* gdk/win32/gdkgc-win32.c: Set clip origins to zero
when appropriate.
(gdk_gc_copy): Increase refcount on colormap if present.
(gdk_win32_hdc_get): Handle just hcliprgn. If we have a stipple,
combine it with clip region after selecting into the DC.
(_gdk_win32_bitmap_to_hrgn): Rename from _gdk_win32_bitmap_to_region.
(_gdk_win3_gdkregion_to_hrgn): New function, code snippet
extracted from gdk_win32_hdc_get().
* gdk/win32/gdkgeometry-win32.c: Ifdef out the translate_queue
handling.
(gdk_window_copy_area_scroll): Increase clipRect to avoid
ScrollWindowEx() not scrolling pixels it thinks are invalid.
Scroll also children with the ScrollWindowEx() call. No need to
call gdk_window_move() on the children.
(gdk_window_scroll): Don't do guffaw scrolling.
(gdk_window_compute_position): Fix typo, used win32_y where x was
intended.
(gdk_window_premove, gdk_window_postmove,
gdk_window_clip_changed): Add debugging output.
(_gdk_windowing_window_queue_antiexpose): Just call ValidateRgn()
on the region.
(_gdk_window_process_expose): No use for the serial number
parameter now. Instead of a rectangle, take a region parameter, as
Windows gives us one in WM_PAINT.
* gdk/win32/gdkmain-win32.c (_gdk_win32_lbstyle_to_string,
_gdk_win32_pstype_to_string, _gdk_win32_psstyle_to_string,
_gdk_win32_psendcap_to_string, _gdk_win32_psjoin_to_string,
_gdk_win32_rect_to_string, _gdk_win32_gdkrectangle_to_string,
_gdk_win32_gdkregion_to_string): New debugging functions.
(static_printf): Helper function for the above. sprintfs into a
static circular buffer, return value should be used "soon".
* gdk/win32/gdkwindow-win32.c (gdk_propagate_shapes): Plug memory
leak, free list after use.
(gdk_window_gravity_works): Remove, we know that there is no such
thing on Windows.
(gdk_window_set_static_bit_gravity,
gdk_window_set_static_win_gravity): Ditto, remove, they didn't do
anything anyway.
(_gdk_windowing_window_init, gdk_window_foreign_new): Call
_gdk_window_init_position() like in the X11 backend.
(gdk_window_reparent): Don't call the now nonexistent
gdk_window_set_static_win_gravity(). No idea what should be done
instead.
(gdk_window_get_geometry): The returned x and y should be relative
to parent. Used to be always zero..
(gdk_window_set_static_gravities): Return FALSE if trying to set
static gravity.
* gdk/win32/gdkprivate-win32.h: Drop the clip_region field from
GdkGCWin32. Only use the HRGN hcliprgn. Declare new
functions.
* gdk/win32/*.c: Use new debugging functions.
* gdk/win32/rc/gdk.rc.in: Update copyright year.
2002-11-12 22:17:48 +00:00
|
|
|
_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)
|
|
|
|
{
|
2003-06-30 21:58:24 +00:00
|
|
|
g_object_unref (private->bg_pixmap);
|
2000-07-25 17:31:05 +00:00
|
|
|
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 (GDK_IS_WINDOW (window));
|
2000-07-25 17:31:05 +00:00
|
|
|
g_return_if_fail (pixmap == NULL || !parent_relative);
|
2002-05-14 19:45:08 +00:00
|
|
|
g_return_if_fail (pixmap == NULL || gdk_drawable_get_depth (window) == gdk_drawable_get_depth (pixmap));
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2005-08-15 12:35:04 +00:00
|
|
|
if (pixmap && !gdk_drawable_get_colormap (pixmap))
|
2005-08-12 13:13:54 +00:00
|
|
|
{
|
|
|
|
g_warning ("gdk_window_set_back_pixmap(): pixmap must have a colormap");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
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)
|
2003-06-30 21:58:24 +00:00
|
|
|
g_object_unref (private->bg_pixmap);
|
2000-07-25 17:31:05 +00:00
|
|
|
|
|
|
|
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;
|
2002-01-01 22:17:09 +00:00
|
|
|
GDK_NOTE (MISC, g_print (G_STRLOC ": setting background pixmap to parent_relative\n"));
|
2000-07-25 17:31:05 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (pixmap)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2003-06-30 21:58:24 +00:00
|
|
|
g_object_ref (pixmap);
|
2000-07-25 17:31:05 +00:00
|
|
|
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;
|
2002-06-10 20:27:15 +00:00
|
|
|
GdkWindowObject *parent_window;
|
2000-07-25 17:31:05 +00:00
|
|
|
HCURSOR hcursor;
|
2001-02-11 11:00:14 +00:00
|
|
|
HCURSOR hprevcursor;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
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;
|
|
|
|
|
2002-01-11 23:56:28 +00:00
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!cursor)
|
|
|
|
hcursor = NULL;
|
|
|
|
else
|
|
|
|
hcursor = cursor_private->hcursor;
|
|
|
|
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_set_cursor: %p: %p\n",
|
Massive changes. Too many to list here, but I'll try a summary:
2002-02-17 Tor Lillqvist <tml@iki.fi>
* gdk/win32/*.c: Massive changes. Too many to list here, but I'll
try a summary:
1) Unify GdkPixmap and GdkImage implementation: For each
GdkPixmap, allocate a GdkImage, and vice versa.
GdkPixmapImplWin32Data has a pointer to the GdkImage.
GdkImage::windowing_data is a pointer to the GdkPixmap.
This simplifies many pixmap and image related functions a lot, and
reduces duplicated code snippets. For instance, there is only one
place in gdk/win32 where CreateDIBSection() is called, in the
function _gdk_win32_new_pixmap(). Converting a bitmap (GdkPixmap)
to a Windows region is almost trivial, with the bitmap bits being
readily accessible in the associated GdkImage.
All blitting between GdkPixmaps, GdkWindows and GdkImages goes
through handled the _gdk_win32_blit() function, which calls
different functions to handle the cases of blitting from pixmaps,
inside windows (scrolling), or from windows, which all require
somewhat different handling.
2) Support 256-color mode. This has long been very broken, now it
works more or less OK. Keep the logical palette for each colormap
as small as possible while allocating and freeing colors. Select
and realize the logical palette associated with a GdkColormap into
a DC before drawing or blitting.
When the display is in 256-color mode, make it possible for the
user to override the size of the palette(s) used with either the
GDK_WIN32_MAX_COLORS environment variable, or a -max-colors
command line option. It is possible to reduce the palette size all
the way down to using just the 16 static colors (which causes the
system visual to be of type GDK_VISUAL_STATIC_COLOR. This could
possibly be useful if one desperately wants to avoid color
flashing. (Note that in order for this to work properly, an as of
yet not commited fix to gdkrgb.c is needed.)
Handle the palette messages. On WM_PALETTECHANGED, call
UpdateColors() for the given window hierarchy. Do this only if a
window in some other top-level window hierarchy caused the palette
change (realized a palette). Do this max five times in a row (an
arbitrarily chosen limit), though, otherwise redraw by generating
expose events. On WM_QUERYNEWPALETTE, cause a redraw of the whole
window hierarchy by generating GDK_EXPOSE events.
3) Code cleanup in general. For instance, remove the "emulated"
X11 structs ColormapStruct, Visual and XStandardColormap. Use the
new GDK_DEBUG_* flags for debugging output in the relevant source
files. Remove the unused colormap hash table in gdkcolor-win32.c
4) Plug some resource leaks.
2002-02-14 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkdnd-win32.c (gdk_dropfiles_filter): Use
g_filename_to_uri() to actually create legal URIs in the
text/uri-list data.
2002-02-17 00:25:05 +00:00
|
|
|
GDK_WINDOW_HWND (window),
|
|
|
|
hcursor));
|
2002-01-11 23:56:28 +00:00
|
|
|
|
|
|
|
/* First get the old cursor, if any (we wait to free the old one
|
|
|
|
* since it may be the current cursor set in the Win32 API right
|
|
|
|
* now).
|
|
|
|
*/
|
|
|
|
hprevcursor = impl->hcursor;
|
|
|
|
|
|
|
|
if (hcursor == NULL)
|
|
|
|
impl->hcursor = NULL;
|
|
|
|
else
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2002-01-11 23:56:28 +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).
|
|
|
|
*/
|
|
|
|
if ((impl->hcursor = CopyCursor (hcursor)) == NULL)
|
|
|
|
WIN32_API_FAILED ("CopyCursor");
|
2005-03-16 01:38:57 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("... CopyCursor (%p) = %p\n",
|
Massive changes. Too many to list here, but I'll try a summary:
2002-02-17 Tor Lillqvist <tml@iki.fi>
* gdk/win32/*.c: Massive changes. Too many to list here, but I'll
try a summary:
1) Unify GdkPixmap and GdkImage implementation: For each
GdkPixmap, allocate a GdkImage, and vice versa.
GdkPixmapImplWin32Data has a pointer to the GdkImage.
GdkImage::windowing_data is a pointer to the GdkPixmap.
This simplifies many pixmap and image related functions a lot, and
reduces duplicated code snippets. For instance, there is only one
place in gdk/win32 where CreateDIBSection() is called, in the
function _gdk_win32_new_pixmap(). Converting a bitmap (GdkPixmap)
to a Windows region is almost trivial, with the bitmap bits being
readily accessible in the associated GdkImage.
All blitting between GdkPixmaps, GdkWindows and GdkImages goes
through handled the _gdk_win32_blit() function, which calls
different functions to handle the cases of blitting from pixmaps,
inside windows (scrolling), or from windows, which all require
somewhat different handling.
2) Support 256-color mode. This has long been very broken, now it
works more or less OK. Keep the logical palette for each colormap
as small as possible while allocating and freeing colors. Select
and realize the logical palette associated with a GdkColormap into
a DC before drawing or blitting.
When the display is in 256-color mode, make it possible for the
user to override the size of the palette(s) used with either the
GDK_WIN32_MAX_COLORS environment variable, or a -max-colors
command line option. It is possible to reduce the palette size all
the way down to using just the 16 static colors (which causes the
system visual to be of type GDK_VISUAL_STATIC_COLOR. This could
possibly be useful if one desperately wants to avoid color
flashing. (Note that in order for this to work properly, an as of
yet not commited fix to gdkrgb.c is needed.)
Handle the palette messages. On WM_PALETTECHANGED, call
UpdateColors() for the given window hierarchy. Do this only if a
window in some other top-level window hierarchy caused the palette
change (realized a palette). Do this max five times in a row (an
arbitrarily chosen limit), though, otherwise redraw by generating
expose events. On WM_QUERYNEWPALETTE, cause a redraw of the whole
window hierarchy by generating GDK_EXPOSE events.
3) Code cleanup in general. For instance, remove the "emulated"
X11 structs ColormapStruct, Visual and XStandardColormap. Use the
new GDK_DEBUG_* flags for debugging output in the relevant source
files. Remove the unused colormap hash table in gdkcolor-win32.c
4) Plug some resource leaks.
2002-02-14 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkdnd-win32.c (gdk_dropfiles_filter): Use
g_filename_to_uri() to actually create legal URIs in the
text/uri-list data.
2002-02-17 00:25:05 +00:00
|
|
|
hcursor, impl->hcursor));
|
2002-01-11 23:56:28 +00:00
|
|
|
}
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2005-01-09 19:26:25 +00:00
|
|
|
if (impl->hcursor != NULL)
|
|
|
|
{
|
|
|
|
/* If the pointer is over our window, set new cursor */
|
|
|
|
GdkWindow *curr_window = gdk_window_get_pointer (window, NULL, NULL, NULL);
|
|
|
|
if (curr_window == window)
|
|
|
|
SetCursor (impl->hcursor);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Climb up the tree and find whether our window is the
|
|
|
|
* first ancestor that has cursor defined, and if so, set
|
|
|
|
* new cursor.
|
|
|
|
*/
|
|
|
|
GdkWindowObject *curr_window_obj = GDK_WINDOW_OBJECT (curr_window);
|
|
|
|
while (curr_window_obj &&
|
|
|
|
!GDK_WINDOW_IMPL_WIN32 (curr_window_obj->impl)->hcursor)
|
|
|
|
{
|
|
|
|
curr_window_obj = curr_window_obj->parent;
|
|
|
|
if (curr_window_obj == GDK_WINDOW_OBJECT (window))
|
|
|
|
{
|
|
|
|
SetCursor (impl->hcursor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2000-07-04 06:12:54 +00:00
|
|
|
|
2002-01-11 23:56:28 +00:00
|
|
|
/* Destroy the previous cursor: Need to make sure it's no longer in
|
|
|
|
* use before we destroy it, in case we're not over our window but
|
|
|
|
* the cursor is still set to our old one.
|
|
|
|
*/
|
|
|
|
if (hprevcursor != NULL)
|
|
|
|
{
|
2005-11-02 13:33:27 +00:00
|
|
|
if (GetCursor () == hprevcursor)
|
2002-06-10 20:27:15 +00:00
|
|
|
{
|
|
|
|
/* Look for a suitable cursor to use instead */
|
|
|
|
hcursor = NULL;
|
|
|
|
parent_window = GDK_WINDOW_OBJECT (window)->parent;
|
|
|
|
while (hcursor == NULL)
|
|
|
|
{
|
|
|
|
if (parent_window)
|
|
|
|
{
|
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (parent_window->impl);
|
|
|
|
hcursor = impl->hcursor;
|
|
|
|
parent_window = parent_window->parent;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
hcursor = LoadCursor (NULL, IDC_ARROW);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SetCursor (hcursor);
|
|
|
|
}
|
2001-02-11 11:00:14 +00:00
|
|
|
|
2005-03-16 01:38:57 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("... DestroyCursor (%p)\n", hprevcursor));
|
2002-01-11 23:56:28 +00:00
|
|
|
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
API_CALL (DestroyCursor, (hprevcursor));
|
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)
|
2005-03-16 02:21:14 +00:00
|
|
|
window = _gdk_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;
|
|
|
|
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
API_CALL (GetClientRect, (GDK_WINDOW_HWND (window), &rect));
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2005-03-16 02:21:14 +00:00
|
|
|
if (window != _gdk_root)
|
gdk/win32/gdkprivate-win32.h Rename all global variables and functions to
2002-11-12 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate-win32.h
* gdk/win32/*.c: Rename all global variables and functions to
start with underscore.
Merge from stable:
More work on the Win32 backend. The cause of some scrolling
problems was that SetWindowPos() and ScrollWindowEx() don't blit
those parts of the window they think are invalid. As we didn't
keep Windows's update region in synch with GDK's, Windows thought
those areas that in fact had been updated were invalid. Calling
ValidateRgn() in _gdk_windowing_window_queue_antiexpose() seems to
be an elegant and efficient solution, removing from Windows's
update region those areas we are about to repaint proactively.
In some cases garbage leftover values were used for the clip
origin in GdkGCWin32. This showed up as odd blank areas around the
pixmaps included in the Text Widget in gtk-demo.
Having the clip region either as a GdkRegion or a HRGN in
GdkGCWin32 was unnecessary, it's better to just use a HRGN.
The translation and antiexpose queue handling in
gdkgeometry-win32.c seems unnecessary (and not implementable in
the same way as on X11 anyway, no serial numbers) on Windows,
ifdeffed out.
Don't (try to) do guffaw scrolling as there is no static window
gravity on Windows. Guffaw scrolling would be unnecessary anyway,
as there is the ScrollWindow() API. This improves the behaviour of
the Text Widget demo in gtk-demo a lot. But I have no idea how the
lack of static win gravity should be handled in other places where
the X11 code uses it. Especially _gdk_window_move_resize_child().
There is still some problem in expose handling. By moving an
obscuring window back and forth over testgtk's main window, for
instance, every now and then you typically get narrow vertical or
horizontal strips of pixels that haven't been properly redrawn
after being exposed. A fencepost error somewhere?
Otherwise, all of testgtk and gtk-demo except "big windows" now
seem to work pretty well.
Bug #79720 should be fixed now.
* gdk/win32/gdkcolor-win32.c (gdk_win32_color_to_string,
gdk_win32_print_paletteentries, gdk_win32_print_system_palette,
gdk_win32_print_hpalette)
* gdk/win32/gdkdrawable-win32.c (gdk_win32_drawable_description)
* gdk/win32/gdkevents-win32.c (gdk_win32_message_name):
Move all debugging helper functions to gdkmain-win32.c.
* gdk/win32/gdkdrawable-win32.c (_gdk_win32_draw_tiles):
Rewrite. Make static. Must take tile origin parameters, too.
(gdk_win32_draw_rectangle): Pass the tile/stipple origin to
_gdk_win32_draw_tiles(). Remove #if 0 code.
(blit_inside_window): Don't call ScrollDC(), that didn't work at
all like I thought. A simple call to BitBlt() is enough.
* gdk/win32/gdkevents-win32.c (gdk_event_translate) Remove unused
latin_locale_loaded variable.
(_gdk_win32_get_next_tick): New function. Used to make sure
timestamps of events are always increasing, both in events
generated from the window procedure and in events gotten via
PeekMessage(). Not sure whether this is actually useful, but it
seemed as a good idea.
(real_window_procedure): Don't use a local GdkEventPrivate
variable. Don't attempt any compression of configure or expose
events here, handled elsewhere.
(erase_background): Accumulate window offsets when traversing up
the parent chain for GDK_PARENT_RELATIVE_BG, in order to get
correct alignment of background pixmaps. Don't fill with
BLACK_BRUSH if GDK_NO_BG.
(gdk_event_get_graphics_expose): A bit more verbose debugging output.
(gdk_event_translate): Use _gdk_win32_get_next_tick(). In the
WM_PAINT handler, don't check for empty update rect. When we get a
WM_PAINT, the update region isn't empty. And if it for some
strange reason is, that will be handled later anyway. Call
GetUpdateRgn() before calling BeginPaint() and EndPaint() (which
empty the update region).
* gdk/win32/gdkdnd-win32.c
* gdk/win32/gdkinput-win32.c:
Use _gdk_win32_get_next_tick().
* gdk/win32/gdkfont-win32.c: Use %p to print HFONTs.
(gdk_text_size): Remove, unused.
* gdk/win32/gdkgc-win32.c: Set clip origins to zero
when appropriate.
(gdk_gc_copy): Increase refcount on colormap if present.
(gdk_win32_hdc_get): Handle just hcliprgn. If we have a stipple,
combine it with clip region after selecting into the DC.
(_gdk_win32_bitmap_to_hrgn): Rename from _gdk_win32_bitmap_to_region.
(_gdk_win3_gdkregion_to_hrgn): New function, code snippet
extracted from gdk_win32_hdc_get().
* gdk/win32/gdkgeometry-win32.c: Ifdef out the translate_queue
handling.
(gdk_window_copy_area_scroll): Increase clipRect to avoid
ScrollWindowEx() not scrolling pixels it thinks are invalid.
Scroll also children with the ScrollWindowEx() call. No need to
call gdk_window_move() on the children.
(gdk_window_scroll): Don't do guffaw scrolling.
(gdk_window_compute_position): Fix typo, used win32_y where x was
intended.
(gdk_window_premove, gdk_window_postmove,
gdk_window_clip_changed): Add debugging output.
(_gdk_windowing_window_queue_antiexpose): Just call ValidateRgn()
on the region.
(_gdk_window_process_expose): No use for the serial number
parameter now. Instead of a rectangle, take a region parameter, as
Windows gives us one in WM_PAINT.
* gdk/win32/gdkmain-win32.c (_gdk_win32_lbstyle_to_string,
_gdk_win32_pstype_to_string, _gdk_win32_psstyle_to_string,
_gdk_win32_psendcap_to_string, _gdk_win32_psjoin_to_string,
_gdk_win32_rect_to_string, _gdk_win32_gdkrectangle_to_string,
_gdk_win32_gdkregion_to_string): New debugging functions.
(static_printf): Helper function for the above. sprintfs into a
static circular buffer, return value should be used "soon".
* gdk/win32/gdkwindow-win32.c (gdk_propagate_shapes): Plug memory
leak, free list after use.
(gdk_window_gravity_works): Remove, we know that there is no such
thing on Windows.
(gdk_window_set_static_bit_gravity,
gdk_window_set_static_win_gravity): Ditto, remove, they didn't do
anything anyway.
(_gdk_windowing_window_init, gdk_window_foreign_new): Call
_gdk_window_init_position() like in the X11 backend.
(gdk_window_reparent): Don't call the now nonexistent
gdk_window_set_static_win_gravity(). No idea what should be done
instead.
(gdk_window_get_geometry): The returned x and y should be relative
to parent. Used to be always zero..
(gdk_window_set_static_gravities): Return FALSE if trying to set
static gravity.
* gdk/win32/gdkprivate-win32.h: Drop the clip_region field from
GdkGCWin32. Only use the HRGN hcliprgn. Declare new
functions.
* gdk/win32/*.c: Use new debugging functions.
* gdk/win32/rc/gdk.rc.in: Update copyright year.
2002-11-12 22:17:48 +00:00
|
|
|
{
|
|
|
|
POINT pt;
|
|
|
|
GdkWindow *parent = gdk_window_get_parent (window);
|
|
|
|
|
|
|
|
pt.x = rect.left;
|
|
|
|
pt.y = rect.top;
|
|
|
|
ClientToScreen (GDK_WINDOW_HWND (window), &pt);
|
|
|
|
ScreenToClient (GDK_WINDOW_HWND (parent), &pt);
|
|
|
|
rect.left = pt.x;
|
|
|
|
rect.top = pt.y;
|
|
|
|
|
|
|
|
pt.x = rect.right;
|
|
|
|
pt.y = rect.bottom;
|
|
|
|
ClientToScreen (GDK_WINDOW_HWND (window), &pt);
|
|
|
|
ScreenToClient (GDK_WINDOW_HWND (parent), &pt);
|
|
|
|
rect.right = pt.x;
|
|
|
|
rect.bottom = pt.y;
|
gdk/win32/gdkinput-win32.h Drop the GdkEvent* parameter, it wasn't used.
2003-08-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkinput-win32.h
* gdk/win32/gdkinput-win32.c (_gdk_input_configure_event,
_gdk_input_enter_event): Drop the GdkEvent* parameter, it wasn't
used.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): Adapt caller
accordingly, in fact an uninitialised variable was dereferenced.
[Win32] Add support for multiple monitors.
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkglobals-win32.c: New global variables for
multiple-monitor info: _gdk_num_monitors, _gdk_monitors, and
_gdk_offset_x and _gdk_offset_y.
* gdk/win32/gdkdisplay-win32.c (count_monitor, enum_monitor): New
functions, enumeration functions passed to EnumDisplayMonitors().
(gdk_display_open): If the EnumDisplayMonitors() and
GetMonitorInfo() API is present (on Win98, Win2000 and newer), use
if to find out monitor info.
Calculate the offset between Win32 coordinates (relative to the
primary monitor's origin (and thus negative on monitors to the
left of or above it), and GDK's (visible coordinates should be
non-negative).
* gdk/win32/gdkscreen-win32 (gdk_screen_get_n_monitors,
gdk_screen_get_monitor_geometry): Use information collected above.
(gdk_window_move, gdk_window_move_resize_window_get_geometry):
Subtract _gdk_offset_{x,y} from GDK root window coordinates.
(gdk_window_get_geometry, gdk_window_get_origin,
gdk_window_get_frame_extents): For top-level windows, add
_gdk_offset_{x,y} to GDK root window coordinates
Still need to handle multiple monitors in
gdk_window_fullscreen(). Probably should make the window
fullscreen on the monitor where the cursor is?
* gdk/win32/gdkevents-win32.c: Add _gdk_offset_{x,y} to all GDK
root window coordinates in GdkEvents.
[Win32] Fix geometry hint handling. Add support for resize
increment and base size, and aspect ratio geometry hints. The
"gridded geometry" test in testgtk now works beautifully.
* gdk/win32/gdkwindow-win32.c (gdk_window_set_geometry_hints):
Turns out this function shouldn't actually ever modify the
window's size, just store the hints. (Old code kept for a while
inside #if 0.)
(gdk_window_set_hints): Remove presumably broken code that handles
the position hints, this function is obsolete anyway.
* gdk/win32/gdkevents-win32.c: Drop the current_{x,y}_root
variables, not used.
(adjust_drag): New function, used to implement resize increment
hints.
(gdk_event_translate): Handle WM_SIZING, implement resize
increment and base size, and aspect ratio geometry hints here. The
WM_GETMINMAXINFO handler takes care of the minimum and maximum
size hints as before. Fix the WM_GETMINMAXINFO handler to take
into account window decorations. No need to modify the
ptMaxPosition and ptMaxSize fields in the MINMAXINFO struct,
the defaults are fine.
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkwindow-win32.c (_gdk_win32_adjust_client_rect,
_gdk_win32_get_adjusted_client_rect): New helper functions.
2003-08-07 22:17:18 +00:00
|
|
|
|
2005-03-16 02:21:14 +00:00
|
|
|
if (parent == _gdk_root)
|
gdk/win32/gdkinput-win32.h Drop the GdkEvent* parameter, it wasn't used.
2003-08-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkinput-win32.h
* gdk/win32/gdkinput-win32.c (_gdk_input_configure_event,
_gdk_input_enter_event): Drop the GdkEvent* parameter, it wasn't
used.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): Adapt caller
accordingly, in fact an uninitialised variable was dereferenced.
[Win32] Add support for multiple monitors.
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkglobals-win32.c: New global variables for
multiple-monitor info: _gdk_num_monitors, _gdk_monitors, and
_gdk_offset_x and _gdk_offset_y.
* gdk/win32/gdkdisplay-win32.c (count_monitor, enum_monitor): New
functions, enumeration functions passed to EnumDisplayMonitors().
(gdk_display_open): If the EnumDisplayMonitors() and
GetMonitorInfo() API is present (on Win98, Win2000 and newer), use
if to find out monitor info.
Calculate the offset between Win32 coordinates (relative to the
primary monitor's origin (and thus negative on monitors to the
left of or above it), and GDK's (visible coordinates should be
non-negative).
* gdk/win32/gdkscreen-win32 (gdk_screen_get_n_monitors,
gdk_screen_get_monitor_geometry): Use information collected above.
(gdk_window_move, gdk_window_move_resize_window_get_geometry):
Subtract _gdk_offset_{x,y} from GDK root window coordinates.
(gdk_window_get_geometry, gdk_window_get_origin,
gdk_window_get_frame_extents): For top-level windows, add
_gdk_offset_{x,y} to GDK root window coordinates
Still need to handle multiple monitors in
gdk_window_fullscreen(). Probably should make the window
fullscreen on the monitor where the cursor is?
* gdk/win32/gdkevents-win32.c: Add _gdk_offset_{x,y} to all GDK
root window coordinates in GdkEvents.
[Win32] Fix geometry hint handling. Add support for resize
increment and base size, and aspect ratio geometry hints. The
"gridded geometry" test in testgtk now works beautifully.
* gdk/win32/gdkwindow-win32.c (gdk_window_set_geometry_hints):
Turns out this function shouldn't actually ever modify the
window's size, just store the hints. (Old code kept for a while
inside #if 0.)
(gdk_window_set_hints): Remove presumably broken code that handles
the position hints, this function is obsolete anyway.
* gdk/win32/gdkevents-win32.c: Drop the current_{x,y}_root
variables, not used.
(adjust_drag): New function, used to implement resize increment
hints.
(gdk_event_translate): Handle WM_SIZING, implement resize
increment and base size, and aspect ratio geometry hints here. The
WM_GETMINMAXINFO handler takes care of the minimum and maximum
size hints as before. Fix the WM_GETMINMAXINFO handler to take
into account window decorations. No need to modify the
ptMaxPosition and ptMaxSize fields in the MINMAXINFO struct,
the defaults are fine.
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkwindow-win32.c (_gdk_win32_adjust_client_rect,
_gdk_win32_get_adjusted_client_rect): New helper functions.
2003-08-07 22:17:18 +00:00
|
|
|
{
|
|
|
|
rect.left += _gdk_offset_x;
|
|
|
|
rect.top += _gdk_offset_y;
|
|
|
|
rect.right += _gdk_offset_x;
|
|
|
|
rect.bottom += _gdk_offset_y;
|
|
|
|
}
|
gdk/win32/gdkprivate-win32.h Rename all global variables and functions to
2002-11-12 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate-win32.h
* gdk/win32/*.c: Rename all global variables and functions to
start with underscore.
Merge from stable:
More work on the Win32 backend. The cause of some scrolling
problems was that SetWindowPos() and ScrollWindowEx() don't blit
those parts of the window they think are invalid. As we didn't
keep Windows's update region in synch with GDK's, Windows thought
those areas that in fact had been updated were invalid. Calling
ValidateRgn() in _gdk_windowing_window_queue_antiexpose() seems to
be an elegant and efficient solution, removing from Windows's
update region those areas we are about to repaint proactively.
In some cases garbage leftover values were used for the clip
origin in GdkGCWin32. This showed up as odd blank areas around the
pixmaps included in the Text Widget in gtk-demo.
Having the clip region either as a GdkRegion or a HRGN in
GdkGCWin32 was unnecessary, it's better to just use a HRGN.
The translation and antiexpose queue handling in
gdkgeometry-win32.c seems unnecessary (and not implementable in
the same way as on X11 anyway, no serial numbers) on Windows,
ifdeffed out.
Don't (try to) do guffaw scrolling as there is no static window
gravity on Windows. Guffaw scrolling would be unnecessary anyway,
as there is the ScrollWindow() API. This improves the behaviour of
the Text Widget demo in gtk-demo a lot. But I have no idea how the
lack of static win gravity should be handled in other places where
the X11 code uses it. Especially _gdk_window_move_resize_child().
There is still some problem in expose handling. By moving an
obscuring window back and forth over testgtk's main window, for
instance, every now and then you typically get narrow vertical or
horizontal strips of pixels that haven't been properly redrawn
after being exposed. A fencepost error somewhere?
Otherwise, all of testgtk and gtk-demo except "big windows" now
seem to work pretty well.
Bug #79720 should be fixed now.
* gdk/win32/gdkcolor-win32.c (gdk_win32_color_to_string,
gdk_win32_print_paletteentries, gdk_win32_print_system_palette,
gdk_win32_print_hpalette)
* gdk/win32/gdkdrawable-win32.c (gdk_win32_drawable_description)
* gdk/win32/gdkevents-win32.c (gdk_win32_message_name):
Move all debugging helper functions to gdkmain-win32.c.
* gdk/win32/gdkdrawable-win32.c (_gdk_win32_draw_tiles):
Rewrite. Make static. Must take tile origin parameters, too.
(gdk_win32_draw_rectangle): Pass the tile/stipple origin to
_gdk_win32_draw_tiles(). Remove #if 0 code.
(blit_inside_window): Don't call ScrollDC(), that didn't work at
all like I thought. A simple call to BitBlt() is enough.
* gdk/win32/gdkevents-win32.c (gdk_event_translate) Remove unused
latin_locale_loaded variable.
(_gdk_win32_get_next_tick): New function. Used to make sure
timestamps of events are always increasing, both in events
generated from the window procedure and in events gotten via
PeekMessage(). Not sure whether this is actually useful, but it
seemed as a good idea.
(real_window_procedure): Don't use a local GdkEventPrivate
variable. Don't attempt any compression of configure or expose
events here, handled elsewhere.
(erase_background): Accumulate window offsets when traversing up
the parent chain for GDK_PARENT_RELATIVE_BG, in order to get
correct alignment of background pixmaps. Don't fill with
BLACK_BRUSH if GDK_NO_BG.
(gdk_event_get_graphics_expose): A bit more verbose debugging output.
(gdk_event_translate): Use _gdk_win32_get_next_tick(). In the
WM_PAINT handler, don't check for empty update rect. When we get a
WM_PAINT, the update region isn't empty. And if it for some
strange reason is, that will be handled later anyway. Call
GetUpdateRgn() before calling BeginPaint() and EndPaint() (which
empty the update region).
* gdk/win32/gdkdnd-win32.c
* gdk/win32/gdkinput-win32.c:
Use _gdk_win32_get_next_tick().
* gdk/win32/gdkfont-win32.c: Use %p to print HFONTs.
(gdk_text_size): Remove, unused.
* gdk/win32/gdkgc-win32.c: Set clip origins to zero
when appropriate.
(gdk_gc_copy): Increase refcount on colormap if present.
(gdk_win32_hdc_get): Handle just hcliprgn. If we have a stipple,
combine it with clip region after selecting into the DC.
(_gdk_win32_bitmap_to_hrgn): Rename from _gdk_win32_bitmap_to_region.
(_gdk_win3_gdkregion_to_hrgn): New function, code snippet
extracted from gdk_win32_hdc_get().
* gdk/win32/gdkgeometry-win32.c: Ifdef out the translate_queue
handling.
(gdk_window_copy_area_scroll): Increase clipRect to avoid
ScrollWindowEx() not scrolling pixels it thinks are invalid.
Scroll also children with the ScrollWindowEx() call. No need to
call gdk_window_move() on the children.
(gdk_window_scroll): Don't do guffaw scrolling.
(gdk_window_compute_position): Fix typo, used win32_y where x was
intended.
(gdk_window_premove, gdk_window_postmove,
gdk_window_clip_changed): Add debugging output.
(_gdk_windowing_window_queue_antiexpose): Just call ValidateRgn()
on the region.
(_gdk_window_process_expose): No use for the serial number
parameter now. Instead of a rectangle, take a region parameter, as
Windows gives us one in WM_PAINT.
* gdk/win32/gdkmain-win32.c (_gdk_win32_lbstyle_to_string,
_gdk_win32_pstype_to_string, _gdk_win32_psstyle_to_string,
_gdk_win32_psendcap_to_string, _gdk_win32_psjoin_to_string,
_gdk_win32_rect_to_string, _gdk_win32_gdkrectangle_to_string,
_gdk_win32_gdkregion_to_string): New debugging functions.
(static_printf): Helper function for the above. sprintfs into a
static circular buffer, return value should be used "soon".
* gdk/win32/gdkwindow-win32.c (gdk_propagate_shapes): Plug memory
leak, free list after use.
(gdk_window_gravity_works): Remove, we know that there is no such
thing on Windows.
(gdk_window_set_static_bit_gravity,
gdk_window_set_static_win_gravity): Ditto, remove, they didn't do
anything anyway.
(_gdk_windowing_window_init, gdk_window_foreign_new): Call
_gdk_window_init_position() like in the X11 backend.
(gdk_window_reparent): Don't call the now nonexistent
gdk_window_set_static_win_gravity(). No idea what should be done
instead.
(gdk_window_get_geometry): The returned x and y should be relative
to parent. Used to be always zero..
(gdk_window_set_static_gravities): Return FALSE if trying to set
static gravity.
* gdk/win32/gdkprivate-win32.h: Drop the clip_region field from
GdkGCWin32. Only use the HRGN hcliprgn. Declare new
functions.
* gdk/win32/*.c: Use new debugging functions.
* gdk/win32/rc/gdk.rc.in: Update copyright year.
2002-11-12 22:17:48 +00:00
|
|
|
}
|
|
|
|
|
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;
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
|
2005-03-16 01:38:57 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_get_geometry: %p: %ldx%ldx%d@%+ld%+ld\n",
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
GDK_WINDOW_HWND (window),
|
|
|
|
rect.right - rect.left, rect.bottom - rect.top,
|
|
|
|
gdk_drawable_get_visual (window)->depth,
|
|
|
|
rect.left, rect.top));
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gint
|
|
|
|
gdk_window_get_origin (GdkWindow *window,
|
|
|
|
gint *x,
|
|
|
|
gint *y)
|
|
|
|
{
|
|
|
|
gint return_val;
|
|
|
|
gint tx = 0;
|
|
|
|
gint ty = 0;
|
|
|
|
|
2005-11-02 13:33:27 +00:00
|
|
|
g_return_val_if_fail (GDK_IS_WINDOW (window), 0);
|
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
|
|
|
{
|
|
|
|
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)
|
gdk/win32/gdkinput-win32.h Drop the GdkEvent* parameter, it wasn't used.
2003-08-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkinput-win32.h
* gdk/win32/gdkinput-win32.c (_gdk_input_configure_event,
_gdk_input_enter_event): Drop the GdkEvent* parameter, it wasn't
used.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): Adapt caller
accordingly, in fact an uninitialised variable was dereferenced.
[Win32] Add support for multiple monitors.
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkglobals-win32.c: New global variables for
multiple-monitor info: _gdk_num_monitors, _gdk_monitors, and
_gdk_offset_x and _gdk_offset_y.
* gdk/win32/gdkdisplay-win32.c (count_monitor, enum_monitor): New
functions, enumeration functions passed to EnumDisplayMonitors().
(gdk_display_open): If the EnumDisplayMonitors() and
GetMonitorInfo() API is present (on Win98, Win2000 and newer), use
if to find out monitor info.
Calculate the offset between Win32 coordinates (relative to the
primary monitor's origin (and thus negative on monitors to the
left of or above it), and GDK's (visible coordinates should be
non-negative).
* gdk/win32/gdkscreen-win32 (gdk_screen_get_n_monitors,
gdk_screen_get_monitor_geometry): Use information collected above.
(gdk_window_move, gdk_window_move_resize_window_get_geometry):
Subtract _gdk_offset_{x,y} from GDK root window coordinates.
(gdk_window_get_geometry, gdk_window_get_origin,
gdk_window_get_frame_extents): For top-level windows, add
_gdk_offset_{x,y} to GDK root window coordinates
Still need to handle multiple monitors in
gdk_window_fullscreen(). Probably should make the window
fullscreen on the monitor where the cursor is?
* gdk/win32/gdkevents-win32.c: Add _gdk_offset_{x,y} to all GDK
root window coordinates in GdkEvents.
[Win32] Fix geometry hint handling. Add support for resize
increment and base size, and aspect ratio geometry hints. The
"gridded geometry" test in testgtk now works beautifully.
* gdk/win32/gdkwindow-win32.c (gdk_window_set_geometry_hints):
Turns out this function shouldn't actually ever modify the
window's size, just store the hints. (Old code kept for a while
inside #if 0.)
(gdk_window_set_hints): Remove presumably broken code that handles
the position hints, this function is obsolete anyway.
* gdk/win32/gdkevents-win32.c: Drop the current_{x,y}_root
variables, not used.
(adjust_drag): New function, used to implement resize increment
hints.
(gdk_event_translate): Handle WM_SIZING, implement resize
increment and base size, and aspect ratio geometry hints here. The
WM_GETMINMAXINFO handler takes care of the minimum and maximum
size hints as before. Fix the WM_GETMINMAXINFO handler to take
into account window decorations. No need to modify the
ptMaxPosition and ptMaxSize fields in the MINMAXINFO struct,
the defaults are fine.
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkwindow-win32.c (_gdk_win32_adjust_client_rect,
_gdk_win32_get_adjusted_client_rect): New helper functions.
2003-08-07 22:17:18 +00:00
|
|
|
*x = tx + _gdk_offset_x;
|
1999-11-11 22:12:27 +00:00
|
|
|
if (y)
|
gdk/win32/gdkinput-win32.h Drop the GdkEvent* parameter, it wasn't used.
2003-08-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkinput-win32.h
* gdk/win32/gdkinput-win32.c (_gdk_input_configure_event,
_gdk_input_enter_event): Drop the GdkEvent* parameter, it wasn't
used.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): Adapt caller
accordingly, in fact an uninitialised variable was dereferenced.
[Win32] Add support for multiple monitors.
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkglobals-win32.c: New global variables for
multiple-monitor info: _gdk_num_monitors, _gdk_monitors, and
_gdk_offset_x and _gdk_offset_y.
* gdk/win32/gdkdisplay-win32.c (count_monitor, enum_monitor): New
functions, enumeration functions passed to EnumDisplayMonitors().
(gdk_display_open): If the EnumDisplayMonitors() and
GetMonitorInfo() API is present (on Win98, Win2000 and newer), use
if to find out monitor info.
Calculate the offset between Win32 coordinates (relative to the
primary monitor's origin (and thus negative on monitors to the
left of or above it), and GDK's (visible coordinates should be
non-negative).
* gdk/win32/gdkscreen-win32 (gdk_screen_get_n_monitors,
gdk_screen_get_monitor_geometry): Use information collected above.
(gdk_window_move, gdk_window_move_resize_window_get_geometry):
Subtract _gdk_offset_{x,y} from GDK root window coordinates.
(gdk_window_get_geometry, gdk_window_get_origin,
gdk_window_get_frame_extents): For top-level windows, add
_gdk_offset_{x,y} to GDK root window coordinates
Still need to handle multiple monitors in
gdk_window_fullscreen(). Probably should make the window
fullscreen on the monitor where the cursor is?
* gdk/win32/gdkevents-win32.c: Add _gdk_offset_{x,y} to all GDK
root window coordinates in GdkEvents.
[Win32] Fix geometry hint handling. Add support for resize
increment and base size, and aspect ratio geometry hints. The
"gridded geometry" test in testgtk now works beautifully.
* gdk/win32/gdkwindow-win32.c (gdk_window_set_geometry_hints):
Turns out this function shouldn't actually ever modify the
window's size, just store the hints. (Old code kept for a while
inside #if 0.)
(gdk_window_set_hints): Remove presumably broken code that handles
the position hints, this function is obsolete anyway.
* gdk/win32/gdkevents-win32.c: Drop the current_{x,y}_root
variables, not used.
(adjust_drag): New function, used to implement resize increment
hints.
(gdk_event_translate): Handle WM_SIZING, implement resize
increment and base size, and aspect ratio geometry hints here. The
WM_GETMINMAXINFO handler takes care of the minimum and maximum
size hints as before. Fix the WM_GETMINMAXINFO handler to take
into account window decorations. No need to modify the
ptMaxPosition and ptMaxSize fields in the MINMAXINFO struct,
the defaults are fine.
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkwindow-win32.c (_gdk_win32_adjust_client_rect,
_gdk_win32_get_adjusted_client_rect): New helper functions.
2003-08-07 22:17:18 +00:00
|
|
|
*y = ty + _gdk_offset_y;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2005-03-16 01:38:57 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_get_origin: %p: %+d%+d\n",
|
Massive changes. Too many to list here, but I'll try a summary:
2002-02-17 Tor Lillqvist <tml@iki.fi>
* gdk/win32/*.c: Massive changes. Too many to list here, but I'll
try a summary:
1) Unify GdkPixmap and GdkImage implementation: For each
GdkPixmap, allocate a GdkImage, and vice versa.
GdkPixmapImplWin32Data has a pointer to the GdkImage.
GdkImage::windowing_data is a pointer to the GdkPixmap.
This simplifies many pixmap and image related functions a lot, and
reduces duplicated code snippets. For instance, there is only one
place in gdk/win32 where CreateDIBSection() is called, in the
function _gdk_win32_new_pixmap(). Converting a bitmap (GdkPixmap)
to a Windows region is almost trivial, with the bitmap bits being
readily accessible in the associated GdkImage.
All blitting between GdkPixmaps, GdkWindows and GdkImages goes
through handled the _gdk_win32_blit() function, which calls
different functions to handle the cases of blitting from pixmaps,
inside windows (scrolling), or from windows, which all require
somewhat different handling.
2) Support 256-color mode. This has long been very broken, now it
works more or less OK. Keep the logical palette for each colormap
as small as possible while allocating and freeing colors. Select
and realize the logical palette associated with a GdkColormap into
a DC before drawing or blitting.
When the display is in 256-color mode, make it possible for the
user to override the size of the palette(s) used with either the
GDK_WIN32_MAX_COLORS environment variable, or a -max-colors
command line option. It is possible to reduce the palette size all
the way down to using just the 16 static colors (which causes the
system visual to be of type GDK_VISUAL_STATIC_COLOR. This could
possibly be useful if one desperately wants to avoid color
flashing. (Note that in order for this to work properly, an as of
yet not commited fix to gdkrgb.c is needed.)
Handle the palette messages. On WM_PALETTECHANGED, call
UpdateColors() for the given window hierarchy. Do this only if a
window in some other top-level window hierarchy caused the palette
change (realized a palette). Do this max five times in a row (an
arbitrarily chosen limit), though, otherwise redraw by generating
expose events. On WM_QUERYNEWPALETTE, cause a redraw of the whole
window hierarchy by generating GDK_EXPOSE events.
3) Code cleanup in general. For instance, remove the "emulated"
X11 structs ColormapStruct, Visual and XStandardColormap. Use the
new GDK_DEBUG_* flags for debugging output in the relevant source
files. Remove the unused colormap hash table in gdkcolor-win32.c
4) Plug some resource leaks.
2002-02-14 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkdnd-win32.c (gdk_dropfiles_filter): Use
g_filename_to_uri() to actually create legal URIs in the
text/uri-list data.
2002-02-17 00:25:05 +00:00
|
|
|
GDK_WINDOW_HWND (window),
|
2000-11-11 18:39:57 +00:00
|
|
|
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)
|
|
|
|
{
|
Massive changes. Too many to list here, but I'll try a summary:
2002-02-17 Tor Lillqvist <tml@iki.fi>
* gdk/win32/*.c: Massive changes. Too many to list here, but I'll
try a summary:
1) Unify GdkPixmap and GdkImage implementation: For each
GdkPixmap, allocate a GdkImage, and vice versa.
GdkPixmapImplWin32Data has a pointer to the GdkImage.
GdkImage::windowing_data is a pointer to the GdkPixmap.
This simplifies many pixmap and image related functions a lot, and
reduces duplicated code snippets. For instance, there is only one
place in gdk/win32 where CreateDIBSection() is called, in the
function _gdk_win32_new_pixmap(). Converting a bitmap (GdkPixmap)
to a Windows region is almost trivial, with the bitmap bits being
readily accessible in the associated GdkImage.
All blitting between GdkPixmaps, GdkWindows and GdkImages goes
through handled the _gdk_win32_blit() function, which calls
different functions to handle the cases of blitting from pixmaps,
inside windows (scrolling), or from windows, which all require
somewhat different handling.
2) Support 256-color mode. This has long been very broken, now it
works more or less OK. Keep the logical palette for each colormap
as small as possible while allocating and freeing colors. Select
and realize the logical palette associated with a GdkColormap into
a DC before drawing or blitting.
When the display is in 256-color mode, make it possible for the
user to override the size of the palette(s) used with either the
GDK_WIN32_MAX_COLORS environment variable, or a -max-colors
command line option. It is possible to reduce the palette size all
the way down to using just the 16 static colors (which causes the
system visual to be of type GDK_VISUAL_STATIC_COLOR. This could
possibly be useful if one desperately wants to avoid color
flashing. (Note that in order for this to work properly, an as of
yet not commited fix to gdkrgb.c is needed.)
Handle the palette messages. On WM_PALETTECHANGED, call
UpdateColors() for the given window hierarchy. Do this only if a
window in some other top-level window hierarchy caused the palette
change (realized a palette). Do this max five times in a row (an
arbitrarily chosen limit), though, otherwise redraw by generating
expose events. On WM_QUERYNEWPALETTE, cause a redraw of the whole
window hierarchy by generating GDK_EXPOSE events.
3) Code cleanup in general. For instance, remove the "emulated"
X11 structs ColormapStruct, Visual and XStandardColormap. Use the
new GDK_DEBUG_* flags for debugging output in the relevant source
files. Remove the unused colormap hash table in gdkcolor-win32.c
4) Plug some resource leaks.
2002-02-14 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkdnd-win32.c (gdk_dropfiles_filter): Use
g_filename_to_uri() to actually create legal URIs in the
text/uri-list data.
2002-02-17 00:25:05 +00:00
|
|
|
GdkRectangle rect;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
Massive changes. Too many to list here, but I'll try a summary:
2002-02-17 Tor Lillqvist <tml@iki.fi>
* gdk/win32/*.c: Massive changes. Too many to list here, but I'll
try a summary:
1) Unify GdkPixmap and GdkImage implementation: For each
GdkPixmap, allocate a GdkImage, and vice versa.
GdkPixmapImplWin32Data has a pointer to the GdkImage.
GdkImage::windowing_data is a pointer to the GdkPixmap.
This simplifies many pixmap and image related functions a lot, and
reduces duplicated code snippets. For instance, there is only one
place in gdk/win32 where CreateDIBSection() is called, in the
function _gdk_win32_new_pixmap(). Converting a bitmap (GdkPixmap)
to a Windows region is almost trivial, with the bitmap bits being
readily accessible in the associated GdkImage.
All blitting between GdkPixmaps, GdkWindows and GdkImages goes
through handled the _gdk_win32_blit() function, which calls
different functions to handle the cases of blitting from pixmaps,
inside windows (scrolling), or from windows, which all require
somewhat different handling.
2) Support 256-color mode. This has long been very broken, now it
works more or less OK. Keep the logical palette for each colormap
as small as possible while allocating and freeing colors. Select
and realize the logical palette associated with a GdkColormap into
a DC before drawing or blitting.
When the display is in 256-color mode, make it possible for the
user to override the size of the palette(s) used with either the
GDK_WIN32_MAX_COLORS environment variable, or a -max-colors
command line option. It is possible to reduce the palette size all
the way down to using just the 16 static colors (which causes the
system visual to be of type GDK_VISUAL_STATIC_COLOR. This could
possibly be useful if one desperately wants to avoid color
flashing. (Note that in order for this to work properly, an as of
yet not commited fix to gdkrgb.c is needed.)
Handle the palette messages. On WM_PALETTECHANGED, call
UpdateColors() for the given window hierarchy. Do this only if a
window in some other top-level window hierarchy caused the palette
change (realized a palette). Do this max five times in a row (an
arbitrarily chosen limit), though, otherwise redraw by generating
expose events. On WM_QUERYNEWPALETTE, cause a redraw of the whole
window hierarchy by generating GDK_EXPOSE events.
3) Code cleanup in general. For instance, remove the "emulated"
X11 structs ColormapStruct, Visual and XStandardColormap. Use the
new GDK_DEBUG_* flags for debugging output in the relevant source
files. Remove the unused colormap hash table in gdkcolor-win32.c
4) Plug some resource leaks.
2002-02-14 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkdnd-win32.c (gdk_dropfiles_filter): Use
g_filename_to_uri() to actually create legal URIs in the
text/uri-list data.
2002-02-17 00:25:05 +00:00
|
|
|
gdk_window_get_frame_extents (window, &rect);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
if (x)
|
Massive changes. Too many to list here, but I'll try a summary:
2002-02-17 Tor Lillqvist <tml@iki.fi>
* gdk/win32/*.c: Massive changes. Too many to list here, but I'll
try a summary:
1) Unify GdkPixmap and GdkImage implementation: For each
GdkPixmap, allocate a GdkImage, and vice versa.
GdkPixmapImplWin32Data has a pointer to the GdkImage.
GdkImage::windowing_data is a pointer to the GdkPixmap.
This simplifies many pixmap and image related functions a lot, and
reduces duplicated code snippets. For instance, there is only one
place in gdk/win32 where CreateDIBSection() is called, in the
function _gdk_win32_new_pixmap(). Converting a bitmap (GdkPixmap)
to a Windows region is almost trivial, with the bitmap bits being
readily accessible in the associated GdkImage.
All blitting between GdkPixmaps, GdkWindows and GdkImages goes
through handled the _gdk_win32_blit() function, which calls
different functions to handle the cases of blitting from pixmaps,
inside windows (scrolling), or from windows, which all require
somewhat different handling.
2) Support 256-color mode. This has long been very broken, now it
works more or less OK. Keep the logical palette for each colormap
as small as possible while allocating and freeing colors. Select
and realize the logical palette associated with a GdkColormap into
a DC before drawing or blitting.
When the display is in 256-color mode, make it possible for the
user to override the size of the palette(s) used with either the
GDK_WIN32_MAX_COLORS environment variable, or a -max-colors
command line option. It is possible to reduce the palette size all
the way down to using just the 16 static colors (which causes the
system visual to be of type GDK_VISUAL_STATIC_COLOR. This could
possibly be useful if one desperately wants to avoid color
flashing. (Note that in order for this to work properly, an as of
yet not commited fix to gdkrgb.c is needed.)
Handle the palette messages. On WM_PALETTECHANGED, call
UpdateColors() for the given window hierarchy. Do this only if a
window in some other top-level window hierarchy caused the palette
change (realized a palette). Do this max five times in a row (an
arbitrarily chosen limit), though, otherwise redraw by generating
expose events. On WM_QUERYNEWPALETTE, cause a redraw of the whole
window hierarchy by generating GDK_EXPOSE events.
3) Code cleanup in general. For instance, remove the "emulated"
X11 structs ColormapStruct, Visual and XStandardColormap. Use the
new GDK_DEBUG_* flags for debugging output in the relevant source
files. Remove the unused colormap hash table in gdkcolor-win32.c
4) Plug some resource leaks.
2002-02-14 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkdnd-win32.c (gdk_dropfiles_filter): Use
g_filename_to_uri() to actually create legal URIs in the
text/uri-list data.
2002-02-17 00:25:05 +00:00
|
|
|
*x = rect.x;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
Massive changes. Too many to list here, but I'll try a summary:
2002-02-17 Tor Lillqvist <tml@iki.fi>
* gdk/win32/*.c: Massive changes. Too many to list here, but I'll
try a summary:
1) Unify GdkPixmap and GdkImage implementation: For each
GdkPixmap, allocate a GdkImage, and vice versa.
GdkPixmapImplWin32Data has a pointer to the GdkImage.
GdkImage::windowing_data is a pointer to the GdkPixmap.
This simplifies many pixmap and image related functions a lot, and
reduces duplicated code snippets. For instance, there is only one
place in gdk/win32 where CreateDIBSection() is called, in the
function _gdk_win32_new_pixmap(). Converting a bitmap (GdkPixmap)
to a Windows region is almost trivial, with the bitmap bits being
readily accessible in the associated GdkImage.
All blitting between GdkPixmaps, GdkWindows and GdkImages goes
through handled the _gdk_win32_blit() function, which calls
different functions to handle the cases of blitting from pixmaps,
inside windows (scrolling), or from windows, which all require
somewhat different handling.
2) Support 256-color mode. This has long been very broken, now it
works more or less OK. Keep the logical palette for each colormap
as small as possible while allocating and freeing colors. Select
and realize the logical palette associated with a GdkColormap into
a DC before drawing or blitting.
When the display is in 256-color mode, make it possible for the
user to override the size of the palette(s) used with either the
GDK_WIN32_MAX_COLORS environment variable, or a -max-colors
command line option. It is possible to reduce the palette size all
the way down to using just the 16 static colors (which causes the
system visual to be of type GDK_VISUAL_STATIC_COLOR. This could
possibly be useful if one desperately wants to avoid color
flashing. (Note that in order for this to work properly, an as of
yet not commited fix to gdkrgb.c is needed.)
Handle the palette messages. On WM_PALETTECHANGED, call
UpdateColors() for the given window hierarchy. Do this only if a
window in some other top-level window hierarchy caused the palette
change (realized a palette). Do this max five times in a row (an
arbitrarily chosen limit), though, otherwise redraw by generating
expose events. On WM_QUERYNEWPALETTE, cause a redraw of the whole
window hierarchy by generating GDK_EXPOSE events.
3) Code cleanup in general. For instance, remove the "emulated"
X11 structs ColormapStruct, Visual and XStandardColormap. Use the
new GDK_DEBUG_* flags for debugging output in the relevant source
files. Remove the unused colormap hash table in gdkcolor-win32.c
4) Plug some resource leaks.
2002-02-14 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkdnd-win32.c (gdk_dropfiles_filter): Use
g_filename_to_uri() to actually create legal URIs in the
text/uri-list data.
2002-02-17 00:25:05 +00:00
|
|
|
if (y)
|
|
|
|
*y = rect.y;
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
|
2005-03-16 01:38:57 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_get_root_origin: %p: %+d%+d\n",
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
GDK_WINDOW_HWND (window), rect.x, rect.y));
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
2001-03-31 19:33:49 +00:00
|
|
|
void
|
|
|
|
gdk_window_get_frame_extents (GdkWindow *window,
|
|
|
|
GdkRectangle *rect)
|
|
|
|
{
|
|
|
|
GdkWindowObject *private;
|
|
|
|
HWND hwnd;
|
|
|
|
RECT r;
|
|
|
|
|
coalescing property notifies
2001-08-11 Hans Breuer <hans@breuer.org>
* gtk/gtkalignment.c, gtk/gtkarrow.c, gtk/gtkaspectframe.c,
gtk/gtkcellrenderer.c, gtk/gtkcellrenderertext.c,
gtk/gtkcombo.c, gtk/gtkcurve.c, gtk/gtkfontsel.c,
gtk/gtklayout.c, gtk/gtkmisc.c, gtk/gtkpacker.c,
gtk/gtkprogress.c, gtk/gtkruler.c,, gtk/gtksettings.c,
gtk/gtkspinbutton.c, gtk/gtktexttag.c : coalescing property notifies
* gtk/gtkclist.c, gtk/gtktipsquery.c, gtk/gtktexttag.c,
gtk/gtkwidget.c : added G_SIGNAL_TYPE_STATIC_SCOPE to all
GDK_TYPE_EVENT signals
* gtk/gtkalignment.c : removed 'direct allocation bug',
which Tim discovered while reading the patch
2001-08-11 20:27:36 +00:00
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
g_return_if_fail (rect != NULL);
|
|
|
|
|
|
|
|
private = GDK_WINDOW_OBJECT (window);
|
|
|
|
|
2001-03-31 19:33:49 +00:00
|
|
|
rect->x = 0;
|
|
|
|
rect->y = 0;
|
|
|
|
rect->width = 1;
|
|
|
|
rect->height = 1;
|
|
|
|
|
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
|
|
|
return;
|
|
|
|
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
/* FIXME: window is documented to be a toplevel GdkWindow, so is it really
|
|
|
|
* necessary to walk its parent chain?
|
|
|
|
*/
|
coalescing property notifies
2001-08-11 Hans Breuer <hans@breuer.org>
* gtk/gtkalignment.c, gtk/gtkarrow.c, gtk/gtkaspectframe.c,
gtk/gtkcellrenderer.c, gtk/gtkcellrenderertext.c,
gtk/gtkcombo.c, gtk/gtkcurve.c, gtk/gtkfontsel.c,
gtk/gtklayout.c, gtk/gtkmisc.c, gtk/gtkpacker.c,
gtk/gtkprogress.c, gtk/gtkruler.c,, gtk/gtksettings.c,
gtk/gtkspinbutton.c, gtk/gtktexttag.c : coalescing property notifies
* gtk/gtkclist.c, gtk/gtktipsquery.c, gtk/gtktexttag.c,
gtk/gtkwidget.c : added G_SIGNAL_TYPE_STATIC_SCOPE to all
GDK_TYPE_EVENT signals
* gtk/gtkalignment.c : removed 'direct allocation bug',
which Tim discovered while reading the patch
2001-08-11 20:27:36 +00:00
|
|
|
while (private->parent && ((GdkWindowObject*) private->parent)->parent)
|
|
|
|
private = (GdkWindowObject*) private->parent;
|
|
|
|
|
2001-03-31 19:33:49 +00:00
|
|
|
hwnd = GDK_WINDOW_HWND (window);
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
API_CALL (GetWindowRect, (hwnd, &r));
|
2001-03-31 19:33:49 +00:00
|
|
|
|
gdk/win32/gdkinput-win32.h Drop the GdkEvent* parameter, it wasn't used.
2003-08-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkinput-win32.h
* gdk/win32/gdkinput-win32.c (_gdk_input_configure_event,
_gdk_input_enter_event): Drop the GdkEvent* parameter, it wasn't
used.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): Adapt caller
accordingly, in fact an uninitialised variable was dereferenced.
[Win32] Add support for multiple monitors.
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkglobals-win32.c: New global variables for
multiple-monitor info: _gdk_num_monitors, _gdk_monitors, and
_gdk_offset_x and _gdk_offset_y.
* gdk/win32/gdkdisplay-win32.c (count_monitor, enum_monitor): New
functions, enumeration functions passed to EnumDisplayMonitors().
(gdk_display_open): If the EnumDisplayMonitors() and
GetMonitorInfo() API is present (on Win98, Win2000 and newer), use
if to find out monitor info.
Calculate the offset between Win32 coordinates (relative to the
primary monitor's origin (and thus negative on monitors to the
left of or above it), and GDK's (visible coordinates should be
non-negative).
* gdk/win32/gdkscreen-win32 (gdk_screen_get_n_monitors,
gdk_screen_get_monitor_geometry): Use information collected above.
(gdk_window_move, gdk_window_move_resize_window_get_geometry):
Subtract _gdk_offset_{x,y} from GDK root window coordinates.
(gdk_window_get_geometry, gdk_window_get_origin,
gdk_window_get_frame_extents): For top-level windows, add
_gdk_offset_{x,y} to GDK root window coordinates
Still need to handle multiple monitors in
gdk_window_fullscreen(). Probably should make the window
fullscreen on the monitor where the cursor is?
* gdk/win32/gdkevents-win32.c: Add _gdk_offset_{x,y} to all GDK
root window coordinates in GdkEvents.
[Win32] Fix geometry hint handling. Add support for resize
increment and base size, and aspect ratio geometry hints. The
"gridded geometry" test in testgtk now works beautifully.
* gdk/win32/gdkwindow-win32.c (gdk_window_set_geometry_hints):
Turns out this function shouldn't actually ever modify the
window's size, just store the hints. (Old code kept for a while
inside #if 0.)
(gdk_window_set_hints): Remove presumably broken code that handles
the position hints, this function is obsolete anyway.
* gdk/win32/gdkevents-win32.c: Drop the current_{x,y}_root
variables, not used.
(adjust_drag): New function, used to implement resize increment
hints.
(gdk_event_translate): Handle WM_SIZING, implement resize
increment and base size, and aspect ratio geometry hints here. The
WM_GETMINMAXINFO handler takes care of the minimum and maximum
size hints as before. Fix the WM_GETMINMAXINFO handler to take
into account window decorations. No need to modify the
ptMaxPosition and ptMaxSize fields in the MINMAXINFO struct,
the defaults are fine.
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkwindow-win32.c (_gdk_win32_adjust_client_rect,
_gdk_win32_get_adjusted_client_rect): New helper functions.
2003-08-07 22:17:18 +00:00
|
|
|
rect->x = r.left + _gdk_offset_x;
|
|
|
|
rect->y = r.top + _gdk_offset_y;
|
2001-03-31 19:33:49 +00:00
|
|
|
rect->width = r.right - r.left;
|
|
|
|
rect->height = r.bottom - r.top;
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
|
2005-03-16 01:38:57 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_get_frame_extents: %p: %ldx%ld@%+ld%+ld\n",
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
GDK_WINDOW_HWND (window),
|
|
|
|
r.right - r.left, r.bottom - r.top,
|
|
|
|
r.left, r.top));
|
2001-03-31 19:33:49 +00:00
|
|
|
}
|
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
GdkWindow*
|
gdk/win32/gdkprivate-win32.h Rename all global variables and functions to
2002-11-12 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate-win32.h
* gdk/win32/*.c: Rename all global variables and functions to
start with underscore.
Merge from stable:
More work on the Win32 backend. The cause of some scrolling
problems was that SetWindowPos() and ScrollWindowEx() don't blit
those parts of the window they think are invalid. As we didn't
keep Windows's update region in synch with GDK's, Windows thought
those areas that in fact had been updated were invalid. Calling
ValidateRgn() in _gdk_windowing_window_queue_antiexpose() seems to
be an elegant and efficient solution, removing from Windows's
update region those areas we are about to repaint proactively.
In some cases garbage leftover values were used for the clip
origin in GdkGCWin32. This showed up as odd blank areas around the
pixmaps included in the Text Widget in gtk-demo.
Having the clip region either as a GdkRegion or a HRGN in
GdkGCWin32 was unnecessary, it's better to just use a HRGN.
The translation and antiexpose queue handling in
gdkgeometry-win32.c seems unnecessary (and not implementable in
the same way as on X11 anyway, no serial numbers) on Windows,
ifdeffed out.
Don't (try to) do guffaw scrolling as there is no static window
gravity on Windows. Guffaw scrolling would be unnecessary anyway,
as there is the ScrollWindow() API. This improves the behaviour of
the Text Widget demo in gtk-demo a lot. But I have no idea how the
lack of static win gravity should be handled in other places where
the X11 code uses it. Especially _gdk_window_move_resize_child().
There is still some problem in expose handling. By moving an
obscuring window back and forth over testgtk's main window, for
instance, every now and then you typically get narrow vertical or
horizontal strips of pixels that haven't been properly redrawn
after being exposed. A fencepost error somewhere?
Otherwise, all of testgtk and gtk-demo except "big windows" now
seem to work pretty well.
Bug #79720 should be fixed now.
* gdk/win32/gdkcolor-win32.c (gdk_win32_color_to_string,
gdk_win32_print_paletteentries, gdk_win32_print_system_palette,
gdk_win32_print_hpalette)
* gdk/win32/gdkdrawable-win32.c (gdk_win32_drawable_description)
* gdk/win32/gdkevents-win32.c (gdk_win32_message_name):
Move all debugging helper functions to gdkmain-win32.c.
* gdk/win32/gdkdrawable-win32.c (_gdk_win32_draw_tiles):
Rewrite. Make static. Must take tile origin parameters, too.
(gdk_win32_draw_rectangle): Pass the tile/stipple origin to
_gdk_win32_draw_tiles(). Remove #if 0 code.
(blit_inside_window): Don't call ScrollDC(), that didn't work at
all like I thought. A simple call to BitBlt() is enough.
* gdk/win32/gdkevents-win32.c (gdk_event_translate) Remove unused
latin_locale_loaded variable.
(_gdk_win32_get_next_tick): New function. Used to make sure
timestamps of events are always increasing, both in events
generated from the window procedure and in events gotten via
PeekMessage(). Not sure whether this is actually useful, but it
seemed as a good idea.
(real_window_procedure): Don't use a local GdkEventPrivate
variable. Don't attempt any compression of configure or expose
events here, handled elsewhere.
(erase_background): Accumulate window offsets when traversing up
the parent chain for GDK_PARENT_RELATIVE_BG, in order to get
correct alignment of background pixmaps. Don't fill with
BLACK_BRUSH if GDK_NO_BG.
(gdk_event_get_graphics_expose): A bit more verbose debugging output.
(gdk_event_translate): Use _gdk_win32_get_next_tick(). In the
WM_PAINT handler, don't check for empty update rect. When we get a
WM_PAINT, the update region isn't empty. And if it for some
strange reason is, that will be handled later anyway. Call
GetUpdateRgn() before calling BeginPaint() and EndPaint() (which
empty the update region).
* gdk/win32/gdkdnd-win32.c
* gdk/win32/gdkinput-win32.c:
Use _gdk_win32_get_next_tick().
* gdk/win32/gdkfont-win32.c: Use %p to print HFONTs.
(gdk_text_size): Remove, unused.
* gdk/win32/gdkgc-win32.c: Set clip origins to zero
when appropriate.
(gdk_gc_copy): Increase refcount on colormap if present.
(gdk_win32_hdc_get): Handle just hcliprgn. If we have a stipple,
combine it with clip region after selecting into the DC.
(_gdk_win32_bitmap_to_hrgn): Rename from _gdk_win32_bitmap_to_region.
(_gdk_win3_gdkregion_to_hrgn): New function, code snippet
extracted from gdk_win32_hdc_get().
* gdk/win32/gdkgeometry-win32.c: Ifdef out the translate_queue
handling.
(gdk_window_copy_area_scroll): Increase clipRect to avoid
ScrollWindowEx() not scrolling pixels it thinks are invalid.
Scroll also children with the ScrollWindowEx() call. No need to
call gdk_window_move() on the children.
(gdk_window_scroll): Don't do guffaw scrolling.
(gdk_window_compute_position): Fix typo, used win32_y where x was
intended.
(gdk_window_premove, gdk_window_postmove,
gdk_window_clip_changed): Add debugging output.
(_gdk_windowing_window_queue_antiexpose): Just call ValidateRgn()
on the region.
(_gdk_window_process_expose): No use for the serial number
parameter now. Instead of a rectangle, take a region parameter, as
Windows gives us one in WM_PAINT.
* gdk/win32/gdkmain-win32.c (_gdk_win32_lbstyle_to_string,
_gdk_win32_pstype_to_string, _gdk_win32_psstyle_to_string,
_gdk_win32_psendcap_to_string, _gdk_win32_psjoin_to_string,
_gdk_win32_rect_to_string, _gdk_win32_gdkrectangle_to_string,
_gdk_win32_gdkregion_to_string): New debugging functions.
(static_printf): Helper function for the above. sprintfs into a
static circular buffer, return value should be used "soon".
* gdk/win32/gdkwindow-win32.c (gdk_propagate_shapes): Plug memory
leak, free list after use.
(gdk_window_gravity_works): Remove, we know that there is no such
thing on Windows.
(gdk_window_set_static_bit_gravity,
gdk_window_set_static_win_gravity): Ditto, remove, they didn't do
anything anyway.
(_gdk_windowing_window_init, gdk_window_foreign_new): Call
_gdk_window_init_position() like in the X11 backend.
(gdk_window_reparent): Don't call the now nonexistent
gdk_window_set_static_win_gravity(). No idea what should be done
instead.
(gdk_window_get_geometry): The returned x and y should be relative
to parent. Used to be always zero..
(gdk_window_set_static_gravities): Return FALSE if trying to set
static gravity.
* gdk/win32/gdkprivate-win32.h: Drop the clip_region field from
GdkGCWin32. Only use the HRGN hcliprgn. Declare new
functions.
* gdk/win32/*.c: Use new debugging functions.
* gdk/win32/rc/gdk.rc.in: Update copyright year.
2002-11-12 22:17:48 +00:00
|
|
|
_gdk_windowing_window_get_pointer (GdkDisplay *display,
|
|
|
|
GdkWindow *window,
|
2001-07-05 13:41:34 +00:00
|
|
|
gint *x,
|
|
|
|
gint *y,
|
|
|
|
GdkModifierType *mask)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
GdkWindow *return_val;
|
2002-01-11 23:56:28 +00:00
|
|
|
POINT screen_point, point;
|
1999-11-11 22:12:27 +00:00
|
|
|
HWND hwnd, hwndc;
|
2002-10-07 19:42:49 +00:00
|
|
|
BYTE kbd[256];
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (window == NULL || GDK_IS_WINDOW (window), NULL);
|
|
|
|
|
|
|
|
return_val = NULL;
|
2002-01-11 23:56:28 +00:00
|
|
|
GetCursorPos (&screen_point);
|
|
|
|
point = screen_point;
|
2000-07-25 17:31:05 +00:00
|
|
|
ScreenToClient (GDK_WINDOW_HWND (window), &point);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2002-10-07 19:42:49 +00:00
|
|
|
*x = point.x;
|
|
|
|
*y = point.y;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2005-03-16 02:21:14 +00:00
|
|
|
if (window == _gdk_root)
|
2003-08-08 07:16:16 +00:00
|
|
|
{
|
|
|
|
*x += _gdk_offset_x;
|
|
|
|
*y += _gdk_offset_y;
|
|
|
|
}
|
|
|
|
|
2003-07-01 11:14:46 +00:00
|
|
|
hwnd = WindowFromPoint (screen_point);
|
2002-01-11 23:56:28 +00:00
|
|
|
if (hwnd != NULL)
|
|
|
|
{
|
|
|
|
gboolean done = FALSE;
|
|
|
|
|
|
|
|
while (!done)
|
|
|
|
{
|
|
|
|
point = screen_point;
|
|
|
|
ScreenToClient (hwnd, &point);
|
|
|
|
hwndc = ChildWindowFromPoint (hwnd, point);
|
|
|
|
if (hwndc == NULL)
|
|
|
|
done = TRUE;
|
|
|
|
else if (hwndc == hwnd)
|
|
|
|
done = TRUE;
|
|
|
|
else
|
|
|
|
hwnd = hwndc;
|
|
|
|
}
|
|
|
|
|
2002-02-10 13:18:51 +00:00
|
|
|
return_val = gdk_window_lookup ((GdkNativeWindow) hwnd);
|
2002-01-11 23:56:28 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
return_val = NULL;
|
|
|
|
|
2002-10-07 19:42:49 +00:00
|
|
|
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;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
return return_val;
|
|
|
|
}
|
|
|
|
|
2002-10-07 19:42:49 +00:00
|
|
|
void
|
|
|
|
_gdk_windowing_get_pointer (GdkDisplay *display,
|
|
|
|
GdkScreen **screen,
|
|
|
|
gint *x,
|
|
|
|
gint *y,
|
|
|
|
GdkModifierType *mask)
|
|
|
|
{
|
2005-11-02 13:33:27 +00:00
|
|
|
g_return_if_fail (display == _gdk_display);
|
2002-10-07 19:42:49 +00:00
|
|
|
|
2005-11-02 13:33:27 +00:00
|
|
|
*screen = _gdk_screen;
|
|
|
|
_gdk_windowing_window_get_pointer (_gdk_display, _gdk_root, x, y, mask);
|
2002-10-07 19:42:49 +00:00
|
|
|
}
|
|
|
|
|
2005-01-18 20:59:31 +00:00
|
|
|
void
|
|
|
|
gdk_display_warp_pointer (GdkDisplay *display,
|
|
|
|
GdkScreen *screen,
|
|
|
|
gint x,
|
|
|
|
gint y)
|
|
|
|
{
|
2005-11-02 13:33:27 +00:00
|
|
|
g_return_if_fail (display == _gdk_display);
|
|
|
|
g_return_if_fail (screen == _gdk_screen);
|
|
|
|
|
|
|
|
SetCursorPos (x - _gdk_offset_x, y - _gdk_offset_y);
|
2005-01-18 20:59:31 +00:00
|
|
|
}
|
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
GdkWindow*
|
2002-10-07 19:42:49 +00:00
|
|
|
_gdk_windowing_window_at_pointer (GdkDisplay *display,
|
|
|
|
gint *win_x,
|
|
|
|
gint *win_y)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
GdkWindow *window;
|
|
|
|
POINT point, pointc;
|
|
|
|
HWND hwnd, hwndc;
|
|
|
|
RECT rect;
|
|
|
|
|
|
|
|
GetCursorPos (&pointc);
|
|
|
|
point = pointc;
|
|
|
|
hwnd = WindowFromPoint (point);
|
|
|
|
|
|
|
|
if (hwnd == NULL)
|
|
|
|
{
|
2005-03-16 02:21:14 +00:00
|
|
|
window = _gdk_root;
|
2003-08-08 07:16:16 +00:00
|
|
|
*win_x = pointc.x + _gdk_offset_x;
|
|
|
|
*win_y = pointc.y + _gdk_offset_y;
|
1999-11-11 22:12:27 +00:00
|
|
|
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);
|
2002-10-07 19:42:49 +00:00
|
|
|
*win_x = point.x - rect.left;
|
|
|
|
*win_y = point.y - rect.top;
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
2005-03-16 01:38:57 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("_gdk_windowing_window_at_pointer: %+d%+d %p%s\n",
|
2003-08-08 07:16:16 +00:00
|
|
|
*win_x, *win_y,
|
Massive changes. Too many to list here, but I'll try a summary:
2002-02-17 Tor Lillqvist <tml@iki.fi>
* gdk/win32/*.c: Massive changes. Too many to list here, but I'll
try a summary:
1) Unify GdkPixmap and GdkImage implementation: For each
GdkPixmap, allocate a GdkImage, and vice versa.
GdkPixmapImplWin32Data has a pointer to the GdkImage.
GdkImage::windowing_data is a pointer to the GdkPixmap.
This simplifies many pixmap and image related functions a lot, and
reduces duplicated code snippets. For instance, there is only one
place in gdk/win32 where CreateDIBSection() is called, in the
function _gdk_win32_new_pixmap(). Converting a bitmap (GdkPixmap)
to a Windows region is almost trivial, with the bitmap bits being
readily accessible in the associated GdkImage.
All blitting between GdkPixmaps, GdkWindows and GdkImages goes
through handled the _gdk_win32_blit() function, which calls
different functions to handle the cases of blitting from pixmaps,
inside windows (scrolling), or from windows, which all require
somewhat different handling.
2) Support 256-color mode. This has long been very broken, now it
works more or less OK. Keep the logical palette for each colormap
as small as possible while allocating and freeing colors. Select
and realize the logical palette associated with a GdkColormap into
a DC before drawing or blitting.
When the display is in 256-color mode, make it possible for the
user to override the size of the palette(s) used with either the
GDK_WIN32_MAX_COLORS environment variable, or a -max-colors
command line option. It is possible to reduce the palette size all
the way down to using just the 16 static colors (which causes the
system visual to be of type GDK_VISUAL_STATIC_COLOR. This could
possibly be useful if one desperately wants to avoid color
flashing. (Note that in order for this to work properly, an as of
yet not commited fix to gdkrgb.c is needed.)
Handle the palette messages. On WM_PALETTECHANGED, call
UpdateColors() for the given window hierarchy. Do this only if a
window in some other top-level window hierarchy caused the palette
change (realized a palette). Do this max five times in a row (an
arbitrarily chosen limit), though, otherwise redraw by generating
expose events. On WM_QUERYNEWPALETTE, cause a redraw of the whole
window hierarchy by generating GDK_EXPOSE events.
3) Code cleanup in general. For instance, remove the "emulated"
X11 structs ColormapStruct, Visual and XStandardColormap. Use the
new GDK_DEBUG_* flags for debugging output in the relevant source
files. Remove the unused colormap hash table in gdkcolor-win32.c
4) Plug some resource leaks.
2002-02-14 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkdnd-win32.c (gdk_dropfiles_filter): Use
g_filename_to_uri() to actually create legal URIs in the
text/uri-list data.
2002-02-17 00:25:05 +00:00
|
|
|
hwnd,
|
1999-11-11 22:12:27 +00:00
|
|
|
(window == NULL ? " NULL" : "")));
|
|
|
|
|
|
|
|
return window;
|
|
|
|
}
|
|
|
|
|
|
|
|
GdkEventMask
|
|
|
|
gdk_window_get_events (GdkWindow *window)
|
|
|
|
{
|
|
|
|
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;
|
|
|
|
|
Remove the event_mask, it is now in GdkWindowObject.
2002-03-01 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkwindow-win32.h (struct _GdkWindowImplWin32): Remove
the event_mask, it is now in GdkWindowObject.
* gdk/win32/gdkwindow-win32.c: Change accordingly. Set the
GDK_STRUCTURE_MASK in gdk_window_set_events(), as it is always set
in gdk_window_new(), too. (Bug#72921)
* gdk/win32/gdkevents-win32.c: Change accordingly here, too.
(vk_from_char): New function, calculates the virtual keycode
corresponding to the char in a WM_CHAR message.
(build_keypress_event, build_keyrelease_event): Use it.
(build_keypress_event): Call ImmReleaseContext() after using the
input context. This might plug a memory or resource leak.
(build_key_event_state): Remove #if 0 code.
(gdk_event_translate): Actually, it would be preferrable to always
handle just the WM_KEYDOWN and WM_KEYUP messages, not WM_CHAR at
all, and thus drop the contorted logic with ignore_wm_char etc.
* gdk/win32/gdkkeys-win32.c: (gdk_keymap_get_entries_for_keyval):
Debugging output.
(gdk_keymap_translate_keyboard_state): Return correct value. (But
_gtk_key_hash_lookup() doesn't check the return value...)
2002-02-28 23:38:55 +00:00
|
|
|
return GDK_WINDOW_OBJECT (window)->event_mask;
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_set_events (GdkWindow *window,
|
|
|
|
GdkEventMask event_mask)
|
|
|
|
{
|
|
|
|
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;
|
|
|
|
|
Remove the event_mask, it is now in GdkWindowObject.
2002-03-01 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkwindow-win32.h (struct _GdkWindowImplWin32): Remove
the event_mask, it is now in GdkWindowObject.
* gdk/win32/gdkwindow-win32.c: Change accordingly. Set the
GDK_STRUCTURE_MASK in gdk_window_set_events(), as it is always set
in gdk_window_new(), too. (Bug#72921)
* gdk/win32/gdkevents-win32.c: Change accordingly here, too.
(vk_from_char): New function, calculates the virtual keycode
corresponding to the char in a WM_CHAR message.
(build_keypress_event, build_keyrelease_event): Use it.
(build_keypress_event): Call ImmReleaseContext() after using the
input context. This might plug a memory or resource leak.
(build_key_event_state): Remove #if 0 code.
(gdk_event_translate): Actually, it would be preferrable to always
handle just the WM_KEYDOWN and WM_KEYUP messages, not WM_CHAR at
all, and thus drop the contorted logic with ignore_wm_char etc.
* gdk/win32/gdkkeys-win32.c: (gdk_keymap_get_entries_for_keyval):
Debugging output.
(gdk_keymap_translate_keyboard_state): Return correct value. (But
_gtk_key_hash_lookup() doesn't check the return value...)
2002-02-28 23:38:55 +00:00
|
|
|
/* gdk_window_new() always sets the GDK_STRUCTURE_MASK, so better
|
|
|
|
* set it here, too. Not that I know or remember why it is
|
|
|
|
* necessary, will have to test some day.
|
|
|
|
*/
|
|
|
|
GDK_WINDOW_OBJECT (window)->event_mask = GDK_STRUCTURE_MASK | event_mask;
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
2006-02-20 10:08:37 +00:00
|
|
|
static void
|
|
|
|
do_shape_combine_region (GdkWindow *window,
|
|
|
|
HRGN hrgn,
|
|
|
|
gint x, gint y)
|
|
|
|
{
|
|
|
|
RECT rect;
|
|
|
|
|
|
|
|
GetClientRect (GDK_WINDOW_HWND (window), &rect);
|
|
|
|
_gdk_win32_adjust_client_rect (window, &rect);
|
|
|
|
|
|
|
|
OffsetRgn (hrgn, -rect.left, -rect.top);
|
|
|
|
OffsetRgn (hrgn, x, y);
|
|
|
|
|
|
|
|
/* If this is a top-level window, add the title bar to the region */
|
|
|
|
if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_TOPLEVEL)
|
|
|
|
{
|
|
|
|
HRGN tmp = CreateRectRgn (0, 0, rect.right - rect.left, -rect.top);
|
|
|
|
CombineRgn (hrgn, hrgn, tmp, RGN_OR);
|
|
|
|
DeleteObject (tmp);
|
|
|
|
}
|
|
|
|
|
|
|
|
SetWindowRgn (GDK_WINDOW_HWND (window), hrgn, TRUE);
|
|
|
|
}
|
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
void
|
|
|
|
gdk_window_shape_combine_mask (GdkWindow *window,
|
|
|
|
GdkBitmap *mask,
|
|
|
|
gint x, gint y)
|
|
|
|
{
|
2005-09-26 20:59:31 +00:00
|
|
|
GdkWindowObject *private = (GdkWindowObject *)window;
|
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
|
|
|
if (!mask)
|
|
|
|
{
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_shape_combine_mask: %p: none\n",
|
Massive changes. Too many to list here, but I'll try a summary:
2002-02-17 Tor Lillqvist <tml@iki.fi>
* gdk/win32/*.c: Massive changes. Too many to list here, but I'll
try a summary:
1) Unify GdkPixmap and GdkImage implementation: For each
GdkPixmap, allocate a GdkImage, and vice versa.
GdkPixmapImplWin32Data has a pointer to the GdkImage.
GdkImage::windowing_data is a pointer to the GdkPixmap.
This simplifies many pixmap and image related functions a lot, and
reduces duplicated code snippets. For instance, there is only one
place in gdk/win32 where CreateDIBSection() is called, in the
function _gdk_win32_new_pixmap(). Converting a bitmap (GdkPixmap)
to a Windows region is almost trivial, with the bitmap bits being
readily accessible in the associated GdkImage.
All blitting between GdkPixmaps, GdkWindows and GdkImages goes
through handled the _gdk_win32_blit() function, which calls
different functions to handle the cases of blitting from pixmaps,
inside windows (scrolling), or from windows, which all require
somewhat different handling.
2) Support 256-color mode. This has long been very broken, now it
works more or less OK. Keep the logical palette for each colormap
as small as possible while allocating and freeing colors. Select
and realize the logical palette associated with a GdkColormap into
a DC before drawing or blitting.
When the display is in 256-color mode, make it possible for the
user to override the size of the palette(s) used with either the
GDK_WIN32_MAX_COLORS environment variable, or a -max-colors
command line option. It is possible to reduce the palette size all
the way down to using just the 16 static colors (which causes the
system visual to be of type GDK_VISUAL_STATIC_COLOR. This could
possibly be useful if one desperately wants to avoid color
flashing. (Note that in order for this to work properly, an as of
yet not commited fix to gdkrgb.c is needed.)
Handle the palette messages. On WM_PALETTECHANGED, call
UpdateColors() for the given window hierarchy. Do this only if a
window in some other top-level window hierarchy caused the palette
change (realized a palette). Do this max five times in a row (an
arbitrarily chosen limit), though, otherwise redraw by generating
expose events. On WM_QUERYNEWPALETTE, cause a redraw of the whole
window hierarchy by generating GDK_EXPOSE events.
3) Code cleanup in general. For instance, remove the "emulated"
X11 structs ColormapStruct, Visual and XStandardColormap. Use the
new GDK_DEBUG_* flags for debugging output in the relevant source
files. Remove the unused colormap hash table in gdkcolor-win32.c
4) Plug some resource leaks.
2002-02-14 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkdnd-win32.c (gdk_dropfiles_filter): Use
g_filename_to_uri() to actually create legal URIs in the
text/uri-list data.
2002-02-17 00:25:05 +00:00
|
|
|
GDK_WINDOW_HWND (window)));
|
2000-07-25 17:31:05 +00:00
|
|
|
SetWindowRgn (GDK_WINDOW_HWND (window), NULL, TRUE);
|
2005-09-26 20:59:31 +00:00
|
|
|
|
|
|
|
private->shaped = FALSE;
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
HRGN hrgn;
|
|
|
|
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_shape_combine_mask: %p: %p\n",
|
Massive changes. Too many to list here, but I'll try a summary:
2002-02-17 Tor Lillqvist <tml@iki.fi>
* gdk/win32/*.c: Massive changes. Too many to list here, but I'll
try a summary:
1) Unify GdkPixmap and GdkImage implementation: For each
GdkPixmap, allocate a GdkImage, and vice versa.
GdkPixmapImplWin32Data has a pointer to the GdkImage.
GdkImage::windowing_data is a pointer to the GdkPixmap.
This simplifies many pixmap and image related functions a lot, and
reduces duplicated code snippets. For instance, there is only one
place in gdk/win32 where CreateDIBSection() is called, in the
function _gdk_win32_new_pixmap(). Converting a bitmap (GdkPixmap)
to a Windows region is almost trivial, with the bitmap bits being
readily accessible in the associated GdkImage.
All blitting between GdkPixmaps, GdkWindows and GdkImages goes
through handled the _gdk_win32_blit() function, which calls
different functions to handle the cases of blitting from pixmaps,
inside windows (scrolling), or from windows, which all require
somewhat different handling.
2) Support 256-color mode. This has long been very broken, now it
works more or less OK. Keep the logical palette for each colormap
as small as possible while allocating and freeing colors. Select
and realize the logical palette associated with a GdkColormap into
a DC before drawing or blitting.
When the display is in 256-color mode, make it possible for the
user to override the size of the palette(s) used with either the
GDK_WIN32_MAX_COLORS environment variable, or a -max-colors
command line option. It is possible to reduce the palette size all
the way down to using just the 16 static colors (which causes the
system visual to be of type GDK_VISUAL_STATIC_COLOR. This could
possibly be useful if one desperately wants to avoid color
flashing. (Note that in order for this to work properly, an as of
yet not commited fix to gdkrgb.c is needed.)
Handle the palette messages. On WM_PALETTECHANGED, call
UpdateColors() for the given window hierarchy. Do this only if a
window in some other top-level window hierarchy caused the palette
change (realized a palette). Do this max five times in a row (an
arbitrarily chosen limit), though, otherwise redraw by generating
expose events. On WM_QUERYNEWPALETTE, cause a redraw of the whole
window hierarchy by generating GDK_EXPOSE events.
3) Code cleanup in general. For instance, remove the "emulated"
X11 structs ColormapStruct, Visual and XStandardColormap. Use the
new GDK_DEBUG_* flags for debugging output in the relevant source
files. Remove the unused colormap hash table in gdkcolor-win32.c
4) Plug some resource leaks.
2002-02-14 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkdnd-win32.c (gdk_dropfiles_filter): Use
g_filename_to_uri() to actually create legal URIs in the
text/uri-list data.
2002-02-17 00:25:05 +00:00
|
|
|
GDK_WINDOW_HWND (window),
|
|
|
|
GDK_WINDOW_HWND (mask)));
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2006-02-20 10:08:37 +00:00
|
|
|
/* Convert mask bitmap to region */
|
|
|
|
hrgn = _gdk_win32_bitmap_to_hrgn (mask);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2006-02-20 10:08:37 +00:00
|
|
|
do_shape_combine_region (window, hrgn, x, y);
|
2005-09-26 20:59:31 +00:00
|
|
|
|
|
|
|
private->shaped = TRUE;
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-02-20 10:08:37 +00:00
|
|
|
void
|
|
|
|
gdk_window_input_shape_combine_mask (GdkWindow *window,
|
|
|
|
GdkBitmap *mask,
|
|
|
|
gint x,
|
|
|
|
gint y)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
|
|
|
/* Not yet implemented
|
|
|
|
*
|
|
|
|
* I don't think there is anything in the Win32 API to directly
|
|
|
|
* support this. And anyway, as we don't currently support RGBA
|
|
|
|
* windows, it doesn't really matter.
|
|
|
|
*
|
|
|
|
* When we do support RGBA, input shape functionality could probably
|
|
|
|
* be implemented by saving the input shape region in the per-window
|
|
|
|
* private data, and then simply checking before generating an input
|
|
|
|
* event whether the event's coordinates are inside the region.
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
void
|
|
|
|
gdk_window_set_override_redirect (GdkWindow *window,
|
|
|
|
gboolean override_redirect)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
|
|
|
g_warning ("gdk_window_set_override_redirect not implemented");
|
|
|
|
}
|
|
|
|
|
2003-12-10 23:58:23 +00:00
|
|
|
void
|
|
|
|
gdk_window_set_accept_focus (GdkWindow *window,
|
|
|
|
gboolean accept_focus)
|
|
|
|
{
|
|
|
|
GdkWindowObject *private;
|
2005-11-02 13:33:27 +00:00
|
|
|
|
2003-12-10 23:58:23 +00:00
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
|
|
|
private = (GdkWindowObject *)window;
|
|
|
|
|
|
|
|
accept_focus = accept_focus != FALSE;
|
|
|
|
|
|
|
|
if (private->accept_focus != accept_focus)
|
|
|
|
private->accept_focus = accept_focus;
|
|
|
|
}
|
|
|
|
|
2004-05-06 02:57:01 +00:00
|
|
|
void
|
|
|
|
gdk_window_set_focus_on_map (GdkWindow *window,
|
|
|
|
gboolean focus_on_map)
|
|
|
|
{
|
|
|
|
GdkWindowObject *private;
|
2005-11-02 13:33:27 +00:00
|
|
|
|
2004-05-06 02:57:01 +00:00
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
|
|
|
private = (GdkWindowObject *)window;
|
|
|
|
|
|
|
|
focus_on_map = focus_on_map != FALSE;
|
|
|
|
|
|
|
|
if (private->focus_on_map != focus_on_map)
|
|
|
|
private->focus_on_map = focus_on_map;
|
|
|
|
}
|
|
|
|
|
2003-12-14 01:06:56 +00:00
|
|
|
void
|
|
|
|
gdk_window_set_icon_list (GdkWindow *window,
|
|
|
|
GList *pixbufs)
|
|
|
|
{
|
|
|
|
GdkPixbuf *pixbuf, *big_pixbuf, *small_pixbuf;
|
|
|
|
gint big_diff, small_diff;
|
|
|
|
gint big_w, big_h, small_w, small_h;
|
|
|
|
gint w, h;
|
|
|
|
gint dw, dh, diff;
|
|
|
|
HICON small_hicon, big_hicon;
|
|
|
|
GdkWindowImplWin32 *impl;
|
|
|
|
gint i, big_i, small_i;
|
|
|
|
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
|
|
|
return;
|
|
|
|
|
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl);
|
|
|
|
|
|
|
|
/* ideal sizes for small and large icons */
|
|
|
|
big_w = GetSystemMetrics (SM_CXICON);
|
|
|
|
big_h = GetSystemMetrics (SM_CYICON);
|
|
|
|
small_w = GetSystemMetrics (SM_CXSMICON);
|
|
|
|
small_h = GetSystemMetrics (SM_CYSMICON);
|
|
|
|
|
|
|
|
/* find closest sized icons in the list */
|
|
|
|
big_pixbuf = NULL;
|
|
|
|
small_pixbuf = NULL;
|
|
|
|
big_diff = 0;
|
|
|
|
small_diff = 0;
|
|
|
|
i = 0;
|
|
|
|
while (pixbufs)
|
2003-08-05 22:24:35 +00:00
|
|
|
{
|
2003-12-14 01:06:56 +00:00
|
|
|
pixbuf = (GdkPixbuf*) pixbufs->data;
|
|
|
|
w = gdk_pixbuf_get_width (pixbuf);
|
|
|
|
h = gdk_pixbuf_get_height (pixbuf);
|
|
|
|
|
|
|
|
dw = ABS (w - big_w);
|
|
|
|
dh = ABS (h - big_h);
|
|
|
|
diff = dw*dw + dh*dh;
|
|
|
|
if (big_pixbuf == NULL || diff < big_diff)
|
|
|
|
{
|
|
|
|
big_pixbuf = pixbuf;
|
|
|
|
big_diff = diff;
|
|
|
|
big_i = i;
|
|
|
|
}
|
|
|
|
|
2005-11-02 13:33:27 +00:00
|
|
|
dw = ABS (w - small_w);
|
|
|
|
dh = ABS (h - small_h);
|
2003-12-14 01:06:56 +00:00
|
|
|
diff = dw*dw + dh*dh;
|
|
|
|
if (small_pixbuf == NULL || diff < small_diff)
|
|
|
|
{
|
|
|
|
small_pixbuf = pixbuf;
|
|
|
|
small_diff = diff;
|
|
|
|
small_i = i;
|
|
|
|
}
|
|
|
|
|
|
|
|
pixbufs = g_list_next (pixbufs);
|
|
|
|
i++;
|
2003-08-05 22:24:35 +00:00
|
|
|
}
|
|
|
|
|
2003-12-14 01:06:56 +00:00
|
|
|
/* Create the icons */
|
2005-06-04 21:43:03 +00:00
|
|
|
big_hicon = _gdk_win32_pixbuf_to_hicon (big_pixbuf);
|
|
|
|
small_hicon = _gdk_win32_pixbuf_to_hicon (small_pixbuf);
|
2003-12-14 01:06:56 +00:00
|
|
|
|
|
|
|
/* Set the icons */
|
2006-09-03 22:50:00 +00:00
|
|
|
SendMessageW (GDK_WINDOW_HWND (window), WM_SETICON, ICON_BIG,
|
|
|
|
(LPARAM)big_hicon);
|
|
|
|
SendMessageW (GDK_WINDOW_HWND (window), WM_SETICON, ICON_SMALL,
|
|
|
|
(LPARAM)small_hicon);
|
2003-12-14 01:06:56 +00:00
|
|
|
|
|
|
|
/* Store the icons, destroying any previous icons */
|
|
|
|
if (impl->hicon_big)
|
|
|
|
GDI_CALL (DestroyIcon, (impl->hicon_big));
|
|
|
|
impl->hicon_big = big_hicon;
|
|
|
|
if (impl->hicon_small)
|
|
|
|
GDI_CALL (DestroyIcon, (impl->hicon_small));
|
|
|
|
impl->hicon_small = small_hicon;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_set_icon (GdkWindow *window,
|
|
|
|
GdkWindow *icon_window,
|
|
|
|
GdkPixmap *pixmap,
|
|
|
|
GdkBitmap *mask)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
|
|
|
/* do nothing, use gdk_window_set_icon_list instead */
|
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
|
|
|
{
|
2007-02-26 13:48:01 +00:00
|
|
|
/* In case I manage to confuse this again (or somebody else does):
|
|
|
|
* Please note that "icon name" here really *does* mean the name or
|
|
|
|
* title of an window minimized as an icon on the desktop, or in the
|
|
|
|
* taskbar. It has nothing to do with the freedesktop.org icon
|
|
|
|
* naming stuff.
|
|
|
|
*/
|
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
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;
|
|
|
|
|
2005-11-02 13:33:27 +00:00
|
|
|
#if 0
|
|
|
|
/* This is not the correct thing to do. We should keep both the
|
|
|
|
* "normal" window title, and the icon name. When the window is
|
|
|
|
* minimized, call SetWindowText() with the icon name, and when the
|
|
|
|
* window is restored, with the normal window title. Also, the name
|
|
|
|
* is in UTF-8, so we should do the normal conversion to either wide
|
|
|
|
* chars or system codepage, and use either the W or A version of
|
|
|
|
* SetWindowText(), depending on Windows version.
|
|
|
|
*/
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
API_CALL (SetWindowText, (GDK_WINDOW_HWND (window), name));
|
2005-11-02 13:33:27 +00:00
|
|
|
#endif
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
2004-03-05 23:26:07 +00:00
|
|
|
GdkWindow *
|
|
|
|
gdk_window_get_group (GdkWindow *window)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
|
|
|
|
g_return_val_if_fail (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD, NULL);
|
|
|
|
|
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
g_warning ("gdk_window_get_group not yet implemented");
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
void
|
|
|
|
gdk_window_set_group (GdkWindow *window,
|
|
|
|
GdkWindow *leader)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
2005-11-02 13:33:27 +00:00
|
|
|
g_return_if_fail (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD);
|
|
|
|
g_return_if_fail (leader == NULL || GDK_IS_WINDOW (leader));
|
1999-11-11 22:12:27 +00:00
|
|
|
|
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");
|
|
|
|
}
|
|
|
|
|
2005-11-09 12:35:56 +00:00
|
|
|
static void
|
2006-02-09 02:58:45 +00:00
|
|
|
update_single_bit (LONG *style,
|
|
|
|
BOOL all,
|
|
|
|
int gdk_bit,
|
|
|
|
int style_bit)
|
|
|
|
{
|
|
|
|
/* all controls the interpretation of gdk_bit -- if all is true, gdk_bit
|
|
|
|
indicates whether style_bit is off; if all is false, gdk bit indicate whether
|
|
|
|
style_bit is on */
|
|
|
|
if ((!all && gdk_bit) || (all && !gdk_bit))
|
|
|
|
*style |= style_bit;
|
|
|
|
else
|
|
|
|
*style &= ~style_bit;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
update_style_bits (GdkWindow *window)
|
2005-11-09 12:35:56 +00:00
|
|
|
{
|
2006-02-09 02:58:45 +00:00
|
|
|
GdkWMDecoration decorations;
|
|
|
|
GdkWMFunction functions;
|
2005-11-09 12:35:56 +00:00
|
|
|
LONG style, exstyle;
|
2006-02-09 02:58:45 +00:00
|
|
|
BOOL all;
|
2005-11-09 12:35:56 +00:00
|
|
|
RECT rect, before, after;
|
|
|
|
|
|
|
|
style = GetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE);
|
|
|
|
exstyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_EXSTYLE);
|
|
|
|
|
|
|
|
GetClientRect (GDK_WINDOW_HWND (window), &before);
|
|
|
|
after = before;
|
|
|
|
AdjustWindowRectEx (&before, style, FALSE, exstyle);
|
|
|
|
|
2006-02-09 02:58:45 +00:00
|
|
|
if (get_effective_window_decorations (window, &decorations))
|
|
|
|
{
|
|
|
|
all = (decorations & GDK_DECOR_ALL);
|
|
|
|
update_single_bit (&style, all, decorations & GDK_DECOR_BORDER, WS_BORDER);
|
|
|
|
update_single_bit (&style, all, decorations & GDK_DECOR_RESIZEH, WS_THICKFRAME);
|
|
|
|
update_single_bit (&style, all, decorations & GDK_DECOR_TITLE, WS_CAPTION);
|
|
|
|
update_single_bit (&style, all, decorations & GDK_DECOR_MENU, WS_SYSMENU);
|
|
|
|
update_single_bit (&style, all, decorations & GDK_DECOR_MINIMIZE, WS_MINIMIZEBOX);
|
|
|
|
update_single_bit (&style, all, decorations & GDK_DECOR_MAXIMIZE, WS_MAXIMIZEBOX);
|
|
|
|
}
|
2005-11-09 12:35:56 +00:00
|
|
|
|
2006-02-09 02:58:45 +00:00
|
|
|
/* XXX this is actually incorrect. The menu entries should be added or removed
|
|
|
|
from the system menu without affecting the window style. */
|
|
|
|
if (_gdk_window_get_functions (window, &functions))
|
|
|
|
{
|
|
|
|
all = (functions & GDK_DECOR_ALL);
|
|
|
|
update_single_bit (&style, all, functions & GDK_FUNC_RESIZE, WS_THICKFRAME);
|
|
|
|
update_single_bit (&style, all, functions & GDK_FUNC_MOVE, WS_THICKFRAME | WS_SYSMENU);
|
|
|
|
update_single_bit (&style, all, functions & GDK_FUNC_MINIMIZE, WS_MINIMIZE);
|
|
|
|
update_single_bit (&style, all, functions & GDK_FUNC_MOVE, WS_MAXIMIZE);
|
|
|
|
update_single_bit (&style, all, functions & GDK_FUNC_CLOSE, WS_SYSMENU);
|
|
|
|
}
|
|
|
|
|
2005-11-09 12:35:56 +00:00
|
|
|
SetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE, style);
|
|
|
|
|
|
|
|
AdjustWindowRectEx (&after, style, FALSE, exstyle);
|
|
|
|
|
|
|
|
GetWindowRect (GDK_WINDOW_HWND (window), &rect);
|
|
|
|
rect.left += after.left - before.left;
|
|
|
|
rect.top += after.top - before.top;
|
|
|
|
rect.right += after.right - before.right;
|
|
|
|
rect.bottom += after.bottom - before.bottom;
|
|
|
|
|
|
|
|
SetWindowPos (GDK_WINDOW_HWND (window), NULL,
|
|
|
|
rect.left, rect.top,
|
|
|
|
rect.right - rect.left, rect.bottom - rect.top,
|
|
|
|
SWP_FRAMECHANGED | SWP_NOACTIVATE |
|
|
|
|
SWP_NOREPOSITION | SWP_NOZORDER);
|
|
|
|
}
|
|
|
|
|
2006-02-09 02:58:45 +00:00
|
|
|
static GQuark
|
|
|
|
get_decorations_quark ()
|
|
|
|
{
|
|
|
|
static GQuark quark = 0;
|
|
|
|
|
|
|
|
if (!quark)
|
|
|
|
quark = g_quark_from_static_string ("gdk-window-decorations");
|
|
|
|
|
|
|
|
return quark;
|
|
|
|
}
|
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
void
|
|
|
|
gdk_window_set_decorations (GdkWindow *window,
|
|
|
|
GdkWMDecoration decorations)
|
|
|
|
{
|
2006-02-09 02:58:45 +00:00
|
|
|
GdkWMDecoration* decorations_copy;
|
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
2005-11-09 12:35:56 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_set_decorations: %p: %s %s%s%s%s%s%s\n",
|
2002-10-28 20:48:40 +00:00
|
|
|
GDK_WINDOW_HWND (window),
|
2005-11-09 12:35:56 +00:00
|
|
|
(decorations & GDK_DECOR_ALL ? "clearing" : "setting"),
|
2002-10-28 20:48:40 +00:00
|
|
|
(decorations & GDK_DECOR_BORDER ? "BORDER " : ""),
|
|
|
|
(decorations & GDK_DECOR_RESIZEH ? "RESIZEH " : ""),
|
|
|
|
(decorations & GDK_DECOR_TITLE ? "TITLE " : ""),
|
|
|
|
(decorations & GDK_DECOR_MENU ? "MENU " : ""),
|
|
|
|
(decorations & GDK_DECOR_MINIMIZE ? "MINIMIZE " : ""),
|
|
|
|
(decorations & GDK_DECOR_MAXIMIZE ? "MAXIMIZE " : "")));
|
|
|
|
|
2006-02-09 02:58:45 +00:00
|
|
|
decorations_copy = g_malloc (sizeof (GdkWMDecoration));
|
|
|
|
*decorations_copy = decorations;
|
|
|
|
g_object_set_qdata_full (G_OBJECT (window), get_decorations_quark (), decorations_copy, g_free);
|
Move the code that sets the window style and extended window style, and
2002-12-21 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkwindow-win32.c (gdk_window_new): Move the code that
sets the window style and extended window style, and adjusts the
width and height to take the window decorations into account
earlier. The adjusted width and height used to be ignored. Remove
the local x, y, width and height variables, no need to further
confuse the code by having local copies. (Partial fix, I hope, for
#101588)
(gdk_window_move): When moving top-level windows, take title bar
and border width into account, offsetting the coordinates before
calling SetWindowPos().
(gdk_window_set_decorations, gdk_window_set_functions):
Reimplement, taking into account the peculiar semantics of
GDK_DECOR_ALL and GDK_FUNC_ALL. (#79036)
(gdk_window_get_decorations): Implement. (#98981)
(gdk_window_set_type_hint): When setting
GDK_WINDOW_TYPE_HINT_MENU, call gdk_window_set_decorations().
(#79036)
* gdk/gdk.def: Add gdk_window_get_decorations. (#98981)
2002-12-21 23:32:20 +00:00
|
|
|
|
2006-02-09 02:58:45 +00:00
|
|
|
update_style_bits (window);
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
Move the code that sets the window style and extended window style, and
2002-12-21 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkwindow-win32.c (gdk_window_new): Move the code that
sets the window style and extended window style, and adjusts the
width and height to take the window decorations into account
earlier. The adjusted width and height used to be ignored. Remove
the local x, y, width and height variables, no need to further
confuse the code by having local copies. (Partial fix, I hope, for
#101588)
(gdk_window_move): When moving top-level windows, take title bar
and border width into account, offsetting the coordinates before
calling SetWindowPos().
(gdk_window_set_decorations, gdk_window_set_functions):
Reimplement, taking into account the peculiar semantics of
GDK_DECOR_ALL and GDK_FUNC_ALL. (#79036)
(gdk_window_get_decorations): Implement. (#98981)
(gdk_window_set_type_hint): When setting
GDK_WINDOW_TYPE_HINT_MENU, call gdk_window_set_decorations().
(#79036)
* gdk/gdk.def: Add gdk_window_get_decorations. (#98981)
2002-12-21 23:32:20 +00:00
|
|
|
gboolean
|
2005-11-02 13:33:27 +00:00
|
|
|
gdk_window_get_decorations (GdkWindow *window,
|
|
|
|
GdkWMDecoration *decorations)
|
Move the code that sets the window style and extended window style, and
2002-12-21 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkwindow-win32.c (gdk_window_new): Move the code that
sets the window style and extended window style, and adjusts the
width and height to take the window decorations into account
earlier. The adjusted width and height used to be ignored. Remove
the local x, y, width and height variables, no need to further
confuse the code by having local copies. (Partial fix, I hope, for
#101588)
(gdk_window_move): When moving top-level windows, take title bar
and border width into account, offsetting the coordinates before
calling SetWindowPos().
(gdk_window_set_decorations, gdk_window_set_functions):
Reimplement, taking into account the peculiar semantics of
GDK_DECOR_ALL and GDK_FUNC_ALL. (#79036)
(gdk_window_get_decorations): Implement. (#98981)
(gdk_window_set_type_hint): When setting
GDK_WINDOW_TYPE_HINT_MENU, call gdk_window_set_decorations().
(#79036)
* gdk/gdk.def: Add gdk_window_get_decorations. (#98981)
2002-12-21 23:32:20 +00:00
|
|
|
{
|
2006-02-09 02:58:45 +00:00
|
|
|
GdkWMDecoration* decorations_set;
|
|
|
|
|
2005-11-02 13:33:27 +00:00
|
|
|
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
|
|
|
|
|
2006-02-09 02:58:45 +00:00
|
|
|
decorations_set = g_object_get_qdata (G_OBJECT (window), get_decorations_quark ());
|
|
|
|
if (decorations_set)
|
|
|
|
*decorations = *decorations_set;
|
Move the code that sets the window style and extended window style, and
2002-12-21 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkwindow-win32.c (gdk_window_new): Move the code that
sets the window style and extended window style, and adjusts the
width and height to take the window decorations into account
earlier. The adjusted width and height used to be ignored. Remove
the local x, y, width and height variables, no need to further
confuse the code by having local copies. (Partial fix, I hope, for
#101588)
(gdk_window_move): When moving top-level windows, take title bar
and border width into account, offsetting the coordinates before
calling SetWindowPos().
(gdk_window_set_decorations, gdk_window_set_functions):
Reimplement, taking into account the peculiar semantics of
GDK_DECOR_ALL and GDK_FUNC_ALL. (#79036)
(gdk_window_get_decorations): Implement. (#98981)
(gdk_window_set_type_hint): When setting
GDK_WINDOW_TYPE_HINT_MENU, call gdk_window_set_decorations().
(#79036)
* gdk/gdk.def: Add gdk_window_get_decorations. (#98981)
2002-12-21 23:32:20 +00:00
|
|
|
|
2006-02-09 02:58:45 +00:00
|
|
|
return (decorations_set != NULL);
|
|
|
|
}
|
Move the code that sets the window style and extended window style, and
2002-12-21 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkwindow-win32.c (gdk_window_new): Move the code that
sets the window style and extended window style, and adjusts the
width and height to take the window decorations into account
earlier. The adjusted width and height used to be ignored. Remove
the local x, y, width and height variables, no need to further
confuse the code by having local copies. (Partial fix, I hope, for
#101588)
(gdk_window_move): When moving top-level windows, take title bar
and border width into account, offsetting the coordinates before
calling SetWindowPos().
(gdk_window_set_decorations, gdk_window_set_functions):
Reimplement, taking into account the peculiar semantics of
GDK_DECOR_ALL and GDK_FUNC_ALL. (#79036)
(gdk_window_get_decorations): Implement. (#98981)
(gdk_window_set_type_hint): When setting
GDK_WINDOW_TYPE_HINT_MENU, call gdk_window_set_decorations().
(#79036)
* gdk/gdk.def: Add gdk_window_get_decorations. (#98981)
2002-12-21 23:32:20 +00:00
|
|
|
|
2006-02-09 02:58:45 +00:00
|
|
|
static GQuark
|
|
|
|
get_functions_quark ()
|
|
|
|
{
|
|
|
|
static GQuark quark = 0;
|
|
|
|
|
|
|
|
if (!quark)
|
|
|
|
quark = g_quark_from_static_string ("gdk-window-functions");
|
|
|
|
|
|
|
|
return quark;
|
Move the code that sets the window style and extended window style, and
2002-12-21 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkwindow-win32.c (gdk_window_new): Move the code that
sets the window style and extended window style, and adjusts the
width and height to take the window decorations into account
earlier. The adjusted width and height used to be ignored. Remove
the local x, y, width and height variables, no need to further
confuse the code by having local copies. (Partial fix, I hope, for
#101588)
(gdk_window_move): When moving top-level windows, take title bar
and border width into account, offsetting the coordinates before
calling SetWindowPos().
(gdk_window_set_decorations, gdk_window_set_functions):
Reimplement, taking into account the peculiar semantics of
GDK_DECOR_ALL and GDK_FUNC_ALL. (#79036)
(gdk_window_get_decorations): Implement. (#98981)
(gdk_window_set_type_hint): When setting
GDK_WINDOW_TYPE_HINT_MENU, call gdk_window_set_decorations().
(#79036)
* gdk/gdk.def: Add gdk_window_get_decorations. (#98981)
2002-12-21 23:32:20 +00:00
|
|
|
}
|
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
void
|
|
|
|
gdk_window_set_functions (GdkWindow *window,
|
|
|
|
GdkWMFunction functions)
|
|
|
|
{
|
2006-02-09 02:58:45 +00:00
|
|
|
GdkWMFunction* functions_copy;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
2005-11-09 12:35:56 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_set_functions: %p: %s %s%s%s%s%s\n",
|
2002-10-28 20:48:40 +00:00
|
|
|
GDK_WINDOW_HWND (window),
|
2005-11-09 12:35:56 +00:00
|
|
|
(functions & GDK_FUNC_ALL ? "clearing" : "setting"),
|
2002-10-28 20:48:40 +00:00
|
|
|
(functions & GDK_FUNC_RESIZE ? "RESIZE " : ""),
|
|
|
|
(functions & GDK_FUNC_MOVE ? "MOVE " : ""),
|
|
|
|
(functions & GDK_FUNC_MINIMIZE ? "MINIMIZE " : ""),
|
|
|
|
(functions & GDK_FUNC_MAXIMIZE ? "MAXIMIZE " : ""),
|
|
|
|
(functions & GDK_FUNC_CLOSE ? "CLOSE " : "")));
|
|
|
|
|
2006-02-09 02:58:45 +00:00
|
|
|
functions_copy = g_malloc (sizeof (GdkWMFunction));
|
|
|
|
*functions_copy = functions;
|
|
|
|
g_object_set_qdata_full (G_OBJECT (window), get_functions_quark (), functions_copy, g_free);
|
|
|
|
|
|
|
|
update_style_bits (window);
|
|
|
|
}
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2006-02-09 02:58:45 +00:00
|
|
|
gboolean
|
|
|
|
_gdk_window_get_functions (GdkWindow *window,
|
|
|
|
GdkWMFunction *functions)
|
|
|
|
{
|
|
|
|
GdkWMDecoration* functions_set;
|
Move the code that sets the window style and extended window style, and
2002-12-21 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkwindow-win32.c (gdk_window_new): Move the code that
sets the window style and extended window style, and adjusts the
width and height to take the window decorations into account
earlier. The adjusted width and height used to be ignored. Remove
the local x, y, width and height variables, no need to further
confuse the code by having local copies. (Partial fix, I hope, for
#101588)
(gdk_window_move): When moving top-level windows, take title bar
and border width into account, offsetting the coordinates before
calling SetWindowPos().
(gdk_window_set_decorations, gdk_window_set_functions):
Reimplement, taking into account the peculiar semantics of
GDK_DECOR_ALL and GDK_FUNC_ALL. (#79036)
(gdk_window_get_decorations): Implement. (#98981)
(gdk_window_set_type_hint): When setting
GDK_WINDOW_TYPE_HINT_MENU, call gdk_window_set_decorations().
(#79036)
* gdk/gdk.def: Add gdk_window_get_decorations. (#98981)
2002-12-21 23:32:20 +00:00
|
|
|
|
2006-02-09 02:58:45 +00:00
|
|
|
functions_set = g_object_get_qdata (G_OBJECT (window), get_functions_quark ());
|
|
|
|
if (functions_set)
|
|
|
|
*functions = *functions_set;
|
|
|
|
|
|
|
|
return (functions_set != NULL);
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2002-10-28 20:48:40 +00:00
|
|
|
QueryTree (HWND hwnd,
|
1999-11-11 22:12:27 +00:00
|
|
|
HWND **children,
|
2002-10-28 20:48:40 +00:00
|
|
|
gint *nchildren)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
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;
|
|
|
|
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);
|
gdk/win32/gdkprivate-win32.h Rename all global variables and functions to
2002-11-12 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkprivate-win32.h
* gdk/win32/*.c: Rename all global variables and functions to
start with underscore.
Merge from stable:
More work on the Win32 backend. The cause of some scrolling
problems was that SetWindowPos() and ScrollWindowEx() don't blit
those parts of the window they think are invalid. As we didn't
keep Windows's update region in synch with GDK's, Windows thought
those areas that in fact had been updated were invalid. Calling
ValidateRgn() in _gdk_windowing_window_queue_antiexpose() seems to
be an elegant and efficient solution, removing from Windows's
update region those areas we are about to repaint proactively.
In some cases garbage leftover values were used for the clip
origin in GdkGCWin32. This showed up as odd blank areas around the
pixmaps included in the Text Widget in gtk-demo.
Having the clip region either as a GdkRegion or a HRGN in
GdkGCWin32 was unnecessary, it's better to just use a HRGN.
The translation and antiexpose queue handling in
gdkgeometry-win32.c seems unnecessary (and not implementable in
the same way as on X11 anyway, no serial numbers) on Windows,
ifdeffed out.
Don't (try to) do guffaw scrolling as there is no static window
gravity on Windows. Guffaw scrolling would be unnecessary anyway,
as there is the ScrollWindow() API. This improves the behaviour of
the Text Widget demo in gtk-demo a lot. But I have no idea how the
lack of static win gravity should be handled in other places where
the X11 code uses it. Especially _gdk_window_move_resize_child().
There is still some problem in expose handling. By moving an
obscuring window back and forth over testgtk's main window, for
instance, every now and then you typically get narrow vertical or
horizontal strips of pixels that haven't been properly redrawn
after being exposed. A fencepost error somewhere?
Otherwise, all of testgtk and gtk-demo except "big windows" now
seem to work pretty well.
Bug #79720 should be fixed now.
* gdk/win32/gdkcolor-win32.c (gdk_win32_color_to_string,
gdk_win32_print_paletteentries, gdk_win32_print_system_palette,
gdk_win32_print_hpalette)
* gdk/win32/gdkdrawable-win32.c (gdk_win32_drawable_description)
* gdk/win32/gdkevents-win32.c (gdk_win32_message_name):
Move all debugging helper functions to gdkmain-win32.c.
* gdk/win32/gdkdrawable-win32.c (_gdk_win32_draw_tiles):
Rewrite. Make static. Must take tile origin parameters, too.
(gdk_win32_draw_rectangle): Pass the tile/stipple origin to
_gdk_win32_draw_tiles(). Remove #if 0 code.
(blit_inside_window): Don't call ScrollDC(), that didn't work at
all like I thought. A simple call to BitBlt() is enough.
* gdk/win32/gdkevents-win32.c (gdk_event_translate) Remove unused
latin_locale_loaded variable.
(_gdk_win32_get_next_tick): New function. Used to make sure
timestamps of events are always increasing, both in events
generated from the window procedure and in events gotten via
PeekMessage(). Not sure whether this is actually useful, but it
seemed as a good idea.
(real_window_procedure): Don't use a local GdkEventPrivate
variable. Don't attempt any compression of configure or expose
events here, handled elsewhere.
(erase_background): Accumulate window offsets when traversing up
the parent chain for GDK_PARENT_RELATIVE_BG, in order to get
correct alignment of background pixmaps. Don't fill with
BLACK_BRUSH if GDK_NO_BG.
(gdk_event_get_graphics_expose): A bit more verbose debugging output.
(gdk_event_translate): Use _gdk_win32_get_next_tick(). In the
WM_PAINT handler, don't check for empty update rect. When we get a
WM_PAINT, the update region isn't empty. And if it for some
strange reason is, that will be handled later anyway. Call
GetUpdateRgn() before calling BeginPaint() and EndPaint() (which
empty the update region).
* gdk/win32/gdkdnd-win32.c
* gdk/win32/gdkinput-win32.c:
Use _gdk_win32_get_next_tick().
* gdk/win32/gdkfont-win32.c: Use %p to print HFONTs.
(gdk_text_size): Remove, unused.
* gdk/win32/gdkgc-win32.c: Set clip origins to zero
when appropriate.
(gdk_gc_copy): Increase refcount on colormap if present.
(gdk_win32_hdc_get): Handle just hcliprgn. If we have a stipple,
combine it with clip region after selecting into the DC.
(_gdk_win32_bitmap_to_hrgn): Rename from _gdk_win32_bitmap_to_region.
(_gdk_win3_gdkregion_to_hrgn): New function, code snippet
extracted from gdk_win32_hdc_get().
* gdk/win32/gdkgeometry-win32.c: Ifdef out the translate_queue
handling.
(gdk_window_copy_area_scroll): Increase clipRect to avoid
ScrollWindowEx() not scrolling pixels it thinks are invalid.
Scroll also children with the ScrollWindowEx() call. No need to
call gdk_window_move() on the children.
(gdk_window_scroll): Don't do guffaw scrolling.
(gdk_window_compute_position): Fix typo, used win32_y where x was
intended.
(gdk_window_premove, gdk_window_postmove,
gdk_window_clip_changed): Add debugging output.
(_gdk_windowing_window_queue_antiexpose): Just call ValidateRgn()
on the region.
(_gdk_window_process_expose): No use for the serial number
parameter now. Instead of a rectangle, take a region parameter, as
Windows gives us one in WM_PAINT.
* gdk/win32/gdkmain-win32.c (_gdk_win32_lbstyle_to_string,
_gdk_win32_pstype_to_string, _gdk_win32_psstyle_to_string,
_gdk_win32_psendcap_to_string, _gdk_win32_psjoin_to_string,
_gdk_win32_rect_to_string, _gdk_win32_gdkrectangle_to_string,
_gdk_win32_gdkregion_to_string): New debugging functions.
(static_printf): Helper function for the above. sprintfs into a
static circular buffer, return value should be used "soon".
* gdk/win32/gdkwindow-win32.c (gdk_propagate_shapes): Plug memory
leak, free list after use.
(gdk_window_gravity_works): Remove, we know that there is no such
thing on Windows.
(gdk_window_set_static_bit_gravity,
gdk_window_set_static_win_gravity): Ditto, remove, they didn't do
anything anyway.
(_gdk_windowing_window_init, gdk_window_foreign_new): Call
_gdk_window_init_position() like in the X11 backend.
(gdk_window_reparent): Don't call the now nonexistent
gdk_window_set_static_win_gravity(). No idea what should be done
instead.
(gdk_window_get_geometry): The returned x and y should be relative
to parent. Used to be always zero..
(gdk_window_set_static_gravities): Return FALSE if trying to set
static gravity.
* gdk/win32/gdkprivate-win32.h: Drop the clip_region field from
GdkGCWin32. Only use the HRGN hcliprgn. Declare new
functions.
* gdk/win32/*.c: Use new debugging functions.
* gdk/win32/rc/gdk.rc.in: Update copyright year.
2002-11-12 22:17:48 +00:00
|
|
|
g_free (list);
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
DeleteObject (region);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_set_child_shapes (GdkWindow *window)
|
|
|
|
{
|
|
|
|
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 (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
|
|
|
}
|
|
|
|
|
2006-02-20 10:08:37 +00:00
|
|
|
void
|
|
|
|
gdk_window_set_child_input_shapes (GdkWindow *window)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
|
|
|
/* Not yet implemented. See comment in
|
|
|
|
* gdk_window_input_shape_combine_mask().
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_merge_child_input_shapes (GdkWindow *window)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
|
|
|
/* Not yet implemented. See comment in
|
|
|
|
* gdk_window_input_shape_combine_mask().
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
gboolean
|
|
|
|
gdk_window_set_static_gravities (GdkWindow *window,
|
|
|
|
gboolean use_static)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
|
|
|
|
|
2005-03-11 23:50:21 +00:00
|
|
|
return !use_static;
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
2001-03-09 16:43:19 +00:00
|
|
|
|
2004-08-06 19:20:42 +00:00
|
|
|
void
|
|
|
|
gdk_window_begin_resize_drag (GdkWindow *window,
|
|
|
|
GdkWindowEdge edge,
|
|
|
|
gint button,
|
|
|
|
gint root_x,
|
|
|
|
gint root_y,
|
|
|
|
guint32 timestamp)
|
|
|
|
{
|
2004-10-30 18:04:49 +00:00
|
|
|
WPARAM winedge;
|
|
|
|
|
2004-08-06 19:20:42 +00:00
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
|
|
|
return;
|
|
|
|
|
2004-10-30 18:04:49 +00:00
|
|
|
/* Tell Windows to start interactively resizing the window by pretending that
|
|
|
|
* the left pointer button was clicked in the suitable edge or corner. This
|
|
|
|
* will only work if the button is down when this function is called, and
|
|
|
|
* will only work with button 1 (left), since Windows only allows window
|
2005-11-02 13:33:27 +00:00
|
|
|
* dragging using the left mouse button.
|
|
|
|
*/
|
2004-10-30 18:04:49 +00:00
|
|
|
if (button != 1)
|
|
|
|
return;
|
|
|
|
|
2005-11-02 13:33:27 +00:00
|
|
|
/* Must break the automatic grab that occured when the button was
|
|
|
|
* pressed, otherwise it won't work.
|
|
|
|
*/
|
|
|
|
gdk_display_pointer_ungrab (_gdk_display, 0);
|
2004-10-30 18:04:49 +00:00
|
|
|
|
|
|
|
switch (edge)
|
|
|
|
{
|
|
|
|
case GDK_WINDOW_EDGE_NORTH_WEST:
|
|
|
|
winedge = HTTOPLEFT;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_WINDOW_EDGE_NORTH:
|
|
|
|
winedge = HTTOP;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_WINDOW_EDGE_NORTH_EAST:
|
|
|
|
winedge = HTTOPRIGHT;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_WINDOW_EDGE_WEST:
|
|
|
|
winedge = HTLEFT;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_WINDOW_EDGE_EAST:
|
|
|
|
winedge = HTRIGHT;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_WINDOW_EDGE_SOUTH_WEST:
|
|
|
|
winedge = HTBOTTOMLEFT;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_WINDOW_EDGE_SOUTH:
|
|
|
|
winedge = HTBOTTOM;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_WINDOW_EDGE_SOUTH_EAST:
|
|
|
|
default:
|
|
|
|
winedge = HTBOTTOMRIGHT;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2006-09-03 22:50:00 +00:00
|
|
|
DefWindowProcW (GDK_WINDOW_HWND (window), WM_NCLBUTTONDOWN, winedge,
|
|
|
|
MAKELPARAM (root_x - _gdk_offset_x, root_y - _gdk_offset_y));
|
2004-08-06 19:20:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_begin_move_drag (GdkWindow *window,
|
|
|
|
gint button,
|
|
|
|
gint root_x,
|
|
|
|
gint root_y,
|
|
|
|
guint32 timestamp)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
|
|
|
return;
|
|
|
|
|
2004-10-30 18:04:49 +00:00
|
|
|
/* Tell Windows to start interactively moving the window by pretending that
|
|
|
|
* the left pointer button was clicked in the titlebar. This will only work
|
|
|
|
* if the button is down when this function is called, and will only work
|
|
|
|
* with button 1 (left), since Windows only allows window dragging using the
|
2005-11-02 13:33:27 +00:00
|
|
|
* left mouse button.
|
|
|
|
*/
|
2004-10-30 18:04:49 +00:00
|
|
|
if (button != 1)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* Must break the automatic grab that occured when the button was pressed,
|
2005-11-02 13:33:27 +00:00
|
|
|
* otherwise it won't work.
|
|
|
|
*/
|
|
|
|
gdk_display_pointer_ungrab (_gdk_display, 0);
|
2004-10-30 18:04:49 +00:00
|
|
|
|
2006-09-03 22:50:00 +00:00
|
|
|
DefWindowProcW (GDK_WINDOW_HWND (window), WM_NCLBUTTONDOWN, HTCAPTION,
|
|
|
|
MAKELPARAM (root_x - _gdk_offset_x, root_y - _gdk_offset_y));
|
2004-08-06 19:20:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-03-09 16:43:19 +00:00
|
|
|
/*
|
|
|
|
* Setting window states
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gdk_window_iconify (GdkWindow *window)
|
|
|
|
{
|
Merge from stable:
2002-12-09 Tor Lillqvist <tml@iki.fi>
Merge from stable:
* gdk/win32/gdkdrawable-win32.c (generic_draw): Don't leak
stipple_gc. More checks for errors. Use correct ternary ROP when
blitting the foreground into the tile pixmap onto those pixels
where the stipple is set. (I didn't notice that I had used the
wrong one, as it didn't matter on Win2k, where DIB sections
apparently are zeroed upon creation. But on Win98 they have random
initial contents. Thanks to Hans Breuer for reporting this.)
(gdk_win32_draw_rectangle, gdk_win32_draw_arc,
gdk_win32_draw_polygon): Don't pass the LINE_ATTRIBUTES bits to
generic_draw() if drawing a filled figure.
* gdk/win32/gdkmain-win32.c (_gdk_win32_print_dc): Minor cosmetics.
(_gdk_win32_gcvalues_mask_to_string): Initialize buffer as empty.
(_gdk_win32_window_state_to_string): New debugging output helper
function.
* gdk/win32/gdkevents-win32.c: Minor debugging output changes.
(gdk_event_translate): Ignore the WM_SHOWWINDOW/SW_OTHERUNZOOM or
SW_OTHERZOOM messages. Do not generate a GDK_UNMAP event for
WM_SIZE/SIZE_MINIMIZED messages, they do not really corrspond to
unmapping on X11. Set window state correctly for all three of
SIZE_{MINIMIZED,MAXIMIZED,RESTORED}. A maximized and then iconified
("minimized" in Windows terminology) window still has the
"maximized" property, i.e. when deiconified, it will reappear as
maximized. (#10557)
* gdk/win32/gdkprivate-win32.h: Declare new function.
(WIN32_API_FAILED, WIN32_GDI_FAILED, OTHER_API_FAILED): Don't use
__PRETTY_FUNCTION__ if __GNUC__ >= 3, to avoid warning message.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Handle more
situations. Add parameter to tell whether deiconifying. Code
reorg: Return early when appropriate instead of using nested if
statements. If just deiconifying without raising, restore active
window. (#10557)
(gdk_window_hide, gdk_window_withdraw, gdk_window_iconify,
gdk_window_deiconify, gdk_window_maximize, gdk_window_unmaximize,
gdk_window_focus): Use _gdk_win32_window_state_to_string() in
debugging output.
(gdk_window_iconify): Restore active window after calling
ShowWindow(). Otherwise the "next" window gets activated.
(gdk_window_stick, gdk_window_unstick): Don't output any warnings.
(gdk_window_set_transient_for): Rewrite. Just call SetWindowLong()
with GWL_HWNDPARENT, which despite its name sets the *owner*
window, which should be exactly what we want. The PSDK
documentation is said to be misleading. testgtk's modal window
test now works much better. (#50586)
2002-12-09 00:43:42 +00:00
|
|
|
HWND old_active_window;
|
|
|
|
|
2001-03-09 16:43:19 +00:00
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
|
|
|
return;
|
|
|
|
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_iconify: %p: %s\n",
|
Merge from stable:
2002-12-09 Tor Lillqvist <tml@iki.fi>
Merge from stable:
* gdk/win32/gdkdrawable-win32.c (generic_draw): Don't leak
stipple_gc. More checks for errors. Use correct ternary ROP when
blitting the foreground into the tile pixmap onto those pixels
where the stipple is set. (I didn't notice that I had used the
wrong one, as it didn't matter on Win2k, where DIB sections
apparently are zeroed upon creation. But on Win98 they have random
initial contents. Thanks to Hans Breuer for reporting this.)
(gdk_win32_draw_rectangle, gdk_win32_draw_arc,
gdk_win32_draw_polygon): Don't pass the LINE_ATTRIBUTES bits to
generic_draw() if drawing a filled figure.
* gdk/win32/gdkmain-win32.c (_gdk_win32_print_dc): Minor cosmetics.
(_gdk_win32_gcvalues_mask_to_string): Initialize buffer as empty.
(_gdk_win32_window_state_to_string): New debugging output helper
function.
* gdk/win32/gdkevents-win32.c: Minor debugging output changes.
(gdk_event_translate): Ignore the WM_SHOWWINDOW/SW_OTHERUNZOOM or
SW_OTHERZOOM messages. Do not generate a GDK_UNMAP event for
WM_SIZE/SIZE_MINIMIZED messages, they do not really corrspond to
unmapping on X11. Set window state correctly for all three of
SIZE_{MINIMIZED,MAXIMIZED,RESTORED}. A maximized and then iconified
("minimized" in Windows terminology) window still has the
"maximized" property, i.e. when deiconified, it will reappear as
maximized. (#10557)
* gdk/win32/gdkprivate-win32.h: Declare new function.
(WIN32_API_FAILED, WIN32_GDI_FAILED, OTHER_API_FAILED): Don't use
__PRETTY_FUNCTION__ if __GNUC__ >= 3, to avoid warning message.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Handle more
situations. Add parameter to tell whether deiconifying. Code
reorg: Return early when appropriate instead of using nested if
statements. If just deiconifying without raising, restore active
window. (#10557)
(gdk_window_hide, gdk_window_withdraw, gdk_window_iconify,
gdk_window_deiconify, gdk_window_maximize, gdk_window_unmaximize,
gdk_window_focus): Use _gdk_win32_window_state_to_string() in
debugging output.
(gdk_window_iconify): Restore active window after calling
ShowWindow(). Otherwise the "next" window gets activated.
(gdk_window_stick, gdk_window_unstick): Don't output any warnings.
(gdk_window_set_transient_for): Rewrite. Just call SetWindowLong()
with GWL_HWNDPARENT, which despite its name sets the *owner*
window, which should be exactly what we want. The PSDK
documentation is said to be misleading. testgtk's modal window
test now works much better. (#50586)
2002-12-09 00:43:42 +00:00
|
|
|
GDK_WINDOW_HWND (window),
|
|
|
|
_gdk_win32_window_state_to_string (((GdkWindowObject *) window)->state)));
|
|
|
|
|
2001-03-09 16:43:19 +00:00
|
|
|
if (GDK_WINDOW_IS_MAPPED (window))
|
|
|
|
{
|
Merge from stable:
2002-12-09 Tor Lillqvist <tml@iki.fi>
Merge from stable:
* gdk/win32/gdkdrawable-win32.c (generic_draw): Don't leak
stipple_gc. More checks for errors. Use correct ternary ROP when
blitting the foreground into the tile pixmap onto those pixels
where the stipple is set. (I didn't notice that I had used the
wrong one, as it didn't matter on Win2k, where DIB sections
apparently are zeroed upon creation. But on Win98 they have random
initial contents. Thanks to Hans Breuer for reporting this.)
(gdk_win32_draw_rectangle, gdk_win32_draw_arc,
gdk_win32_draw_polygon): Don't pass the LINE_ATTRIBUTES bits to
generic_draw() if drawing a filled figure.
* gdk/win32/gdkmain-win32.c (_gdk_win32_print_dc): Minor cosmetics.
(_gdk_win32_gcvalues_mask_to_string): Initialize buffer as empty.
(_gdk_win32_window_state_to_string): New debugging output helper
function.
* gdk/win32/gdkevents-win32.c: Minor debugging output changes.
(gdk_event_translate): Ignore the WM_SHOWWINDOW/SW_OTHERUNZOOM or
SW_OTHERZOOM messages. Do not generate a GDK_UNMAP event for
WM_SIZE/SIZE_MINIMIZED messages, they do not really corrspond to
unmapping on X11. Set window state correctly for all three of
SIZE_{MINIMIZED,MAXIMIZED,RESTORED}. A maximized and then iconified
("minimized" in Windows terminology) window still has the
"maximized" property, i.e. when deiconified, it will reappear as
maximized. (#10557)
* gdk/win32/gdkprivate-win32.h: Declare new function.
(WIN32_API_FAILED, WIN32_GDI_FAILED, OTHER_API_FAILED): Don't use
__PRETTY_FUNCTION__ if __GNUC__ >= 3, to avoid warning message.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Handle more
situations. Add parameter to tell whether deiconifying. Code
reorg: Return early when appropriate instead of using nested if
statements. If just deiconifying without raising, restore active
window. (#10557)
(gdk_window_hide, gdk_window_withdraw, gdk_window_iconify,
gdk_window_deiconify, gdk_window_maximize, gdk_window_unmaximize,
gdk_window_focus): Use _gdk_win32_window_state_to_string() in
debugging output.
(gdk_window_iconify): Restore active window after calling
ShowWindow(). Otherwise the "next" window gets activated.
(gdk_window_stick, gdk_window_unstick): Don't output any warnings.
(gdk_window_set_transient_for): Rewrite. Just call SetWindowLong()
with GWL_HWNDPARENT, which despite its name sets the *owner*
window, which should be exactly what we want. The PSDK
documentation is said to be misleading. testgtk's modal window
test now works much better. (#50586)
2002-12-09 00:43:42 +00:00
|
|
|
old_active_window = GetActiveWindow ();
|
2001-03-09 16:43:19 +00:00
|
|
|
ShowWindow (GDK_WINDOW_HWND (window), SW_MINIMIZE);
|
Merge from stable:
2002-12-09 Tor Lillqvist <tml@iki.fi>
Merge from stable:
* gdk/win32/gdkdrawable-win32.c (generic_draw): Don't leak
stipple_gc. More checks for errors. Use correct ternary ROP when
blitting the foreground into the tile pixmap onto those pixels
where the stipple is set. (I didn't notice that I had used the
wrong one, as it didn't matter on Win2k, where DIB sections
apparently are zeroed upon creation. But on Win98 they have random
initial contents. Thanks to Hans Breuer for reporting this.)
(gdk_win32_draw_rectangle, gdk_win32_draw_arc,
gdk_win32_draw_polygon): Don't pass the LINE_ATTRIBUTES bits to
generic_draw() if drawing a filled figure.
* gdk/win32/gdkmain-win32.c (_gdk_win32_print_dc): Minor cosmetics.
(_gdk_win32_gcvalues_mask_to_string): Initialize buffer as empty.
(_gdk_win32_window_state_to_string): New debugging output helper
function.
* gdk/win32/gdkevents-win32.c: Minor debugging output changes.
(gdk_event_translate): Ignore the WM_SHOWWINDOW/SW_OTHERUNZOOM or
SW_OTHERZOOM messages. Do not generate a GDK_UNMAP event for
WM_SIZE/SIZE_MINIMIZED messages, they do not really corrspond to
unmapping on X11. Set window state correctly for all three of
SIZE_{MINIMIZED,MAXIMIZED,RESTORED}. A maximized and then iconified
("minimized" in Windows terminology) window still has the
"maximized" property, i.e. when deiconified, it will reappear as
maximized. (#10557)
* gdk/win32/gdkprivate-win32.h: Declare new function.
(WIN32_API_FAILED, WIN32_GDI_FAILED, OTHER_API_FAILED): Don't use
__PRETTY_FUNCTION__ if __GNUC__ >= 3, to avoid warning message.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Handle more
situations. Add parameter to tell whether deiconifying. Code
reorg: Return early when appropriate instead of using nested if
statements. If just deiconifying without raising, restore active
window. (#10557)
(gdk_window_hide, gdk_window_withdraw, gdk_window_iconify,
gdk_window_deiconify, gdk_window_maximize, gdk_window_unmaximize,
gdk_window_focus): Use _gdk_win32_window_state_to_string() in
debugging output.
(gdk_window_iconify): Restore active window after calling
ShowWindow(). Otherwise the "next" window gets activated.
(gdk_window_stick, gdk_window_unstick): Don't output any warnings.
(gdk_window_set_transient_for): Rewrite. Just call SetWindowLong()
with GWL_HWNDPARENT, which despite its name sets the *owner*
window, which should be exactly what we want. The PSDK
documentation is said to be misleading. testgtk's modal window
test now works much better. (#50586)
2002-12-09 00:43:42 +00:00
|
|
|
if (old_active_window != GDK_WINDOW_HWND (window))
|
|
|
|
SetActiveWindow (old_active_window);
|
2001-03-09 16:43:19 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gdk_synthesize_window_state (window,
|
|
|
|
0,
|
|
|
|
GDK_WINDOW_STATE_ICONIFIED);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_deiconify (GdkWindow *window)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
|
|
|
return;
|
|
|
|
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_deiconify: %p: %s\n",
|
Merge from stable:
2002-12-09 Tor Lillqvist <tml@iki.fi>
Merge from stable:
* gdk/win32/gdkdrawable-win32.c (generic_draw): Don't leak
stipple_gc. More checks for errors. Use correct ternary ROP when
blitting the foreground into the tile pixmap onto those pixels
where the stipple is set. (I didn't notice that I had used the
wrong one, as it didn't matter on Win2k, where DIB sections
apparently are zeroed upon creation. But on Win98 they have random
initial contents. Thanks to Hans Breuer for reporting this.)
(gdk_win32_draw_rectangle, gdk_win32_draw_arc,
gdk_win32_draw_polygon): Don't pass the LINE_ATTRIBUTES bits to
generic_draw() if drawing a filled figure.
* gdk/win32/gdkmain-win32.c (_gdk_win32_print_dc): Minor cosmetics.
(_gdk_win32_gcvalues_mask_to_string): Initialize buffer as empty.
(_gdk_win32_window_state_to_string): New debugging output helper
function.
* gdk/win32/gdkevents-win32.c: Minor debugging output changes.
(gdk_event_translate): Ignore the WM_SHOWWINDOW/SW_OTHERUNZOOM or
SW_OTHERZOOM messages. Do not generate a GDK_UNMAP event for
WM_SIZE/SIZE_MINIMIZED messages, they do not really corrspond to
unmapping on X11. Set window state correctly for all three of
SIZE_{MINIMIZED,MAXIMIZED,RESTORED}. A maximized and then iconified
("minimized" in Windows terminology) window still has the
"maximized" property, i.e. when deiconified, it will reappear as
maximized. (#10557)
* gdk/win32/gdkprivate-win32.h: Declare new function.
(WIN32_API_FAILED, WIN32_GDI_FAILED, OTHER_API_FAILED): Don't use
__PRETTY_FUNCTION__ if __GNUC__ >= 3, to avoid warning message.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Handle more
situations. Add parameter to tell whether deiconifying. Code
reorg: Return early when appropriate instead of using nested if
statements. If just deiconifying without raising, restore active
window. (#10557)
(gdk_window_hide, gdk_window_withdraw, gdk_window_iconify,
gdk_window_deiconify, gdk_window_maximize, gdk_window_unmaximize,
gdk_window_focus): Use _gdk_win32_window_state_to_string() in
debugging output.
(gdk_window_iconify): Restore active window after calling
ShowWindow(). Otherwise the "next" window gets activated.
(gdk_window_stick, gdk_window_unstick): Don't output any warnings.
(gdk_window_set_transient_for): Rewrite. Just call SetWindowLong()
with GWL_HWNDPARENT, which despite its name sets the *owner*
window, which should be exactly what we want. The PSDK
documentation is said to be misleading. testgtk's modal window
test now works much better. (#50586)
2002-12-09 00:43:42 +00:00
|
|
|
GDK_WINDOW_HWND (window),
|
|
|
|
_gdk_win32_window_state_to_string (((GdkWindowObject *) window)->state)));
|
|
|
|
|
2001-03-09 16:43:19 +00:00
|
|
|
if (GDK_WINDOW_IS_MAPPED (window))
|
|
|
|
{
|
Merge from stable:
2002-12-09 Tor Lillqvist <tml@iki.fi>
Merge from stable:
* gdk/win32/gdkdrawable-win32.c (generic_draw): Don't leak
stipple_gc. More checks for errors. Use correct ternary ROP when
blitting the foreground into the tile pixmap onto those pixels
where the stipple is set. (I didn't notice that I had used the
wrong one, as it didn't matter on Win2k, where DIB sections
apparently are zeroed upon creation. But on Win98 they have random
initial contents. Thanks to Hans Breuer for reporting this.)
(gdk_win32_draw_rectangle, gdk_win32_draw_arc,
gdk_win32_draw_polygon): Don't pass the LINE_ATTRIBUTES bits to
generic_draw() if drawing a filled figure.
* gdk/win32/gdkmain-win32.c (_gdk_win32_print_dc): Minor cosmetics.
(_gdk_win32_gcvalues_mask_to_string): Initialize buffer as empty.
(_gdk_win32_window_state_to_string): New debugging output helper
function.
* gdk/win32/gdkevents-win32.c: Minor debugging output changes.
(gdk_event_translate): Ignore the WM_SHOWWINDOW/SW_OTHERUNZOOM or
SW_OTHERZOOM messages. Do not generate a GDK_UNMAP event for
WM_SIZE/SIZE_MINIMIZED messages, they do not really corrspond to
unmapping on X11. Set window state correctly for all three of
SIZE_{MINIMIZED,MAXIMIZED,RESTORED}. A maximized and then iconified
("minimized" in Windows terminology) window still has the
"maximized" property, i.e. when deiconified, it will reappear as
maximized. (#10557)
* gdk/win32/gdkprivate-win32.h: Declare new function.
(WIN32_API_FAILED, WIN32_GDI_FAILED, OTHER_API_FAILED): Don't use
__PRETTY_FUNCTION__ if __GNUC__ >= 3, to avoid warning message.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Handle more
situations. Add parameter to tell whether deiconifying. Code
reorg: Return early when appropriate instead of using nested if
statements. If just deiconifying without raising, restore active
window. (#10557)
(gdk_window_hide, gdk_window_withdraw, gdk_window_iconify,
gdk_window_deiconify, gdk_window_maximize, gdk_window_unmaximize,
gdk_window_focus): Use _gdk_win32_window_state_to_string() in
debugging output.
(gdk_window_iconify): Restore active window after calling
ShowWindow(). Otherwise the "next" window gets activated.
(gdk_window_stick, gdk_window_unstick): Don't output any warnings.
(gdk_window_set_transient_for): Rewrite. Just call SetWindowLong()
with GWL_HWNDPARENT, which despite its name sets the *owner*
window, which should be exactly what we want. The PSDK
documentation is said to be misleading. testgtk's modal window
test now works much better. (#50586)
2002-12-09 00:43:42 +00:00
|
|
|
show_window_internal (window, FALSE, TRUE);
|
2001-03-09 16:43:19 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gdk_synthesize_window_state (window,
|
|
|
|
GDK_WINDOW_STATE_ICONIFIED,
|
|
|
|
0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_stick (GdkWindow *window)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
|
|
|
return;
|
|
|
|
|
Merge from stable:
2002-12-09 Tor Lillqvist <tml@iki.fi>
Merge from stable:
* gdk/win32/gdkdrawable-win32.c (generic_draw): Don't leak
stipple_gc. More checks for errors. Use correct ternary ROP when
blitting the foreground into the tile pixmap onto those pixels
where the stipple is set. (I didn't notice that I had used the
wrong one, as it didn't matter on Win2k, where DIB sections
apparently are zeroed upon creation. But on Win98 they have random
initial contents. Thanks to Hans Breuer for reporting this.)
(gdk_win32_draw_rectangle, gdk_win32_draw_arc,
gdk_win32_draw_polygon): Don't pass the LINE_ATTRIBUTES bits to
generic_draw() if drawing a filled figure.
* gdk/win32/gdkmain-win32.c (_gdk_win32_print_dc): Minor cosmetics.
(_gdk_win32_gcvalues_mask_to_string): Initialize buffer as empty.
(_gdk_win32_window_state_to_string): New debugging output helper
function.
* gdk/win32/gdkevents-win32.c: Minor debugging output changes.
(gdk_event_translate): Ignore the WM_SHOWWINDOW/SW_OTHERUNZOOM or
SW_OTHERZOOM messages. Do not generate a GDK_UNMAP event for
WM_SIZE/SIZE_MINIMIZED messages, they do not really corrspond to
unmapping on X11. Set window state correctly for all three of
SIZE_{MINIMIZED,MAXIMIZED,RESTORED}. A maximized and then iconified
("minimized" in Windows terminology) window still has the
"maximized" property, i.e. when deiconified, it will reappear as
maximized. (#10557)
* gdk/win32/gdkprivate-win32.h: Declare new function.
(WIN32_API_FAILED, WIN32_GDI_FAILED, OTHER_API_FAILED): Don't use
__PRETTY_FUNCTION__ if __GNUC__ >= 3, to avoid warning message.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Handle more
situations. Add parameter to tell whether deiconifying. Code
reorg: Return early when appropriate instead of using nested if
statements. If just deiconifying without raising, restore active
window. (#10557)
(gdk_window_hide, gdk_window_withdraw, gdk_window_iconify,
gdk_window_deiconify, gdk_window_maximize, gdk_window_unmaximize,
gdk_window_focus): Use _gdk_win32_window_state_to_string() in
debugging output.
(gdk_window_iconify): Restore active window after calling
ShowWindow(). Otherwise the "next" window gets activated.
(gdk_window_stick, gdk_window_unstick): Don't output any warnings.
(gdk_window_set_transient_for): Rewrite. Just call SetWindowLong()
with GWL_HWNDPARENT, which despite its name sets the *owner*
window, which should be exactly what we want. The PSDK
documentation is said to be misleading. testgtk's modal window
test now works much better. (#50586)
2002-12-09 00:43:42 +00:00
|
|
|
/* FIXME: Do something? */
|
2001-03-09 16:43:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_unstick (GdkWindow *window)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
|
|
|
return;
|
|
|
|
|
Merge from stable:
2002-12-09 Tor Lillqvist <tml@iki.fi>
Merge from stable:
* gdk/win32/gdkdrawable-win32.c (generic_draw): Don't leak
stipple_gc. More checks for errors. Use correct ternary ROP when
blitting the foreground into the tile pixmap onto those pixels
where the stipple is set. (I didn't notice that I had used the
wrong one, as it didn't matter on Win2k, where DIB sections
apparently are zeroed upon creation. But on Win98 they have random
initial contents. Thanks to Hans Breuer for reporting this.)
(gdk_win32_draw_rectangle, gdk_win32_draw_arc,
gdk_win32_draw_polygon): Don't pass the LINE_ATTRIBUTES bits to
generic_draw() if drawing a filled figure.
* gdk/win32/gdkmain-win32.c (_gdk_win32_print_dc): Minor cosmetics.
(_gdk_win32_gcvalues_mask_to_string): Initialize buffer as empty.
(_gdk_win32_window_state_to_string): New debugging output helper
function.
* gdk/win32/gdkevents-win32.c: Minor debugging output changes.
(gdk_event_translate): Ignore the WM_SHOWWINDOW/SW_OTHERUNZOOM or
SW_OTHERZOOM messages. Do not generate a GDK_UNMAP event for
WM_SIZE/SIZE_MINIMIZED messages, they do not really corrspond to
unmapping on X11. Set window state correctly for all three of
SIZE_{MINIMIZED,MAXIMIZED,RESTORED}. A maximized and then iconified
("minimized" in Windows terminology) window still has the
"maximized" property, i.e. when deiconified, it will reappear as
maximized. (#10557)
* gdk/win32/gdkprivate-win32.h: Declare new function.
(WIN32_API_FAILED, WIN32_GDI_FAILED, OTHER_API_FAILED): Don't use
__PRETTY_FUNCTION__ if __GNUC__ >= 3, to avoid warning message.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Handle more
situations. Add parameter to tell whether deiconifying. Code
reorg: Return early when appropriate instead of using nested if
statements. If just deiconifying without raising, restore active
window. (#10557)
(gdk_window_hide, gdk_window_withdraw, gdk_window_iconify,
gdk_window_deiconify, gdk_window_maximize, gdk_window_unmaximize,
gdk_window_focus): Use _gdk_win32_window_state_to_string() in
debugging output.
(gdk_window_iconify): Restore active window after calling
ShowWindow(). Otherwise the "next" window gets activated.
(gdk_window_stick, gdk_window_unstick): Don't output any warnings.
(gdk_window_set_transient_for): Rewrite. Just call SetWindowLong()
with GWL_HWNDPARENT, which despite its name sets the *owner*
window, which should be exactly what we want. The PSDK
documentation is said to be misleading. testgtk's modal window
test now works much better. (#50586)
2002-12-09 00:43:42 +00:00
|
|
|
/* FIXME: Do something? */
|
2001-03-09 16:43:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_maximize (GdkWindow *window)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
|
|
|
return;
|
|
|
|
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_maximize: %p: %s\n",
|
Merge from stable:
2002-12-09 Tor Lillqvist <tml@iki.fi>
Merge from stable:
* gdk/win32/gdkdrawable-win32.c (generic_draw): Don't leak
stipple_gc. More checks for errors. Use correct ternary ROP when
blitting the foreground into the tile pixmap onto those pixels
where the stipple is set. (I didn't notice that I had used the
wrong one, as it didn't matter on Win2k, where DIB sections
apparently are zeroed upon creation. But on Win98 they have random
initial contents. Thanks to Hans Breuer for reporting this.)
(gdk_win32_draw_rectangle, gdk_win32_draw_arc,
gdk_win32_draw_polygon): Don't pass the LINE_ATTRIBUTES bits to
generic_draw() if drawing a filled figure.
* gdk/win32/gdkmain-win32.c (_gdk_win32_print_dc): Minor cosmetics.
(_gdk_win32_gcvalues_mask_to_string): Initialize buffer as empty.
(_gdk_win32_window_state_to_string): New debugging output helper
function.
* gdk/win32/gdkevents-win32.c: Minor debugging output changes.
(gdk_event_translate): Ignore the WM_SHOWWINDOW/SW_OTHERUNZOOM or
SW_OTHERZOOM messages. Do not generate a GDK_UNMAP event for
WM_SIZE/SIZE_MINIMIZED messages, they do not really corrspond to
unmapping on X11. Set window state correctly for all three of
SIZE_{MINIMIZED,MAXIMIZED,RESTORED}. A maximized and then iconified
("minimized" in Windows terminology) window still has the
"maximized" property, i.e. when deiconified, it will reappear as
maximized. (#10557)
* gdk/win32/gdkprivate-win32.h: Declare new function.
(WIN32_API_FAILED, WIN32_GDI_FAILED, OTHER_API_FAILED): Don't use
__PRETTY_FUNCTION__ if __GNUC__ >= 3, to avoid warning message.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Handle more
situations. Add parameter to tell whether deiconifying. Code
reorg: Return early when appropriate instead of using nested if
statements. If just deiconifying without raising, restore active
window. (#10557)
(gdk_window_hide, gdk_window_withdraw, gdk_window_iconify,
gdk_window_deiconify, gdk_window_maximize, gdk_window_unmaximize,
gdk_window_focus): Use _gdk_win32_window_state_to_string() in
debugging output.
(gdk_window_iconify): Restore active window after calling
ShowWindow(). Otherwise the "next" window gets activated.
(gdk_window_stick, gdk_window_unstick): Don't output any warnings.
(gdk_window_set_transient_for): Rewrite. Just call SetWindowLong()
with GWL_HWNDPARENT, which despite its name sets the *owner*
window, which should be exactly what we want. The PSDK
documentation is said to be misleading. testgtk's modal window
test now works much better. (#50586)
2002-12-09 00:43:42 +00:00
|
|
|
GDK_WINDOW_HWND (window),
|
|
|
|
_gdk_win32_window_state_to_string (((GdkWindowObject *) window)->state)));
|
|
|
|
|
2001-03-09 16:43:19 +00:00
|
|
|
if (GDK_WINDOW_IS_MAPPED (window))
|
|
|
|
ShowWindow (GDK_WINDOW_HWND (window), SW_MAXIMIZE);
|
|
|
|
else
|
|
|
|
gdk_synthesize_window_state (window,
|
|
|
|
0,
|
|
|
|
GDK_WINDOW_STATE_MAXIMIZED);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_unmaximize (GdkWindow *window)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
|
|
|
return;
|
|
|
|
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_unmaximize: %p: %s\n",
|
Merge from stable:
2002-12-09 Tor Lillqvist <tml@iki.fi>
Merge from stable:
* gdk/win32/gdkdrawable-win32.c (generic_draw): Don't leak
stipple_gc. More checks for errors. Use correct ternary ROP when
blitting the foreground into the tile pixmap onto those pixels
where the stipple is set. (I didn't notice that I had used the
wrong one, as it didn't matter on Win2k, where DIB sections
apparently are zeroed upon creation. But on Win98 they have random
initial contents. Thanks to Hans Breuer for reporting this.)
(gdk_win32_draw_rectangle, gdk_win32_draw_arc,
gdk_win32_draw_polygon): Don't pass the LINE_ATTRIBUTES bits to
generic_draw() if drawing a filled figure.
* gdk/win32/gdkmain-win32.c (_gdk_win32_print_dc): Minor cosmetics.
(_gdk_win32_gcvalues_mask_to_string): Initialize buffer as empty.
(_gdk_win32_window_state_to_string): New debugging output helper
function.
* gdk/win32/gdkevents-win32.c: Minor debugging output changes.
(gdk_event_translate): Ignore the WM_SHOWWINDOW/SW_OTHERUNZOOM or
SW_OTHERZOOM messages. Do not generate a GDK_UNMAP event for
WM_SIZE/SIZE_MINIMIZED messages, they do not really corrspond to
unmapping on X11. Set window state correctly for all three of
SIZE_{MINIMIZED,MAXIMIZED,RESTORED}. A maximized and then iconified
("minimized" in Windows terminology) window still has the
"maximized" property, i.e. when deiconified, it will reappear as
maximized. (#10557)
* gdk/win32/gdkprivate-win32.h: Declare new function.
(WIN32_API_FAILED, WIN32_GDI_FAILED, OTHER_API_FAILED): Don't use
__PRETTY_FUNCTION__ if __GNUC__ >= 3, to avoid warning message.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Handle more
situations. Add parameter to tell whether deiconifying. Code
reorg: Return early when appropriate instead of using nested if
statements. If just deiconifying without raising, restore active
window. (#10557)
(gdk_window_hide, gdk_window_withdraw, gdk_window_iconify,
gdk_window_deiconify, gdk_window_maximize, gdk_window_unmaximize,
gdk_window_focus): Use _gdk_win32_window_state_to_string() in
debugging output.
(gdk_window_iconify): Restore active window after calling
ShowWindow(). Otherwise the "next" window gets activated.
(gdk_window_stick, gdk_window_unstick): Don't output any warnings.
(gdk_window_set_transient_for): Rewrite. Just call SetWindowLong()
with GWL_HWNDPARENT, which despite its name sets the *owner*
window, which should be exactly what we want. The PSDK
documentation is said to be misleading. testgtk's modal window
test now works much better. (#50586)
2002-12-09 00:43:42 +00:00
|
|
|
GDK_WINDOW_HWND (window),
|
|
|
|
_gdk_win32_window_state_to_string (((GdkWindowObject *) window)->state)));
|
|
|
|
|
2001-03-09 16:43:19 +00:00
|
|
|
if (GDK_WINDOW_IS_MAPPED (window))
|
|
|
|
ShowWindow (GDK_WINDOW_HWND (window), SW_RESTORE);
|
|
|
|
else
|
|
|
|
gdk_synthesize_window_state (window,
|
|
|
|
GDK_WINDOW_STATE_MAXIMIZED,
|
|
|
|
0);
|
|
|
|
}
|
|
|
|
|
2003-08-05 22:24:35 +00:00
|
|
|
typedef struct _FullscreenInfo FullscreenInfo;
|
|
|
|
|
|
|
|
struct _FullscreenInfo
|
|
|
|
{
|
|
|
|
RECT r;
|
|
|
|
guint hint_flags;
|
|
|
|
LONG style;
|
|
|
|
};
|
|
|
|
|
2002-11-16 21:51:47 +00:00
|
|
|
void
|
|
|
|
gdk_window_fullscreen (GdkWindow *window)
|
|
|
|
{
|
2003-08-05 22:24:35 +00:00
|
|
|
gint width, height;
|
|
|
|
FullscreenInfo *fi;
|
|
|
|
GdkWindowObject *private = (GdkWindowObject *) window;
|
|
|
|
|
2002-11-16 21:51:47 +00:00
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
2003-08-05 22:24:35 +00:00
|
|
|
fi = g_new (FullscreenInfo, 1);
|
|
|
|
|
|
|
|
if (!GetWindowRect (GDK_WINDOW_HWND (window), &(fi->r)))
|
|
|
|
g_free (fi);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (private->impl);
|
|
|
|
|
gdk/win32/gdkinput-win32.h Drop the GdkEvent* parameter, it wasn't used.
2003-08-07 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkinput-win32.h
* gdk/win32/gdkinput-win32.c (_gdk_input_configure_event,
_gdk_input_enter_event): Drop the GdkEvent* parameter, it wasn't
used.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): Adapt caller
accordingly, in fact an uninitialised variable was dereferenced.
[Win32] Add support for multiple monitors.
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkglobals-win32.c: New global variables for
multiple-monitor info: _gdk_num_monitors, _gdk_monitors, and
_gdk_offset_x and _gdk_offset_y.
* gdk/win32/gdkdisplay-win32.c (count_monitor, enum_monitor): New
functions, enumeration functions passed to EnumDisplayMonitors().
(gdk_display_open): If the EnumDisplayMonitors() and
GetMonitorInfo() API is present (on Win98, Win2000 and newer), use
if to find out monitor info.
Calculate the offset between Win32 coordinates (relative to the
primary monitor's origin (and thus negative on monitors to the
left of or above it), and GDK's (visible coordinates should be
non-negative).
* gdk/win32/gdkscreen-win32 (gdk_screen_get_n_monitors,
gdk_screen_get_monitor_geometry): Use information collected above.
(gdk_window_move, gdk_window_move_resize_window_get_geometry):
Subtract _gdk_offset_{x,y} from GDK root window coordinates.
(gdk_window_get_geometry, gdk_window_get_origin,
gdk_window_get_frame_extents): For top-level windows, add
_gdk_offset_{x,y} to GDK root window coordinates
Still need to handle multiple monitors in
gdk_window_fullscreen(). Probably should make the window
fullscreen on the monitor where the cursor is?
* gdk/win32/gdkevents-win32.c: Add _gdk_offset_{x,y} to all GDK
root window coordinates in GdkEvents.
[Win32] Fix geometry hint handling. Add support for resize
increment and base size, and aspect ratio geometry hints. The
"gridded geometry" test in testgtk now works beautifully.
* gdk/win32/gdkwindow-win32.c (gdk_window_set_geometry_hints):
Turns out this function shouldn't actually ever modify the
window's size, just store the hints. (Old code kept for a while
inside #if 0.)
(gdk_window_set_hints): Remove presumably broken code that handles
the position hints, this function is obsolete anyway.
* gdk/win32/gdkevents-win32.c: Drop the current_{x,y}_root
variables, not used.
(adjust_drag): New function, used to implement resize increment
hints.
(gdk_event_translate): Handle WM_SIZING, implement resize
increment and base size, and aspect ratio geometry hints here. The
WM_GETMINMAXINFO handler takes care of the minimum and maximum
size hints as before. Fix the WM_GETMINMAXINFO handler to take
into account window decorations. No need to modify the
ptMaxPosition and ptMaxSize fields in the MINMAXINFO struct,
the defaults are fine.
* gdk/win32/gdkprivate-win32.h
* gdk/win32/gdkwindow-win32.c (_gdk_win32_adjust_client_rect,
_gdk_win32_get_adjusted_client_rect): New helper functions.
2003-08-07 22:17:18 +00:00
|
|
|
width = GetSystemMetrics (SM_CXSCREEN);
|
|
|
|
height = GetSystemMetrics (SM_CYSCREEN);
|
|
|
|
|
2003-08-05 22:24:35 +00:00
|
|
|
/* remember for restoring */
|
|
|
|
fi->hint_flags = impl->hint_flags;
|
|
|
|
impl->hint_flags &= ~GDK_HINT_MAX_SIZE;
|
|
|
|
g_object_set_data (G_OBJECT (window), "fullscreen-info", fi);
|
|
|
|
fi->style = GetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE);
|
|
|
|
|
|
|
|
SetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE,
|
|
|
|
(fi->style & ~WS_OVERLAPPEDWINDOW) | WS_POPUP);
|
2005-03-16 01:38:57 +00:00
|
|
|
|
|
|
|
API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window), HWND_TOP,
|
|
|
|
0, 0, width, height,
|
|
|
|
SWP_NOCOPYBITS | SWP_SHOWWINDOW));
|
2003-08-05 22:24:35 +00:00
|
|
|
|
|
|
|
gdk_synthesize_window_state (window, 0, GDK_WINDOW_STATE_FULLSCREEN);
|
|
|
|
}
|
2002-11-16 21:51:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_unfullscreen (GdkWindow *window)
|
|
|
|
{
|
2003-08-05 22:24:35 +00:00
|
|
|
FullscreenInfo *fi;
|
|
|
|
GdkWindowObject *private = (GdkWindowObject *) window;
|
|
|
|
|
2002-11-16 21:51:47 +00:00
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
2003-08-05 22:24:35 +00:00
|
|
|
|
2005-11-02 13:33:27 +00:00
|
|
|
fi = g_object_get_data (G_OBJECT (window), "fullscreen-info");
|
2003-08-05 22:24:35 +00:00
|
|
|
if (fi)
|
|
|
|
{
|
|
|
|
GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (private->impl);
|
|
|
|
|
|
|
|
impl->hint_flags = fi->hint_flags;
|
|
|
|
SetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE, fi->style);
|
2005-03-16 01:38:57 +00:00
|
|
|
API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window), HWND_NOTOPMOST,
|
|
|
|
fi->r.left, fi->r.top,
|
|
|
|
fi->r.right - fi->r.left, fi->r.bottom - fi->r.top,
|
|
|
|
SWP_NOCOPYBITS | SWP_SHOWWINDOW));
|
|
|
|
|
2003-08-05 22:24:35 +00:00
|
|
|
g_object_set_data (G_OBJECT (window), "fullscreen-info", NULL);
|
|
|
|
g_free (fi);
|
|
|
|
|
|
|
|
gdk_synthesize_window_state (window, GDK_WINDOW_STATE_FULLSCREEN, 0);
|
|
|
|
}
|
2002-11-16 21:51:47 +00:00
|
|
|
}
|
|
|
|
|
2003-11-15 20:35:55 +00:00
|
|
|
void
|
|
|
|
gdk_window_set_keep_above (GdkWindow *window, gboolean setting)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (GDK_WINDOW_IS_MAPPED (window))
|
|
|
|
{
|
2005-03-16 01:38:57 +00:00
|
|
|
API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window),
|
|
|
|
setting ? HWND_TOPMOST : HWND_NOTOPMOST,
|
|
|
|
0, 0, 0, 0,
|
|
|
|
SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE));
|
2003-11-15 20:35:55 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
gdk_synthesize_window_state (window,
|
|
|
|
setting ? GDK_WINDOW_STATE_BELOW : GDK_WINDOW_STATE_ABOVE,
|
|
|
|
setting ? GDK_WINDOW_STATE_ABOVE : 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_set_keep_below (GdkWindow *window, gboolean setting)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (GDK_WINDOW_IS_MAPPED (window))
|
|
|
|
{
|
2005-03-16 01:38:57 +00:00
|
|
|
API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window),
|
|
|
|
setting ? HWND_BOTTOM : HWND_NOTOPMOST,
|
|
|
|
0, 0, 0, 0,
|
|
|
|
SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE));
|
2003-11-15 20:35:55 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
gdk_synthesize_window_state (window,
|
|
|
|
setting ? GDK_WINDOW_STATE_ABOVE : GDK_WINDOW_STATE_BELOW,
|
|
|
|
setting ? GDK_WINDOW_STATE_BELOW : 0);
|
|
|
|
}
|
|
|
|
|
2001-03-09 16:43:19 +00:00
|
|
|
void
|
|
|
|
gdk_window_focus (GdkWindow *window,
|
|
|
|
guint32 timestamp)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
|
|
|
return;
|
|
|
|
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_focus: %p: %s\n",
|
Merge from stable:
2002-12-09 Tor Lillqvist <tml@iki.fi>
Merge from stable:
* gdk/win32/gdkdrawable-win32.c (generic_draw): Don't leak
stipple_gc. More checks for errors. Use correct ternary ROP when
blitting the foreground into the tile pixmap onto those pixels
where the stipple is set. (I didn't notice that I had used the
wrong one, as it didn't matter on Win2k, where DIB sections
apparently are zeroed upon creation. But on Win98 they have random
initial contents. Thanks to Hans Breuer for reporting this.)
(gdk_win32_draw_rectangle, gdk_win32_draw_arc,
gdk_win32_draw_polygon): Don't pass the LINE_ATTRIBUTES bits to
generic_draw() if drawing a filled figure.
* gdk/win32/gdkmain-win32.c (_gdk_win32_print_dc): Minor cosmetics.
(_gdk_win32_gcvalues_mask_to_string): Initialize buffer as empty.
(_gdk_win32_window_state_to_string): New debugging output helper
function.
* gdk/win32/gdkevents-win32.c: Minor debugging output changes.
(gdk_event_translate): Ignore the WM_SHOWWINDOW/SW_OTHERUNZOOM or
SW_OTHERZOOM messages. Do not generate a GDK_UNMAP event for
WM_SIZE/SIZE_MINIMIZED messages, they do not really corrspond to
unmapping on X11. Set window state correctly for all three of
SIZE_{MINIMIZED,MAXIMIZED,RESTORED}. A maximized and then iconified
("minimized" in Windows terminology) window still has the
"maximized" property, i.e. when deiconified, it will reappear as
maximized. (#10557)
* gdk/win32/gdkprivate-win32.h: Declare new function.
(WIN32_API_FAILED, WIN32_GDI_FAILED, OTHER_API_FAILED): Don't use
__PRETTY_FUNCTION__ if __GNUC__ >= 3, to avoid warning message.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Handle more
situations. Add parameter to tell whether deiconifying. Code
reorg: Return early when appropriate instead of using nested if
statements. If just deiconifying without raising, restore active
window. (#10557)
(gdk_window_hide, gdk_window_withdraw, gdk_window_iconify,
gdk_window_deiconify, gdk_window_maximize, gdk_window_unmaximize,
gdk_window_focus): Use _gdk_win32_window_state_to_string() in
debugging output.
(gdk_window_iconify): Restore active window after calling
ShowWindow(). Otherwise the "next" window gets activated.
(gdk_window_stick, gdk_window_unstick): Don't output any warnings.
(gdk_window_set_transient_for): Rewrite. Just call SetWindowLong()
with GWL_HWNDPARENT, which despite its name sets the *owner*
window, which should be exactly what we want. The PSDK
documentation is said to be misleading. testgtk's modal window
test now works much better. (#50586)
2002-12-09 00:43:42 +00:00
|
|
|
GDK_WINDOW_HWND (window),
|
|
|
|
_gdk_win32_window_state_to_string (((GdkWindowObject *) window)->state)));
|
2002-03-06 00:36:08 +00:00
|
|
|
|
2003-11-15 04:22:16 +00:00
|
|
|
if (((GdkWindowObject *) window)->state & GDK_WINDOW_STATE_MAXIMIZED)
|
|
|
|
ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWMAXIMIZED);
|
|
|
|
else
|
|
|
|
ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWNORMAL);
|
2002-03-06 00:36:08 +00:00
|
|
|
SetFocus (GDK_WINDOW_HWND (window));
|
2001-03-09 16:43:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_set_modal_hint (GdkWindow *window,
|
|
|
|
gboolean modal)
|
|
|
|
{
|
|
|
|
GdkWindowObject *private;
|
|
|
|
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
|
|
|
return;
|
|
|
|
|
|
|
|
private = (GdkWindowObject*) window;
|
|
|
|
|
|
|
|
private->modal_hint = modal;
|
|
|
|
|
2007-07-12 23:38:30 +00:00
|
|
|
#if 0
|
|
|
|
/* Not sure about this one.. -- Cody */
|
2001-03-09 16:43:19 +00:00
|
|
|
if (GDK_WINDOW_IS_MAPPED (window))
|
2003-08-05 22:24:35 +00:00
|
|
|
API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window),
|
|
|
|
modal ? HWND_TOPMOST : HWND_NOTOPMOST,
|
2005-03-16 01:38:57 +00:00
|
|
|
0, 0, 0, 0,
|
|
|
|
SWP_NOMOVE | SWP_NOSIZE));
|
2007-07-12 23:38:30 +00:00
|
|
|
#endif
|
2001-03-09 16:43:19 +00:00
|
|
|
}
|
|
|
|
|
2002-11-16 21:51:47 +00:00
|
|
|
void
|
|
|
|
gdk_window_set_skip_taskbar_hint (GdkWindow *window,
|
|
|
|
gboolean skips_taskbar)
|
|
|
|
{
|
Merge from stable:
2003-12-14 Tor Lillqvist <tml@iki.fi>
Merge from stable:
* gdk/gdkdisplaymanager.c: Mark default_display static.
* gdk/win32/gdkdnd-win32.c: Mark current_dest_drag static.
* gdk/win32/gdkkeys-win32.c: Disable some overly verbose debugging
output.
* gdk/win32/gdkevents-win32.c: Clean up the debugging output from
--gdk-debug=events. In general, output just one line of debugging
output for each Windows message, plus one line for each GDK event
generated. Indent all lines according to window procedure nesting
level.
(inner_window_procedure): Rename from real_window_procedure.
(find_real_window_for_grabbed_mouse_event): Don't get misled when
the point is in the non-client (decoration) area of the window
returned by WindowFromPoint(). Return the root window in that
case.
(build_pointer_event_state): Test also MK_XBUTTON1 and
MK_XBUTTON2 (buttons 4 and 5).
(synthesize_enter_event): Track the mouse leaving the window in
the event being generated, not the one mentioned in the Windows
message.
(propagate): Test for NULL parent earlier. Improves event
generation from a grabbed pointer. Part of fix for #107320.
(handle_stuff_while_moving_or_resizing): New function, to
dispatch the main loop (once).
(resize_timer_proc): New function, set to be called by an inerval
timer during resizes/moves. Calls handle_stuff_while_moving_or_resizing().
(gdk_event_translate): Drop unused return_exposes parameter.
Handle WM_XBUTTONDOWN and UP messages (buttons 4 and 5).
On WM_SYSKEYUP, generate a key release event also for just the Alt
key.
On WM_MOUSELEAVE, generate a leave event of type
GDK_NOTIFY_ANCESTOR (and not UNKNOWN) if the mouse left a
top-level window, and left the app completely.
On WM_ENTERSIZEMOVE, set a flag, and start an interval timer that
calls resize_timer_proc() at regular intervals. On
WM_EXITSIZEMOVE, kill the timer.
On WM_WINDOWPOSCHANGED, generate a configure event if necessary,
and dispatch the main loop (by calling
handle_stuff_while_moving_or_resizing()). Fixes #99540, idea by
Herman Bloggs.
* gdk/win32/gdkmain-win32.c (_gdk_win32_message_to_string): Handle
also wintab messages.
* gdk/win32/gdkwindow-win32.c (gdk_window_set_skip_taskbar_hint):
Instead of using WS_EX_TOOLWINDOW, implement by setting/unsetting
the window's owner. Fixes #118093, reported by Maxime Romano.
2003-12-14 01:57:54 +00:00
|
|
|
static GdkWindow *owner = NULL;
|
|
|
|
GdkWindowAttr wa;
|
2003-01-12 04:44:23 +00:00
|
|
|
|
2002-11-16 21:51:47 +00:00
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
2003-01-12 04:44:23 +00:00
|
|
|
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_set_skip_taskbar_hint: %p: %s\n",
|
2003-01-12 04:44:23 +00:00
|
|
|
GDK_WINDOW_HWND (window),
|
|
|
|
skips_taskbar ? "TRUE" : "FALSE"));
|
|
|
|
|
|
|
|
if (skips_taskbar)
|
Merge from stable:
2003-12-14 Tor Lillqvist <tml@iki.fi>
Merge from stable:
* gdk/gdkdisplaymanager.c: Mark default_display static.
* gdk/win32/gdkdnd-win32.c: Mark current_dest_drag static.
* gdk/win32/gdkkeys-win32.c: Disable some overly verbose debugging
output.
* gdk/win32/gdkevents-win32.c: Clean up the debugging output from
--gdk-debug=events. In general, output just one line of debugging
output for each Windows message, plus one line for each GDK event
generated. Indent all lines according to window procedure nesting
level.
(inner_window_procedure): Rename from real_window_procedure.
(find_real_window_for_grabbed_mouse_event): Don't get misled when
the point is in the non-client (decoration) area of the window
returned by WindowFromPoint(). Return the root window in that
case.
(build_pointer_event_state): Test also MK_XBUTTON1 and
MK_XBUTTON2 (buttons 4 and 5).
(synthesize_enter_event): Track the mouse leaving the window in
the event being generated, not the one mentioned in the Windows
message.
(propagate): Test for NULL parent earlier. Improves event
generation from a grabbed pointer. Part of fix for #107320.
(handle_stuff_while_moving_or_resizing): New function, to
dispatch the main loop (once).
(resize_timer_proc): New function, set to be called by an inerval
timer during resizes/moves. Calls handle_stuff_while_moving_or_resizing().
(gdk_event_translate): Drop unused return_exposes parameter.
Handle WM_XBUTTONDOWN and UP messages (buttons 4 and 5).
On WM_SYSKEYUP, generate a key release event also for just the Alt
key.
On WM_MOUSELEAVE, generate a leave event of type
GDK_NOTIFY_ANCESTOR (and not UNKNOWN) if the mouse left a
top-level window, and left the app completely.
On WM_ENTERSIZEMOVE, set a flag, and start an interval timer that
calls resize_timer_proc() at regular intervals. On
WM_EXITSIZEMOVE, kill the timer.
On WM_WINDOWPOSCHANGED, generate a configure event if necessary,
and dispatch the main loop (by calling
handle_stuff_while_moving_or_resizing()). Fixes #99540, idea by
Herman Bloggs.
* gdk/win32/gdkmain-win32.c (_gdk_win32_message_to_string): Handle
also wintab messages.
* gdk/win32/gdkwindow-win32.c (gdk_window_set_skip_taskbar_hint):
Instead of using WS_EX_TOOLWINDOW, implement by setting/unsetting
the window's owner. Fixes #118093, reported by Maxime Romano.
2003-12-14 01:57:54 +00:00
|
|
|
{
|
|
|
|
if (owner == NULL)
|
|
|
|
{
|
|
|
|
wa.window_type = GDK_WINDOW_TEMP;
|
|
|
|
wa.wclass = GDK_INPUT_OUTPUT;
|
|
|
|
wa.width = wa.height = 1;
|
|
|
|
wa.event_mask = 0;
|
2004-08-22 19:16:22 +00:00
|
|
|
owner = gdk_window_new_internal (NULL, &wa, 0, TRUE);
|
Merge from stable:
2003-12-14 Tor Lillqvist <tml@iki.fi>
Merge from stable:
* gdk/gdkdisplaymanager.c: Mark default_display static.
* gdk/win32/gdkdnd-win32.c: Mark current_dest_drag static.
* gdk/win32/gdkkeys-win32.c: Disable some overly verbose debugging
output.
* gdk/win32/gdkevents-win32.c: Clean up the debugging output from
--gdk-debug=events. In general, output just one line of debugging
output for each Windows message, plus one line for each GDK event
generated. Indent all lines according to window procedure nesting
level.
(inner_window_procedure): Rename from real_window_procedure.
(find_real_window_for_grabbed_mouse_event): Don't get misled when
the point is in the non-client (decoration) area of the window
returned by WindowFromPoint(). Return the root window in that
case.
(build_pointer_event_state): Test also MK_XBUTTON1 and
MK_XBUTTON2 (buttons 4 and 5).
(synthesize_enter_event): Track the mouse leaving the window in
the event being generated, not the one mentioned in the Windows
message.
(propagate): Test for NULL parent earlier. Improves event
generation from a grabbed pointer. Part of fix for #107320.
(handle_stuff_while_moving_or_resizing): New function, to
dispatch the main loop (once).
(resize_timer_proc): New function, set to be called by an inerval
timer during resizes/moves. Calls handle_stuff_while_moving_or_resizing().
(gdk_event_translate): Drop unused return_exposes parameter.
Handle WM_XBUTTONDOWN and UP messages (buttons 4 and 5).
On WM_SYSKEYUP, generate a key release event also for just the Alt
key.
On WM_MOUSELEAVE, generate a leave event of type
GDK_NOTIFY_ANCESTOR (and not UNKNOWN) if the mouse left a
top-level window, and left the app completely.
On WM_ENTERSIZEMOVE, set a flag, and start an interval timer that
calls resize_timer_proc() at regular intervals. On
WM_EXITSIZEMOVE, kill the timer.
On WM_WINDOWPOSCHANGED, generate a configure event if necessary,
and dispatch the main loop (by calling
handle_stuff_while_moving_or_resizing()). Fixes #99540, idea by
Herman Bloggs.
* gdk/win32/gdkmain-win32.c (_gdk_win32_message_to_string): Handle
also wintab messages.
* gdk/win32/gdkwindow-win32.c (gdk_window_set_skip_taskbar_hint):
Instead of using WS_EX_TOOLWINDOW, implement by setting/unsetting
the window's owner. Fixes #118093, reported by Maxime Romano.
2003-12-14 01:57:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SetWindowLong (GDK_WINDOW_HWND (window), GWL_HWNDPARENT,
|
|
|
|
(long) GDK_WINDOW_HWND (owner));
|
2003-01-12 04:44:23 +00:00
|
|
|
|
Merge from stable:
2003-12-14 Tor Lillqvist <tml@iki.fi>
Merge from stable:
* gdk/gdkdisplaymanager.c: Mark default_display static.
* gdk/win32/gdkdnd-win32.c: Mark current_dest_drag static.
* gdk/win32/gdkkeys-win32.c: Disable some overly verbose debugging
output.
* gdk/win32/gdkevents-win32.c: Clean up the debugging output from
--gdk-debug=events. In general, output just one line of debugging
output for each Windows message, plus one line for each GDK event
generated. Indent all lines according to window procedure nesting
level.
(inner_window_procedure): Rename from real_window_procedure.
(find_real_window_for_grabbed_mouse_event): Don't get misled when
the point is in the non-client (decoration) area of the window
returned by WindowFromPoint(). Return the root window in that
case.
(build_pointer_event_state): Test also MK_XBUTTON1 and
MK_XBUTTON2 (buttons 4 and 5).
(synthesize_enter_event): Track the mouse leaving the window in
the event being generated, not the one mentioned in the Windows
message.
(propagate): Test for NULL parent earlier. Improves event
generation from a grabbed pointer. Part of fix for #107320.
(handle_stuff_while_moving_or_resizing): New function, to
dispatch the main loop (once).
(resize_timer_proc): New function, set to be called by an inerval
timer during resizes/moves. Calls handle_stuff_while_moving_or_resizing().
(gdk_event_translate): Drop unused return_exposes parameter.
Handle WM_XBUTTONDOWN and UP messages (buttons 4 and 5).
On WM_SYSKEYUP, generate a key release event also for just the Alt
key.
On WM_MOUSELEAVE, generate a leave event of type
GDK_NOTIFY_ANCESTOR (and not UNKNOWN) if the mouse left a
top-level window, and left the app completely.
On WM_ENTERSIZEMOVE, set a flag, and start an interval timer that
calls resize_timer_proc() at regular intervals. On
WM_EXITSIZEMOVE, kill the timer.
On WM_WINDOWPOSCHANGED, generate a configure event if necessary,
and dispatch the main loop (by calling
handle_stuff_while_moving_or_resizing()). Fixes #99540, idea by
Herman Bloggs.
* gdk/win32/gdkmain-win32.c (_gdk_win32_message_to_string): Handle
also wintab messages.
* gdk/win32/gdkwindow-win32.c (gdk_window_set_skip_taskbar_hint):
Instead of using WS_EX_TOOLWINDOW, implement by setting/unsetting
the window's owner. Fixes #118093, reported by Maxime Romano.
2003-12-14 01:57:54 +00:00
|
|
|
#if 0 /* Should we also turn off the minimize and maximize buttons? */
|
|
|
|
SetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE,
|
|
|
|
GetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE) & ~(WS_MINIMIZEBOX|WS_MAXIMIZEBOX|WS_SYSMENU));
|
2005-03-16 01:38:57 +00:00
|
|
|
SetWindowPos (GDK_WINDOW_HWND (window), NULL,
|
|
|
|
0, 0, 0, 0,
|
Merge from stable:
2003-12-14 Tor Lillqvist <tml@iki.fi>
Merge from stable:
* gdk/gdkdisplaymanager.c: Mark default_display static.
* gdk/win32/gdkdnd-win32.c: Mark current_dest_drag static.
* gdk/win32/gdkkeys-win32.c: Disable some overly verbose debugging
output.
* gdk/win32/gdkevents-win32.c: Clean up the debugging output from
--gdk-debug=events. In general, output just one line of debugging
output for each Windows message, plus one line for each GDK event
generated. Indent all lines according to window procedure nesting
level.
(inner_window_procedure): Rename from real_window_procedure.
(find_real_window_for_grabbed_mouse_event): Don't get misled when
the point is in the non-client (decoration) area of the window
returned by WindowFromPoint(). Return the root window in that
case.
(build_pointer_event_state): Test also MK_XBUTTON1 and
MK_XBUTTON2 (buttons 4 and 5).
(synthesize_enter_event): Track the mouse leaving the window in
the event being generated, not the one mentioned in the Windows
message.
(propagate): Test for NULL parent earlier. Improves event
generation from a grabbed pointer. Part of fix for #107320.
(handle_stuff_while_moving_or_resizing): New function, to
dispatch the main loop (once).
(resize_timer_proc): New function, set to be called by an inerval
timer during resizes/moves. Calls handle_stuff_while_moving_or_resizing().
(gdk_event_translate): Drop unused return_exposes parameter.
Handle WM_XBUTTONDOWN and UP messages (buttons 4 and 5).
On WM_SYSKEYUP, generate a key release event also for just the Alt
key.
On WM_MOUSELEAVE, generate a leave event of type
GDK_NOTIFY_ANCESTOR (and not UNKNOWN) if the mouse left a
top-level window, and left the app completely.
On WM_ENTERSIZEMOVE, set a flag, and start an interval timer that
calls resize_timer_proc() at regular intervals. On
WM_EXITSIZEMOVE, kill the timer.
On WM_WINDOWPOSCHANGED, generate a configure event if necessary,
and dispatch the main loop (by calling
handle_stuff_while_moving_or_resizing()). Fixes #99540, idea by
Herman Bloggs.
* gdk/win32/gdkmain-win32.c (_gdk_win32_message_to_string): Handle
also wintab messages.
* gdk/win32/gdkwindow-win32.c (gdk_window_set_skip_taskbar_hint):
Instead of using WS_EX_TOOLWINDOW, implement by setting/unsetting
the window's owner. Fixes #118093, reported by Maxime Romano.
2003-12-14 01:57:54 +00:00
|
|
|
SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOMOVE |
|
|
|
|
SWP_NOREPOSITION | SWP_NOSIZE | SWP_NOZORDER);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SetWindowLong (GDK_WINDOW_HWND (window), GWL_HWNDPARENT, 0);
|
|
|
|
}
|
2002-11-16 21:51:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_set_skip_pager_hint (GdkWindow *window,
|
|
|
|
gboolean skips_pager)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
}
|
|
|
|
|
2001-03-09 16:43:19 +00:00
|
|
|
void
|
|
|
|
gdk_window_set_type_hint (GdkWindow *window,
|
|
|
|
GdkWindowTypeHint hint)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
|
|
|
return;
|
|
|
|
|
Fix for #108007, #112402, #117042: There was confusion in gdk/win32 at
2003-07-29 Tor Lillqvist <tml@iki.fi>
Fix for #108007, #112402, #117042: There was confusion in
gdk/win32 at various places whether a window position refers to
the decoration position or the client area position. Also whether
window size includes decorations or not.
The correct interpretation apparently is that in GDK (like in
X11), a top-level window position means the decoration's position,
but size means the window's inner size (client area size). In the
Win32 API, the window size usually includes the decorations,
though.
* gdk/win32/gdkevents-win32.c (decode_key_lparam): Move inside
#ifdef G_ENABLE_DEBUG.
(handle_configure_event): New function, generates GDK_CONFIGURE
events from WM_SIZE and WM_MOVE messages. Even if no event is
generated because of the event mask, still set the private
position and size fields. Calculate position and size correctly.
(gdk_event_translate): Call handle_configure_event().
* gdk/win32/gdkgeometry-win32.c: Cosmetics.
* gdk/win32/gdkwindow-win32.c: Use GDI_CALL() and API_CALL()
macros. Cosmetic debugging output changes.
(SafeAdjustWindowRectEx): Remove. If an application wants to
locate a window outside of the screen, it's not GDK's business to
prevent it. And anyway, with multiple monitors, negative
coordinates are perfectly normal.
(gdk_window_new): Adjust the window size for decorations after
_gdk_window_init_position() has done its job. (But the big window
code currently is presumably broken on Win32 anyway.)
(gdk_window_move): The position passed in is supposed to be that
of the window border, so don't need to adjust for decorations.
(gdk_window_resize, gdk_window_move_resize): Simplify somewhat.
2003-07-29 23:35:40 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_set_type_hint: %p: %d\n",
|
2003-01-12 04:44:23 +00:00
|
|
|
GDK_WINDOW_HWND (window), hint));
|
2005-11-09 02:13:35 +00:00
|
|
|
|
2005-11-27 02:58:09 +00:00
|
|
|
((GdkWindowImplWin32 *)((GdkWindowObject *)window)->impl)->type_hint = hint;
|
2005-11-09 02:13:35 +00:00
|
|
|
|
2006-02-09 02:58:45 +00:00
|
|
|
update_style_bits (window);
|
2001-03-09 16:43:19 +00:00
|
|
|
}
|
|
|
|
|
2005-11-09 02:13:35 +00:00
|
|
|
GdkWindowTypeHint
|
|
|
|
gdk_window_get_type_hint (GdkWindow *window)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GDK_IS_WINDOW (window), GDK_WINDOW_TYPE_HINT_NORMAL);
|
|
|
|
|
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
|
|
|
return GDK_WINDOW_TYPE_HINT_NORMAL;
|
|
|
|
|
|
|
|
return GDK_WINDOW_IMPL_WIN32 (((GdkWindowObject *) window)->impl)->type_hint;
|
|
|
|
}
|
|
|
|
|
2001-03-09 16:43:19 +00:00
|
|
|
void
|
|
|
|
gdk_window_shape_combine_region (GdkWindow *window,
|
|
|
|
GdkRegion *shape_region,
|
|
|
|
gint offset_x,
|
|
|
|
gint offset_y)
|
|
|
|
{
|
2006-02-20 10:08:37 +00:00
|
|
|
GdkWindowObject *private = (GdkWindowObject *)window;
|
|
|
|
|
2001-03-09 16:43:19 +00:00
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
|
|
|
return;
|
|
|
|
|
2006-02-20 10:08:37 +00:00
|
|
|
if (!shape_region)
|
|
|
|
{
|
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_shape_combine_region: %p: none\n",
|
|
|
|
GDK_WINDOW_HWND (window)));
|
|
|
|
SetWindowRgn (GDK_WINDOW_HWND (window), NULL, TRUE);
|
|
|
|
|
|
|
|
private->shaped = FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
HRGN hrgn;
|
|
|
|
|
|
|
|
hrgn = _gdk_win32_gdkregion_to_hrgn (shape_region, 0, 0);
|
|
|
|
|
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_shape_combine_region: %p: %p\n",
|
|
|
|
GDK_WINDOW_HWND (window),
|
|
|
|
hrgn));
|
|
|
|
|
|
|
|
do_shape_combine_region (window, hrgn, offset_x, offset_y);
|
|
|
|
|
|
|
|
private->shaped = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_input_shape_combine_region (GdkWindow *window,
|
|
|
|
GdkRegion *shape_region,
|
|
|
|
gint offset_x,
|
|
|
|
gint offset_y)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
|
|
|
/* Not yet implemented. See comment in
|
|
|
|
* gdk_window_input_shape_combine_mask().
|
|
|
|
*/
|
2001-03-09 16:43:19 +00:00
|
|
|
}
|
2001-03-31 19:33:49 +00:00
|
|
|
|
Changes multihead reorganizing code for win32 support, mostly from a patch
Wed Jun 5 18:34:47 2002 Owen Taylor <otaylor@redhat.com>
Changes multihead reorganizing code for win32 support,
mostly from a patch by Hans Breuer.
* gdk/gdkcolor.c gdk/x11/gdkcolor-x11.c gdk/gdkcursor.c
gdk/x11/gdkcursor-x11.c gdk/gdkevents.c gdk/x11/gdkevents-x11.c
gdk/gdkfont.c gdk/x11/gdkfont-x11.c gdk/gdkkeys.c
gdk/x11/gdkkeys-x11.c gdk/gdkimage.c gdk/x11/gdkimage-x11.c
gdk/gdkscreen.c gdk/x11/gdkmain-x11.c
gdk/gdkdisplay.c gdk/gdkevents-x11.c gdk/gdkpango.c
gdk/x11/gdkpango-x11.c gdk/gdkselection.c
gdk/x11/gdkselection-x11.c gdk/gdkwindow.c
gdk/x11/gdkwindow-x11.c gdk/gdkvisual.c gdk/x11/gdkvisual-x11.c:
Move port-independent singlehead wrapper functions into
port-independent part of GDK. (#80009)
* gdk/win32/gdkcolor-win32.c gdk/win32/gdkcursor-win32.c
gdk/win32/gdkevents-win32.c gdk/win32/gdkfont-win32.c
gdk/win32/gdkimage-win32.c gdk/win32/gdkkeys-win32.c
gdk/win32/gdkmain-win32.c gdk/win32/gdkproperty-win32.c
gdk/win32/gdkselection-win32.c gdk/win32/gkwindow-win32.c:
Turn singlehead functions into "multihead" functions that ignore
their GdkDisplay or GdkScreen arguments.
* gdk/win32/gdkdrawable-win32.c gdk/win32/gdkevents-win32.c
gdk/win32/gdkinput-win32.c gdk/win32/gdkprivate-win32.h:
Misc multihead-compatibility changes.
* gtk/gtk.def gdk/gdk.def: Update for multihead functions.
* gdk/gdkcolormap.h gdk/gdkvisual.h gdk/x11/gdkcolormap-x11.c
gdk/x11/gdkvisual-x11.c: Remove the screen fields
from the public parts of the colormap/visual structures, add accessors
instead.
* gdk/gdkpixbuf-render.c gdk/gdkpixmap.c gdk/gdkrgb.c
gdk/x11/gdkcolormap-x11.c gdk/x11/gdkimage-x11.c
gdk/x11/gdkimage-x11.c gdk/x11/gdkprivate-x11.h gtk/gtkgc.c
gtk/gtkstyle.c gtk/gtkwidget.c: Use accessors to get the screen
for colormaps, visuals; move the fields into the private
structures for the x11 backend.
* gdk/gdkdisplay.[ch] gdk/x11/gdkdisplay-x11.[ch]
gdk/gdkscreen.[ch] gdk/x11/gdkscreen-x11.c:
Remove virtualization of screen and display functions.
(#79990, patch from Erwann Chenede)
* gdk/win32/gdkdisplay-x11.c gdk/win32/gdkscreen-win32.c
gdk/win32/{Makefile.am, makefile.msc, makefile.mingw}:
New files containing stub implementations of Display,
Screen functions.
* gdk/x11/gdkscreen-x11.[ch] gdk/x11/gdkdisplay-x11.[ch]
gdk/x11/gdkx.h: Clean up function exports and what
headers they are in. (#79954)
* gdk/x11/gdkx.h: Fix macro that was referring to a non-existant
screen->screen_num. (In the patch for #79972, Erwann Chenede)
* gdk/gdkscreen.c gdk/gdkwindow.c gdk/x11/gdkinternals.h
gdk/x11/gdkscreen-x11.c: Fix gdk_screen_get_window_at_pointer()
to use window hooks. (#79972, patch partly from Erwann Chenede)
* gdk/x11/gdkdisplay-x11.c gdk/x11/gdkevents-x11.c: Fix
some warnings.
2002-06-06 00:26:42 +00:00
|
|
|
GdkWindow *
|
|
|
|
gdk_window_lookup_for_display (GdkDisplay *display, GdkNativeWindow anid)
|
|
|
|
{
|
2005-11-02 13:33:27 +00:00
|
|
|
g_return_val_if_fail (display == _gdk_display, NULL);
|
Changes multihead reorganizing code for win32 support, mostly from a patch
Wed Jun 5 18:34:47 2002 Owen Taylor <otaylor@redhat.com>
Changes multihead reorganizing code for win32 support,
mostly from a patch by Hans Breuer.
* gdk/gdkcolor.c gdk/x11/gdkcolor-x11.c gdk/gdkcursor.c
gdk/x11/gdkcursor-x11.c gdk/gdkevents.c gdk/x11/gdkevents-x11.c
gdk/gdkfont.c gdk/x11/gdkfont-x11.c gdk/gdkkeys.c
gdk/x11/gdkkeys-x11.c gdk/gdkimage.c gdk/x11/gdkimage-x11.c
gdk/gdkscreen.c gdk/x11/gdkmain-x11.c
gdk/gdkdisplay.c gdk/gdkevents-x11.c gdk/gdkpango.c
gdk/x11/gdkpango-x11.c gdk/gdkselection.c
gdk/x11/gdkselection-x11.c gdk/gdkwindow.c
gdk/x11/gdkwindow-x11.c gdk/gdkvisual.c gdk/x11/gdkvisual-x11.c:
Move port-independent singlehead wrapper functions into
port-independent part of GDK. (#80009)
* gdk/win32/gdkcolor-win32.c gdk/win32/gdkcursor-win32.c
gdk/win32/gdkevents-win32.c gdk/win32/gdkfont-win32.c
gdk/win32/gdkimage-win32.c gdk/win32/gdkkeys-win32.c
gdk/win32/gdkmain-win32.c gdk/win32/gdkproperty-win32.c
gdk/win32/gdkselection-win32.c gdk/win32/gkwindow-win32.c:
Turn singlehead functions into "multihead" functions that ignore
their GdkDisplay or GdkScreen arguments.
* gdk/win32/gdkdrawable-win32.c gdk/win32/gdkevents-win32.c
gdk/win32/gdkinput-win32.c gdk/win32/gdkprivate-win32.h:
Misc multihead-compatibility changes.
* gtk/gtk.def gdk/gdk.def: Update for multihead functions.
* gdk/gdkcolormap.h gdk/gdkvisual.h gdk/x11/gdkcolormap-x11.c
gdk/x11/gdkvisual-x11.c: Remove the screen fields
from the public parts of the colormap/visual structures, add accessors
instead.
* gdk/gdkpixbuf-render.c gdk/gdkpixmap.c gdk/gdkrgb.c
gdk/x11/gdkcolormap-x11.c gdk/x11/gdkimage-x11.c
gdk/x11/gdkimage-x11.c gdk/x11/gdkprivate-x11.h gtk/gtkgc.c
gtk/gtkstyle.c gtk/gtkwidget.c: Use accessors to get the screen
for colormaps, visuals; move the fields into the private
structures for the x11 backend.
* gdk/gdkdisplay.[ch] gdk/x11/gdkdisplay-x11.[ch]
gdk/gdkscreen.[ch] gdk/x11/gdkscreen-x11.c:
Remove virtualization of screen and display functions.
(#79990, patch from Erwann Chenede)
* gdk/win32/gdkdisplay-x11.c gdk/win32/gdkscreen-win32.c
gdk/win32/{Makefile.am, makefile.msc, makefile.mingw}:
New files containing stub implementations of Display,
Screen functions.
* gdk/x11/gdkscreen-x11.[ch] gdk/x11/gdkdisplay-x11.[ch]
gdk/x11/gdkx.h: Clean up function exports and what
headers they are in. (#79954)
* gdk/x11/gdkx.h: Fix macro that was referring to a non-existant
screen->screen_num. (In the patch for #79972, Erwann Chenede)
* gdk/gdkscreen.c gdk/gdkwindow.c gdk/x11/gdkinternals.h
gdk/x11/gdkscreen-x11.c: Fix gdk_screen_get_window_at_pointer()
to use window hooks. (#79972, patch partly from Erwann Chenede)
* gdk/x11/gdkdisplay-x11.c gdk/x11/gdkevents-x11.c: Fix
some warnings.
2002-06-06 00:26:42 +00:00
|
|
|
|
|
|
|
return gdk_window_lookup (anid);
|
|
|
|
}
|
2004-07-11 13:26:57 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_enable_synchronized_configure (GdkWindow *window)
|
|
|
|
{
|
2006-02-20 10:08:37 +00:00
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
2004-07-11 13:26:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-08-06 19:20:42 +00:00
|
|
|
gdk_window_configure_finished (GdkWindow *window)
|
2004-07-11 13:26:57 +00:00
|
|
|
{
|
2006-02-20 10:08:37 +00:00
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
2004-07-11 13:26:57 +00:00
|
|
|
}
|
2006-08-30 03:30:43 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_beep (GdkWindow *window)
|
|
|
|
{
|
2006-09-02 21:42:42 +00:00
|
|
|
gdk_display_beep (_gdk_display);
|
2006-08-30 03:30:43 +00:00
|
|
|
}
|
2007-04-30 07:27:22 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
gdk_window_set_opacity (GdkWindow *window,
|
|
|
|
gdouble opacity)
|
|
|
|
{
|
|
|
|
LONG exstyle;
|
2007-06-15 15:25:50 +00:00
|
|
|
typedef BOOL (*PFN_SetLayeredWindowAttributes) (HWND, COLORREF, BYTE, DWORD);
|
|
|
|
PFN_SetLayeredWindowAttributes setLayeredWindowAttributes = NULL;
|
2007-04-30 07:27:22 +00:00
|
|
|
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
g_return_if_fail (WINDOW_IS_TOPLEVEL (window));
|
|
|
|
|
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (opacity < 0)
|
|
|
|
opacity = 0;
|
|
|
|
else if (opacity > 1)
|
|
|
|
opacity = 1;
|
|
|
|
|
|
|
|
exstyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_EXSTYLE);
|
|
|
|
|
|
|
|
if (!(exstyle & WS_EX_LAYERED))
|
|
|
|
API_CALL (SetWindowLong, (GDK_WINDOW_HWND (window),
|
|
|
|
GWL_EXSTYLE,
|
|
|
|
exstyle | WS_EX_LAYERED));
|
|
|
|
|
2007-06-15 15:25:50 +00:00
|
|
|
setLayeredWindowAttributes =
|
|
|
|
(PFN_SetLayeredWindowAttributes)GetProcAddress (GetModuleHandle ("user32.dll"), "SetLayeredWindowAttributes");
|
|
|
|
|
|
|
|
if (setLayeredWindowAttributes)
|
|
|
|
{
|
|
|
|
API_CALL (setLayeredWindowAttributes, (GDK_WINDOW_HWND (window),
|
|
|
|
0,
|
|
|
|
opacity * 0xff,
|
|
|
|
LWA_ALPHA));
|
|
|
|
}
|
2007-04-30 07:27:22 +00:00
|
|
|
}
|
2007-06-01 12:16:12 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
_gdk_windowing_window_set_composited (GdkWindow *window, gboolean composited)
|
|
|
|
{
|
|
|
|
}
|