Commit 7047099f authored by Paolo Borelli's avatar Paolo Borelli

Win32: fold the gdkinput.c file in gdkdisplay-win32.c

This is similar to what is done in the X11 and wayland backends.
It also gets rid of the _gdk_input_devices global variable
parent b3a80180
......@@ -312,7 +312,6 @@ w32_introspection_files = \
win32/gdkevents-win32.c \
win32/gdkgeometry-win32.c \
win32/gdkglobals-win32.c \
win32/gdkinput.c \
win32/gdkkeys-win32.c \
win32/gdkmain-win32.c \
win32/gdkproperty-win32.c \
......
......@@ -45,7 +45,6 @@ libgdk_win32_la_SOURCES = \
gdkglcontext-win32.c \
gdkglcontext-win32.h \
gdkglobals-win32.c \
gdkinput.c \
gdkkeys-win32.c \
gdkmain-win32.c \
gdkprivate-win32.h \
......
......@@ -20,6 +20,7 @@
#include "gdk.h"
#include "gdkprivate-win32.h"
#include "gdkdisplay-win32.h"
#include "gdkdevicemanager-win32.h"
#include "gdkglcontext-win32.h"
#include "gdkwin32display.h"
#include "gdkwin32screen.h"
......@@ -28,6 +29,37 @@
static int debug_indent = 0;
static GList *
gdk_win32_display_list_devices (GdkDisplay *display)
{
g_return_val_if_fail (display == gdk_display_get_default (), NULL);
return GDK_WIN32_DISPLAY (display)->input_devices;
}
static void
_gdk_input_init (GdkDisplay *display)
{
GdkDeviceManagerWin32 *device_manager;
GList *devices;
_gdk_input_ignore_core = FALSE;
device_manager = g_object_new (GDK_TYPE_DEVICE_MANAGER_WIN32,
"display", display,
NULL);
display->device_manager = GDK_DEVICE_MANAGER (device_manager);
display->core_pointer = device_manager->core_pointer;
devices = g_list_append (NULL, display->core_pointer);
devices = g_list_concat (devices, g_list_copy (device_manager->wintab_devices));
GDK_WIN32_DISPLAY (display)->input_devices = devices;
_gdk_input_wintab_init_check (GDK_DEVICE_MANAGER (device_manager));
}
/**
* gdk_win32_display_set_cursor_theme:
* @display: (type GdkWin32Display): a #GdkDisplay
......@@ -624,6 +656,8 @@ gdk_win32_display_finalize (GObject *object)
{
GdkWin32Display *display_win32 = GDK_WIN32_DISPLAY (object);
g_list_free (display_win32->input_devices);
_gdk_win32_display_finalize_cursors (display_win32);
_gdk_win32_dnd_exit ();
......@@ -691,7 +725,7 @@ gdk_win32_display_class_init (GdkWin32DisplayClass *klass)
display_class->supports_input_shapes = gdk_win32_display_supports_input_shapes;
display_class->supports_composite = gdk_win32_display_supports_composite;
display_class->list_devices = _gdk_win32_display_list_devices;
display_class->list_devices = gdk_win32_display_list_devices;
//? display_class->get_app_launch_context = _gdk_win32_display_get_app_launch_context;
display_class->get_cursor_for_type = _gdk_win32_display_get_cursor_for_type;
display_class->get_cursor_for_name = _gdk_win32_display_get_cursor_for_name;
......
......@@ -28,6 +28,8 @@ struct _GdkWin32Display
GdkScreen *screen;
GList *input_devices;
Win32CursorTheme *cursor_theme;
gchar *cursor_theme_name;
int cursor_theme_size;
......
......@@ -3376,7 +3376,7 @@ gdk_event_translate (MSG *msg,
GET_Y_LPARAM (msg->lParam), ret_valp);
break;
/* Handle WINTAB events here, as we know that gdkinput.c will
/* 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.
*/
......
......@@ -35,6 +35,8 @@ HDC _gdk_display_hdc;
HINSTANCE _gdk_dll_hinstance;
HINSTANCE _gdk_app_hmodule;
gboolean _gdk_input_ignore_core;
HKL _gdk_input_locale;
gboolean _gdk_input_locale_is_ime;
UINT _gdk_input_codepage;
......
/* GDK - The GIMP Drawing Kit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* 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/>.
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
/* This file should really be one level up, in the backend-independent
* GDK, and the x11/gdkinput.c could also be removed.
*
* That stuff in x11/gdkinput.c which really *is* X11-dependent should
* be in x11/gdkinput-x11.c.
*/
#include "config.h"
#include "gdkdisplay.h"
#include "gdkdevice.h"
#include "gdkdisplayprivate.h"
#include "gdkprivate-win32.h"
#include "gdkdevicemanager-win32.h"
gint _gdk_input_ignore_core;
GList *_gdk_input_devices;
GList *_gdk_input_windows;
GList *
_gdk_win32_display_list_devices (GdkDisplay *dpy)
{
g_return_val_if_fail (dpy == _gdk_display, NULL);
return _gdk_input_devices;
}
void
_gdk_input_init (GdkDisplay *display)
{
GdkDeviceManagerWin32 *device_manager;
_gdk_input_ignore_core = FALSE;
device_manager = g_object_new (GDK_TYPE_DEVICE_MANAGER_WIN32,
"display", display,
NULL);
display->device_manager = GDK_DEVICE_MANAGER (device_manager);
display->core_pointer = device_manager->core_pointer;
_gdk_input_devices = g_list_append (NULL, display->core_pointer);
_gdk_input_devices = g_list_concat (_gdk_input_devices,
g_list_copy (device_manager->wintab_devices));
_gdk_input_wintab_init_check (GDK_DEVICE_MANAGER (device_manager));
}
......@@ -268,6 +268,8 @@ extern HDC _gdk_display_hdc;
extern HINSTANCE _gdk_dll_hinstance;
extern HINSTANCE _gdk_app_hmodule;
extern gboolean _gdk_input_ignore_core;
/* These are thread specific, but GDK/win32 works OK only when invoked
* from a single thread anyway.
*/
......@@ -539,7 +541,6 @@ void _gdk_monitor_init(GdkWin32Screen *screen);
void _gdk_visual_init (GdkScreen *screen);
void _gdk_dnd_init (void);
void _gdk_events_init (void);
void _gdk_input_init (GdkDisplay *display);
void _gdk_input_wintab_init_check (GdkDeviceManager *device_manager);
#endif /* __GDK_PRIVATE_WIN32_H__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment