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
|
2011-01-02 10:51:25 +00:00
|
|
|
* Copyright (C) 2001-2011 Hans Breuer
|
2009-03-01 13:55:50 +00:00
|
|
|
* Copyright (C) 2007-2009 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
|
2012-02-27 13:01:10 +00:00
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
1999-11-11 22:12:27 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
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
|
2015-04-29 07:31:08 +00:00
|
|
|
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
1999-11-11 22:12:27 +00:00
|
|
|
*/
|
|
|
|
|
2008-06-22 14:28:52 +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"
|
2008-07-02 06:06:29 +00:00
|
|
|
#include "gdkwindowimpl.h"
|
1999-11-20 01:22:57 +00:00
|
|
|
#include "gdkprivate-win32.h"
|
2010-05-25 22:38:44 +00:00
|
|
|
#include "gdkdeviceprivate.h"
|
|
|
|
#include "gdkdevicemanager-win32.h"
|
2008-10-05 00:00:10 +00:00
|
|
|
#include "gdkenumtypes.h"
|
2011-01-02 10:51:25 +00:00
|
|
|
#include "gdkwin32.h"
|
|
|
|
#include "gdkdisplayprivate.h"
|
|
|
|
#include "gdkvisualprivate.h"
|
2016-06-27 05:16:43 +00:00
|
|
|
#include "gdkmonitorprivate.h"
|
2011-01-02 10:51:25 +00:00
|
|
|
#include "gdkwin32window.h"
|
2014-12-17 04:32:04 +00:00
|
|
|
#include "gdkglcontext-win32.h"
|
2016-06-27 05:16:43 +00:00
|
|
|
#include "gdkdisplay-win32.h"
|
2011-01-02 10:51:25 +00:00
|
|
|
|
|
|
|
#include <cairo-win32.h>
|
2015-04-22 19:10:55 +00:00
|
|
|
#include <dwmapi.h>
|
2016-03-08 02:33:47 +00:00
|
|
|
#include <math.h>
|
|
|
|
#include "fallback-c89.c"
|
2003-08-06 21:01:00 +00:00
|
|
|
|
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;
|
2008-02-05 16:47:24 +00:00
|
|
|
static GSList *modal_window_stack = NULL;
|
2000-07-25 17:31:05 +00:00
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
static const cairo_user_data_key_t gdk_win32_cairo_key;
|
2011-10-26 10:43:24 +00:00
|
|
|
typedef struct _FullscreenInfo FullscreenInfo;
|
|
|
|
|
|
|
|
struct _FullscreenInfo
|
|
|
|
{
|
|
|
|
RECT r;
|
|
|
|
guint hint_flags;
|
|
|
|
LONG style;
|
|
|
|
};
|
2011-01-02 10:51:25 +00:00
|
|
|
|
2016-03-08 05:03:29 +00:00
|
|
|
struct _AeroSnapEdgeRegion
|
|
|
|
{
|
|
|
|
/* The rectangle along the edge of the desktop
|
|
|
|
* that allows application of the snap transformation.
|
|
|
|
*/
|
|
|
|
GdkRectangle edge;
|
|
|
|
|
|
|
|
/* A subregion of the "edge". When the pointer hits
|
|
|
|
* this region, the transformation is revealed.
|
|
|
|
* Usually it is 1-pixel thick and is located at the
|
|
|
|
* very edge of the screen. When there's a toolbar
|
|
|
|
* at that edge, the "trigger" and the "edge" regions
|
|
|
|
* are extended to cover that toolbar.
|
|
|
|
*/
|
|
|
|
GdkRectangle trigger;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _AeroSnapEdgeRegion AeroSnapEdgeRegion;
|
|
|
|
|
2015-11-21 03:58:22 +00:00
|
|
|
/* Use this for hWndInsertAfter (2nd argument to SetWindowPos()) if
|
|
|
|
* SWP_NOZORDER flag is used. Otherwise it's unobvious why a particular
|
|
|
|
* argument is used. Using NULL is misleading, because
|
|
|
|
* NULL is equivalent to HWND_TOP.
|
|
|
|
*/
|
|
|
|
#define SWP_NOZORDER_SPECIFIED HWND_TOP
|
|
|
|
|
2016-03-08 05:03:29 +00:00
|
|
|
/* Size of the regions at the edges of the desktop where
|
|
|
|
* snapping can take place (in pixels)
|
|
|
|
*/
|
|
|
|
#define AEROSNAP_REGION_THICKNESS (20)
|
|
|
|
/* Size of the subregions that actually trigger the snapping prompt
|
|
|
|
* (in pixels).
|
|
|
|
*/
|
|
|
|
#define AEROSNAP_REGION_TRIGGER_THICKNESS (1)
|
|
|
|
|
2016-03-12 16:26:19 +00:00
|
|
|
/* The gap between the snap indicator and the edge of the work area
|
|
|
|
* (in pixels).
|
|
|
|
*/
|
|
|
|
#define AEROSNAP_INDICATOR_EDGE_GAP (10)
|
|
|
|
|
|
|
|
/* Width of the outline of the snap indicator
|
|
|
|
* (in pixels).
|
|
|
|
*/
|
|
|
|
#define AEROSNAP_INDICATOR_LINE_WIDTH (3.0)
|
|
|
|
|
|
|
|
/* Corner radius of the snap indicator.
|
|
|
|
*/
|
|
|
|
#define AEROSNAP_INDICATOR_CORNER_RADIUS (3.0)
|
|
|
|
|
|
|
|
/* The time it takes for snap indicator to expand/shrink
|
|
|
|
* from current window size to future position of the
|
|
|
|
* snapped window (in microseconds).
|
|
|
|
*/
|
|
|
|
#define AEROSNAP_INDICATOR_ANIMATION_DURATION (200 * 1000)
|
|
|
|
|
|
|
|
/* Opacity if the snap indicator. */
|
|
|
|
#define AEROSNAP_INDICATOR_OPACITY (0.5)
|
|
|
|
|
|
|
|
/* The interval between snap indicator redraws (in milliseconds).
|
|
|
|
* 16 is ~ 1/60 of a second, for ~60 FPS.
|
|
|
|
*/
|
|
|
|
#define AEROSNAP_INDICATOR_ANIMATION_TICK (16)
|
|
|
|
|
2008-10-05 00:00:10 +00:00
|
|
|
static gboolean _gdk_window_get_functions (GdkWindow *window,
|
|
|
|
GdkWMFunction *functions);
|
2011-11-10 15:51:07 +00:00
|
|
|
static HDC _gdk_win32_impl_acquire_dc (GdkWindowImplWin32 *impl);
|
|
|
|
static void _gdk_win32_impl_release_dc (GdkWindowImplWin32 *impl);
|
2006-02-09 02:58:45 +00:00
|
|
|
|
2005-03-16 02:21:14 +00:00
|
|
|
#define WINDOW_IS_TOPLEVEL(window) \
|
|
|
|
(GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD && \
|
2009-02-14 18:23:54 +00:00
|
|
|
GDK_WINDOW_TYPE (window) != GDK_WINDOW_FOREIGN && \
|
|
|
|
GDK_WINDOW_TYPE (window) != GDK_WINDOW_OFFSCREEN)
|
2005-03-16 02:21:14 +00:00
|
|
|
|
2009-02-14 18:23:54 +00:00
|
|
|
GdkScreen *
|
|
|
|
GDK_WINDOW_SCREEN (GObject *win)
|
|
|
|
{
|
2016-01-15 19:45:45 +00:00
|
|
|
return gdk_display_get_default_screen (gdk_display_get_default ());
|
2009-02-14 18:23:54 +00:00
|
|
|
}
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
struct _GdkWin32Window {
|
|
|
|
GdkWindow parent;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _GdkWin32WindowClass {
|
|
|
|
GdkWindowClass parent_class;
|
|
|
|
};
|
|
|
|
|
|
|
|
G_DEFINE_TYPE (GdkWin32Window, gdk_win32_window, GDK_TYPE_WINDOW)
|
|
|
|
|
|
|
|
static void
|
|
|
|
gdk_win32_window_class_init (GdkWin32WindowClass *window_class)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gdk_win32_window_init (GdkWin32Window *window)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
G_DEFINE_TYPE (GdkWindowImplWin32, gdk_window_impl_win32, GDK_TYPE_WINDOW_IMPL)
|
|
|
|
|
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
|
|
|
{
|
2009-11-06 00:21:09 +00:00
|
|
|
const GTypeInfo object_info =
|
2000-07-25 17:31:05 +00:00
|
|
|
{
|
|
|
|
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,
|
|
|
|
};
|
2008-07-02 06:06:29 +00:00
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
object_type = g_type_register_static (GDK_TYPE_WINDOW_IMPL,
|
2000-07-25 17:31:05 +00:00
|
|
|
"GdkWindowImplWin32",
|
2000-11-11 18:39:57 +00:00
|
|
|
&object_info, 0);
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
2015-04-29 07:31:08 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
return object_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gdk_window_impl_win32_init (GdkWindowImplWin32 *impl)
|
|
|
|
{
|
2016-03-01 03:40:36 +00:00
|
|
|
GdkDisplay *display = gdk_display_get_default ();
|
|
|
|
|
2005-03-16 02:21:14 +00:00
|
|
|
impl->toplevel_window_type = -1;
|
2015-05-03 21:29:35 +00:00
|
|
|
impl->cursor = 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;
|
2007-07-12 23:38:30 +00:00
|
|
|
impl->transient_owner = NULL;
|
2007-10-18 00:31:22 +00:00
|
|
|
impl->transient_children = NULL;
|
|
|
|
impl->num_transients = 0;
|
|
|
|
impl->changing_state = FALSE;
|
2016-06-27 05:16:43 +00:00
|
|
|
impl->window_scale = 1;
|
2016-03-01 03:40:36 +00:00
|
|
|
|
|
|
|
if (display != NULL)
|
|
|
|
/* Replace WM-defined default cursor with the default cursor
|
|
|
|
* from our theme. Otherwise newly-opened windows (such as popup
|
|
|
|
* menus of all kinds) will have WM-default cursor when they are
|
|
|
|
* first shown, which will be replaced by our cursor only later on.
|
|
|
|
*/
|
|
|
|
impl->cursor = _gdk_win32_display_get_cursor_for_type (display, GDK_LEFT_PTR);
|
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
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
static void
|
|
|
|
gdk_window_impl_win32_finalize (GObject *object)
|
|
|
|
{
|
2011-01-02 10:51:25 +00:00
|
|
|
GdkWindow *wrapper;
|
2000-07-25 17:31:05 +00:00
|
|
|
GdkWindowImplWin32 *window_impl;
|
2015-04-29 07:31:08 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
g_return_if_fail (GDK_IS_WINDOW_IMPL_WIN32 (object));
|
|
|
|
|
|
|
|
window_impl = GDK_WINDOW_IMPL_WIN32 (object);
|
2015-04-29 07:31:08 +00:00
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
wrapper = window_impl->wrapper;
|
2000-07-25 17:31:05 +00:00
|
|
|
|
|
|
|
if (!GDK_WINDOW_DESTROYED (wrapper))
|
1999-11-20 01:22:57 +00:00
|
|
|
{
|
2011-01-02 10:51:25 +00:00
|
|
|
gdk_win32_handle_table_remove (window_impl->handle);
|
1999-11-20 01:22:57 +00:00
|
|
|
}
|
|
|
|
|
2015-05-03 21:29:35 +00:00
|
|
|
g_clear_object (&window_impl->cursor);
|
2008-02-05 16:47:24 +00:00
|
|
|
|
2016-03-08 03:17:09 +00:00
|
|
|
g_clear_pointer (&window_impl->snap_stash, g_free);
|
|
|
|
g_clear_pointer (&window_impl->snap_stash_int, g_free);
|
|
|
|
|
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;
|
|
|
|
}
|
2008-02-05 16:47:24 +00:00
|
|
|
|
2003-12-14 01:06:56 +00:00
|
|
|
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
|
|
|
|
2016-02-23 09:20:55 +00:00
|
|
|
g_free (window_impl->decorations);
|
|
|
|
|
2017-09-04 14:42:11 +00:00
|
|
|
if (window_impl->cache_surface)
|
|
|
|
{
|
|
|
|
cairo_surface_destroy (window_impl->cache_surface);
|
|
|
|
window_impl->cache_surface = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (window_impl->cairo_surface)
|
|
|
|
{
|
|
|
|
cairo_surface_destroy (window_impl->cairo_surface);
|
|
|
|
window_impl->cairo_surface = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_assert (window_impl->transient_owner == NULL);
|
|
|
|
g_assert (window_impl->transient_children == NULL);
|
|
|
|
|
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
|
|
|
|
2017-09-02 15:25:36 +00:00
|
|
|
static void
|
|
|
|
gdk_win32_get_window_client_area_rect (GdkWindow *window,
|
|
|
|
gint scale,
|
|
|
|
RECT *rect)
|
|
|
|
{
|
|
|
|
gint x, y, width, height;
|
|
|
|
|
|
|
|
gdk_window_get_position (window, &x, &y);
|
|
|
|
width = gdk_window_get_width (window);
|
|
|
|
height = gdk_window_get_height (window);
|
|
|
|
rect->left = x * scale;
|
|
|
|
rect->top = y * scale;
|
|
|
|
rect->right = rect->left + width * scale;
|
|
|
|
rect->bottom = rect->top + height * scale;
|
|
|
|
}
|
|
|
|
|
2016-03-09 09:50:09 +00:00
|
|
|
static void
|
|
|
|
gdk_win32_window_get_queued_window_rect (GdkWindow *window,
|
|
|
|
RECT *return_window_rect)
|
|
|
|
{
|
|
|
|
RECT window_rect;
|
2016-06-27 05:16:43 +00:00
|
|
|
GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
2016-03-09 09:50:09 +00:00
|
|
|
|
2017-09-02 15:25:36 +00:00
|
|
|
gdk_win32_get_window_client_area_rect (window, impl->window_scale, &window_rect);
|
2016-03-09 09:50:09 +00:00
|
|
|
|
|
|
|
/* Turn client area into window area */
|
|
|
|
_gdk_win32_adjust_client_rect (window, &window_rect);
|
|
|
|
|
|
|
|
/* Convert GDK screen coordinates to W32 desktop coordinates */
|
2016-06-27 05:16:43 +00:00
|
|
|
window_rect.left -= _gdk_offset_x * impl->window_scale;
|
|
|
|
window_rect.right -= _gdk_offset_x * impl->window_scale;
|
|
|
|
window_rect.top -= _gdk_offset_y * impl->window_scale;
|
|
|
|
window_rect.bottom -= _gdk_offset_y * impl->window_scale;
|
2016-03-09 09:50:09 +00:00
|
|
|
|
|
|
|
*return_window_rect = window_rect;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gdk_win32_window_apply_queued_move_resize (GdkWindow *window,
|
|
|
|
RECT window_rect)
|
|
|
|
{
|
2016-03-17 20:07:33 +00:00
|
|
|
if (!IsIconic (GDK_WINDOW_HWND (window)))
|
|
|
|
{
|
2016-06-27 05:16:43 +00:00
|
|
|
GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
2016-03-17 20:07:33 +00:00
|
|
|
GDK_NOTE (EVENTS, g_print ("Setting window position ... "));
|
|
|
|
|
|
|
|
API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window),
|
|
|
|
SWP_NOZORDER_SPECIFIED,
|
|
|
|
window_rect.left, window_rect.top,
|
|
|
|
window_rect.right - window_rect.left,
|
|
|
|
window_rect.bottom - window_rect.top,
|
|
|
|
SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOREDRAW));
|
|
|
|
|
|
|
|
GDK_NOTE (EVENTS, g_print (" ... set window position\n"));
|
2016-03-09 09:50:09 +00:00
|
|
|
|
2016-03-17 20:07:33 +00:00
|
|
|
return;
|
|
|
|
}
|
2016-03-09 09:50:09 +00:00
|
|
|
|
2016-03-17 20:07:33 +00:00
|
|
|
/* Don't move iconic windows */
|
|
|
|
/* TODO: use SetWindowPlacement() to change non-minimized window position */
|
2016-03-09 09:50:09 +00:00
|
|
|
}
|
|
|
|
|
2016-02-23 09:20:55 +00:00
|
|
|
static gboolean
|
|
|
|
gdk_win32_window_begin_paint (GdkWindow *window)
|
|
|
|
{
|
2016-03-09 09:50:09 +00:00
|
|
|
GdkWindowImplWin32 *impl;
|
|
|
|
RECT window_rect;
|
|
|
|
|
|
|
|
if (window == NULL || GDK_WINDOW_DESTROYED (window))
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
|
|
|
|
|
|
|
/* Layered windows are moved *after* repaint.
|
|
|
|
* We supply our own surface, return FALSE to make GDK use it.
|
|
|
|
*/
|
|
|
|
if (impl->layered)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
/* Non-GL windows are moved *after* repaint.
|
|
|
|
* We don't supply our own surface, return TRUE to make GDK create
|
|
|
|
* one by itself.
|
|
|
|
*/
|
|
|
|
if (!window->current_paint.use_gl)
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
/* GL windows are moved *before* repaint (otherwise
|
|
|
|
* repainting doesn't work), but if there's no move queued up,
|
|
|
|
* return immediately. Doesn't matter what we return, GDK
|
|
|
|
* will create a surface anyway, as if we returned TRUE.
|
|
|
|
*/
|
|
|
|
if (!impl->drag_move_resize_context.native_move_resize_pending)
|
|
|
|
return TRUE;
|
2016-02-23 09:20:55 +00:00
|
|
|
|
2016-03-09 09:50:09 +00:00
|
|
|
impl->drag_move_resize_context.native_move_resize_pending = FALSE;
|
|
|
|
|
|
|
|
/* Get the position/size of the window that GDK wants,
|
|
|
|
* apply it.
|
|
|
|
*/
|
|
|
|
gdk_win32_window_get_queued_window_rect (window, &window_rect);
|
|
|
|
gdk_win32_window_apply_queued_move_resize (window, window_rect);
|
|
|
|
|
|
|
|
return TRUE;
|
2016-02-23 09:20:55 +00:00
|
|
|
}
|
|
|
|
|
2016-02-06 12:06:41 +00:00
|
|
|
static void
|
|
|
|
gdk_win32_window_end_paint (GdkWindow *window)
|
|
|
|
{
|
|
|
|
GdkWindowImplWin32 *impl;
|
|
|
|
RECT window_rect;
|
2016-02-23 09:20:55 +00:00
|
|
|
HDC hdc;
|
|
|
|
POINT window_position;
|
|
|
|
SIZE window_size;
|
|
|
|
POINT source_point;
|
|
|
|
BLENDFUNCTION blender;
|
|
|
|
cairo_t *cr;
|
2016-02-06 12:06:41 +00:00
|
|
|
|
|
|
|
if (window == NULL || GDK_WINDOW_DESTROYED (window))
|
|
|
|
return;
|
|
|
|
|
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
|
|
|
|
2016-03-09 09:50:09 +00:00
|
|
|
/* GL windows are moved *before* repaint */
|
|
|
|
if (window->current_paint.use_gl)
|
2016-02-06 12:06:41 +00:00
|
|
|
return;
|
|
|
|
|
2016-03-09 09:50:09 +00:00
|
|
|
/* No move/resize is queued up, and we don't need to update
|
|
|
|
* the contents of a layered window, so return immediately.
|
|
|
|
*/
|
|
|
|
if (!impl->layered &&
|
|
|
|
!impl->drag_move_resize_context.native_move_resize_pending)
|
|
|
|
return;
|
2016-02-06 12:06:41 +00:00
|
|
|
|
2016-03-09 09:50:09 +00:00
|
|
|
impl->drag_move_resize_context.native_move_resize_pending = FALSE;
|
2016-02-06 12:06:41 +00:00
|
|
|
|
2016-03-09 09:50:09 +00:00
|
|
|
/* Get the position/size of the window that GDK wants. */
|
|
|
|
gdk_win32_window_get_queued_window_rect (window, &window_rect);
|
2016-02-06 12:06:41 +00:00
|
|
|
|
2016-02-23 09:20:55 +00:00
|
|
|
if (!impl->layered)
|
|
|
|
{
|
2016-03-09 09:50:09 +00:00
|
|
|
gdk_win32_window_apply_queued_move_resize (window, window_rect);
|
2016-02-23 09:20:55 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
window_position.x = window_rect.left;
|
|
|
|
window_position.y = window_rect.top;
|
2016-06-27 05:16:43 +00:00
|
|
|
|
2016-02-23 09:20:55 +00:00
|
|
|
window_size.cx = window_rect.right - window_rect.left;
|
|
|
|
window_size.cy = window_rect.bottom - window_rect.top;
|
|
|
|
|
|
|
|
cairo_surface_flush (impl->cairo_surface);
|
2016-02-06 12:06:41 +00:00
|
|
|
|
2016-02-23 09:20:55 +00:00
|
|
|
/* we always draw in the top-left corner of the surface */
|
|
|
|
source_point.x = source_point.y = 0;
|
2016-02-06 12:06:41 +00:00
|
|
|
|
2016-02-23 09:20:55 +00:00
|
|
|
blender.BlendOp = AC_SRC_OVER;
|
|
|
|
blender.BlendFlags = 0;
|
|
|
|
blender.AlphaFormat = AC_SRC_ALPHA;
|
|
|
|
blender.SourceConstantAlpha = impl->layered_opacity * 255;
|
|
|
|
|
|
|
|
/* Update cache surface contents */
|
|
|
|
cr = cairo_create (impl->cache_surface);
|
|
|
|
|
|
|
|
cairo_set_source_surface (cr, window->current_paint.surface, 0, 0);
|
|
|
|
gdk_cairo_region (cr, window->current_paint.region);
|
|
|
|
cairo_clip (cr);
|
|
|
|
|
|
|
|
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
|
|
|
|
cairo_paint (cr);
|
|
|
|
|
|
|
|
cairo_destroy (cr);
|
|
|
|
|
|
|
|
cairo_surface_flush (impl->cache_surface);
|
|
|
|
hdc = cairo_win32_surface_get_dc (impl->cache_surface);
|
|
|
|
|
2016-03-17 20:07:33 +00:00
|
|
|
/* Don't use UpdateLayeredWindow on minimized windows */
|
|
|
|
if (IsIconic (GDK_WINDOW_HWND (window)))
|
|
|
|
{
|
|
|
|
gdk_win32_window_apply_queued_move_resize (window, window_rect);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-02-23 09:20:55 +00:00
|
|
|
/* Move, resize and redraw layered window in one call */
|
|
|
|
API_CALL (UpdateLayeredWindow, (GDK_WINDOW_HWND (window), NULL,
|
|
|
|
&window_position, &window_size,
|
|
|
|
hdc, &source_point,
|
|
|
|
0, &blender, ULW_ALPHA));
|
2016-02-06 12:06:41 +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));
|
|
|
|
}
|
|
|
|
|
2015-04-22 19:10:55 +00:00
|
|
|
gboolean
|
|
|
|
_gdk_win32_window_enable_transparency (GdkWindow *window)
|
|
|
|
{
|
2016-02-23 09:20:55 +00:00
|
|
|
GdkWindowImplWin32 *impl;
|
2015-12-17 23:36:57 +00:00
|
|
|
GdkScreen *screen;
|
2015-04-22 19:10:55 +00:00
|
|
|
DWM_BLURBEHIND blur_behind;
|
|
|
|
HRGN empty_region;
|
|
|
|
HRESULT call_result;
|
|
|
|
HWND parent, thiswindow;
|
|
|
|
|
|
|
|
if (window == NULL || GDK_WINDOW_HWND (window) == NULL)
|
|
|
|
return FALSE;
|
|
|
|
|
2016-02-23 09:20:55 +00:00
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
|
|
|
|
|
|
|
/* layered windows don't need blurbehind for transparency */
|
|
|
|
if (impl->layered)
|
|
|
|
return TRUE;
|
|
|
|
|
2015-12-17 23:36:57 +00:00
|
|
|
screen = gdk_window_get_screen (window);
|
|
|
|
|
|
|
|
if (!gdk_screen_is_composited (screen))
|
2015-04-22 19:10:55 +00:00
|
|
|
return FALSE;
|
|
|
|
|
2015-12-17 23:36:57 +00:00
|
|
|
if (window == gdk_screen_get_root_window (screen))
|
2015-04-22 19:10:55 +00:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
thiswindow = GDK_WINDOW_HWND (window);
|
|
|
|
|
|
|
|
/* Blurbehind only works on toplevel windows */
|
|
|
|
parent = GetAncestor (thiswindow, GA_PARENT);
|
|
|
|
if (!(GetWindowLong (thiswindow, GWL_STYLE) & WS_POPUP) &&
|
|
|
|
(parent == NULL || parent != GetDesktopWindow ()))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
empty_region = CreateRectRgn (0, 0, -1, -1);
|
|
|
|
|
|
|
|
if (empty_region == NULL)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
memset (&blur_behind, 0, sizeof (blur_behind));
|
|
|
|
blur_behind.dwFlags = DWM_BB_ENABLE | DWM_BB_BLURREGION;
|
|
|
|
blur_behind.hRgnBlur = empty_region;
|
|
|
|
blur_behind.fEnable = TRUE;
|
|
|
|
call_result = DwmEnableBlurBehindWindow (thiswindow, &blur_behind);
|
|
|
|
|
|
|
|
if (!SUCCEEDED (call_result))
|
|
|
|
g_warning ("%s: %s (%p) failed: %" G_GINT32_MODIFIER "x",
|
|
|
|
G_STRLOC, "DwmEnableBlurBehindWindow", thiswindow, (guint32) call_result);
|
|
|
|
|
|
|
|
DeleteObject (empty_region);
|
|
|
|
|
|
|
|
return SUCCEEDED (call_result);
|
|
|
|
}
|
|
|
|
|
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.
|
2015-04-29 07:31:08 +00:00
|
|
|
* It creates at least one unique class for every
|
1999-11-11 22:12:27 +00:00
|
|
|
* 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 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;
|
2015-04-29 07:31:08 +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;
|
2008-02-05 16:47:24 +00:00
|
|
|
|
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);
|
2008-02-05 16:47:24 +00:00
|
|
|
|
2006-10-28 23:58:30 +00:00
|
|
|
if (0 == hAppIcon && 0 == hAppIconSm)
|
|
|
|
{
|
|
|
|
if (0 != GetModuleFileName (_gdk_dll_hinstance, sLoc, MAX_PATH))
|
2008-02-05 16:47:24 +00:00
|
|
|
{
|
|
|
|
ExtractIconEx (sLoc, 0, &hAppIcon, &hAppIconSm, 1);
|
|
|
|
}
|
2006-10-28 23:58:30 +00:00
|
|
|
}
|
|
|
|
}
|
2008-02-05 16:47:24 +00:00
|
|
|
|
2006-10-28 23:58:30 +00:00
|
|
|
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
|
|
|
}
|
2008-02-05 16:47:24 +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; \
|
2015-04-29 07:31:08 +00:00
|
|
|
wcl.hCursor = LoadCursor (NULL, IDC_ARROW);
|
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
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:
|
2014-12-17 04:32:04 +00:00
|
|
|
/* MSDN: CS_OWNDC is needed for OpenGL contexts */
|
|
|
|
wcl.style |= CS_OWNDC;
|
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 (0 == klassTOPLEVEL)
|
2014-12-17 04:32:04 +00:00
|
|
|
{
|
|
|
|
wcl.lpszClassName = L"gdkWindowToplevel";
|
|
|
|
|
|
|
|
ONCE_PER_CLASS ();
|
|
|
|
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;
|
2015-04-29 07:31:08 +00:00
|
|
|
|
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";
|
2015-04-29 07:31:08 +00:00
|
|
|
|
2014-12-17 04:32:04 +00:00
|
|
|
/* XXX: Find out whether GL Widgets are done for GDK_WINDOW_CHILD
|
|
|
|
* MSDN says CS_PARENTDC should not be used for GL Context
|
|
|
|
* creation
|
|
|
|
*/
|
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;
|
2015-04-29 07:31:08 +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
|
|
|
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) ||
|
2015-12-27 05:05:39 +00:00
|
|
|
(wtype_hint == GDK_WINDOW_TYPE_HINT_POPUP_MENU))
|
2007-04-25 23:44:54 +00:00
|
|
|
{
|
|
|
|
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;
|
2015-04-15 09:17:06 +00:00
|
|
|
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;
|
2015-04-29 07:31:08 +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
|
|
|
default:
|
|
|
|
g_assert_not_reached ();
|
|
|
|
break;
|
|
|
|
}
|
2015-04-29 07:31:08 +00:00
|
|
|
|
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
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
/*
|
|
|
|
* Create native windows.
|
|
|
|
*
|
|
|
|
* With the default Gdk the created windows are mostly toplevel windows.
|
|
|
|
*
|
|
|
|
* Placement of the window is derived from the passed in window,
|
|
|
|
* except for toplevel window where OS/Window Manager placement
|
|
|
|
* is used.
|
|
|
|
*
|
|
|
|
* The visual parameter, is based on GDK_WA_VISUAL if set already.
|
2015-04-29 07:31:08 +00:00
|
|
|
* From attributes the only things used is: colormap, title,
|
2011-01-02 10:51:25 +00:00
|
|
|
* wmclass and type_hint. [1]. We are checking redundant information
|
|
|
|
* and complain if that changes, which would break this implementation
|
|
|
|
* again.
|
|
|
|
*
|
|
|
|
* [1] http://mail.gnome.org/archives/gtk-devel-list/2010-August/msg00214.html
|
|
|
|
*/
|
2009-02-14 18:23:54 +00:00
|
|
|
void
|
2011-01-02 10:51:25 +00:00
|
|
|
_gdk_win32_display_create_window_impl (GdkDisplay *display,
|
|
|
|
GdkWindow *window,
|
|
|
|
GdkWindow *real_parent,
|
|
|
|
GdkScreen *screen,
|
|
|
|
GdkEventMask event_mask,
|
|
|
|
GdkWindowAttr *attributes,
|
|
|
|
gint attributes_mask)
|
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;
|
2000-07-25 17:31:05 +00:00
|
|
|
GdkWindowImplWin32 *impl;
|
2016-06-27 05:16:43 +00:00
|
|
|
GdkWin32Display *display_win32;
|
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;
|
2011-10-27 14:09:42 +00:00
|
|
|
gboolean override_redirect;
|
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;
|
2011-11-02 11:15:53 +00:00
|
|
|
gint x, y, real_x = 0, real_y = 0;
|
2011-01-02 10:51:25 +00:00
|
|
|
/* check consistency of redundant information */
|
|
|
|
guint remaining_mask = attributes_mask;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2016-04-11 20:22:37 +00:00
|
|
|
g_return_if_fail (display == _gdk_display);
|
2016-02-22 16:55:16 +00:00
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
GDK_NOTE (MISC,
|
|
|
|
g_print ("_gdk_window_impl_new: %s %s\n",
|
|
|
|
(window->window_type == GDK_WINDOW_TOPLEVEL ? "TOPLEVEL" :
|
|
|
|
(window->window_type == GDK_WINDOW_CHILD ? "CHILD" :
|
|
|
|
(window->window_type == GDK_WINDOW_TEMP ? "TEMP" :
|
|
|
|
"???"))),
|
|
|
|
(attributes->wclass == GDK_INPUT_OUTPUT ? "" : "input-only"))
|
|
|
|
);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
/* to ensure to not miss important information some additional check against
|
|
|
|
* attributes which may silently work on X11 */
|
|
|
|
if ((attributes_mask & GDK_WA_X) != 0)
|
|
|
|
{
|
|
|
|
g_assert (attributes->x == window->x);
|
|
|
|
remaining_mask &= ~GDK_WA_X;
|
|
|
|
}
|
|
|
|
if ((attributes_mask & GDK_WA_Y) != 0)
|
|
|
|
{
|
|
|
|
g_assert (attributes->y == window->y);
|
|
|
|
remaining_mask &= ~GDK_WA_Y;
|
|
|
|
}
|
2011-10-27 14:09:42 +00:00
|
|
|
override_redirect = FALSE;
|
2011-01-02 10:51:25 +00:00
|
|
|
if ((attributes_mask & GDK_WA_NOREDIR) != 0)
|
2011-10-27 14:09:42 +00:00
|
|
|
{
|
|
|
|
override_redirect = !!attributes->override_redirect;
|
|
|
|
remaining_mask &= ~GDK_WA_NOREDIR;
|
|
|
|
}
|
2005-03-15 02:07:08 +00:00
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
if ((remaining_mask & ~(GDK_WA_WMCLASS|GDK_WA_VISUAL|GDK_WA_CURSOR|GDK_WA_TITLE|GDK_WA_TYPE_HINT)) != 0)
|
|
|
|
g_warning ("_gdk_window_impl_new: uexpected attribute 0x%X",
|
|
|
|
remaining_mask & ~(GDK_WA_WMCLASS|GDK_WA_VISUAL|GDK_WA_CURSOR|GDK_WA_TITLE|GDK_WA_TYPE_HINT));
|
2000-12-30 20:06:14 +00:00
|
|
|
|
2009-02-14 18:23:54 +00:00
|
|
|
hparent = GDK_WINDOW_HWND (real_parent);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2010-11-23 00:03:55 +00:00
|
|
|
impl = g_object_new (GDK_TYPE_WINDOW_IMPL_WIN32, NULL);
|
2011-01-02 10:51:25 +00:00
|
|
|
impl->wrapper = GDK_WINDOW (window);
|
|
|
|
window->impl = GDK_WINDOW_IMPL (impl);
|
2003-12-10 23:58:23 +00:00
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
if (attributes_mask & GDK_WA_VISUAL)
|
2015-04-22 19:10:55 +00:00
|
|
|
g_assert ((gdk_screen_get_system_visual (screen) == attributes->visual) ||
|
|
|
|
(gdk_screen_get_rgba_visual (screen) == attributes->visual));
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2011-10-27 14:09:42 +00:00
|
|
|
impl->override_redirect = override_redirect;
|
2016-02-23 09:20:55 +00:00
|
|
|
impl->layered = FALSE;
|
|
|
|
impl->layered_opacity = 1.0;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2016-06-27 05:16:43 +00:00
|
|
|
display_win32 = GDK_WIN32_DISPLAY (display);
|
|
|
|
impl->window_scale = _gdk_win32_display_get_monitor_scale_factor (display_win32, NULL, NULL, NULL);
|
|
|
|
impl->unscaled_width = window->width * impl->window_scale;
|
|
|
|
impl->unscaled_height = window->height * impl->window_scale;
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
/* wclass is not any longer set always, but if is ... */
|
|
|
|
if ((attributes_mask & GDK_WA_WMCLASS) == GDK_WA_WMCLASS)
|
|
|
|
g_assert ((attributes->wclass == GDK_INPUT_OUTPUT) == !window->input_only);
|
|
|
|
|
|
|
|
if (!window->input_only)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
dwExStyle = 0;
|
|
|
|
}
|
|
|
|
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;
|
2010-08-29 10:37:58 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("... GDK_INPUT_ONLY\n"));
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
switch (window->window_type)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
case GDK_WINDOW_TOPLEVEL:
|
2011-01-02 10:51:25 +00:00
|
|
|
if (GDK_WINDOW_TYPE (window->parent) != GDK_WINDOW_ROOT)
|
2009-03-01 13:55:50 +00:00
|
|
|
{
|
|
|
|
/* The common code warns for this case. */
|
|
|
|
hparent = GetDesktopWindow ();
|
|
|
|
}
|
2005-03-15 02:07:08 +00:00
|
|
|
/* Children of foreign windows aren't toplevel windows */
|
2011-01-02 10:51:25 +00:00
|
|
|
if (GDK_WINDOW_TYPE (real_parent) == GDK_WINDOW_FOREIGN)
|
2009-03-01 13:55:50 +00:00
|
|
|
{
|
|
|
|
dwStyle = WS_CHILDWINDOW | WS_CLIPCHILDREN;
|
|
|
|
}
|
2005-03-15 02:07:08 +00:00
|
|
|
else
|
2009-03-01 13:55:50 +00:00
|
|
|
{
|
2014-12-17 04:32:04 +00:00
|
|
|
/* MSDN: We need WS_CLIPCHILDREN and WS_CLIPSIBLINGS for GL Context Creation */
|
2011-01-02 10:51:25 +00:00
|
|
|
if (window->window_type == GDK_WINDOW_TOPLEVEL)
|
2014-12-17 04:32:04 +00:00
|
|
|
dwStyle = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
|
2009-03-01 13:55:50 +00:00
|
|
|
else
|
|
|
|
dwStyle = WS_OVERLAPPED | WS_MINIMIZEBOX | WS_SYSMENU | WS_CAPTION | WS_THICKFRAME | WS_CLIPCHILDREN;
|
2005-03-15 02:07:08 +00:00
|
|
|
|
2009-03-01 13:55:50 +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_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 */
|
2015-12-17 23:36:57 +00:00
|
|
|
dwStyle = (gdk_screen_get_root_window (screen) == real_parent ? WS_POPUP : WS_CHILDWINDOW);
|
2005-03-15 02:07:08 +00:00
|
|
|
dwStyle |= WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
|
2011-11-25 10:21:26 +00:00
|
|
|
dwExStyle |= WS_EX_TOOLWINDOW | WS_EX_TOPMOST;
|
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
|
|
|
|
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
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
if (window->window_type != GDK_WINDOW_CHILD)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2016-06-27 05:16:43 +00:00
|
|
|
rect.left = window->x * impl->window_scale;
|
|
|
|
rect.top = window->y * impl->window_scale;
|
|
|
|
rect.right = rect.left + window->width * impl->window_scale;
|
|
|
|
rect.bottom = rect.top + window->height * impl->window_scale;
|
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
|
|
|
|
2016-06-27 05:16:43 +00:00
|
|
|
real_x = (window->x - offset_x) * impl->window_scale;
|
|
|
|
real_y = (window->y - offset_y) * impl->window_scale;
|
2011-11-02 11:15:53 +00:00
|
|
|
|
|
|
|
if (window->window_type == GDK_WINDOW_TOPLEVEL)
|
|
|
|
{
|
|
|
|
/* We initially place it at default so that we can get the
|
|
|
|
default window positioning if we want */
|
|
|
|
x = y = CW_USEDEFAULT;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* TEMP, FOREIGN: Put these where requested */
|
|
|
|
x = real_x;
|
|
|
|
y = real_y;
|
|
|
|
}
|
2011-01-02 10:51:25 +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
|
|
|
|
{
|
2011-01-02 10:51:25 +00:00
|
|
|
/* adjust position relative to real_parent */
|
2016-06-27 05:16:43 +00:00
|
|
|
window_width = impl->unscaled_width;
|
|
|
|
window_height = impl->unscaled_height;
|
2011-01-02 10:51:25 +00:00
|
|
|
/* use given position for initial placement, native coordinates */
|
2016-06-27 05:16:43 +00:00
|
|
|
x = (window->x + window->parent->abs_x - offset_x) * impl->window_scale;
|
|
|
|
y = (window->y + window->parent->abs_y - offset_y) * impl->window_scale;
|
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
|
|
|
|
2011-10-19 19:36:41 +00:00
|
|
|
impl->native_event_mask = GDK_STRUCTURE_MASK | event_mask;
|
2015-04-29 07:31:08 +00:00
|
|
|
|
2007-04-25 23:44:54 +00:00
|
|
|
if (attributes_mask & GDK_WA_TYPE_HINT)
|
2011-01-02 10:51:25 +00:00
|
|
|
gdk_window_set_type_hint (window, attributes->type_hint);
|
2007-04-25 23:44:54 +00:00
|
|
|
|
2008-10-05 00:00:10 +00:00
|
|
|
if (impl->type_hint == GDK_WINDOW_TYPE_HINT_UTILITY)
|
|
|
|
dwExStyle |= WS_EX_TOOLWINDOW;
|
|
|
|
|
W32: Massive W32 DnD fix
Massive changes to OLE2 DnD protocol, which was completely broken before:
* Keep GdkDragContext and OLE2 objects separate (don't ref/unref them
together, don't necessarily create them together).
* Keep IDataObject formats in the object itself, not in a global variable.
* Fix getdata() to look up the request target in its format list, not in the
global hash table
* Create target GdkDragContext on each drag_enter, destroy it on drag_leave,
whereas IDropTarget is created when a window becomes a drag destination
and is re-used indefinitely.
* Query the source IDataObject for its supported types, cache them in the
target (!) context. This is how GTK+ works, honestly.
* Remember current_src_object when we initiate a drag, to be able
to detect later on that the data object is ours and use a
shortcut when querying targets
* Make sure GDK_DRAG_MOTION is only sent when something changes
* Support GTK drag cursors
* Ensure that exotic GTK clipboard formats are registered
(but try to avoid registering formats that can't be used between applications).
* Don't enumerate internal formats
* Ensure that DnD indicator window can't accept drags or receive any kind of input
(use WS_EX_TRANSPARENT).
* Remove unneeded indentation in _gdk_win32_dnd_do_dragdrop()
* Fix indentation in gdk_win32_drag_context_drop_finish()
* Remove obsolete comments in _gdk_win32_window_register_dnd()
* Check for DnD in progress when processing WM_KILLFOCUS, don't emit a grab
break event in such cases (this allows alt-tabbing while DnD is in progress,
though there may be lingering issues with focus after dropping...)
* Support Shell ID List -> text/uri-list conversion, now it's possible
to drop files (dragged from Explorer) on GTK+ applications
* Explicitly use RegisterClipboardFormatA() when we know that the string
is not in unicode. Otherwise explicitly use RegisterClipboardFormatW()
with a UTF8->UTF16 converted string
* Fix _gdk_win32_display_get_selection_owner() to correctly bail
when selection owner HWND is NULL (looking up GdkWindow for NULL
HWND always succeeds and returns the root window - not the intended
effect)
* More logging
* Send DROP_FINISHED event after DnD loop ends
* Send STATUS event on feedback
* Move GetKeyboardState() and related code into _gdk_win32_window_drag_begin(),
so that it's closer to the point where last_pt and start_pt are set
* Use & 0x80 to check for the key being pressed. Windows will set low-order bit
to 1 for all mouse buttons to indicate that they are toggled, so simply
checking for the value not being 0 is not enough anymore.
This is probably a new thing in modern W32 that didn't exist before
(OLE2 DnD code is old).
* Fixed (hopefully) and simplified HiDPI parts of the code.
Also adds managed DnD implementation for W32 GDK backend (for both
OLE2 and LOCAL protocols). Mostly a copy of the X11 backend code, but
there are some minor differences:
* doesn't use drag_window field in GdkDragContext,
uses the one in GdkWin32DragContext exclusively
* subtracts hotspot offset from the window coordinates when showing
the dragback animation
* tries to consistently support scaling and caches the scale
in the context
* Some keynav code is removed (places where grabbing/ungrabbing should
happen is marked with TODOs), and the rest is probably inert.
Also significantly changes the way selection (and clipboard) is handled
(as MSDN rightly notes, the handling for DnD and Clipboard
formats is virtually the same, so it makes sense to handle
both with the same code):
* Don't spam GDK_OWNER_CHANGE, send them only when owner
actually changes
* Open clipboard when our process becomes the clipboard owner
(we are doing it anyway, to empty the clipboard and *become* the owner),
and then don't close it until a scheduled selection request event
(with TARGETS target) is received. Process that event by announcing
all of our supported formats (by that time add_targets() should have
been called up the stack, thus the formats are known; just in case,
add_targets() will also schedule a selection request, if one isn't
scheduled already, so that late-coming formats can still be announced).
* Allow clipboard opening for selection_convert() to be delayed if it
fails initially.
* The last two points above should fix all the bugs about GTK+ rising
too much ruckus over OpenClipboard() failures, as owner change
*is allowed* to fail (though not all callers currently handle
that case), and selection_convert() is asynchronous to begin with.
Still, this is somewhat risky, as there's a possibility that the
code will work in unexpected ways and the clipboard will remain open.
There's now logging to track the clipboard being opened and closed,
and a number of failsafes that try to ensure that it isn't kept open
for no reason.
* Added copious notes on the way clipboard works on X11, Windows and GDK-W32,
also removed old comments in DnD implementation, replaced some of them
with the new ones
* A lot of crufty module-global variables are stuffed into a singleton
object, GdkWin32Selection. It's technically possible to make it a
sub-object of the Display object (the way Wayland backend does),
but since Display object on W32 is a singleton anyway... why bother?
* Fixed the send_change_events() a bit (was slightly broken in one of the
previous iterations)
* Ensure that there's no confusion between selection conversion (an artifact
term from X11) and selection transmutation (changing the data to be W32-compatible)
* Put all the transmutation code and format-target-matching code into gdkselection-win32.c,
now this code isn't spread across multiple files.
* Consequently, moved some code away from gdkproperty-win32.c and gdkdnd-win32.c
* Extensive format transmutation checks for OLE2 DnD and clipboard.
We now keep track of which format mappings are for transmutations,
and which aren't (for example, when formats are passed as-is, or when
a registered name is just an alias)
* Put transmutation code into separate functions
* Ensure that drop target keeps a format->target map for supported formats,
this is useful when selection_convert() is called, as it only receives a
single target and no hints on the format from which the data should
be transmuted into this target.
* Add clear_targets() on W32, to de called by GTK
* Use g_set_object() instead of g_ref_object() where it is allowed.
* Fix indentation (and convert tabs to spaces), remove unused variables
https://bugzilla.gnome.org/show_bug.cgi?id=786509
2017-08-19 12:06:27 +00:00
|
|
|
/* WS_EX_TRANSPARENT means "try draw this window last, and ignore input".
|
|
|
|
* It's the last part we're after. We don't want DND indicator to accept
|
|
|
|
* input, because that will make it a potential drop target, and if it's
|
|
|
|
* under the mouse cursor, this will kill any DND.
|
|
|
|
*/
|
|
|
|
if (impl->type_hint == GDK_WINDOW_TYPE_HINT_DND)
|
|
|
|
dwExStyle |= WS_EX_TRANSPARENT;
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
klass = RegisterGdkClass (window->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);
|
2015-04-29 07:31:08 +00:00
|
|
|
|
2006-09-03 22:50:00 +00:00
|
|
|
hwndNew = CreateWindowExW (dwExStyle,
|
2009-07-18 14:24:02 +00:00
|
|
|
MAKEINTRESOURCEW (klass),
|
|
|
|
wtitle,
|
|
|
|
dwStyle,
|
2011-01-02 10:51:25 +00:00
|
|
|
x,
|
|
|
|
y,
|
2009-07-18 14:24:02 +00:00
|
|
|
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
|
2015-04-29 07:31:08 +00:00
|
|
|
* one, which causes much trouble. Because I can't find the
|
2000-10-09 19:49:42 +00:00
|
|
|
* 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 */
|
2011-01-02 10:51:25 +00:00
|
|
|
impl->handle = hwndNew;
|
2000-10-09 19:49:42 +00:00
|
|
|
# endif
|
|
|
|
|
|
|
|
}
|
2011-11-02 11:15:53 +00:00
|
|
|
|
|
|
|
if (window->window_type != GDK_WINDOW_CHILD)
|
|
|
|
{
|
|
|
|
GetWindowRect (GDK_WINDOW_HWND (window), &rect);
|
|
|
|
impl->initial_x = rect.left;
|
|
|
|
impl->initial_y = rect.top;
|
|
|
|
|
|
|
|
/* Now we know the initial position, move to actually specified position */
|
|
|
|
if (real_x != x || real_y != y)
|
|
|
|
{
|
2015-11-21 03:58:22 +00:00
|
|
|
API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window),
|
|
|
|
SWP_NOZORDER_SPECIFIED,
|
2011-11-02 11:15:53 +00:00
|
|
|
real_x, real_y, 0, 0,
|
|
|
|
SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER));
|
|
|
|
}
|
|
|
|
}
|
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,
|
2011-01-02 10:51:25 +00:00
|
|
|
window->x - offset_x,
|
2015-04-29 07:31:08 +00:00
|
|
|
window->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
|
|
|
|
2008-10-05 00:00:10 +00:00
|
|
|
/* Add window handle to title */
|
|
|
|
GDK_NOTE (MISC_OR_EVENTS, gdk_window_set_title (window, title));
|
|
|
|
|
2006-09-03 22:50:00 +00:00
|
|
|
g_free (wtitle);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
if (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);
|
2009-02-14 18:23:54 +00:00
|
|
|
return;
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
// if (!from_set_skip_taskbar_hint && window->window_type == GDK_WINDOW_TEMP)
|
2009-02-14 18:23:54 +00:00
|
|
|
// gdk_window_set_skip_taskbar_hint (window, TRUE);
|
2004-08-22 19:16:22 +00:00
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
if (attributes_mask & GDK_WA_CURSOR)
|
|
|
|
gdk_window_set_cursor (window, attributes->cursor);
|
2015-04-22 19:10:55 +00:00
|
|
|
|
|
|
|
_gdk_win32_window_enable_transparency (window);
|
2004-08-22 19:16:22 +00:00
|
|
|
}
|
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
GdkWindow *
|
2016-02-22 16:55:16 +00:00
|
|
|
gdk_win32_window_foreign_new_for_display (GdkDisplay *display,
|
|
|
|
HWND anid)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
GdkWindow *window;
|
2000-07-25 17:31:05 +00:00
|
|
|
GdkWindowImplWin32 *impl;
|
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
HANDLE parent;
|
|
|
|
RECT rect;
|
|
|
|
POINT point;
|
|
|
|
|
2011-02-06 14:03:32 +00:00
|
|
|
if ((window = gdk_win32_window_lookup_for_display (display, anid)) != NULL)
|
|
|
|
return g_object_ref (window);
|
|
|
|
|
2010-12-21 02:06:59 +00:00
|
|
|
window = _gdk_display_create_window (display);
|
2016-01-15 19:45:45 +00:00
|
|
|
window->visual = gdk_screen_get_system_visual (gdk_display_get_default_screen (display));
|
2011-01-02 10:51:25 +00:00
|
|
|
window->impl = g_object_new (GDK_TYPE_WINDOW_IMPL_WIN32, NULL);
|
2014-09-08 15:21:00 +00:00
|
|
|
window->impl_window = window;
|
2011-01-02 10:51:25 +00:00
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
|
|
|
impl->wrapper = window;
|
2011-02-06 14:03:32 +00:00
|
|
|
parent = GetParent (anid);
|
2015-04-29 07:31:08 +00:00
|
|
|
|
2011-02-06 14:03:32 +00:00
|
|
|
window->parent = gdk_win32_handle_table_lookup (parent);
|
2011-01-02 10:51:25 +00:00
|
|
|
if (!window->parent || GDK_WINDOW_TYPE (window->parent) == GDK_WINDOW_FOREIGN)
|
2015-12-17 23:36:57 +00:00
|
|
|
window->parent = gdk_get_default_root_window ();
|
2015-04-29 07:31:08 +00:00
|
|
|
|
2015-09-21 13:33:53 +00:00
|
|
|
window->parent->children = g_list_concat (&window->children_list_node, window->parent->children);
|
2013-05-15 08:23:14 +00:00
|
|
|
window->parent->impl_window->native_children =
|
|
|
|
g_list_prepend (window->parent->impl_window->native_children, window);
|
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);
|
2017-08-08 14:19:45 +00:00
|
|
|
window->x = point.x / impl->window_scale;
|
|
|
|
window->y = point.y / impl->window_scale;
|
2016-06-27 05:16:43 +00:00
|
|
|
impl->unscaled_width = rect.right - rect.left;
|
|
|
|
impl->unscaled_height = rect.bottom - rect.top;
|
|
|
|
window->width = (impl->unscaled_width + impl->window_scale - 1) / impl->window_scale;
|
|
|
|
window->height = (impl->unscaled_height + impl->window_scale - 1) / impl->window_scale;
|
2011-01-02 10:51:25 +00:00
|
|
|
window->window_type = GDK_WINDOW_FOREIGN;
|
|
|
|
window->destroyed = FALSE;
|
|
|
|
window->event_mask = GDK_ALL_EVENTS_MASK; /* XXX */
|
2001-03-09 16:43:19 +00:00
|
|
|
if (IsWindowVisible ((HWND) anid))
|
2011-01-02 10:51:25 +00:00
|
|
|
window->state &= (~GDK_WINDOW_STATE_WITHDRAWN);
|
2001-03-09 16:43:19 +00:00
|
|
|
else
|
2011-01-02 10:51:25 +00:00
|
|
|
window->state |= GDK_WINDOW_STATE_WITHDRAWN;
|
2003-11-15 20:35:55 +00:00
|
|
|
if (GetWindowLong ((HWND)anid, GWL_EXSTYLE) & WS_EX_TOPMOST)
|
2011-01-02 10:51:25 +00:00
|
|
|
window->state |= GDK_WINDOW_STATE_ABOVE;
|
2003-11-15 20:35:55 +00:00
|
|
|
else
|
2011-01-02 10:51:25 +00:00
|
|
|
window->state &= (~GDK_WINDOW_STATE_ABOVE);
|
|
|
|
window->state &= (~GDK_WINDOW_STATE_BELOW);
|
|
|
|
window->viewable = TRUE;
|
2003-11-15 20:35:55 +00:00
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
window->depth = gdk_visual_get_system ()->depth;
|
2014-07-25 23:12:24 +00:00
|
|
|
GDK_WINDOW_HWND (window) = anid;
|
1999-11-11 22:12:27 +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
|
|
|
|
2010-12-17 05:46:04 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_win32_window_foreign_new_for_display: %p: %s@%+d%+d\n",
|
2005-03-16 01:38:57 +00:00
|
|
|
(HWND) anid,
|
2011-01-02 10:51:25 +00:00
|
|
|
_gdk_win32_window_description (window),
|
|
|
|
window->x, window->y));
|
2005-03-16 01:38:57 +00:00
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
return window;
|
|
|
|
}
|
|
|
|
|
2010-12-10 19:06:13 +00:00
|
|
|
static void
|
|
|
|
gdk_win32_window_destroy (GdkWindow *window,
|
|
|
|
gboolean recursing,
|
|
|
|
gboolean foreign_destroy)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2011-01-02 10:51:25 +00:00
|
|
|
GdkWindowImplWin32 *window_impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
2007-10-18 00:31:22 +00:00
|
|
|
GSList *tmp;
|
Add a EGL renderer (via ANGLE) for Windows
This is for adding a EGL-based renderer which is done via the ANGLE
project, which translate EGL calls to Direct3D 9/11. This is done as a
possible solution to issue #105, especially for cases where the needed
full GL extensions to map OpenGL to Direc3D is unavailable or
unreliable, or when the OpenGL implementation from the graphics drivers
are problematic.
To enable this, do the following:
-Build ANGLE and ensure the ANGLE libEGL.dll and libGLESv2.dll are
available. A sufficiently-recent ANGLE is needed for things to
work correctly--note that the copy of ANGLE that is included in
qtbase-5.10.1 is sufficient. ANGLE is licensed under a BSD 3-clause
license. Note also that Visual Studio 2013 or later is required to
build ANGLE from QT-5.10.1, but the 2013-built ANGLE DLLs can work
without without problems for GTK+ that is built with Visual Studio
2008 or later.
-Build libepoxy on Windows with EGL support enabled.
-Define GDK_WIN32_ENABLE_EGL when building gdk-win32.lib when building
with Visual Studio, or pass in --enable-win32-gles during configure
when building with MinGW/mingw-w64.
-Prior to running GTK+ programs, the GDK_GL envvar needs to contain
gles.
Known issues:
-Only OpenGL ES 3 is supported, ANGLE's ES 2 does not support the needed
extensions, notably GL_OES_vertex_array_object, but its ES 3 support is
sufficient.
-There is no autodetection or fallback mechanism to enable using
EGL/Angle automatically yet. There is no plans to do this in this
commit.
Thanks to LRN for pointing out that we should #include
"win32/gdkwin32.h" instead of #include "gdkwin32.h" for gdkgl.c. LRN
also did the autotools portion of this patch.
Further notes about the autotools --enable-win32-gles option, fom LRN:
This adds --enable-win32-gles option, which enables the
code for GLES renderer. This commit also adds tests for WGL and
EGL in epoxy. The absence of WGL is highly unlikely (it's enabled
by default), but checking for EGL when GLES is enabled is necessary,
as EGL is disabled in Windows builds of epoxy by default.
2018-04-27 15:30:32 +00:00
|
|
|
GdkWin32Display *display = NULL;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
2015-04-29 07:31:08 +00:00
|
|
|
|
2010-12-10 19:06:13 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_win32_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
|
|
|
|
2008-02-05 16:47:24 +00:00
|
|
|
/* Remove ourself from the modal stack */
|
|
|
|
_gdk_remove_modal_window (window);
|
|
|
|
|
2007-10-18 00:31:22 +00:00
|
|
|
/* Remove all our transient children */
|
2018-07-17 10:01:54 +00:00
|
|
|
while (window_impl->transient_children != NULL)
|
2007-10-18 00:31:22 +00:00
|
|
|
{
|
2018-07-17 10:01:54 +00:00
|
|
|
GdkWindow *child = window_impl->transient_children->data;
|
|
|
|
gdk_window_set_transient_for (child, NULL);
|
2007-10-18 00:31:22 +00:00
|
|
|
}
|
|
|
|
|
Add a EGL renderer (via ANGLE) for Windows
This is for adding a EGL-based renderer which is done via the ANGLE
project, which translate EGL calls to Direct3D 9/11. This is done as a
possible solution to issue #105, especially for cases where the needed
full GL extensions to map OpenGL to Direc3D is unavailable or
unreliable, or when the OpenGL implementation from the graphics drivers
are problematic.
To enable this, do the following:
-Build ANGLE and ensure the ANGLE libEGL.dll and libGLESv2.dll are
available. A sufficiently-recent ANGLE is needed for things to
work correctly--note that the copy of ANGLE that is included in
qtbase-5.10.1 is sufficient. ANGLE is licensed under a BSD 3-clause
license. Note also that Visual Studio 2013 or later is required to
build ANGLE from QT-5.10.1, but the 2013-built ANGLE DLLs can work
without without problems for GTK+ that is built with Visual Studio
2008 or later.
-Build libepoxy on Windows with EGL support enabled.
-Define GDK_WIN32_ENABLE_EGL when building gdk-win32.lib when building
with Visual Studio, or pass in --enable-win32-gles during configure
when building with MinGW/mingw-w64.
-Prior to running GTK+ programs, the GDK_GL envvar needs to contain
gles.
Known issues:
-Only OpenGL ES 3 is supported, ANGLE's ES 2 does not support the needed
extensions, notably GL_OES_vertex_array_object, but its ES 3 support is
sufficient.
-There is no autodetection or fallback mechanism to enable using
EGL/Angle automatically yet. There is no plans to do this in this
commit.
Thanks to LRN for pointing out that we should #include
"win32/gdkwin32.h" instead of #include "gdkwin32.h" for gdkgl.c. LRN
also did the autotools portion of this patch.
Further notes about the autotools --enable-win32-gles option, fom LRN:
This adds --enable-win32-gles option, which enables the
code for GLES renderer. This commit also adds tests for WGL and
EGL in epoxy. The absence of WGL is highly unlikely (it's enabled
by default), but checking for EGL when GLES is enabled is necessary,
as EGL is disabled in Windows builds of epoxy by default.
2018-04-27 15:30:32 +00:00
|
|
|
#ifdef GDK_WIN32_ENABLE_EGL
|
|
|
|
display = GDK_WIN32_DISPLAY (gdk_window_get_display (window));
|
|
|
|
|
|
|
|
/* Get rid of any EGLSurfaces that we might have created */
|
|
|
|
if (window_impl->egl_surface != EGL_NO_SURFACE)
|
|
|
|
{
|
|
|
|
eglDestroySurface (display->egl_disp, window_impl->egl_surface);
|
|
|
|
window_impl->egl_surface = EGL_NO_SURFACE;
|
|
|
|
}
|
|
|
|
if (window_impl->egl_dummy_surface != EGL_NO_SURFACE)
|
|
|
|
{
|
|
|
|
eglDestroySurface (display->egl_disp, window_impl->egl_dummy_surface);
|
|
|
|
window_impl->egl_dummy_surface = EGL_NO_SURFACE;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
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
|
|
|
{
|
2011-01-02 10:51:25 +00:00
|
|
|
window->destroyed = TRUE;
|
2001-07-28 23:02:02 +00:00
|
|
|
DestroyWindow (GDK_WINDOW_HWND (window));
|
|
|
|
}
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
2010-12-10 19:06:13 +00:00
|
|
|
static void
|
|
|
|
gdk_win32_window_destroy_foreign (GdkWindow *window)
|
2004-03-13 18:27:56 +00:00
|
|
|
{
|
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);
|
2015-04-29 07:31:08 +00:00
|
|
|
|
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.
|
|
|
|
*/
|
2011-01-02 10:51:25 +00:00
|
|
|
static void
|
|
|
|
gdk_win32_window_destroy_notify (GdkWindow *window)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
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
|
|
|
}
|
2015-04-29 07:31:08 +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)
|
|
|
|
{
|
2016-06-27 05:16:43 +00:00
|
|
|
GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
|
|
|
|
2003-08-02 02:05:12 +00:00
|
|
|
rect->left = rect->top = 0;
|
2016-06-27 05:16:43 +00:00
|
|
|
rect->right = width * impl->window_scale;
|
|
|
|
rect->bottom = height * impl->window_scale;
|
2015-04-29 07:31:08 +00:00
|
|
|
|
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
|
2009-02-14 18:23:54 +00:00
|
|
|
adjust_for_gravity_hints (GdkWindow *window,
|
2009-07-18 14:24:02 +00:00
|
|
|
RECT *outer_rect,
|
|
|
|
gint *x,
|
|
|
|
gint *y)
|
2003-08-02 02:05:12 +00:00
|
|
|
{
|
2016-06-27 05:16:43 +00:00
|
|
|
GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
2009-02-14 18:23:54 +00:00
|
|
|
|
2003-08-02 02:05:12 +00:00
|
|
|
if (impl->hint_flags & GDK_HINT_WIN_GRAVITY)
|
|
|
|
{
|
2011-11-02 15:49:55 +00:00
|
|
|
#ifdef G_ENABLE_DEBUG
|
2003-08-02 02:05:12 +00:00
|
|
|
gint orig_x = *x, orig_y = *y;
|
2011-11-02 15:49:55 +00:00
|
|
|
#endif
|
2003-08-02 02:05:12 +00:00
|
|
|
|
|
|
|
switch (impl->hints.win_gravity)
|
|
|
|
{
|
|
|
|
case GDK_GRAVITY_NORTH:
|
|
|
|
case GDK_GRAVITY_CENTER:
|
|
|
|
case GDK_GRAVITY_SOUTH:
|
2016-06-27 05:16:43 +00:00
|
|
|
*x -= (outer_rect->right - outer_rect->left / 2) / impl->window_scale;
|
2011-01-02 10:51:25 +00:00
|
|
|
*x += window->width / 2;
|
2003-08-02 02:05:12 +00:00
|
|
|
break;
|
2015-04-29 07:31:08 +00:00
|
|
|
|
2003-08-02 02:05:12 +00:00
|
|
|
case GDK_GRAVITY_SOUTH_EAST:
|
|
|
|
case GDK_GRAVITY_EAST:
|
|
|
|
case GDK_GRAVITY_NORTH_EAST:
|
2016-06-27 05:16:43 +00:00
|
|
|
*x -= (outer_rect->right - outer_rect->left) / impl->window_scale;
|
2011-01-02 10:51:25 +00:00
|
|
|
*x += window->width;
|
2003-08-02 02:05:12 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_GRAVITY_STATIC:
|
2016-06-27 05:16:43 +00:00
|
|
|
*x += outer_rect->left / impl->window_scale;
|
2003-08-02 02:05:12 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (impl->hints.win_gravity)
|
|
|
|
{
|
|
|
|
case GDK_GRAVITY_WEST:
|
|
|
|
case GDK_GRAVITY_CENTER:
|
|
|
|
case GDK_GRAVITY_EAST:
|
2016-06-27 05:16:43 +00:00
|
|
|
*y -= ((outer_rect->bottom - outer_rect->top) / 2) / impl->window_scale;
|
2011-01-02 10:51:25 +00:00
|
|
|
*y += window->height / 2;
|
2003-08-02 02:05:12 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_GRAVITY_SOUTH_WEST:
|
|
|
|
case GDK_GRAVITY_SOUTH:
|
|
|
|
case GDK_GRAVITY_SOUTH_EAST:
|
2016-06-27 05:16:43 +00:00
|
|
|
*y -= (outer_rect->bottom - outer_rect->top) / impl->window_scale;
|
2011-01-02 10:51:25 +00:00
|
|
|
*y += window->height;
|
2003-08-02 02:05:12 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_GRAVITY_STATIC:
|
2016-06-27 05:16:43 +00:00
|
|
|
*y += outer_rect->top * impl->window_scale;
|
2003-08-02 02:05:12 +00:00
|
|
|
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,
|
2011-10-25 12:26:22 +00:00
|
|
|
gboolean already_mapped,
|
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 deiconify)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2011-10-27 14:09:42 +00:00
|
|
|
GdkWindowImplWin32 *window_impl;
|
2011-10-25 12:26:22 +00:00
|
|
|
gboolean focus_on_map = FALSE;
|
2008-10-21 20:31:05 +00:00
|
|
|
DWORD exstyle;
|
2004-05-08 16:25:15 +00:00
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
if (window->destroyed)
|
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;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2011-10-25 12:26:22 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("show_window_internal: %p: %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),
|
2011-01-02 10:51:25 +00:00
|
|
|
_gdk_win32_window_state_to_string (window->state),
|
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
|
|
|
(deiconify ? " deiconify" : "")));
|
2015-04-29 07:31:08 +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 show (not deiconify) an withdrawn and iconified
|
|
|
|
* window, do that.
|
|
|
|
*/
|
|
|
|
if (!deiconify &&
|
2011-10-25 12:26:22 +00:00
|
|
|
!already_mapped &&
|
2011-01-02 10:51:25 +00:00
|
|
|
(window->state & GDK_WINDOW_STATE_ICONIFIED))
|
2015-04-29 07:31:08 +00:00
|
|
|
{
|
2016-06-27 05:16:43 +00:00
|
|
|
GtkShowWindow (window, SW_SHOWMINNOACTIVE);
|
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;
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
2015-04-29 07:31:08 +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. */
|
2011-01-02 10:51:25 +00:00
|
|
|
if (!deiconify && (window->state & GDK_WINDOW_STATE_ICONIFIED))
|
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;
|
2015-04-29 07:31:08 +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 deiconify an already noniconified window, do
|
|
|
|
* nothing. (Especially, don't cause the window to rise and
|
|
|
|
* activate. There are different calls for that.)
|
|
|
|
*/
|
2011-01-02 10:51:25 +00:00
|
|
|
if (deiconify && !(window->state & GDK_WINDOW_STATE_ICONIFIED))
|
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;
|
2015-04-29 07:31:08 +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 show (but not raise) a window that is already
|
|
|
|
* visible, do nothing.
|
|
|
|
*/
|
2011-10-25 12:26:22 +00:00
|
|
|
if (!deiconify && !already_mapped && IsWindowVisible (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
|
|
|
return;
|
|
|
|
|
|
|
|
/* Other cases */
|
2015-04-29 07:31:08 +00:00
|
|
|
|
2011-10-25 12:26:22 +00:00
|
|
|
if (!already_mapped)
|
|
|
|
focus_on_map = window->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
|
|
|
|
2008-10-21 20:31:05 +00:00
|
|
|
exstyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_EXSTYLE);
|
|
|
|
|
2004-03-10 22:20:36 +00:00
|
|
|
/* Use SetWindowPos to show transparent windows so automatic redraws
|
|
|
|
* in other windows can be suppressed.
|
|
|
|
*/
|
2008-10-21 20:31:05 +00:00
|
|
|
if (exstyle & WS_EX_TRANSPARENT)
|
2004-03-10 22:20:36 +00:00
|
|
|
{
|
2011-10-25 12:26:22 +00:00
|
|
|
UINT flags = SWP_SHOWWINDOW | SWP_NOREDRAW | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER;
|
2008-10-21 20:31:05 +00:00
|
|
|
|
2011-10-25 12:26:22 +00:00
|
|
|
if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_TEMP || !focus_on_map)
|
2009-07-18 14:24:02 +00:00
|
|
|
flags |= SWP_NOACTIVATE;
|
2004-03-10 22:20:36 +00:00
|
|
|
|
2015-11-21 03:58:22 +00:00
|
|
|
SetWindowPos (GDK_WINDOW_HWND (window),
|
|
|
|
SWP_NOZORDER_SPECIFIED, 0, 0, 0, 0, flags);
|
2008-10-21 20:31:05 +00:00
|
|
|
|
2004-03-10 22:20:36 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-10-27 14:09:42 +00:00
|
|
|
/* For initial map of "normal" windows we want to emulate WM window
|
2015-04-29 07:31:08 +00:00
|
|
|
* positioning behaviour, which means:
|
2011-10-27 14:09:42 +00:00
|
|
|
* + Use user specified position if GDK_HINT_POS or GDK_HINT_USER_POS
|
|
|
|
* otherwise:
|
|
|
|
* + default to the initial CW_USEDEFAULT placement,
|
|
|
|
* no matter if the user moved the window before showing it.
|
|
|
|
* + Certain window types and hints have more elaborate positioning
|
|
|
|
* schemes.
|
|
|
|
*/
|
|
|
|
window_impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
|
|
|
if (!already_mapped &&
|
|
|
|
GDK_WINDOW_TYPE (window) == GDK_WINDOW_TOPLEVEL &&
|
|
|
|
(window_impl->hint_flags & (GDK_HINT_POS | GDK_HINT_USER_POS)) == 0 &&
|
|
|
|
!window_impl->override_redirect)
|
|
|
|
{
|
|
|
|
gboolean center = FALSE;
|
|
|
|
RECT window_rect, center_on_rect;
|
|
|
|
int x, y;
|
|
|
|
|
|
|
|
x = window_impl->initial_x;
|
|
|
|
y = window_impl->initial_y;
|
|
|
|
|
|
|
|
if (window_impl->type_hint == GDK_WINDOW_TYPE_HINT_SPLASHSCREEN)
|
|
|
|
{
|
|
|
|
HMONITOR monitor;
|
|
|
|
MONITORINFO mi;
|
|
|
|
|
|
|
|
monitor = MonitorFromWindow (GDK_WINDOW_HWND (window), MONITOR_DEFAULTTONEAREST);
|
|
|
|
mi.cbSize = sizeof (mi);
|
|
|
|
if (monitor && GetMonitorInfo (monitor, &mi))
|
|
|
|
center_on_rect = mi.rcMonitor;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
center_on_rect.left = 0;
|
2016-03-14 16:14:22 +00:00
|
|
|
center_on_rect.top = 0;
|
2011-10-27 14:09:42 +00:00
|
|
|
center_on_rect.right = GetSystemMetrics (SM_CXSCREEN);
|
|
|
|
center_on_rect.bottom = GetSystemMetrics (SM_CYSCREEN);
|
|
|
|
}
|
|
|
|
center = TRUE;
|
|
|
|
}
|
|
|
|
else if (window_impl->transient_owner != NULL &&
|
|
|
|
GDK_WINDOW_IS_MAPPED (window_impl->transient_owner))
|
|
|
|
{
|
|
|
|
GdkWindow *owner = window_impl->transient_owner;
|
|
|
|
/* Center on transient parent */
|
2016-06-27 05:16:43 +00:00
|
|
|
center_on_rect.left = (owner->x - _gdk_offset_x) * window_impl->window_scale;
|
|
|
|
center_on_rect.top = (owner->y - _gdk_offset_y) * window_impl->window_scale;
|
|
|
|
center_on_rect.right = center_on_rect.left + owner->width * window_impl->window_scale;
|
|
|
|
center_on_rect.bottom = center_on_rect.top + owner->height * window_impl->window_scale;
|
|
|
|
|
2011-10-27 14:09:42 +00:00
|
|
|
_gdk_win32_adjust_client_rect (GDK_WINDOW (owner), ¢er_on_rect);
|
|
|
|
center = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (center)
|
|
|
|
{
|
|
|
|
window_rect.left = 0;
|
|
|
|
window_rect.top = 0;
|
2016-06-27 05:16:43 +00:00
|
|
|
window_rect.right = window->width * window_impl->window_scale;
|
|
|
|
window_rect.bottom = window->height * window_impl->window_scale;
|
2011-10-27 14:09:42 +00:00
|
|
|
_gdk_win32_adjust_client_rect (window, &window_rect);
|
|
|
|
|
|
|
|
x = center_on_rect.left + ((center_on_rect.right - center_on_rect.left) - (window_rect.right - window_rect.left)) / 2;
|
|
|
|
y = center_on_rect.top + ((center_on_rect.bottom - center_on_rect.top) - (window_rect.bottom - window_rect.top)) / 2;
|
|
|
|
}
|
|
|
|
|
2015-11-21 03:58:22 +00:00
|
|
|
API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window),
|
|
|
|
SWP_NOZORDER_SPECIFIED,
|
2011-10-27 14:09:42 +00:00
|
|
|
x, y, 0, 0,
|
|
|
|
SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER));
|
|
|
|
}
|
|
|
|
|
2011-11-02 13:30:23 +00:00
|
|
|
if (!already_mapped &&
|
|
|
|
GDK_WINDOW_TYPE (window) == GDK_WINDOW_TOPLEVEL &&
|
|
|
|
!window_impl->override_redirect)
|
|
|
|
{
|
|
|
|
/* Ensure new windows are fully onscreen */
|
|
|
|
RECT window_rect;
|
|
|
|
HMONITOR monitor;
|
|
|
|
MONITORINFO mi;
|
|
|
|
int x, y;
|
|
|
|
|
|
|
|
GetWindowRect (GDK_WINDOW_HWND (window), &window_rect);
|
|
|
|
|
|
|
|
monitor = MonitorFromWindow (GDK_WINDOW_HWND (window), MONITOR_DEFAULTTONEAREST);
|
|
|
|
mi.cbSize = sizeof (mi);
|
|
|
|
if (monitor && GetMonitorInfo (monitor, &mi))
|
|
|
|
{
|
|
|
|
x = window_rect.left;
|
|
|
|
y = window_rect.top;
|
|
|
|
|
|
|
|
if (window_rect.right > mi.rcWork.right)
|
|
|
|
{
|
|
|
|
window_rect.left -= (window_rect.right - mi.rcWork.right);
|
|
|
|
window_rect.right -= (window_rect.right - mi.rcWork.right);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (window_rect.bottom > mi.rcWork.bottom)
|
|
|
|
{
|
|
|
|
window_rect.top -= (window_rect.bottom - mi.rcWork.bottom);
|
|
|
|
window_rect.bottom -= (window_rect.bottom - mi.rcWork.bottom);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (window_rect.left < mi.rcWork.left)
|
|
|
|
{
|
|
|
|
window_rect.right += (mi.rcWork.left - window_rect.left);
|
|
|
|
window_rect.left += (mi.rcWork.left - window_rect.left);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (window_rect.top < mi.rcWork.top)
|
|
|
|
{
|
|
|
|
window_rect.bottom += (mi.rcWork.top - window_rect.top);
|
|
|
|
window_rect.top += (mi.rcWork.top - window_rect.top);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (x != window_rect.left || y != window_rect.top)
|
2015-11-21 03:58:22 +00:00
|
|
|
API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window),
|
|
|
|
SWP_NOZORDER_SPECIFIED,
|
2011-11-02 13:30:23 +00:00
|
|
|
window_rect.left, window_rect.top, 0, 0,
|
|
|
|
SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
if (window->state & GDK_WINDOW_STATE_FULLSCREEN)
|
2008-08-28 02:42:23 +00:00
|
|
|
{
|
|
|
|
gdk_window_fullscreen (window);
|
|
|
|
}
|
2011-01-02 10:51:25 +00:00
|
|
|
else if (window->state & GDK_WINDOW_STATE_MAXIMIZED)
|
2008-08-28 02:42:23 +00:00
|
|
|
{
|
2016-06-27 05:16:43 +00:00
|
|
|
GtkShowWindow (window, SW_MAXIMIZE);
|
2008-08-28 02:42:23 +00:00
|
|
|
}
|
2011-01-02 10:51:25 +00:00
|
|
|
else if (window->state & GDK_WINDOW_STATE_ICONIFIED)
|
2008-08-28 02:42:23 +00:00
|
|
|
{
|
2011-10-25 12:26:22 +00:00
|
|
|
if (focus_on_map)
|
2016-06-27 05:16:43 +00:00
|
|
|
GtkShowWindow (window, SW_RESTORE);
|
2011-10-25 12:26:22 +00:00
|
|
|
else
|
2016-06-27 05:16:43 +00:00
|
|
|
GtkShowWindow (window, SW_SHOWNOACTIVATE);
|
2008-08-28 02:42:23 +00:00
|
|
|
}
|
2004-05-08 16:25:15 +00:00
|
|
|
else if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_TEMP || !focus_on_map)
|
2008-08-28 02:42:23 +00:00
|
|
|
{
|
2016-02-08 12:20:02 +00:00
|
|
|
if (!IsWindowVisible (GDK_WINDOW_HWND (window)))
|
2016-06-27 05:16:43 +00:00
|
|
|
GtkShowWindow (window, SW_SHOWNOACTIVATE);
|
2016-02-08 12:20:02 +00:00
|
|
|
else
|
2016-06-27 05:16:43 +00:00
|
|
|
GtkShowWindow (window, SW_SHOWNA);
|
2008-08-28 02:42:23 +00:00
|
|
|
}
|
2016-02-08 12:20:02 +00:00
|
|
|
else if (!IsWindowVisible (GDK_WINDOW_HWND (window)))
|
2008-08-28 02:42:23 +00:00
|
|
|
{
|
2016-06-27 05:16:43 +00:00
|
|
|
GtkShowWindow (window, SW_SHOWNORMAL);
|
2008-08-28 02:42:23 +00:00
|
|
|
}
|
2016-02-08 12:20:02 +00:00
|
|
|
else
|
|
|
|
{
|
2016-06-27 05:16:43 +00:00
|
|
|
GtkShowWindow (window, SW_SHOW);
|
2016-02-08 12:20:02 +00:00
|
|
|
}
|
2011-10-26 09:08:33 +00:00
|
|
|
|
|
|
|
/* Sync STATE_ABOVE to TOPMOST */
|
2011-11-25 10:21:26 +00:00
|
|
|
if (GDK_WINDOW_TYPE (window) != GDK_WINDOW_TEMP &&
|
|
|
|
(((window->state & GDK_WINDOW_STATE_ABOVE) &&
|
|
|
|
!(exstyle & WS_EX_TOPMOST)) ||
|
|
|
|
(!(window->state & GDK_WINDOW_STATE_ABOVE) &&
|
|
|
|
(exstyle & WS_EX_TOPMOST))))
|
2011-10-26 09:08:33 +00:00
|
|
|
{
|
|
|
|
API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window),
|
|
|
|
(window->state & GDK_WINDOW_STATE_ABOVE)?HWND_TOPMOST:HWND_NOTOPMOST,
|
|
|
|
0, 0, 0, 0,
|
2018-06-17 10:48:48 +00:00
|
|
|
SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOOWNERZORDER));
|
2011-10-26 09:08:33 +00:00
|
|
|
}
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
2008-07-02 13:58:28 +00:00
|
|
|
static void
|
2015-04-29 07:31:08 +00:00
|
|
|
gdk_win32_window_show (GdkWindow *window,
|
2009-07-01 08:26:37 +00:00
|
|
|
gboolean already_mapped)
|
2001-08-19 18:34:59 +00:00
|
|
|
{
|
2009-02-14 18:23:54 +00:00
|
|
|
show_window_internal (window, FALSE, FALSE);
|
2001-08-19 18:34:59 +00:00
|
|
|
}
|
|
|
|
|
2008-07-02 13:58:28 +00:00
|
|
|
static void
|
2008-07-02 06:06:29 +00:00
|
|
|
gdk_win32_window_hide (GdkWindow *window)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2011-01-02 10:51:25 +00:00
|
|
|
if (window->destroyed)
|
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
|
|
|
return;
|
2000-07-25 17:31:05 +00:00
|
|
|
|
2009-10-18 08:43:33 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_win32_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),
|
2011-01-02 10:51:25 +00:00
|
|
|
_gdk_win32_window_state_to_string (window->state)));
|
2015-04-29 07:31:08 +00:00
|
|
|
|
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 (GDK_WINDOW_IS_MAPPED (window))
|
|
|
|
gdk_synthesize_window_state (window,
|
|
|
|
0,
|
|
|
|
GDK_WINDOW_STATE_WITHDRAWN);
|
2015-04-29 07:31:08 +00:00
|
|
|
|
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_clear_update_area (window);
|
2015-04-29 07:31:08 +00:00
|
|
|
|
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 (GDK_WINDOW_TYPE (window) == GDK_WINDOW_TOPLEVEL)
|
|
|
|
ShowOwnedPopups (GDK_WINDOW_HWND (window), FALSE);
|
2015-04-29 07:31:08 +00:00
|
|
|
|
2015-11-21 04:00:33 +00:00
|
|
|
/* Use SetWindowPos to hide transparent windows so automatic redraws
|
|
|
|
* in other windows can be suppressed.
|
|
|
|
*/
|
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 (GetWindowLong (GDK_WINDOW_HWND (window), GWL_EXSTYLE) & WS_EX_TRANSPARENT)
|
|
|
|
{
|
2015-11-21 03:58:22 +00:00
|
|
|
SetWindowPos (GDK_WINDOW_HWND (window), SWP_NOZORDER_SPECIFIED,
|
2005-03-16 01:38:57 +00:00
|
|
|
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
|
|
|
|
{
|
2016-06-27 05:16:43 +00:00
|
|
|
GtkShowWindow (window, SW_HIDE);
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-07-02 13:58:28 +00:00
|
|
|
static void
|
2008-07-02 06:06:29 +00:00
|
|
|
gdk_win32_window_withdraw (GdkWindow *window)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2011-01-02 10:51:25 +00:00
|
|
|
if (window->destroyed)
|
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
|
|
|
return;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2009-10-18 08:43:33 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_win32_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),
|
2011-01-02 10:51:25 +00:00
|
|
|
_gdk_win32_window_state_to_string (window->state)));
|
|
|
|
|
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_hide (window); /* ??? */
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
2008-07-02 13:58:28 +00:00
|
|
|
static void
|
2008-07-02 20:22:30 +00:00
|
|
|
gdk_win32_window_move (GdkWindow *window,
|
|
|
|
gint x, gint y)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
|
|
|
return;
|
|
|
|
|
2009-10-18 08:43:33 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_win32_window_move: %p: %+d%+d\n",
|
2008-07-02 20:22:30 +00:00
|
|
|
GDK_WINDOW_HWND (window), x, y));
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
if (window->state & GDK_WINDOW_STATE_FULLSCREEN)
|
2011-10-27 08:42:07 +00:00
|
|
|
return;
|
2008-07-02 20:22:30 +00:00
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
/* Don't check GDK_WINDOW_TYPE (window) == GDK_WINDOW_CHILD.
|
2008-07-02 20:22:30 +00:00
|
|
|
* Foreign windows (another app's windows) might be children of our
|
|
|
|
* windows! Especially in the case of gtkplug/socket.
|
|
|
|
*/
|
|
|
|
if (GetAncestor (GDK_WINDOW_HWND (window), GA_PARENT) != GetDesktopWindow ())
|
|
|
|
{
|
2011-01-02 10:51:25 +00:00
|
|
|
_gdk_window_move_resize_child (window, x, y, window->width, window->height);
|
2008-07-02 20:22:30 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
RECT outer_rect;
|
2016-06-27 05:16:43 +00:00
|
|
|
GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
2008-07-02 20:22:30 +00:00
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
get_outer_rect (window, window->width, window->height, &outer_rect);
|
2008-07-02 20:22:30 +00:00
|
|
|
|
2009-02-14 18:23:54 +00:00
|
|
|
adjust_for_gravity_hints (window, &outer_rect, &x, &y);
|
2008-07-02 20:22:30 +00:00
|
|
|
|
|
|
|
GDK_NOTE (MISC, g_print ("... SetWindowPos(%p,NULL,%d,%d,0,0,"
|
|
|
|
"NOACTIVATE|NOSIZE|NOZORDER)\n",
|
|
|
|
GDK_WINDOW_HWND (window),
|
2016-06-27 05:16:43 +00:00
|
|
|
(x - _gdk_offset_x) * impl->window_scale,
|
|
|
|
(y - _gdk_offset_y) * impl->window_scale));
|
2008-07-02 20:22:30 +00:00
|
|
|
|
2015-11-21 03:58:22 +00:00
|
|
|
API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window),
|
|
|
|
SWP_NOZORDER_SPECIFIED,
|
2016-06-27 05:16:43 +00:00
|
|
|
(x - _gdk_offset_x) * impl->window_scale,
|
|
|
|
(y - _gdk_offset_y) * impl->window_scale,
|
|
|
|
0, 0,
|
2008-07-02 20:22:30 +00:00
|
|
|
SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gdk_win32_window_resize (GdkWindow *window,
|
|
|
|
gint width, gint height)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2008-07-02 20:22:30 +00:00
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
|
|
|
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;
|
2008-07-02 20:22:30 +00:00
|
|
|
|
2009-10-18 08:43:33 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_win32_window_resize: %p: %dx%d\n",
|
2008-07-02 20:22:30 +00:00
|
|
|
GDK_WINDOW_HWND (window), width, height));
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
if (window->state & GDK_WINDOW_STATE_FULLSCREEN)
|
2011-10-27 08:42:07 +00:00
|
|
|
return;
|
2008-07-02 20:22:30 +00:00
|
|
|
|
|
|
|
if (GetAncestor (GDK_WINDOW_HWND (window), GA_PARENT) != GetDesktopWindow ())
|
|
|
|
{
|
2011-01-02 10:51:25 +00:00
|
|
|
_gdk_window_move_resize_child (window, window->x, window->y, width, height);
|
2008-07-02 20:22:30 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
RECT outer_rect;
|
2016-06-27 05:16:43 +00:00
|
|
|
GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
2008-07-02 20:22:30 +00:00
|
|
|
|
|
|
|
get_outer_rect (window, width, height, &outer_rect);
|
|
|
|
|
|
|
|
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));
|
|
|
|
|
2015-11-21 03:58:22 +00:00
|
|
|
API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window),
|
|
|
|
SWP_NOZORDER_SPECIFIED,
|
2008-07-02 20:22:30 +00:00
|
|
|
0, 0,
|
|
|
|
outer_rect.right - outer_rect.left,
|
|
|
|
outer_rect.bottom - outer_rect.top,
|
|
|
|
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER));
|
2011-01-02 10:51:25 +00:00
|
|
|
window->resize_count += 1;
|
2008-07-02 20:22:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gdk_win32_window_move_resize_internal (GdkWindow *window,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (width < 1)
|
|
|
|
width = 1;
|
|
|
|
if (height < 1)
|
|
|
|
height = 1;
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
if (window->state & GDK_WINDOW_STATE_FULLSCREEN)
|
2011-10-27 08:42:07 +00:00
|
|
|
return;
|
2003-08-05 22:24:35 +00:00
|
|
|
|
2009-10-18 08:43:33 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_win32_window_move_resize: %p: %dx%d@%+d%+d\n",
|
2008-07-02 20:22:30 +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;
|
2016-06-27 05:16:43 +00:00
|
|
|
GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->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-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
|
|
|
|
2009-02-14 18:23:54 +00:00
|
|
|
adjust_for_gravity_hints (window, &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,"
|
2008-07-02 20:22:30 +00:00
|
|
|
"NOACTIVATE|NOZORDER)\n",
|
|
|
|
GDK_WINDOW_HWND (window),
|
2016-06-27 05:16:43 +00:00
|
|
|
(x - _gdk_offset_x) * impl->window_scale,
|
|
|
|
(y - _gdk_offset_y) * impl->window_scale,
|
2008-07-02 20:22:30 +00:00
|
|
|
outer_rect.right - outer_rect.left,
|
|
|
|
outer_rect.bottom - outer_rect.top));
|
2008-07-02 06:06:29 +00:00
|
|
|
|
2015-11-21 03:58:22 +00:00
|
|
|
API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window),
|
|
|
|
SWP_NOZORDER_SPECIFIED,
|
2016-06-27 05:16:43 +00:00
|
|
|
(x - _gdk_offset_x) * impl->window_scale,
|
|
|
|
(y - _gdk_offset_y) * impl->window_scale,
|
2008-07-02 20:22:30 +00:00
|
|
|
outer_rect.right - outer_rect.left,
|
|
|
|
outer_rect.bottom - outer_rect.top,
|
|
|
|
SWP_NOACTIVATE | SWP_NOZORDER));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gdk_win32_window_move_resize (GdkWindow *window,
|
|
|
|
gboolean with_move,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
|
|
|
{
|
2011-10-27 08:42:07 +00:00
|
|
|
GdkWindowImplWin32 *window_impl;
|
|
|
|
|
|
|
|
window_impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
|
|
|
window_impl->inhibit_configure = TRUE;
|
|
|
|
|
2015-04-29 07:31:08 +00:00
|
|
|
/* We ignore changes to the window being moved or resized by the
|
2011-10-25 14:13:47 +00:00
|
|
|
user, as we don't want to fight the user */
|
|
|
|
if (GDK_WINDOW_HWND (window) == _modal_move_resize_window)
|
2011-10-27 08:42:07 +00:00
|
|
|
goto out;
|
2011-10-25 14:13:47 +00:00
|
|
|
|
2008-07-02 20:22:30 +00:00
|
|
|
if (with_move && (width < 0 && height < 0))
|
|
|
|
{
|
|
|
|
gdk_win32_window_move (window, x, y);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-06-20 09:27:30 +00:00
|
|
|
_gdk_win32_window_invalidate_egl_framebuffer (window);
|
2008-07-02 20:22:30 +00:00
|
|
|
if (with_move)
|
|
|
|
{
|
|
|
|
gdk_win32_window_move_resize_internal (window, x, y, width, height);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gdk_win32_window_resize (window, width, height);
|
|
|
|
}
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
2011-10-27 08:42:07 +00:00
|
|
|
|
|
|
|
out:
|
|
|
|
window_impl->inhibit_configure = FALSE;
|
|
|
|
|
|
|
|
if (WINDOW_IS_TOPLEVEL (window))
|
|
|
|
_gdk_win32_emit_configure_event (window);
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
2008-07-02 06:06:29 +00:00
|
|
|
static gboolean
|
|
|
|
gdk_win32_window_reparent (GdkWindow *window,
|
|
|
|
GdkWindow *new_parent,
|
|
|
|
gint x,
|
|
|
|
gint y)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2015-12-17 23:36:57 +00:00
|
|
|
GdkScreen *screen;
|
2000-07-25 17:31:05 +00:00
|
|
|
GdkWindowImplWin32 *impl;
|
2015-12-17 23:36:57 +00:00
|
|
|
gboolean new_parent_is_root;
|
2005-03-16 02:21:14 +00:00
|
|
|
gboolean was_toplevel;
|
|
|
|
LONG style;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2015-12-17 23:36:57 +00:00
|
|
|
screen = gdk_window_get_screen (window);
|
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
if (!new_parent)
|
2015-12-17 23:36:57 +00:00
|
|
|
{
|
|
|
|
new_parent = gdk_screen_get_root_window (screen);
|
|
|
|
new_parent_is_root = TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
new_parent_is_root = (gdk_screen_get_root_window (screen) == new_parent);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2009-10-18 08:43:33 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_win32_window_reparent: %p: %p\n",
|
2005-03-16 02:21:14 +00:00
|
|
|
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 ();
|
2015-12-17 23:36:57 +00:00
|
|
|
if (was_toplevel && !new_parent_is_root)
|
2005-03-16 02:21:14 +00:00
|
|
|
{
|
|
|
|
/* 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);
|
|
|
|
}
|
2015-12-17 23:36:57 +00:00
|
|
|
else if (new_parent_is_root)
|
2005-03-16 02:21:14 +00:00
|
|
|
{
|
|
|
|
/* 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)));
|
2015-04-29 07:31:08 +00:00
|
|
|
|
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)
|
2015-12-17 23:36:57 +00:00
|
|
|
new_parent = gdk_screen_get_root_window (screen);
|
2015-04-29 07:31:08 +00:00
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
window->parent = 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_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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-04-15 11:22:20 +00:00
|
|
|
/* Move window into desired position while keeping the same client area */
|
|
|
|
gdk_win32_window_move_resize (window, TRUE, x, y, window->width, window->height);
|
|
|
|
|
2008-08-28 00:32:17 +00:00
|
|
|
return FALSE;
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
2008-07-02 13:58:28 +00:00
|
|
|
static void
|
2008-07-02 06:06:29 +00:00
|
|
|
gdk_win32_window_raise (GdkWindow *window)
|
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
|
|
|
{
|
2009-10-18 08:43:33 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_win32_window_raise: %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
|
|
|
|
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,
|
2018-06-17 10:44:04 +00:00
|
|
|
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOOWNERZORDER));
|
2011-01-02 10:51:25 +00:00
|
|
|
else if (window->accept_focus)
|
2012-01-25 12:02:21 +00:00
|
|
|
/* Do not wrap this in an API_CALL macro as SetForegroundWindow might
|
|
|
|
* fail when for example dragging a window belonging to a different
|
|
|
|
* application at the time of a gtk_window_present() call due to focus
|
|
|
|
* stealing prevention. */
|
|
|
|
SetForegroundWindow (GDK_WINDOW_HWND (window));
|
2006-02-09 03:20:56 +00:00
|
|
|
else
|
|
|
|
API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window), HWND_TOP,
|
|
|
|
0, 0, 0, 0,
|
2018-06-17 10:48:48 +00:00
|
|
|
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOOWNERZORDER));
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-07-02 13:58:28 +00:00
|
|
|
static void
|
2008-07-02 06:06:29 +00:00
|
|
|
gdk_win32_window_lower (GdkWindow *window)
|
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
|
|
|
{
|
2009-10-18 08:43:33 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_win32_window_lower: %p\n"
|
2005-03-16 01:38:57 +00:00
|
|
|
"... 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,
|
2018-06-17 10:48:48 +00:00
|
|
|
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOOWNERZORDER));
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
static void
|
|
|
|
gdk_win32_window_set_urgency_hint (GdkWindow *window,
|
2005-07-03 15:47:42 +00:00
|
|
|
gboolean urgent)
|
|
|
|
{
|
2005-08-01 07:19:15 +00:00
|
|
|
FLASHWINFO flashwinfo;
|
2012-11-23 20:38:34 +00:00
|
|
|
typedef BOOL (WINAPI *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);
|
2015-04-29 07:31:08 +00:00
|
|
|
|
2005-09-18 12:28:42 +00:00
|
|
|
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;
|
2015-04-29 07:31:08 +00:00
|
|
|
|
2005-11-28 08:40:56 +00:00
|
|
|
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;
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
impl = (GdkWindowImplWin32 *)window->impl;
|
2005-11-27 02:58:09 +00:00
|
|
|
|
2006-02-09 02:58:45 +00:00
|
|
|
if (gdk_window_get_decorations (window, decoration))
|
|
|
|
return TRUE;
|
2015-04-29 07:31:08 +00:00
|
|
|
|
|
|
|
if (window->window_type != GDK_WINDOW_TOPLEVEL)
|
2008-02-05 16:47:24 +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;
|
2008-02-05 16:47:24 +00:00
|
|
|
|
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)
|
2008-02-05 16:47:24 +00:00
|
|
|
{
|
|
|
|
*decoration |= GDK_DECOR_MINIMIZE;
|
|
|
|
}
|
2005-11-27 02:58:09 +00:00
|
|
|
else if (impl->type_hint == GDK_WINDOW_TYPE_HINT_SPLASHSCREEN)
|
2008-02-05 16:47:24 +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)
|
2008-02-05 16:47:24 +00:00
|
|
|
{
|
|
|
|
*decoration |= GDK_DECOR_MINIMIZE;
|
|
|
|
}
|
|
|
|
|
2006-02-09 02:58:45 +00:00
|
|
|
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:
|
2008-10-05 00:00:10 +00:00
|
|
|
case GDK_WINDOW_TYPE_HINT_UTILITY:
|
2005-11-27 02:58:09 +00:00
|
|
|
gdk_window_set_skip_taskbar_hint (window, TRUE);
|
2008-10-05 00:00:10 +00:00
|
|
|
gdk_window_set_skip_pager_hint (window, TRUE);
|
|
|
|
*decoration = (GDK_DECOR_ALL | GDK_DECOR_MINIMIZE | GDK_DECOR_MAXIMIZE);
|
2006-02-09 02:58:45 +00:00
|
|
|
return TRUE;
|
|
|
|
|
2005-11-27 02:58:09 +00:00
|
|
|
case GDK_WINDOW_TYPE_HINT_SPLASHSCREEN:
|
2008-10-05 00:00:10 +00:00
|
|
|
*decoration = (GDK_DECOR_ALL | GDK_DECOR_RESIZEH | GDK_DECOR_MENU |
|
|
|
|
GDK_DECOR_MINIMIZE | GDK_DECOR_MAXIMIZE);
|
2006-02-09 02:58:45 +00:00
|
|
|
return TRUE;
|
2015-04-29 07:31:08 +00:00
|
|
|
|
2005-11-27 02:58:09 +00:00
|
|
|
case GDK_WINDOW_TYPE_HINT_DOCK:
|
2006-02-09 02:58:45 +00:00
|
|
|
return FALSE;
|
2015-04-29 07:31:08 +00:00
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|
2015-04-29 07:31:08 +00:00
|
|
|
|
2006-02-09 02:58:45 +00:00
|
|
|
return FALSE;
|
2005-11-27 02:58:09 +00:00
|
|
|
}
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
static void
|
|
|
|
gdk_win32_window_set_geometry_hints (GdkWindow *window,
|
2008-01-15 15:32:37 +00:00
|
|
|
const GdkGeometry *geometry,
|
|
|
|
GdkWindowHints geom_mask)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
GdkWindowImplWin32 *impl;
|
2011-10-26 10:43:24 +00:00
|
|
|
FullscreenInfo *fi;
|
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));
|
2015-04-29 07:31:08 +00:00
|
|
|
|
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)));
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2011-10-26 10:43:24 +00:00
|
|
|
fi = g_object_get_data (G_OBJECT (window), "fullscreen-info");
|
|
|
|
if (fi)
|
|
|
|
fi->hint_flags = geom_mask;
|
|
|
|
else
|
|
|
|
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)
|
2016-02-06 01:14:37 +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
|
|
|
}
|
2015-04-29 07:31:08 +00:00
|
|
|
|
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
|
|
|
}
|
2015-04-29 07:31:08 +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
|
|
|
}
|
2015-04-29 07:31:08 +00:00
|
|
|
|
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
|
|
|
|
2016-03-08 05:00:49 +00:00
|
|
|
_gdk_win32_window_update_style_bits (window);
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
static void
|
|
|
|
gdk_win32_window_set_title (GdkWindow *window,
|
1999-11-11 22:12:27 +00:00
|
|
|
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 = ".";
|
2015-04-29 07:31:08 +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));
|
2015-04-29 07:31:08 +00:00
|
|
|
|
2008-10-05 00:00:10 +00:00
|
|
|
GDK_NOTE (MISC_OR_EVENTS, title = g_strdup_printf ("%p %s", GDK_WINDOW_HWND (window), title));
|
|
|
|
|
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);
|
2008-10-05 00:00:10 +00:00
|
|
|
|
|
|
|
GDK_NOTE (MISC_OR_EVENTS, g_free ((char *) title));
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
static void
|
|
|
|
gdk_win32_window_set_role (GdkWindow *window,
|
1999-11-11 22:12:27 +00:00
|
|
|
const gchar *role)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
2015-04-29 07:31:08 +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_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 */
|
|
|
|
}
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
static void
|
2015-04-29 07:31:08 +00:00
|
|
|
gdk_win32_window_set_transient_for (GdkWindow *window,
|
1999-11-11 22:12:27 +00:00
|
|
|
GdkWindow *parent)
|
|
|
|
{
|
2001-08-04 13:17:33 +00:00
|
|
|
HWND window_id, parent_id;
|
2014-08-02 15:48:03 +00:00
|
|
|
LONG_PTR old_ptr;
|
|
|
|
DWORD w32_error;
|
2011-01-02 10:51:25 +00:00
|
|
|
GdkWindowImplWin32 *window_impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
2007-10-18 00:31:22 +00:00
|
|
|
GdkWindowImplWin32 *parent_impl = NULL;
|
|
|
|
GSList *item;
|
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;
|
|
|
|
|
2008-10-05 00:00:10 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_set_transient_for: %p: %p\n", window_id, parent_id));
|
|
|
|
|
2007-07-12 23:38:30 +00:00
|
|
|
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
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
if (window->window_type == GDK_WINDOW_CHILD)
|
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
|
|
|
{
|
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
|
|
|
|
2018-07-17 10:01:54 +00:00
|
|
|
if (window_impl->transient_owner == parent)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (GDK_IS_WINDOW (window_impl->transient_owner))
|
2007-10-18 00:31:22 +00:00
|
|
|
{
|
2011-01-02 10:51:25 +00:00
|
|
|
GdkWindowImplWin32 *trans_impl = GDK_WINDOW_IMPL_WIN32 (window_impl->transient_owner->impl);
|
2018-07-17 10:01:54 +00:00
|
|
|
item = g_slist_find (trans_impl->transient_children, window);
|
|
|
|
item->data = NULL;
|
|
|
|
trans_impl->transient_children = g_slist_delete_link (trans_impl->transient_children, item);
|
|
|
|
trans_impl->num_transients--;
|
2007-10-18 00:31:22 +00:00
|
|
|
|
2018-07-17 10:01:54 +00:00
|
|
|
if (!trans_impl->num_transients)
|
|
|
|
{
|
|
|
|
trans_impl->transient_children = NULL;
|
2007-10-18 00:31:22 +00:00
|
|
|
}
|
2018-07-17 10:01:54 +00:00
|
|
|
|
2008-01-10 20:58:40 +00:00
|
|
|
g_object_unref (G_OBJECT (window_impl->transient_owner));
|
|
|
|
g_object_unref (G_OBJECT (window));
|
2007-10-18 00:31:22 +00:00
|
|
|
|
|
|
|
window_impl->transient_owner = NULL;
|
|
|
|
}
|
2018-07-17 10:01:54 +00:00
|
|
|
|
|
|
|
if (parent)
|
2007-10-18 00:31:22 +00:00
|
|
|
{
|
2011-01-02 10:51:25 +00:00
|
|
|
parent_impl = GDK_WINDOW_IMPL_WIN32 (parent->impl);
|
2007-10-18 00:31:22 +00:00
|
|
|
|
|
|
|
parent_impl->transient_children = g_slist_append (parent_impl->transient_children, window);
|
2008-01-10 20:58:40 +00:00
|
|
|
g_object_ref (G_OBJECT (window));
|
2007-10-18 00:31:22 +00:00
|
|
|
parent_impl->num_transients++;
|
|
|
|
window_impl->transient_owner = parent;
|
2008-01-10 20:58:40 +00:00
|
|
|
g_object_ref (G_OBJECT (parent));
|
2007-10-18 00:31:22 +00:00
|
|
|
}
|
2001-08-04 13:17:33 +00:00
|
|
|
|
2014-08-02 15:48:03 +00:00
|
|
|
SetLastError (0);
|
|
|
|
old_ptr = GetWindowLongPtr (window_id, GWLP_HWNDPARENT);
|
|
|
|
w32_error = GetLastError ();
|
|
|
|
|
|
|
|
/* Don't re-set GWLP_HWNDPARENT to the same value */
|
2014-08-06 05:06:35 +00:00
|
|
|
if ((HWND) old_ptr == parent_id && w32_error == NO_ERROR)
|
2014-08-02 15:48:03 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
/* Don't return if it failed, try SetWindowLongPtr() anyway */
|
|
|
|
if (old_ptr == 0 && w32_error != NO_ERROR)
|
|
|
|
WIN32_API_FAILED ("GetWindowLongPtr");
|
|
|
|
|
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);
|
2014-08-02 15:48:03 +00:00
|
|
|
old_ptr = SetWindowLongPtr (window_id, GWLP_HWNDPARENT, (LONG_PTR) parent_id);
|
|
|
|
w32_error = GetLastError ();
|
|
|
|
|
|
|
|
if (old_ptr == 0 && w32_error != NO_ERROR)
|
2008-08-04 23:21:36 +00:00
|
|
|
WIN32_API_FAILED ("SetWindowLongPtr");
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
2008-02-05 16:47:24 +00:00
|
|
|
void
|
|
|
|
_gdk_push_modal_window (GdkWindow *window)
|
|
|
|
{
|
|
|
|
modal_window_stack = g_slist_prepend (modal_window_stack,
|
|
|
|
window);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_gdk_remove_modal_window (GdkWindow *window)
|
|
|
|
{
|
2008-02-07 19:25:07 +00:00
|
|
|
GSList *tmp;
|
|
|
|
|
2008-02-05 16:47:24 +00:00
|
|
|
g_return_if_fail (window != NULL);
|
|
|
|
|
|
|
|
/* It's possible to be NULL here if someone sets the modal hint of the window
|
|
|
|
* to FALSE before a modal window stack has ever been created. */
|
|
|
|
if (modal_window_stack == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* Find the requested window in the stack and remove it. Yeah, I realize this
|
|
|
|
* means we're not a 'real stack', strictly speaking. Sue me. :) */
|
2008-02-07 19:25:07 +00:00
|
|
|
tmp = g_slist_find (modal_window_stack, window);
|
2008-02-05 16:47:24 +00:00
|
|
|
if (tmp != NULL)
|
|
|
|
{
|
|
|
|
modal_window_stack = g_slist_delete_link (modal_window_stack, tmp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-27 20:13:54 +00:00
|
|
|
gboolean
|
|
|
|
_gdk_modal_blocked (GdkWindow *window)
|
2008-02-05 16:47:24 +00:00
|
|
|
{
|
2011-10-27 20:13:54 +00:00
|
|
|
GSList *l;
|
|
|
|
gboolean found_any = FALSE;
|
|
|
|
|
|
|
|
for (l = modal_window_stack; l != NULL; l = l->next)
|
2008-02-05 23:46:35 +00:00
|
|
|
{
|
2011-10-27 20:13:54 +00:00
|
|
|
GdkWindow *modal = l->data;
|
2008-02-05 23:46:35 +00:00
|
|
|
|
2011-10-27 20:13:54 +00:00
|
|
|
if (modal == window)
|
|
|
|
return FALSE;
|
2008-02-05 23:46:35 +00:00
|
|
|
|
2011-10-27 20:13:54 +00:00
|
|
|
if (GDK_WINDOW_IS_MAPPED (modal))
|
|
|
|
found_any = TRUE;
|
2008-02-05 23:46:35 +00:00
|
|
|
}
|
2011-10-27 20:13:54 +00:00
|
|
|
|
|
|
|
return found_any;
|
|
|
|
}
|
|
|
|
|
|
|
|
GdkWindow *
|
|
|
|
_gdk_modal_current (void)
|
|
|
|
{
|
|
|
|
GSList *l;
|
|
|
|
|
|
|
|
for (l = modal_window_stack; l != NULL; l = l->next)
|
2008-02-05 23:46:35 +00:00
|
|
|
{
|
2011-10-27 20:13:54 +00:00
|
|
|
GdkWindow *modal = l->data;
|
|
|
|
|
|
|
|
if (GDK_WINDOW_IS_MAPPED (modal))
|
|
|
|
return modal;
|
2008-02-05 23:46:35 +00:00
|
|
|
}
|
2011-10-27 20:13:54 +00:00
|
|
|
|
|
|
|
return NULL;
|
2008-02-05 16:47:24 +00:00
|
|
|
}
|
|
|
|
|
2008-07-02 13:58:28 +00:00
|
|
|
static void
|
2010-08-15 11:49:30 +00:00
|
|
|
gdk_win32_window_set_background (GdkWindow *window,
|
|
|
|
cairo_pattern_t *pattern)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2008-07-02 13:58:28 +00:00
|
|
|
static void
|
2010-05-25 22:38:44 +00:00
|
|
|
gdk_win32_window_set_device_cursor (GdkWindow *window,
|
|
|
|
GdkDevice *device,
|
|
|
|
GdkCursor *cursor)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2000-07-25 17:31:05 +00:00
|
|
|
GdkWindowImplWin32 *impl;
|
2015-05-03 21:29:35 +00:00
|
|
|
GdkCursor *previous_cursor;
|
2015-04-29 07:31:08 +00:00
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
2015-04-29 07:31:08 +00:00
|
|
|
|
2002-01-11 23:56:28 +00:00
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
|
|
|
return;
|
|
|
|
|
2009-10-18 08:43:33 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_win32_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),
|
2015-05-03 21:29:35 +00:00
|
|
|
cursor));
|
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).
|
|
|
|
*/
|
2015-05-03 21:29:35 +00:00
|
|
|
previous_cursor = impl->cursor;
|
2002-01-11 23:56:28 +00:00
|
|
|
|
2015-05-03 21:29:35 +00:00
|
|
|
if (cursor)
|
|
|
|
impl->cursor = g_object_ref (cursor);
|
2002-01-11 23:56:28 +00:00
|
|
|
else
|
2016-02-27 00:10:12 +00:00
|
|
|
/* Use default cursor otherwise. Don't just set NULL cursor,
|
|
|
|
* because that will just hide the cursor, which is not
|
|
|
|
* what the caller probably wanted.
|
2015-05-13 07:45:40 +00:00
|
|
|
*/
|
2016-02-27 00:10:12 +00:00
|
|
|
impl->cursor = _gdk_win32_display_get_cursor_for_type (gdk_device_get_display (device),
|
2016-02-22 16:55:16 +00:00
|
|
|
GDK_LEFT_PTR);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2016-02-27 00:10:12 +00:00
|
|
|
GDK_DEVICE_GET_CLASS (device)->set_window_cursor (device, window, impl->cursor);
|
|
|
|
|
2010-05-25 22:38:44 +00:00
|
|
|
/* Destroy the previous cursor */
|
2015-05-03 21:29:35 +00:00
|
|
|
if (previous_cursor != NULL)
|
|
|
|
g_object_unref (previous_cursor);
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
2008-07-02 13:58:28 +00:00
|
|
|
static void
|
2008-07-02 06:06:29 +00:00
|
|
|
gdk_win32_window_get_geometry (GdkWindow *window,
|
|
|
|
gint *x,
|
|
|
|
gint *y,
|
|
|
|
gint *width,
|
2010-12-05 13:40:35 +00:00
|
|
|
gint *height)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2015-12-17 23:36:57 +00:00
|
|
|
GdkScreen *screen;
|
|
|
|
gboolean window_is_root;
|
|
|
|
|
|
|
|
screen = gdk_window_get_screen (window);
|
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
if (!window)
|
2015-12-17 23:36:57 +00:00
|
|
|
{
|
|
|
|
window = gdk_screen_get_root_window (screen);
|
|
|
|
window_is_root = TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
window_is_root = (gdk_screen_get_root_window (screen) == window);
|
2015-04-29 07:31:08 +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;
|
2016-06-27 05:16:43 +00:00
|
|
|
GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
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
|
|
|
API_CALL (GetClientRect, (GDK_WINDOW_HWND (window), &rect));
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2015-12-17 23:36:57 +00:00
|
|
|
if (!window_is_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
|
|
|
|
2015-12-17 23:36:57 +00:00
|
|
|
if (gdk_screen_get_root_window (screen) == parent)
|
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
|
|
|
{
|
2016-06-27 05:16:43 +00:00
|
|
|
rect.left += _gdk_offset_x * impl->window_scale;
|
|
|
|
rect.top += _gdk_offset_y * impl->window_scale;
|
|
|
|
rect.right += _gdk_offset_x * impl->window_scale;
|
|
|
|
rect.bottom += _gdk_offset_y * impl->window_scale;
|
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
|
|
|
}
|
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)
|
2016-06-27 05:16:43 +00:00
|
|
|
*x = rect.left / impl->window_scale;
|
1999-11-11 22:12:27 +00:00
|
|
|
if (y)
|
2016-06-27 05:16:43 +00:00
|
|
|
*y = rect.top / impl->window_scale;
|
1999-11-11 22:12:27 +00:00
|
|
|
if (width)
|
2016-06-27 05:16:43 +00:00
|
|
|
*width = (rect.right - rect.left) / impl->window_scale;
|
1999-11-11 22:12:27 +00:00
|
|
|
if (height)
|
2016-06-27 05:16:43 +00:00
|
|
|
*height = (rect.bottom - rect.top) / impl->window_scale;
|
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
|
|
|
|
2009-10-18 08:43:33 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_win32_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),
|
2016-06-27 05:16:43 +00:00
|
|
|
(rect.right - rect.left) / impl->window_scale,
|
|
|
|
(rect.bottom - rect.top) / impl->window_scale,
|
2010-08-28 23:32:52 +00:00
|
|
|
gdk_window_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
|
|
|
rect.left, rect.top));
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-02-28 01:58:13 +00:00
|
|
|
static void
|
2009-07-01 08:26:37 +00:00
|
|
|
gdk_win32_window_get_root_coords (GdkWindow *window,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint *root_x,
|
|
|
|
gint *root_y)
|
|
|
|
{
|
|
|
|
gint tx;
|
|
|
|
gint ty;
|
|
|
|
POINT pt;
|
2016-06-27 05:16:43 +00:00
|
|
|
GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
2009-07-01 08:26:37 +00:00
|
|
|
|
2016-06-27 05:16:43 +00:00
|
|
|
pt.x = x * impl->window_scale;
|
|
|
|
pt.y = y * impl->window_scale;
|
2009-07-01 08:26:37 +00:00
|
|
|
ClientToScreen (GDK_WINDOW_HWND (window), &pt);
|
|
|
|
tx = pt.x;
|
|
|
|
ty = pt.y;
|
2015-04-29 07:31:08 +00:00
|
|
|
|
2009-07-04 10:10:57 +00:00
|
|
|
if (root_x)
|
2016-06-27 05:16:43 +00:00
|
|
|
*root_x = (tx + _gdk_offset_x) / impl->window_scale;
|
2009-07-04 10:10:57 +00:00
|
|
|
if (root_y)
|
2016-06-27 05:16:43 +00:00
|
|
|
*root_y = (ty + _gdk_offset_y) / impl->window_scale;
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2009-10-18 08:43:33 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_win32_window_get_root_coords: %p: %+d%+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),
|
2016-06-27 05:16:43 +00:00
|
|
|
x * impl->window_scale,
|
|
|
|
y * impl->window_scale,
|
|
|
|
(tx + _gdk_offset_x) / impl->window_scale,
|
|
|
|
(ty + _gdk_offset_y) / impl->window_scale));
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
2009-02-14 18:23:54 +00:00
|
|
|
static void
|
|
|
|
gdk_win32_window_restack_under (GdkWindow *window,
|
2009-03-01 13:55:50 +00:00
|
|
|
GList *native_siblings)
|
2009-02-14 18:23:54 +00:00
|
|
|
{
|
|
|
|
// ### TODO
|
|
|
|
}
|
|
|
|
|
2009-09-02 21:38:55 +00:00
|
|
|
static void
|
|
|
|
gdk_win32_window_restack_toplevel (GdkWindow *window,
|
|
|
|
GdkWindow *sibling,
|
|
|
|
gboolean above)
|
|
|
|
{
|
|
|
|
// ### TODO
|
|
|
|
}
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
static void
|
|
|
|
gdk_win32_window_get_frame_extents (GdkWindow *window,
|
2001-03-31 19:33:49 +00:00
|
|
|
GdkRectangle *rect)
|
|
|
|
{
|
|
|
|
HWND hwnd;
|
|
|
|
RECT r;
|
2016-06-27 05:16:43 +00:00
|
|
|
GdkWindowImplWin32 *impl;
|
2001-03-31 19:33:49 +00:00
|
|
|
|
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);
|
|
|
|
|
2001-03-31 19:33:49 +00:00
|
|
|
rect->x = 0;
|
|
|
|
rect->y = 0;
|
|
|
|
rect->width = 1;
|
|
|
|
rect->height = 1;
|
2015-04-29 07:31:08 +00:00
|
|
|
|
2001-03-31 19:33:49 +00:00
|
|
|
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?
|
|
|
|
*/
|
2011-01-02 10:51:25 +00:00
|
|
|
while (window->parent && window->parent->parent)
|
|
|
|
window = window->parent;
|
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
|
|
|
|
2016-06-27 05:16:43 +00:00
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
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
|
|
|
|
2017-09-29 12:50:03 +00:00
|
|
|
/* Initialize to real, unscaled size */
|
|
|
|
rect->x = r.left + _gdk_offset_x * impl->window_scale;
|
|
|
|
rect->y = r.top + _gdk_offset_y * impl->window_scale;
|
|
|
|
rect->width = (r.right - r.left);
|
|
|
|
rect->height = (r.bottom - r.top);
|
|
|
|
|
|
|
|
/* Extend width and height to ensure that they cover the real size when de-scaled,
|
|
|
|
* and replace everyting with scaled values
|
|
|
|
*/
|
|
|
|
rect->width = (rect->width + rect->x % impl->window_scale + impl->window_scale - 1) / impl->window_scale;
|
|
|
|
rect->height = (rect->height + rect->y % impl->window_scale + impl->window_scale - 1) / impl->window_scale;
|
|
|
|
rect->x = r.left / impl->window_scale + _gdk_offset_x;
|
|
|
|
rect->y = r.top / impl->window_scale + _gdk_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
|
|
|
|
2005-03-16 01:38:57 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_get_frame_extents: %p: %ldx%ld@%+ld%+ld\n",
|
2017-09-29 12:50:03 +00:00
|
|
|
GDK_WINDOW_HWND (window),
|
|
|
|
rect->width,
|
|
|
|
rect->height,
|
|
|
|
rect->x, rect->y));
|
2001-03-31 19:33:49 +00:00
|
|
|
}
|
|
|
|
|
2009-07-01 08:26:37 +00:00
|
|
|
static gboolean
|
2010-05-25 22:38:44 +00:00
|
|
|
gdk_window_win32_get_device_state (GdkWindow *window,
|
|
|
|
GdkDevice *device,
|
2013-07-03 09:52:58 +00:00
|
|
|
gdouble *x,
|
|
|
|
gdouble *y,
|
2010-05-25 22:38:44 +00:00
|
|
|
GdkModifierType *mask)
|
2009-07-01 08:26:37 +00:00
|
|
|
{
|
2010-05-25 22:38:44 +00:00
|
|
|
GdkWindow *child;
|
2009-07-01 08:26:37 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (window == NULL || GDK_IS_WINDOW (window), FALSE);
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2010-05-25 22:38:44 +00:00
|
|
|
GDK_DEVICE_GET_CLASS (device)->query_state (device, window,
|
|
|
|
NULL, &child,
|
|
|
|
NULL, NULL,
|
|
|
|
x, y, mask);
|
|
|
|
return (child != NULL);
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
2010-05-25 22:38:44 +00:00
|
|
|
void
|
|
|
|
gdk_display_warp_device (GdkDisplay *display,
|
|
|
|
GdkDevice *device,
|
|
|
|
GdkScreen *screen,
|
|
|
|
gint x,
|
|
|
|
gint y)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2016-02-22 16:55:16 +00:00
|
|
|
g_return_if_fail (display == gdk_display_get_default ());
|
2016-01-15 19:45:45 +00:00
|
|
|
g_return_if_fail (screen == gdk_display_get_default_screen (display));
|
2010-05-25 22:38:44 +00:00
|
|
|
g_return_if_fail (GDK_IS_DEVICE (device));
|
|
|
|
g_return_if_fail (display == gdk_device_get_display (device));
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2010-05-25 22:38:44 +00:00
|
|
|
GDK_DEVICE_GET_CLASS (device)->warp (device, screen, x, y);
|
|
|
|
}
|
1999-11-11 22:12:27 +00:00
|
|
|
|
2015-04-29 07:31:08 +00:00
|
|
|
static GdkEventMask
|
2008-07-02 06:06:29 +00:00
|
|
|
gdk_win32_window_get_events (GdkWindow *window)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2011-10-19 19:36:41 +00:00
|
|
|
GdkWindowImplWin32 *impl;
|
|
|
|
|
2000-07-25 17:31:05 +00:00
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
1999-11-11 22:12:27 +00:00
|
|
|
return 0;
|
|
|
|
|
2011-10-19 19:36:41 +00:00
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
|
|
|
|
|
|
|
return impl->native_event_mask;
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
2015-04-29 07:31:08 +00:00
|
|
|
static void
|
2008-07-02 06:06:29 +00:00
|
|
|
gdk_win32_window_set_events (GdkWindow *window,
|
2011-10-19 19:36:41 +00:00
|
|
|
GdkEventMask event_mask)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2011-10-19 19:36:41 +00:00
|
|
|
GdkWindowImplWin32 *impl;
|
|
|
|
|
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
|
|
|
|
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.
|
|
|
|
*/
|
2011-10-19 19:36:41 +00:00
|
|
|
impl->native_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;
|
2016-06-27 05:16:43 +00:00
|
|
|
GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
2006-02-20 10:08:37 +00:00
|
|
|
|
|
|
|
GetClientRect (GDK_WINDOW_HWND (window), &rect);
|
2016-06-27 05:16:43 +00:00
|
|
|
|
2006-02-20 10:08:37 +00:00
|
|
|
_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);
|
|
|
|
}
|
2015-04-29 07:31:08 +00:00
|
|
|
|
2006-02-20 10:08:37 +00:00
|
|
|
SetWindowRgn (GDK_WINDOW_HWND (window), hrgn, TRUE);
|
|
|
|
}
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
static void
|
|
|
|
gdk_win32_window_set_override_redirect (GdkWindow *window,
|
1999-11-11 22:12:27 +00:00
|
|
|
gboolean override_redirect)
|
|
|
|
{
|
2011-10-27 14:09:42 +00:00
|
|
|
GdkWindowImplWin32 *window_impl;
|
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
2011-10-27 14:09:42 +00:00
|
|
|
window_impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
|
|
|
|
|
|
|
window_impl->override_redirect = !!override_redirect;
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
static void
|
|
|
|
gdk_win32_window_set_accept_focus (GdkWindow *window,
|
2003-12-10 23:58:23 +00:00
|
|
|
gboolean accept_focus)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
|
|
|
accept_focus = accept_focus != FALSE;
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
if (window->accept_focus != accept_focus)
|
|
|
|
window->accept_focus = accept_focus;
|
2003-12-10 23:58:23 +00:00
|
|
|
}
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
static void
|
|
|
|
gdk_win32_window_set_focus_on_map (GdkWindow *window,
|
2004-05-06 02:57:01 +00:00
|
|
|
gboolean focus_on_map)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
|
|
|
focus_on_map = focus_on_map != FALSE;
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
if (window->focus_on_map != focus_on_map)
|
|
|
|
window->focus_on_map = focus_on_map;
|
2004-05-06 02:57:01 +00:00
|
|
|
}
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
static void
|
|
|
|
gdk_win32_window_set_icon_list (GdkWindow *window,
|
2003-12-14 01:06:56 +00:00
|
|
|
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;
|
|
|
|
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
|
|
|
return;
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
2003-12-14 01:06:56 +00:00
|
|
|
|
|
|
|
/* 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;
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2015-10-20 00:30:33 +00:00
|
|
|
pixbufs = pixbufs->next;
|
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;
|
|
|
|
}
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
static void
|
2015-04-29 07:31:08 +00:00
|
|
|
gdk_win32_window_set_icon_name (GdkWindow *window,
|
2000-03-16 21:58:35 +00:00
|
|
|
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;
|
2015-04-29 07:31:08 +00:00
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
static GdkWindow *
|
|
|
|
gdk_win32_window_get_group (GdkWindow *window)
|
2004-03-05 23:26:07 +00:00
|
|
|
{
|
|
|
|
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;
|
2015-04-29 07:31:08 +00:00
|
|
|
|
2004-03-05 23:26:07 +00:00
|
|
|
g_warning ("gdk_window_get_group not yet implemented");
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
static void
|
2015-04-29 07:31:08 +00:00
|
|
|
gdk_win32_window_set_group (GdkWindow *window,
|
1999-11-11 22:12:27 +00:00
|
|
|
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;
|
2015-04-29 07:31:08 +00:00
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
g_warning ("gdk_window_set_group not implemented");
|
|
|
|
}
|
|
|
|
|
2005-11-09 12:35:56 +00:00
|
|
|
static void
|
2008-03-10 15:48:06 +00:00
|
|
|
update_single_bit (LONG *style,
|
|
|
|
gboolean 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
|
|
|
|
*/
|
2006-02-09 02:58:45 +00:00
|
|
|
if ((!all && gdk_bit) || (all && !gdk_bit))
|
|
|
|
*style |= style_bit;
|
|
|
|
else
|
|
|
|
*style &= ~style_bit;
|
|
|
|
}
|
|
|
|
|
2016-02-23 09:20:55 +00:00
|
|
|
/*
|
|
|
|
* Returns TRUE if window has no decorations.
|
|
|
|
* Usually it means CSD windows, because GTK
|
|
|
|
* calls gdk_window_set_decorations (window, 0);
|
|
|
|
* This is used to decide whether a toplevel should
|
|
|
|
* be made layered, thus it
|
|
|
|
* only returns TRUE for toplevels (until GTK minimal
|
|
|
|
* system requirements are lifted to Windows 8 or newer,
|
|
|
|
* because only toplevels can be layered).
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
_gdk_win32_window_lacks_wm_decorations (GdkWindow *window)
|
|
|
|
{
|
|
|
|
GdkWindowImplWin32 *impl;
|
|
|
|
LONG style;
|
|
|
|
gboolean has_any_decorations;
|
|
|
|
|
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
/* only toplevels can be layered */
|
|
|
|
if (!WINDOW_IS_TOPLEVEL (window))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
|
|
|
|
|
|
|
/* This is because GTK calls gdk_window_set_decorations (window, 0),
|
|
|
|
* even though GdkWMDecoration docs indicate that 0 does NOT mean
|
|
|
|
* "no decorations".
|
|
|
|
*/
|
|
|
|
if (impl->decorations &&
|
|
|
|
*impl->decorations == 0)
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
if (GDK_WINDOW_HWND (window) == 0)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
style = GetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE);
|
|
|
|
|
|
|
|
if (style == 0)
|
|
|
|
{
|
|
|
|
DWORD w32_error = GetLastError ();
|
|
|
|
|
|
|
|
GDK_NOTE (MISC, g_print ("Failed to get style of window %p (handle %p): %lu\n",
|
|
|
|
window, GDK_WINDOW_HWND (window), w32_error));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2016-03-08 05:00:49 +00:00
|
|
|
/* Keep this in sync with _gdk_win32_window_update_style_bits() */
|
2016-02-23 09:20:55 +00:00
|
|
|
/* We don't check what get_effective_window_decorations()
|
|
|
|
* has to say, because it gives suggestions based on
|
|
|
|
* various hints, while we want *actual* decorations,
|
|
|
|
* or their absence.
|
|
|
|
*/
|
|
|
|
has_any_decorations = FALSE;
|
|
|
|
|
|
|
|
if (style & (WS_BORDER | WS_THICKFRAME | WS_CAPTION |
|
|
|
|
WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX))
|
|
|
|
has_any_decorations = TRUE;
|
|
|
|
else
|
|
|
|
GDK_NOTE (MISC, g_print ("Window %p (handle %p): has no decorations (style %lx)\n",
|
|
|
|
window, GDK_WINDOW_HWND (window), style));
|
|
|
|
|
|
|
|
return !has_any_decorations;
|
|
|
|
}
|
|
|
|
|
2016-03-08 05:00:49 +00:00
|
|
|
void
|
|
|
|
_gdk_win32_window_update_style_bits (GdkWindow *window)
|
2005-11-09 12:35:56 +00:00
|
|
|
{
|
2011-01-02 10:51:25 +00:00
|
|
|
GdkWindowImplWin32 *impl = (GdkWindowImplWin32 *)window->impl;
|
2006-02-09 02:58:45 +00:00
|
|
|
GdkWMDecoration decorations;
|
2008-10-05 00:00:10 +00:00
|
|
|
LONG old_style, new_style, old_exstyle, new_exstyle;
|
2008-03-10 15:48:06 +00:00
|
|
|
gboolean all;
|
2005-11-09 12:35:56 +00:00
|
|
|
RECT rect, before, after;
|
2015-11-21 03:48:55 +00:00
|
|
|
gboolean was_topmost;
|
|
|
|
gboolean will_be_topmost;
|
|
|
|
HWND insert_after;
|
|
|
|
UINT flags;
|
2005-11-09 12:35:56 +00:00
|
|
|
|
2011-10-26 10:43:24 +00:00
|
|
|
if (window->state & GDK_WINDOW_STATE_FULLSCREEN)
|
|
|
|
return;
|
|
|
|
|
2008-05-23 18:25:12 +00:00
|
|
|
old_style = GetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE);
|
2008-10-05 00:00:10 +00:00
|
|
|
old_exstyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_EXSTYLE);
|
2005-11-09 12:35:56 +00:00
|
|
|
|
|
|
|
GetClientRect (GDK_WINDOW_HWND (window), &before);
|
|
|
|
after = before;
|
2008-10-05 00:00:10 +00:00
|
|
|
AdjustWindowRectEx (&before, old_style, FALSE, old_exstyle);
|
2008-03-10 15:48:06 +00:00
|
|
|
|
2015-11-21 03:48:55 +00:00
|
|
|
was_topmost = (old_exstyle & WS_EX_TOPMOST) ? TRUE : FALSE;
|
|
|
|
will_be_topmost = was_topmost;
|
|
|
|
|
|
|
|
old_exstyle &= ~WS_EX_TOPMOST;
|
|
|
|
|
2008-05-23 18:25:12 +00:00
|
|
|
new_style = old_style;
|
2008-10-05 00:00:10 +00:00
|
|
|
new_exstyle = old_exstyle;
|
|
|
|
|
2011-11-25 10:21:26 +00:00
|
|
|
if (window->window_type == GDK_WINDOW_TEMP)
|
2015-11-21 03:48:55 +00:00
|
|
|
{
|
|
|
|
new_exstyle |= WS_EX_TOOLWINDOW;
|
|
|
|
will_be_topmost = TRUE;
|
|
|
|
}
|
2011-11-25 10:21:26 +00:00
|
|
|
else if (impl->type_hint == GDK_WINDOW_TYPE_HINT_UTILITY)
|
2015-11-21 03:48:55 +00:00
|
|
|
{
|
|
|
|
new_exstyle |= WS_EX_TOOLWINDOW;
|
|
|
|
}
|
2008-10-05 00:00:10 +00:00
|
|
|
else
|
2015-11-21 03:48:55 +00:00
|
|
|
{
|
|
|
|
new_exstyle &= ~WS_EX_TOOLWINDOW;
|
|
|
|
}
|
2008-10-05 00:00:10 +00:00
|
|
|
|
2016-02-23 09:20:55 +00:00
|
|
|
/* We can get away with using layered windows
|
|
|
|
* only when no decorations are needed. It can mean
|
|
|
|
* CSD or borderless non-CSD windows (tooltips?).
|
2016-03-05 03:34:16 +00:00
|
|
|
*
|
|
|
|
* If this window cannot use layered windows, disable it always.
|
|
|
|
* This currently applies to windows using OpenGL, which
|
|
|
|
* does not work with layered windows.
|
2016-02-23 09:20:55 +00:00
|
|
|
*/
|
2016-03-05 03:34:16 +00:00
|
|
|
if (impl->suppress_layered == 0)
|
|
|
|
{
|
|
|
|
if (_gdk_win32_window_lacks_wm_decorations (window))
|
|
|
|
impl->layered = g_strcmp0 (g_getenv ("GDK_WIN32_LAYERED"), "0") != 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
impl->layered = FALSE;
|
2016-02-23 09:20:55 +00:00
|
|
|
|
|
|
|
if (impl->layered)
|
|
|
|
new_exstyle |= WS_EX_LAYERED;
|
|
|
|
else
|
|
|
|
new_exstyle &= ~WS_EX_LAYERED;
|
|
|
|
|
2006-02-09 02:58:45 +00:00
|
|
|
if (get_effective_window_decorations (window, &decorations))
|
|
|
|
{
|
|
|
|
all = (decorations & GDK_DECOR_ALL);
|
2016-02-23 09:20:55 +00:00
|
|
|
/* Keep this in sync with the test in _gdk_win32_window_lacks_wm_decorations() */
|
2008-05-23 18:25:12 +00:00
|
|
|
update_single_bit (&new_style, all, decorations & GDK_DECOR_BORDER, WS_BORDER);
|
|
|
|
update_single_bit (&new_style, all, decorations & GDK_DECOR_RESIZEH, WS_THICKFRAME);
|
|
|
|
update_single_bit (&new_style, all, decorations & GDK_DECOR_TITLE, WS_CAPTION);
|
|
|
|
update_single_bit (&new_style, all, decorations & GDK_DECOR_MENU, WS_SYSMENU);
|
|
|
|
update_single_bit (&new_style, all, decorations & GDK_DECOR_MINIMIZE, WS_MINIMIZEBOX);
|
|
|
|
update_single_bit (&new_style, all, decorations & GDK_DECOR_MAXIMIZE, WS_MAXIMIZEBOX);
|
2006-02-09 02:58:45 +00:00
|
|
|
}
|
2005-11-09 12:35:56 +00:00
|
|
|
|
2008-10-05 00:00:10 +00:00
|
|
|
if (old_style == new_style && old_exstyle == new_exstyle )
|
2008-05-23 18:25:12 +00:00
|
|
|
{
|
2016-03-08 05:00:49 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("_gdk_win32_window_update_style_bits: %p: no change\n",
|
2008-05-23 18:25:12 +00:00
|
|
|
GDK_WINDOW_HWND (window)));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-10-05 00:00:10 +00:00
|
|
|
if (old_style != new_style)
|
|
|
|
{
|
2016-03-08 05:00:49 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("_gdk_win32_window_update_style_bits: %p: STYLE: %s => %s\n",
|
2008-10-05 00:00:10 +00:00
|
|
|
GDK_WINDOW_HWND (window),
|
|
|
|
_gdk_win32_window_style_to_string (old_style),
|
|
|
|
_gdk_win32_window_style_to_string (new_style)));
|
2015-04-29 07:31:08 +00:00
|
|
|
|
2008-10-05 00:00:10 +00:00
|
|
|
SetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE, new_style);
|
|
|
|
}
|
2008-03-10 15:48:06 +00:00
|
|
|
|
2008-10-05 00:00:10 +00:00
|
|
|
if (old_exstyle != new_exstyle)
|
|
|
|
{
|
2016-03-08 05:00:49 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("_gdk_win32_window_update_style_bits: %p: EXSTYLE: %s => %s\n",
|
2008-10-05 00:00:10 +00:00
|
|
|
GDK_WINDOW_HWND (window),
|
|
|
|
_gdk_win32_window_exstyle_to_string (old_exstyle),
|
|
|
|
_gdk_win32_window_exstyle_to_string (new_exstyle)));
|
2015-04-29 07:31:08 +00:00
|
|
|
|
2008-10-05 00:00:10 +00:00
|
|
|
SetWindowLong (GDK_WINDOW_HWND (window), GWL_EXSTYLE, new_exstyle);
|
|
|
|
}
|
2005-11-09 12:35:56 +00:00
|
|
|
|
2008-10-05 00:00:10 +00:00
|
|
|
AdjustWindowRectEx (&after, new_style, FALSE, new_exstyle);
|
2005-11-09 12:35:56 +00:00
|
|
|
|
|
|
|
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;
|
|
|
|
|
2018-06-17 10:48:48 +00:00
|
|
|
flags = SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOREPOSITION | SWP_NOOWNERZORDER;
|
2008-03-10 15:48:06 +00:00
|
|
|
|
2015-11-21 03:48:55 +00:00
|
|
|
if (will_be_topmost && !was_topmost)
|
|
|
|
{
|
|
|
|
insert_after = HWND_TOPMOST;
|
|
|
|
}
|
|
|
|
else if (was_topmost && !will_be_topmost)
|
|
|
|
{
|
|
|
|
insert_after = HWND_NOTOPMOST;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
flags |= SWP_NOZORDER;
|
2015-11-21 03:58:22 +00:00
|
|
|
insert_after = SWP_NOZORDER_SPECIFIED;
|
2015-11-21 03:48:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SetWindowPos (GDK_WINDOW_HWND (window), insert_after,
|
2016-04-06 10:22:15 +00:00
|
|
|
rect.left, rect.top,
|
2015-11-21 03:48:55 +00:00
|
|
|
rect.right - rect.left, rect.bottom - rect.top,
|
|
|
|
flags);
|
2008-03-10 15:48:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
update_single_system_menu_entry (HMENU hmenu,
|
|
|
|
gboolean all,
|
|
|
|
int gdk_bit,
|
|
|
|
int menu_entry)
|
|
|
|
{
|
|
|
|
/* all controls the interpretation of gdk_bit -- if all is TRUE,
|
|
|
|
* gdk_bit indicates whether menu entry is disabled; if all is
|
|
|
|
* FALSE, gdk bit indicate whether menu entry is enabled
|
|
|
|
*/
|
|
|
|
if ((!all && gdk_bit) || (all && !gdk_bit))
|
|
|
|
EnableMenuItem (hmenu, menu_entry, MF_BYCOMMAND | MF_ENABLED);
|
|
|
|
else
|
|
|
|
EnableMenuItem (hmenu, menu_entry, MF_BYCOMMAND | MF_GRAYED);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
update_system_menu (GdkWindow *window)
|
|
|
|
{
|
|
|
|
GdkWMFunction functions;
|
|
|
|
BOOL all;
|
|
|
|
|
|
|
|
if (_gdk_window_get_functions (window, &functions))
|
|
|
|
{
|
|
|
|
HMENU hmenu = GetSystemMenu (GDK_WINDOW_HWND (window), FALSE);
|
|
|
|
|
2008-09-26 16:47:58 +00:00
|
|
|
all = (functions & GDK_FUNC_ALL);
|
2008-03-10 15:48:06 +00:00
|
|
|
update_single_system_menu_entry (hmenu, all, functions & GDK_FUNC_RESIZE, SC_SIZE);
|
|
|
|
update_single_system_menu_entry (hmenu, all, functions & GDK_FUNC_MOVE, SC_MOVE);
|
|
|
|
update_single_system_menu_entry (hmenu, all, functions & GDK_FUNC_MINIMIZE, SC_MINIMIZE);
|
|
|
|
update_single_system_menu_entry (hmenu, all, functions & GDK_FUNC_MAXIMIZE, SC_MAXIMIZE);
|
|
|
|
update_single_system_menu_entry (hmenu, all, functions & GDK_FUNC_CLOSE, SC_CLOSE);
|
|
|
|
}
|
2005-11-09 12:35:56 +00:00
|
|
|
}
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
static void
|
|
|
|
gdk_win32_window_set_decorations (GdkWindow *window,
|
2016-02-23 09:20:55 +00:00
|
|
|
GdkWMDecoration decorations)
|
1999-11-11 22:12:27 +00:00
|
|
|
{
|
2016-02-23 09:20:55 +00:00
|
|
|
GdkWindowImplWin32 *impl;
|
2015-04-29 07:31:08 +00:00
|
|
|
|
1999-11-11 22:12:27 +00:00
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
2015-04-29 07:31:08 +00:00
|
|
|
|
2016-02-23 09:20:55 +00:00
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
|
|
|
|
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 " : "")));
|
|
|
|
|
2016-02-23 09:20:55 +00:00
|
|
|
if (!impl->decorations)
|
|
|
|
impl->decorations = g_malloc (sizeof (GdkWMDecoration));
|
|
|
|
|
|
|
|
*impl->decorations = 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
|
|
|
|
2016-03-08 05:00:49 +00:00
|
|
|
_gdk_win32_window_update_style_bits (window);
|
1999-11-11 22:12:27 +00:00
|
|
|
}
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
static gboolean
|
|
|
|
gdk_win32_window_get_decorations (GdkWindow *window,
|
2016-02-23 09:20:55 +00:00
|
|
|
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
|
|
|
{
|
2016-02-23 09:20:55 +00:00
|
|
|
GdkWindowImplWin32 *impl;
|
2015-04-29 07:31:08 +00:00
|
|
|
|
2005-11-02 13:33:27 +00:00
|
|
|
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
|
|
|
|
|
2016-02-23 09:20:55 +00:00
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
|
|
|
|
|
|
|
if (impl->decorations == NULL)
|
|
|
|
return FALSE;
|
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
|
|
|
|
2016-02-23 09:20:55 +00:00
|
|
|
*decorations = *impl->decorations;
|
|
|
|
|
|
|
|
return TRUE;
|
2006-02-09 02:58:45 +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
|
|
|
|
2006-02-09 02:58:45 +00:00
|
|
|
static GQuark
|
|
|
|
get_functions_quark ()
|
|
|
|
{
|
|
|
|
static GQuark quark = 0;
|
2015-04-29 07:31:08 +00:00
|
|
|
|
2006-02-09 02:58:45 +00:00
|
|
|
if (!quark)
|
|
|
|
quark = g_quark_from_static_string ("gdk-window-functions");
|
2015-04-29 07:31:08 +00:00
|
|
|
|
2006-02-09 02:58:45 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
static void
|
|
|
|
gdk_win32_window_set_functions (GdkWindow *window,
|
1999-11-11 22:12:27 +00:00
|
|
|
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));
|
2015-04-29 07:31:08 +00:00
|
|
|
|
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);
|
|
|
|
|
2008-03-10 15:48:06 +00:00
|
|
|
update_system_menu (window);
|
2006-02-09 02:58:45 +00:00
|
|
|
}
|
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)
|
|
|
|
{
|
2011-10-26 10:43:24 +00:00
|
|
|
GdkWMFunction* functions_set;
|
2015-04-29 07:31:08 +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
|
|
|
}
|
|
|
|
|
2016-03-12 16:26:19 +00:00
|
|
|
#if defined(MORE_AEROSNAP_DEBUGGING)
|
2016-03-08 05:03:29 +00:00
|
|
|
static void
|
|
|
|
log_region (gchar *prefix, AeroSnapEdgeRegion *region)
|
|
|
|
{
|
|
|
|
GDK_NOTE (MISC, g_print ("Region %s:\n"
|
|
|
|
"edge %d x %d @ %d x %d\n"
|
|
|
|
"trig %d x %d @ %d x %d\n",
|
|
|
|
prefix,
|
|
|
|
region->edge.width,
|
|
|
|
region->edge.height,
|
|
|
|
region->edge.x,
|
|
|
|
region->edge.y,
|
|
|
|
region->trigger.width,
|
|
|
|
region->trigger.height,
|
|
|
|
region->trigger.x,
|
|
|
|
region->trigger.y));
|
|
|
|
}
|
2016-03-12 16:26:19 +00:00
|
|
|
#endif
|
2016-03-08 05:03:29 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
calculate_aerosnap_regions (GdkW32DragMoveResizeContext *context)
|
|
|
|
{
|
|
|
|
GdkDisplay *display;
|
|
|
|
GdkScreen *screen;
|
|
|
|
gint n_monitors, monitor, other_monitor;
|
2016-06-27 05:16:43 +00:00
|
|
|
GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (context->window->impl);
|
2016-03-12 16:26:19 +00:00
|
|
|
#if defined(MORE_AEROSNAP_DEBUGGING)
|
|
|
|
gint i;
|
|
|
|
#endif
|
2016-03-08 05:03:29 +00:00
|
|
|
|
|
|
|
display = gdk_display_get_default ();
|
|
|
|
screen = gdk_display_get_default_screen (display);
|
|
|
|
n_monitors = gdk_screen_get_n_monitors (screen);
|
|
|
|
|
|
|
|
#define _M_UP 0
|
|
|
|
#define _M_DOWN 1
|
|
|
|
#define _M_LEFT 2
|
|
|
|
#define _M_RIGHT 3
|
|
|
|
|
|
|
|
for (monitor = 0; monitor < n_monitors; monitor++)
|
|
|
|
{
|
|
|
|
GdkRectangle wa;
|
|
|
|
GdkRectangle geometry;
|
|
|
|
AeroSnapEdgeRegion snap_region;
|
|
|
|
gboolean move_edge[4] = { TRUE, FALSE, TRUE, TRUE };
|
|
|
|
gboolean resize_edge[2] = { TRUE, TRUE };
|
|
|
|
gint diff;
|
|
|
|
gint thickness, trigger_thickness;
|
|
|
|
|
|
|
|
gdk_screen_get_monitor_workarea (screen, monitor, &wa);
|
|
|
|
gdk_screen_get_monitor_geometry (screen, monitor, &geometry);
|
|
|
|
|
|
|
|
for (other_monitor = 0;
|
|
|
|
other_monitor < n_monitors &&
|
|
|
|
(move_edge[_M_UP] || move_edge[_M_LEFT] ||
|
|
|
|
move_edge[_M_RIGHT] || resize_edge[_M_DOWN]);
|
|
|
|
other_monitor++)
|
|
|
|
{
|
|
|
|
GdkRectangle other_wa;
|
|
|
|
|
|
|
|
if (other_monitor == monitor)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
gdk_screen_get_monitor_workarea (screen, other_monitor, &other_wa);
|
|
|
|
|
|
|
|
/* An edge triggers AeroSnap only if there are no
|
|
|
|
* monitors beyond that edge.
|
|
|
|
* Even if there's another monitor, but it does not cover
|
|
|
|
* the whole edge (it's smaller or is not aligned to
|
|
|
|
* the corner of current monitor), that edge is still
|
|
|
|
* removed from the trigger list.
|
|
|
|
*/
|
|
|
|
if (other_wa.x >= wa.x + wa.width)
|
|
|
|
move_edge[_M_RIGHT] = FALSE;
|
|
|
|
|
|
|
|
if (other_wa.x + other_wa.width <= wa.x)
|
|
|
|
move_edge[_M_LEFT] = FALSE;
|
|
|
|
|
|
|
|
if (other_wa.y + other_wa.height <= wa.y)
|
|
|
|
{
|
|
|
|
move_edge[_M_UP] = FALSE;
|
|
|
|
resize_edge[_M_UP] = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (other_wa.y >= wa.y + wa.height)
|
|
|
|
{
|
|
|
|
/* no move_edge for the bottom edge, just resize_edge */
|
|
|
|
resize_edge[_M_DOWN] = FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-06-27 05:16:43 +00:00
|
|
|
thickness = AEROSNAP_REGION_THICKNESS * impl->window_scale;
|
|
|
|
trigger_thickness = AEROSNAP_REGION_TRIGGER_THICKNESS * impl->window_scale;
|
2016-03-08 05:03:29 +00:00
|
|
|
|
|
|
|
snap_region.edge = wa;
|
|
|
|
snap_region.trigger = wa;
|
|
|
|
snap_region.edge.height = thickness;
|
|
|
|
snap_region.trigger.height = trigger_thickness;
|
|
|
|
|
|
|
|
/* Extend both regions into toolbar space.
|
|
|
|
* When there's no toolbar, diff == 0.
|
|
|
|
*/
|
|
|
|
diff = wa.y - geometry.y;
|
|
|
|
snap_region.edge.height += diff;
|
|
|
|
snap_region.edge.y -= diff;
|
|
|
|
snap_region.trigger.height += diff;
|
|
|
|
snap_region.trigger.y -= diff;
|
|
|
|
|
|
|
|
if (move_edge[_M_UP])
|
|
|
|
g_array_append_val (context->maximize_regions, snap_region);
|
|
|
|
|
|
|
|
if (resize_edge[_M_UP])
|
|
|
|
g_array_append_val (context->fullup_regions, snap_region);
|
|
|
|
|
|
|
|
snap_region.edge = wa;
|
|
|
|
snap_region.trigger = wa;
|
|
|
|
snap_region.edge.width = thickness;
|
|
|
|
snap_region.trigger.width = trigger_thickness;
|
|
|
|
|
|
|
|
diff = wa.x - geometry.x;
|
|
|
|
snap_region.edge.width += diff;
|
|
|
|
snap_region.edge.x -= diff;
|
|
|
|
snap_region.trigger.width += diff;
|
|
|
|
snap_region.trigger.x -= diff;
|
|
|
|
|
|
|
|
if (move_edge[_M_LEFT])
|
|
|
|
g_array_append_val (context->halfleft_regions, snap_region);
|
|
|
|
|
|
|
|
snap_region.edge = wa;
|
|
|
|
snap_region.trigger = wa;
|
|
|
|
snap_region.edge.x += wa.width - thickness;
|
|
|
|
snap_region.edge.width = thickness;
|
|
|
|
snap_region.trigger.x += wa.width - trigger_thickness;
|
|
|
|
snap_region.trigger.width = trigger_thickness;
|
|
|
|
|
|
|
|
diff = (geometry.x + geometry.width) - (wa.x + wa.width);
|
|
|
|
snap_region.edge.width += diff;
|
|
|
|
snap_region.trigger.width += diff;
|
|
|
|
|
|
|
|
if (move_edge[_M_RIGHT])
|
|
|
|
g_array_append_val (context->halfright_regions, snap_region);
|
|
|
|
|
|
|
|
snap_region.edge = wa;
|
|
|
|
snap_region.trigger = wa;
|
|
|
|
snap_region.edge.y += wa.height - thickness;
|
|
|
|
snap_region.edge.height = thickness;
|
|
|
|
snap_region.trigger.y += wa.height - trigger_thickness;
|
|
|
|
snap_region.trigger.height = trigger_thickness;
|
|
|
|
|
|
|
|
diff = (geometry.y + geometry.height) - (wa.y + wa.height);
|
|
|
|
snap_region.edge.height += diff;
|
|
|
|
snap_region.trigger.height += diff;
|
|
|
|
|
|
|
|
if (resize_edge[_M_DOWN])
|
|
|
|
g_array_append_val (context->fullup_regions, snap_region);
|
|
|
|
}
|
|
|
|
|
|
|
|
#undef _M_UP
|
|
|
|
#undef _M_DOWN
|
|
|
|
#undef _M_LEFT
|
|
|
|
#undef _M_RIGHT
|
|
|
|
|
2016-03-12 16:26:19 +00:00
|
|
|
#if defined(MORE_AEROSNAP_DEBUGGING)
|
2016-03-08 05:03:29 +00:00
|
|
|
for (i = 0; i < context->maximize_regions->len; i++)
|
|
|
|
log_region ("maximize", &g_array_index (context->maximize_regions, AeroSnapEdgeRegion, i));
|
|
|
|
|
|
|
|
for (i = 0; i < context->halfleft_regions->len; i++)
|
|
|
|
log_region ("halfleft", &g_array_index (context->halfleft_regions, AeroSnapEdgeRegion, i));
|
|
|
|
|
|
|
|
for (i = 0; i < context->halfright_regions->len; i++)
|
|
|
|
log_region ("halfright", &g_array_index (context->halfright_regions, AeroSnapEdgeRegion, i));
|
|
|
|
|
|
|
|
for (i = 0; i < context->fullup_regions->len; i++)
|
|
|
|
log_region ("fullup", &g_array_index (context->fullup_regions, AeroSnapEdgeRegion, i));
|
2016-03-12 16:26:19 +00:00
|
|
|
#endif
|
2016-03-08 05:03:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
discard_snapinfo (GdkWindow *window)
|
|
|
|
{
|
|
|
|
GdkWindowImplWin32 *impl;
|
|
|
|
|
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
|
|
|
|
|
|
|
impl->snap_state = GDK_WIN32_AEROSNAP_STATE_UNDETERMINED;
|
|
|
|
|
|
|
|
if (impl->snap_stash == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
g_clear_pointer (&impl->snap_stash, g_free);
|
|
|
|
g_clear_pointer (&impl->snap_stash_int, g_free);
|
|
|
|
}
|
|
|
|
|
2016-03-08 02:33:47 +00:00
|
|
|
static void
|
|
|
|
unsnap (GdkWindow *window,
|
|
|
|
GdkScreen *screen,
|
|
|
|
gint monitor)
|
|
|
|
{
|
|
|
|
GdkWindowImplWin32 *impl;
|
|
|
|
GdkRectangle rect;
|
|
|
|
|
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
|
|
|
|
|
|
|
impl->snap_state = GDK_WIN32_AEROSNAP_STATE_UNDETERMINED;
|
|
|
|
|
|
|
|
if (impl->snap_stash == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
gdk_screen_get_monitor_workarea (screen, monitor, &rect);
|
|
|
|
|
|
|
|
GDK_NOTE (MISC, g_print ("Monitor work area %d x %d @ %d : %d\n", rect.width, rect.height, rect.x, rect.y));
|
|
|
|
|
2016-03-08 03:17:09 +00:00
|
|
|
if (rect.width >= impl->snap_stash_int->width &&
|
|
|
|
rect.height >= impl->snap_stash_int->height)
|
|
|
|
{
|
|
|
|
/* If the window fits into new work area without resizing it,
|
|
|
|
* place it into new work area without resizing it.
|
|
|
|
*/
|
|
|
|
gdouble left, right, up, down, hratio, vratio;
|
|
|
|
gdouble hscale, vscale;
|
|
|
|
gdouble new_left, new_up;
|
|
|
|
|
|
|
|
left = impl->snap_stash->x;
|
|
|
|
right = 1.0 - (impl->snap_stash->x + impl->snap_stash->width);
|
|
|
|
up = impl->snap_stash->y;
|
|
|
|
down = 1.0 - (impl->snap_stash->y + impl->snap_stash->height);
|
|
|
|
hscale = 1.0;
|
|
|
|
|
|
|
|
if (right > 0.001)
|
|
|
|
{
|
|
|
|
hratio = left / right;
|
|
|
|
hscale = hratio / (1.0 + hratio);
|
|
|
|
}
|
|
|
|
|
|
|
|
new_left = (gdouble) (rect.width - impl->snap_stash_int->width) * hscale;
|
|
|
|
|
|
|
|
vscale = 1.0;
|
|
|
|
|
|
|
|
if (down > 0.001)
|
|
|
|
{
|
|
|
|
vratio = up / down;
|
|
|
|
vscale = vratio / (1.0 + vratio);
|
|
|
|
}
|
|
|
|
|
|
|
|
new_up = (gdouble) (rect.height - impl->snap_stash_int->height) * vscale;
|
|
|
|
|
|
|
|
rect.x = round (rect.x + new_left);
|
|
|
|
rect.y = round (rect.y + new_up);
|
|
|
|
rect.width = impl->snap_stash_int->width;
|
|
|
|
rect.height = impl->snap_stash_int->height;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Calculate actual unsnapped window size based on its
|
|
|
|
* old relative size. Same for position.
|
|
|
|
*/
|
|
|
|
rect.x += round (rect.width * impl->snap_stash->x);
|
|
|
|
rect.y += round (rect.height * impl->snap_stash->y);
|
|
|
|
rect.width = round (rect.width * impl->snap_stash->width);
|
|
|
|
rect.height = round (rect.height * impl->snap_stash->height);
|
|
|
|
}
|
2016-03-08 02:33:47 +00:00
|
|
|
|
|
|
|
GDK_NOTE (MISC, g_print ("Unsnapped window size %d x %d @ %d : %d\n", rect.width, rect.height, rect.x, rect.y));
|
|
|
|
|
|
|
|
gdk_window_move_resize (window, rect.x, rect.y,
|
|
|
|
rect.width, rect.height);
|
|
|
|
|
|
|
|
g_clear_pointer (&impl->snap_stash, g_free);
|
2016-03-08 03:17:09 +00:00
|
|
|
g_clear_pointer (&impl->snap_stash_int, g_free);
|
2016-03-08 02:33:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
stash_window (GdkWindow *window,
|
|
|
|
GdkWindowImplWin32 *impl,
|
|
|
|
GdkScreen *screen,
|
|
|
|
gint monitor)
|
|
|
|
{
|
|
|
|
gint x, y;
|
2017-08-08 14:19:45 +00:00
|
|
|
gint width, wwidth;
|
|
|
|
gint height, wheight;
|
2016-03-08 02:33:47 +00:00
|
|
|
WINDOWPLACEMENT placement;
|
|
|
|
HMONITOR hmonitor;
|
|
|
|
MONITORINFO hmonitor_info;
|
|
|
|
|
|
|
|
placement.length = sizeof(WINDOWPLACEMENT);
|
|
|
|
|
|
|
|
/* Use W32 API to get unmaximized window size, which GDK doesn't remember */
|
|
|
|
if (!GetWindowPlacement (GDK_WINDOW_HWND (window), &placement))
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* MSDN is very vague, but in practice rcNormalPosition is the same as GetWindowRect(),
|
|
|
|
* only with adjustments for toolbars (which creates rather weird coodinate space issues).
|
|
|
|
* We need to get monitor info and apply workarea vs monitorarea diff to turn
|
|
|
|
* these into screen coordinates proper.
|
|
|
|
*/
|
|
|
|
hmonitor = MonitorFromWindow (GDK_WINDOW_HWND (window), MONITOR_DEFAULTTONEAREST);
|
|
|
|
hmonitor_info.cbSize = sizeof (hmonitor_info);
|
|
|
|
|
|
|
|
if (!GetMonitorInfoA (hmonitor, &hmonitor_info))
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (impl->snap_stash == NULL)
|
|
|
|
impl->snap_stash = g_new0 (GdkRectangleDouble, 1);
|
|
|
|
|
2016-03-08 03:17:09 +00:00
|
|
|
if (impl->snap_stash_int == NULL)
|
|
|
|
impl->snap_stash_int = g_new0 (GdkRectangle, 1);
|
|
|
|
|
2016-03-08 02:33:47 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("monitor work area %ld x %ld @ %ld : %ld\n",
|
2016-06-27 05:16:43 +00:00
|
|
|
(hmonitor_info.rcWork.right - hmonitor_info.rcWork.left) / impl->window_scale,
|
|
|
|
(hmonitor_info.rcWork.bottom - hmonitor_info.rcWork.top) / impl->window_scale,
|
2016-03-08 02:33:47 +00:00
|
|
|
hmonitor_info.rcWork.left,
|
|
|
|
hmonitor_info.rcWork.top));
|
|
|
|
GDK_NOTE (MISC, g_print ("monitor area %ld x %ld @ %ld : %ld\n",
|
2016-06-27 05:16:43 +00:00
|
|
|
(hmonitor_info.rcMonitor.right - hmonitor_info.rcMonitor.left) / impl->window_scale,
|
|
|
|
(hmonitor_info.rcMonitor.bottom - hmonitor_info.rcMonitor.top) / impl->window_scale,
|
2016-03-08 02:33:47 +00:00
|
|
|
hmonitor_info.rcMonitor.left,
|
|
|
|
hmonitor_info.rcMonitor.top));
|
|
|
|
GDK_NOTE (MISC, g_print ("window work place %ld x %ld @ %ld : %ld\n",
|
2016-06-27 05:16:43 +00:00
|
|
|
(placement.rcNormalPosition.right - placement.rcNormalPosition.left) / impl->window_scale,
|
|
|
|
(placement.rcNormalPosition.bottom - placement.rcNormalPosition.top) / impl->window_scale,
|
2016-03-08 02:33:47 +00:00
|
|
|
placement.rcNormalPosition.left,
|
|
|
|
placement.rcNormalPosition.top));
|
|
|
|
|
2017-08-08 14:19:45 +00:00
|
|
|
width = (placement.rcNormalPosition.right - placement.rcNormalPosition.left) / impl->window_scale;
|
|
|
|
height = (placement.rcNormalPosition.bottom - placement.rcNormalPosition.top) / impl->window_scale;
|
|
|
|
x = (placement.rcNormalPosition.left - hmonitor_info.rcMonitor.left) / impl->window_scale;
|
|
|
|
y = (placement.rcNormalPosition.top - hmonitor_info.rcMonitor.top) / impl->window_scale;
|
|
|
|
|
|
|
|
wwidth = (hmonitor_info.rcWork.right - hmonitor_info.rcWork.left) / impl->window_scale;
|
|
|
|
wheight = (hmonitor_info.rcWork.bottom - hmonitor_info.rcWork.top) / impl->window_scale;
|
2016-03-08 02:33:47 +00:00
|
|
|
|
2017-08-08 14:19:45 +00:00
|
|
|
impl->snap_stash->x = (gdouble) (x) / (gdouble) (wwidth);
|
|
|
|
impl->snap_stash->y = (gdouble) (y) / (gdouble) (wheight);
|
|
|
|
impl->snap_stash->width = (gdouble) width / (gdouble) (wwidth);
|
|
|
|
impl->snap_stash->height = (gdouble) height / (gdouble) (wheight);
|
2016-03-08 02:33:47 +00:00
|
|
|
|
2017-08-08 14:19:45 +00:00
|
|
|
impl->snap_stash_int->x = x;
|
|
|
|
impl->snap_stash_int->y = y;
|
|
|
|
impl->snap_stash_int->width = width;
|
|
|
|
impl->snap_stash_int->height = height;
|
2016-03-08 03:17:09 +00:00
|
|
|
|
2016-03-08 02:33:47 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("Stashed window %d x %d @ %d : %d as %f x %f @ %f : %f\n",
|
|
|
|
width, height, x, y,
|
|
|
|
impl->snap_stash->width, impl->snap_stash->height, impl->snap_stash->x, impl->snap_stash->y));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
snap_up (GdkWindow *window,
|
|
|
|
GdkScreen *screen,
|
|
|
|
gint monitor)
|
|
|
|
{
|
|
|
|
SHORT maxysize;
|
|
|
|
gint x, y;
|
2016-03-15 10:17:45 +00:00
|
|
|
gint width, height;
|
2016-03-08 02:33:47 +00:00
|
|
|
GdkWindowImplWin32 *impl;
|
|
|
|
|
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
|
|
|
|
|
|
|
impl->snap_state = GDK_WIN32_AEROSNAP_STATE_FULLUP;
|
|
|
|
|
2016-03-15 10:17:45 +00:00
|
|
|
stash_window (window, impl, screen, monitor);
|
|
|
|
|
2016-06-27 05:16:43 +00:00
|
|
|
maxysize = GetSystemMetrics (SM_CYVIRTUALSCREEN) / impl->window_scale;
|
2016-03-08 02:33:47 +00:00
|
|
|
gdk_window_get_position (window, &x, &y);
|
|
|
|
width = gdk_window_get_width (window);
|
|
|
|
|
2016-03-15 10:17:45 +00:00
|
|
|
y = 0;
|
|
|
|
height = maxysize;
|
2016-03-08 02:33:47 +00:00
|
|
|
|
2017-08-08 14:19:45 +00:00
|
|
|
x = x - impl->margins.left;
|
|
|
|
y = y - impl->margins.top;
|
2016-03-15 10:17:45 +00:00
|
|
|
width += impl->margins_x;
|
|
|
|
height += impl->margins_y;
|
|
|
|
|
|
|
|
gdk_window_move_resize (window, x, y, width, height);
|
2016-03-08 02:33:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
snap_left (GdkWindow *window,
|
|
|
|
GdkScreen *screen,
|
|
|
|
gint monitor,
|
|
|
|
gint snap_monitor)
|
|
|
|
{
|
|
|
|
GdkRectangle rect;
|
|
|
|
GdkWindowImplWin32 *impl;
|
|
|
|
|
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
|
|
|
|
|
|
|
impl->snap_state = GDK_WIN32_AEROSNAP_STATE_HALFLEFT;
|
|
|
|
|
|
|
|
gdk_screen_get_monitor_workarea (screen, snap_monitor, &rect);
|
|
|
|
|
|
|
|
stash_window (window, impl, screen, monitor);
|
|
|
|
|
2017-08-08 14:19:45 +00:00
|
|
|
rect.width = rect.width / 2;
|
2016-03-08 02:33:47 +00:00
|
|
|
|
2017-08-08 14:19:45 +00:00
|
|
|
rect.x = rect.x - impl->margins.left;
|
|
|
|
rect.y = rect.y - impl->margins.top;
|
2016-06-27 05:16:43 +00:00
|
|
|
rect.width = rect.width + impl->margins_x;
|
|
|
|
rect.height = rect.height + impl->margins_y;
|
2016-03-15 10:17:45 +00:00
|
|
|
|
2016-03-08 02:33:47 +00:00
|
|
|
gdk_window_move_resize (window, rect.x, rect.y, rect.width, rect.height);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
snap_right (GdkWindow *window,
|
|
|
|
GdkScreen *screen,
|
|
|
|
gint monitor,
|
|
|
|
gint snap_monitor)
|
|
|
|
{
|
|
|
|
GdkRectangle rect;
|
|
|
|
GdkWindowImplWin32 *impl;
|
|
|
|
|
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
|
|
|
|
|
|
|
impl->snap_state = GDK_WIN32_AEROSNAP_STATE_HALFRIGHT;
|
|
|
|
|
|
|
|
gdk_screen_get_monitor_workarea (screen, snap_monitor, &rect);
|
|
|
|
|
|
|
|
stash_window (window, impl, screen, monitor);
|
|
|
|
|
2017-08-08 14:19:45 +00:00
|
|
|
rect.width = rect.width / 2;
|
2016-03-08 02:33:47 +00:00
|
|
|
rect.x += rect.width;
|
|
|
|
|
2017-08-08 14:19:45 +00:00
|
|
|
rect.x = rect.x - impl->margins.left;
|
|
|
|
rect.y = rect.y - impl->margins.top;
|
|
|
|
rect.width = rect.width + impl->margins_x;
|
|
|
|
rect.height = rect.height + impl->margins_y;
|
2016-03-15 10:17:45 +00:00
|
|
|
|
2016-03-08 02:33:47 +00:00
|
|
|
gdk_window_move_resize (window, rect.x, rect.y, rect.width, rect.height);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_gdk_win32_window_handle_aerosnap (GdkWindow *window,
|
|
|
|
GdkWin32AeroSnapCombo combo)
|
|
|
|
{
|
|
|
|
GdkWindowImplWin32 *impl;
|
|
|
|
GdkDisplay *display;
|
|
|
|
GdkScreen *screen;
|
|
|
|
gint n_monitors, monitor;
|
|
|
|
GdkWindowState window_state = gdk_window_get_state (window);
|
|
|
|
gboolean minimized = window_state & GDK_WINDOW_STATE_ICONIFIED;
|
|
|
|
gboolean maximized = window_state & GDK_WINDOW_STATE_MAXIMIZED;
|
|
|
|
gboolean halfsnapped;
|
|
|
|
|
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
|
|
|
display = gdk_window_get_display (window);
|
|
|
|
screen = gdk_display_get_default_screen (display);
|
|
|
|
n_monitors = gdk_screen_get_n_monitors (screen);
|
|
|
|
monitor = gdk_screen_get_monitor_at_window (screen, window);
|
|
|
|
|
|
|
|
if (minimized && maximized)
|
|
|
|
minimized = FALSE;
|
|
|
|
|
|
|
|
halfsnapped = (impl->snap_state == GDK_WIN32_AEROSNAP_STATE_HALFRIGHT ||
|
|
|
|
impl->snap_state == GDK_WIN32_AEROSNAP_STATE_HALFLEFT ||
|
|
|
|
impl->snap_state == GDK_WIN32_AEROSNAP_STATE_FULLUP);
|
|
|
|
|
|
|
|
switch (combo)
|
|
|
|
{
|
|
|
|
case GDK_WIN32_AEROSNAP_COMBO_NOTHING:
|
|
|
|
/* Do nothing */
|
|
|
|
break;
|
|
|
|
case GDK_WIN32_AEROSNAP_COMBO_UP:
|
|
|
|
if (!maximized)
|
|
|
|
{
|
|
|
|
unsnap (window, screen, monitor);
|
|
|
|
gdk_window_maximize (window);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GDK_WIN32_AEROSNAP_COMBO_DOWN:
|
|
|
|
case GDK_WIN32_AEROSNAP_COMBO_SHIFTDOWN:
|
|
|
|
if (maximized)
|
|
|
|
{
|
|
|
|
gdk_window_unmaximize (window);
|
|
|
|
unsnap (window, screen, monitor);
|
|
|
|
}
|
|
|
|
else if (halfsnapped)
|
|
|
|
unsnap (window, screen, monitor);
|
|
|
|
else if (!minimized)
|
|
|
|
gdk_window_iconify (window);
|
|
|
|
break;
|
|
|
|
case GDK_WIN32_AEROSNAP_COMBO_LEFT:
|
|
|
|
if (maximized)
|
|
|
|
gdk_window_unmaximize (window);
|
|
|
|
|
|
|
|
if (impl->snap_state == GDK_WIN32_AEROSNAP_STATE_UNDETERMINED ||
|
|
|
|
impl->snap_state == GDK_WIN32_AEROSNAP_STATE_FULLUP)
|
|
|
|
{
|
|
|
|
unsnap (window, screen, monitor);
|
|
|
|
snap_left (window, screen, monitor, monitor);
|
|
|
|
}
|
|
|
|
else if (impl->snap_state == GDK_WIN32_AEROSNAP_STATE_HALFLEFT)
|
|
|
|
{
|
|
|
|
unsnap (window, screen, monitor);
|
|
|
|
snap_right (window, screen, monitor, monitor - 1 >= 0 ? monitor - 1 : n_monitors - 1);
|
|
|
|
}
|
|
|
|
else if (impl->snap_state == GDK_WIN32_AEROSNAP_STATE_HALFRIGHT)
|
|
|
|
{
|
|
|
|
unsnap (window, screen, monitor);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GDK_WIN32_AEROSNAP_COMBO_RIGHT:
|
|
|
|
if (maximized)
|
|
|
|
gdk_window_unmaximize (window);
|
|
|
|
|
|
|
|
if (impl->snap_state == GDK_WIN32_AEROSNAP_STATE_UNDETERMINED ||
|
|
|
|
impl->snap_state == GDK_WIN32_AEROSNAP_STATE_FULLUP)
|
|
|
|
{
|
|
|
|
unsnap (window, screen, monitor);
|
|
|
|
snap_right (window, screen, monitor, monitor);
|
|
|
|
}
|
|
|
|
else if (impl->snap_state == GDK_WIN32_AEROSNAP_STATE_HALFLEFT)
|
|
|
|
{
|
|
|
|
unsnap (window, screen, monitor);
|
|
|
|
}
|
|
|
|
else if (impl->snap_state == GDK_WIN32_AEROSNAP_STATE_HALFRIGHT)
|
|
|
|
{
|
|
|
|
unsnap (window, screen, monitor);
|
|
|
|
snap_left (window, screen, monitor, monitor + 1 < n_monitors ? monitor + 1 : 0);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GDK_WIN32_AEROSNAP_COMBO_SHIFTUP:
|
|
|
|
if (!maximized &&
|
|
|
|
impl->snap_state == GDK_WIN32_AEROSNAP_STATE_UNDETERMINED)
|
|
|
|
{
|
|
|
|
snap_up (window, screen, monitor);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GDK_WIN32_AEROSNAP_COMBO_SHIFTLEFT:
|
|
|
|
case GDK_WIN32_AEROSNAP_COMBO_SHIFTRIGHT:
|
|
|
|
/* No implementation needed at the moment */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-03-08 05:03:29 +00:00
|
|
|
static void
|
|
|
|
apply_snap (GdkWindow *window,
|
|
|
|
GdkWin32AeroSnapState snap)
|
|
|
|
{
|
|
|
|
GdkScreen *screen;
|
|
|
|
gint monitor;
|
|
|
|
|
|
|
|
screen = gdk_display_get_default_screen (gdk_window_get_display (window));
|
|
|
|
monitor = gdk_screen_get_monitor_at_window (screen, window);
|
|
|
|
|
|
|
|
switch (snap)
|
|
|
|
{
|
|
|
|
case GDK_WIN32_AEROSNAP_STATE_UNDETERMINED:
|
|
|
|
break;
|
|
|
|
case GDK_WIN32_AEROSNAP_STATE_MAXIMIZE:
|
|
|
|
unsnap (window, screen, monitor);
|
|
|
|
gdk_window_maximize (window);
|
|
|
|
break;
|
|
|
|
case GDK_WIN32_AEROSNAP_STATE_HALFLEFT:
|
|
|
|
unsnap (window, screen, monitor);
|
|
|
|
snap_left (window, screen, monitor, monitor);
|
|
|
|
break;
|
|
|
|
case GDK_WIN32_AEROSNAP_STATE_HALFRIGHT:
|
|
|
|
unsnap (window, screen, monitor);
|
|
|
|
snap_right (window, screen, monitor, monitor);
|
|
|
|
break;
|
|
|
|
case GDK_WIN32_AEROSNAP_STATE_FULLUP:
|
|
|
|
snap_up (window, screen, monitor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-03-15 16:10:34 +00:00
|
|
|
/* Registers a dumb window class. This window
|
|
|
|
* has DefWindowProc() for a window procedure and
|
|
|
|
* does not do anything that GdkWindow-bound HWNDs do.
|
|
|
|
*/
|
|
|
|
static ATOM
|
|
|
|
RegisterGdkDumbClass ()
|
|
|
|
{
|
|
|
|
static ATOM klassDUMB = 0;
|
|
|
|
static WNDCLASSEXW wcl;
|
|
|
|
ATOM klass = 0;
|
|
|
|
|
|
|
|
wcl.cbSize = sizeof (WNDCLASSEX);
|
|
|
|
wcl.style = 0; /* DON'T set CS_<H,V>REDRAW. It causes total redraw
|
|
|
|
* on WM_SIZE and WM_MOVE. Flicker, Performance!
|
|
|
|
*/
|
|
|
|
wcl.lpfnWndProc = DefWindowProcW;
|
|
|
|
wcl.cbClsExtra = 0;
|
|
|
|
wcl.cbWndExtra = 0;
|
|
|
|
wcl.hInstance = _gdk_app_hmodule;
|
|
|
|
wcl.hIcon = 0;
|
|
|
|
wcl.hIconSm = 0;
|
|
|
|
wcl.lpszMenuName = NULL;
|
|
|
|
wcl.hbrBackground = NULL;
|
|
|
|
wcl.hCursor = LoadCursor (NULL, IDC_ARROW);
|
|
|
|
wcl.style |= CS_OWNDC;
|
|
|
|
wcl.lpszClassName = L"gdkWindowDumb";
|
|
|
|
|
|
|
|
if (klassDUMB == 0)
|
|
|
|
klassDUMB = RegisterClassExW (&wcl);
|
|
|
|
|
|
|
|
klass = klassDUMB;
|
|
|
|
|
|
|
|
if (klass == 0)
|
|
|
|
{
|
|
|
|
WIN32_API_FAILED ("RegisterClassExW");
|
|
|
|
g_error ("That is a fatal error");
|
|
|
|
}
|
|
|
|
|
|
|
|
return klass;
|
|
|
|
}
|
|
|
|
|
2016-03-12 16:26:19 +00:00
|
|
|
static gboolean
|
|
|
|
ensure_snap_indicator_exists (GdkW32DragMoveResizeContext *context)
|
|
|
|
{
|
|
|
|
if (context->shape_indicator == NULL)
|
|
|
|
{
|
|
|
|
HWND handle;
|
|
|
|
ATOM klass;
|
2016-03-15 16:10:34 +00:00
|
|
|
klass = RegisterGdkDumbClass ();
|
2016-03-12 16:26:19 +00:00
|
|
|
|
|
|
|
handle = CreateWindowExW (WS_EX_TRANSPARENT | WS_EX_LAYERED | WS_EX_NOACTIVATE,
|
|
|
|
MAKEINTRESOURCEW (klass),
|
|
|
|
L"",
|
|
|
|
WS_POPUP,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
0, 0,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
_gdk_app_hmodule,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
context->shape_indicator = handle;
|
|
|
|
}
|
|
|
|
|
|
|
|
return context->shape_indicator != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
ensure_snap_indicator_surface (GdkW32DragMoveResizeContext *context,
|
|
|
|
gint width,
|
2016-06-27 05:16:43 +00:00
|
|
|
gint height,
|
|
|
|
guint scale)
|
2016-03-12 16:26:19 +00:00
|
|
|
{
|
|
|
|
if (context->indicator_surface != NULL &&
|
|
|
|
(context->indicator_surface_width < width ||
|
|
|
|
context->indicator_surface_height < height))
|
|
|
|
{
|
|
|
|
cairo_surface_destroy (context->indicator_surface);
|
|
|
|
context->indicator_surface = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (context->indicator_surface == NULL)
|
2016-06-27 05:16:43 +00:00
|
|
|
context->indicator_surface = cairo_win32_surface_create_with_dib (CAIRO_FORMAT_ARGB32,
|
|
|
|
width * scale,
|
|
|
|
height * scale);
|
2016-03-12 16:26:19 +00:00
|
|
|
|
|
|
|
if (cairo_surface_status (context->indicator_surface) != CAIRO_STATUS_SUCCESS)
|
|
|
|
{
|
|
|
|
cairo_surface_destroy (context->indicator_surface);
|
|
|
|
context->indicator_surface = NULL;
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Indicator is drawn with some inward offset, so that it does
|
|
|
|
* not hug screen edges.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
adjust_indicator_rectangle (GdkRectangle *rect,
|
2017-08-08 14:19:45 +00:00
|
|
|
gboolean inward)
|
2016-03-12 16:26:19 +00:00
|
|
|
{
|
|
|
|
gdouble inverter;
|
2016-06-27 05:16:43 +00:00
|
|
|
const gint gap = AEROSNAP_INDICATOR_EDGE_GAP;
|
2016-03-12 16:26:19 +00:00
|
|
|
#if defined(MORE_AEROSNAP_DEBUGGING)
|
|
|
|
GdkRectangle cache = *rect;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (inward)
|
|
|
|
inverter = 1.0;
|
|
|
|
else
|
|
|
|
inverter = -1.0;
|
|
|
|
|
2016-06-27 05:16:43 +00:00
|
|
|
rect->x += (gap * inverter);
|
|
|
|
rect->y += (gap * inverter);
|
2017-08-08 14:19:45 +00:00
|
|
|
rect->width -= (gap * 2 * inverter);
|
|
|
|
rect->height -= (gap * 2 * inverter);
|
2016-03-12 16:26:19 +00:00
|
|
|
|
|
|
|
#if defined(MORE_AEROSNAP_DEBUGGING)
|
|
|
|
GDK_NOTE (MISC, g_print ("Adjusted %d x %d @ %d : %d -> %d x %d @ %d : %d\n",
|
|
|
|
cache.width, cache.height, cache.x, cache.y,
|
|
|
|
rect->width, rect->height, rect->x, rect->y));
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
rounded_rectangle (cairo_t *cr,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
gdouble radius,
|
|
|
|
gdouble line_width,
|
|
|
|
GdkRGBA *fill,
|
2017-08-08 14:19:45 +00:00
|
|
|
GdkRGBA *outline)
|
2016-03-12 16:26:19 +00:00
|
|
|
{
|
|
|
|
gdouble degrees = M_PI / 180.0;
|
|
|
|
|
|
|
|
if (fill == NULL && outline == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
cairo_save (cr);
|
|
|
|
cairo_new_sub_path (cr);
|
2017-08-08 14:19:45 +00:00
|
|
|
cairo_arc (cr, x + width - radius, y + radius, radius, -90 * degrees, 0 * degrees);
|
|
|
|
cairo_arc (cr, x + width - radius, y + height - radius, radius, 0 * degrees, 90 * degrees);
|
|
|
|
cairo_arc (cr, (x + radius), y + height - radius, radius, 90 * degrees, 180 * degrees);
|
|
|
|
cairo_arc (cr, (x + radius), (y + radius), radius, 180 * degrees, 270 * degrees);
|
2016-03-12 16:26:19 +00:00
|
|
|
cairo_close_path (cr);
|
|
|
|
|
|
|
|
if (fill)
|
|
|
|
{
|
|
|
|
cairo_set_source_rgba (cr, fill->red, fill->green, fill->blue, fill->alpha);
|
|
|
|
|
|
|
|
if (outline)
|
|
|
|
cairo_fill_preserve (cr);
|
|
|
|
else
|
|
|
|
cairo_fill (cr);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (outline)
|
|
|
|
{
|
|
|
|
cairo_set_source_rgba (cr, outline->red, outline->green, outline->blue, outline->alpha);
|
|
|
|
cairo_set_line_width (cr, line_width);
|
|
|
|
cairo_stroke (cr);
|
|
|
|
}
|
|
|
|
|
|
|
|
cairo_restore (cr);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Translates linear animation scale into some kind of curve */
|
|
|
|
static gdouble
|
|
|
|
curve (gdouble val)
|
|
|
|
{
|
|
|
|
/* TODO: try different curves. For now it's just linear */
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
draw_indicator (GdkW32DragMoveResizeContext *context,
|
|
|
|
gint64 timestamp)
|
|
|
|
{
|
|
|
|
cairo_t *cr;
|
|
|
|
GdkRGBA outline = {0, 0, 1.0, 1.0};
|
|
|
|
GdkRGBA fill = {0, 0, 1.0, 0.8};
|
|
|
|
GdkRectangle current_rect;
|
|
|
|
gint64 current_time = g_get_monotonic_time ();
|
|
|
|
gdouble animation_progress;
|
|
|
|
gboolean last_draw;
|
|
|
|
gdouble line_width;
|
|
|
|
gdouble corner_radius;
|
|
|
|
gint64 animation_duration;
|
2016-06-27 05:16:43 +00:00
|
|
|
GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (context->window->impl);
|
2016-03-12 16:26:19 +00:00
|
|
|
|
2017-08-08 14:19:45 +00:00
|
|
|
line_width = AEROSNAP_INDICATOR_LINE_WIDTH * impl->window_scale;
|
2016-03-12 16:26:19 +00:00
|
|
|
corner_radius = AEROSNAP_INDICATOR_CORNER_RADIUS;
|
|
|
|
animation_duration = AEROSNAP_INDICATOR_ANIMATION_DURATION;
|
|
|
|
last_draw = FALSE;
|
|
|
|
|
|
|
|
if (timestamp == 0 &&
|
|
|
|
current_time - context->indicator_start_time > animation_duration)
|
|
|
|
{
|
|
|
|
timestamp = context->indicator_start_time + animation_duration;
|
|
|
|
last_draw = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (timestamp != 0)
|
|
|
|
current_time = timestamp;
|
|
|
|
|
|
|
|
animation_progress = (gdouble) (current_time - context->indicator_start_time) / animation_duration;
|
|
|
|
|
|
|
|
if (animation_progress > 1.0)
|
|
|
|
animation_progress = 1.0;
|
|
|
|
|
|
|
|
if (animation_progress < 0)
|
|
|
|
animation_progress = 0;
|
|
|
|
|
|
|
|
animation_progress = curve (animation_progress);
|
|
|
|
|
|
|
|
current_rect = context->indicator_start;
|
|
|
|
current_rect.x += (context->indicator_target.x - context->indicator_start.x) * animation_progress;
|
|
|
|
current_rect.y += (context->indicator_target.y - context->indicator_start.y) * animation_progress;
|
|
|
|
current_rect.width += (context->indicator_target.width - context->indicator_start.width) * animation_progress;
|
|
|
|
current_rect.height += (context->indicator_target.height - context->indicator_start.height) * animation_progress;
|
|
|
|
|
|
|
|
if (context->op == GDK_WIN32_DRAGOP_RESIZE && last_draw)
|
|
|
|
{
|
|
|
|
switch (context->edge)
|
|
|
|
{
|
|
|
|
case GDK_WINDOW_EDGE_NORTH_WEST:
|
|
|
|
current_rect.x = context->indicator_target.x + (context->indicator_target.width - current_rect.width);
|
|
|
|
current_rect.y = context->indicator_target.y + (context->indicator_target.height - current_rect.height);
|
|
|
|
break;
|
|
|
|
case GDK_WINDOW_EDGE_NORTH:
|
|
|
|
current_rect.y = context->indicator_target.y + (context->indicator_target.height - current_rect.height);
|
|
|
|
break;
|
|
|
|
case GDK_WINDOW_EDGE_WEST:
|
|
|
|
current_rect.x = context->indicator_target.x + (context->indicator_target.width - current_rect.width);
|
|
|
|
break;
|
|
|
|
case GDK_WINDOW_EDGE_SOUTH_WEST:
|
|
|
|
current_rect.x = context->indicator_target.x + (context->indicator_target.width - current_rect.width);
|
|
|
|
current_rect.y = context->indicator_target.y;
|
|
|
|
break;
|
|
|
|
case GDK_WINDOW_EDGE_NORTH_EAST:
|
|
|
|
current_rect.x = context->indicator_target.x;
|
|
|
|
current_rect.y = context->indicator_target.y + (context->indicator_target.height - current_rect.height);
|
|
|
|
break;
|
|
|
|
case GDK_WINDOW_EDGE_SOUTH_EAST:
|
|
|
|
current_rect.x = context->indicator_target.x;
|
|
|
|
current_rect.y = context->indicator_target.y;
|
|
|
|
break;
|
|
|
|
case GDK_WINDOW_EDGE_SOUTH:
|
|
|
|
current_rect.y = context->indicator_target.y;
|
|
|
|
break;
|
|
|
|
case GDK_WINDOW_EDGE_EAST:
|
|
|
|
current_rect.x = context->indicator_target.x;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
cr = cairo_create (context->indicator_surface);
|
|
|
|
rounded_rectangle (cr,
|
2017-08-08 14:19:45 +00:00
|
|
|
(current_rect.x - context->indicator_window_rect.x) * impl->window_scale,
|
|
|
|
(current_rect.y - context->indicator_window_rect.y) * impl->window_scale,
|
|
|
|
current_rect.width * impl->window_scale,
|
|
|
|
current_rect.height * impl->window_scale,
|
2016-03-12 16:26:19 +00:00
|
|
|
corner_radius,
|
|
|
|
line_width,
|
2017-08-08 14:19:45 +00:00
|
|
|
&fill, &outline);
|
2016-03-12 16:26:19 +00:00
|
|
|
cairo_destroy (cr);
|
|
|
|
|
|
|
|
#if defined(MORE_AEROSNAP_DEBUGGING)
|
|
|
|
GDK_NOTE (MISC, g_print ("Indicator is %d x %d @ %d : %d; current time is %" G_GINT64_FORMAT "\n",
|
|
|
|
current_rect.width, current_rect.height,
|
|
|
|
current_rect.x - context->indicator_window_rect.x,
|
|
|
|
current_rect.y - context->indicator_window_rect.y,
|
|
|
|
current_time));
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return last_draw;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
redraw_indicator (gpointer user_data)
|
|
|
|
{
|
|
|
|
GdkW32DragMoveResizeContext *context = user_data;
|
|
|
|
POINT window_position;
|
|
|
|
SIZE window_size;
|
|
|
|
BLENDFUNCTION blender;
|
|
|
|
HDC hdc;
|
|
|
|
POINT source_point = { 0, 0 };
|
|
|
|
gboolean last_draw;
|
|
|
|
gdouble indicator_opacity;
|
2016-06-27 05:16:43 +00:00
|
|
|
GdkWindowImplWin32 *impl;
|
|
|
|
gboolean do_source_remove = FALSE;
|
2016-03-12 16:26:19 +00:00
|
|
|
|
|
|
|
indicator_opacity = AEROSNAP_INDICATOR_OPACITY;
|
|
|
|
|
|
|
|
if (GDK_WINDOW_DESTROYED (context->window) ||
|
2016-06-27 05:16:43 +00:00
|
|
|
!ensure_snap_indicator_exists (context))
|
|
|
|
{
|
|
|
|
do_source_remove = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (context->window->impl);
|
|
|
|
|
|
|
|
if (!ensure_snap_indicator_surface (context,
|
|
|
|
context->indicator_window_rect.width,
|
|
|
|
context->indicator_window_rect.height,
|
|
|
|
impl->window_scale))
|
|
|
|
{
|
|
|
|
do_source_remove = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (do_source_remove)
|
2016-03-12 16:26:19 +00:00
|
|
|
{
|
|
|
|
context->timer = 0;
|
|
|
|
return G_SOURCE_REMOVE;
|
|
|
|
}
|
|
|
|
|
|
|
|
last_draw = draw_indicator (context, context->draw_timestamp);
|
|
|
|
|
2016-06-27 05:16:43 +00:00
|
|
|
window_position.x = (context->indicator_window_rect.x - _gdk_offset_x) * impl->window_scale;
|
|
|
|
window_position.y = (context->indicator_window_rect.y - _gdk_offset_y) * impl->window_scale;
|
|
|
|
window_size.cx = context->indicator_window_rect.width * impl->window_scale;
|
|
|
|
window_size.cy = context->indicator_window_rect.height * impl->window_scale;
|
2016-03-12 16:26:19 +00:00
|
|
|
|
|
|
|
blender.BlendOp = AC_SRC_OVER;
|
|
|
|
blender.BlendFlags = 0;
|
|
|
|
blender.AlphaFormat = AC_SRC_ALPHA;
|
|
|
|
blender.SourceConstantAlpha = 255 * indicator_opacity;
|
|
|
|
|
|
|
|
hdc = cairo_win32_surface_get_dc (context->indicator_surface);
|
|
|
|
|
|
|
|
API_CALL (SetWindowPos, (context->shape_indicator,
|
|
|
|
GDK_WINDOW_HWND (context->window),
|
|
|
|
0, 0, 0, 0,
|
|
|
|
SWP_NOMOVE | SWP_NOSIZE | SWP_NOREDRAW | SWP_SHOWWINDOW | SWP_NOACTIVATE));
|
|
|
|
|
|
|
|
#if defined(MORE_AEROSNAP_DEBUGGING)
|
|
|
|
GDK_NOTE (MISC, g_print ("Indicator window position is %ld x %ld @ %ld : %ld\n",
|
|
|
|
window_size.cx, window_size.cy,
|
|
|
|
window_position.x, window_position.y));
|
|
|
|
#endif
|
|
|
|
|
|
|
|
API_CALL (UpdateLayeredWindow, (context->shape_indicator, NULL,
|
|
|
|
&window_position, &window_size,
|
|
|
|
hdc, &source_point,
|
|
|
|
0, &blender, ULW_ALPHA));
|
|
|
|
|
|
|
|
if (last_draw)
|
|
|
|
context->timer = 0;
|
|
|
|
|
|
|
|
return last_draw ? G_SOURCE_REMOVE : G_SOURCE_CONTINUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GdkRectangle
|
|
|
|
unity_of_rects (GdkRectangle a,
|
|
|
|
GdkRectangle b)
|
|
|
|
{
|
|
|
|
GdkRectangle u = b;
|
|
|
|
|
|
|
|
if (a.x < u.x)
|
|
|
|
{
|
|
|
|
u.width += u.x - a.x;
|
|
|
|
u.x = a.x;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (a.y < u.y)
|
|
|
|
{
|
|
|
|
u.height += (u.y - a.y);
|
|
|
|
u.y = a.y;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (a.x + a.width > u.x + u.width)
|
|
|
|
u.width += (a.x + a.width) - (u.x + u.width);
|
|
|
|
|
|
|
|
if (a.y + a.height > u.y + u.height)
|
|
|
|
u.height += (a.y + a.height) - (u.y + u.height);
|
|
|
|
|
|
|
|
#if defined(MORE_AEROSNAP_DEBUGGING)
|
|
|
|
GDK_NOTE (MISC, g_print ("Unified 2 rects into %d x %d @ %d : %d\n",
|
|
|
|
u.width, u.height, u.x, u.y));
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return u;
|
|
|
|
}
|
|
|
|
|
2016-03-08 05:03:29 +00:00
|
|
|
static void
|
|
|
|
start_indicator_drawing (GdkW32DragMoveResizeContext *context,
|
|
|
|
GdkRectangle from,
|
2016-06-27 05:16:43 +00:00
|
|
|
GdkRectangle to,
|
|
|
|
guint scale)
|
2016-03-08 05:03:29 +00:00
|
|
|
{
|
2016-03-12 16:26:19 +00:00
|
|
|
GdkRectangle to_adjusted, from_adjusted, from_or_to;
|
|
|
|
gint64 indicator_animation_tick = AEROSNAP_INDICATOR_ANIMATION_TICK;
|
2016-03-08 05:03:29 +00:00
|
|
|
|
|
|
|
GDK_NOTE (MISC, g_print ("Start drawing snap indicator %d x %d @ %d : %d -> %d x %d @ %d : %d\n",
|
2016-06-27 05:16:43 +00:00
|
|
|
from.width * scale, from.height * scale, from.x, from.y, to.width * scale, to.height * scale, to.x, to.y));
|
2016-03-12 16:26:19 +00:00
|
|
|
|
|
|
|
if (GDK_WINDOW_DESTROYED (context->window))
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!ensure_snap_indicator_exists (context))
|
|
|
|
return;
|
|
|
|
|
|
|
|
from_or_to = unity_of_rects (from, to);
|
|
|
|
|
2016-06-27 05:16:43 +00:00
|
|
|
if (!ensure_snap_indicator_surface (context, from_or_to.width, from_or_to.height, scale))
|
2016-03-12 16:26:19 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
to_adjusted = to;
|
2017-08-08 14:19:45 +00:00
|
|
|
adjust_indicator_rectangle (&to_adjusted, TRUE);
|
2016-06-27 05:16:43 +00:00
|
|
|
|
2016-03-12 16:26:19 +00:00
|
|
|
from_adjusted = from;
|
2017-08-08 14:19:45 +00:00
|
|
|
adjust_indicator_rectangle (&from_adjusted, TRUE);
|
2016-03-12 16:26:19 +00:00
|
|
|
|
|
|
|
context->draw_timestamp = 0;
|
|
|
|
context->indicator_start = from_adjusted;
|
|
|
|
context->indicator_target = to_adjusted;
|
|
|
|
context->indicator_window_rect = from_or_to;
|
|
|
|
context->indicator_start_time = g_get_monotonic_time ();
|
|
|
|
|
|
|
|
if (context->timer)
|
|
|
|
{
|
|
|
|
g_source_remove (context->timer);
|
|
|
|
context->timer = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
context->timer = g_timeout_add_full (G_PRIORITY_DEFAULT,
|
|
|
|
indicator_animation_tick,
|
|
|
|
redraw_indicator,
|
|
|
|
context,
|
|
|
|
NULL);
|
2016-03-08 05:03:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
update_fullup_indicator (GdkWindow *window,
|
|
|
|
GdkW32DragMoveResizeContext *context)
|
|
|
|
{
|
2016-03-12 16:26:19 +00:00
|
|
|
SHORT maxysize;
|
|
|
|
GdkRectangle from, to;
|
|
|
|
GdkRectangle to_adjusted, from_adjusted, from_or_to;
|
2016-06-27 05:16:43 +00:00
|
|
|
GdkWindowImplWin32 *impl;
|
2016-03-08 05:03:29 +00:00
|
|
|
|
|
|
|
GDK_NOTE (MISC, g_print ("Update fullup indicator\n"));
|
2016-03-12 16:26:19 +00:00
|
|
|
|
|
|
|
if (GDK_WINDOW_DESTROYED (context->window))
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (context->shape_indicator == NULL)
|
|
|
|
return;
|
|
|
|
|
2016-06-27 05:16:43 +00:00
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
2016-03-12 16:26:19 +00:00
|
|
|
maxysize = GetSystemMetrics (SM_CYVIRTUALSCREEN);
|
|
|
|
gdk_window_get_position (window, &to.x, &to.y);
|
2017-08-08 14:19:45 +00:00
|
|
|
to.width = gdk_window_get_width (window);
|
|
|
|
to.height = gdk_window_get_height (window);
|
2016-03-12 16:26:19 +00:00
|
|
|
|
|
|
|
to.y = 0;
|
|
|
|
to.height = maxysize;
|
|
|
|
from = context->indicator_target;
|
|
|
|
|
|
|
|
if (context->timer == 0)
|
|
|
|
{
|
|
|
|
from_adjusted = from;
|
2017-08-08 14:19:45 +00:00
|
|
|
adjust_indicator_rectangle (&from_adjusted, FALSE);
|
2016-03-12 16:26:19 +00:00
|
|
|
|
|
|
|
GDK_NOTE (MISC, g_print ("Restart fullup animation from %d x %d @ %d : %d -> %d x %d @ %d x %d\n",
|
|
|
|
context->indicator_target.width, context->indicator_target.height,
|
|
|
|
context->indicator_target.x, context->indicator_target.y,
|
|
|
|
to.width, to.height, to.x, to.y));
|
2016-06-27 05:16:43 +00:00
|
|
|
start_indicator_drawing (context, from_adjusted, to, impl->window_scale);
|
2016-03-12 16:26:19 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
from_or_to = unity_of_rects (from, to);
|
|
|
|
|
|
|
|
to_adjusted = to;
|
2017-08-08 14:19:45 +00:00
|
|
|
adjust_indicator_rectangle (&to_adjusted, TRUE);
|
2016-03-12 16:26:19 +00:00
|
|
|
|
|
|
|
GDK_NOTE (MISC, g_print ("Retarget fullup animation %d x %d @ %d : %d -> %d x %d @ %d x %d\n",
|
|
|
|
context->indicator_target.width, context->indicator_target.height,
|
|
|
|
context->indicator_target.x, context->indicator_target.y,
|
|
|
|
to_adjusted.width, to_adjusted.height, to_adjusted.x, to_adjusted.y));
|
|
|
|
|
|
|
|
context->indicator_target = to_adjusted;
|
|
|
|
context->indicator_window_rect = from_or_to;
|
|
|
|
|
2016-06-27 05:16:43 +00:00
|
|
|
ensure_snap_indicator_surface (context, from_or_to.width, from_or_to.height, impl->window_scale);
|
2016-03-08 05:03:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
start_indicator (GdkWindow *window,
|
|
|
|
GdkW32DragMoveResizeContext *context,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
GdkWin32AeroSnapState state)
|
|
|
|
{
|
|
|
|
GdkScreen *screen;
|
|
|
|
gint monitor;
|
|
|
|
GdkRectangle workarea;
|
|
|
|
SHORT maxysize;
|
|
|
|
GdkRectangle start_size, end_size;
|
2016-06-27 05:16:43 +00:00
|
|
|
GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
2016-03-08 05:03:29 +00:00
|
|
|
|
|
|
|
screen = gdk_window_get_screen (window);
|
|
|
|
monitor = gdk_screen_get_monitor_at_point (screen, x, y);
|
|
|
|
gdk_screen_get_monitor_workarea (screen, monitor, &workarea);
|
|
|
|
|
2016-06-27 05:16:43 +00:00
|
|
|
maxysize = GetSystemMetrics (SM_CYVIRTUALSCREEN) / impl->window_scale;
|
2016-03-08 05:03:29 +00:00
|
|
|
gdk_window_get_position (window, &start_size.x, &start_size.y);
|
|
|
|
start_size.width = gdk_window_get_width (window);
|
|
|
|
start_size.height = gdk_window_get_height (window);
|
|
|
|
|
|
|
|
end_size = start_size;
|
|
|
|
|
|
|
|
switch (state)
|
|
|
|
{
|
|
|
|
case GDK_WIN32_AEROSNAP_STATE_UNDETERMINED:
|
|
|
|
return;
|
|
|
|
case GDK_WIN32_AEROSNAP_STATE_MAXIMIZE:
|
|
|
|
end_size.x = workarea.x;
|
|
|
|
end_size.y = workarea.y;
|
|
|
|
end_size.width = workarea.width;
|
|
|
|
end_size.height = workarea.height;
|
|
|
|
break;
|
|
|
|
case GDK_WIN32_AEROSNAP_STATE_HALFLEFT:
|
|
|
|
end_size.x = workarea.x;
|
|
|
|
end_size.y = workarea.y;
|
|
|
|
end_size.width = workarea.width / 2;
|
|
|
|
end_size.height = workarea.height;
|
|
|
|
break;
|
|
|
|
case GDK_WIN32_AEROSNAP_STATE_HALFRIGHT:
|
2017-08-08 14:19:45 +00:00
|
|
|
end_size.x = (workarea.x + workarea.width / 2);
|
2016-03-08 05:03:29 +00:00
|
|
|
end_size.y = workarea.y;
|
|
|
|
end_size.width = workarea.width / 2;
|
|
|
|
end_size.height = workarea.height;
|
|
|
|
break;
|
|
|
|
case GDK_WIN32_AEROSNAP_STATE_FULLUP:
|
2016-03-12 16:26:19 +00:00
|
|
|
end_size.y = 0;
|
2016-03-08 05:03:29 +00:00
|
|
|
end_size.height = maxysize;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2016-06-27 05:16:43 +00:00
|
|
|
start_indicator_drawing (context, start_size, end_size, impl->window_scale);
|
2016-03-08 05:03:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
stop_indicator (GdkWindow *window,
|
|
|
|
GdkW32DragMoveResizeContext *context)
|
|
|
|
{
|
|
|
|
GDK_NOTE (MISC, g_print ("Stop drawing snap indicator\n"));
|
2016-03-12 16:26:19 +00:00
|
|
|
|
|
|
|
if (context->timer)
|
|
|
|
{
|
|
|
|
g_source_remove (context->timer);
|
|
|
|
context->timer = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
API_CALL (SetWindowPos, (context->shape_indicator,
|
|
|
|
SWP_NOZORDER_SPECIFIED,
|
|
|
|
0, 0, 0, 0,
|
|
|
|
SWP_NOZORDER | SWP_NOMOVE |
|
|
|
|
SWP_NOSIZE | SWP_NOREDRAW | SWP_HIDEWINDOW | SWP_NOACTIVATE));
|
2016-03-08 05:03:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
2016-06-27 05:16:43 +00:00
|
|
|
point_in_aerosnap_region (gint x,
|
|
|
|
gint y,
|
2017-08-08 14:19:45 +00:00
|
|
|
AeroSnapEdgeRegion *region)
|
2016-03-08 05:03:29 +00:00
|
|
|
{
|
|
|
|
gint edge, trigger;
|
2017-08-08 14:19:45 +00:00
|
|
|
|
|
|
|
edge = (x >= region->edge.x &&
|
|
|
|
y >= region->edge.y &&
|
|
|
|
x <= region->edge.x + region->edge.width &&
|
|
|
|
y <= region->edge.y + region->edge.height) ? 1 : 0;
|
|
|
|
trigger = (x >= region->trigger.x &&
|
|
|
|
y >= region->trigger.y &&
|
|
|
|
x <= region->trigger.x + region->trigger.width &&
|
|
|
|
y <= region->trigger.y + region->trigger.height) ? 1 : 0;
|
2016-03-08 05:03:29 +00:00
|
|
|
return edge + trigger;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
handle_aerosnap_move_resize (GdkWindow *window,
|
|
|
|
GdkW32DragMoveResizeContext *context,
|
|
|
|
gint x,
|
|
|
|
gint y)
|
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
AeroSnapEdgeRegion *reg;
|
|
|
|
gint maximize = 0;
|
|
|
|
gint halfleft = 0;
|
|
|
|
gint halfright = 0;
|
|
|
|
gint fullup = 0;
|
2016-03-12 16:26:19 +00:00
|
|
|
gboolean fullup_edge = FALSE;
|
2016-06-27 05:16:43 +00:00
|
|
|
GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
2016-03-12 16:26:19 +00:00
|
|
|
|
|
|
|
if (context->op == GDK_WIN32_DRAGOP_RESIZE)
|
|
|
|
switch (context->edge)
|
|
|
|
{
|
|
|
|
case GDK_WINDOW_EDGE_NORTH_WEST:
|
|
|
|
case GDK_WINDOW_EDGE_NORTH_EAST:
|
|
|
|
case GDK_WINDOW_EDGE_WEST:
|
|
|
|
case GDK_WINDOW_EDGE_EAST:
|
|
|
|
case GDK_WINDOW_EDGE_SOUTH_WEST:
|
|
|
|
case GDK_WINDOW_EDGE_SOUTH_EAST:
|
|
|
|
break;
|
|
|
|
case GDK_WINDOW_EDGE_SOUTH:
|
|
|
|
case GDK_WINDOW_EDGE_NORTH:
|
|
|
|
fullup_edge = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
2016-03-08 05:03:29 +00:00
|
|
|
|
|
|
|
for (i = 0; i < context->maximize_regions->len && maximize == 0; i++)
|
|
|
|
{
|
|
|
|
reg = &g_array_index (context->maximize_regions, AeroSnapEdgeRegion, i);
|
2017-08-08 14:19:45 +00:00
|
|
|
maximize = point_in_aerosnap_region (x, y, reg);
|
2016-03-08 05:03:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < context->halfleft_regions->len && halfleft == 0; i++)
|
|
|
|
{
|
|
|
|
reg = &g_array_index (context->halfleft_regions, AeroSnapEdgeRegion, i);
|
2017-08-08 14:19:45 +00:00
|
|
|
halfleft = point_in_aerosnap_region (x, y, reg);
|
2016-03-08 05:03:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < context->halfright_regions->len && halfright == 0; i++)
|
|
|
|
{
|
|
|
|
reg = &g_array_index (context->halfright_regions, AeroSnapEdgeRegion, i);
|
2017-08-08 14:19:45 +00:00
|
|
|
halfright = point_in_aerosnap_region (x, y, reg);
|
2016-03-08 05:03:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < context->fullup_regions->len && fullup == 0; i++)
|
|
|
|
{
|
|
|
|
reg = &g_array_index (context->fullup_regions, AeroSnapEdgeRegion, i);
|
2017-08-08 14:19:45 +00:00
|
|
|
fullup = point_in_aerosnap_region (x, y, reg);
|
2016-03-08 05:03:29 +00:00
|
|
|
}
|
|
|
|
|
2016-03-12 16:26:19 +00:00
|
|
|
#if defined(MORE_AEROSNAP_DEBUGGING)
|
2016-03-08 05:03:29 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("AeroSnap: point %d : %d - max: %d, left %d, right %d, up %d\n",
|
|
|
|
x, y, maximize, halfleft, halfright, fullup));
|
2016-03-12 16:26:19 +00:00
|
|
|
#endif
|
2016-03-08 05:03:29 +00:00
|
|
|
|
|
|
|
if (!context->revealed)
|
|
|
|
{
|
|
|
|
if (context->op == GDK_WIN32_DRAGOP_MOVE && maximize == 2)
|
|
|
|
{
|
|
|
|
context->revealed = TRUE;
|
|
|
|
context->current_snap = GDK_WIN32_AEROSNAP_STATE_MAXIMIZE;
|
|
|
|
start_indicator (window, context, x, y, context->current_snap);
|
|
|
|
}
|
|
|
|
else if (context->op == GDK_WIN32_DRAGOP_MOVE && halfleft == 2)
|
|
|
|
{
|
|
|
|
context->revealed = TRUE;
|
|
|
|
context->current_snap = GDK_WIN32_AEROSNAP_STATE_HALFLEFT;
|
|
|
|
start_indicator (window, context, x, y, context->current_snap);
|
|
|
|
}
|
|
|
|
else if (context->op == GDK_WIN32_DRAGOP_MOVE && halfright == 2)
|
|
|
|
{
|
|
|
|
context->revealed = TRUE;
|
|
|
|
context->current_snap = GDK_WIN32_AEROSNAP_STATE_HALFRIGHT;
|
|
|
|
start_indicator (window, context, x, y, context->current_snap);
|
|
|
|
}
|
2016-03-12 16:26:19 +00:00
|
|
|
else if (context->op == GDK_WIN32_DRAGOP_RESIZE && fullup == 2 && fullup_edge)
|
2016-03-08 05:03:29 +00:00
|
|
|
{
|
|
|
|
context->revealed = TRUE;
|
|
|
|
context->current_snap = GDK_WIN32_AEROSNAP_STATE_FULLUP;
|
|
|
|
start_indicator (window, context, x, y, context->current_snap);
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (context->current_snap)
|
|
|
|
{
|
|
|
|
case GDK_WIN32_AEROSNAP_STATE_UNDETERMINED:
|
|
|
|
if (context->op == GDK_WIN32_DRAGOP_RESIZE && fullup > 0)
|
|
|
|
{
|
|
|
|
context->current_snap = GDK_WIN32_AEROSNAP_STATE_FULLUP;
|
|
|
|
start_indicator (window, context, x, y, context->current_snap);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GDK_WIN32_AEROSNAP_STATE_MAXIMIZE:
|
|
|
|
if (context->op == GDK_WIN32_DRAGOP_MOVE && maximize > 0)
|
|
|
|
break;
|
|
|
|
if (context->op == GDK_WIN32_DRAGOP_MOVE && halfleft > 0)
|
|
|
|
{
|
|
|
|
context->current_snap = GDK_WIN32_AEROSNAP_STATE_HALFLEFT;
|
|
|
|
start_indicator (window, context, x, y, context->current_snap);
|
|
|
|
}
|
|
|
|
else if (context->op == GDK_WIN32_DRAGOP_MOVE && halfright > 0)
|
|
|
|
{
|
|
|
|
context->current_snap = GDK_WIN32_AEROSNAP_STATE_HALFRIGHT;
|
|
|
|
start_indicator (window, context, x, y, context->current_snap);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
context->current_snap = GDK_WIN32_AEROSNAP_STATE_UNDETERMINED;
|
|
|
|
stop_indicator (window, context);
|
|
|
|
context->revealed = FALSE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GDK_WIN32_AEROSNAP_STATE_HALFLEFT:
|
|
|
|
if (context->op == GDK_WIN32_DRAGOP_MOVE && halfleft > 0)
|
|
|
|
break;
|
|
|
|
if (context->op == GDK_WIN32_DRAGOP_MOVE && maximize > 0)
|
|
|
|
{
|
|
|
|
context->current_snap = GDK_WIN32_AEROSNAP_STATE_MAXIMIZE;
|
|
|
|
start_indicator (window, context, x, y, context->current_snap);
|
|
|
|
}
|
|
|
|
else if (context->op == GDK_WIN32_DRAGOP_MOVE && halfright > 0)
|
|
|
|
{
|
|
|
|
context->current_snap = GDK_WIN32_AEROSNAP_STATE_HALFRIGHT;
|
|
|
|
start_indicator (window, context, x, y, context->current_snap);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
context->current_snap = GDK_WIN32_AEROSNAP_STATE_UNDETERMINED;
|
|
|
|
stop_indicator (window, context);
|
|
|
|
context->revealed = FALSE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GDK_WIN32_AEROSNAP_STATE_HALFRIGHT:
|
|
|
|
if (context->op == GDK_WIN32_DRAGOP_MOVE && halfright > 0)
|
|
|
|
break;
|
|
|
|
if (context->op == GDK_WIN32_DRAGOP_MOVE && maximize > 0)
|
|
|
|
{
|
|
|
|
context->current_snap = GDK_WIN32_AEROSNAP_STATE_MAXIMIZE;
|
|
|
|
start_indicator (window, context, x, y, context->current_snap);
|
|
|
|
}
|
|
|
|
else if (context->op == GDK_WIN32_DRAGOP_MOVE && halfleft > 0)
|
|
|
|
{
|
|
|
|
context->current_snap = GDK_WIN32_AEROSNAP_STATE_HALFLEFT;
|
|
|
|
start_indicator (window, context, x, y, context->current_snap);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
context->current_snap = GDK_WIN32_AEROSNAP_STATE_UNDETERMINED;
|
|
|
|
stop_indicator (window, context);
|
|
|
|
context->revealed = FALSE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GDK_WIN32_AEROSNAP_STATE_FULLUP:
|
2016-03-12 16:26:19 +00:00
|
|
|
if (context->op == GDK_WIN32_DRAGOP_RESIZE && fullup > 0 && fullup_edge)
|
2016-03-08 05:03:29 +00:00
|
|
|
{
|
|
|
|
update_fullup_indicator (window, context);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
context->current_snap = GDK_WIN32_AEROSNAP_STATE_UNDETERMINED;
|
|
|
|
stop_indicator (window, context);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-02-27 00:10:12 +00:00
|
|
|
static const gchar *
|
|
|
|
get_cursor_name_from_op (GdkW32WindowDragOp op,
|
|
|
|
GdkWindowEdge edge)
|
|
|
|
{
|
|
|
|
switch (op)
|
|
|
|
{
|
|
|
|
case GDK_WIN32_DRAGOP_MOVE:
|
|
|
|
return "move";
|
|
|
|
case GDK_WIN32_DRAGOP_RESIZE:
|
|
|
|
switch (edge)
|
|
|
|
{
|
|
|
|
case GDK_WINDOW_EDGE_NORTH_WEST:
|
|
|
|
return "nw-resize";
|
|
|
|
case GDK_WINDOW_EDGE_NORTH:
|
|
|
|
return "n-resize";
|
|
|
|
case GDK_WINDOW_EDGE_NORTH_EAST:
|
|
|
|
return "ne-resize";
|
|
|
|
case GDK_WINDOW_EDGE_WEST:
|
|
|
|
return "w-resize";
|
|
|
|
case GDK_WINDOW_EDGE_EAST:
|
|
|
|
return "e-resize";
|
|
|
|
case GDK_WINDOW_EDGE_SOUTH_WEST:
|
|
|
|
return "sw-resize";
|
|
|
|
case GDK_WINDOW_EDGE_SOUTH:
|
|
|
|
return "s-resize";
|
|
|
|
case GDK_WINDOW_EDGE_SOUTH_EAST:
|
2016-03-12 12:14:04 +00:00
|
|
|
return "se-resize";
|
2016-02-27 00:10:12 +00:00
|
|
|
}
|
|
|
|
/* default: warn about unhandled enum values,
|
|
|
|
* fallthrough to GDK_WIN32_DRAGOP_NONE case
|
|
|
|
*/
|
|
|
|
case GDK_WIN32_DRAGOP_COUNT:
|
|
|
|
g_assert_not_reached ();
|
|
|
|
case GDK_WIN32_DRAGOP_NONE:
|
|
|
|
return "default";
|
|
|
|
/* default: warn about unhandled enum values */
|
|
|
|
}
|
|
|
|
|
|
|
|
g_assert_not_reached ();
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2016-03-12 12:55:24 +00:00
|
|
|
static gboolean
|
|
|
|
point_in_window (GdkWindow *window,
|
2017-08-08 14:19:45 +00:00
|
|
|
gdouble x,
|
2016-03-12 12:55:24 +00:00
|
|
|
gdouble y)
|
|
|
|
{
|
|
|
|
return x >= 0 && x < window->width &&
|
|
|
|
y >= 0 && y < window->height &&
|
|
|
|
(window->shape == NULL ||
|
|
|
|
cairo_region_contains_point (window->shape, x, y)) &&
|
|
|
|
(window->input_shape == NULL ||
|
|
|
|
cairo_region_contains_point (window->input_shape, x, y));
|
|
|
|
}
|
|
|
|
|
|
|
|
static GdkWindow *
|
|
|
|
child_window_at_coordinates (GdkWindow *window,
|
|
|
|
gint root_x,
|
|
|
|
gint root_y)
|
|
|
|
{
|
|
|
|
gint x, y;
|
|
|
|
GList *l;
|
|
|
|
GList *children;
|
|
|
|
|
|
|
|
children = gdk_window_peek_children (window);
|
|
|
|
gdk_window_get_root_origin (window, &x, &y);
|
|
|
|
x = root_x - x;
|
|
|
|
y = root_y - y;
|
|
|
|
|
|
|
|
for (l = children; l; l = g_list_next (l))
|
|
|
|
{
|
|
|
|
GdkWindow *child = GDK_WINDOW (l->data);
|
|
|
|
|
|
|
|
if (point_in_window (child, x, y))
|
|
|
|
return child;
|
|
|
|
}
|
|
|
|
|
|
|
|
return window;
|
|
|
|
}
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
static void
|
2016-02-06 12:06:41 +00:00
|
|
|
setup_drag_move_resize_context (GdkWindow *window,
|
|
|
|
GdkW32DragMoveResizeContext *context,
|
|
|
|
GdkW32WindowDragOp op,
|
|
|
|
GdkWindowEdge edge,
|
|
|
|
GdkDevice *device,
|
|
|
|
gint button,
|
|
|
|
gint root_x,
|
|
|
|
gint root_y,
|
|
|
|
guint32 timestamp)
|
2004-08-06 19:20:42 +00:00
|
|
|
{
|
2016-02-06 12:06:41 +00:00
|
|
|
RECT rect;
|
2016-02-27 00:10:12 +00:00
|
|
|
const gchar *cursor_name;
|
|
|
|
GdkWindow *pointer_window;
|
2016-03-08 05:03:29 +00:00
|
|
|
GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
2016-02-27 00:10:12 +00:00
|
|
|
GdkDisplay *display = gdk_device_get_display (device);
|
2016-03-08 05:03:29 +00:00
|
|
|
gboolean maximized = gdk_window_get_state (window) & GDK_WINDOW_STATE_MAXIMIZED;
|
|
|
|
|
|
|
|
/* Before we drag, we need to undo any maximization or snapping.
|
2016-03-15 10:17:45 +00:00
|
|
|
* AeroSnap behaviour:
|
|
|
|
* If snapped halfleft/halfright:
|
|
|
|
* horizontal resize:
|
|
|
|
* resize
|
|
|
|
* don't unsnap
|
|
|
|
* keep stashed unsnapped size intact
|
|
|
|
* vertical resize:
|
|
|
|
* resize
|
|
|
|
* unsnap to new size (merge cached unsnapped state with current
|
|
|
|
* snapped state in such a way that the gripped edge
|
|
|
|
* does not move)
|
|
|
|
* diagonal resize:
|
|
|
|
* difficult to test (first move is usually either purely
|
|
|
|
* horizontal or purely vertical, in which
|
|
|
|
* case the above behaviour applies)
|
|
|
|
* If snapped up:
|
|
|
|
* horizontal resize:
|
|
|
|
* resize
|
|
|
|
* don't unsnap
|
|
|
|
* apply new width and x position to unsnapped cache,
|
|
|
|
* so that unsnapped window only regains its height
|
|
|
|
* and y position, but inherits x and width from
|
|
|
|
* the fullup snapped state
|
|
|
|
* vertical resize:
|
|
|
|
* unsnap to new size (merge cached unsnapped state with current
|
|
|
|
* snapped state in such a way that the gripped edge
|
|
|
|
* does not move)
|
|
|
|
*
|
|
|
|
* This implementation behaviour:
|
|
|
|
* If snapped halfleft/halfright/fullup:
|
|
|
|
* any resize:
|
|
|
|
* unsnap to current size, discard cached pre-snap state
|
|
|
|
*
|
|
|
|
* TODO: make this implementation behave as AeroSnap on resizes?
|
|
|
|
* There's also the case where
|
2016-03-08 05:03:29 +00:00
|
|
|
* a halfleft/halfright window isn't unsnapped when it's
|
|
|
|
* being moved horizontally, but it's more difficult to implement.
|
|
|
|
*/
|
2016-03-15 10:17:45 +00:00
|
|
|
if (op == GDK_WIN32_DRAGOP_RESIZE &&
|
2016-03-08 05:03:29 +00:00
|
|
|
(impl->snap_state == GDK_WIN32_AEROSNAP_STATE_HALFRIGHT ||
|
|
|
|
impl->snap_state == GDK_WIN32_AEROSNAP_STATE_HALFLEFT ||
|
|
|
|
impl->snap_state == GDK_WIN32_AEROSNAP_STATE_FULLUP))
|
2016-03-15 10:17:45 +00:00
|
|
|
{
|
|
|
|
discard_snapinfo (window);
|
|
|
|
}
|
|
|
|
else if (maximized ||
|
|
|
|
(impl->snap_state == GDK_WIN32_AEROSNAP_STATE_HALFRIGHT ||
|
|
|
|
impl->snap_state == GDK_WIN32_AEROSNAP_STATE_HALFLEFT ||
|
|
|
|
impl->snap_state == GDK_WIN32_AEROSNAP_STATE_FULLUP))
|
2016-03-08 05:03:29 +00:00
|
|
|
{
|
|
|
|
GdkScreen *screen;
|
|
|
|
gint monitor;
|
|
|
|
gint wx, wy, wwidth, wheight;
|
2016-03-15 10:17:45 +00:00
|
|
|
gint swx, swy, swwidth, swheight;
|
2016-03-08 05:03:29 +00:00
|
|
|
gboolean pointer_outside_of_window;
|
|
|
|
gint offsetx, offsety;
|
|
|
|
gboolean left_half;
|
|
|
|
|
|
|
|
screen = gdk_display_get_default_screen (gdk_window_get_display (window));
|
|
|
|
monitor = gdk_screen_get_monitor_at_window (screen, window);
|
|
|
|
gdk_window_get_geometry (window, &wx, &wy, &wwidth, &wheight);
|
|
|
|
|
2016-03-15 10:17:45 +00:00
|
|
|
swx = wx;
|
|
|
|
swy = wy;
|
|
|
|
swwidth = wwidth;
|
|
|
|
swheight = wheight;
|
|
|
|
|
|
|
|
/* Subtract window shadow. We don't want pointer to go outside of
|
|
|
|
* the visible window during drag-move. For drag-resize it's OK.
|
|
|
|
* Don't take shadow into account if the window is maximized -
|
|
|
|
* maximized windows don't have shadows.
|
|
|
|
*/
|
|
|
|
if (op == GDK_WIN32_DRAGOP_MOVE && !maximized)
|
|
|
|
{
|
2016-06-27 05:16:43 +00:00
|
|
|
swx += impl->margins.left / impl->window_scale;
|
|
|
|
swy += impl->margins.top / impl->window_scale;
|
2016-03-15 10:17:45 +00:00
|
|
|
swwidth -= impl->margins_x;
|
|
|
|
swheight -= impl->margins_y;
|
|
|
|
}
|
|
|
|
|
|
|
|
pointer_outside_of_window = root_x < swx || root_x > swx + swwidth ||
|
|
|
|
root_y < swy || root_y > swy + swheight;
|
2016-03-08 05:03:29 +00:00
|
|
|
/* Calculate the offset of the pointer relative to the window */
|
2016-03-15 10:17:45 +00:00
|
|
|
offsetx = root_x - swx;
|
|
|
|
offsety = root_y - swy;
|
2016-03-08 05:03:29 +00:00
|
|
|
|
|
|
|
/* Figure out in which half of the window the pointer is.
|
|
|
|
* The code currently only concerns itself with horizontal
|
|
|
|
* dimension (left/right halves).
|
|
|
|
* There's no upper/lower half, because usually window
|
|
|
|
* is dragged by its upper half anyway. If that changes, adjust
|
|
|
|
* accordingly.
|
|
|
|
*/
|
2016-03-15 10:17:45 +00:00
|
|
|
left_half = (offsetx < swwidth / 2);
|
2016-03-08 05:03:29 +00:00
|
|
|
|
|
|
|
/* Inverse the offset for it to be from the right edge */
|
|
|
|
if (!left_half)
|
2016-03-15 10:17:45 +00:00
|
|
|
offsetx = swwidth - offsetx;
|
2016-03-08 05:03:29 +00:00
|
|
|
|
|
|
|
GDK_NOTE (MISC, g_print ("Pointer at %d : %d, this is %d : %d relative to the window's %s\n",
|
|
|
|
root_x, root_y, offsetx, offsety,
|
|
|
|
left_half ? "left half" : "right half"));
|
|
|
|
|
|
|
|
/* Move window in such a way that on unmaximization/unsnapping the pointer
|
|
|
|
* is still pointing at the appropriate half of the window,
|
|
|
|
* with the same offset from the left or right edge. If the new
|
|
|
|
* window size is too small, and adding that offset puts the pointer
|
|
|
|
* into the other half or even beyond, move the pointer to the middle.
|
|
|
|
*/
|
|
|
|
if (!pointer_outside_of_window && maximized)
|
|
|
|
{
|
|
|
|
WINDOWPLACEMENT placement;
|
|
|
|
gint unmax_width, unmax_height;
|
2016-03-15 10:17:45 +00:00
|
|
|
gint shadow_unmax_width, shadow_unmax_height;
|
2016-03-08 05:03:29 +00:00
|
|
|
|
|
|
|
placement.length = sizeof (placement);
|
|
|
|
API_CALL (GetWindowPlacement, (GDK_WINDOW_HWND (window), &placement));
|
|
|
|
|
|
|
|
GDK_NOTE (MISC, g_print ("W32 WM unmaximized window placement is %ld x %ld @ %ld : %ld\n",
|
|
|
|
placement.rcNormalPosition.right - placement.rcNormalPosition.left,
|
|
|
|
placement.rcNormalPosition.bottom - placement.rcNormalPosition.top,
|
2016-06-27 05:16:43 +00:00
|
|
|
placement.rcNormalPosition.left + _gdk_offset_x * impl->window_scale,
|
|
|
|
placement.rcNormalPosition.top + _gdk_offset_y * impl->window_scale));
|
2016-03-08 05:03:29 +00:00
|
|
|
|
|
|
|
unmax_width = placement.rcNormalPosition.right - placement.rcNormalPosition.left;
|
|
|
|
unmax_height = placement.rcNormalPosition.bottom - placement.rcNormalPosition.top;
|
|
|
|
|
2016-06-27 05:16:43 +00:00
|
|
|
shadow_unmax_width = unmax_width - impl->margins_x * impl->window_scale;
|
|
|
|
shadow_unmax_height = unmax_height - impl->margins_y * impl->window_scale;
|
2016-03-15 10:17:45 +00:00
|
|
|
|
2016-06-27 05:16:43 +00:00
|
|
|
if (offsetx * impl->window_scale < (shadow_unmax_width / 2) &&
|
|
|
|
offsety * impl->window_scale < (shadow_unmax_height / 2))
|
2016-03-08 05:03:29 +00:00
|
|
|
{
|
2016-06-27 05:16:43 +00:00
|
|
|
placement.rcNormalPosition.top = (root_y - offsety + impl->margins.top - _gdk_offset_y) * impl->window_scale;
|
2016-03-08 05:03:29 +00:00
|
|
|
placement.rcNormalPosition.bottom = placement.rcNormalPosition.top + unmax_height;
|
|
|
|
|
|
|
|
if (left_half)
|
|
|
|
{
|
2016-06-27 05:16:43 +00:00
|
|
|
placement.rcNormalPosition.left = (root_x - offsetx + impl->margins.left - _gdk_offset_x) * impl->window_scale;
|
2016-03-08 05:03:29 +00:00
|
|
|
placement.rcNormalPosition.right = placement.rcNormalPosition.left + unmax_width;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-06-27 05:16:43 +00:00
|
|
|
placement.rcNormalPosition.right = (root_x + offsetx + impl->margins.right - _gdk_offset_x) * impl->window_scale;
|
2016-03-08 05:03:29 +00:00
|
|
|
placement.rcNormalPosition.left = placement.rcNormalPosition.right - unmax_width;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-06-27 05:16:43 +00:00
|
|
|
placement.rcNormalPosition.left = (root_x * impl->window_scale) -
|
|
|
|
(unmax_width / 2) -
|
|
|
|
(_gdk_offset_x * impl->window_scale);
|
2016-03-15 10:17:45 +00:00
|
|
|
|
2016-06-27 05:16:43 +00:00
|
|
|
if (offsety * impl->window_scale < shadow_unmax_height / 2)
|
|
|
|
placement.rcNormalPosition.top = (root_y - offsety + impl->margins.top - _gdk_offset_y) * impl->window_scale;
|
2016-03-15 10:17:45 +00:00
|
|
|
else
|
2016-06-27 05:16:43 +00:00
|
|
|
placement.rcNormalPosition.top = (root_y * impl->window_scale) -
|
|
|
|
(unmax_height / 2) -
|
|
|
|
(_gdk_offset_y * impl->window_scale);
|
2016-03-15 10:17:45 +00:00
|
|
|
|
2016-03-08 05:03:29 +00:00
|
|
|
placement.rcNormalPosition.right = placement.rcNormalPosition.left + unmax_width;
|
|
|
|
placement.rcNormalPosition.bottom = placement.rcNormalPosition.top + unmax_height;
|
|
|
|
}
|
|
|
|
|
|
|
|
GDK_NOTE (MISC, g_print ("Unmaximized window will be at %ld : %ld\n",
|
2016-06-27 05:16:43 +00:00
|
|
|
placement.rcNormalPosition.left + _gdk_offset_x * impl->window_scale,
|
|
|
|
placement.rcNormalPosition.top + _gdk_offset_y * impl->window_scale));
|
2016-03-08 05:03:29 +00:00
|
|
|
|
|
|
|
API_CALL (SetWindowPlacement, (GDK_WINDOW_HWND (window), &placement));
|
|
|
|
}
|
|
|
|
else if (!pointer_outside_of_window && impl->snap_stash_int)
|
|
|
|
{
|
|
|
|
GdkRectangle new_pos;
|
2016-03-15 10:17:45 +00:00
|
|
|
GdkRectangle snew_pos;
|
2016-03-08 05:03:29 +00:00
|
|
|
|
|
|
|
new_pos.width = impl->snap_stash_int->width;
|
|
|
|
new_pos.height = impl->snap_stash_int->height;
|
2016-03-15 10:17:45 +00:00
|
|
|
snew_pos = new_pos;
|
2016-03-08 05:03:29 +00:00
|
|
|
|
2016-03-15 10:17:45 +00:00
|
|
|
if (op == GDK_WIN32_DRAGOP_MOVE)
|
2016-03-08 05:03:29 +00:00
|
|
|
{
|
2016-03-15 10:17:45 +00:00
|
|
|
snew_pos.width -= impl->margins_x;
|
|
|
|
snew_pos.height -= impl->margins_y;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (offsetx < snew_pos.width / 2 && offsety < snew_pos.height / 2)
|
|
|
|
{
|
2016-06-27 05:16:43 +00:00
|
|
|
new_pos.y = root_y - offsety + impl->margins.top / impl->window_scale;
|
2016-03-08 05:03:29 +00:00
|
|
|
|
|
|
|
if (left_half)
|
2016-06-27 05:16:43 +00:00
|
|
|
new_pos.x = root_x - offsetx + impl->margins.left / impl->window_scale;
|
2016-03-08 05:03:29 +00:00
|
|
|
else
|
2016-06-27 05:16:43 +00:00
|
|
|
new_pos.x = root_x + offsetx + impl->margins.left / impl->window_scale - new_pos.width;
|
2016-03-08 05:03:29 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
new_pos.x = root_x - new_pos.width / 2;
|
|
|
|
new_pos.y = root_y - new_pos.height / 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
GDK_NOTE (MISC, g_print ("Unsnapped window to %d : %d\n",
|
|
|
|
new_pos.x, new_pos.y));
|
|
|
|
discard_snapinfo (window);
|
|
|
|
gdk_window_move_resize (window, new_pos.x, new_pos.y,
|
|
|
|
new_pos.width, new_pos.height);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (maximized)
|
|
|
|
gdk_window_unmaximize (window);
|
|
|
|
else
|
|
|
|
unsnap (window, screen, monitor);
|
|
|
|
|
|
|
|
if (pointer_outside_of_window)
|
|
|
|
{
|
|
|
|
/* Pointer outside of the window, move pointer into window */
|
|
|
|
GDK_NOTE (MISC, g_print ("Pointer at %d : %d is outside of %d x %d @ %d : %d, move it to %d : %d\n",
|
|
|
|
root_x, root_y, wwidth, wheight, wx, wy, wx + wwidth / 2, wy + wheight / 2));
|
|
|
|
root_x = wx + wwidth / 2;
|
|
|
|
/* This is Gnome behaviour. Windows WM would put the pointer
|
|
|
|
* in the middle of the titlebar, but GDK doesn't know where
|
|
|
|
* the titlebar is, if any.
|
|
|
|
*/
|
|
|
|
root_y = wy + wheight / 2;
|
|
|
|
gdk_device_warp (device, screen,
|
|
|
|
root_x, root_y);
|
|
|
|
}
|
|
|
|
}
|
2015-04-29 07:31:08 +00:00
|
|
|
|
2016-02-06 12:06:41 +00:00
|
|
|
_gdk_win32_get_window_rect (window, &rect);
|
2015-04-29 07:31:08 +00:00
|
|
|
|
2016-02-27 00:10:12 +00:00
|
|
|
cursor_name = get_cursor_name_from_op (op, edge);
|
|
|
|
|
|
|
|
context->cursor = _gdk_win32_display_get_cursor_for_name (display, cursor_name);
|
|
|
|
|
2016-03-12 12:55:24 +00:00
|
|
|
pointer_window = child_window_at_coordinates (window, root_x, root_y);
|
2016-02-27 00:10:12 +00:00
|
|
|
|
|
|
|
/* Note: This triggers a WM_CAPTURECHANGED, which will trigger
|
|
|
|
* gdk_win32_window_end_move_resize_drag(), which will end
|
|
|
|
* our op before it even begins, but only if context->op is not NONE.
|
|
|
|
* This is why we first do the grab, *then* set the op.
|
|
|
|
*/
|
|
|
|
gdk_device_grab (device, pointer_window,
|
|
|
|
GDK_OWNERSHIP_NONE, FALSE,
|
|
|
|
GDK_ALL_EVENTS_MASK,
|
|
|
|
context->cursor,
|
|
|
|
timestamp);
|
|
|
|
|
2016-03-12 16:26:19 +00:00
|
|
|
context->window = g_object_ref (window);
|
2016-02-06 12:06:41 +00:00
|
|
|
context->op = op;
|
|
|
|
context->edge = edge;
|
|
|
|
context->device = device;
|
|
|
|
context->button = button;
|
|
|
|
context->start_root_x = root_x;
|
|
|
|
context->start_root_y = root_y;
|
|
|
|
context->timestamp = timestamp;
|
|
|
|
context->start_rect = rect;
|
2004-08-06 19:20:42 +00:00
|
|
|
|
2016-03-08 05:03:29 +00:00
|
|
|
context->shape_indicator = NULL;
|
|
|
|
context->revealed = FALSE;
|
|
|
|
context->halfleft_regions = g_array_new (FALSE, FALSE, sizeof (AeroSnapEdgeRegion));
|
|
|
|
context->halfright_regions = g_array_new (FALSE, FALSE, sizeof (AeroSnapEdgeRegion));
|
|
|
|
context->maximize_regions = g_array_new (FALSE, FALSE, sizeof (AeroSnapEdgeRegion));
|
|
|
|
context->fullup_regions = g_array_new (FALSE, FALSE, sizeof (AeroSnapEdgeRegion));
|
|
|
|
|
|
|
|
calculate_aerosnap_regions (context);
|
|
|
|
|
2016-02-06 12:06:41 +00:00
|
|
|
GDK_NOTE (EVENTS,
|
2016-02-27 00:10:12 +00:00
|
|
|
g_print ("begin drag moveresize: window %p, toplevel %p, "
|
2016-02-06 12:06:41 +00:00
|
|
|
"op %u, edge %d, device %p, "
|
|
|
|
"button %d, coord %d:%d, time %u\n",
|
2016-03-12 12:55:24 +00:00
|
|
|
pointer_window, gdk_window_get_toplevel (window),
|
2016-02-06 12:06:41 +00:00
|
|
|
context->op, context->edge, context->device,
|
|
|
|
context->button, context->start_root_x,
|
|
|
|
context->start_root_y, context->timestamp));
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_win32_window_end_move_resize_drag (GdkWindow *window)
|
|
|
|
{
|
|
|
|
GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
|
|
|
GdkW32DragMoveResizeContext *context = &impl->drag_move_resize_context;
|
|
|
|
|
2018-06-20 09:27:30 +00:00
|
|
|
if (context->op == GDK_WIN32_DRAGOP_RESIZE)
|
|
|
|
_gdk_win32_window_invalidate_egl_framebuffer (window);
|
|
|
|
|
2016-02-06 12:06:41 +00:00
|
|
|
context->op = GDK_WIN32_DRAGOP_NONE;
|
2016-02-27 00:10:12 +00:00
|
|
|
|
|
|
|
gdk_device_ungrab (context->device, GDK_CURRENT_TIME);
|
|
|
|
|
|
|
|
g_clear_object (&context->cursor);
|
|
|
|
|
2016-03-08 05:03:29 +00:00
|
|
|
context->revealed = FALSE;
|
2016-03-12 16:26:19 +00:00
|
|
|
|
|
|
|
if (context->timer)
|
|
|
|
{
|
|
|
|
g_source_remove (context->timer);
|
|
|
|
context->timer = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_clear_object (&context->window);
|
|
|
|
|
|
|
|
if (context->indicator_surface)
|
|
|
|
{
|
|
|
|
cairo_surface_destroy (context->indicator_surface);
|
|
|
|
context->indicator_surface = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (context->shape_indicator)
|
|
|
|
{
|
|
|
|
stop_indicator (window, context);
|
|
|
|
DestroyWindow (context->shape_indicator);
|
|
|
|
context->shape_indicator = NULL;
|
|
|
|
}
|
|
|
|
|
2016-03-08 05:03:29 +00:00
|
|
|
g_clear_pointer (&context->halfleft_regions, g_array_unref);
|
|
|
|
g_clear_pointer (&context->halfright_regions, g_array_unref);
|
|
|
|
g_clear_pointer (&context->maximize_regions, g_array_unref);
|
|
|
|
g_clear_pointer (&context->fullup_regions, g_array_unref);
|
|
|
|
|
2016-02-06 12:06:41 +00:00
|
|
|
GDK_NOTE (EVENTS,
|
2016-02-27 00:10:12 +00:00
|
|
|
g_print ("end drag moveresize: window %p, toplevel %p,"
|
2016-02-06 12:06:41 +00:00
|
|
|
"op %u, edge %d, device %p, "
|
|
|
|
"button %d, coord %d:%d, time %u\n",
|
2016-02-27 00:10:12 +00:00
|
|
|
window, gdk_window_get_toplevel (window),
|
2016-02-06 12:06:41 +00:00
|
|
|
context->op, context->edge, context->device,
|
|
|
|
context->button, context->start_root_x,
|
|
|
|
context->start_root_y, context->timestamp));
|
2016-06-05 07:37:02 +00:00
|
|
|
|
|
|
|
if (context->current_snap != GDK_WIN32_AEROSNAP_STATE_UNDETERMINED)
|
|
|
|
apply_snap (window, context->current_snap);
|
|
|
|
|
|
|
|
context->current_snap = GDK_WIN32_AEROSNAP_STATE_UNDETERMINED;
|
2016-02-06 12:06:41 +00:00
|
|
|
}
|
|
|
|
|
2017-09-02 15:25:36 +00:00
|
|
|
static void
|
|
|
|
gdk_win32_get_window_size_and_position_from_client_rect (GdkWindow *window,
|
|
|
|
RECT *window_rect,
|
|
|
|
SIZE *window_size,
|
|
|
|
POINT *window_position)
|
|
|
|
{
|
|
|
|
GdkWindowImplWin32 *impl;
|
|
|
|
|
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
|
|
|
|
|
|
|
/* Turn client area into window area */
|
|
|
|
_gdk_win32_adjust_client_rect (window, window_rect);
|
|
|
|
|
|
|
|
/* Convert GDK screen coordinates to W32 desktop coordinates */
|
|
|
|
window_rect->left -= _gdk_offset_x * impl->window_scale;
|
|
|
|
window_rect->right -= _gdk_offset_x * impl->window_scale;
|
|
|
|
window_rect->top -= _gdk_offset_y * impl->window_scale;
|
|
|
|
window_rect->bottom -= _gdk_offset_y * impl->window_scale;
|
|
|
|
|
|
|
|
window_position->x = window_rect->left;
|
|
|
|
window_position->y = window_rect->top;
|
|
|
|
window_size->cx = window_rect->right - window_rect->left;
|
|
|
|
window_size->cy = window_rect->bottom - window_rect->top;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gdk_win32_update_layered_window_from_cache (GdkWindow *window,
|
|
|
|
RECT *client_rect)
|
|
|
|
{
|
|
|
|
POINT window_position;
|
|
|
|
SIZE window_size;
|
|
|
|
BLENDFUNCTION blender;
|
|
|
|
HDC hdc;
|
|
|
|
SIZE *window_size_ptr;
|
|
|
|
POINT source_point = { 0, 0 };
|
|
|
|
POINT *source_point_ptr;
|
|
|
|
GdkWindowImplWin32 *impl;
|
|
|
|
|
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
|
|
|
|
|
|
|
gdk_win32_get_window_size_and_position_from_client_rect (window,
|
|
|
|
client_rect,
|
|
|
|
&window_size,
|
|
|
|
&window_position);
|
|
|
|
|
|
|
|
blender.BlendOp = AC_SRC_OVER;
|
|
|
|
blender.BlendFlags = 0;
|
|
|
|
blender.AlphaFormat = AC_SRC_ALPHA;
|
|
|
|
blender.SourceConstantAlpha = impl->layered_opacity * 255;
|
|
|
|
|
|
|
|
/* Size didn't change, so move immediately, no need to wait for redraw */
|
|
|
|
/* Strictly speaking, we don't need to supply hdc, source_point and
|
|
|
|
* window_size here. However, without these arguments
|
|
|
|
* the window moves but does not update its contents on Windows 7 when
|
|
|
|
* desktop composition is off. This forces us to provide hdc and
|
|
|
|
* source_point. window_size is here to avoid the function
|
|
|
|
* inexplicably failing with error 317.
|
|
|
|
*/
|
|
|
|
if (gdk_screen_is_composited (gdk_window_get_screen (window)))
|
|
|
|
{
|
|
|
|
hdc = NULL;
|
|
|
|
window_size_ptr = NULL;
|
|
|
|
source_point_ptr = NULL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
hdc = cairo_win32_surface_get_dc (impl->cache_surface);
|
|
|
|
window_size_ptr = &window_size;
|
|
|
|
source_point_ptr = &source_point;
|
|
|
|
}
|
|
|
|
|
|
|
|
API_CALL (UpdateLayeredWindow, (GDK_WINDOW_HWND (window), NULL,
|
|
|
|
&window_position, window_size_ptr,
|
|
|
|
hdc, source_point_ptr,
|
|
|
|
0, &blender, ULW_ALPHA));
|
|
|
|
}
|
|
|
|
|
2016-02-06 12:06:41 +00:00
|
|
|
void
|
|
|
|
gdk_win32_window_do_move_resize_drag (GdkWindow *window,
|
|
|
|
gint x,
|
|
|
|
gint y)
|
|
|
|
{
|
|
|
|
RECT rect;
|
|
|
|
RECT new_rect;
|
|
|
|
gint diffy, diffx;
|
|
|
|
MINMAXINFO mmi;
|
|
|
|
GdkWindowImplWin32 *impl;
|
|
|
|
GdkW32DragMoveResizeContext *context;
|
|
|
|
gint width;
|
|
|
|
gint height;
|
|
|
|
|
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
|
|
|
context = &impl->drag_move_resize_context;
|
|
|
|
|
|
|
|
if (!_gdk_win32_get_window_rect (window, &rect))
|
2004-10-30 18:04:49 +00:00
|
|
|
return;
|
2015-04-29 07:31:08 +00:00
|
|
|
|
2016-02-06 12:06:41 +00:00
|
|
|
new_rect = context->start_rect;
|
2016-06-27 05:16:43 +00:00
|
|
|
diffx = (x - context->start_root_x) * impl->window_scale;
|
|
|
|
diffy = (y - context->start_root_y) * impl->window_scale;
|
2004-10-30 18:04:49 +00:00
|
|
|
|
2016-02-06 12:06:41 +00:00
|
|
|
switch (context->op)
|
2004-10-30 18:04:49 +00:00
|
|
|
{
|
2016-02-06 12:06:41 +00:00
|
|
|
case GDK_WIN32_DRAGOP_RESIZE:
|
2016-06-27 05:16:43 +00:00
|
|
|
|
2016-02-06 12:06:41 +00:00
|
|
|
switch (context->edge)
|
|
|
|
{
|
|
|
|
case GDK_WINDOW_EDGE_NORTH_WEST:
|
|
|
|
new_rect.left += diffx;
|
|
|
|
new_rect.top += diffy;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_WINDOW_EDGE_NORTH:
|
|
|
|
new_rect.top += diffy;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_WINDOW_EDGE_NORTH_EAST:
|
|
|
|
new_rect.right += diffx;
|
|
|
|
new_rect.top += diffy;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_WINDOW_EDGE_WEST:
|
|
|
|
new_rect.left += diffx;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_WINDOW_EDGE_EAST:
|
|
|
|
new_rect.right += diffx;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_WINDOW_EDGE_SOUTH_WEST:
|
|
|
|
new_rect.left += diffx;
|
|
|
|
new_rect.bottom += diffy;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_WINDOW_EDGE_SOUTH:
|
|
|
|
new_rect.bottom += diffy;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_WINDOW_EDGE_SOUTH_EAST:
|
|
|
|
default:
|
|
|
|
new_rect.right += diffx;
|
|
|
|
new_rect.bottom += diffy;
|
|
|
|
break;
|
|
|
|
}
|
2004-10-30 18:04:49 +00:00
|
|
|
|
2016-02-06 12:06:41 +00:00
|
|
|
/* When handling WM_GETMINMAXINFO, mmi is already populated
|
|
|
|
* by W32 WM and we apply our stuff on top of that.
|
|
|
|
* Here it isn't, so we should at least clear it.
|
|
|
|
*/
|
|
|
|
memset (&mmi, 0, sizeof (mmi));
|
2004-10-30 18:04:49 +00:00
|
|
|
|
2016-02-06 12:06:41 +00:00
|
|
|
if (!_gdk_win32_window_fill_min_max_info (window, &mmi))
|
|
|
|
break;
|
2004-10-30 18:04:49 +00:00
|
|
|
|
2016-02-06 12:06:41 +00:00
|
|
|
width = new_rect.right - new_rect.left;
|
|
|
|
height = new_rect.bottom - new_rect.top;
|
2004-10-30 18:04:49 +00:00
|
|
|
|
2016-02-06 12:06:41 +00:00
|
|
|
if (width > mmi.ptMaxTrackSize.x)
|
|
|
|
{
|
|
|
|
switch (context->edge)
|
|
|
|
{
|
|
|
|
case GDK_WINDOW_EDGE_NORTH_WEST:
|
|
|
|
case GDK_WINDOW_EDGE_WEST:
|
|
|
|
case GDK_WINDOW_EDGE_SOUTH_WEST:
|
|
|
|
new_rect.left = new_rect.right - mmi.ptMaxTrackSize.x;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_WINDOW_EDGE_NORTH_EAST:
|
|
|
|
case GDK_WINDOW_EDGE_EAST:
|
|
|
|
case GDK_WINDOW_EDGE_SOUTH_EAST:
|
|
|
|
default:
|
|
|
|
new_rect.right = new_rect.left + mmi.ptMaxTrackSize.x;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (width < mmi.ptMinTrackSize.x)
|
|
|
|
{
|
|
|
|
switch (context->edge)
|
|
|
|
{
|
|
|
|
case GDK_WINDOW_EDGE_NORTH_WEST:
|
|
|
|
case GDK_WINDOW_EDGE_WEST:
|
|
|
|
case GDK_WINDOW_EDGE_SOUTH_WEST:
|
|
|
|
new_rect.left = new_rect.right - mmi.ptMinTrackSize.x;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_WINDOW_EDGE_NORTH_EAST:
|
|
|
|
case GDK_WINDOW_EDGE_EAST:
|
|
|
|
case GDK_WINDOW_EDGE_SOUTH_EAST:
|
|
|
|
default:
|
|
|
|
new_rect.right = new_rect.left + mmi.ptMinTrackSize.x;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2004-10-30 18:04:49 +00:00
|
|
|
|
2016-02-06 12:06:41 +00:00
|
|
|
if (height > mmi.ptMaxTrackSize.y)
|
|
|
|
{
|
|
|
|
switch (context->edge)
|
|
|
|
{
|
|
|
|
case GDK_WINDOW_EDGE_NORTH_WEST:
|
|
|
|
case GDK_WINDOW_EDGE_NORTH:
|
|
|
|
case GDK_WINDOW_EDGE_NORTH_EAST:
|
|
|
|
new_rect.top = new_rect.bottom - mmi.ptMaxTrackSize.y;
|
|
|
|
|
|
|
|
case GDK_WINDOW_EDGE_SOUTH_WEST:
|
|
|
|
case GDK_WINDOW_EDGE_SOUTH:
|
|
|
|
case GDK_WINDOW_EDGE_SOUTH_EAST:
|
|
|
|
default:
|
|
|
|
new_rect.bottom = new_rect.top + mmi.ptMaxTrackSize.y;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (height < mmi.ptMinTrackSize.y)
|
|
|
|
{
|
|
|
|
switch (context->edge)
|
|
|
|
{
|
|
|
|
case GDK_WINDOW_EDGE_NORTH_WEST:
|
|
|
|
case GDK_WINDOW_EDGE_NORTH:
|
|
|
|
case GDK_WINDOW_EDGE_NORTH_EAST:
|
|
|
|
new_rect.top = new_rect.bottom - mmi.ptMinTrackSize.y;
|
|
|
|
|
|
|
|
case GDK_WINDOW_EDGE_SOUTH_WEST:
|
|
|
|
case GDK_WINDOW_EDGE_SOUTH:
|
|
|
|
case GDK_WINDOW_EDGE_SOUTH_EAST:
|
|
|
|
default:
|
|
|
|
new_rect.bottom = new_rect.top + mmi.ptMinTrackSize.y;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2004-10-30 18:04:49 +00:00
|
|
|
|
|
|
|
break;
|
2016-02-06 12:06:41 +00:00
|
|
|
case GDK_WIN32_DRAGOP_MOVE:
|
|
|
|
new_rect.left += diffx;
|
|
|
|
new_rect.top += diffy;
|
|
|
|
new_rect.right += diffx;
|
|
|
|
new_rect.bottom += diffy;
|
|
|
|
break;
|
2004-10-30 18:04:49 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2016-02-06 12:06:41 +00:00
|
|
|
if (context->op == GDK_WIN32_DRAGOP_RESIZE &&
|
|
|
|
(rect.left != new_rect.left ||
|
|
|
|
rect.right != new_rect.right ||
|
|
|
|
rect.top != new_rect.top ||
|
|
|
|
rect.bottom != new_rect.bottom))
|
|
|
|
{
|
|
|
|
context->native_move_resize_pending = TRUE;
|
|
|
|
_gdk_win32_do_emit_configure_event (window, new_rect);
|
|
|
|
}
|
|
|
|
else if (context->op == GDK_WIN32_DRAGOP_MOVE &&
|
|
|
|
(rect.left != new_rect.left ||
|
|
|
|
rect.top != new_rect.top))
|
|
|
|
{
|
|
|
|
context->native_move_resize_pending = FALSE;
|
|
|
|
|
|
|
|
_gdk_win32_do_emit_configure_event (window, new_rect);
|
|
|
|
|
2016-02-23 09:20:55 +00:00
|
|
|
if (impl->layered)
|
2016-03-03 17:17:25 +00:00
|
|
|
{
|
2017-09-02 15:25:36 +00:00
|
|
|
gdk_win32_update_layered_window_from_cache (window, &new_rect);
|
2016-03-03 17:17:25 +00:00
|
|
|
}
|
2016-02-23 09:20:55 +00:00
|
|
|
else
|
2016-03-03 17:17:25 +00:00
|
|
|
{
|
2017-09-02 15:25:36 +00:00
|
|
|
SIZE window_size;
|
|
|
|
POINT window_position;
|
|
|
|
|
|
|
|
gdk_win32_get_window_size_and_position_from_client_rect (window,
|
|
|
|
&new_rect,
|
|
|
|
&window_size,
|
|
|
|
&window_position);
|
|
|
|
|
2016-03-03 17:17:25 +00:00
|
|
|
API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window),
|
|
|
|
SWP_NOZORDER_SPECIFIED,
|
|
|
|
window_position.x, window_position.y,
|
|
|
|
0, 0,
|
|
|
|
SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSIZE));
|
|
|
|
}
|
2016-02-06 12:06:41 +00:00
|
|
|
}
|
2016-03-08 05:03:29 +00:00
|
|
|
|
|
|
|
if (context->op == GDK_WIN32_DRAGOP_RESIZE ||
|
|
|
|
context->op == GDK_WIN32_DRAGOP_MOVE)
|
|
|
|
handle_aerosnap_move_resize (window, context, x, y);
|
2016-02-06 12:06:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gdk_win32_window_begin_resize_drag (GdkWindow *window,
|
|
|
|
GdkWindowEdge edge,
|
|
|
|
GdkDevice *device,
|
|
|
|
gint button,
|
|
|
|
gint root_x,
|
|
|
|
gint root_y,
|
|
|
|
guint32 timestamp)
|
|
|
|
{
|
|
|
|
GdkWindowImplWin32 *impl;
|
|
|
|
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
|
|
|
if (GDK_WINDOW_DESTROYED (window) ||
|
|
|
|
GDK_WINDOW_TYPE (window) == GDK_WINDOW_CHILD ||
|
|
|
|
IsIconic (GDK_WINDOW_HWND (window)))
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* 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
|
|
|
|
* dragging using the left mouse button.
|
|
|
|
*/
|
2016-06-27 05:16:43 +00:00
|
|
|
|
2016-02-06 12:06:41 +00:00
|
|
|
if (button != 1)
|
|
|
|
return;
|
|
|
|
|
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
|
|
|
|
|
|
|
if (impl->drag_move_resize_context.op != GDK_WIN32_DRAGOP_NONE)
|
|
|
|
gdk_win32_window_end_move_resize_drag (window);
|
|
|
|
|
|
|
|
setup_drag_move_resize_context (window, &impl->drag_move_resize_context,
|
|
|
|
GDK_WIN32_DRAGOP_RESIZE, edge, device,
|
|
|
|
button, root_x, root_y, timestamp);
|
2004-08-06 19:20:42 +00:00
|
|
|
}
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
static void
|
|
|
|
gdk_win32_window_begin_move_drag (GdkWindow *window,
|
2016-02-06 12:06:41 +00:00
|
|
|
GdkDevice *device,
|
|
|
|
gint button,
|
|
|
|
gint root_x,
|
|
|
|
gint root_y,
|
|
|
|
guint32 timestamp)
|
2004-08-06 19:20:42 +00:00
|
|
|
{
|
2016-02-06 12:06:41 +00:00
|
|
|
GdkWindowImplWin32 *impl;
|
|
|
|
|
2004-08-06 19:20:42 +00:00
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
2015-04-29 07:31:08 +00:00
|
|
|
|
2016-02-06 12:06:41 +00:00
|
|
|
if (GDK_WINDOW_DESTROYED (window) ||
|
|
|
|
GDK_WINDOW_TYPE (window) == GDK_WINDOW_CHILD ||
|
|
|
|
IsIconic (GDK_WINDOW_HWND (window)))
|
2004-08-06 19:20:42 +00:00
|
|
|
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;
|
2015-04-29 07:31:08 +00:00
|
|
|
|
2016-02-06 12:06:41 +00:00
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
|
|
|
|
|
|
|
if (impl->drag_move_resize_context.op != GDK_WIN32_DRAGOP_NONE)
|
|
|
|
gdk_win32_window_end_move_resize_drag (window);
|
2004-10-30 18:04:49 +00:00
|
|
|
|
2016-02-06 12:06:41 +00:00
|
|
|
setup_drag_move_resize_context (window, &impl->drag_move_resize_context,
|
|
|
|
GDK_WIN32_DRAGOP_MOVE, GDK_WINDOW_EDGE_NORTH_WEST,
|
|
|
|
device, button, root_x, root_y, timestamp);
|
2004-08-06 19:20:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-03-09 16:43:19 +00:00
|
|
|
/*
|
|
|
|
* Setting window states
|
|
|
|
*/
|
2011-01-02 10:51:25 +00:00
|
|
|
static void
|
|
|
|
gdk_win32_window_iconify (GdkWindow *window)
|
2001-03-09 16:43:19 +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
|
|
|
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),
|
2011-01-02 10:51:25 +00:00
|
|
|
_gdk_win32_window_state_to_string (window->state)));
|
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
|
|
|
|
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 ();
|
2016-06-27 05:16:43 +00:00
|
|
|
GtkShowWindow (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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
static void
|
|
|
|
gdk_win32_window_deiconify (GdkWindow *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_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),
|
2011-01-02 10:51:25 +00:00
|
|
|
_gdk_win32_window_state_to_string (window->state)));
|
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
|
|
|
|
2001-03-09 16:43:19 +00:00
|
|
|
if (GDK_WINDOW_IS_MAPPED (window))
|
2015-04-29 07:31:08 +00:00
|
|
|
{
|
2011-10-25 12:26:22 +00:00
|
|
|
show_window_internal (window, GDK_WINDOW_IS_MAPPED (window), TRUE);
|
2001-03-09 16:43:19 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gdk_synthesize_window_state (window,
|
|
|
|
GDK_WINDOW_STATE_ICONIFIED,
|
|
|
|
0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
static void
|
|
|
|
gdk_win32_window_stick (GdkWindow *window)
|
2001-03-09 16:43:19 +00:00
|
|
|
{
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
static void
|
|
|
|
gdk_win32_window_unstick (GdkWindow *window)
|
2001-03-09 16:43:19 +00:00
|
|
|
{
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
static void
|
|
|
|
gdk_win32_window_maximize (GdkWindow *window)
|
2001-03-09 16:43:19 +00:00
|
|
|
{
|
2016-06-27 05:16:43 +00:00
|
|
|
|
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_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),
|
2011-01-02 10:51:25 +00:00
|
|
|
_gdk_win32_window_state_to_string (window->state)));
|
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
|
|
|
|
2001-03-09 16:43:19 +00:00
|
|
|
if (GDK_WINDOW_IS_MAPPED (window))
|
2016-06-27 05:16:43 +00:00
|
|
|
GtkShowWindow (window, SW_MAXIMIZE);
|
2001-03-09 16:43:19 +00:00
|
|
|
else
|
|
|
|
gdk_synthesize_window_state (window,
|
|
|
|
0,
|
|
|
|
GDK_WINDOW_STATE_MAXIMIZED);
|
|
|
|
}
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
static void
|
|
|
|
gdk_win32_window_unmaximize (GdkWindow *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_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),
|
2011-01-02 10:51:25 +00:00
|
|
|
_gdk_win32_window_state_to_string (window->state)));
|
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
|
|
|
|
2018-05-22 10:05:35 +00:00
|
|
|
_gdk_win32_window_invalidate_egl_framebuffer (window);
|
|
|
|
|
2001-03-09 16:43:19 +00:00
|
|
|
if (GDK_WINDOW_IS_MAPPED (window))
|
2016-06-27 05:16:43 +00:00
|
|
|
GtkShowWindow (window, SW_RESTORE);
|
2001-03-09 16:43:19 +00:00
|
|
|
else
|
|
|
|
gdk_synthesize_window_state (window,
|
|
|
|
GDK_WINDOW_STATE_MAXIMIZED,
|
|
|
|
0);
|
|
|
|
}
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
static void
|
|
|
|
gdk_win32_window_fullscreen (GdkWindow *window)
|
2002-11-16 21:51:47 +00:00
|
|
|
{
|
2007-11-25 22:59:50 +00:00
|
|
|
gint x, y, width, height;
|
2003-08-05 22:24:35 +00:00
|
|
|
FullscreenInfo *fi;
|
2007-11-25 22:59:50 +00:00
|
|
|
HMONITOR monitor;
|
|
|
|
MONITORINFO mi;
|
2003-08-05 22:24:35 +00:00
|
|
|
|
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
|
|
|
|
{
|
2011-01-02 10:51:25 +00:00
|
|
|
GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
2003-08-05 22:24:35 +00:00
|
|
|
|
2007-11-25 22:59:50 +00:00
|
|
|
monitor = MonitorFromWindow (GDK_WINDOW_HWND (window), MONITOR_DEFAULTTONEAREST);
|
|
|
|
mi.cbSize = sizeof (mi);
|
|
|
|
if (monitor && GetMonitorInfo (monitor, &mi))
|
|
|
|
{
|
|
|
|
x = mi.rcMonitor.left;
|
|
|
|
y = mi.rcMonitor.top;
|
|
|
|
width = mi.rcMonitor.right - x;
|
|
|
|
height = mi.rcMonitor.bottom - y;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
x = y = 0;
|
|
|
|
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);
|
|
|
|
|
2011-10-26 08:21:10 +00:00
|
|
|
/* Send state change before configure event */
|
|
|
|
gdk_synthesize_window_state (window, 0, GDK_WINDOW_STATE_FULLSCREEN);
|
|
|
|
|
2015-04-29 07:31:08 +00:00
|
|
|
SetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE,
|
2003-08-05 22:24:35 +00:00
|
|
|
(fi->style & ~WS_OVERLAPPEDWINDOW) | WS_POPUP);
|
2005-03-16 01:38:57 +00:00
|
|
|
|
|
|
|
API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window), HWND_TOP,
|
2016-06-27 05:16:43 +00:00
|
|
|
x, y, width, height,
|
2018-06-17 10:48:48 +00:00
|
|
|
SWP_NOCOPYBITS | SWP_SHOWWINDOW | SWP_NOOWNERZORDER));
|
2003-08-05 22:24:35 +00:00
|
|
|
}
|
2002-11-16 21:51:47 +00:00
|
|
|
}
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
static void
|
|
|
|
gdk_win32_window_unfullscreen (GdkWindow *window)
|
2002-11-16 21:51:47 +00:00
|
|
|
{
|
2003-08-05 22:24:35 +00:00
|
|
|
FullscreenInfo *fi;
|
|
|
|
|
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)
|
|
|
|
{
|
2011-01-02 10:51:25 +00:00
|
|
|
GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
2003-08-05 22:24:35 +00:00
|
|
|
|
2011-10-26 08:21:10 +00:00
|
|
|
gdk_synthesize_window_state (window, GDK_WINDOW_STATE_FULLSCREEN, 0);
|
|
|
|
|
2003-08-05 22:24:35 +00:00
|
|
|
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,
|
2018-06-17 10:48:48 +00:00
|
|
|
SWP_NOCOPYBITS | SWP_SHOWWINDOW | SWP_NOOWNERZORDER));
|
2015-04-29 07:31:08 +00:00
|
|
|
|
2003-08-05 22:24:35 +00:00
|
|
|
g_object_set_data (G_OBJECT (window), "fullscreen-info", NULL);
|
|
|
|
g_free (fi);
|
2016-03-08 05:00:49 +00:00
|
|
|
_gdk_win32_window_update_style_bits (window);
|
2003-08-05 22:24:35 +00:00
|
|
|
}
|
2002-11-16 21:51:47 +00:00
|
|
|
}
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
static void
|
|
|
|
gdk_win32_window_set_keep_above (GdkWindow *window,
|
2008-10-05 00:00:10 +00:00
|
|
|
gboolean setting)
|
2003-11-15 20:35:55 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
|
|
|
return;
|
|
|
|
|
2008-10-05 00:00:10 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_set_keep_above: %p: %s\n",
|
|
|
|
GDK_WINDOW_HWND (window),
|
|
|
|
setting ? "YES" : "NO"));
|
|
|
|
|
2003-11-15 20:35:55 +00:00
|
|
|
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,
|
2018-06-17 10:48:48 +00:00
|
|
|
SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOOWNERZORDER));
|
2003-11-15 20:35:55 +00:00
|
|
|
}
|
2011-10-26 09:08:33 +00:00
|
|
|
|
|
|
|
gdk_synthesize_window_state (window,
|
|
|
|
setting ? GDK_WINDOW_STATE_BELOW : GDK_WINDOW_STATE_ABOVE,
|
|
|
|
setting ? GDK_WINDOW_STATE_ABOVE : 0);
|
2003-11-15 20:35:55 +00:00
|
|
|
}
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
static void
|
|
|
|
gdk_win32_window_set_keep_below (GdkWindow *window,
|
2008-10-05 00:00:10 +00:00
|
|
|
gboolean setting)
|
2003-11-15 20:35:55 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
|
|
|
return;
|
|
|
|
|
2008-10-05 00:00:10 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_set_keep_below: %p: %s\n",
|
|
|
|
GDK_WINDOW_HWND (window),
|
|
|
|
setting ? "YES" : "NO"));
|
|
|
|
|
2003-11-15 20:35:55 +00:00
|
|
|
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,
|
2018-06-17 10:48:48 +00:00
|
|
|
SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOOWNERZORDER));
|
2003-11-15 20:35:55 +00:00
|
|
|
}
|
2011-10-26 09:08:33 +00:00
|
|
|
|
|
|
|
gdk_synthesize_window_state (window,
|
|
|
|
setting ? GDK_WINDOW_STATE_ABOVE : GDK_WINDOW_STATE_BELOW,
|
|
|
|
setting ? GDK_WINDOW_STATE_BELOW : 0);
|
2003-11-15 20:35:55 +00:00
|
|
|
}
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
static void
|
|
|
|
gdk_win32_window_focus (GdkWindow *window,
|
|
|
|
guint32 timestamp)
|
2001-03-09 16:43:19 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
|
|
|
return;
|
2015-04-29 07:31:08 +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_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),
|
2011-01-02 10:51:25 +00:00
|
|
|
_gdk_win32_window_state_to_string (window->state)));
|
2002-03-06 00:36:08 +00:00
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
if (window->state & GDK_WINDOW_STATE_MAXIMIZED)
|
2016-06-27 05:16:43 +00:00
|
|
|
GtkShowWindow (window, SW_SHOWMAXIMIZED);
|
2016-02-08 08:24:12 +00:00
|
|
|
else if (window->state & GDK_WINDOW_STATE_ICONIFIED)
|
2016-06-27 05:16:43 +00:00
|
|
|
GtkShowWindow (window, SW_RESTORE);
|
2016-02-08 12:20:02 +00:00
|
|
|
else if (!IsWindowVisible (GDK_WINDOW_HWND (window)))
|
2016-06-27 05:16:43 +00:00
|
|
|
GtkShowWindow (window, SW_SHOWNORMAL);
|
2016-02-08 12:20:02 +00:00
|
|
|
else
|
2016-06-27 05:16:43 +00:00
|
|
|
GtkShowWindow (window, SW_SHOW);
|
2016-02-08 08:24:12 +00:00
|
|
|
|
2002-03-06 00:36:08 +00:00
|
|
|
SetFocus (GDK_WINDOW_HWND (window));
|
2001-03-09 16:43:19 +00:00
|
|
|
}
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
static void
|
|
|
|
gdk_win32_window_set_modal_hint (GdkWindow *window,
|
2001-03-09 16:43:19 +00:00
|
|
|
gboolean modal)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
2015-04-29 07:31:08 +00:00
|
|
|
|
2001-03-09 16:43:19 +00:00
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
|
|
|
return;
|
|
|
|
|
2008-10-05 00:00:10 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_set_modal_hint: %p: %s\n",
|
|
|
|
GDK_WINDOW_HWND (window),
|
|
|
|
modal ? "YES" : "NO"));
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
if (modal == window->modal_hint)
|
2008-07-07 22:26:35 +00:00
|
|
|
return;
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
window->modal_hint = modal;
|
2001-03-09 16:43:19 +00:00
|
|
|
|
2008-02-05 16:47:24 +00:00
|
|
|
#if 0
|
2007-07-12 23:38:30 +00:00
|
|
|
/* Not sure about this one.. -- Cody */
|
2001-03-09 16:43:19 +00:00
|
|
|
if (GDK_WINDOW_IS_MAPPED (window))
|
2015-04-29 07:31:08 +00:00
|
|
|
API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window),
|
2003-08-05 22:24:35 +00:00
|
|
|
modal ? HWND_TOPMOST : HWND_NOTOPMOST,
|
2005-03-16 01:38:57 +00:00
|
|
|
0, 0, 0, 0,
|
|
|
|
SWP_NOMOVE | SWP_NOSIZE));
|
2008-02-05 16:47:24 +00:00
|
|
|
#else
|
|
|
|
|
|
|
|
if (modal)
|
2008-07-02 20:22:30 +00:00
|
|
|
{
|
|
|
|
_gdk_push_modal_window (window);
|
|
|
|
gdk_window_raise (window);
|
|
|
|
}
|
2008-02-05 16:47:24 +00:00
|
|
|
else
|
2008-07-02 20:22:30 +00:00
|
|
|
{
|
|
|
|
_gdk_remove_modal_window (window);
|
|
|
|
}
|
2008-02-05 16:47:24 +00:00
|
|
|
|
2007-07-12 23:38:30 +00:00
|
|
|
#endif
|
2001-03-09 16:43:19 +00:00
|
|
|
}
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
static void
|
|
|
|
gdk_win32_window_set_skip_taskbar_hint (GdkWindow *window,
|
2009-02-24 15:52:32 +00:00
|
|
|
gboolean skips_taskbar)
|
2002-11-16 21:51:47 +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
|
|
|
static GdkWindow *owner = NULL;
|
2009-02-14 18:23:54 +00:00
|
|
|
//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
|
|
|
|
2008-10-05 00:00:10 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_set_skip_taskbar_hint: %p: %s, doing nothing\n",
|
|
|
|
GDK_WINDOW_HWND (window),
|
|
|
|
skips_taskbar ? "YES" : "NO"));
|
|
|
|
|
2007-10-18 00:31:22 +00:00
|
|
|
// ### TODO: Need to figure out what to do here.
|
|
|
|
return;
|
|
|
|
|
2003-01-12 04:44:23 +00:00
|
|
|
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
|
|
|
{
|
2009-02-14 18:23:54 +00:00
|
|
|
#if 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
|
|
|
if (owner == NULL)
|
2009-02-14 18:23:54 +00:00
|
|
|
{
|
|
|
|
wa.window_type = GDK_WINDOW_TEMP;
|
|
|
|
wa.wclass = GDK_INPUT_OUTPUT;
|
|
|
|
wa.width = wa.height = 1;
|
|
|
|
wa.event_mask = 0;
|
|
|
|
owner = gdk_window_new_internal (NULL, &wa, 0, TRUE);
|
|
|
|
}
|
|
|
|
#endif
|
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
|
|
|
|
2008-08-04 23:21:36 +00:00
|
|
|
SetWindowLongPtr (GDK_WINDOW_HWND (window), GWLP_HWNDPARENT, (LONG_PTR) 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));
|
2015-04-29 07:31:08 +00:00
|
|
|
|
2015-11-21 03:58:22 +00:00
|
|
|
SetWindowPos (GDK_WINDOW_HWND (window), SWP_NOZORDER_SPECIFIED,
|
2005-03-16 01:38:57 +00:00
|
|
|
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
|
|
|
|
{
|
2008-08-04 23:21:36 +00:00
|
|
|
SetWindowLongPtr (GDK_WINDOW_HWND (window), GWLP_HWNDPARENT, 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
|
|
|
}
|
2002-11-16 21:51:47 +00:00
|
|
|
}
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
static void
|
|
|
|
gdk_win32_window_set_skip_pager_hint (GdkWindow *window,
|
2009-02-24 15:52:32 +00:00
|
|
|
gboolean skips_pager)
|
2002-11-16 21:51:47 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
2008-10-05 00:00:10 +00:00
|
|
|
|
|
|
|
GDK_NOTE (MISC, g_print ("gdk_window_set_skip_pager_hint: %p: %s, doing nothing\n",
|
|
|
|
GDK_WINDOW_HWND (window),
|
|
|
|
skips_pager ? "YES" : "NO"));
|
2002-11-16 21:51:47 +00:00
|
|
|
}
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
static void
|
|
|
|
gdk_win32_window_set_type_hint (GdkWindow *window,
|
2009-02-24 15:52:32 +00:00
|
|
|
GdkWindowTypeHint hint)
|
2001-03-09 16:43:19 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
2015-04-29 07:31:08 +00:00
|
|
|
|
2001-03-09 16:43:19 +00:00
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
|
|
|
return;
|
|
|
|
|
2008-10-05 00:00:10 +00:00
|
|
|
GDK_NOTE (MISC,
|
|
|
|
G_STMT_START{
|
|
|
|
static GEnumClass *class = NULL;
|
|
|
|
if (!class)
|
|
|
|
class = g_type_class_ref (GDK_TYPE_WINDOW_TYPE_HINT);
|
|
|
|
g_print ("gdk_window_set_type_hint: %p: %s\n",
|
|
|
|
GDK_WINDOW_HWND (window),
|
|
|
|
g_enum_get_value (class, hint)->value_name);
|
|
|
|
}G_STMT_END);
|
2005-11-09 02:13:35 +00:00
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
((GdkWindowImplWin32 *)window->impl)->type_hint = hint;
|
2005-11-09 02:13:35 +00:00
|
|
|
|
2016-03-08 05:00:49 +00:00
|
|
|
_gdk_win32_window_update_style_bits (window);
|
2001-03-09 16:43:19 +00:00
|
|
|
}
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
static GdkWindowTypeHint
|
|
|
|
gdk_win32_window_get_type_hint (GdkWindow *window)
|
2005-11-09 02:13:35 +00:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GDK_IS_WINDOW (window), GDK_WINDOW_TYPE_HINT_NORMAL);
|
2015-04-29 07:31:08 +00:00
|
|
|
|
2005-11-09 02:13:35 +00:00
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
|
|
|
return GDK_WINDOW_TYPE_HINT_NORMAL;
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
return GDK_WINDOW_IMPL_WIN32 (window->impl)->type_hint;
|
2005-11-09 02:13:35 +00:00
|
|
|
}
|
|
|
|
|
2010-08-23 15:49:30 +00:00
|
|
|
static HRGN
|
|
|
|
cairo_region_to_hrgn (const cairo_region_t *region,
|
|
|
|
gint x_origin,
|
2016-06-27 05:16:43 +00:00
|
|
|
gint y_origin,
|
|
|
|
guint scale)
|
2010-08-23 15:49:30 +00:00
|
|
|
{
|
|
|
|
HRGN hrgn;
|
|
|
|
RGNDATA *rgndata;
|
|
|
|
RECT *rect;
|
|
|
|
cairo_rectangle_int_t r;
|
|
|
|
const int nrects = cairo_region_num_rectangles (region);
|
|
|
|
guint nbytes =
|
|
|
|
sizeof (RGNDATAHEADER) + (sizeof (RECT) * nrects);
|
|
|
|
int i;
|
|
|
|
|
|
|
|
rgndata = g_malloc (nbytes);
|
|
|
|
rgndata->rdh.dwSize = sizeof (RGNDATAHEADER);
|
|
|
|
rgndata->rdh.iType = RDH_RECTANGLES;
|
|
|
|
rgndata->rdh.nCount = rgndata->rdh.nRgnSize = 0;
|
|
|
|
SetRect (&rgndata->rdh.rcBound,
|
|
|
|
G_MAXLONG, G_MAXLONG, G_MINLONG, G_MINLONG);
|
|
|
|
|
|
|
|
for (i = 0; i < nrects; i++)
|
|
|
|
{
|
|
|
|
rect = ((RECT *) rgndata->Buffer) + rgndata->rdh.nCount++;
|
2015-04-29 07:31:08 +00:00
|
|
|
|
2010-08-23 15:49:30 +00:00
|
|
|
cairo_region_get_rectangle (region, i, &r);
|
2016-06-27 05:16:43 +00:00
|
|
|
rect->left = (r.x + x_origin) * scale;
|
|
|
|
rect->right = (rect->left + r.width) * scale;
|
|
|
|
rect->top = (r.y + y_origin) * scale;
|
|
|
|
rect->bottom = (rect->top + r.height) * scale;
|
2010-08-23 15:49:30 +00:00
|
|
|
|
|
|
|
if (rect->left < rgndata->rdh.rcBound.left)
|
|
|
|
rgndata->rdh.rcBound.left = rect->left;
|
|
|
|
if (rect->right > rgndata->rdh.rcBound.right)
|
|
|
|
rgndata->rdh.rcBound.right = rect->right;
|
|
|
|
if (rect->top < rgndata->rdh.rcBound.top)
|
|
|
|
rgndata->rdh.rcBound.top = rect->top;
|
|
|
|
if (rect->bottom > rgndata->rdh.rcBound.bottom)
|
|
|
|
rgndata->rdh.rcBound.bottom = rect->bottom;
|
|
|
|
}
|
|
|
|
if ((hrgn = ExtCreateRegion (NULL, nbytes, rgndata)) == NULL)
|
|
|
|
WIN32_API_FAILED ("ExtCreateRegion");
|
|
|
|
|
|
|
|
g_free (rgndata);
|
|
|
|
|
|
|
|
return (hrgn);
|
|
|
|
}
|
|
|
|
|
2008-07-02 13:58:28 +00:00
|
|
|
static void
|
2008-07-02 06:06:29 +00:00
|
|
|
gdk_win32_window_shape_combine_region (GdkWindow *window,
|
2010-06-28 12:54:37 +00:00
|
|
|
const cairo_region_t *shape_region,
|
2009-02-24 15:52:32 +00:00
|
|
|
gint offset_x,
|
|
|
|
gint offset_y)
|
2001-03-09 16:43:19 +00:00
|
|
|
{
|
2016-06-27 05:16:43 +00:00
|
|
|
GdkWindowImplWin32 *impl;
|
|
|
|
|
2001-03-09 16:43:19 +00:00
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
|
|
|
return;
|
|
|
|
|
2006-02-20 10:08:37 +00:00
|
|
|
if (!shape_region)
|
|
|
|
{
|
2009-10-18 08:43:33 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_win32_window_shape_combine_region: %p: none\n",
|
2006-02-20 10:08:37 +00:00
|
|
|
GDK_WINDOW_HWND (window)));
|
|
|
|
SetWindowRgn (GDK_WINDOW_HWND (window), NULL, TRUE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
HRGN hrgn;
|
2016-06-27 05:16:43 +00:00
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
2006-02-20 10:08:37 +00:00
|
|
|
|
2016-06-27 05:16:43 +00:00
|
|
|
hrgn = cairo_region_to_hrgn (shape_region, 0, 0, impl->window_scale);
|
2015-04-29 07:31:08 +00:00
|
|
|
|
2009-10-18 08:43:33 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_win32_window_shape_combine_region: %p: %p\n",
|
2006-02-20 10:08:37 +00:00
|
|
|
GDK_WINDOW_HWND (window),
|
|
|
|
hrgn));
|
|
|
|
|
|
|
|
do_shape_combine_region (window, hrgn, offset_x, offset_y);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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 *
|
2011-02-06 14:03:32 +00:00
|
|
|
gdk_win32_window_lookup_for_display (GdkDisplay *display,
|
|
|
|
HWND anid)
|
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
|
|
|
{
|
2016-02-22 16:55:16 +00:00
|
|
|
g_return_val_if_fail (display == gdk_display_get_default (), 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
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
return (GdkWindow*) gdk_win32_handle_table_lookup (anid);
|
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
|
|
|
}
|
2004-07-11 13:26:57 +00:00
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
static void
|
|
|
|
gdk_win32_window_set_opacity (GdkWindow *window,
|
2007-04-30 07:27:22 +00:00
|
|
|
gdouble opacity)
|
|
|
|
{
|
|
|
|
LONG exstyle;
|
2012-11-23 20:38:34 +00:00
|
|
|
typedef BOOL (WINAPI *PFN_SetLayeredWindowAttributes) (HWND, COLORREF, BYTE, DWORD);
|
2007-06-15 15:25:50 +00:00
|
|
|
PFN_SetLayeredWindowAttributes setLayeredWindowAttributes = NULL;
|
2016-02-23 09:20:55 +00:00
|
|
|
GdkWindowImplWin32 *impl;
|
2007-04-30 07:27:22 +00:00
|
|
|
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
2014-07-25 23:28:31 +00:00
|
|
|
if (!WINDOW_IS_TOPLEVEL (window) || GDK_WINDOW_DESTROYED (window))
|
2007-04-30 07:27:22 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
if (opacity < 0)
|
|
|
|
opacity = 0;
|
|
|
|
else if (opacity > 1)
|
|
|
|
opacity = 1;
|
|
|
|
|
2016-02-23 09:20:55 +00:00
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
|
|
|
|
|
|
|
if (impl->layered)
|
2017-09-02 15:25:36 +00:00
|
|
|
{
|
|
|
|
if (impl->layered_opacity != opacity)
|
|
|
|
{
|
|
|
|
RECT window_rect;
|
|
|
|
|
|
|
|
impl->layered_opacity = opacity;
|
|
|
|
|
|
|
|
gdk_win32_get_window_client_area_rect (window, impl->window_scale, &window_rect);
|
|
|
|
gdk_win32_update_layered_window_from_cache (window, &window_rect);
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
2016-02-23 09:20:55 +00:00
|
|
|
|
2007-04-30 07:27:22 +00:00
|
|
|
exstyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_EXSTYLE);
|
|
|
|
|
|
|
|
if (!(exstyle & WS_EX_LAYERED))
|
2011-10-27 15:16:46 +00:00
|
|
|
SetWindowLong (GDK_WINDOW_HWND (window),
|
|
|
|
GWL_EXSTYLE,
|
|
|
|
exstyle | WS_EX_LAYERED);
|
2007-04-30 07:27:22 +00:00
|
|
|
|
2015-04-29 07:31:08 +00:00
|
|
|
setLayeredWindowAttributes =
|
2007-06-15 15:25:50 +00:00
|
|
|
(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
|
|
|
|
2010-11-25 11:17:11 +00:00
|
|
|
static cairo_region_t *
|
|
|
|
gdk_win32_window_get_shape (GdkWindow *window)
|
2009-02-14 18:23:54 +00:00
|
|
|
{
|
2009-07-12 16:58:59 +00:00
|
|
|
HRGN hrgn = CreateRectRgn (0, 0, 0, 0);
|
|
|
|
int type = GetWindowRgn (GDK_WINDOW_HWND (window), hrgn);
|
2016-06-27 05:16:43 +00:00
|
|
|
GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
2009-07-12 16:58:59 +00:00
|
|
|
|
|
|
|
if (type == SIMPLEREGION || type == COMPLEXREGION)
|
|
|
|
{
|
2016-06-27 05:16:43 +00:00
|
|
|
cairo_region_t *region = _gdk_win32_hrgn_to_region (hrgn, impl->window_scale);
|
2009-07-12 16:58:59 +00:00
|
|
|
|
|
|
|
DeleteObject (hrgn);
|
|
|
|
return region;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
2009-02-14 18:23:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gdk_win32_input_shape_combine_region (GdkWindow *window,
|
2010-06-28 12:54:37 +00:00
|
|
|
const cairo_region_t *shape_region,
|
2009-02-16 18:26:35 +00:00
|
|
|
gint offset_x,
|
|
|
|
gint offset_y)
|
2009-02-14 18:23:54 +00:00
|
|
|
{
|
2014-07-24 16:27:09 +00:00
|
|
|
/* Partial input shape support is implemented by handling the
|
|
|
|
* WM_NCHITTEST message.
|
2014-07-24 13:41:51 +00:00
|
|
|
*/
|
2009-02-14 18:23:54 +00:00
|
|
|
}
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
gboolean
|
|
|
|
gdk_win32_window_is_win32 (GdkWindow *window)
|
2009-02-14 18:23:54 +00:00
|
|
|
{
|
2011-01-02 10:51:25 +00:00
|
|
|
return GDK_WINDOW_IS_WIN32 (window);
|
2009-02-14 18:23:54 +00:00
|
|
|
}
|
|
|
|
|
2016-03-18 04:51:52 +00:00
|
|
|
static gboolean
|
|
|
|
gdk_win32_window_show_window_menu (GdkWindow *window,
|
|
|
|
GdkEvent *event)
|
|
|
|
{
|
|
|
|
double event_x, event_y;
|
|
|
|
gint x, y;
|
2016-06-27 05:16:43 +00:00
|
|
|
GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
2016-03-18 04:51:52 +00:00
|
|
|
|
|
|
|
switch (event->type)
|
|
|
|
{
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
case GDK_BUTTON_RELEASE:
|
|
|
|
case GDK_TOUCH_BEGIN:
|
|
|
|
case GDK_TOUCH_END:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
gdk_event_get_root_coords (event, &event_x, &event_y);
|
|
|
|
x = event_x - _gdk_offset_x;
|
|
|
|
y = event_y - _gdk_offset_y;
|
|
|
|
|
2016-06-27 05:16:43 +00:00
|
|
|
SendMessage (GDK_WINDOW_HWND (window),
|
|
|
|
WM_SYSMENU,
|
|
|
|
0,
|
|
|
|
MAKELPARAM (x * impl->window_scale, y * impl->window_scale));
|
2016-03-18 04:51:52 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
/**
|
|
|
|
* _gdk_win32_acquire_dc
|
|
|
|
* @impl: a Win32 #GdkWindowImplWin32 implementation
|
2015-04-29 07:31:08 +00:00
|
|
|
*
|
2011-01-02 10:51:25 +00:00
|
|
|
* Gets a DC with the given drawable selected into it.
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
* Returns: The DC, on success. Otherwise
|
2011-01-02 10:51:25 +00:00
|
|
|
* %NULL. If this function succeeded
|
|
|
|
* _gdk_win32_impl_release_dc() must be called
|
|
|
|
* release the DC when you are done using it.
|
|
|
|
**/
|
2015-04-29 07:31:08 +00:00
|
|
|
static HDC
|
2011-01-02 10:51:25 +00:00
|
|
|
_gdk_win32_impl_acquire_dc (GdkWindowImplWin32 *impl)
|
|
|
|
{
|
|
|
|
if (GDK_IS_WINDOW_IMPL_WIN32 (impl) &&
|
|
|
|
GDK_WINDOW_DESTROYED (impl->wrapper))
|
|
|
|
return NULL;
|
|
|
|
|
2016-02-23 09:20:55 +00:00
|
|
|
/* We don't call this function for layered windows, but
|
|
|
|
* in case we do...
|
|
|
|
*/
|
|
|
|
if (impl->layered)
|
|
|
|
return NULL;
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
if (!impl->hdc)
|
|
|
|
{
|
|
|
|
impl->hdc = GetDC (impl->handle);
|
|
|
|
if (!impl->hdc)
|
|
|
|
WIN32_GDI_FAILED ("GetDC");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (impl->hdc)
|
|
|
|
{
|
|
|
|
impl->hdc_count++;
|
|
|
|
return impl->hdc;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
2008-07-02 06:06:29 +00:00
|
|
|
}
|
2010-06-11 18:20:07 +00:00
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
/**
|
|
|
|
* _gdk_win32_impl_release_dc
|
|
|
|
* @impl: a Win32 #GdkWindowImplWin32 implementation
|
2015-04-29 07:31:08 +00:00
|
|
|
*
|
2011-01-02 10:51:25 +00:00
|
|
|
* Releases the reference count for the DC
|
|
|
|
* from _gdk_win32_impl_acquire_dc()
|
|
|
|
**/
|
|
|
|
static void
|
|
|
|
_gdk_win32_impl_release_dc (GdkWindowImplWin32 *impl)
|
2010-06-14 18:47:57 +00:00
|
|
|
{
|
2016-02-23 09:20:55 +00:00
|
|
|
if (impl->layered)
|
|
|
|
return;
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
g_return_if_fail (impl->hdc_count > 0);
|
|
|
|
|
|
|
|
impl->hdc_count--;
|
|
|
|
if (impl->hdc_count == 0)
|
|
|
|
{
|
|
|
|
if (impl->saved_dc_bitmap)
|
|
|
|
{
|
|
|
|
GDI_CALL (SelectObject, (impl->hdc, impl->saved_dc_bitmap));
|
|
|
|
impl->saved_dc_bitmap = NULL;
|
|
|
|
}
|
2015-04-29 07:31:08 +00:00
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
if (impl->hdc)
|
|
|
|
{
|
|
|
|
GDI_CALL (ReleaseDC, (impl->handle, impl->hdc));
|
|
|
|
impl->hdc = NULL;
|
|
|
|
}
|
|
|
|
}
|
2010-06-14 18:47:57 +00:00
|
|
|
}
|
|
|
|
|
2011-10-28 09:05:53 +00:00
|
|
|
HWND
|
|
|
|
gdk_win32_window_get_impl_hwnd (GdkWindow *window)
|
|
|
|
{
|
|
|
|
if (GDK_WINDOW_IS_WIN32 (window))
|
|
|
|
return GDK_WINDOW_HWND (window);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
static void
|
|
|
|
gdk_win32_cairo_surface_destroy (void *data)
|
|
|
|
{
|
|
|
|
GdkWindowImplWin32 *impl = data;
|
|
|
|
|
|
|
|
_gdk_win32_impl_release_dc (impl);
|
|
|
|
impl->cairo_surface = NULL;
|
|
|
|
}
|
|
|
|
|
2016-02-23 09:20:55 +00:00
|
|
|
static cairo_surface_t *
|
|
|
|
gdk_win32_ref_cairo_surface_layered (GdkWindow *window,
|
|
|
|
GdkWindowImplWin32 *impl)
|
|
|
|
{
|
2017-09-02 15:25:36 +00:00
|
|
|
gint width, height;
|
2016-02-23 09:20:55 +00:00
|
|
|
RECT window_rect;
|
|
|
|
|
2017-09-02 15:25:36 +00:00
|
|
|
gdk_win32_get_window_client_area_rect (window, impl->window_scale, &window_rect);
|
2016-02-23 09:20:55 +00:00
|
|
|
|
|
|
|
/* Turn client area into window area */
|
|
|
|
_gdk_win32_adjust_client_rect (window, &window_rect);
|
|
|
|
|
|
|
|
width = window_rect.right - window_rect.left;
|
|
|
|
height = window_rect.bottom - window_rect.top;
|
|
|
|
|
|
|
|
if (width > impl->dib_width ||
|
|
|
|
height > impl->dib_height)
|
|
|
|
{
|
|
|
|
cairo_surface_t *new_cache;
|
|
|
|
cairo_t *cr;
|
|
|
|
|
|
|
|
/* Create larger cache surface, copy old cache surface over it */
|
2016-06-27 05:16:43 +00:00
|
|
|
new_cache = cairo_win32_surface_create_with_dib (CAIRO_FORMAT_ARGB32,
|
|
|
|
width,
|
|
|
|
height);
|
2016-02-23 09:20:55 +00:00
|
|
|
|
|
|
|
if (impl->cache_surface)
|
|
|
|
{
|
|
|
|
cr = cairo_create (new_cache);
|
|
|
|
cairo_set_source_surface (cr, impl->cache_surface, 0, 0);
|
|
|
|
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
|
|
|
|
cairo_paint (cr);
|
|
|
|
cairo_destroy (cr);
|
|
|
|
cairo_surface_flush (new_cache);
|
|
|
|
|
|
|
|
cairo_surface_destroy (impl->cache_surface);
|
|
|
|
}
|
|
|
|
|
|
|
|
impl->cache_surface = new_cache;
|
|
|
|
|
2016-06-27 05:16:43 +00:00
|
|
|
cairo_surface_set_device_scale (impl->cache_surface,
|
|
|
|
impl->window_scale,
|
|
|
|
impl->window_scale);
|
|
|
|
|
2016-02-23 09:20:55 +00:00
|
|
|
if (impl->cairo_surface)
|
|
|
|
cairo_surface_destroy (impl->cairo_surface);
|
|
|
|
|
|
|
|
impl->cairo_surface = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* This is separate, because cairo_surface gets killed
|
|
|
|
* off frequently by outside code, whereas cache_surface
|
|
|
|
* is only killed by us, above.
|
|
|
|
*/
|
|
|
|
if (!impl->cairo_surface)
|
|
|
|
{
|
2016-06-27 05:16:43 +00:00
|
|
|
impl->cairo_surface = cairo_win32_surface_create_with_dib (CAIRO_FORMAT_ARGB32,
|
|
|
|
width,
|
|
|
|
height);
|
2016-02-23 09:20:55 +00:00
|
|
|
impl->dib_width = width;
|
|
|
|
impl->dib_height = height;
|
|
|
|
|
2016-06-27 05:16:43 +00:00
|
|
|
cairo_surface_set_device_scale (impl->cairo_surface,
|
|
|
|
impl->window_scale,
|
|
|
|
impl->window_scale);
|
|
|
|
|
2016-02-23 09:20:55 +00:00
|
|
|
cairo_surface_set_user_data (impl->cairo_surface, &gdk_win32_cairo_key,
|
|
|
|
impl, gdk_win32_cairo_surface_destroy);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cairo_surface_reference (impl->cairo_surface);
|
|
|
|
}
|
|
|
|
|
|
|
|
return impl->cairo_surface;
|
|
|
|
}
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
static cairo_surface_t *
|
|
|
|
gdk_win32_ref_cairo_surface (GdkWindow *window)
|
|
|
|
{
|
|
|
|
GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
|
|
|
|
|
|
|
if (GDK_IS_WINDOW_IMPL_WIN32 (impl) &&
|
|
|
|
GDK_WINDOW_DESTROYED (impl->wrapper))
|
|
|
|
return NULL;
|
|
|
|
|
2016-02-23 09:20:55 +00:00
|
|
|
if (impl->layered)
|
|
|
|
return gdk_win32_ref_cairo_surface_layered (window, impl);
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
if (!impl->cairo_surface)
|
|
|
|
{
|
|
|
|
HDC hdc = _gdk_win32_impl_acquire_dc (impl);
|
|
|
|
if (!hdc)
|
|
|
|
return NULL;
|
|
|
|
|
2015-04-22 19:10:55 +00:00
|
|
|
impl->cairo_surface = cairo_win32_surface_create_with_format (hdc, CAIRO_FORMAT_ARGB32);
|
2016-06-27 05:16:43 +00:00
|
|
|
cairo_surface_set_device_scale (impl->cairo_surface,
|
|
|
|
impl->window_scale,
|
|
|
|
impl->window_scale);
|
2011-01-02 10:51:25 +00:00
|
|
|
|
|
|
|
cairo_surface_set_user_data (impl->cairo_surface, &gdk_win32_cairo_key,
|
|
|
|
impl, gdk_win32_cairo_surface_destroy);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
cairo_surface_reference (impl->cairo_surface);
|
|
|
|
|
|
|
|
return impl->cairo_surface;
|
|
|
|
}
|
|
|
|
|
2016-03-16 18:16:33 +00:00
|
|
|
BOOL WINAPI
|
2016-06-27 05:16:43 +00:00
|
|
|
GtkShowWindow (GdkWindow *window,
|
|
|
|
int cmd_show)
|
2016-03-16 18:16:33 +00:00
|
|
|
{
|
|
|
|
cairo_t *cr;
|
|
|
|
cairo_surface_t *surface;
|
|
|
|
RECT window_rect;
|
|
|
|
HDC hdc;
|
|
|
|
POINT window_position;
|
|
|
|
SIZE window_size;
|
|
|
|
POINT source_point;
|
|
|
|
BLENDFUNCTION blender;
|
|
|
|
|
2016-06-27 05:16:43 +00:00
|
|
|
HWND hwnd = GDK_WINDOW_HWND (window);
|
|
|
|
GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
|
|
|
|
2016-03-16 18:16:33 +00:00
|
|
|
switch (cmd_show)
|
|
|
|
{
|
|
|
|
case SW_FORCEMINIMIZE:
|
|
|
|
case SW_HIDE:
|
|
|
|
case SW_MINIMIZE:
|
|
|
|
break;
|
|
|
|
case SW_MAXIMIZE:
|
|
|
|
case SW_RESTORE:
|
|
|
|
case SW_SHOW:
|
|
|
|
case SW_SHOWDEFAULT:
|
|
|
|
case SW_SHOWMINIMIZED:
|
|
|
|
case SW_SHOWMINNOACTIVE:
|
|
|
|
case SW_SHOWNA:
|
|
|
|
case SW_SHOWNOACTIVATE:
|
|
|
|
case SW_SHOWNORMAL:
|
2018-05-22 10:05:35 +00:00
|
|
|
|
2016-03-16 18:16:33 +00:00
|
|
|
if (IsWindowVisible (hwnd))
|
|
|
|
break;
|
|
|
|
|
|
|
|
if ((WS_EX_LAYERED & GetWindowLongPtr (hwnd, GWL_EXSTYLE)) != WS_EX_LAYERED)
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* Window was hidden, will be shown. Erase it, GDK will repaint soon,
|
|
|
|
* but not soon enough, so it's possible to see old content before
|
|
|
|
* the next redraw, unless we erase the window first.
|
|
|
|
*/
|
|
|
|
GetWindowRect (hwnd, &window_rect);
|
|
|
|
source_point.x = source_point.y = 0;
|
|
|
|
|
|
|
|
window_position.x = window_rect.left;
|
|
|
|
window_position.y = window_rect.top;
|
|
|
|
window_size.cx = window_rect.right - window_rect.left;
|
|
|
|
window_size.cy = window_rect.bottom - window_rect.top;
|
|
|
|
|
|
|
|
blender.BlendOp = AC_SRC_OVER;
|
|
|
|
blender.BlendFlags = 0;
|
|
|
|
blender.AlphaFormat = AC_SRC_ALPHA;
|
|
|
|
blender.SourceConstantAlpha = 255;
|
|
|
|
|
|
|
|
/* Create a surface of appropriate size and clear it */
|
2016-06-27 05:16:43 +00:00
|
|
|
surface = cairo_win32_surface_create_with_dib (CAIRO_FORMAT_ARGB32,
|
|
|
|
window_size.cx,
|
|
|
|
window_size.cy);
|
|
|
|
cairo_surface_set_device_scale (surface, impl->window_scale, impl->window_scale);
|
2016-03-16 18:16:33 +00:00
|
|
|
cr = cairo_create (surface);
|
|
|
|
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
|
|
|
|
cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.0);
|
|
|
|
cairo_paint (cr);
|
|
|
|
cairo_destroy (cr);
|
|
|
|
cairo_surface_flush (surface);
|
|
|
|
hdc = cairo_win32_surface_get_dc (surface);
|
|
|
|
|
|
|
|
/* No API_CALL() wrapper, don't check for errors */
|
|
|
|
UpdateLayeredWindow (hwnd, NULL,
|
|
|
|
&window_position, &window_size,
|
|
|
|
hdc, &source_point,
|
|
|
|
0, &blender, ULW_ALPHA);
|
|
|
|
|
|
|
|
cairo_surface_destroy (surface);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2016-12-11 16:26:34 +00:00
|
|
|
/* Ensure that maximized window size is corrected later on */
|
|
|
|
if (cmd_show == SW_MAXIMIZE)
|
|
|
|
impl->maximizing = TRUE;
|
|
|
|
|
2016-03-16 18:16:33 +00:00
|
|
|
return ShowWindow (hwnd, cmd_show);
|
|
|
|
}
|
|
|
|
|
2016-03-15 10:15:14 +00:00
|
|
|
static void
|
|
|
|
gdk_win32_window_set_shadow_width (GdkWindow *window,
|
|
|
|
gint left,
|
|
|
|
gint right,
|
|
|
|
gint top,
|
|
|
|
gint bottom)
|
|
|
|
{
|
|
|
|
GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
|
|
|
|
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
|
|
|
return;
|
|
|
|
|
2016-03-15 10:17:45 +00:00
|
|
|
GDK_NOTE (MISC, g_print ("gdk_win32_window_set_shadow_width: window %p, "
|
|
|
|
"left %d, top %d, right %d, bottom %d\n",
|
|
|
|
window, left, top, right, bottom));
|
|
|
|
|
|
|
|
impl->zero_margins = left == 0 && right == 0 && top == 0 && bottom == 0;
|
|
|
|
|
|
|
|
if (impl->zero_margins)
|
|
|
|
return;
|
|
|
|
|
2016-03-15 10:15:14 +00:00
|
|
|
impl->margins.left = left;
|
2016-06-27 05:16:43 +00:00
|
|
|
impl->margins.right = right * impl->window_scale;
|
2016-03-15 10:15:14 +00:00
|
|
|
impl->margins.top = top;
|
2016-06-27 05:16:43 +00:00
|
|
|
impl->margins.bottom = bottom * impl->window_scale;
|
2016-03-15 10:15:14 +00:00
|
|
|
impl->margins_x = left + right;
|
|
|
|
impl->margins_y = top + bottom;
|
|
|
|
}
|
|
|
|
|
2016-06-27 05:16:43 +00:00
|
|
|
|
|
|
|
gint
|
|
|
|
_gdk_win32_window_get_scale_factor (GdkWindow *window)
|
|
|
|
{
|
|
|
|
GdkDisplay *display;
|
|
|
|
GdkWindowImplWin32 *impl;
|
|
|
|
|
|
|
|
GdkWin32Display *win32_display;
|
|
|
|
UINT dpix, dpiy;
|
|
|
|
gboolean is_scale_acquired;
|
|
|
|
|
|
|
|
if (GDK_WINDOW_DESTROYED (window))
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
g_return_val_if_fail (window != NULL, 1);
|
|
|
|
|
|
|
|
display = gdk_window_get_display (window);
|
|
|
|
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
|
|
|
|
|
|
|
win32_display = GDK_WIN32_DISPLAY (display);
|
|
|
|
|
|
|
|
if (win32_display->dpi_aware_type != PROCESS_DPI_UNAWARE)
|
|
|
|
{
|
|
|
|
if (win32_display->has_fixed_scale)
|
|
|
|
impl->window_scale = win32_display->window_scale;
|
|
|
|
else
|
|
|
|
impl->window_scale = _gdk_win32_display_get_monitor_scale_factor (win32_display,
|
|
|
|
NULL,
|
|
|
|
GDK_WINDOW_HWND (window),
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
return impl->window_scale;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (win32_display->has_fixed_scale)
|
|
|
|
{
|
|
|
|
static gsize hidpi_msg_displayed = 0;
|
|
|
|
|
|
|
|
if (g_once_init_enter (&hidpi_msg_displayed))
|
|
|
|
{
|
|
|
|
g_message ("Note: GDK_SCALE is ignored as HiDPI awareness is disabled.");
|
|
|
|
g_once_init_leave (&hidpi_msg_displayed, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Application is not DPI aware, don't bother */
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_gdk_win32_window_get_unscaled_size (GdkWindow *window,
|
|
|
|
gint *unscaled_width,
|
|
|
|
gint *unscaled_height)
|
|
|
|
{
|
|
|
|
GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
|
|
|
|
|
|
|
if (unscaled_width)
|
|
|
|
*unscaled_width = impl->unscaled_width;
|
|
|
|
if (unscaled_height)
|
|
|
|
*unscaled_height = impl->unscaled_height;
|
|
|
|
}
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
static void
|
|
|
|
gdk_window_impl_win32_class_init (GdkWindowImplWin32Class *klass)
|
|
|
|
{
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
GdkWindowImplClass *impl_class = GDK_WINDOW_IMPL_CLASS (klass);
|
|
|
|
|
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
|
|
|
|
|
|
|
object_class->finalize = gdk_window_impl_win32_finalize;
|
2015-04-29 07:31:08 +00:00
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
impl_class->ref_cairo_surface = gdk_win32_ref_cairo_surface;
|
|
|
|
|
|
|
|
impl_class->show = gdk_win32_window_show;
|
|
|
|
impl_class->hide = gdk_win32_window_hide;
|
|
|
|
impl_class->withdraw = gdk_win32_window_withdraw;
|
|
|
|
impl_class->set_events = gdk_win32_window_set_events;
|
|
|
|
impl_class->get_events = gdk_win32_window_get_events;
|
|
|
|
impl_class->raise = gdk_win32_window_raise;
|
|
|
|
impl_class->lower = gdk_win32_window_lower;
|
|
|
|
impl_class->restack_under = gdk_win32_window_restack_under;
|
|
|
|
impl_class->restack_toplevel = gdk_win32_window_restack_toplevel;
|
|
|
|
impl_class->move_resize = gdk_win32_window_move_resize;
|
|
|
|
impl_class->set_background = gdk_win32_window_set_background;
|
|
|
|
impl_class->reparent = gdk_win32_window_reparent;
|
|
|
|
impl_class->set_device_cursor = gdk_win32_window_set_device_cursor;
|
|
|
|
impl_class->get_geometry = gdk_win32_window_get_geometry;
|
|
|
|
impl_class->get_device_state = gdk_window_win32_get_device_state;
|
|
|
|
impl_class->get_root_coords = gdk_win32_window_get_root_coords;
|
|
|
|
|
|
|
|
impl_class->shape_combine_region = gdk_win32_window_shape_combine_region;
|
|
|
|
impl_class->input_shape_combine_region = gdk_win32_input_shape_combine_region;
|
|
|
|
impl_class->destroy = gdk_win32_window_destroy;
|
|
|
|
impl_class->destroy_foreign = gdk_win32_window_destroy_foreign;
|
|
|
|
impl_class->get_shape = gdk_win32_window_get_shape;
|
|
|
|
//FIXME?: impl_class->get_input_shape = gdk_win32_window_get_input_shape;
|
2016-02-23 09:20:55 +00:00
|
|
|
impl_class->begin_paint = gdk_win32_window_begin_paint;
|
2016-02-06 12:06:41 +00:00
|
|
|
impl_class->end_paint = gdk_win32_window_end_paint;
|
2011-01-02 10:51:25 +00:00
|
|
|
|
|
|
|
//impl_class->beep = gdk_x11_window_beep;
|
|
|
|
|
2016-03-18 04:51:52 +00:00
|
|
|
|
|
|
|
impl_class->show_window_menu = gdk_win32_window_show_window_menu;
|
2011-01-02 10:51:25 +00:00
|
|
|
impl_class->focus = gdk_win32_window_focus;
|
|
|
|
impl_class->set_type_hint = gdk_win32_window_set_type_hint;
|
|
|
|
impl_class->get_type_hint = gdk_win32_window_get_type_hint;
|
|
|
|
impl_class->set_modal_hint = gdk_win32_window_set_modal_hint;
|
|
|
|
impl_class->set_skip_taskbar_hint = gdk_win32_window_set_skip_taskbar_hint;
|
|
|
|
impl_class->set_skip_pager_hint = gdk_win32_window_set_skip_pager_hint;
|
|
|
|
impl_class->set_urgency_hint = gdk_win32_window_set_urgency_hint;
|
|
|
|
impl_class->set_geometry_hints = gdk_win32_window_set_geometry_hints;
|
|
|
|
impl_class->set_title = gdk_win32_window_set_title;
|
|
|
|
impl_class->set_role = gdk_win32_window_set_role;
|
|
|
|
//impl_class->set_startup_id = gdk_x11_window_set_startup_id;
|
|
|
|
impl_class->set_transient_for = gdk_win32_window_set_transient_for;
|
|
|
|
impl_class->get_frame_extents = gdk_win32_window_get_frame_extents;
|
|
|
|
impl_class->set_override_redirect = gdk_win32_window_set_override_redirect;
|
|
|
|
impl_class->set_accept_focus = gdk_win32_window_set_accept_focus;
|
|
|
|
impl_class->set_focus_on_map = gdk_win32_window_set_focus_on_map;
|
|
|
|
impl_class->set_icon_list = gdk_win32_window_set_icon_list;
|
|
|
|
impl_class->set_icon_name = gdk_win32_window_set_icon_name;
|
|
|
|
impl_class->iconify = gdk_win32_window_iconify;
|
|
|
|
impl_class->deiconify = gdk_win32_window_deiconify;
|
|
|
|
impl_class->stick = gdk_win32_window_stick;
|
|
|
|
impl_class->unstick = gdk_win32_window_unstick;
|
|
|
|
impl_class->maximize = gdk_win32_window_maximize;
|
|
|
|
impl_class->unmaximize = gdk_win32_window_unmaximize;
|
|
|
|
impl_class->fullscreen = gdk_win32_window_fullscreen;
|
|
|
|
impl_class->unfullscreen = gdk_win32_window_unfullscreen;
|
|
|
|
impl_class->set_keep_above = gdk_win32_window_set_keep_above;
|
|
|
|
impl_class->set_keep_below = gdk_win32_window_set_keep_below;
|
|
|
|
impl_class->get_group = gdk_win32_window_get_group;
|
|
|
|
impl_class->set_group = gdk_win32_window_set_group;
|
|
|
|
impl_class->set_decorations = gdk_win32_window_set_decorations;
|
|
|
|
impl_class->get_decorations = gdk_win32_window_get_decorations;
|
|
|
|
impl_class->set_functions = gdk_win32_window_set_functions;
|
|
|
|
|
2016-03-15 10:15:14 +00:00
|
|
|
impl_class->set_shadow_width = gdk_win32_window_set_shadow_width;
|
2011-01-02 10:51:25 +00:00
|
|
|
impl_class->begin_resize_drag = gdk_win32_window_begin_resize_drag;
|
|
|
|
impl_class->begin_move_drag = gdk_win32_window_begin_move_drag;
|
|
|
|
impl_class->set_opacity = gdk_win32_window_set_opacity;
|
|
|
|
//impl_class->set_composited = gdk_win32_window_set_composited;
|
|
|
|
impl_class->destroy_notify = gdk_win32_window_destroy_notify;
|
2011-02-06 14:03:32 +00:00
|
|
|
impl_class->get_drag_protocol = _gdk_win32_window_get_drag_protocol;
|
2011-01-02 10:51:25 +00:00
|
|
|
impl_class->register_dnd = _gdk_win32_window_register_dnd;
|
|
|
|
impl_class->drag_begin = _gdk_win32_window_drag_begin;
|
|
|
|
//? impl_class->sync_rendering = _gdk_win32_window_sync_rendering;
|
|
|
|
impl_class->simulate_key = _gdk_win32_window_simulate_key;
|
|
|
|
impl_class->simulate_button = _gdk_win32_window_simulate_button;
|
|
|
|
impl_class->get_property = _gdk_win32_window_get_property;
|
|
|
|
impl_class->change_property = _gdk_win32_window_change_property;
|
|
|
|
impl_class->delete_property = _gdk_win32_window_delete_property;
|
2014-12-17 04:32:04 +00:00
|
|
|
impl_class->create_gl_context = _gdk_win32_window_create_gl_context;
|
|
|
|
impl_class->invalidate_for_new_frame = _gdk_win32_window_invalidate_for_new_frame;
|
2016-06-27 05:16:43 +00:00
|
|
|
impl_class->get_scale_factor = _gdk_win32_window_get_scale_factor;
|
|
|
|
impl_class->get_unscaled_size = _gdk_win32_window_get_unscaled_size;
|
2011-01-02 10:51:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HGDIOBJ
|
|
|
|
gdk_win32_window_get_handle (GdkWindow *window)
|
|
|
|
{
|
2011-09-09 14:17:29 +00:00
|
|
|
/* Try to ensure the window has a native window */
|
|
|
|
if (!_gdk_window_has_impl (window))
|
|
|
|
gdk_window_ensure_native (window);
|
|
|
|
|
|
|
|
if (!GDK_WINDOW_IS_WIN32 (window))
|
|
|
|
{
|
|
|
|
g_warning (G_STRLOC " window is not a native Win32 window");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2011-01-02 10:51:25 +00:00
|
|
|
return GDK_WINDOW_HWND (window);
|
|
|
|
}
|
Add a EGL renderer (via ANGLE) for Windows
This is for adding a EGL-based renderer which is done via the ANGLE
project, which translate EGL calls to Direct3D 9/11. This is done as a
possible solution to issue #105, especially for cases where the needed
full GL extensions to map OpenGL to Direc3D is unavailable or
unreliable, or when the OpenGL implementation from the graphics drivers
are problematic.
To enable this, do the following:
-Build ANGLE and ensure the ANGLE libEGL.dll and libGLESv2.dll are
available. A sufficiently-recent ANGLE is needed for things to
work correctly--note that the copy of ANGLE that is included in
qtbase-5.10.1 is sufficient. ANGLE is licensed under a BSD 3-clause
license. Note also that Visual Studio 2013 or later is required to
build ANGLE from QT-5.10.1, but the 2013-built ANGLE DLLs can work
without without problems for GTK+ that is built with Visual Studio
2008 or later.
-Build libepoxy on Windows with EGL support enabled.
-Define GDK_WIN32_ENABLE_EGL when building gdk-win32.lib when building
with Visual Studio, or pass in --enable-win32-gles during configure
when building with MinGW/mingw-w64.
-Prior to running GTK+ programs, the GDK_GL envvar needs to contain
gles.
Known issues:
-Only OpenGL ES 3 is supported, ANGLE's ES 2 does not support the needed
extensions, notably GL_OES_vertex_array_object, but its ES 3 support is
sufficient.
-There is no autodetection or fallback mechanism to enable using
EGL/Angle automatically yet. There is no plans to do this in this
commit.
Thanks to LRN for pointing out that we should #include
"win32/gdkwin32.h" instead of #include "gdkwin32.h" for gdkgl.c. LRN
also did the autotools portion of this patch.
Further notes about the autotools --enable-win32-gles option, fom LRN:
This adds --enable-win32-gles option, which enables the
code for GLES renderer. This commit also adds tests for WGL and
EGL in epoxy. The absence of WGL is highly unlikely (it's enabled
by default), but checking for EGL when GLES is enabled is necessary,
as EGL is disabled in Windows builds of epoxy by default.
2018-04-27 15:30:32 +00:00
|
|
|
|
|
|
|
#ifdef GDK_WIN32_ENABLE_EGL
|
|
|
|
EGLSurface
|
|
|
|
_gdk_win32_window_get_egl_surface (GdkWindow *window,
|
|
|
|
EGLConfig config,
|
|
|
|
gboolean is_dummy)
|
|
|
|
{
|
|
|
|
EGLSurface surface;
|
|
|
|
GdkWin32Display *display = GDK_WIN32_DISPLAY (gdk_window_get_display (window));
|
|
|
|
GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
|
|
|
|
|
|
|
if (is_dummy)
|
|
|
|
{
|
|
|
|
if (impl->egl_dummy_surface == EGL_NO_SURFACE)
|
|
|
|
{
|
|
|
|
EGLint attribs[] = {EGL_WIDTH, 1, EGL_WIDTH, 1, EGL_NONE};
|
|
|
|
impl->egl_dummy_surface = eglCreatePbufferSurface (display->egl_disp,
|
|
|
|
config,
|
|
|
|
attribs);
|
|
|
|
}
|
|
|
|
return impl->egl_dummy_surface;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (impl->egl_surface == EGL_NO_SURFACE)
|
|
|
|
impl->egl_surface = eglCreateWindowSurface (display->egl_disp, config, display->gl_hwnd, NULL);
|
|
|
|
|
|
|
|
return impl->egl_surface;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
#endif
|