mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 02:40:11 +00:00
Move the _gdk_win32_pointer_input_api global variable into GdkWin32Display
This commit is contained in:
parent
58e65ae7dd
commit
c02bae9e08
@ -31,6 +31,7 @@
|
||||
#include "gdkdevice-wintab.h"
|
||||
#include "gdkinput-winpointer.h"
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include "gdkdisplay-win32.h"
|
||||
#include "gdkseatdefaultprivate.h"
|
||||
|
||||
#define WINTAB32_DLL "Wintab32.dll"
|
||||
@ -682,12 +683,13 @@ wintab_default_display_notify_cb (GdkDisplayManager *display_manager)
|
||||
static void
|
||||
gdk_device_manager_win32_constructed (GObject *object)
|
||||
{
|
||||
GdkWin32Display *display_win32;
|
||||
GdkDeviceManagerWin32 *device_manager;
|
||||
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;
|
||||
const char *api_preference = NULL;
|
||||
gboolean have_api_preference = TRUE;
|
||||
|
||||
display_win32 = GDK_WIN32_DISPLAY (_gdk_display);
|
||||
|
||||
device_manager = GDK_DEVICE_MANAGER_WIN32 (object);
|
||||
device_manager->core_pointer =
|
||||
@ -730,35 +732,44 @@ gdk_device_manager_win32_constructed (GObject *object)
|
||||
|
||||
_gdk_device_manager = device_manager;
|
||||
|
||||
tablet_input_api_user_preference = g_getenv ("GDK_WIN32_TABLET_INPUT_API");
|
||||
if (g_strcmp0 (tablet_input_api_user_preference, "none") == 0)
|
||||
api_preference = g_getenv ("GDK_WIN32_TABLET_INPUT_API");
|
||||
if (g_strcmp0 (api_preference, "none") == 0)
|
||||
{
|
||||
have_tablet_input_api_preference = TRUE;
|
||||
_gdk_win32_tablet_input_api = GDK_WIN32_TABLET_INPUT_API_NONE;
|
||||
display_win32->tablet_input_api = GDK_WIN32_TABLET_INPUT_API_NONE;
|
||||
}
|
||||
else if (g_strcmp0 (tablet_input_api_user_preference, "wintab") == 0)
|
||||
else if (g_strcmp0 (api_preference, "wintab") == 0)
|
||||
{
|
||||
have_tablet_input_api_preference = TRUE;
|
||||
_gdk_win32_tablet_input_api = GDK_WIN32_TABLET_INPUT_API_WINTAB;
|
||||
display_win32->tablet_input_api = GDK_WIN32_TABLET_INPUT_API_WINTAB;
|
||||
}
|
||||
else if (g_strcmp0 (tablet_input_api_user_preference, "winpointer") == 0)
|
||||
else if (g_strcmp0 (api_preference, "winpointer") == 0)
|
||||
{
|
||||
have_tablet_input_api_preference = TRUE;
|
||||
_gdk_win32_tablet_input_api = GDK_WIN32_TABLET_INPUT_API_WINPOINTER;
|
||||
display_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;
|
||||
/* No user preference, default to WinPointer. If unsuccessful,
|
||||
* try to initialize other API's in sequence until one succeeds.
|
||||
*/
|
||||
display_win32->tablet_input_api = GDK_WIN32_TABLET_INPUT_API_WINPOINTER;
|
||||
have_api_preference = FALSE;
|
||||
}
|
||||
|
||||
if (_gdk_win32_tablet_input_api == GDK_WIN32_TABLET_INPUT_API_WINPOINTER)
|
||||
if (display_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;
|
||||
gboolean init_successful = gdk_winpointer_initialize ();
|
||||
|
||||
if (!init_successful && !have_api_preference)
|
||||
{
|
||||
/* Try Wintab */
|
||||
display_win32->tablet_input_api = GDK_WIN32_TABLET_INPUT_API_WINTAB;
|
||||
}
|
||||
}
|
||||
if (_gdk_win32_tablet_input_api == GDK_WIN32_TABLET_INPUT_API_WINTAB)
|
||||
|
||||
if (display_win32->tablet_input_api == GDK_WIN32_TABLET_INPUT_API_WINTAB)
|
||||
{
|
||||
GdkDisplayManager *display_manager = NULL;
|
||||
GdkDisplay *default_display = NULL;
|
||||
|
||||
/* Only call Wintab init stuff after the default display
|
||||
* is globally known and accessible through the display manager
|
||||
* singleton. Approach lifted from gtkmodules.c.
|
||||
|
@ -99,6 +99,12 @@ typedef struct _GdkWin32User32DPIFuncs
|
||||
funcADACE areDACEqual;
|
||||
} GdkWin32User32DPIFuncs;
|
||||
|
||||
typedef enum {
|
||||
GDK_WIN32_TABLET_INPUT_API_NONE,
|
||||
GDK_WIN32_TABLET_INPUT_API_WINTAB,
|
||||
GDK_WIN32_TABLET_INPUT_API_WINPOINTER
|
||||
} GdkWin32TabletInputAPI;
|
||||
|
||||
/* Detect running architecture */
|
||||
typedef BOOL (WINAPI *funcIsWow64Process2) (HANDLE, USHORT *, USHORT *);
|
||||
typedef struct _GdkWin32KernelCPUFuncs
|
||||
@ -159,7 +165,9 @@ struct _GdkWin32Display
|
||||
|
||||
GdkWin32ShcoreFuncs shcore_funcs;
|
||||
GdkWin32User32DPIFuncs user32_dpi_funcs;
|
||||
|
||||
|
||||
GdkWin32TabletInputAPI tablet_input_api;
|
||||
|
||||
/* Cursor Items (GdkCursor->GdkWin32HCursor) */
|
||||
GHashTable *cursors;
|
||||
/* The cursor that is used by current grab (if any) */
|
||||
|
@ -2345,7 +2345,7 @@ gdk_event_translate (MSG *msg,
|
||||
* https://devblogs.microsoft.com/oldnewthing/20031001-00/?p=42343
|
||||
*
|
||||
*/
|
||||
if (_gdk_win32_tablet_input_api == GDK_WIN32_TABLET_INPUT_API_WINPOINTER &&
|
||||
if (win32_display->tablet_input_api == GDK_WIN32_TABLET_INPUT_API_WINPOINTER &&
|
||||
( (msg->time - last_digitizer_time) < 200 ||
|
||||
-(msg->time - last_digitizer_time) < 200 ))
|
||||
break;
|
||||
@ -2496,7 +2496,7 @@ gdk_event_translate (MSG *msg,
|
||||
break;
|
||||
|
||||
case WM_POINTERDOWN:
|
||||
if (_gdk_win32_tablet_input_api != GDK_WIN32_TABLET_INPUT_API_WINPOINTER ||
|
||||
if (win32_display->tablet_input_api != GDK_WIN32_TABLET_INPUT_API_WINPOINTER ||
|
||||
gdk_winpointer_should_forward_message (msg))
|
||||
{
|
||||
return_val = FALSE;
|
||||
@ -2526,7 +2526,7 @@ gdk_event_translate (MSG *msg,
|
||||
break;
|
||||
|
||||
case WM_POINTERUP:
|
||||
if (_gdk_win32_tablet_input_api != GDK_WIN32_TABLET_INPUT_API_WINPOINTER ||
|
||||
if (win32_display->tablet_input_api != GDK_WIN32_TABLET_INPUT_API_WINPOINTER ||
|
||||
gdk_winpointer_should_forward_message (msg))
|
||||
{
|
||||
return_val = FALSE;
|
||||
@ -2559,7 +2559,7 @@ gdk_event_translate (MSG *msg,
|
||||
break;
|
||||
|
||||
case WM_POINTERUPDATE:
|
||||
if (_gdk_win32_tablet_input_api != GDK_WIN32_TABLET_INPUT_API_WINPOINTER ||
|
||||
if (win32_display->tablet_input_api != GDK_WIN32_TABLET_INPUT_API_WINPOINTER ||
|
||||
gdk_winpointer_should_forward_message (msg))
|
||||
{
|
||||
return_val = FALSE;
|
||||
@ -2598,7 +2598,7 @@ gdk_event_translate (MSG *msg,
|
||||
break;
|
||||
|
||||
case WM_NCPOINTERUPDATE:
|
||||
if (_gdk_win32_tablet_input_api != GDK_WIN32_TABLET_INPUT_API_WINPOINTER ||
|
||||
if (win32_display->tablet_input_api != GDK_WIN32_TABLET_INPUT_API_WINPOINTER ||
|
||||
gdk_winpointer_should_forward_message (msg))
|
||||
{
|
||||
return_val = FALSE;
|
||||
@ -2633,7 +2633,7 @@ gdk_event_translate (MSG *msg,
|
||||
break;
|
||||
|
||||
case WM_POINTERENTER:
|
||||
if (_gdk_win32_tablet_input_api != GDK_WIN32_TABLET_INPUT_API_WINPOINTER ||
|
||||
if (win32_display->tablet_input_api != GDK_WIN32_TABLET_INPUT_API_WINPOINTER ||
|
||||
gdk_winpointer_should_forward_message (msg))
|
||||
{
|
||||
return_val = FALSE;
|
||||
@ -2663,7 +2663,7 @@ gdk_event_translate (MSG *msg,
|
||||
break;
|
||||
|
||||
case WM_POINTERLEAVE:
|
||||
if (_gdk_win32_tablet_input_api != GDK_WIN32_TABLET_INPUT_API_WINPOINTER ||
|
||||
if (win32_display->tablet_input_api != GDK_WIN32_TABLET_INPUT_API_WINPOINTER ||
|
||||
gdk_winpointer_should_forward_message (msg))
|
||||
{
|
||||
return_val = FALSE;
|
||||
@ -3219,7 +3219,7 @@ gdk_event_translate (MSG *msg,
|
||||
break;
|
||||
|
||||
case WM_DESTROY:
|
||||
if (_gdk_win32_tablet_input_api == GDK_WIN32_TABLET_INPUT_API_WINPOINTER)
|
||||
if (win32_display->tablet_input_api == GDK_WIN32_TABLET_INPUT_API_WINPOINTER)
|
||||
gdk_winpointer_finalize_surface (window);
|
||||
|
||||
return_val = FALSE;
|
||||
@ -3305,7 +3305,7 @@ gdk_event_translate (MSG *msg,
|
||||
{
|
||||
gdk_synthesize_surface_state (window, 0, GDK_TOPLEVEL_STATE_FOCUSED);
|
||||
|
||||
if (_gdk_win32_tablet_input_api == GDK_WIN32_TABLET_INPUT_API_WINTAB)
|
||||
if (win32_display->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.
|
||||
@ -3362,7 +3362,7 @@ gdk_event_translate (MSG *msg,
|
||||
/* Fall through */
|
||||
wintab:
|
||||
|
||||
if (_gdk_win32_tablet_input_api == GDK_WIN32_TABLET_INPUT_API_WINTAB)
|
||||
if (win32_display->tablet_input_api == GDK_WIN32_TABLET_INPUT_API_WINTAB)
|
||||
{
|
||||
event = gdk_wintab_make_event (display, msg, window);
|
||||
if (event)
|
||||
|
@ -37,7 +37,6 @@ 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;
|
||||
|
@ -147,12 +147,6 @@ typedef enum
|
||||
GDK_DRAG_PROTO_OLE2,
|
||||
} 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,7 +271,6 @@ 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.
|
||||
|
@ -646,7 +646,7 @@ _gdk_win32_display_create_surface (GdkDisplay *display,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (_gdk_win32_tablet_input_api == GDK_WIN32_TABLET_INPUT_API_WINPOINTER)
|
||||
if (display_win32->tablet_input_api == GDK_WIN32_TABLET_INPUT_API_WINPOINTER)
|
||||
gdk_winpointer_initialize_surface (surface);
|
||||
|
||||
_gdk_win32_surface_enable_transparency (surface);
|
||||
|
Loading…
Reference in New Issue
Block a user