Commits (85)
......@@ -79,6 +79,8 @@ msys2-mingw64-meson:
name: "gtk3-${env:CI_JOB_NAME}-${env:CI_COMMIT_REF_NAME}"
paths:
- "_build/meson-logs"
- "_build/gdk/libgdk-3-0.dll"
- "_build/gtk/libgtk-3-0.dll"
msys2-mingw64-autotools:
when: manual
......
......@@ -15,7 +15,7 @@ meson \
-Dx11_backend=true \
-Dwayland_backend=true \
-Dxinerama=yes \
-Dprint_backends="file,lpr,test,cloudprint,cups" \
-Dprint_backends="file,lpr,test,cups" \
${EXTRA_MESON_FLAGS:-} \
_build
......
Overview of Changes in GTK+ 3.24.30
===================================
* Input:
- Ignore NoSymbol key events (happens with some XKB options)
- Fix incomplete reset in some cases
* GtkEmojiChooser:
- Update data from CLDR 39
- Support translated keywords for multiple languages
- Allow inserting multiple Emoji with Ctrl
- Match keywords for search
- Fix a memory leak
* GtkFileChooser:
- Accessibility improvements
* GtkTreeView
- Fix an accessibility-related memory leak
- Fix assertion failures in some cases
* Printing:
- Remove the Google Cloud Print backend, since the
service was shut down
* Wayland:
- Work with pointer-gestures v1 protocol
* Win32:
- Fix using GL with Mesa drivers
- Add support for Windows Pointer Input stack
* MacOS:
- Fix a crash with Drag-and-Drop
* Translation updates:
Belarusian
Brazilian Portuguese
British English
Catalan
Indonesian
Lithuanian
Nepali
Norwegian Bokmål
Occitan
Portuguese
Romanian
Russian
Serbian
Slovenian
Spanish
Turkish
Ukrainian
Overview of Changes in GTK+ 3.24.29
===================================
 
