Compare commits
12 Commits
ebassi/css
...
matthiasc/
Author | SHA1 | Date | |
---|---|---|---|
|
00ddcef38f | ||
|
697e05cb80 | ||
|
833c18f5e9 | ||
|
599f9ff984 | ||
|
6c75fbb77c | ||
|
dc36bf61cd | ||
|
f8ff200918 | ||
|
6448111296 | ||
|
2e42216e44 | ||
|
f753be69b7 | ||
|
d615d27c3c | ||
|
9d18913fa8 |
@@ -14,14 +14,19 @@ instructions, binary downloads, etc, can be found
|
||||
The Win32 GDK backend can be influenced with some additional environment
|
||||
variables.
|
||||
|
||||
### GDK_IGNORE_WINTAB
|
||||
### GDK_WIN32_TABLET_INPUT_API
|
||||
|
||||
If this variable is set, GTK doesn't use the Wintab API for tablet support.
|
||||
If this variable is set, it determines the API that GTK uses for tablet support.
|
||||
The possible values are:
|
||||
|
||||
### GDK_USE_WINTAB
|
||||
`none`
|
||||
: Disables tablet support
|
||||
|
||||
If this variable is set, GTK uses the Wintab API for tablet support.
|
||||
This is the default.
|
||||
`wintab`
|
||||
: Use the Wintab API
|
||||
|
||||
`winpointer`
|
||||
: Use the Windows Pointer Input Stack API. This is the default.
|
||||
|
||||
## Windows-specific handling of cursors
|
||||
|
||||
|
188
gdk/win32/gdkdevice-winpointer.c
Normal file
188
gdk/win32/gdkdevice-winpointer.c
Normal file
@@ -0,0 +1,188 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
* Copyright (C) 2020 the GTK team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gdk/gdksurface.h>
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include "gdkwin32.h"
|
||||
#include "gdkdevice-winpointer.h"
|
||||
#include "gdkdisplay-win32.h"
|
||||
|
||||
G_DEFINE_TYPE (GdkDeviceWinpointer, gdk_device_winpointer, GDK_TYPE_DEVICE)
|
||||
|
||||
static GdkModifierType
|
||||
get_keyboard_mask (void)
|
||||
{
|
||||
GdkModifierType mask = 0;
|
||||
BYTE kbd[256];
|
||||
|
||||
GetKeyboardState (kbd);
|
||||
if (kbd[VK_SHIFT] & 0x80)
|
||||
mask |= GDK_SHIFT_MASK;
|
||||
if (kbd[VK_CAPITAL] & 0x80)
|
||||
mask |= GDK_LOCK_MASK;
|
||||
if (kbd[VK_CONTROL] & 0x80)
|
||||
mask |= GDK_CONTROL_MASK;
|
||||
if (kbd[VK_MENU] & 0x80)
|
||||
mask |= GDK_ALT_MASK;
|
||||
|
||||
return mask;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_device_winpointer_set_surface_cursor (GdkDevice *device,
|
||||
GdkSurface *window,
|
||||
GdkCursor *cursor)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
gdk_device_winpointer_query_state (GdkDevice *device,
|
||||
GdkSurface *window,
|
||||
GdkSurface **child_window,
|
||||
double *win_x,
|
||||
double *win_y,
|
||||
GdkModifierType *mask)
|
||||
{
|
||||
GdkDeviceWinpointer *device_winpointer;
|
||||
POINT point;
|
||||
HWND hwnd, hwndc;
|
||||
int scale;
|
||||
|
||||
device_winpointer = GDK_DEVICE_WINPOINTER (device);
|
||||
if (window)
|
||||
{
|
||||
scale = GDK_WIN32_SURFACE (window)->surface_scale;
|
||||
hwnd = GDK_SURFACE_HWND (window);
|
||||
}
|
||||
else
|
||||
{
|
||||
GdkDisplay *display = gdk_device_get_display (device);
|
||||
|
||||
scale = GDK_WIN32_DISPLAY (display)->surface_scale;
|
||||
hwnd = NULL;
|
||||
}
|
||||
|
||||
GetCursorPos (&point);
|
||||
|
||||
if (hwnd)
|
||||
ScreenToClient (hwnd, &point);
|
||||
|
||||
if (win_x)
|
||||
*win_x = point.x / scale;
|
||||
|
||||
if (win_y)
|
||||
*win_y = point.y / scale;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
if (win_x)
|
||||
*win_x += _gdk_offset_x;
|
||||
|
||||
if (win_y)
|
||||
*win_y += _gdk_offset_y;
|
||||
}
|
||||
|
||||
if (hwnd && child_window)
|
||||
{
|
||||
hwndc = ChildWindowFromPoint (hwnd, point);
|
||||
|
||||
if (hwndc && hwndc != hwnd)
|
||||
*child_window = gdk_win32_handle_table_lookup (hwndc);
|
||||
else
|
||||
*child_window = NULL; /* Direct child unknown to gdk */
|
||||
}
|
||||
|
||||
if (mask)
|
||||
{
|
||||
*mask = get_keyboard_mask ();
|
||||
*mask |= device_winpointer->last_button_mask;
|
||||
}
|
||||
}
|
||||
|
||||
static GdkGrabStatus
|
||||
gdk_device_winpointer_grab (GdkDevice *device,
|
||||
GdkSurface *window,
|
||||
gboolean owner_events,
|
||||
GdkEventMask event_mask,
|
||||
GdkSurface *confine_to,
|
||||
GdkCursor *cursor,
|
||||
guint32 time_)
|
||||
{
|
||||
return GDK_GRAB_SUCCESS;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_device_winpointer_ungrab (GdkDevice *device,
|
||||
guint32 time_)
|
||||
{
|
||||
}
|
||||
|
||||
static GdkSurface *
|
||||
gdk_device_winpointer_surface_at_position (GdkDevice *device,
|
||||
double *win_x,
|
||||
double *win_y,
|
||||
GdkModifierType *mask)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_device_winpointer_init (GdkDeviceWinpointer *device_winpointer)
|
||||
{
|
||||
device_winpointer->device_handle = NULL;
|
||||
device_winpointer->start_cursor_id = 0;
|
||||
device_winpointer->end_cursor_id = 0;
|
||||
|
||||
device_winpointer->origin_x = 0;
|
||||
device_winpointer->origin_y = 0;
|
||||
device_winpointer->scale_x = 0.0;
|
||||
device_winpointer->scale_y = 0.0;
|
||||
|
||||
device_winpointer->last_axis_data = NULL;
|
||||
device_winpointer->num_axes = 0;
|
||||
device_winpointer->last_button_mask = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_device_winpointer_finalize (GObject *object)
|
||||
{
|
||||
GdkDeviceWinpointer *device_winpointer = GDK_DEVICE_WINPOINTER (object);
|
||||
|
||||
g_clear_object (&device_winpointer->tool_pen);
|
||||
g_clear_object (&device_winpointer->tool_eraser);
|
||||
|
||||
g_free (device_winpointer->last_axis_data);
|
||||
|
||||
G_OBJECT_CLASS (gdk_device_winpointer_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_device_winpointer_class_init (GdkDeviceWinpointerClass *klass)
|
||||
{
|
||||
GdkDeviceClass *device_class = GDK_DEVICE_CLASS (klass);
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->finalize = gdk_device_winpointer_finalize;
|
||||
device_class->set_surface_cursor = gdk_device_winpointer_set_surface_cursor;
|
||||
device_class->grab = gdk_device_winpointer_grab;
|
||||
device_class->ungrab = gdk_device_winpointer_ungrab;
|
||||
device_class->surface_at_position = gdk_device_winpointer_surface_at_position;
|
||||
}
|
67
gdk/win32/gdkdevice-winpointer.h
Normal file
67
gdk/win32/gdkdevice-winpointer.h
Normal file
@@ -0,0 +1,67 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
* Copyright (C) 2020 the GTK team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GDK_DEVICE_WINPOINTER_H__
|
||||
#define __GDK_DEVICE_WINPOINTER_H__
|
||||
|
||||
#include <gdk/gdkdeviceprivate.h>
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GDK_TYPE_DEVICE_WINPOINTER (gdk_device_winpointer_get_type ())
|
||||
#define GDK_DEVICE_WINPOINTER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDK_TYPE_DEVICE_WINPOINTER, GdkDeviceWinpointer))
|
||||
#define GDK_DEVICE_WINPOINTER_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), GDK_TYPE_DEVICE_WINPOINTER, GdkDeviceWinpointerClass))
|
||||
#define GDK_IS_DEVICE_WINPOINTER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_DEVICE_WINPOINTER))
|
||||
#define GDK_IS_DEVICE_WINPOINTER_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), GDK_TYPE_DEVICE_WINPOINTER))
|
||||
#define GDK_DEVICE_WINPOINTER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDK_TYPE_DEVICE_WINPOINTER, GdkDeviceWinpointerClass))
|
||||
|
||||
typedef struct _GdkDeviceWinpointer GdkDeviceWinpointer;
|
||||
typedef struct _GdkDeviceWinpointerClass GdkDeviceWinpointerClass;
|
||||
|
||||
struct _GdkDeviceWinpointer
|
||||
{
|
||||
GdkDevice parent_instance;
|
||||
|
||||
HANDLE device_handle;
|
||||
UINT32 start_cursor_id;
|
||||
UINT32 end_cursor_id;
|
||||
|
||||
int origin_x;
|
||||
int origin_y;
|
||||
double scale_x;
|
||||
double scale_y;
|
||||
|
||||
double *last_axis_data;
|
||||
unsigned num_axes;
|
||||
GdkModifierType last_button_mask;
|
||||
|
||||
GdkDeviceTool *tool_pen;
|
||||
GdkDeviceTool *tool_eraser;
|
||||
};
|
||||
|
||||
struct _GdkDeviceWinpointerClass
|
||||
{
|
||||
GdkDeviceClass parent_class;
|
||||
};
|
||||
|
||||
GType gdk_device_winpointer_get_type (void) G_GNUC_CONST;
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_DEVICE_WINPOINTER_H__ */
|
@@ -29,6 +29,7 @@
|
||||
#include "gdkdevice-win32.h"
|
||||
#include "gdkdevice-virtual.h"
|
||||
#include "gdkdevice-wintab.h"
|
||||
#include "gdkinput-winpointer.h"
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include "gdkseatdefaultprivate.h"
|
||||
|
||||
@@ -371,9 +372,6 @@ wintab_init_check (GdkDeviceManagerWin32 *device_manager)
|
||||
|
||||
wintab_contexts = NULL;
|
||||
|
||||
if (_gdk_input_ignore_wintab)
|
||||
return;
|
||||
|
||||
n = GetSystemDirectory (&dummy, 0);
|
||||
|
||||
if (n <= 0)
|
||||
@@ -688,6 +686,8 @@ gdk_device_manager_win32_constructed (GObject *object)
|
||||
GdkSeat *seat;
|
||||
GdkDisplayManager *display_manager = NULL;
|
||||
GdkDisplay *default_display = NULL;
|
||||
const char *tablet_input_api_user_preference = NULL;
|
||||
gboolean have_tablet_input_api_preference = FALSE;
|
||||
|
||||
device_manager = GDK_DEVICE_MANAGER_WIN32 (object);
|
||||
device_manager->core_pointer =
|
||||
@@ -728,18 +728,48 @@ gdk_device_manager_win32_constructed (GObject *object)
|
||||
gdk_seat_default_add_physical_device (GDK_SEAT_DEFAULT (seat), device_manager->system_keyboard);
|
||||
g_object_unref (seat);
|
||||
|
||||
/* Only call Wintab init stuff after the default display
|
||||
* is globally known and accessible through the display manager
|
||||
* singleton. Approach lifted from gtkmodules.c.
|
||||
*/
|
||||
display_manager = gdk_display_manager_get ();
|
||||
g_assert (display_manager != NULL);
|
||||
default_display = gdk_display_manager_get_default_display (display_manager);
|
||||
g_assert (default_display == NULL);
|
||||
tablet_input_api_user_preference = g_getenv ("GDK_WIN32_TABLET_INPUT_API");
|
||||
if (g_strcmp0 (tablet_input_api_user_preference, "none") == 0)
|
||||
{
|
||||
have_tablet_input_api_preference = TRUE;
|
||||
_gdk_win32_tablet_input_api = GDK_WIN32_TABLET_INPUT_API_NONE;
|
||||
}
|
||||
else if (g_strcmp0 (tablet_input_api_user_preference, "wintab") == 0)
|
||||
{
|
||||
have_tablet_input_api_preference = TRUE;
|
||||
_gdk_win32_tablet_input_api = GDK_WIN32_TABLET_INPUT_API_WINTAB;
|
||||
}
|
||||
else if (g_strcmp0 (tablet_input_api_user_preference, "winpointer") == 0)
|
||||
{
|
||||
have_tablet_input_api_preference = TRUE;
|
||||
_gdk_win32_tablet_input_api = GDK_WIN32_TABLET_INPUT_API_WINPOINTER;
|
||||
}
|
||||
else
|
||||
{
|
||||
have_tablet_input_api_preference = FALSE;
|
||||
_gdk_win32_tablet_input_api = GDK_WIN32_TABLET_INPUT_API_WINPOINTER;
|
||||
}
|
||||
|
||||
g_signal_connect (display_manager, "notify::default-display",
|
||||
G_CALLBACK (wintab_default_display_notify_cb),
|
||||
NULL);
|
||||
if (_gdk_win32_tablet_input_api == GDK_WIN32_TABLET_INPUT_API_WINPOINTER)
|
||||
{
|
||||
if (!gdk_winpointer_initialize () && !have_tablet_input_api_preference)
|
||||
_gdk_win32_tablet_input_api = GDK_WIN32_TABLET_INPUT_API_WINTAB;
|
||||
}
|
||||
if (_gdk_win32_tablet_input_api == GDK_WIN32_TABLET_INPUT_API_WINTAB)
|
||||
{
|
||||
/* Only call Wintab init stuff after the default display
|
||||
* is globally known and accessible through the display manager
|
||||
* singleton. Approach lifted from gtkmodules.c.
|
||||
*/
|
||||
display_manager = gdk_display_manager_get ();
|
||||
g_assert (display_manager != NULL);
|
||||
default_display = gdk_display_manager_get_default_display (display_manager);
|
||||
g_assert (default_display == NULL);
|
||||
|
||||
g_signal_connect (display_manager, "notify::default-display",
|
||||
G_CALLBACK (wintab_default_display_notify_cb),
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -752,7 +782,7 @@ gdk_device_manager_win32_class_init (GdkDeviceManagerWin32Class *klass)
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_input_set_tablet_active (void)
|
||||
_gdk_wintab_set_tablet_active (void)
|
||||
{
|
||||
GList *tmp_list;
|
||||
HCTX *hctx;
|
||||
@@ -763,7 +793,7 @@ _gdk_input_set_tablet_active (void)
|
||||
if (!wintab_contexts)
|
||||
return; /* No tablet devices found, or Wintab not initialized yet */
|
||||
|
||||
GDK_NOTE (INPUT, g_print ("_gdk_input_set_tablet_active: "
|
||||
GDK_NOTE (INPUT, g_print ("_gdk_wintab_set_tablet_active: "
|
||||
"Bringing Wintab contexts to the top of the overlap order\n"));
|
||||
|
||||
tmp_list = wintab_contexts;
|
||||
@@ -866,7 +896,7 @@ gdk_device_manager_find_wintab_device (GdkDeviceManagerWin32 *device_manager,
|
||||
}
|
||||
|
||||
GdkEvent *
|
||||
gdk_input_other_event (GdkDisplay *display,
|
||||
gdk_wintab_make_event (GdkDisplay *display,
|
||||
MSG *msg,
|
||||
GdkSurface *window)
|
||||
{
|
||||
@@ -894,7 +924,7 @@ gdk_input_other_event (GdkDisplay *display,
|
||||
|
||||
if (window != wintab_window)
|
||||
{
|
||||
g_warning ("gdk_input_other_event: not wintab_window?");
|
||||
g_warning ("gdk_wintab_make_event: not wintab_window?");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -905,7 +935,7 @@ gdk_input_other_event (GdkDisplay *display,
|
||||
g_object_ref (window);
|
||||
|
||||
GDK_NOTE (EVENTS_OR_INPUT,
|
||||
g_print ("gdk_input_other_event: window=%p %+g%+g\n",
|
||||
g_print ("gdk_wintab_make_event: window=%p %+g%+g\n",
|
||||
window ? GDK_SURFACE_HWND (window) : NULL, x, y));
|
||||
|
||||
if (msg->message == WT_PACKET || msg->message == WT_CSRCHANGE)
|
||||
|
@@ -40,6 +40,8 @@ struct _GdkDeviceManagerWin32
|
||||
/* Fake physical devices */
|
||||
GdkDevice *system_pointer;
|
||||
GdkDevice *system_keyboard;
|
||||
|
||||
GList *winpointer_devices;
|
||||
GList *wintab_devices;
|
||||
|
||||
/* Bumped up every time a wintab device enters the proximity
|
||||
@@ -56,8 +58,8 @@ struct _GdkDeviceManagerWin32Class
|
||||
|
||||
GType gdk_device_manager_win32_get_type (void) G_GNUC_CONST;
|
||||
|
||||
void _gdk_input_set_tablet_active (void);
|
||||
GdkEvent * gdk_input_other_event (GdkDisplay *display,
|
||||
void _gdk_wintab_set_tablet_active (void);
|
||||
GdkEvent * gdk_wintab_make_event (GdkDisplay *display,
|
||||
MSG *msg,
|
||||
GdkSurface *window);
|
||||
|
||||
|
@@ -18,7 +18,6 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#define _WIN32_WINNT 0x0600
|
||||
#define VK_USE_PLATFORM_WIN32_KHR
|
||||
|
||||
#include "gdk.h"
|
||||
|
@@ -55,7 +55,9 @@
|
||||
#include "gdkdevicemanager-win32.h"
|
||||
#include "gdkdisplay-win32.h"
|
||||
#include "gdkdeviceprivate.h"
|
||||
#include "gdkdevice-virtual.h"
|
||||
#include "gdkdevice-wintab.h"
|
||||
#include "gdkinput-winpointer.h"
|
||||
#include "gdkwin32dnd.h"
|
||||
#include "gdkwin32dnd-private.h"
|
||||
#include "gdkdisplay-win32.h"
|
||||
@@ -70,8 +72,9 @@
|
||||
#endif
|
||||
|
||||
#include <objbase.h>
|
||||
|
||||
#include <imm.h>
|
||||
#include <tchar.h>
|
||||
#include <tpcshrd.h>
|
||||
|
||||
#define GDK_MOD2_MASK (1 << 4)
|
||||
|
||||
@@ -1035,11 +1038,12 @@ do_show_window (GdkSurface *window, gboolean hide_window)
|
||||
|
||||
static void
|
||||
send_crossing_event (GdkDisplay *display,
|
||||
GdkSurface *window,
|
||||
GdkDevice *physical_device,
|
||||
GdkSurface *window,
|
||||
GdkEventType type,
|
||||
GdkCrossingMode mode,
|
||||
GdkNotifyType notify_type,
|
||||
GdkSurface *subwindow,
|
||||
GdkSurface *subwindow,
|
||||
POINT *screen_pt,
|
||||
GdkModifierType mask,
|
||||
guint32 time_)
|
||||
@@ -1066,16 +1070,18 @@ send_crossing_event (GdkDisplay *display,
|
||||
pt = *screen_pt;
|
||||
ScreenToClient (GDK_SURFACE_HWND (window), &pt);
|
||||
|
||||
_gdk_device_virtual_set_active (_gdk_device_manager->core_pointer, physical_device);
|
||||
|
||||
event = gdk_crossing_event_new (type,
|
||||
window,
|
||||
device_manager->core_pointer,
|
||||
_gdk_win32_get_next_tick (time_),
|
||||
time_,
|
||||
mask,
|
||||
pt.x / impl->surface_scale,
|
||||
pt.y / impl->surface_scale,
|
||||
mode,
|
||||
notify_type);
|
||||
|
||||
|
||||
_gdk_win32_append_event (event);
|
||||
}
|
||||
|
||||
@@ -1118,8 +1124,9 @@ find_common_ancestor (GdkSurface *win1,
|
||||
|
||||
void
|
||||
synthesize_crossing_events (GdkDisplay *display,
|
||||
GdkSurface *src,
|
||||
GdkSurface *dest,
|
||||
GdkDevice *physical_device,
|
||||
GdkSurface *src,
|
||||
GdkSurface *dest,
|
||||
GdkCrossingMode mode,
|
||||
POINT *screen_pt,
|
||||
GdkModifierType mask,
|
||||
@@ -1152,6 +1159,7 @@ synthesize_crossing_events (GdkDisplay *display,
|
||||
else
|
||||
notify_type = GDK_NOTIFY_ANCESTOR;
|
||||
send_crossing_event (display,
|
||||
physical_device,
|
||||
a, GDK_LEAVE_NOTIFY,
|
||||
mode,
|
||||
notify_type,
|
||||
@@ -1171,6 +1179,7 @@ synthesize_crossing_events (GdkDisplay *display,
|
||||
while (win != c && win != NULL)
|
||||
{
|
||||
send_crossing_event (display,
|
||||
physical_device,
|
||||
win, GDK_LEAVE_NOTIFY,
|
||||
mode,
|
||||
notify_type,
|
||||
@@ -1213,6 +1222,7 @@ synthesize_crossing_events (GdkDisplay *display,
|
||||
next = b;
|
||||
|
||||
send_crossing_event (display,
|
||||
physical_device,
|
||||
win, GDK_ENTER_NOTIFY,
|
||||
mode,
|
||||
notify_type,
|
||||
@@ -1232,6 +1242,7 @@ synthesize_crossing_events (GdkDisplay *display,
|
||||
notify_type = GDK_NOTIFY_INFERIOR;
|
||||
|
||||
send_crossing_event (display,
|
||||
physical_device,
|
||||
b, GDK_ENTER_NOTIFY,
|
||||
mode,
|
||||
notify_type,
|
||||
@@ -1525,6 +1536,9 @@ generate_button_event (GdkEventType type,
|
||||
current_x = (gint16) GET_X_LPARAM (msg->lParam) / impl->surface_scale;
|
||||
current_y = (gint16) GET_Y_LPARAM (msg->lParam) / impl->surface_scale;
|
||||
|
||||
_gdk_device_virtual_set_active (_gdk_device_manager->core_pointer,
|
||||
_gdk_device_manager->system_pointer);
|
||||
|
||||
event = gdk_button_event_new (type,
|
||||
window,
|
||||
device_manager->core_pointer,
|
||||
@@ -2244,11 +2258,12 @@ gdk_event_translate (MSG *msg,
|
||||
}
|
||||
|
||||
synthesize_crossing_events (display,
|
||||
_gdk_device_manager->system_pointer,
|
||||
implicit_grab_surface, new_window,
|
||||
GDK_CROSSING_UNGRAB,
|
||||
&msg->pt,
|
||||
0, /* TODO: Set right mask */
|
||||
msg->time,
|
||||
_gdk_win32_get_next_tick (msg->time),
|
||||
FALSE);
|
||||
g_set_object (&implicit_grab_surface, NULL);
|
||||
g_set_object (&mouse_window, new_window);
|
||||
@@ -2308,11 +2323,12 @@ gdk_event_translate (MSG *msg,
|
||||
mouse_window ? GDK_SURFACE_HWND (mouse_window) : NULL,
|
||||
new_window ? GDK_SURFACE_HWND (new_window) : NULL));
|
||||
synthesize_crossing_events (display,
|
||||
_gdk_device_manager->system_pointer,
|
||||
mouse_window, new_window,
|
||||
GDK_CROSSING_NORMAL,
|
||||
&msg->pt,
|
||||
0, /* TODO: Set right mask */
|
||||
msg->time,
|
||||
_gdk_win32_get_next_tick (msg->time),
|
||||
FALSE);
|
||||
g_set_object (&mouse_window, new_window);
|
||||
mouse_window_ignored_leave = NULL;
|
||||
@@ -2350,6 +2366,9 @@ gdk_event_translate (MSG *msg,
|
||||
current_x = (gint16) GET_X_LPARAM (msg->lParam) / impl->surface_scale;
|
||||
current_y = (gint16) GET_Y_LPARAM (msg->lParam) / impl->surface_scale;
|
||||
|
||||
_gdk_device_virtual_set_active (_gdk_device_manager->core_pointer,
|
||||
_gdk_device_manager->system_pointer);
|
||||
|
||||
event = gdk_motion_event_new (window,
|
||||
device_manager_win32->core_pointer,
|
||||
NULL,
|
||||
@@ -2400,11 +2419,12 @@ gdk_event_translate (MSG *msg,
|
||||
|
||||
if (!ignore_leave)
|
||||
synthesize_crossing_events (display,
|
||||
_gdk_device_manager->system_pointer,
|
||||
mouse_window, new_window,
|
||||
GDK_CROSSING_NORMAL,
|
||||
&msg->pt,
|
||||
0, /* TODO: Set right mask */
|
||||
msg->time,
|
||||
_gdk_win32_get_next_tick (msg->time),
|
||||
FALSE);
|
||||
g_set_object (&mouse_window, new_window);
|
||||
mouse_window_ignored_leave = ignore_leave ? new_window : NULL;
|
||||
@@ -2954,6 +2974,13 @@ gdk_event_translate (MSG *msg,
|
||||
*ret_valp = 0;
|
||||
break;
|
||||
|
||||
case WM_DESTROY:
|
||||
if (_gdk_win32_tablet_input_api == GDK_WIN32_TABLET_INPUT_API_WINPOINTER)
|
||||
gdk_winpointer_finalize_surface (window);
|
||||
|
||||
return_val = FALSE;
|
||||
break;
|
||||
|
||||
case WM_NCDESTROY:
|
||||
if ((pointer_grab != NULL && pointer_grab->surface == window) ||
|
||||
(keyboard_grab && keyboard_grab->surface == window))
|
||||
@@ -3034,12 +3061,15 @@ gdk_event_translate (MSG *msg,
|
||||
{
|
||||
gdk_synthesize_surface_state (window, 0, GDK_TOPLEVEL_STATE_FOCUSED);
|
||||
|
||||
/* Bring any tablet contexts to the top of the overlap order when
|
||||
* one of our windows is activated.
|
||||
* NOTE: It doesn't seem to work well if it is done in WM_ACTIVATEAPP
|
||||
* instead
|
||||
*/
|
||||
_gdk_input_set_tablet_active ();
|
||||
if (_gdk_win32_tablet_input_api == GDK_WIN32_TABLET_INPUT_API_WINTAB)
|
||||
{
|
||||
/* Bring any tablet contexts to the top of the overlap order when
|
||||
* one of our windows is activated.
|
||||
* NOTE: It doesn't seem to work well if it is done in WM_ACTIVATEAPP
|
||||
* instead
|
||||
*/
|
||||
_gdk_wintab_set_tablet_active ();
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -3056,6 +3086,16 @@ gdk_event_translate (MSG *msg,
|
||||
GET_Y_LPARAM (msg->lParam), ret_valp);
|
||||
break;
|
||||
|
||||
case WM_TABLET_QUERYSYSTEMGESTURESTATUS:
|
||||
*ret_valp = TABLET_DISABLE_PRESSANDHOLD |
|
||||
TABLET_DISABLE_PENTAPFEEDBACK |
|
||||
TABLET_DISABLE_PENBARRELFEEDBACK |
|
||||
TABLET_DISABLE_FLICKS |
|
||||
TABLET_DISABLE_FLICKFALLBACKKEYS;
|
||||
return_val = TRUE;
|
||||
break;
|
||||
|
||||
|
||||
/* Handle WINTAB events here, as we know that the device manager will
|
||||
* use the fixed WT_DEFBASE as lcMsgBase, and we thus can use the
|
||||
* constants as case labels.
|
||||
@@ -3078,11 +3118,14 @@ gdk_event_translate (MSG *msg,
|
||||
/* Fall through */
|
||||
wintab:
|
||||
|
||||
event = gdk_input_other_event (display, msg, window);
|
||||
if (event)
|
||||
if (_gdk_win32_tablet_input_api == GDK_WIN32_TABLET_INPUT_API_WINTAB)
|
||||
{
|
||||
_gdk_win32_append_event (event);
|
||||
gdk_event_unref (event);
|
||||
event = gdk_wintab_make_event (display, msg, window);
|
||||
if (event)
|
||||
{
|
||||
_gdk_win32_append_event (event);
|
||||
gdk_event_unref (event);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
@@ -37,14 +37,12 @@ HINSTANCE _gdk_dll_hinstance;
|
||||
HINSTANCE _gdk_app_hmodule;
|
||||
|
||||
int _gdk_input_ignore_core;
|
||||
GdkWin32TabletInputAPI _gdk_win32_tablet_input_api;
|
||||
|
||||
HKL _gdk_input_locale;
|
||||
gboolean _gdk_input_locale_is_ime = FALSE;
|
||||
UINT _gdk_input_codepage;
|
||||
|
||||
int _gdk_input_ignore_wintab = FALSE;
|
||||
int _gdk_max_colors = 0;
|
||||
|
||||
GdkWin32ModalOpKind _modal_operation_in_progress = GDK_WIN32_MODAL_OP_NONE;
|
||||
HWND _modal_move_resize_window = NULL;
|
||||
|
||||
|
1114
gdk/win32/gdkinput-winpointer.c
Normal file
1114
gdk/win32/gdkinput-winpointer.c
Normal file
File diff suppressed because it is too large
Load Diff
41
gdk/win32/gdkinput-winpointer.h
Normal file
41
gdk/win32/gdkinput-winpointer.h
Normal file
@@ -0,0 +1,41 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
* Copyright (C) 2021 the GTK team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GDK_INPUT_WINPOINTER_H__
|
||||
#define __GDK_INPUT_WINPOINTER_H__
|
||||
|
||||
gboolean gdk_winpointer_initialize (void);
|
||||
|
||||
void gdk_winpointer_initialize_surface (GdkSurface *surface);
|
||||
void gdk_winpointer_finalize_surface (GdkSurface *surface);
|
||||
|
||||
typedef void
|
||||
(*crossing_cb_t)(GdkDevice *device,
|
||||
GdkWindow *window,
|
||||
POINT *screen_pt,
|
||||
guint32 time_);
|
||||
|
||||
gboolean gdk_winpointer_should_forward_message (MSG *msg);
|
||||
void gdk_winpointer_input_events (GdkWindow *window,
|
||||
crossing_cb_t crossing_cb,
|
||||
MSG *msg);
|
||||
gboolean gdk_winpointer_get_message_info (MSG *msg,
|
||||
GdkDevice **device,
|
||||
guint32 *time_);
|
||||
void gdk_winpointer_interaction_ended (MSG *msg);
|
||||
|
||||
#endif /* __GDK_INPUT_WINPOINTER_H__ */
|
@@ -54,11 +54,6 @@ _gdk_win32_surfaceing_init (void)
|
||||
{
|
||||
char buf[10];
|
||||
|
||||
if (getenv ("GDK_IGNORE_WINTAB") != NULL)
|
||||
_gdk_input_ignore_wintab = TRUE;
|
||||
else if (getenv ("GDK_USE_WINTAB") != NULL)
|
||||
_gdk_input_ignore_wintab = FALSE;
|
||||
|
||||
if (gdk_synchronize)
|
||||
GdiSetBatchLimit (1);
|
||||
|
||||
|
@@ -15,22 +15,6 @@
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if defined (_WIN32_WINNT) && WIN32_WINNT < 0x0601
|
||||
# undef _WIN32_WINNT
|
||||
|
||||
# define _WIN32_WINNT 0x0601
|
||||
# ifdef WINVER
|
||||
# undef WINVER
|
||||
# endif
|
||||
# define WINVER _WIN32_WINNT
|
||||
#elif !defined (_WIN32_WINNT)
|
||||
# define _WIN32_WINNT 0x0601
|
||||
# ifdef WINVER
|
||||
# undef WINVER
|
||||
# endif
|
||||
# define WINVER _WIN32_WINNT
|
||||
#endif
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gdkprivate-win32.h"
|
||||
|
@@ -25,15 +25,6 @@
|
||||
#ifndef __GDK_PRIVATE_WIN32_H__
|
||||
#define __GDK_PRIVATE_WIN32_H__
|
||||
|
||||
#ifndef WINVER
|
||||
/* Vista or newer */
|
||||
#define WINVER 0x0600
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32_WINNT
|
||||
#define _WIN32_WINNT WINVER
|
||||
#endif
|
||||
|
||||
#include <gdk/gdkcursorprivate.h>
|
||||
#include <gdk/win32/gdksurface-win32.h>
|
||||
#include <gdk/win32/gdkwin32display.h>
|
||||
@@ -157,6 +148,12 @@ typedef enum
|
||||
GDK_DRAG_PROTO_LOCAL,
|
||||
} GdkDragProtocol;
|
||||
|
||||
typedef enum {
|
||||
GDK_WIN32_TABLET_INPUT_API_NONE = 0,
|
||||
GDK_WIN32_TABLET_INPUT_API_WINTAB,
|
||||
GDK_WIN32_TABLET_INPUT_API_WINPOINTER
|
||||
} GdkWin32TabletInputAPI;
|
||||
|
||||
GType _gdk_gc_win32_get_type (void);
|
||||
|
||||
gulong _gdk_win32_get_next_tick (gulong suggested_tick);
|
||||
@@ -277,6 +274,7 @@ extern HINSTANCE _gdk_dll_hinstance;
|
||||
extern HINSTANCE _gdk_app_hmodule;
|
||||
|
||||
extern int _gdk_input_ignore_core;
|
||||
extern GdkWin32TabletInputAPI _gdk_win32_tablet_input_api;
|
||||
|
||||
/* These are thread specific, but GDK/win32 works OK only when invoked
|
||||
* from a single thread anyway.
|
||||
@@ -313,11 +311,6 @@ extern HWND _modal_move_resize_window;
|
||||
void _gdk_win32_begin_modal_call (GdkWin32ModalOpKind kind);
|
||||
void _gdk_win32_end_modal_call (GdkWin32ModalOpKind kind);
|
||||
|
||||
|
||||
/* Options */
|
||||
extern gboolean _gdk_input_ignore_wintab;
|
||||
extern int _gdk_max_colors;
|
||||
|
||||
/* Convert a pixbuf to an HICON (or HCURSOR). Supports alpha under
|
||||
* Windows XP, thresholds alpha otherwise.
|
||||
*/
|
||||
|
@@ -17,8 +17,6 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#define _WIN32_WINNT 0x0600
|
||||
|
||||
#include "gdk.h"
|
||||
#include "gdkprivate-win32.h"
|
||||
#include "gdkwin32screen.h"
|
||||
|
@@ -43,6 +43,7 @@
|
||||
#include "gdkmonitorprivate.h"
|
||||
#include "gdkwin32surface.h"
|
||||
#include "gdkwin32cursor.h"
|
||||
#include "gdkinput-winpointer.h"
|
||||
#include "gdkglcontext-win32.h"
|
||||
#include "gdkdisplay-win32.h"
|
||||
#include "gdkdevice-win32.h"
|
||||
@@ -645,6 +646,9 @@ _gdk_win32_display_create_surface (GdkDisplay *display,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (_gdk_win32_tablet_input_api == GDK_WIN32_TABLET_INPUT_API_WINPOINTER)
|
||||
gdk_winpointer_initialize_surface (surface);
|
||||
|
||||
_gdk_win32_surface_enable_transparency (surface);
|
||||
_gdk_win32_surface_register_dnd (surface);
|
||||
|
||||
|
@@ -6,6 +6,7 @@ gdk_win32_sources = files([
|
||||
'gdkdevicemanager-win32.c',
|
||||
'gdkdevice-virtual.c',
|
||||
'gdkdevice-win32.c',
|
||||
'gdkdevice-winpointer.c',
|
||||
'gdkdevice-wintab.c',
|
||||
'gdkdisplay-win32.c',
|
||||
'gdkdisplaymanager-win32.c',
|
||||
@@ -15,6 +16,7 @@ gdk_win32_sources = files([
|
||||
'gdkglcontext-win32.c',
|
||||
'gdkglobals-win32.c',
|
||||
'gdkhdataoutputstream-win32.c',
|
||||
'gdkinput-winpointer.c',
|
||||
'gdkkeys-win32.c',
|
||||
'gdkwin32langnotification.c',
|
||||
'gdkmain-win32.c',
|
||||
@@ -43,23 +45,31 @@ gdk_win32_public_headers = files([
|
||||
|
||||
install_headers(gdk_win32_public_headers, 'gdkwin32.h', subdir: 'gtk-4.0/gdk/win32/')
|
||||
|
||||
GDK_WIN32_EGL_CFLAGS = []
|
||||
gdk_win32_cflags = [
|
||||
'-DGTK_COMPILATION',
|
||||
'-DG_LOG_DOMAIN="Gdk"',
|
||||
'-DINSIDE_GDK_WIN32',
|
||||
]
|
||||
|
||||
gdk_win32_cflags += [
|
||||
'-D_WIN32_WINNT=0x0602', # Windows 8
|
||||
'-Isdkddkver.h',
|
||||
]
|
||||
|
||||
if win32_has_egl
|
||||
GDK_WIN32_EGL_CFLAGS = ['-DGDK_WIN32_ENABLE_EGL']
|
||||
gdk_win32_cflags += [
|
||||
'-DGDK_WIN32_ENABLE_EGL'
|
||||
]
|
||||
endif
|
||||
|
||||
gdk_win32_deps = [ # FIXME
|
||||
pangowin32_dep
|
||||
gdk_win32_deps = [
|
||||
pangowin32_dep, # FIXME
|
||||
cc.find_library('hid'),
|
||||
]
|
||||
|
||||
libgdk_win32 = static_library('gdk-win32',
|
||||
gdk_win32_sources, gdkconfig, gdkenum_h,
|
||||
include_directories: [ confinc, gdkinc ],
|
||||
c_args: [
|
||||
'-DGTK_COMPILATION',
|
||||
'-DG_LOG_DOMAIN="Gdk"',
|
||||
'-DINSIDE_GDK_WIN32',
|
||||
] + GDK_WIN32_EGL_CFLAGS,
|
||||
c_args: gdk_win32_cflags,
|
||||
dependencies: [ gdk_deps, gdk_win32_deps ],
|
||||
)
|
||||
|
Reference in New Issue
Block a user