forked from AuroraMiddleware/gtk
gdk/win32: Fix build after GdkScreen and cursor cleanups
Move the leftovers from the removals to use the current APIs, to fix the build. Also for gdk_device_virtual_set_window_cursor(), only do something when a valid GdkCursor is passed in here. https://bugzilla.gnome.org/show_bug.cgi?id=773299
This commit is contained in:
parent
a409320cda
commit
6a12a3cd10
@ -92,33 +92,8 @@ gdk_device_virtual_set_window_cursor (GdkDevice *device,
|
||||
GdkWindow *window,
|
||||
GdkCursor *cursor)
|
||||
{
|
||||
GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
||||
GdkCursor *previous_cursor = impl->cursor;
|
||||
|
||||
if (cursor != NULL && GDK_WIN32_CURSOR (cursor)->hcursor != NULL)
|
||||
{
|
||||
SetCursor (GDK_WIN32_CURSOR (cursor)->hcursor);
|
||||
}
|
||||
else if (previous_cursor != NULL &&
|
||||
GetCursor () == GDK_WIN32_CURSOR (previous_cursor)->hcursor)
|
||||
{
|
||||
/* The caller will unref previous_cursor shortly,
|
||||
* but it holds the handle to currently-used cursor,
|
||||
* and we can't call SetCursor(NULL).
|
||||
*/
|
||||
g_warning (G_STRLOC ": Refusing to replace cursor %p (handle %p) with NULL. "
|
||||
"Expect ugly results.",
|
||||
previous_cursor, GDK_WIN32_CURSOR (previous_cursor)->hcursor);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Up the stack all effors were made already to ensure that
|
||||
* the "cursor" argument is non-NULL.
|
||||
* If it is, calling SetCursor(NULL) is absolutely not
|
||||
* the right decision, so we just warn and bail out.
|
||||
*/
|
||||
g_warning (G_STRLOC ": Refusing to set NULL cursor");
|
||||
}
|
||||
SetCursor (GDK_WIN32_CURSOR (cursor)->hcursor);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -171,8 +146,6 @@ gdk_device_virtual_grab (GdkDevice *device,
|
||||
|
||||
if (_gdk_win32_grab_cursor != NULL)
|
||||
SetCursor (GDK_WIN32_CURSOR (_gdk_win32_grab_cursor)->hcursor);
|
||||
else if (impl->cursor != NULL)
|
||||
SetCursor (GDK_WIN32_CURSOR (impl->cursor)->hcursor);
|
||||
else
|
||||
SetCursor (LoadCursor (NULL, IDC_ARROW));
|
||||
|
||||
|
@ -111,7 +111,7 @@ gdk_device_win32_query_state (GdkDevice *device,
|
||||
GdkWindowImplWin32 *impl;
|
||||
|
||||
if (window == NULL)
|
||||
window = gdk_get_default_root_window ();
|
||||
window = gdk_display_get_root_window (gdk_display_get_default ());
|
||||
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
||||
|
||||
hwnd = GDK_WINDOW_HWND (window);
|
||||
@ -131,7 +131,7 @@ gdk_device_win32_query_state (GdkDevice *device,
|
||||
if (win_y)
|
||||
*win_y = point.y / impl->window_scale;
|
||||
|
||||
if (window == gdk_get_default_root_window ())
|
||||
if (window == gdk_display_get_root_window (gdk_display_get_default ()))
|
||||
{
|
||||
if (win_x)
|
||||
*win_x += _gdk_offset_x;
|
||||
@ -247,7 +247,7 @@ _gdk_device_win32_window_at_position (GdkDevice *device,
|
||||
/* If we didn't hit any window at that point, return the desktop */
|
||||
if (hwnd == NULL)
|
||||
{
|
||||
window = gdk_get_default_root_window ();
|
||||
window = gdk_display_get_root_window (gdk_display_get_default ());
|
||||
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
||||
|
||||
if (win_x)
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
#include "gdkwin32.h"
|
||||
#include "gdkdevice-wintab.h"
|
||||
#include "gdkdisplayprivate.h"
|
||||
|
||||
G_DEFINE_TYPE (GdkDeviceWintab, gdk_device_wintab, GDK_TYPE_DEVICE)
|
||||
|
||||
@ -122,7 +123,7 @@ gdk_device_wintab_query_state (GdkDevice *device,
|
||||
|
||||
device_wintab = GDK_DEVICE_WINTAB (device);
|
||||
if (window == NULL)
|
||||
window = gdk_get_default_root_window ();
|
||||
window = gdk_display_get_root_window (gdk_display_get_default ());
|
||||
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
||||
|
||||
hwnd = GDK_WINDOW_HWND (window);
|
||||
@ -142,7 +143,7 @@ gdk_device_wintab_query_state (GdkDevice *device,
|
||||
if (win_y)
|
||||
*win_y = point.y / impl->window_scale;
|
||||
|
||||
if (window == gdk_get_default_root_window ())
|
||||
if (window == gdk_display_get_root_window (gdk_display_get_default ()))
|
||||
{
|
||||
if (win_x)
|
||||
*win_x += _gdk_offset_x;
|
||||
|
@ -961,7 +961,7 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS;
|
||||
window = gdk_device_get_window_at_position (device_manager->core_pointer, &x, &y);
|
||||
if (window == NULL)
|
||||
window = gdk_get_default_root_window ();
|
||||
window = gdk_display_get_root_window (gdk_display_get_default ());
|
||||
|
||||
g_object_ref (window);
|
||||
|
||||
@ -1004,7 +1004,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS;
|
||||
window = g_object_ref (last_grab->window);
|
||||
}
|
||||
|
||||
if (window == gdk_get_default_root_window ())
|
||||
if (window == gdk_display_get_root_window (gdk_display_get_default ()))
|
||||
{
|
||||
GDK_NOTE (EVENTS_OR_INPUT, g_print ("... is root\n"));
|
||||
return FALSE;
|
||||
@ -1081,7 +1081,8 @@ G_GNUC_END_IGNORE_DEPRECATIONS;
|
||||
{
|
||||
GDK_NOTE (EVENTS_OR_INPUT, g_print ("... not selected\n"));
|
||||
|
||||
if (window->parent == gdk_get_default_root_window () || window->parent == NULL)
|
||||
if (window->parent == gdk_display_get_root_window (gdk_display_get_default ()) ||
|
||||
window->parent == NULL)
|
||||
return FALSE;
|
||||
|
||||
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
||||
|
@ -619,7 +619,7 @@ inner_clipboard_window_procedure (HWND hwnd,
|
||||
GDK_NOTE (DND, g_print (" \n"));
|
||||
|
||||
event = gdk_event_new (GDK_OWNER_CHANGE);
|
||||
event->owner_change.window = gdk_get_default_root_window ();
|
||||
event->owner_change.window = gdk_display_get_root_window (gdk_display_get_default ());
|
||||
event->owner_change.reason = GDK_OWNER_CHANGE_NEW_OWNER;
|
||||
event->owner_change.selection = GDK_SELECTION_CLIPBOARD;
|
||||
event->owner_change.time = _gdk_win32_get_next_tick (0);
|
||||
|
@ -81,6 +81,7 @@
|
||||
#include "gdkwin32.h"
|
||||
#include "gdkwin32dnd.h"
|
||||
#include "gdk/gdkdndprivate.h"
|
||||
#include "gdkdisplayprivate.h"
|
||||
|
||||
#include <ole2.h>
|
||||
|
||||
@ -731,7 +732,7 @@ idropsource_givefeedback (LPDROPSOURCE This,
|
||||
else
|
||||
{
|
||||
if (ctx->context->dest_window == NULL)
|
||||
ctx->context->dest_window = g_object_ref (gdk_get_default_root_window ());
|
||||
ctx->context->dest_window = g_object_ref (gdk_display_get_root_window (gdk_display_get_default ()));
|
||||
}
|
||||
|
||||
return DRAGDROP_S_USEDEFAULTCURSORS;
|
||||
@ -1430,7 +1431,7 @@ gdk_dropfiles_filter (GdkXEvent *xev,
|
||||
context->protocol = GDK_DRAG_PROTO_WIN32_DROPFILES;
|
||||
context->is_source = FALSE;
|
||||
|
||||
context->source_window = gdk_get_default_root_window ();
|
||||
context->source_window = gdk_display_get_root_window (gdk_display_get_default ());
|
||||
g_object_ref (context->source_window);
|
||||
|
||||
context->dest_window = event->any.window;
|
||||
|
@ -673,7 +673,6 @@ _gdk_win32_print_event (const GdkEvent *event)
|
||||
CASE (GDK_DROP_START);
|
||||
CASE (GDK_DROP_FINISHED);
|
||||
CASE (GDK_CLIENT_EVENT);
|
||||
CASE (GDK_VISIBILITY_NOTIFY);
|
||||
CASE (GDK_SCROLL);
|
||||
CASE (GDK_WINDOW_STATE);
|
||||
CASE (GDK_OWNER_CHANGE);
|
||||
@ -1356,7 +1355,8 @@ propagate (GdkWindow **window,
|
||||
{
|
||||
/* Owner doesn't want it, propagate to parent. */
|
||||
GdkWindow *parent = gdk_window_get_parent (*window);
|
||||
if (parent == gdk_get_default_root_window () || parent == NULL)
|
||||
if (parent == gdk_display_get_root_window (gdk_display_get_default ()) ||
|
||||
parent == NULL)
|
||||
{
|
||||
/* No parent; check if grabbed */
|
||||
if (grab_window != NULL)
|
||||
@ -1434,7 +1434,7 @@ _gdk_win32_get_window_rect (GdkWindow *window,
|
||||
point.y = client_rect.top;
|
||||
|
||||
/* top level windows need screen coords */
|
||||
if (gdk_window_get_parent (window) == gdk_get_default_root_window ())
|
||||
if (gdk_window_get_parent (window) == gdk_display_get_root_window (gdk_display_get_default ()))
|
||||
{
|
||||
ClientToScreen (hwnd, &point);
|
||||
point.x += _gdk_offset_x * window_impl->window_scale;
|
||||
@ -1692,7 +1692,6 @@ handle_dpi_changed (GdkWindow *window,
|
||||
GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
||||
GdkDisplay *display = gdk_display_get_default ();
|
||||
GdkWin32Display *win32_display = GDK_WIN32_DISPLAY (display);
|
||||
GdkScreen *screen = gdk_window_get_screen (window);
|
||||
GdkDevice *device = gdk_seat_get_pointer (gdk_display_get_default_seat (display));
|
||||
RECT *rect = (RECT *)msg->lParam;
|
||||
GdkEvent *event;
|
||||
@ -1711,9 +1710,6 @@ handle_dpi_changed (GdkWindow *window,
|
||||
if (old_scale == impl->window_scale)
|
||||
return;
|
||||
|
||||
_gdk_screen_set_resolution (screen,
|
||||
impl->window_scale >= 2 ? USER_DEFAULT_SCREEN_DPI : dpi);
|
||||
|
||||
if (!IsIconic (msg->hwnd) &&
|
||||
!GDK_WINDOW_DESTROYED (window))
|
||||
{
|
||||
@ -3070,8 +3066,6 @@ gdk_event_translate (MSG *msg,
|
||||
|
||||
if (grab_window != NULL && _gdk_win32_grab_cursor != NULL)
|
||||
cursor = _gdk_win32_grab_cursor;
|
||||
else if (!GDK_WINDOW_DESTROYED (window) && GDK_WINDOW_IMPL_WIN32 (window->impl)->cursor != NULL)
|
||||
cursor = GDK_WINDOW_IMPL_WIN32 (window->impl)->cursor;
|
||||
else
|
||||
cursor = NULL;
|
||||
|
||||
|
@ -466,7 +466,6 @@ GdkKeymap *_gdk_win32_display_get_keymap (GdkDisplay *display);
|
||||
void _gdk_win32_display_create_window_impl (GdkDisplay *display,
|
||||
GdkWindow *window,
|
||||
GdkWindow *real_parent,
|
||||
GdkScreen *screen,
|
||||
GdkEventMask event_mask,
|
||||
GdkWindowAttr *attributes);
|
||||
|
||||
@ -530,8 +529,6 @@ gboolean _gdk_win32_window_lacks_wm_decorations (GdkWindow *window);
|
||||
BOOL WINAPI GtkShowWindow (GdkWindow *window,
|
||||
int cmd_show);
|
||||
|
||||
void _gdk_win32_screen_set_font_resolution (GdkWin32Screen *win32_screen);
|
||||
|
||||
/* Initialization */
|
||||
void _gdk_win32_windowing_init (void);
|
||||
void _gdk_dnd_init (void);
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "gdkscreen.h"
|
||||
#include "gdkproperty.h"
|
||||
#include "gdkselection.h"
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include "gdkprivate-win32.h"
|
||||
#include "gdkwin32.h"
|
||||
|
||||
|
@ -127,7 +127,6 @@ static void
|
||||
gdk_win32_screen_init (GdkWin32Screen *win32_screen)
|
||||
{
|
||||
GdkScreen *screen = GDK_SCREEN (win32_screen);
|
||||
_gdk_win32_screen_set_font_resolution (win32_screen);
|
||||
|
||||
_gdk_win32_display_init_monitors (GDK_WIN32_DISPLAY (_gdk_display));
|
||||
init_root_window (win32_screen);
|
||||
@ -141,37 +140,6 @@ _gdk_win32_screen_on_displaychange_event (GdkWin32Screen *screen)
|
||||
init_root_window_size (screen);
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_win32_screen_set_font_resolution (GdkWin32Screen *win32_screen)
|
||||
{
|
||||
GdkScreen *screen = GDK_SCREEN (win32_screen);
|
||||
int logpixelsx = -1;
|
||||
const gchar *font_resolution;
|
||||
|
||||
font_resolution = g_getenv ("GDK_WIN32_FONT_RESOLUTION");
|
||||
if (font_resolution)
|
||||
{
|
||||
int env_logpixelsx = atol (font_resolution);
|
||||
if (env_logpixelsx > 0)
|
||||
logpixelsx = env_logpixelsx;
|
||||
}
|
||||
else
|
||||
{
|
||||
gint dpi = -1;
|
||||
GdkWin32Display *win32_display = GDK_WIN32_DISPLAY (screen->display);
|
||||
guint scale = _gdk_win32_display_get_monitor_scale_factor (win32_display, NULL, NULL, &dpi);
|
||||
|
||||
/* If we have a scale that is at least 2, don't scale up the fonts */
|
||||
if (scale >= 2)
|
||||
logpixelsx = USER_DEFAULT_SCREEN_DPI;
|
||||
else
|
||||
logpixelsx = dpi;
|
||||
}
|
||||
|
||||
if (logpixelsx > 0)
|
||||
_gdk_screen_set_resolution (screen, logpixelsx);
|
||||
}
|
||||
|
||||
GdkWindow *
|
||||
gdk_win32_screen_get_root_window (GdkScreen *screen)
|
||||
{
|
||||
|
@ -36,7 +36,6 @@
|
||||
#include "gdkenumtypes.h"
|
||||
#include "gdkwin32.h"
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include "gdkvisualprivate.h"
|
||||
#include "gdkmonitorprivate.h"
|
||||
#include "gdkwin32window.h"
|
||||
#include "gdkglcontext-win32.h"
|
||||
@ -449,7 +448,6 @@ gboolean
|
||||
_gdk_win32_window_enable_transparency (GdkWindow *window)
|
||||
{
|
||||
GdkWindowImplWin32 *impl;
|
||||
GdkScreen *screen;
|
||||
DWM_BLURBEHIND blur_behind;
|
||||
HRGN empty_region;
|
||||
HRESULT call_result;
|
||||
@ -464,8 +462,6 @@ _gdk_win32_window_enable_transparency (GdkWindow *window)
|
||||
if (impl->layered)
|
||||
return TRUE;
|
||||
|
||||
screen = gdk_window_get_screen (window);
|
||||
|
||||
if (!gdk_display_is_composited (gdk_window_get_display (window)))
|
||||
return FALSE;
|
||||
|
||||
@ -748,7 +744,7 @@ _gdk_win32_display_create_window_impl (GdkDisplay *display,
|
||||
|
||||
case GDK_WINDOW_TEMP:
|
||||
/* A temp window is not necessarily a top level window */
|
||||
dwStyle = (gdk_screen_get_root_window (screen) == real_parent ? WS_POPUP : WS_CHILDWINDOW);
|
||||
dwStyle = (gdk_display_get_root_window (display) == real_parent ? WS_POPUP : WS_CHILDWINDOW);
|
||||
dwStyle |= WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
|
||||
dwExStyle |= WS_EX_TOOLWINDOW | WS_EX_TOPMOST;
|
||||
offset_x = _gdk_offset_x;
|
||||
@ -897,7 +893,7 @@ gdk_win32_window_foreign_new_for_display (GdkDisplay *display,
|
||||
parent = GetParent (anid);
|
||||
|
||||
/* Always treat foreigns as toplevels */
|
||||
window->parent = gdk_get_default_root_window ();
|
||||
window->parent = gdk_display_get_root_window (gdk_display_get_default ());
|
||||
|
||||
window->parent->children = g_list_concat (&window->children_list_node, window->parent->children);
|
||||
|
||||
@ -1999,18 +1995,18 @@ gdk_win32_window_get_geometry (GdkWindow *window,
|
||||
gint *width,
|
||||
gint *height)
|
||||
{
|
||||
GdkScreen *screen;
|
||||
GdkDisplay *display;
|
||||
gboolean window_is_root;
|
||||
|
||||
screen = gdk_window_get_screen (window);
|
||||
display = gdk_window_get_display (window);
|
||||
|
||||
if (!window)
|
||||
{
|
||||
window = gdk_screen_get_root_window (screen);
|
||||
window = gdk_display_get_root_window (display);
|
||||
window_is_root = TRUE;
|
||||
}
|
||||
else
|
||||
window_is_root = (gdk_screen_get_root_window (screen) == window);
|
||||
window_is_root = (gdk_display_get_root_window (display) == window);
|
||||
|
||||
if (!GDK_WINDOW_DESTROYED (window))
|
||||
{
|
||||
@ -2038,7 +2034,7 @@ gdk_win32_window_get_geometry (GdkWindow *window,
|
||||
rect.right = pt.x;
|
||||
rect.bottom = pt.y;
|
||||
|
||||
if (gdk_screen_get_root_window (screen) == parent)
|
||||
if (gdk_display_get_root_window (display) == parent)
|
||||
{
|
||||
rect.left += _gdk_offset_x * impl->window_scale;
|
||||
rect.top += _gdk_offset_y * impl->window_scale;
|
||||
@ -5830,7 +5826,6 @@ gdk_window_impl_win32_class_init (GdkWindowImplWin32Class *klass)
|
||||
impl_class->lower = gdk_win32_window_lower;
|
||||
impl_class->restack_toplevel = gdk_win32_window_restack_toplevel;
|
||||
impl_class->move_resize = gdk_win32_window_move_resize;
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user