......
......@@ -15,6 +15,8 @@ the same compiler is used for at least GDK-Pixbuf, Pango, atk and glib
so that crashes and errors caused by different CRTs can be avoided. Currently
building with Visual Studio 2008 or later is supported, either via Visual Studio
project files or via the Meson build system, as described in the below sections.
For Visual Studio 2008, 2010, a special setup making use of the Windows 8.0 SDK
is required, see at the bottom of this document for guidance.
Interchanging between Visual Studio 2015, 2017 and 2019 builds should be fine
as they use the same CRT (UCRT) DLLs.
......@@ -286,6 +288,73 @@ If you are building with Visual Studio 2008, note the following items as well:
- The more modern visual style for the print dialog is not applied for Visual
Studio 2008 builds. Any solutions to this is really appreciated.
Support for pre-2012 Visual Studio
==================================
This release of GTK+ requires at least the Windows 8.0 SDK in order to be built
successfully using Visual Studio, which means that building with Visual Studio
2008 or 2010 is possible only with a special setup and must be done in the
command line with Ninja. Please see
https://devblogs.microsoft.com/cppblog/using-the-windows-software-development-kit-sdk-for-windows-8-consumer-preview-with-visual-studio-2010/
for references; basically, assuming that your Windows 8.0 SDK is installed in
`C:\Program Files (x86)\Windows Kits\8.0` (`$(WIN8SDKDIR)` in short), you need
to ensure the following before invoking Meson to configure the build:
- Your `%INCLUDE%` must not include the Windows 7.0/7.1 SDK include directories,
and `$(WIN8SDKDIR)\include\um`, `$(WIN8SDKDIR)\include\um\share` and
`$(WIN8SDKDIR)\include\winrt` (in this order) must be before your stock
Visual Studio 2008/2010 header directories. If you have the DirectX SDK installed,
you should remove its include directory from your `%INCLUDE%` as well.
- You must replace the Windows 7.0/7.1 SDK library directory in `%LIB%` with the
Windows 8.0 SDK library directory, i.e. `$(WIN8SDKDIR)\lib\win8\um\[x86|x64]`.
If you have the DirectX SDK installed, you should remove its library directory
from your `%INCLUDE%` as well.
- You must replace the Windows 7.0/7.1 SDK tools directory from your `%PATH%` with
the Windows 8.0 SDK tools directory, i.e. `$(WIN8SDKDIR)\bin\[x86|x64]`.
If you have the DirectX SDK installed, you should remove its utility directory
from your `%PATH%` as well.
The Windows 8.0 SDK headers may contain an `roapi.h` that cannot be used under plain
C, so to remedy that, change the following lines (around lines 55-57):
// RegisterActivationFactory/RevokeActivationFactory registration cookie
typedef struct {} *RO_REGISTRATION_COOKIE;
// RegisterActivationFactory/DllGetActivationFactory callback
to
// RegisterActivationFactory/RevokeActivationFactory registration cookie
#ifdef __cplusplus
typedef struct {} *RO_REGISTRATION_COOKIE;
#else
typedef struct _RO_REGISTRATION_COOKIE *RO_REGISTRATION_COOKIE; /* make this header includable in C files */
#endif
// RegisterActivationFactory/DllGetActivationFactory callback
This follows what is done in the Windows 8.1 SDK, which contains an `roapi.h`
that is usable under plain C. Please note that you might need to copy that file
into a location that is in your `%INCLUDE%` which precedes the include path for the
Windows 8.0 SDK headers, if you do not have administrative privileges.
Visual Studio 2008 hacks
========================
- You need to run the following lines from your build directory, to embed the
manifests that are generated during the build, assuming the built binaries
are installed to `$(PREFIX)`, after a successful build/installation:
```cmd
> for /r %f in (*.dll.manifest) do if exist $(PREFIX)\bin\%~nf mt /manifest %f (PREFIX)\bin\%~nf;2
> for /r %f in (*.exe.manifest) do if exist $(PREFIX)\bin\%~nf mt /manifest %f (PREFIX)\bin\%~nf;1
```
- If building for amd64/x86_64/x64, sometimes the compilation of sources may seem to hang, which
is caused by an optimization issue in the 2008 x64 compiler. You need to use Task Manager to
remove all running instances of `cl.exe`, which will cause the build process to terminate. Update
the build flags of the sources that hang on compilation by changing its `"/O2"` flag to `"/O1"`
in `build.ninja`, and retry the build, where things should continue to build normally.
Using GTK+ on Win32
===================
......@@ -302,13 +371,5 @@ cases, but not in general. Sorry. If you have all GTK+ and GDK calls
in the same thread, it might work. Otherwise, probably not at
all. Possible ways to fix this are being investigated.
Wintab
======
The tablet support uses the Wintab API. The Wintab development kit is
no longer required. The wintab.h header file is bundled with GTK+
sources. Unfortunately it seems that only Wacom tablets come with
support for the Wintab API nowadays.
--Tor Lillqvist <tml@iki.fi>, <tml@novell.com>
--Updated by Fan, Chun-wei <fanc999@yahoo.com.tw>
......@@ -10,8 +10,8 @@
m4_define([gtk_major_version], [3])
m4_define([gtk_minor_version], [24])
m4_define([gtk_micro_version], [29])
m4_define([gtk_interface_age], [25])
m4_define([gtk_micro_version], [30])
m4_define([gtk_interface_age], [26])
m4_define([gtk_binary_age],
[m4_eval(100 * gtk_minor_version + gtk_micro_version)])
m4_define([gtk_version],
......@@ -1576,38 +1576,6 @@ fi
AM_CONDITIONAL(HAVE_TRACKER3, test "x$have_tracker3" = "xyes")
# Checks to see if we should compile with cloudprint backend for GTK+
#
AC_ARG_ENABLE(cloudprint,
[AS_HELP_STRING([--disable-cloudprint],
[disable cloudprint print backend])],,
[enable_cloudprint=auto])
if test "x$enable_cloudprint" = "xno"; then
AM_CONDITIONAL(HAVE_CLOUDPRINT, false)
else
PKG_CHECK_MODULES(REST, [rest-0.7], have_rest=yes, have_rest=no)
PKG_CHECK_MODULES(JSON_GLIB, [json-glib-1.0], have_json_glib=yes, have_json_glib=no)
if test "x$have_rest" = "xyes" -a "x$have_json_glib" = "xyes"; then
PRINT_BACKENDS="$PRINT_BACKENDS cloudprint"
have_cloudprint=yes
fi
AM_CONDITIONAL(HAVE_CLOUDPRINT, test "x$have_cloudprint" = "xyes")
fi
if test "x$enable_cloudprint" = "xyes" -a "x$have_rest" = "xno"; then
AC_MSG_ERROR([
*** rest not found.
])
fi
if test "x$enable_cloudprint" = "xyes" -a "x$have_json_glib" = "xno"; then
AC_MSG_ERROR([
*** json-glib not found.
])
fi
gtk_save_cppflags="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $GTK_DEP_CFLAGS $GDK_DEP_CFLAGS"
......@@ -1650,9 +1618,6 @@ fi
if test "$have_papi" != "yes" -a "$have_cups" != "yes"; then
GTK_PRINT_BACKENDS="$GTK_PRINT_BACKENDS,lpr"
fi
if test "$have_cloudprint" = "yes"; then
GTK_PRINT_BACKENDS="$GTK_PRINT_BACKENDS,cloudprint"
fi
AC_SUBST(GTK_PRINT_BACKENDS)
################################################################
......@@ -1994,7 +1959,6 @@ modules/Makefile
modules/input/Makefile
modules/printbackends/Makefile
modules/printbackends/cups/Makefile
modules/printbackends/cloudprint/Makefile
modules/printbackends/lpr/Makefile
modules/printbackends/file/Makefile
modules/printbackends/papi/Makefile
......
......@@ -370,7 +370,7 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
paint_data = gdk_gl_context_get_paint_data (paint_context);
if (paint_data->tmp_framebuffer == 0)
glGenFramebuffersEXT (1, &paint_data->tmp_framebuffer);
glGenFramebuffers (1, &paint_data->tmp_framebuffer);
if (source_type == GL_RENDERBUFFER)
{
......@@ -423,10 +423,10 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
/* Create a framebuffer with the source renderbuffer and
make it the current target for reads */
framebuffer = paint_data->tmp_framebuffer;
glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, framebuffer);
glFramebufferRenderbufferEXT (GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
GL_RENDERBUFFER_EXT, source);
glBindFramebufferEXT (GL_DRAW_FRAMEBUFFER_EXT, 0);
glBindFramebuffer (GL_FRAMEBUFFER, framebuffer);
glFramebufferRenderbuffer (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
GL_RENDERBUFFER, source);
glBindFramebuffer (GL_DRAW_FRAMEBUFFER, 0);
/* Translate to impl coords */
cairo_region_translate (clip_region, dx, dy);
......@@ -481,11 +481,11 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
{
int clipped_src_x = x + (dest.x - dx * window_scale);
int clipped_src_y = y + (height - dest.height - (dest.y - dy * window_scale));
glBlitFramebufferEXT(clipped_src_x, clipped_src_y,
(clipped_src_x + dest.width), (clipped_src_y + dest.height),
dest.x, FLIP_Y(dest.y + dest.height),
dest.x + dest.width, FLIP_Y(dest.y),
GL_COLOR_BUFFER_BIT, GL_NEAREST);
glBlitFramebuffer (clipped_src_x, clipped_src_y,
(clipped_src_x + dest.width), (clipped_src_y + dest.height),
dest.x, FLIP_Y(dest.y + dest.height),
dest.x + dest.width, FLIP_Y(dest.y),
GL_COLOR_BUFFER_BIT, GL_NEAREST);
if (impl_window->current_paint.flushed_region)
{
cairo_rectangle_int_t flushed_rect;
......@@ -505,7 +505,7 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
glDisable (GL_SCISSOR_TEST);
glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0);
glBindFramebuffer (GL_FRAMEBUFFER, 0);
#undef FLIP_Y
......@@ -671,19 +671,19 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
cairo_surface_set_device_scale (image, buffer_scale, buffer_scale);
framebuffer = paint_data->tmp_framebuffer;
glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, framebuffer);
glBindFramebuffer (GL_FRAMEBUFFER, framebuffer);
if (source_type == GL_RENDERBUFFER)
{
/* Create a framebuffer with the source renderbuffer and
make it the current target for reads */
glFramebufferRenderbufferEXT (GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
GL_RENDERBUFFER_EXT, source);
glFramebufferRenderbuffer (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
GL_RENDERBUFFER, source);
}
else
{
glFramebufferTexture2DEXT (GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
GL_TEXTURE_2D, source, 0);
glFramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
GL_TEXTURE_2D, source, 0);
}
glPixelStorei (GL_PACK_ALIGNMENT, 4);
......@@ -699,7 +699,7 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
glPixelStorei (GL_PACK_ROW_LENGTH, 0);
glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0);
glBindFramebuffer (GL_FRAMEBUFFER, 0);
cairo_surface_mark_dirty (image);
......
......@@ -803,8 +803,7 @@ update_context_from_dragging_info (id <NSDraggingInfo> sender)
gdk_event_free (event);
g_object_unref (_gdk_quartz_drag_source_context);
_gdk_quartz_drag_source_context = NULL;
_gdk_quartz_drag_source_context_destroy_gtk_only ();
}
#ifdef AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER
......
......@@ -59,6 +59,14 @@ _gdk_quartz_window_drag_begin (GdkWindow *window,
return _gdk_quartz_drag_source_context;
}
void
_gdk_quartz_drag_source_context_destroy_gtk_only ()
{
if (_gdk_quartz_drag_source_context)
g_object_unref (_gdk_quartz_drag_source_context);
_gdk_quartz_drag_source_context = NULL;
}
static gboolean
gdk_quartz_drag_context_drag_motion (GdkDragContext *context,
GdkWindow *dest_window,
......
......@@ -79,14 +79,10 @@ typedef enum {
#define GDK_QUARTZ_EVENT_TABLET_PROXIMITY NSEventTypeTabletProximity
#define GDK_QUARTZ_EVENT_SUBTYPE_TABLET_PROXIMITY NSEventSubtypeTabletProximity
#define GDK_QUARTZ_EVENT_SUBTYPE_TABLET_POINT NSEventSubtypeTabletPoint
#elif MAC_OS_X_VERSION_MIN_REQUIRED >= 10120
#else
#define GDK_QUARTZ_EVENT_TABLET_PROXIMITY NSTabletProximity
#define GDK_QUARTZ_EVENT_SUBTYPE_TABLET_PROXIMITY NSTabletProximityEventSubtype
#define GDK_QUARTZ_EVENT_SUBTYPE_TABLET_POINT NSTabletPointEventSubtype
#else
#define GDK_QUARTZ_EVENT_TABLET_PROXIMITY kEventTabletProximity
#define GDK_QUARTZ_EVENT_SUBTYPE_TABLET_PROXIMITY NSTabletProximityEventSubtype
#define GDK_QUARTZ_EVENT_SUBTYPE_TABLET_POINT kCGEventMouseSubtypeTabletPoint
#endif
void _gdk_quartz_events_update_focus_window (GdkWindow *new_window,
......
......@@ -51,6 +51,9 @@ id gdk_quartz_drag_context_get_dragging_info_libgtk_only (GdkDragContext
GDK_AVAILABLE_IN_ALL
GdkDragContext *gdk_quartz_drag_source_context_libgtk_only (void);
GDK_AVAILABLE_IN_3_24
void _gdk_quartz_drag_source_context_destroy_gtk_only ();
G_END_DECLS
#endif /* __GDK_QUARTZ_DRAG_CONTEXT_H__ */
......@@ -2228,7 +2228,7 @@ _gdk_quartz_window_set_collection_behavior (NSWindow *nswindow,
GdkWindowTypeHint hint)
{
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 10110
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 101100
#define GDK_QUARTZ_ALLOWS_TILING NSWindowCollectionBehaviorFullScreenAllowsTiling
#define GDK_QUARTZ_DISALLOWS_TILING NSWindowCollectionBehaviorFullScreenDisallowsTiling
#else
......
......@@ -460,12 +460,12 @@ gdk_registry_handle_global (void *data,
display_wayland->subcompositor =
wl_registry_bind (display_wayland->wl_registry, id, &wl_subcompositor_interface, 1);
}
else if (strcmp (interface, "zwp_pointer_gestures_v1") == 0 &&
version == GDK_ZWP_POINTER_GESTURES_V1_VERSION)
else if (strcmp (interface, "zwp_pointer_gestures_v1") == 0)
{
display_wayland->pointer_gestures =
wl_registry_bind (display_wayland->wl_registry,
id, &zwp_pointer_gestures_v1_interface, version);
id, &zwp_pointer_gestures_v1_interface,
MIN (version, GDK_ZWP_POINTER_GESTURES_V1_VERSION));
}
else if (strcmp (interface, "gtk_primary_selection_device_manager") == 0)
{
......
......@@ -1638,7 +1638,21 @@ output_handle_geometry (void *data,
monitor->x = x;
monitor->y = y;
gdk_monitor_set_physical_size (GDK_MONITOR (monitor), physical_width, physical_height);
switch (transform)
{
case WL_OUTPUT_TRANSFORM_90:
case WL_OUTPUT_TRANSFORM_270:
case WL_OUTPUT_TRANSFORM_FLIPPED_90:
case WL_OUTPUT_TRANSFORM_FLIPPED_270:
gdk_monitor_set_physical_size (GDK_MONITOR (monitor),
physical_height, physical_width);
break;
default:
gdk_monitor_set_physical_size (GDK_MONITOR (monitor),
physical_width, physical_height);
}
gdk_monitor_set_subpixel_layout (GDK_MONITOR (monitor), subpixel);
gdk_monitor_set_manufacturer (GDK_MONITOR (monitor), make);
gdk_monitor_set_model (GDK_MONITOR (monitor), model);
......
......@@ -21,7 +21,10 @@ if WIN32_GLES
AM_CPPFLAGS += "-DGDK_WIN32_ENABLE_EGL=1"
endif #WIN32_GLES
LDADDS = $(GDK_DEP_LIBS)
libgdk_win32_DEP_LIBS = \
hid.lib
LDADDS = $(libgdk_win32_DEP_LIBS) $(GDK_DEP_LIBS)
noinst_LTLIBRARIES = libgdk-win32.la
......@@ -40,6 +43,8 @@ libgdk_win32_la_SOURCES = \
gdkdevice-virtual.h \
gdkdevice-win32.c \
gdkdevice-win32.h \
gdkdevice-winpointer.c \
gdkdevice-winpointer.h \
gdkdevice-wintab.c \
gdkdevice-wintab.h \
gdkdisplay-win32.c \
......
......@@ -117,7 +117,7 @@ gdk_device_win32_query_state (GdkDevice *device,
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
hwnd = GDK_WINDOW_HWND (window);
GetCursorPos (&point);
_gdk_win32_get_cursor_pos (&point);
if (root_x)
*root_x = point.x / impl->window_scale;
......@@ -215,7 +215,7 @@ _gdk_device_win32_window_at_position (GdkDevice *device,
HWND hwnd;
RECT rect;
if (!GetCursorPos (&screen_pt))
if (!_gdk_win32_get_cursor_pos (&screen_pt))
return NULL;
hwnd = WindowFromPoint (screen_pt);
......
/* 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/gdkwindow.h>
#include <windows.h>
#include "gdkwin32.h"
#include "gdkdevice-winpointer.h"
G_DEFINE_TYPE (GdkDeviceWinpointer, gdk_device_winpointer, GDK_TYPE_DEVICE)
static GdkModifierType
get_keyboard_mask (void)
{
GdkModifierType mask;
BYTE kbd[256];
GetKeyboardState (kbd);
mask = 0;
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_MOD1_MASK;
return mask;
}
static gboolean
gdk_device_winpointer_get_history (GdkDevice *device,
GdkWindow *window,
guint32 start,
guint32 stop,
GdkTimeCoord ***events,
gint *n_events)
{
return FALSE;
}
static void
gdk_device_winpointer_get_state (GdkDevice *device,
GdkWindow *window,
gdouble *axes,
GdkModifierType *mask)
{
GdkDeviceWinpointer *device_winpointer = GDK_DEVICE_WINPOINTER (device);
if (mask)
{
*mask = get_keyboard_mask ();
*mask |= device_winpointer->last_button_mask;
}
if (axes)
{
gsize size = sizeof (double) * device_winpointer->num_axes;
memcpy (axes, device_winpointer->last_axis_data, size);
}
}
static void
gdk_device_winpointer_set_window_cursor (GdkDevice *device,
GdkWindow *window,
GdkCursor *cursor)
{
}
static void
gdk_device_winpointer_warp (GdkDevice *device,
GdkScreen *screen,
gdouble x,
gdouble y)
{
}
static void
gdk_device_winpointer_query_state (GdkDevice *device,
GdkWindow *window,
GdkWindow **root_window,
GdkWindow **child_window,
gdouble *root_x,
gdouble *root_y,
gdouble *win_x,
gdouble *win_y,
GdkModifierType *mask)
{
GdkDeviceWinpointer *device_winpointer = GDK_DEVICE_WINPOINTER (device);
GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
GdkScreen *screen = gdk_window_get_screen (window);
HWND hwnd = GDK_WINDOW_HWND (window);
HWND hwndc = NULL;
POINT point;
_gdk_win32_get_cursor_pos (&point);
if (root_x)
*root_x = point.x / impl->window_scale;
if (root_y)
*root_y = point.y / impl->window_scale;
ScreenToClient (hwnd, &point);
if (win_x)
*win_x = point.x / impl->window_scale;
if (win_y)
*win_y = point.y / impl->window_scale;
if (window == gdk_screen_get_root_window (screen))
{
if (win_x)
*win_x += _gdk_offset_x;
if (win_y)
*win_y += _gdk_offset_y;
if (root_x)
*root_x += _gdk_offset_x;
if (root_y)
*root_y += _gdk_offset_y;
}
if (child_window)
{
if (window == gdk_screen_get_root_window (screen))
{
/* Always use WindowFromPoint when searching from the root window.
* Only WindowFromPoint is able to look through transparent
* layered windows.
*/
hwndc = GetAncestor (WindowFromPoint (point), GA_ROOT);
}
else
{
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 (root_window)
*root_window = gdk_screen_get_root_window (screen);
if (mask)
{
*mask = get_keyboard_mask ();
*mask |= device_winpointer->last_button_mask;
}
}
static GdkGrabStatus
gdk_device_winpointer_grab (GdkDevice *device,
GdkWindow *window,
gboolean owner_events,
GdkEventMask event_mask,
GdkWindow *confine_to,
GdkCursor *cursor,
guint32 time_)
{
return GDK_GRAB_SUCCESS;
}
static void
gdk_device_winpointer_ungrab (GdkDevice *device,
guint32 time_)
{
}
static void
screen_to_client (HWND hwnd, POINT screen_pt, POINT *client_pt)
{
*client_pt = screen_pt;
ScreenToClient (hwnd, client_pt);
}
GdkWindow *
_gdk_device_winpointer_window_at_position (GdkDevice *device,
gdouble *win_x,
gdouble *win_y,
GdkModifierType *mask,
gboolean get_toplevel)
{
GdkDeviceWinpointer *device_winpointer = GDK_DEVICE_WINPOINTER (device);
GdkWindow *window = NULL;
GdkWindowImplWin32 *impl = NULL;
POINT screen_pt, client_pt;
HWND hwnd;
RECT rect;
if (!_gdk_win32_get_cursor_pos (&screen_pt))
return NULL;
hwnd = WindowFromPoint (screen_pt);
if (get_toplevel)
{
/* Use WindowFromPoint instead of ChildWindowFromPoint(Ex).
* Only WindowFromPoint is able to look through transparent
* layered windows.
*/
hwnd = GetAncestor (hwnd, GA_ROOT);
}
/* Verify that we're really inside the client area of the window */
GetClientRect (hwnd, &rect);
screen_to_client (hwnd, screen_pt, &client_pt);
if (!PtInRect (&rect, client_pt))
hwnd = NULL;
if (!get_toplevel && hwnd == NULL)
{
/* If we didn't hit any window, return the root window */
/* note that the root window ain't a toplevel window */
window = gdk_get_default_root_window ();
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
if (win_x)
*win_x = (screen_pt.x + _gdk_offset_x) / impl->window_scale;
if (win_y)
*win_y = (screen_pt.y + _gdk_offset_y) / impl->window_scale;
return window;
}
window = gdk_win32_handle_table_lookup (hwnd);
if (window && (win_x || win_y))
{
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
if (win_x)
*win_x = client_pt.x / impl->window_scale;
if (win_y)
*win_y = client_pt.y / impl->window_scale;
}
if (mask)
{
*mask = get_keyboard_mask ();
*mask |= device_winpointer->last_button_mask;
}
return window;
}
static void
gdk_device_winpointer_select_window_events (GdkDevice *device,
GdkWindow *window,
GdkEventMask event_mask)
{
}
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_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->get_history = gdk_device_winpointer_get_history;
device_class->get_state = gdk_device_winpointer_get_state;
device_class->set_window_cursor = gdk_device_winpointer_set_window_cursor;
device_class->warp = gdk_device_winpointer_warp;
device_class->query_state = gdk_device_winpointer_query_state;
device_class->grab = gdk_device_winpointer_grab;
device_class->ungrab = gdk_device_winpointer_ungrab;
device_class->window_at_position = _gdk_device_winpointer_window_at_position;
device_class->select_window_events = gdk_device_winpointer_select_window_events;
}
/* gtkprintbackendcloudprint.h: Google Cloud Print implementation of
* GtkPrintBackend
* Copyright (C) 2014, Red Hat, Inc.
/* 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
......@@ -16,25 +15,50 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GTK_PRINT_BACKEND_CLOUDPRINT_H__
#define __GTK_PRINT_BACKEND_CLOUDPRINT_H__
#ifndef __GDK_DEVICE_WINPOINTER_H__
#define __GDK_DEVICE_WINPOINTER_H__
#include <glib-object.h>
#include "gtkprintbackend.h"
#include <gdk/gdkdeviceprivate.h>
#include <windows.h>
G_BEGIN_DECLS
#define GTK_TYPE_PRINT_BACKEND_CLOUDPRINT (gtk_print_backend_cloudprint_get_type ())
#define GTK_PRINT_BACKEND_CLOUDPRINT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_PRINT_BACKEND_CLOUDPRINT, GtkPrintBackendCloudprint))
#define GTK_IS_PRINT_BACKEND_CLOUDPRINT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_PRINT_BACKEND_CLOUDPRINT))
#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;
#define ONLINE_ACCOUNTS_BUS "org.gnome.OnlineAccounts"
double *last_axis_data;
unsigned num_axes;
GdkModifierType last_button_mask;
};
typedef struct _GtkPrintBackendCloudprint GtkPrintBackendCloudprint;
struct _GdkDeviceWinpointerClass
{
GdkDeviceClass parent_class;
};
GtkPrintBackend *gtk_print_backend_cloudprint_new (void);
GType gtk_print_backend_cloudprint_get_type (void) G_GNUC_CONST;
GType gdk_device_winpointer_get_type (void) G_GNUC_CONST;
G_END_DECLS
#endif /* __GTK_PRINT_BACKEND_CLOUDPRINT_H__ */
#endif /* __GDK_DEVICE_WINPOINTER_H__ */
......@@ -128,7 +128,7 @@ gdk_device_wintab_query_state (GdkDevice *device,
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
hwnd = GDK_WINDOW_HWND (window);
GetCursorPos (&point);
_gdk_win32_get_cursor_pos (&point);
if (root_x)
*root_x = point.x / impl->window_scale;
......
This diff is collapsed.
......@@ -41,6 +41,8 @@ struct _GdkDeviceManagerWin32
/* Fake slave devices */
GdkDevice *system_pointer;
GdkDevice *system_keyboard;
GList *winpointer_devices;
GList *wintab_devices;
/* Bumped up every time a wintab device enters the proximity
......@@ -57,11 +59,31 @@ struct _GdkDeviceManagerWin32Class
GType gdk_device_manager_win32_get_type (void) G_GNUC_CONST;
void _gdk_input_set_tablet_active (void);
gboolean gdk_input_other_event (GdkDisplay *display,
GdkEvent *event,
MSG *msg,
GdkWindow *window);
typedef void
(*crossing_cb_t)(GdkDisplay *display,
GdkDevice *device,
GdkWindow *window,
POINT *screen_pt,
guint32 time_);
void gdk_winpointer_initialize_window (GdkWindow *window);
gboolean gdk_winpointer_should_forward_message (MSG *msg);
void gdk_winpointer_input_events (GdkDisplay *display,
GdkWindow *window,
crossing_cb_t crossing_cb,
MSG *msg);
gboolean gdk_winpointer_get_message_info (GdkDisplay *display,
MSG *msg,
GdkDevice **device,
guint32 *time_);
void gdk_winpointer_interaction_ended (MSG *msg);
void gdk_winpointer_finalize_window (GdkWindow *window);
void _gdk_wintab_set_tablet_active (void);
gboolean gdk_wintab_input_events (GdkDisplay *display,
GdkEvent *event,
MSG *msg,
GdkWindow *window);
G_END_DECLS
......