Compare commits

..

1 Commits

Author SHA1 Message Date
Chun-wei Fan 127685ef22 laguage-names.c: Windows: Look for iso-codes dynamically
Use the internal APIs _gtk_get_localedir() and gtk_get_datadir() to look for
the XML files and translations for iso-codes, instead of using a path defined
at build time, on Windows.
2022-01-06 17:54:37 +08:00
173 changed files with 23977 additions and 22940 deletions
+2 -7
View File
@@ -25,7 +25,7 @@ variables:
BACKEND_FLAGS: "-Dx11-backend=true -Dwayland-backend=true -Dbroadway-backend=true"
FEATURE_FLAGS: "-Dvulkan=enabled -Dcloudproviders=enabled"
MESON_TEST_TIMEOUT_MULTIPLIER: 3
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v36"
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v35"
FLATPAK_IMAGE: "registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master"
.only-default:
@@ -88,7 +88,7 @@ fedora-x86_64:
- meson compile -C _build
- meson install -C _build
- PKG_CONFIG_PATH=${CI_PROJECT_DIR}/_install/lib64/pkgconfig:${CI_PROJECT_DIR}/_install/share/pkgconfig meson setup _build_hello examples/hello
- LD_LIBRARY_PATH=${CI_PROJECT_DIR}/_install/lib64 meson compile -C _build_hello
- meson compile -C _build_hello
- .gitlab-ci/run-tests.sh _build x11
- .gitlab-ci/run-tests.sh _build wayland
- .gitlab-ci/run-tests.sh _build waylandgles
@@ -156,11 +156,6 @@ msys2-mingw64:
variables:
MSYSTEM: "MINGW64"
CHERE_INVOKING: "yes"
artifacts:
when: always
expose_as: 'Windows_DLL_MSYS2_64_bit_toolchain'
paths:
- "${CI_PROJECT_DIR}/_build/gtkdll.tar.gz"
macos:
extends: .only-default
-2
View File
@@ -95,8 +95,6 @@ RUN dnf -y install \
weston-libs \
which \
xorg-x11-server-Xvfb \
&& dnf install -y 'dnf-command(builddep)' \
&& dnf builddep -y wayland \
&& dnf clean all
# Enable sudo for wheel users
-2
View File
@@ -73,5 +73,3 @@ unset CCACHE_DISABLE
ninja -C _build
ccache --show-stats
tar zcf _build/gtkdll.tar.gz _build/gtk/libgtk*.dll
+2 -69
View File
@@ -1,72 +1,5 @@
Overview of Changes in 4.6.1, 11-02-2022
========================================
* GtkFontChooser:
- Stop using PangoFc api
- Fix a crash
- Use new HarfBuzz api
* GtkMenuButton:
- Update accessible description
* GtkTextView:
- Fix intra-widget dnd
* Printing:
- Fix an fd leak
* Input:
- Make sure input methods get focus-in events
- Always flush events to avoid scroll event pileup
- Support hold events
- Update keysyms from libxkbcommon
* Theme:
- Improve text selection legibility
* Introspection:
- Add missing nullable annotations everywhere
* Build:
- Make stack noexec again
- Avoid symbol leaks
- Drop unneeded script data
* Windows:
- Stop using WM_SYNCPAINT
- Relax check for GL 3.x legacy contexts
- Use native apis for language names
- Rewrite the keymap code
- Use the GL renderer by default
* Wayland:
- Fix support for the new high-contrast setting
- Avoid redundant scale changes
- Fix DND hotspot handling
- Don't always restore the saved size when floating
* MacOS:
- Various performance improvements
* Translation updates:
Brazilian Portuguese
Catalan
Chinese (China)
Galician
Hebrew
Japanese
Lithuanian
Persian
Polish
Portuguese
Russian
Slovenian
Spanish
Ukrainian
Overview of Changes in 4.6.0, 30-12-2021
========================================
Overview of Changes
===================
* GtkProgressBar:
- Fix handling of "inverted"
+1 -2
View File
@@ -43,8 +43,7 @@
"sources" : [
{
"type" : "git",
"url" : "https://gitlab.freedesktop.org/wayland/wayland.git",
"branch" : "main"
"url" : "https://gitlab.freedesktop.org/wayland/wayland.git"
}
]
},
+1 -2
View File
@@ -43,8 +43,7 @@
"sources" : [
{
"type" : "git",
"url" : "https://gitlab.freedesktop.org/wayland/wayland.git",
"branch" : "main"
"url" : "https://gitlab.freedesktop.org/wayland/wayland.git"
}
]
},
@@ -43,8 +43,7 @@
"sources" : [
{
"type" : "git",
"url" : "https://gitlab.freedesktop.org/wayland/wayland.git",
"branch" : "main"
"url" : "https://gitlab.freedesktop.org/wayland/wayland.git"
}
]
},
+4 -4
View File
@@ -13,7 +13,7 @@ if 'DESTDIR' not in os.environ:
gtk_moduledir = os.path.join(gtk_libdir, 'gtk-' + gtk_api_version, gtk_abi_version)
gtk_printmodule_dir = os.path.join(gtk_moduledir, 'printbackends')
gtk_mediamodule_dir = os.path.join(gtk_moduledir, 'media')
gtk_immodule_dir = os.path.join(gtk_moduledir, 'immodules')
print('Compiling GSettings schemas...')
glib_compile_schemas = subprocess.check_output(['pkg-config',
@@ -40,6 +40,6 @@ if 'DESTDIR' not in os.environ:
gio_querymodules = 'gio-querymodules'
subprocess.call([gio_querymodules, gtk_printmodule_dir])
print('Updating module cache for media backends...')
os.makedirs(gtk_mediamodule_dir, exist_ok=True)
subprocess.call([gio_querymodules, gtk_mediamodule_dir])
print('Updating module cache for input methods...')
os.makedirs(gtk_immodule_dir, exist_ok=True)
subprocess.call([gio_querymodules, gtk_immodule_dir])
+1
View File
@@ -12,6 +12,7 @@
*/
#include <gtk/gtk.h>
#include <pango/pangofc-font.h>
#include <hb.h>
#include <hb-ot.h>
#include <glib/gi18n.h>
-72
View File
@@ -18,81 +18,15 @@
#include "language-names.h"
#ifdef G_OS_WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#else
#ifndef ISO_CODES_PREFIX
#define ISO_CODES_PREFIX "/usr"
#endif
#define ISO_CODES_DATADIR ISO_CODES_PREFIX "/share/xml/iso-codes"
#define ISO_CODES_LOCALESDIR ISO_CODES_PREFIX "/share/locale"
#endif
static GHashTable *language_map;
#ifdef G_OS_WIN32
/* if we are using native Windows use native Windows API for language names */
static BOOL CALLBACK
get_win32_all_locales_scripts (LPWSTR locale_w, DWORD flags, LPARAM param)
{
wchar_t *langname_w = NULL;
wchar_t locale_abbrev_w[9];
gchar *langname, *locale_abbrev, *locale, *p;
gint i;
const LCTYPE iso639_lctypes[] = { LOCALE_SISO639LANGNAME, LOCALE_SISO639LANGNAME2 };
GHashTable *ht_scripts_langs = (GHashTable *) param;
PangoLanguage *lang;
gint langname_size, locale_abbrev_size;
langname_size = GetLocaleInfoEx (locale_w, LOCALE_SLOCALIZEDDISPLAYNAME, langname_w, 0);
if (langname_size == 0)
return FALSE;
langname_w = g_new0 (wchar_t, langname_size);
if (langname_size == 0)
return FALSE;
GetLocaleInfoEx (locale_w, LOCALE_SLOCALIZEDDISPLAYNAME, langname_w, langname_size);
langname = g_utf16_to_utf8 (langname_w, -1, NULL, NULL, NULL);
locale = g_utf16_to_utf8 (locale_w, -1, NULL, NULL, NULL);
p = strchr (locale, '-');
lang = pango_language_from_string (locale);
if (g_hash_table_lookup (ht_scripts_langs, lang) == NULL)
g_hash_table_insert (ht_scripts_langs, lang, langname);
/*
* Track 3+-letter ISO639-2/3 language codes as well (these have a max length of 9 including terminating NUL)
* ISO639-2: iso639_lctypes[0] = LOCALE_SISO639LANGNAME
* ISO639-3: iso639_lctypes[1] = LOCALE_SISO639LANGNAME2
*/
for (i = 0; i < 2; i++)
{
locale_abbrev_size = GetLocaleInfoEx (locale_w, iso639_lctypes[i], locale_abbrev_w, 0);
if (locale_abbrev_size > 0)
{
GetLocaleInfoEx (locale_w, iso639_lctypes[i], locale_abbrev_w, locale_abbrev_size);
locale_abbrev = g_utf16_to_utf8 (locale_abbrev_w, -1, NULL, NULL, NULL);
lang = pango_language_from_string (locale_abbrev);
if (g_hash_table_lookup (ht_scripts_langs, lang) == NULL)
g_hash_table_insert (ht_scripts_langs, lang, langname);
g_free (locale_abbrev);
}
}
g_free (locale);
g_free (langname_w);
return TRUE;
}
#else /* non-Windows */
static char *
get_first_item_in_semicolon_list (const char *list)
{
@@ -276,7 +210,6 @@ languages_variant_init (const char *variant)
g_free (filename);
g_free (buf);
}
#endif
static void
languages_init (void)
@@ -285,13 +218,8 @@ languages_init (void)
return;
language_map = g_hash_table_new_full (NULL, NULL, NULL, g_free);
#ifdef G_OS_WIN32
g_return_if_fail (EnumSystemLocalesEx (&get_win32_all_locales_scripts, LOCALE_ALL, (LPARAM) language_map, NULL));
#else
languages_variant_init ("iso_639");
languages_variant_init ("iso_639_3");
#endif
}
const char *
+6 -6
View File
@@ -98,7 +98,6 @@ demos = files([
'transparent.c',
'tree_store.c',
'video_player.c',
'font_features.c',
])
gtkdemo_deps = [ libgtk_dep, ]
@@ -129,9 +128,14 @@ extra_demo_sources = files([
'script-names.c',
'unicode-names.c',
'suggestionentry.c',
'language-names.c',
])
if harfbuzz_dep.found() and pangoft_dep.found()
demos += files(['font_features.c'])
extra_demo_sources += files(['language-names.c'])
gtkdemo_deps += [ harfbuzz_dep, epoxy_dep ]
endif
if os_unix
demos += files('pagesetup.c')
endif
@@ -170,7 +174,6 @@ if build_machine.system() == 'linux' and objcopy.found() and objcopy_supports_ad
depfile : 'gtkdemo.gresource.d',
command : [glib_compile_resources,
'--generate',
'--internal',
'--target=@OUTPUT@',
'--dependency-file=@DEPFILE@',
'--sourcedir=' + meson.current_source_dir(),
@@ -184,7 +187,6 @@ if build_machine.system() == 'linux' and objcopy.found() and objcopy_supports_ad
depfile : 'gtkdemo_resources.c.d',
command : [glib_compile_resources,
'--generate-source',
'--internal',
'--target=@OUTPUT@',
'--dependency-file=@DEPFILE@',
'--sourcedir=' + meson.current_source_dir(),
@@ -198,7 +200,6 @@ if build_machine.system() == 'linux' and objcopy.found() and objcopy_supports_ad
input : gtkdemo_gresource,
output : 'gtkdemo_resources.o',
command : [ld,
'-z', 'noexecstack',
'-r',
'-b','binary',
'@INPUT@',
@@ -209,7 +210,6 @@ if build_machine.system() == 'linux' and objcopy.found() and objcopy_supports_ad
input : gtkdemo_resources_binary,
output : 'gtkdemo_resources2.o',
command : [objcopy,
'--strip-all',
'--add-symbol','_g_binary_gtkdemo_resource_data=.data:0',
'@INPUT@',
'@OUTPUT@'])
-4
View File
@@ -18,7 +18,6 @@ if build_machine.system() == 'linux' and objcopy.found() and objcopy_supports_ad
depfile: 'widgetfactory.gresource.d',
command : [glib_compile_resources,
'--generate',
'--internal',
'--target=@OUTPUT@',
'--dependency-file=@DEPFILE@',
'--sourcedir=' + meson.current_source_dir(),
@@ -32,7 +31,6 @@ if build_machine.system() == 'linux' and objcopy.found() and objcopy_supports_ad
depfile: 'widgetfactory_resources.c.d',
command : [glib_compile_resources,
'--generate-source',
'--internal',
'--target=@OUTPUT@',
'--dependency-file=@DEPFILE@',
'--sourcedir=' + meson.current_source_dir(),
@@ -46,7 +44,6 @@ if build_machine.system() == 'linux' and objcopy.found() and objcopy_supports_ad
input : widgetfactory_gresource,
output : 'widgetfactory_resources.o',
command : [ld,
'-z', 'noexecstack',
'-r',
'-b','binary',
'@INPUT@',
@@ -57,7 +54,6 @@ if build_machine.system() == 'linux' and objcopy.found() and objcopy_supports_ad
input : widgetfactory_resources_binary,
output : 'widgetfactory_resources2.o',
command : [objcopy,
'--strip-all',
'--add-symbol','_g_binary_widgetfactory_resource_data=.data:0',
'@INPUT@',
'@OUTPUT@'])
+1 -1
View File
@@ -20,7 +20,7 @@ name = "basic"
show_index_summary = true
[source-location]
base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/main/"
base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/master/"
[extra]
content_images = [
+1 -1
View File
@@ -20,7 +20,7 @@ name = "basic"
show_index_summary = true
[source-location]
base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/main/"
base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/master/"
[extra]
content_images = [
+1 -1
View File
@@ -43,7 +43,7 @@ show_index_summary = true
show_class_hierarchy = true
[source-location]
base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/main/"
base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/master/"
[extra]
content_files = [
+1 -1
View File
@@ -38,7 +38,7 @@ show_index_summary = true
show_class_hierarchy = true
[source-location]
base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/main/"
base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/master/"
[extra]
content_images = [
+12 -12
View File
@@ -170,7 +170,7 @@ activate (GtkApplication *app,
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_set_halign (box, GTK_ALIGN_CENTER);
gtk_widget_set_valign (box, GTK_ALIGN_CENTER);
gtk_window_set_child (GTK_WINDOW (window), box);
button = gtk_button_new_with_label ("Hello World");
@@ -752,7 +752,7 @@ templates, resources, application menus, settings, [class@Gtk.HeaderBar], [class
The full, buildable sources for these examples can be found in the
`examples` directory of the GTK source distribution, or
[online](https://gitlab.gnome.org/GNOME/gtk/blob/main/examples) in the GTK
[online](https://gitlab.gnome.org/GNOME/gtk/blob/master/examples) in the GTK
source code repository. You can build each example separately by using make
with the `Makefile.example` file. For more information, see the `README`
included in the examples directory.
@@ -972,7 +972,7 @@ example_app_window_class_init (ExampleAppWindowClass *class)
...
```
([full source](https://gitlab.gnome.org/GNOME/gtk/blob/main/examples/application2/exampleappwin.c))
([full source](https://gitlab.gnome.org/GNOME/gtk/blob/master/examples/application2/exampleappwin.c))
You may have noticed that we used the `_from_resource()` variant of the function
that sets a template. Now we need to use
@@ -1043,7 +1043,7 @@ example_app_window_class_init (ExampleAppWindowClass *class)
...
```
([full source](https://gitlab.gnome.org/GNOME/gtk/blob/main/examples/application3/exampleappwin.c))
([full source](https://gitlab.gnome.org/GNOME/gtk/blob/master/examples/application3/exampleappwin.c))
Now we revisit the `example_app_window_open()` function that is called for each
commandline argument, and construct a GtkTextView that we then add as a page
@@ -1087,7 +1087,7 @@ example_app_window_open (ExampleAppWindow *win,
...
```
([full source](https://gitlab.gnome.org/GNOME/gtk/blob/main/examples/application3/exampleappwin.c))
([full source](https://gitlab.gnome.org/GNOME/gtk/blob/master/examples/application3/exampleappwin.c))
Lastly, we add a [class@Gtk.StackSwitcher] to the titlebar area in the UI file, and we
tell it to display information about our stack.
@@ -1188,7 +1188,7 @@ example_app_class_init (ExampleAppClass *class)
...
```
([full source](https://gitlab.gnome.org/GNOME/gtk/blob/main/examples/application4/exampleapp.c))
([full source](https://gitlab.gnome.org/GNOME/gtk/blob/master/examples/application4/exampleapp.c))
Our preferences menu item does not do anything yet, but the Quit menu item
is fully functional. Note that it can also be activated by the usual Ctrl-Q
@@ -1258,7 +1258,7 @@ example_app_window_init (ExampleAppWindow *win)
...
```
([full source](https://gitlab.gnome.org/GNOME/gtk/blob/main/examples/application5/exampleappwin.c))
([full source](https://gitlab.gnome.org/GNOME/gtk/blob/master/examples/application5/exampleappwin.c))
The code to connect the font setting is a little more involved, since there
is no simple object property that it corresponds to, so we are not going to
@@ -1429,7 +1429,7 @@ preferences_activated (GSimpleAction *action,
...
```
([full source](https://gitlab.gnome.org/GNOME/gtk/blob/main/examples/application6/exampleapp.c))
([full source](https://gitlab.gnome.org/GNOME/gtk/blob/master/examples/application6/exampleapp.c))
After all this work, our application can now show a preference dialog
like this:
@@ -1549,7 +1549,7 @@ example_app_window_init (ExampleAppWindow *win)
...
```
([full source](https://gitlab.gnome.org/GNOME/gtk/blob/main/examples/application7/exampleappwin.c))
([full source](https://gitlab.gnome.org/GNOME/gtk/blob/master/examples/application7/exampleappwin.c))
With the search bar, our application now looks like this:
@@ -1682,7 +1682,7 @@ example_app_window_init (ExampleAppWindow *win)
...
```
([full source](https://gitlab.gnome.org/GNOME/gtk/blob/main/examples/application8/exampleappwin.c))
([full source](https://gitlab.gnome.org/GNOME/gtk/blob/master/examples/application8/exampleappwin.c))
What our application looks like now:
@@ -1760,10 +1760,10 @@ example_app_window_init (ExampleAppWindow *win)
...
```
([full source](https://gitlab.gnome.org/GNOME/gtk/blob/main/examples/application9/exampleappwin.c))
([full source](https://gitlab.gnome.org/GNOME/gtk/blob/master/examples/application9/exampleappwin.c))
We also need a function that counts the lines of the currently active tab,
and updates the `lines` label. See the [full source](https://gitlab.gnome.org/GNOME/gtk/blob/main/examples/application9/exampleappwin.c)
and updates the `lines` label. See the [full source](https://gitlab.gnome.org/GNOME/gtk/blob/master/examples/application9/exampleappwin.c)
if you are interested in the details.
This brings our example application to this appearance:
+1 -1
View File
@@ -43,7 +43,7 @@ show_index_summary = true
show_class_hierarchy = true
[source-location]
base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/main/"
base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/master/"
[extra]
# The same order will be used when generating the index
+1 -1
View File
@@ -42,7 +42,7 @@ univocally identifies events that are related to the same
interaction.
When GTK creates a `GdkSurface`, it connects to the ::event
signal on it, which receives all of these input events. Surfaces
signal on it, which receives all of these input events. Surfaces have
have signals and properties, e.g. to deal with window management
related events.
+1 -1
View File
@@ -1382,5 +1382,5 @@ a new family of widgets for this purpose that uses list models instead
of tree models, and widgets instead of cell renderers.
To learn more about the new list widgets, you can read the [List Widget
Overview](https://docs.gtk.org/gtk4/section-list-widget.html).
Overview](#ListWidget).
+1 -1
View File
@@ -26,7 +26,7 @@ GTK with your code applied, and run the test suite, on multiple platforms
and architectures, and verify that nothing breaks. They also allow us to
do proper code reviews, so we can iterate over the changes.
You should follow the [contribution guide](https://gitlab.gnome.org/GNOME/gtk/blob/main/CONTRIBUTING.md)
You should follow the [contribution guide](https://gitlab.gnome.org/GNOME/gtk/blob/master/CONTRIBUTING.md)
for GTK, available on GitLab.
If you want to discuss your approach before or after working on it,
+4 -1
View File
@@ -286,7 +286,7 @@ requires that GTK is compiled with support for that backend.
The following backends can be selected, provided they are
included in the GDK libraries you are using:
`macos`
`quartz`
: Selects the native Quartz backend
`win32`
@@ -336,6 +336,9 @@ using and the GDK backend supports them:
`gl`
: Selects the "gl" OpenGL renderer
`ngl`
: Selects the "ngl" OpenGL renderer
`vulkan`
: Selects the Vulkan renderer
+3 -5
View File
@@ -31,7 +31,8 @@
* `GdkAppLaunchContext` handles launching an application in a graphical context.
*
* It is an implementation of `GAppLaunchContext` that provides startup
* notification and allows to launch applications on a specific workspace.
* notification and allows to launch applications on a specific screen
* or workspace.
*
* ## Launching an application
*
@@ -40,6 +41,7 @@
*
* context = gdk_display_get_app_launch_context (display);
*
* gdk_app_launch_context_set_display (display);
* gdk_app_launch_context_set_timestamp (gdk_event_get_time (event));
*
* if (!g_app_info_launch_default_for_uri ("http://www.gtk.org", context, &error))
@@ -194,10 +196,6 @@ gdk_app_launch_context_get_display (GdkAppLaunchContext *context)
* This only works when running under a window manager that
* supports multiple workspaces, as described in the
* [Extended Window Manager Hints](http://www.freedesktop.org/Standards/wm-spec).
* Specifically this sets the `_NET_WM_DESKTOP` property described
* in that spec.
*
* This only works when using the X11 backend.
*
* When the workspace is not specified or @desktop is set to -1,
* it is up to the window manager to pick one, typically it will
+5 -1
View File
@@ -132,6 +132,8 @@ gdk_device_class_init (GdkDeviceClass *klass)
* GdkDevice:source: (attributes org.gtk.Property.get=gdk_device_get_source)
*
* Source type for the device.
*
* Deprecated: 4.6: Use GdkDeviceTool:tool-type instead
*/
device_props[PROP_SOURCE] =
g_param_spec_enum ("source",
@@ -596,6 +598,8 @@ gdk_device_get_has_cursor (GdkDevice *device)
* Determines the type of the device.
*
* Returns: a `GdkInputSource`
*
* Deprecated: 4.6: Use gdk_device_tool_get_tool_type() instead
*/
GdkInputSource
gdk_device_get_source (GdkDevice *device)
@@ -1238,7 +1242,7 @@ gdk_device_get_num_touches (GdkDevice *device)
*
* Retrieves the current tool for @device.
*
* Returns: (transfer none) (nullable): the `GdkDeviceTool`
* Returns: (transfer none): the `GdkDeviceTool`
*/
GdkDeviceTool *
gdk_device_get_device_tool (GdkDevice *device)
+1 -1
View File
@@ -92,7 +92,7 @@ GDK_AVAILABLE_IN_ALL
GdkDisplay * gdk_device_get_display (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
GdkSeat * gdk_device_get_seat (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_6_FOR(gdk_device_tool_get_tool_type)
GdkDeviceTool * gdk_device_get_device_tool (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
-2
View File
@@ -1727,8 +1727,6 @@ gdk_display_init_egl (GdkDisplay *self,
epoxy_has_egl_extension (priv->egl_display, "EGL_KHR_no_config_context");
self->have_egl_pixel_format_float =
epoxy_has_egl_extension (priv->egl_display, "EGL_EXT_pixel_format_float");
self->have_egl_win32_libangle =
epoxy_has_egl_extension (priv->egl_display, "EGL_ANGLE_d3d_share_handle_client_buffer");
if (self->have_egl_no_config_context)
priv->egl_config_high_depth = gdk_display_create_egl_config (self,
-1
View File
@@ -110,7 +110,6 @@ struct _GdkDisplay
guint have_egl_swap_buffers_with_damage : 1;
guint have_egl_no_config_context : 1;
guint have_egl_pixel_format_float : 1;
guint have_egl_win32_libangle : 1;
};
struct _GdkDisplayClass
+19 -27
View File
@@ -719,6 +719,14 @@ gdk_event_queue_handle_scroll_compression (GdkDisplay *display)
gdk_event_unref (old_event);
}
if (g_queue_get_length (&display->queued_events) == 1 &&
g_queue_peek_head_link (&display->queued_events) == scrolls)
{
GdkFrameClock *clock = gdk_surface_get_frame_clock (surface);
if (clock) /* might be NULL if surface was destroyed */
gdk_frame_clock_request_phase (clock, GDK_FRAME_CLOCK_PHASE_FLUSH_EVENTS);
}
}
static void
@@ -824,6 +832,14 @@ _gdk_event_queue_handle_motion_compression (GdkDisplay *display)
g_queue_delete_link (&display->queued_events, pending_motions);
pending_motions = next;
}
if (g_queue_get_length (&display->queued_events) == 1 &&
g_queue_peek_head_link (&display->queued_events) == pending_motions)
{
GdkFrameClock *clock = gdk_surface_get_frame_clock (pending_motion_surface);
if (clock) /* might be NULL if surface was destroyed */
gdk_frame_clock_request_phase (clock, GDK_FRAME_CLOCK_PHASE_FLUSH_EVENTS);
}
}
void
@@ -2496,8 +2512,7 @@ static const GdkEventTypeInfo gdk_touchpad_event_info = {
GDK_DEFINE_EVENT_TYPE (GdkTouchpadEvent, gdk_touchpad_event,
&gdk_touchpad_event_info,
GDK_EVENT_TYPE_SLOT (GDK_TOUCHPAD_SWIPE)
GDK_EVENT_TYPE_SLOT (GDK_TOUCHPAD_PINCH)
GDK_EVENT_TYPE_SLOT (GDK_TOUCHPAD_HOLD))
GDK_EVENT_TYPE_SLOT (GDK_TOUCHPAD_PINCH))
GdkEvent *
gdk_touchpad_event_new_swipe (GdkSurface *surface,
@@ -2571,27 +2586,6 @@ gdk_touchpad_event_new_pinch (GdkSurface *surface,
return (GdkEvent *) self;
}
GdkEvent *
gdk_touchpad_event_new_hold (GdkSurface *surface,
GdkDevice *device,
guint32 time,
GdkModifierType state,
GdkTouchpadGesturePhase phase,
double x,
double y,
int n_fingers)
{
GdkTouchpadEvent *self = gdk_event_alloc (GDK_TOUCHPAD_HOLD, surface, device, time);
self->state = state;
self->phase = phase;
self->x = x;
self->y = y;
self->n_fingers = n_fingers;
return (GdkEvent *) self;
}
/**
* gdk_touchpad_event_get_gesture_phase:
* @event: (type GdkTouchpadEvent): a touchpad event
@@ -2607,8 +2601,7 @@ gdk_touchpad_event_get_gesture_phase (GdkEvent *event)
g_return_val_if_fail (GDK_IS_EVENT (event), 0);
g_return_val_if_fail (GDK_IS_EVENT_TYPE (event, GDK_TOUCHPAD_PINCH) ||
GDK_IS_EVENT_TYPE (event, GDK_TOUCHPAD_SWIPE) ||
GDK_IS_EVENT_TYPE (event, GDK_TOUCHPAD_HOLD), 0);
GDK_IS_EVENT_TYPE (event, GDK_TOUCHPAD_SWIPE), 0);
return self->phase;
}
@@ -2628,8 +2621,7 @@ gdk_touchpad_event_get_n_fingers (GdkEvent *event)
g_return_val_if_fail (GDK_IS_EVENT (event), 0);
g_return_val_if_fail (GDK_IS_EVENT_TYPE (event, GDK_TOUCHPAD_PINCH) ||
GDK_IS_EVENT_TYPE (event, GDK_TOUCHPAD_SWIPE) ||
GDK_IS_EVENT_TYPE (event, GDK_TOUCHPAD_HOLD), 0);
GDK_IS_EVENT_TYPE (event, GDK_TOUCHPAD_SWIPE), 0);
return self->n_fingers;
}
-3
View File
@@ -169,8 +169,6 @@ typedef struct _GdkTouchpadEvent GdkTouchpadEvent;
* @GDK_PAD_RING: A tablet pad axis event from a "ring".
* @GDK_PAD_STRIP: A tablet pad axis event from a "strip".
* @GDK_PAD_GROUP_MODE: A tablet pad group mode change.
* @GDK_TOUCHPAD_HOLD: A touchpad hold gesture event, the current state
* is determined by its phase field. Since: 4.6
* @GDK_EVENT_LAST: marks the end of the GdkEventType enumeration.
*
* Specifies the type of the event.
@@ -205,7 +203,6 @@ typedef enum
GDK_PAD_RING,
GDK_PAD_STRIP,
GDK_PAD_GROUP_MODE,
GDK_TOUCHPAD_HOLD,
GDK_EVENT_LAST /* helper variable for decls */
} GdkEventType;
-9
View File
@@ -533,15 +533,6 @@ GdkEvent * gdk_touchpad_event_new_pinch (GdkSurface *surface,
double scale,
double angle_delta);
GdkEvent * gdk_touchpad_event_new_hold (GdkSurface *surface,
GdkDevice *device,
guint32 time,
GdkModifierType state,
GdkTouchpadGesturePhase phase,
double x,
double y,
int n_fingers);
GdkEvent * gdk_pad_event_new_ring (GdkSurface *surface,
GdkDevice *device,
guint32 time,
+7 -17
View File
@@ -185,7 +185,8 @@ gdk_gl_context_dispose (GObject *gobject)
if (priv->egl_context != NULL)
{
GdkDisplay *display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context));
GdkSurface *surface = gdk_gl_context_get_surface (context);
GdkDisplay *display = gdk_surface_get_display (surface);
EGLDisplay *egl_display = gdk_display_get_egl_display (display);
if (eglGetCurrentContext () == priv->egl_context)
@@ -278,15 +279,7 @@ gdk_gl_context_real_realize (GdkGLContext *context,
int i = 0;
G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
if (share != NULL)
{
gdk_gl_context_get_required_version (share, &major, &minor);
gdk_gl_context_set_allowed_apis (context,
gdk_gl_context_get_allowed_apis (share));
}
else
gdk_gl_context_get_required_version (context, &major, &minor);
gdk_gl_context_get_required_version (context, &major, &minor);
debug_bit = gdk_gl_context_get_debug_enabled (context);
forward_bit = gdk_gl_context_get_forward_compatible (context);
legacy_bit = GDK_DISPLAY_DEBUG_CHECK (display, GL_LEGACY) ||
@@ -1056,29 +1049,26 @@ gdk_gl_context_get_required_version (GdkGLContext *context,
{
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
gboolean force_gles = FALSE;
#ifdef G_ENABLE_DEBUG
GdkDisplay *display;
#endif
int default_major, default_minor;
int maj, min;
g_return_if_fail (GDK_IS_GL_CONTEXT (context));
display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context));
#ifdef G_ENABLE_DEBUG
display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context));
force_gles = GDK_DISPLAY_DEBUG_CHECK (display, GL_GLES);
#endif
/* libANGLE on Windows at least requires GLES 3.0+ */
if (display->have_egl_win32_libangle)
force_gles = TRUE;
/* Default fallback values for uninitialised contexts; we
* enforce a context version number of 3.2 for desktop GL,
* and 2.0 for GLES
*/
if (gdk_gl_context_get_use_es (context) || force_gles)
{
default_major = display->have_egl_win32_libangle ? 3 : 2;
default_major = 2;
default_minor = 0;
}
else
+5 -15
View File
@@ -175,19 +175,10 @@ gdk_gl_texture_do_download (gpointer texture_,
glGenFramebuffers (1, &fbo);
glBindFramebuffer (GL_FRAMEBUFFER, fbo);
glFramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, self->id, 0);
if (gdk_gl_context_check_version (self->context, 4, 3, 3, 1))
{
glGetFramebufferParameteriv (GL_FRAMEBUFFER, GL_IMPLEMENTATION_COLOR_READ_FORMAT, &gl_read_format);
glGetFramebufferParameteriv (GL_FRAMEBUFFER, GL_IMPLEMENTATION_COLOR_READ_TYPE, &gl_read_type);
if (!gdk_gl_texture_find_format (gdk_gl_context_get_use_es (self->context), gl_read_format, gl_read_type, &actual_format))
actual_format = GDK_MEMORY_R8G8B8A8_PREMULTIPLIED; /* pray */
}
else
{
gl_read_format = GL_RGBA;
gl_read_type = GL_UNSIGNED_BYTE;
actual_format = GDK_MEMORY_R8G8B8A8_PREMULTIPLIED;
}
glGetFramebufferParameteriv (GL_FRAMEBUFFER, GL_IMPLEMENTATION_COLOR_READ_FORMAT, &gl_read_format);
glGetFramebufferParameteriv (GL_FRAMEBUFFER, GL_IMPLEMENTATION_COLOR_READ_TYPE, &gl_read_type);
if (!gdk_gl_texture_find_format (gdk_gl_context_get_use_es (self->context), gl_read_format, gl_read_type, &actual_format))
actual_format = GDK_MEMORY_R8G8B8A8_PREMULTIPLIED; /* pray */
if (download->format == actual_format &&
(download->stride == expected_stride))
@@ -392,8 +383,7 @@ gdk_gl_texture_determine_format (GdkGLTexture *self)
* which will happen when the GdkTexture object is finalized, or due to
* an explicit call of [method@Gdk.GLTexture.release].
*
* Return value: (transfer full) (type GdkGLTexture): A newly-created
* `GdkTexture`
* Return value: (transfer full): A newly-created `GdkTexture`
*/
GdkTexture *
gdk_gl_texture_new (GdkGLContext *context,
+8 -8
View File
@@ -1,16 +1,16 @@
#!/usr/bin/env perl
# Updates https://gitlab.gnome.org/GNOME/gtk/tree/main/gdk/gdkkeysyms.h from upstream (X.org 7.x),
# Updates https://gitlab.gnome.org/GNOME/gtk/tree/master/gdk/gdkkeysyms.h from upstream (X.org 7.x),
# from https://cgit.freedesktop.org/xorg/proto/x11proto/plain/keysymdef.h
#
#
# Author : Simos Xenitellis <simos at gnome dot org>.
# Author : Bastien Nocera <hadess@hadess.net>
# Version : 1.2
#
# Input : https://cgit.freedesktop.org/xorg/proto/x11proto/plain/keysymdef.h
# Input : https://cgit.freedesktop.org/xorg/proto/x11proto/plain/XF86keysym.h
# Output : https://gitlab.gnome.org/GNOME/gtk/tree/main/gdk/gdkkeysyms.h
#
# Output : https://gitlab.gnome.org/GNOME/gtk/tree/master/gdk/gdkkeysyms.h
#
# Notes : It downloads keysymdef.h from the Internet, if not found locally,
# Notes : and creates an updated gdkkeysyms.h
# Notes : This version updates the source of gdkkeysyms.h from CVS to the GIT server.
@@ -24,7 +24,7 @@ if ( ! -f "keysymdef.h" )
{
print "Trying to download keysymdef.h from\n";
print "http://cgit.freedesktop.org/xorg/proto/x11proto/plain/keysymdef.h\n";
die "Unable to download keysymdef.h from http://cgit.freedesktop.org/xorg/proto/x11proto/plain/keysymdef.h\n"
die "Unable to download keysymdef.h from http://cgit.freedesktop.org/xorg/proto/x11proto/plain/keysymdef.h\n"
unless system("wget -c -O keysymdef.h \"http://cgit.freedesktop.org/xorg/proto/x11proto/plain/keysymdef.h\"") == 0;
print " done.\n\n";
}
@@ -39,7 +39,7 @@ if ( ! -f "XF86keysym.h" )
{
print "Trying to download XF86keysym.h from\n";
print "http://cgit.freedesktop.org/xorg/proto/x11proto/plain/XF86keysym.h\n";
die "Unable to download keysymdef.h from http://cgit.freedesktop.org/xorg/proto/x11proto/plain/XF86keysym.h\n"
die "Unable to download keysymdef.h from http://cgit.freedesktop.org/xorg/proto/x11proto/plain/XF86keysym.h\n"
unless system("wget -c -O XF86keysym.h \"http://cgit.freedesktop.org/xorg/proto/x11proto/plain/XF86keysym.h\"") == 0;
print " done.\n\n";
}
@@ -82,7 +82,7 @@ print OUT_GDKKEYSYMS $LICENSE_HEADER;
print OUT_GDKKEYSYMS<<EOF;
/*
* File auto-generated from script https://gitlab.gnome.org/GNOME/gtk/tree/main/gdk/gdkkeysyms-update.pl
* File auto-generated from script https://gitlab.gnome.org/GNOME/gtk/tree/master/gdk/gdkkeysyms-update.pl
* using the input file
* http://cgit.freedesktop.org/xorg/proto/x11proto/plain/keysymdef.h
* and
@@ -111,7 +111,7 @@ while (<IN_KEYSYMDEF>)
$_ = $keysymelements[1];
die "Internal error, was expecting \"XC_*\", found: $_\n" if ( ! /^XK_/ );
$_ = $keysymelements[2];
die "Internal error, was expecting \"0x*\", found: $_\n" if ( ! /^0x/ );
+1 -1
View File
@@ -18,7 +18,7 @@
/*
* File auto-generated from script https://gitlab.gnome.org/GNOME/gtk/tree/main/gdk/gdkkeysyms-update.pl
* File auto-generated from script https://gitlab.gnome.org/GNOME/gtk/tree/master/gdk/gdkkeysyms-update.pl
* using the input file
* http://cgit.freedesktop.org/xorg/proto/x11proto/plain/keysymdef.h
* and
+43 -58
View File
@@ -369,7 +369,7 @@ static const struct {
{ 0x07a2, 0x0388 }, /* Greek_EPSILONaccent Έ GREEK CAPITAL LETTER EPSILON WITH TONOS */
{ 0x07a3, 0x0389 }, /* Greek_ETAaccent Ή GREEK CAPITAL LETTER ETA WITH TONOS */
{ 0x07a4, 0x038a }, /* Greek_IOTAaccent Ί GREEK CAPITAL LETTER IOTA WITH TONOS */
{ 0x07a5, 0x03aa }, /* Greek_IOTAdiaeresis Ϊ GREEK CAPITAL LETTER IOTA WITH DIALYTIKA */
{ 0x07a5, 0x03aa }, /* Greek_IOTAdieresis Ϊ GREEK CAPITAL LETTER IOTA WITH DIALYTIKA */
{ 0x07a7, 0x038c }, /* Greek_OMICRONaccent Ό GREEK CAPITAL LETTER OMICRON WITH TONOS */
{ 0x07a8, 0x038e }, /* Greek_UPSILONaccent Ύ GREEK CAPITAL LETTER UPSILON WITH TONOS */
{ 0x07a9, 0x03ab }, /* Greek_UPSILONdieresis Ϋ GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA */
@@ -436,22 +436,22 @@ static const struct {
{ 0x07f7, 0x03c7 }, /* Greek_chi χ GREEK SMALL LETTER CHI */
{ 0x07f8, 0x03c8 }, /* Greek_psi ψ GREEK SMALL LETTER PSI */
{ 0x07f9, 0x03c9 }, /* Greek_omega ω GREEK SMALL LETTER OMEGA */
{ 0x08a1, 0x23b7 }, /* leftradical ??? */
{ 0x08a2, 0x250c }, /* topleftradical ┌ BOX DRAWINGS LIGHT DOWN AND RIGHT */
{ 0x08a3, 0x2500 }, /* horizconnector ─ BOX DRAWINGS LIGHT HORIZONTAL */
/* 0x08a1 leftradical ? ??? */
/* 0x08a2 topleftradical ? ??? */
/* 0x08a3 horizconnector ? ??? */
{ 0x08a4, 0x2320 }, /* topintegral ⌠ TOP HALF INTEGRAL */
{ 0x08a5, 0x2321 }, /* botintegral ⌡ BOTTOM HALF INTEGRAL */
{ 0x08a6, 0x2502 }, /* vertconnector │ BOX DRAWINGS LIGHT VERTICAL */
{ 0x08a7, 0x23a1 }, /* topleftsqbracket ??? */
{ 0x08a8, 0x23a3 }, /* botleftsqbracket ??? */
{ 0x08a9, 0x23a4 }, /* toprightsqbracket ??? */
{ 0x08aa, 0x23a6 }, /* botrightsqbracket ??? */
{ 0x08ab, 0x239b }, /* topleftparens ??? */
{ 0x08ac, 0x239d }, /* botleftparens ??? */
{ 0x08ad, 0x239e }, /* toprightparens ??? */
{ 0x08ae, 0x23a0 }, /* botrightparens ??? */
{ 0x08af, 0x23a8 }, /* leftmiddlecurlybrace ??? */
{ 0x08b0, 0x23ac }, /* rightmiddlecurlybrace ??? */
/* 0x08a7 topleftsqbracket ? ??? */
/* 0x08a8 botleftsqbracket ? ??? */
/* 0x08a9 toprightsqbracket ? ??? */
/* 0x08aa botrightsqbracket ? ??? */
/* 0x08ab topleftparens ? ??? */
/* 0x08ac botleftparens ? ??? */
/* 0x08ad toprightparens ? ??? */
/* 0x08ae botrightparens ? ??? */
/* 0x08af leftmiddlecurlybrace ? ??? */
/* 0x08b0 rightmiddlecurlybrace ? ??? */
/* 0x08b1 topleftsummation ? ??? */
/* 0x08b2 botleftsummation ? ??? */
/* 0x08b3 topvertsummationconnector ? ??? */
@@ -467,8 +467,8 @@ static const struct {
{ 0x08c1, 0x221d }, /* variation ∝ PROPORTIONAL TO */
{ 0x08c2, 0x221e }, /* infinity ∞ INFINITY */
{ 0x08c5, 0x2207 }, /* nabla ∇ NABLA */
{ 0x08c8, 0x223c }, /* approximate TILDE OPERATOR */
{ 0x08c9, 0x2243 }, /* similarequal ≃ ASYMPTOTICALLY EQUAL TO */
{ 0x08c8, 0x2245 }, /* approximate ≅ APPROXIMATELY EQUAL TO */
/* 0x08c9 similarequal ? ??? */
{ 0x08cd, 0x21d4 }, /* ifonlyif ⇔ LEFT RIGHT DOUBLE ARROW */
{ 0x08ce, 0x21d2 }, /* implies ⇒ RIGHTWARDS DOUBLE ARROW */
{ 0x08cf, 0x2261 }, /* identical ≡ IDENTICAL TO */
@@ -485,7 +485,7 @@ static const struct {
{ 0x08fc, 0x2191 }, /* uparrow ↑ UPWARDS ARROW */
{ 0x08fd, 0x2192 }, /* rightarrow → RIGHTWARDS ARROW */
{ 0x08fe, 0x2193 }, /* downarrow ↓ DOWNWARDS ARROW */
/* 0x09df blank ? ??? */
{ 0x09df, 0x2422 }, /* blank ␢ BLANK SYMBOL */
{ 0x09e0, 0x25c6 }, /* soliddiamond ◆ BLACK DIAMOND */
{ 0x09e1, 0x2592 }, /* checkerboard ▒ MEDIUM SHADE */
{ 0x09e2, 0x2409 }, /* ht ␉ SYMBOL FOR HORIZONTAL TABULATION */
@@ -499,11 +499,11 @@ static const struct {
{ 0x09ec, 0x250c }, /* upleftcorner ┌ BOX DRAWINGS LIGHT DOWN AND RIGHT */
{ 0x09ed, 0x2514 }, /* lowleftcorner └ BOX DRAWINGS LIGHT UP AND RIGHT */
{ 0x09ee, 0x253c }, /* crossinglines ┼ BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL */
{ 0x09ef, 0x23ba }, /* horizlinescan1 ⎺ HORIZONTAL SCAN LINE-1 (Unicode 3.2 draft) */
{ 0x09f0, 0x23bb }, /* horizlinescan3 ⎻ HORIZONTAL SCAN LINE-3 (Unicode 3.2 draft) */
/* 0x09ef horizlinescan1 ? ??? */
/* 0x09f0 horizlinescan3 ? ??? */
{ 0x09f1, 0x2500 }, /* horizlinescan5 ─ BOX DRAWINGS LIGHT HORIZONTAL */
{ 0x09f2, 0x23bc }, /* horizlinescan7 ⎼ HORIZONTAL SCAN LINE-7 (Unicode 3.2 draft) */
{ 0x09f3, 0x23bd }, /* horizlinescan9 ⎽ HORIZONTAL SCAN LINE-9 (Unicode 3.2 draft) */
/* 0x09f2 horizlinescan7 ? ??? */
/* 0x09f3 horizlinescan9 ? ??? */
{ 0x09f4, 0x251c }, /* leftt ├ BOX DRAWINGS LIGHT VERTICAL AND RIGHT */
{ 0x09f5, 0x2524 }, /* rightt ┤ BOX DRAWINGS LIGHT VERTICAL AND LEFT */
{ 0x09f6, 0x2534 }, /* bott ┴ BOX DRAWINGS LIGHT UP AND HORIZONTAL */
@@ -519,9 +519,9 @@ static const struct {
{ 0x0aa8, 0x200a }, /* hairspace HAIR SPACE */
{ 0x0aa9, 0x2014 }, /* emdash — EM DASH */
{ 0x0aaa, 0x2013 }, /* endash EN DASH */
{ 0x0aac, 0x2423 }, /* signifblank ␣ OPEN BOX */
/* 0x0aac signifblank ? ??? */
{ 0x0aae, 0x2026 }, /* ellipsis … HORIZONTAL ELLIPSIS */
{ 0x0aaf, 0x2025 }, /* doubbaselinedot ‥ TWO DOT LEADER */
/* 0x0aaf doubbaselinedot ? ??? */
{ 0x0ab0, 0x2153 }, /* onethird ⅓ VULGAR FRACTION ONE THIRD */
{ 0x0ab1, 0x2154 }, /* twothirds ⅔ VULGAR FRACTION TWO THIRDS */
{ 0x0ab2, 0x2155 }, /* onefifth ⅕ VULGAR FRACTION ONE FIFTH */
@@ -532,9 +532,9 @@ static const struct {
{ 0x0ab7, 0x215a }, /* fivesixths ⅚ VULGAR FRACTION FIVE SIXTHS */
{ 0x0ab8, 0x2105 }, /* careof ℅ CARE OF */
{ 0x0abb, 0x2012 }, /* figdash FIGURE DASH */
{ 0x0abc, 0x27e8 }, /* leftanglebracket ⟨ MATHEMATICAL LEFT ANGLE BRACKET */
{ 0x0abc, 0x2329 }, /* leftanglebracket 〈 LEFT-POINTING ANGLE BRACKET */
{ 0x0abd, 0x002e }, /* decimalpoint . FULL STOP */
{ 0x0abe, 0x27e9 }, /* rightanglebracket ⟩ MATHEMATICAL RIGHT ANGLE BRACKET */
{ 0x0abe, 0x232a }, /* rightanglebracket 〉 RIGHT-POINTING ANGLE BRACKET */
/* 0x0abf marker ? ??? */
{ 0x0ac3, 0x215b }, /* oneeighth ⅛ VULGAR FRACTION ONE EIGHTH */
{ 0x0ac4, 0x215c }, /* threeeighths ⅜ VULGAR FRACTION THREE EIGHTHS */
@@ -546,13 +546,12 @@ static const struct {
{ 0x0acc, 0x25c1 }, /* leftopentriangle ◁ WHITE LEFT-POINTING TRIANGLE */
{ 0x0acd, 0x25b7 }, /* rightopentriangle ▷ WHITE RIGHT-POINTING TRIANGLE */
{ 0x0ace, 0x25cb }, /* emopencircle ○ WHITE CIRCLE */
{ 0x0acf, 0x25af }, /* emopenrectangle WHITE VERTICAL RECTANGLE */
{ 0x0acf, 0x25a1 }, /* emopenrectangle WHITE SQUARE */
{ 0x0ad0, 0x2018 }, /* leftsinglequotemark LEFT SINGLE QUOTATION MARK */
{ 0x0ad1, 0x2019 }, /* rightsinglequotemark RIGHT SINGLE QUOTATION MARK */
{ 0x0ad2, 0x201c }, /* leftdoublequotemark “ LEFT DOUBLE QUOTATION MARK */
{ 0x0ad3, 0x201d }, /* rightdoublequotemark ” RIGHT DOUBLE QUOTATION MARK */
{ 0x0ad4, 0x211e }, /* prescription ℞ PRESCRIPTION TAKE */
{ 0x0ad5, 0x2030 }, /* permille ‰ PER MILLE SIGN */
{ 0x0ad6, 0x2032 }, /* minutes PRIME */
{ 0x0ad7, 0x2033 }, /* seconds ″ DOUBLE PRIME */
{ 0x0ad9, 0x271d }, /* latincross ✝ LATIN CROSS */
@@ -561,7 +560,7 @@ static const struct {
{ 0x0adc, 0x25c0 }, /* filledlefttribullet ◀ BLACK LEFT-POINTING TRIANGLE */
{ 0x0add, 0x25b6 }, /* filledrighttribullet ▶ BLACK RIGHT-POINTING TRIANGLE */
{ 0x0ade, 0x25cf }, /* emfilledcircle ● BLACK CIRCLE */
{ 0x0adf, 0x25ae }, /* emfilledrect BLACK VERTICAL RECTANGLE */
{ 0x0adf, 0x25a0 }, /* emfilledrect BLACK SQUARE */
{ 0x0ae0, 0x25e6 }, /* enopencircbullet ◦ WHITE BULLET */
{ 0x0ae1, 0x25ab }, /* enopensquarebullet ▫ WHITE SMALL SQUARE */
{ 0x0ae2, 0x25ad }, /* openrectbullet ▭ WHITE RECTANGLE */
@@ -806,16 +805,15 @@ static const struct {
{ 0x0ef0, 0x3171 }, /* Hangul_SunkyeongeumMieum ㅱ HANGUL LETTER KAPYEOUNMIEUM */
{ 0x0ef1, 0x3178 }, /* Hangul_SunkyeongeumPieub ㅸ HANGUL LETTER KAPYEOUNPIEUP */
{ 0x0ef2, 0x317f }, /* Hangul_PanSios ㅿ HANGUL LETTER PANSIOS */
{ 0x0ef3, 0x3181 }, /* Hangul_KkogjiDalrinIeung ㆁ HANGUL LETTER YESIEUNG */
/* 0x0ef3 Hangul_KkogjiDalrinIeung ? ??? */
{ 0x0ef4, 0x3184 }, /* Hangul_SunkyeongeumPhieuf ㆄ HANGUL LETTER KAPYEOUNPHIEUPH */
{ 0x0ef5, 0x3186 }, /* Hangul_YeorinHieuh ㆆ HANGUL LETTER YEORINHIEUH */
{ 0x0ef6, 0x318d }, /* Hangul_AraeA ㆍ HANGUL LETTER ARAEA */
{ 0x0ef7, 0x318e }, /* Hangul_AraeAE ㆎ HANGUL LETTER ARAEAE */
{ 0x0ef8, 0x11eb }, /* Hangul_J_PanSios ᇫ HANGUL JONGSEONG PANSIOS */
{ 0x0ef9, 0x11f0 }, /* Hangul_J_KkogjiDalrinIeung ᇰ HANGUL JONGSEONG YESIEUNG */
/* 0x0ef9 Hangul_J_KkogjiDalrinIeung ? ??? */
{ 0x0efa, 0x11f9 }, /* Hangul_J_YeorinHieuh ᇹ HANGUL JONGSEONG YEORINHIEUH */
{ 0x0eff, 0x20a9 }, /* Korean_Won ₩ WON SIGN */
{ 0x13a4, 0x20ac }, /* Euro € EURO SIGN */
{ 0x13bc, 0x0152 }, /* OE Œ LATIN CAPITAL LIGATURE OE */
{ 0x13bd, 0x0153 }, /* oe œ LATIN SMALL LIGATURE OE */
{ 0x13be, 0x0178 }, /* Ydiaeresis Ÿ LATIN CAPITAL LETTER Y WITH DIAERESIS */
@@ -837,13 +835,18 @@ static const struct {
/* Following items added to GTK, not in the xterm table */
/* A few ASCII control characters */
#ifndef GDK_WINDOWING_WIN32
{ 0xFF08 /* Backspace */, '\b' },
{ 0xFF09 /* Tab */, '\t' },
#endif
{ 0xFF0A /* Linefeed */, '\n' },
{ 0xFF0B /* Vert. Tab */, '\v' },
#ifndef GDK_WINDOWING_WIN32
{ 0xFF0D /* Return */, '\r' },
{ 0xFF1B /* Escape */, '\033' },
#endif
/* Numeric keypad */
@@ -868,7 +871,9 @@ static const struct {
/* End numeric keypad */
#ifndef GDK_WINDOWING_WIN32
{ 0xFFFF /* Delete */, '\177' }
#endif
};
/**
@@ -1079,7 +1084,7 @@ static const struct {
{ 0x07d7, 0x03a7 }, /* Greek_CHI Χ GREEK CAPITAL LETTER CHI */
{ 0x07d8, 0x03a8 }, /* Greek_PSI Ψ GREEK CAPITAL LETTER PSI */
{ 0x07d9, 0x03a9 }, /* Greek_OMEGA Ω GREEK CAPITAL LETTER OMEGA */
{ 0x07a5, 0x03aa }, /* Greek_IOTAdiaeresis Ϊ GREEK CAPITAL LETTER IOTA WITH DIALYTIKA */
{ 0x07a5, 0x03aa }, /* Greek_IOTAdieresis Ϊ GREEK CAPITAL LETTER IOTA WITH DIALYTIKA */
{ 0x07a9, 0x03ab }, /* Greek_UPSILONdieresis Ϋ GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA */
{ 0x07b1, 0x03ac }, /* Greek_alphaaccent ά GREEK SMALL LETTER ALPHA WITH TONOS */
{ 0x07b2, 0x03ad }, /* Greek_epsilonaccent έ GREEK SMALL LETTER EPSILON WITH TONOS */
@@ -1394,7 +1399,6 @@ static const struct {
{ 0x0eed, 0x11c1 }, /* Hangul_J_Phieuf ᇁ HANGUL JONGSEONG PHIEUPH */
{ 0x0eee, 0x11c2 }, /* Hangul_J_Hieuh ᇂ HANGUL JONGSEONG HIEUH */
{ 0x0ef8, 0x11eb }, /* Hangul_J_PanSios ᇫ HANGUL JONGSEONG PANSIOS */
{ 0x0ef9, 0x11f0 }, /* Hangul_J_KkogjiDalrinIeung ᇰ HANGUL JONGSEONG YESIEUNG */
{ 0x0efa, 0x11f9 }, /* Hangul_J_YeorinHieuh ᇹ HANGUL JONGSEONG YEORINHIEUH */
{ 0x0aa2, 0x2002 }, /* enspace EN SPACE */
{ 0x0aa1, 0x2003 }, /* emspace EM SPACE */
@@ -1418,9 +1422,7 @@ static const struct {
{ 0x0af1, 0x2020 }, /* dagger † DAGGER */
{ 0x0af2, 0x2021 }, /* doubledagger ‡ DOUBLE DAGGER */
{ 0x0ae6, 0x2022 }, /* enfilledcircbullet • BULLET */
{ 0x0aaf, 0x2025 }, /* doubbaselinedot ‥ TWO DOT LEADER */
{ 0x0aae, 0x2026 }, /* ellipsis … HORIZONTAL ELLIPSIS */
{ 0x0ad5, 0x2030 }, /* permille ‰ PER MILLE SIGN */
{ 0x0ad6, 0x2032 }, /* minutes PRIME */
{ 0x0ad7, 0x2033 }, /* seconds ″ DOUBLE PRIME */
{ 0x0afc, 0x2038 }, /* caret ‸ CARET */
@@ -1478,8 +1480,7 @@ static const struct {
{ 0x0bd6, 0x222a }, /* downshoe UNION */
{ 0x08bf, 0x222b }, /* integral ∫ INTEGRAL */
{ 0x08c0, 0x2234 }, /* therefore ∴ THEREFORE */
{ 0x08c8, 0x223c }, /* approximate TILDE OPERATOR */
{ 0x08c9, 0x2243 }, /* similarequal ≃ ASYMPTOTICALLY EQUAL TO */
{ 0x08c8, 0x2245 }, /* approximate ≅ APPROXIMATELY EQUAL TO */
{ 0x08bd, 0x2260 }, /* notequal ≠ NOT EQUAL TO */
{ 0x08cf, 0x2261 }, /* identical ≡ IDENTICAL TO */
{ 0x08bc, 0x2264 }, /* lessthanequal ≤ LESS-THAN OR EQUAL TO */
@@ -1497,28 +1498,15 @@ static const struct {
{ 0x0afa, 0x2315 }, /* telephonerecorder ⌕ TELEPHONE RECORDER */
{ 0x08a4, 0x2320 }, /* topintegral ⌠ TOP HALF INTEGRAL */
{ 0x08a5, 0x2321 }, /* botintegral ⌡ BOTTOM HALF INTEGRAL */
{ 0x0abc, 0x2329 }, /* leftanglebracket 〈 LEFT-POINTING ANGLE BRACKET */
{ 0x0abe, 0x232a }, /* rightanglebracket 〉 RIGHT-POINTING ANGLE BRACKET */
{ 0x0bcc, 0x2395 }, /* quad ⎕ APL FUNCTIONAL SYMBOL QUAD (Unicode 3.0) */
{ 0x08a7, 0x23a1 }, /* topleftsqbracket ⎡ ??? */
{ 0x08a8, 0x23a3 }, /* botleftsqbracket ⎣ ??? */
{ 0x08a9, 0x23a4 }, /* toprightsqbracket ⎤ ??? */
{ 0x08aa, 0x23a6 }, /* botrightsqbracket ⎦ ??? */
{ 0x08ab, 0x239b }, /* topleftparens ⎛ ??? */
{ 0x08ac, 0x239d }, /* botleftparens ⎝ ??? */
{ 0x08ad, 0x239e }, /* toprightparens ⎞ ??? */
{ 0x08ae, 0x23a0 }, /* botrightparens ⎠ ??? */
{ 0x08af, 0x23a8 }, /* leftmiddlecurlybrace ⎨ ??? */
{ 0x08b0, 0x23ac }, /* rightmiddlecurlybrace ⎬ ??? */
{ 0x08a1, 0x23b7 }, /* leftradical ⎷ ??? */
{ 0x09ef, 0x23ba }, /* horizlinescan1 ⎺ HORIZONTAL SCAN LINE-1 (Unicode 3.2 draft) */
{ 0x09f0, 0x23bb }, /* horizlinescan3 ⎻ HORIZONTAL SCAN LINE-3 (Unicode 3.2 draft) */
{ 0x09f2, 0x23bc }, /* horizlinescan7 ⎼ HORIZONTAL SCAN LINE-7 (Unicode 3.2 draft) */
{ 0x09f3, 0x23bd }, /* horizlinescan9 ⎽ HORIZONTAL SCAN LINE-9 (Unicode 3.2 draft) */
{ 0x09e2, 0x2409 }, /* ht ␉ SYMBOL FOR HORIZONTAL TABULATION */
{ 0x09e5, 0x240a }, /* lf ␊ SYMBOL FOR LINE FEED */
{ 0x09e9, 0x240b }, /* vt ␋ SYMBOL FOR VERTICAL TABULATION */
{ 0x09e3, 0x240c }, /* ff ␌ SYMBOL FOR FORM FEED */
{ 0x09e4, 0x240d }, /* cr ␍ SYMBOL FOR CARRIAGE RETURN */
{ 0x0aac, 0x2423 }, /* signifblank ␣ OPEN BOX */
{ 0x09df, 0x2422 }, /* blank ␢ BLANK SYMBOL */
{ 0x09e8, 0x2424 }, /* nl ␤ SYMBOL FOR NEWLINE */
{ 0x09f1, 0x2500 }, /* horizlinescan5 ─ BOX DRAWINGS LIGHT HORIZONTAL */
{ 0x08a6, 0x2502 }, /* vertconnector │ BOX DRAWINGS LIGHT VERTICAL */
@@ -1534,11 +1522,11 @@ static const struct {
{ 0x09ee, 0x253c }, /* crossinglines ┼ BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL */
{ 0x09e1, 0x2592 }, /* checkerboard ▒ MEDIUM SHADE */
{ 0x0adf, 0x25a0 }, /* emfilledrect ■ BLACK SQUARE */
{ 0x0acf, 0x25a1 }, /* emopenrectangle □ WHITE SQUARE */
{ 0x0ae7, 0x25aa }, /* enfilledsqbullet ▪ BLACK SMALL SQUARE */
{ 0x0ae1, 0x25ab }, /* enopensquarebullet ▫ WHITE SMALL SQUARE */
{ 0x0adb, 0x25ac }, /* filledrectbullet ▬ BLACK RECTANGLE */
{ 0x0ae2, 0x25ad }, /* openrectbullet ▭ WHITE RECTANGLE */
{ 0x0acf, 0x25af }, /* emopenrectangle ▯ WHITE VERTICAL RECTANGLE */
{ 0x0ae8, 0x25b2 }, /* filledtribulletup ▲ BLACK UP-POINTING TRIANGLE */
{ 0x0ae3, 0x25b3 }, /* opentribulletup △ WHITE UP-POINTING TRIANGLE */
{ 0x0add, 0x25b6 }, /* filledrighttribullet ▶ BLACK RIGHT-POINTING TRIANGLE */
@@ -1568,8 +1556,6 @@ static const struct {
{ 0x0af4, 0x2717 }, /* ballotcross ✗ BALLOT X */
{ 0x0ad9, 0x271d }, /* latincross ✝ LATIN CROSS */
{ 0x0af0, 0x2720 }, /* maltesecross ✠ MALTESE CROSS */
{ 0x0abc, 0x27e8 }, /* leftanglebracket ⟨ MATHEMATICAL LEFT ANGLE BRACKET */
{ 0x0abe, 0x27e9 }, /* rightanglebracket ⟩ MATHEMATICAL RIGHT ANGLE BRACKET */
{ 0x04a4, 0x3001 }, /* kana_comma 、 IDEOGRAPHIC COMMA */
{ 0x04a1, 0x3002 }, /* kana_fullstop 。 IDEOGRAPHIC FULL STOP */
{ 0x04a2, 0x300c }, /* kana_openingbracket 「 LEFT CORNER BRACKET */
@@ -1688,7 +1674,6 @@ static const struct {
{ 0x0ef0, 0x3171 }, /* Hangul_SunkyeongeumMieum ㅱ HANGUL LETTER KAPYEOUNMIEUM */
{ 0x0ef1, 0x3178 }, /* Hangul_SunkyeongeumPieub ㅸ HANGUL LETTER KAPYEOUNPIEUP */
{ 0x0ef2, 0x317f }, /* Hangul_PanSios ㅿ HANGUL LETTER PANSIOS */
{ 0x0ef3, 0x3181 }, /* Hangul_KkogjiDalrinIeung ㆁ HANGUL LETTER YESIEUNG */
{ 0x0ef4, 0x3184 }, /* Hangul_SunkyeongeumPhieuf ㆄ HANGUL LETTER KAPYEOUNPHIEUPH */
{ 0x0ef5, 0x3186 }, /* Hangul_YeorinHieuh ㆆ HANGUL LETTER YEORINHIEUH */
{ 0x0ef6, 0x318d }, /* Hangul_AraeA ㆍ HANGUL LETTER ARAEA */
+2 -2
View File
@@ -133,10 +133,10 @@ gdk_memory_sanitize (GBytes *bytes,
*
* Creates a new texture for a blob of image data.
*
* The `GBytes` must contain @stride × @height pixels
* The `GBytes` must contain @stride x @height pixels
* in the given format.
*
* Returns: (type GdkMemoryTexture): A newly-created `GdkTexture`
* Returns: A newly-created `GdkTexture`
*/
GdkTexture *
gdk_memory_texture_new (int width,
+17 -17
View File
@@ -1,5 +1,5 @@
/* GDK - The GIMP Drawing Kit
* Copyright (C) 2000 Red Hat, Inc.
* Copyright (C) 2000 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -52,25 +52,25 @@ layout_iter_get_line_clip_region (PangoLayoutIter *iter,
i = 0;
while (i < n_ranges)
{
{
int *pixel_ranges = NULL;
int n_pixel_ranges = 0;
int j;
/* Note that get_x_ranges returns layout coordinates
*/
if (index_ranges[i*2+1] >= pango_layout_line_get_start_index (line) &&
index_ranges[i*2] < pango_layout_line_get_start_index (line) + pango_layout_line_get_length (line))
if (index_ranges[i*2+1] >= line->start_index &&
index_ranges[i*2] < line->start_index + line->length)
pango_layout_line_get_x_ranges (line,
index_ranges[i*2],
index_ranges[i*2+1],
&pixel_ranges, &n_pixel_ranges);
for (j = 0; j < n_pixel_ranges; j++)
{
GdkRectangle rect;
int x_off, y_off;
x_off = PANGO_PIXELS (pixel_ranges[2*j] - logical_rect.x);
y_off = PANGO_PIXELS (baseline - logical_rect.y);
@@ -124,14 +124,14 @@ gdk_pango_layout_line_get_clip_region (PangoLayoutLine *line,
{
cairo_region_t *clip_region;
PangoLayoutIter *iter;
g_return_val_if_fail (line != NULL, NULL);
g_return_val_if_fail (index_ranges != NULL, NULL);
iter = pango_layout_get_iter (line->layout);
while (pango_layout_iter_get_line_readonly (iter) != line)
pango_layout_iter_next_line (iter);
clip_region = layout_iter_get_line_clip_region(iter, x_origin, y_origin, index_ranges, n_ranges);
pango_layout_iter_free (iter);
@@ -167,26 +167,26 @@ gdk_pango_layout_get_clip_region (PangoLayout *layout,
const int *index_ranges,
int n_ranges)
{
PangoLayoutIter *iter;
PangoLayoutIter *iter;
cairo_region_t *clip_region;
g_return_val_if_fail (PANGO_IS_LAYOUT (layout), NULL);
g_return_val_if_fail (index_ranges != NULL, NULL);
clip_region = cairo_region_create ();
iter = pango_layout_get_iter (layout);
do
{
PangoRectangle logical_rect;
cairo_region_t *line_region;
int baseline;
pango_layout_iter_get_line_extents (iter, NULL, &logical_rect);
baseline = pango_layout_iter_get_baseline (iter);
baseline = pango_layout_iter_get_baseline (iter);
line_region = layout_iter_get_line_clip_region(iter,
line_region = layout_iter_get_line_clip_region(iter,
x_origin + PANGO_PIXELS (logical_rect.x),
y_origin + PANGO_PIXELS (baseline),
index_ranges,
+1 -1
View File
@@ -33,7 +33,7 @@
((_GDK_RGBA_SELECT_COLOR(str, 0, 0) << 4) | _GDK_RGBA_SELECT_COLOR(str, 0, 1)) / 255., \
((_GDK_RGBA_SELECT_COLOR(str, 1, 2) << 4) | _GDK_RGBA_SELECT_COLOR(str, 1, 3)) / 255., \
((_GDK_RGBA_SELECT_COLOR(str, 2, 4) << 4) | _GDK_RGBA_SELECT_COLOR(str, 2, 5)) / 255., \
((sizeof(str) % 4 == 1) ? ((_GDK_RGBA_SELECT_COLOR(str, 3, 6) << 4) | _GDK_RGBA_SELECT_COLOR(str, 3, 7)) : 0xFF) / 255. })
((sizeof(str) % 4 == 1) ? ((_GDK_RGBA_SELECT_COLOR(str, 3, 6) << 4) | _GDK_RGBA_SELECT_COLOR(str, 3, 7)) : 0xFF) / 255 })
gboolean gdk_rgba_parser_parse (GtkCssParser *parser,
+1 -9
View File
@@ -2244,7 +2244,7 @@ _gdk_windowing_got_event (GdkDisplay *display,
GdkEvent *event,
gulong serial)
{
GdkSurface *event_surface = NULL;
GdkSurface *event_surface;
gboolean unlink_event = FALSE;
GdkDeviceGrabInfo *button_release_grab;
GdkPointerSurfaceInfo *pointer_info = NULL;
@@ -2336,14 +2336,6 @@ _gdk_windowing_got_event (GdkDisplay *display,
*/
_gdk_event_queue_handle_motion_compression (display);
gdk_event_queue_handle_scroll_compression (display);
if (event_surface)
{
GdkFrameClock *clock = gdk_surface_get_frame_clock (event_surface);
if (clock) /* might be NULL if surface was destroyed */
gdk_frame_clock_request_phase (clock, GDK_FRAME_CLOCK_PHASE_FLUSH_EVENTS);
}
}
/**
+9 -9
View File
@@ -25,14 +25,14 @@
* multiple frames, and will be used for a long time.
*
* There are various ways to create `GdkTexture` objects from a
* [class@GdkPixbuf.Pixbuf], or a Cairo surface, or other pixel data.
* `GdkPixbuf`, or a Cairo surface, or other pixel data.
*
* The ownership of the pixel data is transferred to the `GdkTexture`
* instance; you can only make a copy of it, via [method@Gdk.Texture.download].
*
* `GdkTexture` is an immutable object: That means you cannot change
* anything about it other than increasing the reference count via
* [method@GObject.Object.ref], and consequently, it is a thread-safe object.
* g_object_ref().
*/
#include "config.h"
@@ -346,7 +346,7 @@ gdk_texture_init (GdkTexture *self)
*
* Creates a new texture object representing the surface.
*
* @surface must be an image surface with format `CAIRO_FORMAT_ARGB32`.
* @surface must be an image surface with format CAIRO_FORMAT_ARGB32.
*
* Returns: a new `GdkTexture`
*/
@@ -384,7 +384,7 @@ gdk_texture_new_for_surface (cairo_surface_t *surface)
* Creates a new texture object representing the `GdkPixbuf`.
*
* This function is threadsafe, so that you can e.g. use GTask
* and [method@Gio.Task.run_in_thread] to avoid blocking the main thread
* and g_task_run_in_thread() to avoid blocking the main thread
* while loading a big image.
*
* Returns: a new `GdkTexture`
@@ -430,7 +430,7 @@ gdk_texture_new_for_pixbuf (GdkPixbuf *pixbuf)
* [ctor@Gdk.Texture.new_from_file] to load it.
*
* This function is threadsafe, so that you can e.g. use GTask
* and [method@Gio.Task.run_in_thread] to avoid blocking the main thread
* and g_task_run_in_thread() to avoid blocking the main thread
* while loading a big image.
*
* Return value: A newly-created `GdkTexture`
@@ -472,7 +472,7 @@ gdk_texture_new_from_resource (const char *resource_path)
* If %NULL is returned, then @error will be set.
*
* This function is threadsafe, so that you can e.g. use GTask
* and [method@Gio.Task.run_in_thread] to avoid blocking the main thread
* and g_task_run_in_thread() to avoid blocking the main thread
* while loading a big image.
*
* Return value: A newly-created `GdkTexture`
@@ -565,7 +565,7 @@ gdk_texture_new_from_bytes_pixbuf (GBytes *bytes,
* If %NULL is returned, then @error will be set.
*
* This function is threadsafe, so that you can e.g. use GTask
* and [method@Gio.Task.run_in_thread] to avoid blocking the main thread
* and g_task_run_in_thread() to avoid blocking the main thread
* while loading a big image.
*
* Return value: A newly-created `GdkTexture`
@@ -611,7 +611,7 @@ gdk_texture_new_from_bytes (GBytes *bytes,
* If %NULL is returned, then @error will be set.
*
* This function is threadsafe, so that you can e.g. use GTask
* and [method@Gio.Task.run_in_thread] to avoid blocking the main thread
* and g_task_run_in_thread() to avoid blocking the main thread
* while loading a big image.
*
* Return value: A newly-created `GdkTexture`
@@ -796,7 +796,7 @@ gdk_texture_get_render_data (GdkTexture *self,
*
* This is a utility function intended for debugging and testing.
* If you want more control over formats, proper error handling or
* want to store to a [iface@Gio.File] or other location, you might want to
* want to store to a `GFile` or other location, you might want to
* use [method@Gdk.Texture.save_to_png_bytes] or look into the
* gdk-pixbuf library.
*
-2
View File
@@ -15,8 +15,6 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdlib.h>
#include "config.h"
#include "gdkjpegprivate.h"
+16
View File
@@ -222,7 +222,11 @@ gdk_load_png (GBytes *bytes,
case PNG_COLOR_TYPE_RGB_ALPHA:
if (depth == 8)
{
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
format = GDK_MEMORY_R8G8B8A8;
#elif G_BYTE_ORDER == G_BIG_ENDIAN
format = GDK_MEMORY_A8B8G8R8;
#endif
}
else
{
@@ -232,7 +236,11 @@ gdk_load_png (GBytes *bytes,
case PNG_COLOR_TYPE_RGB:
if (depth == 8)
{
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
format = GDK_MEMORY_R8G8B8;
#elif G_BYTE_ORDER == G_BIG_ENDIAN
format = GDK_MEMORY_B8G8R8;
#endif
}
else if (depth == 16)
{
@@ -317,14 +325,22 @@ gdk_save_png (GdkTexture *texture)
case GDK_MEMORY_A8R8G8B8:
case GDK_MEMORY_R8G8B8A8:
case GDK_MEMORY_A8B8G8R8:
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
format = GDK_MEMORY_R8G8B8A8;
#elif G_BYTE_ORDER == G_BIG_ENDIAN
format = GDK_MEMORY_A8B8G8R8;
#endif
png_format = PNG_COLOR_TYPE_RGB_ALPHA;
depth = 8;
break;
case GDK_MEMORY_R8G8B8:
case GDK_MEMORY_B8G8R8:
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
format = GDK_MEMORY_R8G8B8;
#elif G_BYTE_ORDER == G_BIG_ENDIAN
format = GDK_MEMORY_B8G8R8;
#endif
png_format = PNG_COLOR_TYPE_RGB;
depth = 8;
break;
+109 -75
View File
@@ -23,6 +23,7 @@
#include <CoreGraphics/CoreGraphics.h>
#include <cairo-quartz.h>
#import "GdkMacosCairoSubview.h"
#import "GdkMacosCairoView.h"
@@ -32,9 +33,7 @@
-(void)dealloc
{
g_clear_pointer (&self->clip, g_array_unref);
g_clear_pointer (&self->damage, g_array_unref);
g_clear_pointer (&self->image, CGImageRelease);
g_clear_pointer (&self->clip, cairo_region_destroy);
[super dealloc];
}
@@ -56,67 +55,132 @@
-(void)drawRect:(NSRect)rect
{
CGContextRef cgContext;
GdkSurface *gdk_surface;
cairo_surface_t *dest;
const NSRect *rects = NULL;
NSView *root_view;
CGRect image_rect;
CGRect abs_bounds;
NSInteger n_rects = 0;
NSRect abs_bounds;
cairo_t *cr;
CGSize scale;
int abs_height;
int scale_factor;
if (self->image == NULL)
if (self->cairoSurface == NULL)
return;
cgContext = [[NSGraphicsContext currentContext] CGContext];
/* Acquire everything we need to do translations, drawing, etc */
gdk_surface = [self gdkSurface];
scale_factor = gdk_surface_get_scale_factor (gdk_surface);
root_view = [[self window] contentView];
cgContext = [[NSGraphicsContext currentContext] CGContext];
abs_bounds = [self convertRect:[self bounds] toView:root_view];
abs_height = CGImageGetHeight (self->image);
CGContextSaveGState (cgContext);
/* Clip while our context is still using matching coordinates
* to the self->clip region. This is usually just on the views
* for the shadow areas.
/* Translate scaling to remove HiDPI scaling from CGContext as
* cairo will be doing that for us already.
*/
CGContextAddRect (cgContext, [self bounds]);
if (self->clip != NULL)
{
for (guint i = 0; i < self->clip->len; i++)
CGContextAddRect (cgContext, g_array_index (self->clip, CGRect, i));
}
if (self->damage != NULL)
{
for (guint i = 0; i < self->damage->len; i++)
CGContextAddRect (cgContext, g_array_index (self->damage, CGRect, i));
}
CGContextClip (cgContext);
/* Scale/Translate so that the CGImageRef draws in proper format/placement */
scale = CGSizeMake (1.0, 1.0);
scale = CGContextConvertSizeToDeviceSpace (cgContext, scale);
CGContextScaleCTM (cgContext, 1.0 / scale.width, 1.0 / scale.height);
CGContextTranslateCTM (cgContext, -abs_bounds.origin.x, -abs_bounds.origin.y);
image_rect = CGRectMake (-abs_bounds.origin.x,
-abs_bounds.origin.y,
CGImageGetWidth (self->image),
CGImageGetHeight (self->image));
CGContextDrawImage (cgContext, image_rect, self->image);
/* Create the cairo surface to draw to the CGContext and translate
* coordinates so we can pretend we are in the same coordinate system
* as the GDK surface.
*/
dest = cairo_quartz_surface_create_for_cg_context (cgContext,
gdk_surface->width * scale_factor,
gdk_surface->height * scale_factor);
cairo_surface_set_device_scale (dest, scale_factor, scale_factor);
/* Create cairo context and translate things into the origin of
* the topmost contentView so that we just draw at 0,0 with a
* clip region to paint the surface.
*/
cr = cairo_create (dest);
cairo_translate (cr, -abs_bounds.origin.x, -abs_bounds.origin.y);
/* Apply the clip if provided one */
if (self->clip != NULL)
{
cairo_rectangle_int_t area;
n_rects = cairo_region_num_rectangles (self->clip);
for (guint i = 0; i < n_rects; i++)
{
cairo_region_get_rectangle (self->clip, i, &area);
cairo_rectangle (cr, area.x, area.y, area.width, area.height);
}
cairo_clip (cr);
}
/* Clip the cairo context based on the rectangles to be drawn
* within the bounding box :rect.
*/
[self getRectsBeingDrawn:&rects count:&n_rects];
for (NSInteger i = 0; i < n_rects; i++)
{
NSRect area = [self convertRect:rects[i] toView:root_view];
cairo_rectangle (cr,
area.origin.x, area.origin.y,
area.size.width, area.size.height);
}
cairo_clip (cr);
/* Now paint the surface (without blending) as we do not need
* any compositing here. The transparent regions (like shadows)
* are already on non-opaque layers.
*/
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
cairo_set_source_surface (cr, self->cairoSurface, 0, 0);
cairo_paint (cr);
/* Cleanup state, flush the surface to the backing layer, and
* restore GState for future use.
*/
cairo_destroy (cr);
cairo_surface_flush (dest);
cairo_surface_destroy (dest);
CGContextRestoreGState (cgContext);
}
-(void)setImage:(CGImageRef)theImage
withDamage:(cairo_region_t *)region
-(void)setCairoSurface:(cairo_surface_t *)surface
withDamage:(cairo_region_t *)region
{
if (theImage != image)
if (surface != self->cairoSurface)
{
g_clear_pointer (&image, CGImageRelease);
if (theImage)
image = CGImageRetain (theImage);
g_clear_pointer (&self->cairoSurface, cairo_surface_destroy);
if (surface != NULL)
self->cairoSurface = cairo_surface_reference (surface);
}
[self convertRegion:region toArray:&self->damage andDisplay:YES];
if (region != NULL)
{
NSView *root_view = [[self window] contentView];
NSRect abs_bounds = [self convertRect:[self bounds] toView:root_view];
guint n_rects = cairo_region_num_rectangles (region);
for (guint i = 0; i < n_rects; i++)
{
cairo_rectangle_int_t rect;
NSRect nsrect;
cairo_region_get_rectangle (region, i, &rect);
nsrect = NSMakeRect (rect.x, rect.y, rect.width, rect.height);
if (NSIntersectsRect (abs_bounds, nsrect))
{
nsrect.origin.x -= abs_bounds.origin.x;
nsrect.origin.y -= abs_bounds.origin.y;
[self setNeedsDisplayInRect:nsrect];
}
}
}
for (id view in [self subviews])
[(GdkMacosCairoSubview *)view setImage:theImage withDamage:region];
[(GdkMacosCairoSubview *)view setCairoSurface:surface
withDamage:region];
}
-(void)setOpaque:(BOOL)opaque
@@ -124,44 +188,14 @@
self->_isOpaque = opaque;
}
-(void)convertRegion:(const cairo_region_t *)region
toArray:(GArray **)array
andDisplay:(BOOL)display
-(void)setClip:(cairo_region_t*)region
{
NSView *root_view;
CGRect abs_bounds;
guint n_rects;
if (*array == NULL)
*array = g_array_new (FALSE, FALSE, sizeof (CGRect));
else
g_array_set_size (*array, 0);
root_view = [[self window] contentView];
abs_bounds = [self convertRect:[self bounds] toView:root_view];
n_rects = cairo_region_num_rectangles (region);
for (guint i = 0; i < n_rects; i++)
if (region != self->clip)
{
cairo_rectangle_int_t rect;
CGRect nsrect;
cairo_region_get_rectangle (region, i, &rect);
nsrect = CGRectIntersection (abs_bounds, CGRectMake (rect.x, rect.y, rect.width, rect.height));
if (!CGRectIsNull (nsrect))
g_array_append_val (*array, nsrect);
if (display)
[self setNeedsDisplayInRect:CGRectMake (rect.x - abs_bounds.origin.x,
rect.y - abs_bounds.origin.y,
rect.width, rect.height)];
g_clear_pointer (&self->clip, cairo_region_destroy);
if (region != NULL)
self->clip = cairo_region_reference (region);
}
}
-(void)setClip:(cairo_region_t*)region
{
[self convertRegion:region toArray:&self->clip andDisplay:NO];
}
@end
+5 -7
View File
@@ -19,21 +19,19 @@
*/
#include <AppKit/AppKit.h>
#include <cairo.h>
#include <glib.h>
#define GDK_IS_MACOS_CAIRO_SUBVIEW(obj) ((obj) && [obj isKindOfClass:[GdkMacosCairoSubview class]])
@interface GdkMacosCairoSubview : NSView
{
BOOL _isOpaque;
GArray *clip;
GArray *damage;
CGImageRef image;
BOOL _isOpaque;
cairo_surface_t *cairoSurface;
cairo_region_t *clip;
}
-(void)setOpaque:(BOOL)opaque;
-(void)setImage:(CGImageRef)theImage withDamage:(cairo_region_t *)region;
-(void)setCairoSurface:(cairo_surface_t *)cairoSurface
withDamage:(cairo_region_t *)region;
-(void)setClip:(cairo_region_t*)region;
@end
+3 -83
View File
@@ -28,7 +28,6 @@
#import "GdkMacosCairoView.h"
#import "GdkMacosCairoSubview.h"
#include "gdkmacosmonitor-private.h"
#include "gdkmacossurface-private.h"
@implementation GdkMacosCairoView
@@ -59,92 +58,12 @@
[child setNeedsDisplay:needsDisplay];
}
static void
release_surface_provider (void *info,
const void *data,
size_t size)
{
cairo_surface_destroy (info);
}
-(void)setCairoSurface:(cairo_surface_t *)cairoSurface
withDamage:(cairo_region_t *)cairoRegion
{
CGImageRef image = NULL;
if (cairoSurface != NULL)
{
const CGColorRenderingIntent intent = kCGRenderingIntentDefault;
CGDataProviderRef provider;
CGColorSpaceRef rgb;
cairo_format_t format;
CGBitmapInfo bitmap = kCGBitmapByteOrder32Host;
GdkMonitor *monitor;
guint8 *framebuffer;
size_t width;
size_t height;
int rowstride;
int bpp;
int bpc;
cairo_surface_flush (cairoSurface);
format = cairo_image_surface_get_format (cairoSurface);
framebuffer = cairo_image_surface_get_data (cairoSurface);
rowstride = cairo_image_surface_get_stride (cairoSurface);
width = cairo_image_surface_get_width (cairoSurface);
height = cairo_image_surface_get_height (cairoSurface);
monitor = _gdk_macos_surface_get_best_monitor ([self gdkSurface]);
rgb = _gdk_macos_monitor_copy_colorspace (GDK_MACOS_MONITOR (monitor));
/* If we have an WCG colorspace, just take the slow path or we risk
* really screwing things up.
*/
if (CGColorSpaceIsWideGamutRGB (rgb))
{
CGColorSpaceRelease (rgb);
rgb = CGColorSpaceCreateDeviceRGB ();
}
/* Assert that our image surface was created correctly with
* 16-byte aligned pointers and strides. This is needed to
* ensure that we're working with fast paths in CoreGraphics.
*/
g_assert (format == CAIRO_FORMAT_ARGB32 || format == CAIRO_FORMAT_RGB24);
g_assert (framebuffer != NULL);
g_assert (((intptr_t)framebuffer & (intptr_t)~0xF) == (intptr_t)framebuffer);
g_assert ((rowstride & ~0xF) == rowstride);
if (format == CAIRO_FORMAT_ARGB32)
{
bitmap |= kCGImageAlphaPremultipliedFirst;
bpp = 32;
bpc = 8;
}
else
{
bitmap |= kCGImageAlphaNoneSkipFirst;
bpp = 32;
bpc = 8;
}
provider = CGDataProviderCreateWithData (cairo_surface_reference (cairoSurface),
framebuffer,
rowstride * height,
release_surface_provider);
image = CGImageCreate (width, height, bpc, bpp, rowstride, rgb, bitmap, provider, NULL, FALSE, intent);
CGDataProviderRelease (provider);
CGColorSpaceRelease (rgb);
}
for (id view in [self subviews])
[(GdkMacosCairoSubview *)view setImage:image
withDamage:cairoRegion];
if (image != NULL)
CGImageRelease (image);
[(GdkMacosCairoSubview *)view setCairoSurface:cairoSurface
withDamage:cairoRegion];
}
-(void)removeOpaqueChildren
@@ -243,6 +162,7 @@ release_surface_provider (void *info,
*/
self->transparent = [[GdkMacosCairoSubview alloc] initWithFrame:frame];
[self addSubview:self->transparent];
}
return self;
+1 -8
View File
@@ -214,14 +214,7 @@ typedef NSString *CALayerContentsGravity;
* as we are leaving maximized state.
*/
if ((style_mask & NSWindowStyleMaskTitled) == 0 && [self isOpaque])
{
GdkSurface *surface = GDK_SURFACE ([self gdkSurface]);
[self setOpaque:NO];
/* Force updating of various styling, regions, etc */
_gdk_surface_update_size (surface);
}
[self setOpaque:NO];
}
-(void)windowDidMove:(NSNotification *)aNotification
-1
View File
@@ -27,7 +27,6 @@
#include "gdkdisplaylinksource.h"
#include "gdkmacoseventsource-private.h"
#include "gdk-private.h"
static gint64 host_to_frame_clock_time (gint64 val);
+26 -79
View File
@@ -34,7 +34,6 @@ struct _GdkMacosCairoContext
GdkCairoContext parent_instance;
cairo_surface_t *window_surface;
cairo_t *cr;
};
struct _GdkMacosCairoContextClass
@@ -47,66 +46,30 @@ G_DEFINE_TYPE (GdkMacosCairoContext, _gdk_macos_cairo_context, GDK_TYPE_CAIRO_CO
static cairo_surface_t *
create_cairo_surface_for_surface (GdkSurface *surface)
{
static const cairo_user_data_key_t buffer_key;
cairo_surface_t *cairo_surface;
guint8 *data;
cairo_format_t format;
size_t size;
size_t rowstride;
size_t width;
size_t height;
int scale;
int width;
int height;
g_assert (GDK_IS_MACOS_SURFACE (surface));
/* We use a cairo image surface here instead of a quartz surface because
* we get strange artifacts with the quartz surface such as empty
* cross-fades when hovering buttons. For performance, we want to be using
* GL rendering so there isn't much point here as correctness is better.
*
* Additionally, so we can take avantage of faster paths in Core
* Graphics, we want our data pointer to be 16-byte aligned and our rows
* to be 16-byte aligned or we risk errors below us. Normally, cairo
* image surface does not guarantee the later, which means we could end
* up doing some costly copies along the way to compositing.
*/
if ([GDK_MACOS_SURFACE (surface)->window isOpaque])
format = CAIRO_FORMAT_RGB24;
else
format = CAIRO_FORMAT_ARGB32;
scale = gdk_surface_get_scale_factor (surface);
width = scale * gdk_surface_get_width (surface);
height = scale * gdk_surface_get_height (surface);
rowstride = (cairo_format_stride_for_width (format, width) + 0xF) & ~0xF;
size = rowstride * height;
data = g_malloc0 (size);
cairo_surface = cairo_image_surface_create_for_data (data, format, width, height, rowstride);
cairo_surface_set_user_data (cairo_surface, &buffer_key, data, g_free);
cairo_surface_set_device_scale (cairo_surface, scale, scale);
/* We use a cairo image surface here instead of a quartz surface because we
* get strange artifacts with the quartz surface such as empty cross-fades
* when hovering buttons. For performance, we want to be using GL rendering
* so there isn't much point here as correctness is better.
*/
cairo_surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height);
if (cairo_surface != NULL)
cairo_surface_set_device_scale (cairo_surface, scale, scale);
return cairo_surface;
}
static cairo_t *
do_cairo_create (GdkMacosCairoContext *self)
{
GdkSurface *surface;
cairo_t *cr;
g_assert (GDK_IS_MACOS_CAIRO_CONTEXT (self));
surface = gdk_draw_context_get_surface (GDK_DRAW_CONTEXT (self));
cr = cairo_create (self->window_surface);
/* Draw upside down as quartz prefers */
cairo_translate (cr, 0, surface->height);
cairo_scale (cr, 1.0, -1.0);
return cr;
}
static cairo_t *
_gdk_macos_cairo_context_cairo_create (GdkCairoContext *cairo_context)
{
@@ -114,10 +77,7 @@ _gdk_macos_cairo_context_cairo_create (GdkCairoContext *cairo_context)
g_assert (GDK_IS_MACOS_CAIRO_CONTEXT (self));
if (self->cr != NULL)
return cairo_reference (self->cr);
return do_cairo_create (self);
return cairo_create (self->window_surface);
}
static void
@@ -135,18 +95,20 @@ _gdk_macos_cairo_context_begin_frame (GdkDrawContext *draw_context,
nswindow = _gdk_macos_surface_get_native (GDK_MACOS_SURFACE (surface));
if (self->window_surface == NULL)
self->window_surface = create_cairo_surface_for_surface (surface);
self->cr = do_cairo_create (self);
if (![nswindow isOpaque])
{
cairo_save (self->cr);
gdk_cairo_region (self->cr, region);
cairo_set_source_rgba (self->cr, 0, 0, 0, 0);
cairo_set_operator (self->cr, CAIRO_OPERATOR_SOURCE);
cairo_fill (self->cr);
cairo_restore (self->cr);
self->window_surface = create_cairo_surface_for_surface (surface);
}
else
{
if (![nswindow isOpaque])
{
cairo_t *cr = cairo_create (self->window_surface);
gdk_cairo_region (cr, region);
cairo_set_source_rgba (cr, 0, 0, 0, 0);
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
cairo_fill (cr);
cairo_destroy (cr);
}
}
}
@@ -164,8 +126,6 @@ _gdk_macos_cairo_context_end_frame (GdkDrawContext *draw_context,
surface = gdk_draw_context_get_surface (draw_context);
nsview = _gdk_macos_surface_get_view (GDK_MACOS_SURFACE (surface));
g_clear_pointer (&self->cr, cairo_destroy);
if (GDK_IS_MACOS_CAIRO_VIEW (nsview))
[(GdkMacosCairoView *)nsview setCairoSurface:self->window_surface
withDamage:painted];
@@ -181,25 +141,12 @@ _gdk_macos_cairo_context_surface_resized (GdkDrawContext *draw_context)
g_clear_pointer (&self->window_surface, cairo_surface_destroy);
}
static void
_gdk_macos_cairo_context_dispose (GObject *object)
{
GdkMacosCairoContext *self = (GdkMacosCairoContext *)object;
g_clear_pointer (&self->window_surface, cairo_surface_destroy);
G_OBJECT_CLASS (_gdk_macos_cairo_context_parent_class)->dispose (object);
}
static void
_gdk_macos_cairo_context_class_init (GdkMacosCairoContextClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GdkCairoContextClass *cairo_context_class = GDK_CAIRO_CONTEXT_CLASS (klass);
GdkDrawContextClass *draw_context_class = GDK_DRAW_CONTEXT_CLASS (klass);
object_class->dispose = _gdk_macos_cairo_context_dispose;
draw_context_class->begin_frame = _gdk_macos_cairo_context_begin_frame;
draw_context_class->end_frame = _gdk_macos_cairo_context_end_frame;
draw_context_class->surface_resized = _gdk_macos_cairo_context_surface_resized;
+5 -14
View File
@@ -301,14 +301,10 @@ gdk_macos_display_frame_cb (gpointer data)
iter = iter->next;
_gdk_macos_surface_publish_timings (surface,
source->presentation_time,
source->refresh_interval);
_gdk_macos_display_remove_frame_callback (self, surface);
if (GDK_SURFACE_IS_MAPPED (GDK_SURFACE (surface)))
gdk_surface_thaw_updates (GDK_SURFACE (surface));
_gdk_macos_surface_thaw (surface,
source->presentation_time,
source->refresh_interval);
}
return G_SOURCE_CONTINUE;
@@ -730,8 +726,7 @@ _gdk_macos_display_open (const char *display_name)
if (self != NULL)
return NULL;
display_name = display_name ? display_name : "";
GDK_NOTE (MISC, g_message ("opening display %s", display_name));
GDK_NOTE (MISC, g_message ("opening display %s", display_name ? display_name : ""));
/* Make the current process a foreground application, i.e. an app
* with a user interface, in case we're not running from a .app bundle
@@ -992,11 +987,7 @@ _gdk_macos_display_add_frame_callback (GdkMacosDisplay *self,
if (!queue_contains (&self->awaiting_frames, &surface->frame))
{
/* Processing frames is always head to tail, so push to the
* head so that we don't possibly re-enter this right after
* adding to the queue.
*/
g_queue_push_head_link (&self->awaiting_frames, &surface->frame);
g_queue_push_tail_link (&self->awaiting_frames, &surface->frame);
if (self->awaiting_frames.length == 1)
gdk_display_link_source_unpause ((GdkDisplayLinkSource *)self->frame_source);
+4 -5
View File
@@ -29,11 +29,10 @@
G_BEGIN_DECLS
GdkMacosMonitor *_gdk_macos_monitor_new (GdkMacosDisplay *display,
CGDirectDisplayID screen_id);
CGDirectDisplayID _gdk_macos_monitor_get_screen_id (GdkMacosMonitor *self);
gboolean _gdk_macos_monitor_reconfigure (GdkMacosMonitor *self);
CGColorSpaceRef _gdk_macos_monitor_copy_colorspace (GdkMacosMonitor *self);
GdkMacosMonitor *_gdk_macos_monitor_new (GdkMacosDisplay *display,
CGDirectDisplayID screen_id);
CGDirectDisplayID _gdk_macos_monitor_get_screen_id (GdkMacosMonitor *self);
gboolean _gdk_macos_monitor_reconfigure (GdkMacosMonitor *self);
G_END_DECLS
-8
View File
@@ -298,11 +298,3 @@ _gdk_macos_monitor_get_screen_id (GdkMacosMonitor *self)
return self->screen_id;
}
CGColorSpaceRef
_gdk_macos_monitor_copy_colorspace (GdkMacosMonitor *self)
{
g_return_val_if_fail (GDK_IS_MACOS_MONITOR (self), NULL);
return CGDisplayCopyColorSpace (self->screen_id);
}
-4
View File
@@ -204,10 +204,6 @@ static void
_gdk_macos_popup_surface_finalize (GObject *object)
{
GdkMacosPopupSurface *self = (GdkMacosPopupSurface *)object;
GdkSurface *parent = GDK_SURFACE (self)->parent;
if (parent != NULL)
parent->children = g_list_remove (parent->children, self);
g_clear_object (&GDK_SURFACE (self)->parent);
g_clear_pointer (&self->layout, gdk_popup_layout_unref);
+1 -1
View File
@@ -104,7 +104,7 @@ void _gdk_macos_surface_resize (GdkMacosSurface
void _gdk_macos_surface_update_fullscreen_state (GdkMacosSurface *self);
void _gdk_macos_surface_update_position (GdkMacosSurface *self);
void _gdk_macos_surface_show (GdkMacosSurface *self);
void _gdk_macos_surface_publish_timings (GdkMacosSurface *self,
void _gdk_macos_surface_thaw (GdkMacosSurface *self,
gint64 predicted_presentation_time,
gint64 refresh_interval);
CGContextRef _gdk_macos_surface_acquire_context (GdkMacosSurface *self,
+13 -24
View File
@@ -125,8 +125,6 @@ gdk_macos_surface_hide (GdkSurface *surface)
g_assert (GDK_IS_MACOS_SURFACE (self));
_gdk_macos_display_remove_frame_callback (GDK_MACOS_DISPLAY (surface->display), self);
was_mapped = GDK_SURFACE_IS_MAPPED (GDK_SURFACE (self));
seat = gdk_display_get_default_seat (surface->display);
@@ -192,20 +190,15 @@ gdk_macos_surface_end_frame (GdkMacosSurface *self)
g_assert (GDK_IS_MACOS_SURFACE (self));
if (GDK_SURFACE_DESTROYED (self))
return;
display = gdk_surface_get_display (GDK_SURFACE (self));
frame_clock = gdk_surface_get_frame_clock (GDK_SURFACE (self));
if ((timings = gdk_frame_clock_get_current_timings (frame_clock)))
self->pending_frame_counter = timings->frame_counter;
if (GDK_SURFACE_IS_MAPPED (GDK_SURFACE (self)))
{
_gdk_macos_display_add_frame_callback (GDK_MACOS_DISPLAY (display), self);
gdk_surface_freeze_updates (GDK_SURFACE (self));
}
_gdk_macos_display_add_frame_callback (GDK_MACOS_DISPLAY (display), self);
gdk_surface_freeze_updates (GDK_SURFACE (self));
}
static void
@@ -217,11 +210,10 @@ gdk_macos_surface_before_paint (GdkMacosSurface *self,
g_assert (GDK_IS_MACOS_SURFACE (self));
g_assert (GDK_IS_FRAME_CLOCK (frame_clock));
if (GDK_SURFACE_DESTROYED (self))
if (surface->update_freeze_count > 0)
return;
if (surface->update_freeze_count == 0)
gdk_macos_surface_begin_frame (self);
gdk_macos_surface_begin_frame (self);
}
static void
@@ -233,11 +225,10 @@ gdk_macos_surface_after_paint (GdkMacosSurface *self,
g_assert (GDK_IS_MACOS_SURFACE (self));
g_assert (GDK_IS_FRAME_CLOCK (frame_clock));
if (GDK_SURFACE_DESTROYED (self))
if (surface->update_freeze_count > 0)
return;
if (surface->update_freeze_count == 0)
gdk_macos_surface_end_frame (self);
gdk_macos_surface_end_frame (self);
}
static void
@@ -724,17 +715,18 @@ _gdk_macos_surface_update_position (GdkMacosSurface *self)
}
void
_gdk_macos_surface_publish_timings (GdkMacosSurface *self,
gint64 presentation_time,
gint64 refresh_interval)
_gdk_macos_surface_thaw (GdkMacosSurface *self,
gint64 presentation_time,
gint64 refresh_interval)
{
GdkFrameTimings *timings;
GdkFrameClock *frame_clock;
g_return_if_fail (GDK_IS_MACOS_SURFACE (self));
if (!(frame_clock = gdk_surface_get_frame_clock (GDK_SURFACE (self))))
return;
gdk_surface_thaw_updates (GDK_SURFACE (self));
frame_clock = gdk_surface_get_frame_clock (GDK_SURFACE (self));
if (self->pending_frame_counter)
{
@@ -994,9 +986,6 @@ _gdk_macos_surface_monitor_changed (GdkMacosSurface *self)
g_object_unref (monitor);
}
_gdk_surface_update_size (GDK_SURFACE (self));
gdk_surface_invalidate_rect (GDK_SURFACE (self), NULL);
}
GdkMonitor *
+1 -1
View File
@@ -181,8 +181,8 @@ gdk_wayland_cairo_context_end_frame (GdkDrawContext *draw_context,
GdkWaylandCairoContext *self = GDK_WAYLAND_CAIRO_CONTEXT (draw_context);
GdkSurface *surface = gdk_draw_context_get_surface (draw_context);
gdk_wayland_surface_sync (surface);
gdk_wayland_surface_attach_image (surface, self->paint_surface, painted);
gdk_wayland_surface_sync (surface);
gdk_wayland_surface_request_frame (surface);
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "wayland", "surface commit");
-92
View File
@@ -227,7 +227,6 @@ struct _GdkWaylandSeat
struct wl_touch *wl_touch;
struct zwp_pointer_gesture_swipe_v1 *wp_pointer_gesture_swipe;
struct zwp_pointer_gesture_pinch_v1 *wp_pointer_gesture_pinch;
struct zwp_pointer_gesture_hold_v1 *wp_pointer_gesture_hold;
struct zwp_tablet_seat_v2 *wp_tablet_seat;
GdkDisplay *display;
@@ -2857,81 +2856,6 @@ gesture_pinch_end (void *data,
0, 0, 1, 0);
}
static void
emit_gesture_hold_event (GdkWaylandSeat *seat,
GdkTouchpadGesturePhase phase,
guint32 _time,
guint32 n_fingers)
{
GdkEvent *event;
if (!seat->pointer_info.focus)
return;
seat->pointer_info.time = _time;
event = gdk_touchpad_event_new_hold (seat->pointer_info.focus,
seat->logical_pointer,
_time,
device_get_modifiers (seat->logical_pointer),
phase,
seat->pointer_info.surface_x,
seat->pointer_info.surface_y,
n_fingers);
if (GDK_DISPLAY_DEBUG_CHECK (gdk_seat_get_display (GDK_SEAT (seat)), EVENTS))
{
double x, y;
gdk_event_get_position (event, &x, &y);
g_message ("hold event %d, coords: %f %f, seat %p state %d",
gdk_event_get_event_type (event),
x, y, seat,
gdk_event_get_modifier_state (event));
}
_gdk_wayland_display_deliver_event (seat->display, event);
}
static void
gesture_hold_begin (void *data,
struct zwp_pointer_gesture_hold_v1 *hold,
uint32_t serial,
uint32_t time,
struct wl_surface *surface,
uint32_t fingers)
{
GdkWaylandSeat *seat = data;
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (seat->display);
_gdk_wayland_display_update_serial (display, serial);
emit_gesture_hold_event (seat,
GDK_TOUCHPAD_GESTURE_PHASE_BEGIN,
time, fingers);
seat->gesture_n_fingers = fingers;
}
static void
gesture_hold_end (void *data,
struct zwp_pointer_gesture_hold_v1 *hold,
uint32_t serial,
uint32_t time,
int32_t cancelled)
{
GdkWaylandSeat *seat = data;
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (seat->display);
GdkTouchpadGesturePhase phase;
_gdk_wayland_display_update_serial (display, serial);
phase = (cancelled) ?
GDK_TOUCHPAD_GESTURE_PHASE_CANCEL :
GDK_TOUCHPAD_GESTURE_PHASE_END;
emit_gesture_hold_event (seat, phase, time,
seat->gesture_n_fingers);
}
static void
_gdk_wayland_seat_remove_tool (GdkWaylandSeat *seat,
GdkWaylandTabletToolData *tool)
@@ -3141,11 +3065,6 @@ static const struct zwp_pointer_gesture_pinch_v1_listener gesture_pinch_listener
gesture_pinch_end
};
static const struct zwp_pointer_gesture_hold_v1_listener gesture_hold_listener = {
gesture_hold_begin,
gesture_hold_end
};
static const struct zwp_tablet_v2_listener tablet_listener = {
tablet_handle_name,
tablet_handle_id,
@@ -3201,17 +3120,6 @@ seat_handle_capabilities (void *data,
seat);
zwp_pointer_gesture_pinch_v1_add_listener (seat->wp_pointer_gesture_pinch,
&gesture_pinch_listener, seat);
if (display_wayland->pointer_gestures_version >= ZWP_POINTER_GESTURES_V1_GET_HOLD_GESTURE_SINCE_VERSION)
{
seat->wp_pointer_gesture_hold =
zwp_pointer_gestures_v1_get_hold_gesture (display_wayland->pointer_gestures,
seat->wl_pointer);
zwp_pointer_gesture_hold_v1_set_user_data (seat->wp_pointer_gesture_hold,
seat);
zwp_pointer_gesture_hold_v1_add_listener (seat->wp_pointer_gesture_hold,
&gesture_hold_listener, seat);
}
}
}
else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && seat->wl_pointer)
+1 -5
View File
@@ -366,8 +366,7 @@ gdk_registry_handle_global (void *data,
if (strcmp (interface, "wl_compositor") == 0)
{
display_wayland->compositor =
wl_registry_bind (display_wayland->wl_registry, id,
&wl_compositor_interface, MIN (version, 5));
wl_registry_bind (display_wayland->wl_registry, id, &wl_compositor_interface, MIN (version, 4));
display_wayland->compositor_version = MIN (version, 4);
}
else if (strcmp (interface, "wl_shm") == 0)
@@ -431,9 +430,6 @@ gdk_registry_handle_global (void *data,
}
else if (strcmp (interface, "zwp_pointer_gestures_v1") == 0)
{
display_wayland->pointer_gestures_version =
MIN (version, GDK_ZWP_POINTER_GESTURES_V1_VERSION);
display_wayland->pointer_gestures =
wl_registry_bind (display_wayland->wl_registry,
id, &zwp_pointer_gestures_v1_interface,
+1 -2
View File
@@ -52,7 +52,7 @@
G_BEGIN_DECLS
#define GDK_ZWP_POINTER_GESTURES_V1_VERSION 3
#define GDK_ZWP_POINTER_GESTURES_V1_VERSION 1
typedef struct _GdkWaylandSelection GdkWaylandSelection;
@@ -140,7 +140,6 @@ struct _GdkWaylandDisplay
int data_device_manager_version;
int gtk_shell_version;
int xdg_output_manager_version;
int pointer_gestures_version;
int xdg_activation_version;
uint32_t server_decoration_mode;
-1
View File
@@ -101,7 +101,6 @@ gdk_wayland_primary_claim_remote (GdkWaylandPrimary *cb,
{
GDK_DISPLAY_NOTE (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), CLIPBOARD, g_message ("%p: Ignoring clipboard offer for self", cb));
gdk_content_formats_unref (formats);
g_clear_pointer (&offer, zwp_primary_selection_offer_v1_destroy);
return;
}
+25 -45
View File
@@ -118,6 +118,7 @@ struct _GdkWaylandSurface
unsigned int mapped : 1;
unsigned int awaiting_frame : 1;
unsigned int awaiting_frame_frozen : 1;
unsigned int is_drag_surface : 1;
int pending_buffer_offset_x;
int pending_buffer_offset_y;
@@ -779,22 +780,11 @@ gdk_wayland_surface_update_scale (GdkSurface *surface)
return;
}
if (!impl->display_server.outputs)
scale = 1;
for (l = impl->display_server.outputs; l != NULL; l = l->next)
{
scale = impl->scale;
}
else
{
scale = 1;
for (l = impl->display_server.outputs; l != NULL; l = l->next)
{
struct wl_output *output = l->data;
uint32_t output_scale;
output_scale = gdk_wayland_display_get_output_scale (display_wayland,
output);
scale = MAX (scale, output_scale);
}
guint32 output_scale = gdk_wayland_display_get_output_scale (display_wayland, l->data);
scale = MAX (scale, output_scale);
}
/* Notify app that scale changed */
@@ -935,33 +925,12 @@ gdk_wayland_surface_attach_image (GdkSurface *surface,
}
}
static void
gdk_wayland_surface_sync_offset (GdkSurface *surface)
{
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
if (wl_surface_get_version (impl->display_server.wl_surface) <
WL_SURFACE_OFFSET_SINCE_VERSION)
return;
if (impl->pending_buffer_offset_x == 0 &&
impl->pending_buffer_offset_y == 0)
return;
wl_surface_offset (impl->display_server.wl_surface,
impl->pending_buffer_offset_x,
impl->pending_buffer_offset_y);
impl->pending_buffer_offset_x = 0;
impl->pending_buffer_offset_y = 0;
}
void
gdk_wayland_surface_sync (GdkSurface *surface)
{
gdk_wayland_surface_sync_shadow (surface);
gdk_wayland_surface_sync_opaque_region (surface);
gdk_wayland_surface_sync_input_region (surface);
gdk_wayland_surface_sync_offset (surface);
}
static gboolean
@@ -1498,7 +1467,6 @@ gdk_wayland_surface_configure_toplevel (GdkSurface *surface)
int width, height;
gboolean is_resizing;
gboolean fixed_size;
gboolean was_fixed_size;
gboolean saved_size;
new_state = impl->pending.toplevel.state;
@@ -1513,11 +1481,6 @@ gdk_wayland_surface_configure_toplevel (GdkSurface *surface)
GDK_TOPLEVEL_STATE_TILED) ||
is_resizing;
was_fixed_size =
surface->state & (GDK_TOPLEVEL_STATE_MAXIMIZED |
GDK_TOPLEVEL_STATE_FULLSCREEN |
GDK_TOPLEVEL_STATE_TILED);
width = impl->pending.toplevel.width;
height = impl->pending.toplevel.height;
@@ -1530,7 +1493,7 @@ gdk_wayland_surface_configure_toplevel (GdkSurface *surface)
* the client should configure its size back to what it was before
* being maximize or fullscreen.
*/
if (saved_size && !fixed_size && was_fixed_size)
if (saved_size && !fixed_size)
{
width = impl->saved_width;
height = impl->saved_height;
@@ -2320,7 +2283,8 @@ gdk_wayland_toplevel_inhibit_idle (GdkToplevel *toplevel)
if (!wayland_toplevel->idle_inhibitor)
{
g_assert (wayland_toplevel->idle_inhibitor_refcount == 0);
g_assert (wayland_toplevel->idle_inhibitor &&
wayland_toplevel->idle_inhibitor_refcount > 0);
wayland_toplevel->idle_inhibitor =
zwp_idle_inhibit_manager_v1_create_inhibitor (display_wayland->idle_inhibit_manager,
@@ -2861,12 +2825,27 @@ find_grab_input_seat (GdkSurface *surface,
return NULL;
}
static gboolean
should_be_mapped (GdkSurface *surface)
{
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
/* Don't map crazy temp that GTK uses for internal X11 shenanigans. */
if (GDK_IS_DRAG_SURFACE (surface) && surface->x < 0 && surface->y < 0)
return FALSE;
if (impl->is_drag_surface)
return FALSE;
return TRUE;
}
static void
gdk_wayland_surface_map_toplevel (GdkSurface *surface)
{
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
if (!GDK_IS_WAYLAND_TOPLEVEL (surface))
if (!should_be_mapped (surface))
return;
if (impl->mapped)
@@ -4724,6 +4703,7 @@ create_dnd_surface (GdkDisplay *display)
GDK_SURFACE_TEMP,
NULL,
0, 0, 100, 100);
GDK_WAYLAND_SURFACE (surface)->is_drag_surface = TRUE;
return surface;
}
+1 -1
View File
@@ -71,7 +71,7 @@ foreach p: proto_sources
elif proto_stability == 'staging'
proto_version = p.get(2)
output_base = '@0@-@1@'.format(proto_name, proto_version)
input = files(join_paths(wlproto_dir, '@0@/@1@/@2@.xml'.format(proto_stability, proto_name, output_base)))
input = join_paths(wlproto_dir, '@0@/@1@/@2@.xml'.format(proto_stability, proto_name, output_base))
elif proto_stability == 'private'
output_base = proto_name
input = files('protocol/@0@.xml'.format(proto_name))
+54 -80
View File
@@ -945,71 +945,38 @@ _gdk_win32_enable_hidpi (GdkWin32Display *display)
}
}
gboolean
_gdk_win32_check_processor (GdkWin32ProcessorCheckType check_type)
static void
_gdk_win32_check_on_arm64 (GdkWin32Display *display)
{
static gsize checked = 0;
static gboolean is_arm64 = FALSE;
static gboolean is_wow64 = FALSE;
if (g_once_init_enter (&checked))
{
gboolean fallback_wow64_check = FALSE;
HMODULE kernel32 = LoadLibraryW (L"kernel32.dll");
if (kernel32 != NULL)
{
typedef BOOL (WINAPI *funcIsWow64Process2) (HANDLE, USHORT *, USHORT *);
funcIsWow64Process2 isWow64Process2 =
display->cpu_funcs.isWow64Process2 =
(funcIsWow64Process2) GetProcAddress (kernel32, "IsWow64Process2");
if (isWow64Process2 != NULL)
if (display->cpu_funcs.isWow64Process2 != NULL)
{
USHORT proc_cpu = 0;
USHORT native_cpu = 0;
isWow64Process2 (GetCurrentProcess (), &proc_cpu, &native_cpu);
display->cpu_funcs.isWow64Process2 (GetCurrentProcess (),
&proc_cpu,
&native_cpu);
if (native_cpu == IMAGE_FILE_MACHINE_ARM64)
is_arm64 = TRUE;
if (proc_cpu != IMAGE_FILE_MACHINE_UNKNOWN)
is_wow64 = TRUE;
}
else
{
fallback_wow64_check = TRUE;
display->running_on_arm64 = TRUE;
}
FreeLibrary (kernel32);
}
else
{
fallback_wow64_check = TRUE;
}
if (fallback_wow64_check)
IsWow64Process (GetCurrentProcess (), &is_wow64);
g_once_init_leave (&checked, 1);
}
switch (check_type)
{
case GDK_WIN32_ARM64:
return is_arm64;
break;
case GDK_WIN32_WOW64:
return is_wow64;
break;
default:
g_warning ("unknown CPU check type");
return FALSE;
break;
}
}
static void
@@ -1020,7 +987,7 @@ gdk_win32_display_init (GdkWin32Display *display_win32)
display_win32->monitors = G_LIST_MODEL (g_list_store_new (GDK_TYPE_MONITOR));
_gdk_win32_enable_hidpi (display_win32);
display_win32->running_on_arm64 = _gdk_win32_check_processor (GDK_WIN32_ARM64);
_gdk_win32_check_on_arm64 (display_win32);
/* if we have DPI awareness, set up fixed scale if set */
if (display_win32->dpi_aware_type != PROCESS_DPI_UNAWARE &&
@@ -1175,18 +1142,16 @@ gdk_win32_display_get_setting (GdkDisplay *display,
#define EGL_PLATFORM_ANGLE_ANGLE 0x3202
#endif
static GdkGLContext *
gdk_win32_display_init_gl (GdkDisplay *display,
GError **error)
static gboolean
gdk_win32_display_init_gl_backend (GdkDisplay *display,
GError **error)
{
gboolean result = FALSE;
GdkWin32Display *display_win32 = GDK_WIN32_DISPLAY (display);
HDC init_gl_hdc = NULL;
if (display_win32->dummy_context_wgl.hdc == NULL)
display_win32->dummy_context_wgl.hdc = GetDC (display_win32->hwnd);
init_gl_hdc = display_win32->dummy_context_wgl.hdc;
/*
* No env vars set, do the regular GL initialization, first WGL and then EGL,
* as WGL is the more tried-and-tested configuration.
@@ -1194,50 +1159,59 @@ gdk_win32_display_init_gl (GdkDisplay *display,
#ifdef HAVE_EGL
/*
* Disable defaulting to EGL as EGL is used more as a compatibility layer
* Disable defaulting to EGL for now, since shaders need to be fixed for
* usage against libANGLE EGL. EGL is used more as a compatibility layer
* on Windows rather than being a native citizen on Windows
*/
if (GDK_DEBUG_CHECK (GL_EGL) || GDK_DEBUG_CHECK (GL_GLES))
{
if (gdk_display_init_egl (display,
EGL_PLATFORM_ANGLE_ANGLE,
init_gl_hdc,
FALSE,
error))
{
return g_object_new (GDK_TYPE_WIN32_GL_CONTEXT_EGL,
"display", display,
NULL);
}
else
g_clear_error (error);
}
if (_gdk_debug_flags & GDK_DEBUG_GL_EGL)
result = gdk_display_init_egl (display,
EGL_PLATFORM_ANGLE_ANGLE,
display_win32->dummy_context_wgl.hdc,
FALSE,
error);
#endif
if (gdk_win32_display_init_wgl (display, error))
if (!result)
{
return g_object_new (GDK_TYPE_WIN32_GL_CONTEXT_WGL,
"display", display,
NULL);
g_clear_error (error);
result = gdk_win32_display_init_wgl (display, error);
}
#ifdef HAVE_EGL
g_clear_error (error);
if (gdk_display_init_egl (display,
EGL_PLATFORM_ANGLE_ANGLE,
init_gl_hdc,
TRUE,
error))
if (!result)
{
return g_object_new (GDK_TYPE_WIN32_GL_CONTEXT_EGL,
"display", display,
NULL);
g_clear_error (error);
result = gdk_display_init_egl (display,
EGL_PLATFORM_ANGLE_ANGLE,
display_win32->dummy_context_wgl.hdc,
TRUE,
error);
}
#endif
return NULL;
return result;
}
static GdkGLContext *
gdk_win32_display_init_gl (GdkDisplay *display,
GError **error)
{
GdkWin32Display *display_win32 = GDK_WIN32_DISPLAY (display);
GdkGLContext *gl_context = NULL;
if (!gdk_win32_display_init_gl_backend (display, error))
return NULL;
if (display_win32->wgl_pixel_format != 0)
gl_context = g_object_new (GDK_TYPE_WIN32_GL_CONTEXT_WGL, "display", display, NULL);
#ifdef HAVE_EGL
else if (gdk_display_get_egl_display (display))
gl_context = g_object_new (GDK_TYPE_WIN32_GL_CONTEXT_EGL, "display", display, NULL);
#endif
g_return_val_if_fail (gl_context != NULL, NULL);
return gl_context;
}
/**
+9
View File
@@ -105,6 +105,13 @@ typedef enum {
GDK_WIN32_TABLET_INPUT_API_WINPOINTER
} GdkWin32TabletInputAPI;
/* Detect running architecture */
typedef BOOL (WINAPI *funcIsWow64Process2) (HANDLE, USHORT *, USHORT *);
typedef struct _GdkWin32KernelCPUFuncs
{
funcIsWow64Process2 isWow64Process2;
} GdkWin32KernelCPUFuncs;
typedef struct
{
HDC hdc;
@@ -125,6 +132,7 @@ struct _GdkWin32Display
/* WGL/OpenGL Items */
GdkWin32GLDummyContextWGL dummy_context_wgl;
int wgl_pixel_format;
guint gl_version;
GListModel *monitors;
@@ -169,6 +177,7 @@ struct _GdkWin32Display
/* Running CPU items */
guint running_on_arm64 : 1;
GdkWin32KernelCPUFuncs cpu_funcs;
};
struct _GdkWin32DisplayClass
+290 -306
View File
@@ -19,7 +19,7 @@
*/
/*
* Modified by the GTK+ Team and others 1997-2020. See the AUTHORS
* 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/.
@@ -644,9 +644,11 @@ build_key_event_state (BYTE *key_state)
{
GdkModifierType state;
GdkWin32Keymap *keymap;
keymap = GDK_WIN32_KEYMAP (_gdk_win32_display_get_keymap (_gdk_display));
state = _gdk_win32_keymap_get_mod_mask (keymap);
state = 0;
if (key_state[VK_SHIFT] & 0x80)
state |= GDK_SHIFT_MASK;
if (key_state[VK_CAPITAL] & 0x01)
state |= GDK_LOCK_MASK;
@@ -662,6 +664,26 @@ build_key_event_state (BYTE *key_state)
if (key_state[VK_XBUTTON2] & 0x80)
state |= GDK_BUTTON5_MASK;
keymap = GDK_WIN32_KEYMAP (_gdk_win32_display_get_keymap (_gdk_display));
if (_gdk_win32_keymap_has_altgr (keymap) &&
(key_state[VK_LCONTROL] & 0x80) &&
(key_state[VK_RMENU] & 0x80))
{
state |= GDK_MOD2_MASK;
if (key_state[VK_RCONTROL] & 0x80)
state |= GDK_CONTROL_MASK;
if (key_state[VK_LMENU] & 0x80)
state |= GDK_ALT_MASK;
}
else
{
if (key_state[VK_CONTROL] & 0x80)
state |= GDK_CONTROL_MASK;
if (key_state[VK_MENU] & 0x80)
state |= GDK_ALT_MASK;
}
return state;
}
@@ -1740,12 +1762,16 @@ gdk_event_translate (MSG *msg,
POINT point;
MINMAXINFO *mmi;
HWND hwnd;
BYTE key_state[256];
HIMC himc;
WINDOWPOS *windowpos;
gboolean ignore_leave;
GdkEvent *event;
wchar_t wbuf[100];
int ccount;
GdkDisplay *display;
GdkSurface *window = NULL;
GdkWin32Surface *impl;
@@ -1763,12 +1789,20 @@ gdk_event_translate (MSG *msg,
int button;
char buf[256];
gboolean return_val = FALSE;
int i;
GdkModifierType state;
guint keyval;
guint16 keycode;
guint8 group;
gboolean is_modifier;
double delta_x, delta_y;
GdkScrollDirection direction;
GdkTranslatedKey translated;
display = gdk_display_get_default ();
win32_display = GDK_WIN32_DISPLAY (display);
@@ -1827,39 +1861,35 @@ gdk_event_translate (MSG *msg,
switch (msg->message)
{
case WM_INPUTLANGCHANGE:
{
GdkWin32Keymap *win32_keymap;
GdkTranslatedKey translated;
_gdk_input_locale = (HKL) msg->lParam;
_gdk_win32_keymap_set_active_layout (GDK_WIN32_KEYMAP (_gdk_win32_display_get_keymap (_gdk_display)), _gdk_input_locale);
GetLocaleInfo (MAKELCID (LOWORD (_gdk_input_locale), SORT_DEFAULT),
LOCALE_IDEFAULTANSICODEPAGE,
buf, sizeof (buf));
_gdk_input_codepage = atoi (buf);
_gdk_keymap_serial++;
GDK_NOTE (EVENTS,
g_print (" cs:%lu hkl:%p%s cp:%d",
(gulong) msg->wParam,
(gpointer) msg->lParam, _gdk_input_locale_is_ime ? " (IME)" : "",
_gdk_input_codepage));
gdk_display_setting_changed (display, "gtk-im-module");
win32_keymap = GDK_WIN32_KEYMAP (_gdk_win32_display_get_keymap (_gdk_display));
_gdk_input_locale = (HKL) msg->lParam;
_gdk_win32_keymap_set_active_layout (win32_keymap, _gdk_input_locale);
_gdk_keymap_serial++;
GDK_NOTE (EVENTS,
g_print (" cs:%lu hkl:%p%s",
(gulong) msg->wParam,
(gpointer) msg->lParam,
_gdk_input_locale_is_ime ? " (IME)" : ""));
gdk_display_setting_changed (display, "gtk-im-module");
/* Generate a dummy key event to "nudge" IMContext */
translated.keyval = GDK_KEY_VoidSymbol;
translated.consumed = 0;
translated.layout = 0;
translated.level = 0;
event = gdk_key_event_new (GDK_KEY_PRESS,
window,
device_manager_win32->core_keyboard,
_gdk_win32_get_next_tick (msg->time),
0,
0,
FALSE,
&translated,
&translated);
_gdk_win32_append_event (event);
}
/* Generate a dummy key event to "nudge" IMContext */
translated.keyval = GDK_KEY_VoidSymbol;
translated.consumed = 0;
translated.layout = 0;
translated.level = 0;
event = gdk_key_event_new (GDK_KEY_PRESS,
window,
device_manager_win32->core_keyboard,
_gdk_win32_get_next_tick (msg->time),
0,
0,
FALSE,
&translated,
&translated);
_gdk_win32_append_event (event);
break;
case WM_SYSKEYUP:
@@ -1896,203 +1926,177 @@ gdk_event_translate (MSG *msg,
decode_key_lparam (msg->lParam)));
keyup_or_down:
{
GdkWin32Keymap *win32_keymap;
GdkModifierType state;
guint keyval;
guint16 keycode;
guint8 group;
gboolean is_modifier;
GdkTranslatedKey translated;
GdkTranslatedKey no_lock;
BYTE key_state[256];
wchar_t wbuf[100];
int ccount = 0;
/* Ignore key messages intended for the IME */
if (msg->wParam == VK_PROCESSKEY || in_ime_composition)
break;
/* Ignore key messages intended for the IME */
if (msg->wParam == VK_PROCESSKEY ||
in_ime_composition)
break;
/* Ignore autorepeats on modifiers */
if (msg->message == WM_KEYDOWN &&
(msg->wParam == VK_MENU ||
msg->wParam == VK_CONTROL ||
msg->wParam == VK_SHIFT) &&
((HIWORD(msg->lParam) & KF_REPEAT) >= 1))
break;
/* Ignore autorepeats on modifiers */
if (msg->message == WM_KEYDOWN &&
(msg->wParam == VK_MENU ||
msg->wParam == VK_CONTROL ||
msg->wParam == VK_SHIFT) &&
((HIWORD(msg->lParam) & KF_REPEAT) >= 1))
break;
if (GDK_SURFACE_DESTROYED (window))
break;
if (GDK_SURFACE_DESTROYED (window))
break;
win32_keymap = GDK_WIN32_KEYMAP (_gdk_win32_display_get_keymap (display));
impl = GDK_WIN32_SURFACE (window);
impl = GDK_WIN32_SURFACE (window);
API_CALL (GetKeyboardState, (key_state));
API_CALL (GetKeyboardState, (key_state));
ccount = 0;
ccount = 0;
if (msg->wParam == VK_PACKET)
{
ccount = ToUnicode (VK_PACKET, HIWORD (msg->lParam), key_state, wbuf, 1, 0);
if (ccount == 1)
{
if (wbuf[0] >= 0xD800 && wbuf[0] < 0xDC00)
{
if (msg->message == WM_KEYDOWN)
impl->leading_surrogate_keydown = wbuf[0];
else
impl->leading_surrogate_keyup = wbuf[0];
if (msg->wParam == VK_PACKET)
{
ccount = ToUnicode (VK_PACKET, HIWORD (msg->lParam), key_state, wbuf, 1, 0);
if (ccount == 1)
{
if (wbuf[0] >= 0xD800 && wbuf[0] < 0xDC00)
{
if (msg->message == WM_KEYDOWN)
impl->leading_surrogate_keydown = wbuf[0];
else
impl->leading_surrogate_keyup = wbuf[0];
/* don't emit an event */
return_val = TRUE;
break;
}
else
{
/* wait until an event is created */;
}
}
}
/* don't emit an event */
return_val = TRUE;
break;
}
else
{
/* wait until an event is created */;
}
}
}
keyval = GDK_KEY_VoidSymbol;
keycode = msg->wParam;
keyval = GDK_KEY_VoidSymbol;
keycode = msg->wParam;
if (HIWORD (msg->lParam) & KF_EXTENDED)
{
switch (msg->wParam)
{
case VK_CONTROL:
keycode = VK_RCONTROL;
break;
case VK_SHIFT: /* Actually, KF_EXTENDED is not set
* for the right shift key.
*/
keycode = VK_RSHIFT;
break;
case VK_MENU:
keycode = VK_RMENU;
break;
}
}
else if (msg->wParam == VK_SHIFT &&
LOBYTE (HIWORD (msg->lParam)) == _gdk_win32_keymap_get_rshift_scancode (win32_keymap))
keycode = VK_RSHIFT;
if (HIWORD (msg->lParam) & KF_EXTENDED)
{
switch (msg->wParam)
{
case VK_CONTROL:
keycode = VK_RCONTROL;
break;
case VK_SHIFT: /* Actually, KF_EXTENDED is not set
* for the right shift key.
*/
keycode = VK_RSHIFT;
break;
case VK_MENU:
keycode = VK_RMENU;
break;
}
}
else if (msg->wParam == VK_SHIFT &&
LOBYTE (HIWORD (msg->lParam)) == _gdk_win32_keymap_get_rshift_scancode (GDK_WIN32_KEYMAP (_gdk_win32_display_get_keymap (_gdk_display))))
keycode = VK_RSHIFT;
is_modifier = (msg->wParam == VK_CONTROL ||
msg->wParam == VK_SHIFT ||
msg->wParam == VK_MENU);
is_modifier = (msg->wParam == VK_CONTROL ||
msg->wParam == VK_SHIFT ||
msg->wParam == VK_MENU);
/* g_print ("ctrl:%02x lctrl:%02x rctrl:%02x alt:%02x lalt:%02x ralt:%02x\n", key_state[VK_CONTROL], key_state[VK_LCONTROL], key_state[VK_RCONTROL], key_state[VK_MENU], key_state[VK_LMENU], key_state[VK_RMENU]); */
state = build_key_event_state (key_state);
group = get_active_group ();
state = build_key_event_state (key_state);
group = get_active_group ();
if (msg->wParam == VK_PACKET && ccount == 1)
{
if (wbuf[0] >= 0xD800 && wbuf[0] < 0xDC00)
{
g_assert_not_reached ();
}
else if (wbuf[0] >= 0xDC00 && wbuf[0] < 0xE000)
{
wchar_t leading;
if (msg->wParam == VK_PACKET && ccount == 1)
{
if (wbuf[0] >= 0xD800 && wbuf[0] < 0xDC00)
{
g_assert_not_reached ();
}
else if (wbuf[0] >= 0xDC00 && wbuf[0] < 0xE000)
{
wchar_t leading;
if (msg->message == WM_KEYDOWN)
leading = impl->leading_surrogate_keydown;
else
leading = impl->leading_surrogate_keyup;
if (msg->message == WM_KEYDOWN)
leading = impl->leading_surrogate_keydown;
else
leading = impl->leading_surrogate_keyup;
keyval = gdk_unicode_to_keyval ((leading - 0xD800) * 0x400 + wbuf[0] - 0xDC00 + 0x10000);
}
else
{
keyval = gdk_unicode_to_keyval (wbuf[0]);
}
keyval = gdk_unicode_to_keyval ((leading - 0xD800) * 0x400 + wbuf[0] - 0xDC00 + 0x10000);
}
else
{
keyval = gdk_unicode_to_keyval (wbuf[0]);
}
}
else
{
gdk_keymap_translate_keyboard_state (_gdk_win32_display_get_keymap (display),
keycode,
state,
group,
&keyval,
NULL, NULL, NULL);
}
translated.keyval = keyval;
translated.consumed = 0;
translated.layout = 0;
translated.level = 0;
if (msg->message == WM_KEYDOWN)
impl->leading_surrogate_keydown = 0;
else
impl->leading_surrogate_keyup = 0;
no_lock = translated;
}
else
{
int level = 0;
int effective_group = 0;
GdkModifierType consumed = 0;
/* Only one release key event is fired when both shift keys are pressed together
and then released. In order to send the missing event, press events for shift
keys are recorded and sent together when the release event occurs.
Other modifiers (e.g. ctrl, alt) don't have this problem. */
if (msg->message == WM_KEYDOWN && msg->wParam == VK_SHIFT)
{
int pressed_shift = msg->lParam & 0xffffff; /* mask shift modifier */
if (both_shift_pressed[0] == 0)
both_shift_pressed[0] = pressed_shift;
else if (both_shift_pressed[0] != pressed_shift)
both_shift_pressed[1] = pressed_shift;
}
gdk_keymap_translate_keyboard_state ((GdkKeymap*) win32_keymap, keycode, state, group,
&keyval, &effective_group, &level, &consumed);
translated.keyval = keyval;
translated.consumed = consumed;
translated.layout = effective_group;
translated.level = level;
if (msg->message == WM_KEYUP && msg->wParam == VK_SHIFT)
{
if (both_shift_pressed[0] != 0 && both_shift_pressed[1] != 0)
{
int tmp_retval;
MSG fake_release = *msg;
int pressed_shift = msg->lParam & 0xffffff;
gdk_keymap_translate_keyboard_state ((GdkKeymap*) win32_keymap, keycode,
state & ~GDK_LOCK_MASK, group, &keyval,
&effective_group, &level, &consumed);
no_lock.keyval = keyval;
no_lock.consumed = consumed;
no_lock.layout = effective_group;
no_lock.level = level;
}
if (both_shift_pressed[0] == pressed_shift)
fake_release.lParam = both_shift_pressed[1];
else
fake_release.lParam = both_shift_pressed[0];
if (msg->message == WM_KEYDOWN)
impl->leading_surrogate_keydown = 0;
else
impl->leading_surrogate_keyup = 0;
both_shift_pressed[0] = both_shift_pressed[1] = 0;
gdk_event_translate (&fake_release, &tmp_retval);
}
both_shift_pressed[0] = both_shift_pressed[1] = 0;
}
/* Only one release key event is fired when both shift keys are pressed together
and then released. In order to send the missing event, press events for shift
keys are recorded and sent together when the release event occurs.
Other modifiers (e.g. ctrl, alt) don't have this problem. */
if (msg->message == WM_KEYDOWN && msg->wParam == VK_SHIFT)
{
int pressed_shift = msg->lParam & 0xffffff; /* mask shift modifier */
if (both_shift_pressed[0] == 0)
both_shift_pressed[0] = pressed_shift;
else if (both_shift_pressed[0] != pressed_shift)
both_shift_pressed[1] = pressed_shift;
}
/* Reset ALT_MASK if it is the Alt key itself */
if (msg->wParam == VK_MENU)
state &= ~GDK_ALT_MASK;
if (msg->message == WM_KEYUP && msg->wParam == VK_SHIFT)
{
if (both_shift_pressed[0] != 0 && both_shift_pressed[1] != 0)
{
int tmp_retval;
MSG fake_release = *msg;
int pressed_shift = msg->lParam & 0xffffff;
/* FIXME do proper translation */
translated.keyval = keyval;
translated.consumed = 0;
translated.layout = group;
translated.level = 0;
event = gdk_key_event_new ((msg->message == WM_KEYDOWN || msg->message == WM_SYSKEYDOWN)
? GDK_KEY_PRESS
: GDK_KEY_RELEASE,
window,
device_manager_win32->core_keyboard,
_gdk_win32_get_next_tick (msg->time),
keycode,
state,
is_modifier,
&translated,
&translated);
if (both_shift_pressed[0] == pressed_shift)
fake_release.lParam = both_shift_pressed[1];
else
fake_release.lParam = both_shift_pressed[0];
_gdk_win32_append_event (event);
both_shift_pressed[0] = both_shift_pressed[1] = 0;
gdk_event_translate (&fake_release, &tmp_retval);
}
both_shift_pressed[0] = both_shift_pressed[1] = 0;
}
/* Reset ALT_MASK if it is the Alt key itself */
if (msg->wParam == VK_MENU)
state &= ~GDK_ALT_MASK;
event = gdk_key_event_new ((msg->message == WM_KEYDOWN || msg->message == WM_SYSKEYDOWN)
? GDK_KEY_PRESS
: GDK_KEY_RELEASE,
window,
device_manager_win32->core_keyboard,
_gdk_win32_get_next_tick (msg->time),
keycode,
state,
is_modifier,
&translated,
&no_lock);
_gdk_win32_append_event (event);
return_val = TRUE;
}
return_val = TRUE;
break;
case WM_SYSCHAR:
@@ -2113,82 +2117,73 @@ gdk_event_translate (MSG *msg,
break;
case WM_IME_COMPOSITION:
{
BYTE key_state[256];
wchar_t wbuf[100];
int ccount = 0;
/* On Win2k WM_IME_CHAR doesn't work correctly for non-Unicode
* applications. Thus, handle WM_IME_COMPOSITION with
* GCS_RESULTSTR instead, fetch the Unicode chars from the IME
* with ImmGetCompositionStringW().
*
* See for instance
* http://groups.google.com/groups?selm=natX5.57%24g77.19788%40nntp2.onemain.com
* and
* http://groups.google.com/groups?selm=u2XfrXw5BHA.1628%40tkmsftngp02
* for comments by other people that seems to have the same
* experience. WM_IME_CHAR just gives question marks, apparently
* because of going through some conversion to the current code
* page.
*
* WM_IME_CHAR might work on NT4 or Win9x with ActiveIMM, but
* use WM_IME_COMPOSITION there, too, to simplify the code.
*/
GDK_NOTE (EVENTS, g_print (" %#lx", (long) msg->lParam));
/* On Win2k WM_IME_CHAR doesn't work correctly for non-Unicode
* applications. Thus, handle WM_IME_COMPOSITION with
* GCS_RESULTSTR instead, fetch the Unicode chars from the IME
* with ImmGetCompositionStringW().
*
* See for instance
* http://groups.google.com/groups?selm=natX5.57%24g77.19788%40nntp2.onemain.com
* and
* http://groups.google.com/groups?selm=u2XfrXw5BHA.1628%40tkmsftngp02
* for comments by other people that seems to have the same
* experience. WM_IME_CHAR just gives question marks, apparently
* because of going through some conversion to the current code
* page.
*
* WM_IME_CHAR might work on NT4 or Win9x with ActiveIMM, but
* use WM_IME_COMPOSITION there, too, to simplify the code.
*/
GDK_NOTE (EVENTS, g_print (" %#lx", (long) msg->lParam));
if (!(msg->lParam & GCS_RESULTSTR))
break;
if (!(msg->lParam & GCS_RESULTSTR))
break;
if (GDK_SURFACE_DESTROYED (window))
break;
if (GDK_SURFACE_DESTROYED (window))
break;
himc = ImmGetContext (msg->hwnd);
ccount = ImmGetCompositionStringW (himc, GCS_RESULTSTR,
wbuf, sizeof (wbuf));
ImmReleaseContext (msg->hwnd, himc);
himc = ImmGetContext (msg->hwnd);
ccount = ImmGetCompositionStringW (himc, GCS_RESULTSTR,
wbuf, sizeof (wbuf));
ImmReleaseContext (msg->hwnd, himc);
ccount /= 2;
ccount /= 2;
API_CALL (GetKeyboardState, (key_state));
API_CALL (GetKeyboardState, (key_state));
for (i = 0; i < ccount; i++)
{
/* Build a key press event */
translated.keyval = gdk_unicode_to_keyval (wbuf[i]);
translated.consumed = 0;
translated.layout = get_active_group ();
translated.level = 0;
event = gdk_key_event_new (GDK_KEY_PRESS,
window,
device_manager_win32->core_keyboard,
_gdk_win32_get_next_tick (msg->time),
0,
build_key_event_state (key_state),
FALSE,
&translated,
&translated);
for (i = 0; i < ccount; i++)
{
GdkTranslatedKey translated;
_gdk_win32_append_event (event);
/* Build a key press event */
translated.keyval = gdk_unicode_to_keyval (wbuf[i]);
translated.consumed = 0;
translated.layout = get_active_group ();
translated.level = 0;
event = gdk_key_event_new (GDK_KEY_PRESS,
window,
device_manager_win32->core_keyboard,
_gdk_win32_get_next_tick (msg->time),
0,
build_key_event_state (key_state),
FALSE,
&translated,
&translated);
/* Build a key release event. */
event = gdk_key_event_new (GDK_KEY_RELEASE,
window,
device_manager_win32->core_keyboard,
_gdk_win32_get_next_tick (msg->time),
0,
build_key_event_state (key_state),
FALSE,
&translated,
&translated);
_gdk_win32_append_event (event);
/* Build a key release event. */
event = gdk_key_event_new (GDK_KEY_RELEASE,
window,
device_manager_win32->core_keyboard,
_gdk_win32_get_next_tick (msg->time),
0,
build_key_event_state (key_state),
FALSE,
&translated,
&translated);
_gdk_win32_append_event (event);
}
return_val = TRUE;
}
_gdk_win32_append_event (event);
}
return_val = TRUE;
break;
case WM_LBUTTONDOWN:
@@ -2985,22 +2980,17 @@ gdk_event_translate (MSG *msg,
break;
case WM_WINDOWPOSCHANGING:
#ifdef G_ENABLE_DEBUG
{
char buf[256];
GDK_NOTE (EVENTS, (windowpos = (WINDOWPOS *) msg->lParam,
g_print (" %s %s %dx%d@%+d%+d now below %p",
_gdk_win32_surface_pos_bits_to_string (windowpos->flags),
(windowpos->hwndInsertAfter == HWND_BOTTOM ? "BOTTOM" :
(windowpos->hwndInsertAfter == HWND_NOTOPMOST ? "NOTOPMOST" :
(windowpos->hwndInsertAfter == HWND_TOP ? "TOP" :
(windowpos->hwndInsertAfter == HWND_TOPMOST ? "TOPMOST" :
(sprintf (buf, "%p", windowpos->hwndInsertAfter),
buf))))),
windowpos->cx, windowpos->cy, windowpos->x, windowpos->y,
GetNextWindow (msg->hwnd, GW_HWNDPREV))));
}
#endif
GDK_NOTE (EVENTS, (windowpos = (WINDOWPOS *) msg->lParam,
g_print (" %s %s %dx%d@%+d%+d now below %p",
_gdk_win32_surface_pos_bits_to_string (windowpos->flags),
(windowpos->hwndInsertAfter == HWND_BOTTOM ? "BOTTOM" :
(windowpos->hwndInsertAfter == HWND_NOTOPMOST ? "NOTOPMOST" :
(windowpos->hwndInsertAfter == HWND_TOP ? "TOP" :
(windowpos->hwndInsertAfter == HWND_TOPMOST ? "TOPMOST" :
(sprintf (buf, "%p", windowpos->hwndInsertAfter),
buf))))),
windowpos->cx, windowpos->cy, windowpos->x, windowpos->y,
GetNextWindow (msg->hwnd, GW_HWNDPREV))));
if (GDK_SURFACE_IS_MAPPED (window))
{
@@ -3026,21 +3016,15 @@ gdk_event_translate (MSG *msg,
case WM_WINDOWPOSCHANGED:
windowpos = (WINDOWPOS *) msg->lParam;
#ifdef G_ENABLE_DEBUG
{
char buf[256];
GDK_NOTE (EVENTS, g_print (" %s %s %dx%d@%+d%+d",
_gdk_win32_surface_pos_bits_to_string (windowpos->flags),
(windowpos->hwndInsertAfter == HWND_BOTTOM ? "BOTTOM" :
(windowpos->hwndInsertAfter == HWND_NOTOPMOST ? "NOTOPMOST" :
(windowpos->hwndInsertAfter == HWND_TOP ? "TOP" :
(windowpos->hwndInsertAfter == HWND_TOPMOST ? "TOPMOST" :
(sprintf (buf, "%p", windowpos->hwndInsertAfter),
buf))))),
windowpos->cx, windowpos->cy, windowpos->x, windowpos->y));
}
#endif
GDK_NOTE (EVENTS, g_print (" %s %s %dx%d@%+d%+d",
_gdk_win32_surface_pos_bits_to_string (windowpos->flags),
(windowpos->hwndInsertAfter == HWND_BOTTOM ? "BOTTOM" :
(windowpos->hwndInsertAfter == HWND_NOTOPMOST ? "NOTOPMOST" :
(windowpos->hwndInsertAfter == HWND_TOP ? "TOP" :
(windowpos->hwndInsertAfter == HWND_TOPMOST ? "TOPMOST" :
(sprintf (buf, "%p", windowpos->hwndInsertAfter),
buf))))),
windowpos->cx, windowpos->cy, windowpos->x, windowpos->y));
/* Break grabs on unmap or minimize */
if (windowpos->flags & SWP_HIDEWINDOW ||
+35 -29
View File
@@ -258,6 +258,9 @@ gdk_win32_display_init_wgl (GdkDisplay *display,
if (!gdk_gl_backend_can_be_used (GDK_GL_WGL, error))
return FALSE;
if (display_win32->wgl_pixel_format != 0)
return TRUE;
/* acquire and cache dummy Window (HWND & HDC) and
* dummy GL Context, it is used to query functions
* and used for other stuff as well
@@ -296,6 +299,8 @@ gdk_win32_display_init_wgl (GdkDisplay *display,
}
}
display_win32->wgl_pixel_format = best_idx;
display_win32->hasWglARBCreateContext =
epoxy_has_wgl_extension (hdc, "WGL_ARB_create_context");
display_win32->hasWglEXTSwapControl =
@@ -427,13 +432,33 @@ create_wgl_context (HDC hdc,
goto gl_fail;
}
hglrc = create_wgl_context_with_attribs (hdc,
hglrc_base,
share,
flags,
major,
minor,
is_legacy);
/*
* We need a Core GL 4.1 context in order to use the GL support in
* the GStreamer media widget backend, but wglCreateContextAttribsARB()
* may only give us the GL context version that we ask for here, and
* nothing more. So, if we are asking for a pre-GL 4.1 context,
* try to ask for a 4.1 context explicitly first. If that is not supported,
* then we fall back to whatever version that we were asking for (or, even a
* legacy context if that fails), at a price of not able to have GL support
* for the media GStreamer backend.
*/
if (major < 4 || (major == 4 && minor < 1))
hglrc = create_wgl_context_with_attribs (hdc,
hglrc_base,
share,
flags,
4,
1,
is_legacy);
if (hglrc == NULL)
hglrc = create_wgl_context_with_attribs (hdc,
hglrc_base,
share,
flags,
major,
minor,
is_legacy);
/* return the legacy context we have if it could be setup properly, in case the 3.0+ context creation failed */
if (hglrc == NULL)
@@ -539,27 +564,10 @@ gdk_win32_gl_context_wgl_realize (GdkGLContext *context,
if (!gdk_gl_context_is_api_allowed (context, GDK_GL_API_GL, error))
return 0;
gdk_gl_context_get_required_version (context, &major, &minor);
debug_bit = gdk_gl_context_get_debug_enabled (context);
compat_bit = gdk_gl_context_get_forward_compatible (context);
/*
* We may need a Core GL 4.1+ context in order to use the GL support in
* the GStreamer media widget backend (such as on Intel drivers), but
* wglCreateContextAttribsARB() may only give us the GL context version
* that we ask for here, and nothing more. So, improve things here by
* asking for the GL version that is reported to us via epoxy_gl_version(),
* rather than the default GL core 3.2 context. Save this up in our
* GdkGLContext so that subsequent contexts that are shared with this
* context are created likewise too.
*/
if (share != NULL)
gdk_gl_context_get_required_version (share, &major, &minor);
else
{
major = display_win32->gl_version / 10;
minor = display_win32->gl_version % 10;
}
if (surface != NULL)
hdc = GDK_WIN32_SURFACE (surface)->hdc;
else
@@ -626,7 +634,6 @@ gdk_win32_gl_context_wgl_realize (GdkGLContext *context,
/* Ensure that any other context is created with a legacy bit set */
gdk_gl_context_set_is_legacy (context, legacy_bit);
gdk_gl_context_set_required_version (context, major, minor);
return GDK_GL_API_GL;
}
@@ -721,10 +728,9 @@ gdk_win32_display_get_wgl_version (GdkDisplay *display,
if (!GDK_IS_WIN32_DISPLAY (display))
return FALSE;
if (!gdk_gl_backend_can_be_used (GDK_GL_WGL, NULL))
return FALSE;
display_win32 = GDK_WIN32_DISPLAY (display);
if (display_win32->wgl_pixel_format == 0)
return FALSE;
if (major != NULL)
*major = display_win32->gl_version / 10;
+1
View File
@@ -38,6 +38,7 @@ int _gdk_input_ignore_core;
HKL _gdk_input_locale;
gboolean _gdk_input_locale_is_ime = FALSE;
UINT _gdk_input_codepage;
GdkWin32ModalOpKind _modal_operation_in_progress = GDK_WIN32_MODAL_OP_NONE;
HWND _modal_move_resize_window = NULL;
-26
View File
@@ -1,26 +0,0 @@
/*
* Copyright (c) 2021 Philip Zander
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef _WIN64
#define GDK_WIN32_COMPILE_FOR_WOW64 1
#include "gdkkeys-win32-impl.c"
#endif
-566
View File
@@ -1,566 +0,0 @@
/*
* Copyright (c) 2021 Philip Zander
* Copyright (c) 2018 Microsoft
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/* NOTE: When compiling the 32-bit version of the library, in addition to being
* compiled as a regular source file, this file is also included by
* gdkkeys-win32-impl-wow64.c to generate an alternate version of the code
* intended for running on a 64-bit kernel. Because of the way keyboard layout
* DLLs work on Windows, we have to generate two versions and decide at runtime
* which code path to execute. You can read more about the specifics below, in
* the section about KBD_LONG_POINTER. */
#include "gdkkeys-win32.h"
#ifndef GDK_WIN32_COMPILE_FOR_WOW64
#define GDK_WIN32_COMPILE_FOR_WOW64 0
#endif
/* This is our equivalent of the KBD_LONG_POINTER macro in Microsoft's kbd.h.
*
* A KBD_LONG_POINTER represents a pointer native to the *host*.
* I.e. 32 bits on 32-bit Windows and 64 bits on 64-bit Windows.
*
* This is *not* the same as the the bitness of the application, since it is
* possible to execute 32-bit binaries on either a 32-bit *or* a 64-bit host.
* On a 64-bit host, KBD_LONG_PTR will be 64-bits, even if the application
* itself is 32-bit. (Whereas on a 32-bit host, it will be 32-bit.)
*
* For clarity, here is an overview of the bit-size of KBD_LONG_POINTER on all
* possible host & app combinations:
*
* Host 32 64
* App +-----------
* 32 | 32 64
* 64 | - 64
*
* In the official MS headers, KBD_LONG_POINTER is implemented via a macro
* which expands to the attribute `__ptr64` if the keyboard driver is
* compiled for a 64 bit host. Unfortunately, `__ptr64` is only
* supported by MSVC. We use a union here as a workaround.
*
* For all KBD_LONG_POINTERs, we define an alias starting with "KLP".
* Our naming schema (inspired by the Windows headers) is thus the following:
* - FOO: The type FOO itself
* - PFOO: Regular pointer to the type FOO
* - KLPFOO: Keyboard Long Pointer to the type FOO
*/
#if GDK_WIN32_COMPILE_FOR_WOW64
#define DEFINE_KBD_LONG_POINTER(type) \
typedef union { \
P##type ptr; \
UINT64 _align; \
} KLP##type
#else
#define DEFINE_KBD_LONG_POINTER(type) \
typedef union { \
P##type ptr; \
} KLP##type
#endif
DEFINE_KBD_LONG_POINTER (USHORT);
DEFINE_KBD_LONG_POINTER (VOID);
/* Driver definitions
* See
* https://github.com/microsoft/windows-rs/blob/0.28.0/crates/deps/sys/src/Windows/Win32/UI/Input/KeyboardAndMouse/mod.rs
*
* For more information on how these structures work, see also:
* https://github.com/microsoft/Windows-driver-samples/tree/f0adcda012820b1cd44a8b3a1953baf478029738/input/layout
*/
typedef struct
{
BYTE Vk;
BYTE ModBits;
} VK_TO_BIT, *PVK_TO_BIT;
DEFINE_KBD_LONG_POINTER (VK_TO_BIT);
typedef struct
{
KLPVK_TO_BIT pVkToBit;
WORD wMaxModBits;
BYTE ModNumber[1];
} MODIFIERS, *PMODIFIERS;
DEFINE_KBD_LONG_POINTER (MODIFIERS);
typedef struct
{
BYTE Vsc;
USHORT Vk;
} VSC_VK, *PVSC_VK;
DEFINE_KBD_LONG_POINTER (VSC_VK);
typedef struct
{
BYTE Vk;
BYTE Vsc;
} VK_VSC, *PVK_VSC;
DEFINE_KBD_LONG_POINTER (VK_VSC);
typedef struct
{
BYTE VirtualKey;
BYTE Attributes;
WCHAR wch[1];
} VK_TO_WCHARS, *PVK_TO_WCHARS;
DEFINE_KBD_LONG_POINTER (VK_TO_WCHARS);
typedef struct
{
KLPVK_TO_WCHARS pVkToWchars;
BYTE nModifications;
BYTE cbSize;
} VK_TO_WCHAR_TABLE, *PVK_TO_WCHAR_TABLE;
DEFINE_KBD_LONG_POINTER (VK_TO_WCHAR_TABLE);
typedef struct
{
DWORD dwBoth;
WCHAR wchComposed;
USHORT uFlags;
} DEADKEY, *PDEADKEY;
DEFINE_KBD_LONG_POINTER (DEADKEY);
typedef struct
{
KLPMODIFIERS pCharModifiers;
KLPVK_TO_WCHAR_TABLE pVkToWcharTable;
KLPDEADKEY pDeadKey;
KLPVOID pKeyNames;
KLPVOID pKeyNamesExt;
KLPVOID pKeyNamesDead;
KLPUSHORT pusVSCtoVK;
BYTE bMaxVSCtoVK;
KLPVSC_VK pVSCtoVK_E0;
KLPVSC_VK pVSCtoVK_E1;
DWORD fLocaleFlags;
BYTE nLgMaxd;
BYTE cbLgEntry;
KLPVOID pLigature;
} KBDTABLES, *PKBDTABLES;
DEFINE_KBD_LONG_POINTER (KBDTABLES);
/* End of declarations */
static BYTE
keystate_to_modbits (GdkWin32KeymapLayoutInfo *info,
const BYTE keystate[256])
{
PKBDTABLES tables = (PKBDTABLES) info->tables;
PVK_TO_BIT vk_to_bit;
BYTE result = 0;
int i;
if (tables == NULL)
return 0;
vk_to_bit = tables->pCharModifiers.ptr->pVkToBit.ptr;
for (i = 0; vk_to_bit[i].Vk != 0; ++i)
if (keystate[vk_to_bit[i].Vk] & 0x80)
result |= vk_to_bit[i].ModBits;
return result;
}
static BYTE
modbits_to_level (GdkWin32KeymapLayoutInfo *info,
BYTE modbits)
{
PKBDTABLES tables = (PKBDTABLES) info->tables;
PMODIFIERS modifiers;
if (tables == NULL)
return 0;
modifiers = tables->pCharModifiers.ptr;
if (modbits > modifiers->wMaxModBits)
return 0;
return modifiers->ModNumber[modbits];
}
#define POPCOUNT(b) (!!(b & 0x01) + !!(b & 0x02) + !!(b & 0x04) + !!(b & 0x08) + \
!!(b & 0x10) + !!(b & 0x20) + !!(b & 0x40) + !!(b & 0x80))
/*
* vk_to_char_fuzzy:
*
* For a given key and modifier state, return the best-fit character and the
* modifiers used to produce it. Note that not all modifiers need to be used,
* because some modifier combination aren't actually mapped in the keyboard
* layout (for example the Ctrl key typically has no effect, unless used in
* combination with Alt). Such modifiers will not be consumed.
*
* 'Best-fit' means 'consume as many modifiers as possibe'.
*
* For example (assuming a neutral lock state):
*
* - a -> 'a', consumed_mod_bits: []
* - Shift + a -> 'A', consumed_mod_bits: [Shift]
* - Ctrl + a -> 'a', consumed_mod_bits: []
* - Ctrl + Shift + a -> 'A', consumed_mod_bits: [Shift]
*
* If capslock is active, the result could be:
*
* - a -> 'A', consumed_mod_bits: [Shift]
* - Shift + a -> 'a', consumed_mod_bits: []
* - Ctrl + a -> 'a', consumed_mod_bits: []
* - Ctrl + Shift + a -> 'A', consumed_mod_bits: [Shift]
*
* The held down modifiers are supplied in `mod_bits` as a bitmask of KBDSHIFT,
* KBDCTRL, KBDALT etc.
*
* The toggled modifiers are supplied in `lock_state` as a bitmask of CAPLOK and KANALOK.
*
* If the key combination results in a dead key, `is_dead` will be set to TRUE,
* otherwise it will be set to FALSE.
*/
static WCHAR
vk_to_char_fuzzy (GdkWin32KeymapLayoutInfo *info,
BYTE mod_bits,
BYTE lock_bits,
BYTE *consumed_mod_bits,
gboolean *is_dead,
BYTE vk)
{
PKBDTABLES tables = (PKBDTABLES) info->tables;
PVK_TO_WCHAR_TABLE wch_tables;
PVK_TO_WCHAR_TABLE wch_table;
PVK_TO_WCHARS entry;
int table_index;
int entry_index;
int n_levels;
int entry_size;
/* Initialize with defaults */
if (consumed_mod_bits)
*consumed_mod_bits = 0;
if (is_dead)
*is_dead = FALSE;
if (tables == NULL)
return WCH_NONE;
wch_tables = tables->pVkToWcharTable.ptr;
table_index = info->vk_lookup_table[vk].table;
entry_index = info->vk_lookup_table[vk].index;
if (table_index == -1 || entry_index == -1)
return WCH_NONE;
wch_table = &wch_tables[table_index];
n_levels = wch_table->nModifications;
entry_size = wch_table->cbSize;
entry = (PVK_TO_WCHARS) ((PBYTE) wch_table->pVkToWchars.ptr
+ entry_size*entry_index);
if (entry->VirtualKey == vk)
{
gboolean have_sgcaps = FALSE;
WCHAR best_char = WCH_NONE;
BYTE best_modifiers = 0;
int best_score = -1;
gboolean best_is_dead = FALSE;
int level;
/* Take toggled keys into account. For example, capslock normally inverts the
* state of KBDSHIFT (with some exceptions). */
/* Key supporting capslock */
if ((entry->Attributes & CAPLOK) &&
/* Ignore capslock if any modifiers other than shift are pressed.
* E.g. on the German layout, CapsLock + AltGr + q is the same as
* AltGr + q ('@'), but NOT the same as Shift + AltGr + q (not mapped). */
!(mod_bits & ~KBDSHIFT) &&
(lock_bits & CAPLOK))
mod_bits ^= KBDSHIFT;
/* Key supporting combination of capslock + altgr */
if ((entry->Attributes & CAPLOKALTGR) &&
(mod_bits & KBDALTGR) &&
(lock_bits & CAPLOK))
mod_bits ^= KBDSHIFT;
/* In the Swiss German layout, CapsLock + key is different from Shift + key
* for some keys. For such keys, the characters for active capslock are
* in the next entry. */
if ((entry->Attributes & SGCAPS) &&
(lock_bits & CAPLOK))
have_sgcaps = TRUE;
/* I'm not totally sure how kanalok behaves, for now I assume that there
* aren't any special cases. */
if ((entry->Attributes & KANALOK) &&
(lock_bits & KANALOK))
mod_bits ^= KBDKANA;
/* We try to find the entry with the most matching modifiers */
for (level = 0; level < n_levels; ++level)
{
BYTE candidate_modbits = info->level_to_modbits[level];
gboolean candidate_is_dead = FALSE;
WCHAR c;
int score;
if (candidate_modbits & ~mod_bits)
continue;
/* Some keys have bogus mappings for the control key, e.g. Ctrl +
* Backspace = Delete, Ctrl + [ = 0x1B or even Ctrl + Shift + 6 =
* 0x1E on a US keyboard. So we have to ignore all cases of
* Ctrl that aren't part of AltGr.
*/
if ((candidate_modbits & KBDCTRL) && !(candidate_modbits & KBDALT))
continue;
c = entry->wch[level];
if (c == WCH_DEAD || have_sgcaps)
{
/* Next entry contains the undead/capslocked keys */
PVK_TO_WCHARS next_entry;
next_entry = (PVK_TO_WCHARS) ((PBYTE) wch_table->pVkToWchars.ptr
+ entry_size * (entry_index + 1));
c = next_entry->wch[level];
candidate_is_dead = TRUE;
}
if (c == WCH_DEAD || c == WCH_LGTR || c == WCH_NONE)
continue;
score = POPCOUNT (candidate_modbits & mod_bits);
if (score > best_score)
{
best_score = score;
best_char = c;
best_modifiers = candidate_modbits;
best_is_dead = candidate_is_dead;
}
}
if (consumed_mod_bits)
*consumed_mod_bits = best_modifiers;
if (is_dead)
*is_dead = best_is_dead;
return best_char;
}
return WCH_NONE;
}
static void
init_vk_lookup_table (GdkWin32KeymapLayoutInfo *info)
{
PKBDTABLES tables = (PKBDTABLES) info->tables;
PVK_TO_WCHAR_TABLE wch_tables;
PMODIFIERS modifiers;
int i, vk, table_idx;
g_return_if_fail (tables != NULL);
wch_tables = tables->pVkToWcharTable.ptr;
/* Initialize empty table */
memset (info->vk_lookup_table, -1, sizeof (info->vk_lookup_table));
/* Initialize level -> modbits lookup table */
memset (info->level_to_modbits, 0, sizeof(info->level_to_modbits));
info->max_level = 0;
modifiers = tables->pCharModifiers.ptr;
for (i = 0; i <= modifiers->wMaxModBits; ++i)
{
if (modifiers->ModNumber[i] != SHFT_INVALID &&
modifiers->ModNumber[i] != 0 /* Workaround for buggy layouts*/)
{
if (modifiers->ModNumber[i] > info->max_level)
info->max_level = modifiers->ModNumber[i];
info->level_to_modbits[modifiers->ModNumber[i]] = i;
}
}
info->max_modbit_value = modifiers->wMaxModBits;
/* For convenience, we add 256 identity-mapped entries corresponding to the VKs.
* This allows us to return a pointer to them from the `gdk_keysym_to_key_entry`
* function.
*/
for (vk = 0; vk < 256; ++vk)
{
GdkWin32KeymapKeyEntry key_entry = {0};
key_entry.vk = vk;
key_entry.mod_bits = 0;
key_entry.next = -1;
g_array_append_val (info->key_entries, key_entry);
}
/* Special entry for ISO_Left_Tab */
{
GdkWin32KeymapKeyEntry key_entry = {0};
key_entry.vk = VK_TAB;
key_entry.mod_bits = KBDSHIFT;
key_entry.next = -1;
g_array_append_val (info->key_entries, key_entry);
}
/* Initialize generic vk <-> char tables */
for (table_idx = 0; ; ++table_idx)
{
PVK_TO_WCHAR_TABLE wch_table = &wch_tables[table_idx];
int entry_size;
int n_levels;
int entry_idx;
if (wch_table->pVkToWchars.ptr == NULL)
break;
entry_size = wch_table->cbSize;
n_levels = wch_table->nModifications;
for (entry_idx = 0; ; ++entry_idx)
{
PVK_TO_WCHARS entry;
int level;
entry = (PVK_TO_WCHARS) ((PBYTE) wch_table->pVkToWchars.ptr
+ entry_size * entry_idx);
if (entry->VirtualKey == 0)
break;
/* Lookup table to find entry for a VK in O(1). */
/* Only add the first entry, as some layouts (Swiss German) contain
* multiple successive entries for the same VK (SGCAPS). */
if (info->vk_lookup_table[entry->VirtualKey].table < 0)
{
info->vk_lookup_table[entry->VirtualKey].table = table_idx;
info->vk_lookup_table[entry->VirtualKey].index = entry_idx;
}
/* Create reverse lookup entries to find a VK+modifier combinations
* that results in a given character. */
for (level = 0; level < n_levels; ++level)
{
GdkWin32KeymapKeyEntry key_entry = {0};
WCHAR c = entry->wch[level];
int inserted_idx;
gintptr next_idx;
key_entry.vk = entry->VirtualKey;
key_entry.mod_bits = info->level_to_modbits[level];
/* There can be multiple combinations that produce the same character.
* We store all of them in a linked list.
* Check if we already have an entry for the character, so we can chain
* them together. */
if (g_hash_table_lookup_extended (info->reverse_lookup_table,
GINT_TO_POINTER (c),
NULL, (gpointer*)&next_idx))
{
key_entry.next = next_idx;
}
else
{
key_entry.next = -1;
}
/* We store the KeyEntry in an array. In the hash table we only store
* the index. */
g_array_append_val (info->key_entries, key_entry);
inserted_idx = info->key_entries->len - 1;
g_hash_table_insert (info->reverse_lookup_table,
GINT_TO_POINTER (c),
GINT_TO_POINTER (inserted_idx));
}
}
}
}
static gboolean
load_layout_dll (const char *dll,
GdkWin32KeymapLayoutInfo *info)
{
typedef KLPKBDTABLES (*KbdLayerDescriptor)(VOID);
HMODULE lib;
KbdLayerDescriptor func;
KLPKBDTABLES tables;
g_return_val_if_fail (dll != NULL, FALSE);
lib = LoadLibraryA (dll);
if (lib == NULL)
goto fail1;
func = (KbdLayerDescriptor) GetProcAddress (lib, "KbdLayerDescriptor");
if (func == NULL)
goto fail2;
tables = func();
info->lib = lib;
info->tables = (PKBDTABLES) tables.ptr;
return TRUE;
fail2:
FreeLibrary (lib);
fail1:
return FALSE;
}
#if GDK_WIN32_COMPILE_FOR_WOW64
#define GDK_WIN32_KEYMAP_IMPL_NAME gdkwin32_keymap_impl_wow64
#else
#define GDK_WIN32_KEYMAP_IMPL_NAME gdkwin32_keymap_impl
#endif
const GdkWin32KeymapImpl GDK_WIN32_KEYMAP_IMPL_NAME =
{
load_layout_dll,
init_vk_lookup_table,
keystate_to_modbits,
modbits_to_level,
vk_to_char_fuzzy
};
+1301 -720
View File
File diff suppressed because it is too large Load Diff
-168
View File
@@ -1,168 +0,0 @@
/*
* Copyright (c) 2021 Philip Zander
* Copyright (c) 2018 Microsoft
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include <glib.h>
#include <windows.h>
/* For lookup table VK -> chars */
typedef struct
{
int table;
int index;
} GdkWin32KeymapTableAndIndex;
/* For reverse lookup char -> VKs */
typedef struct
{
BYTE mod_bits;
BYTE vk;
/* Index of next KeyEntry. -1 if there is no next entry. */
int next;
} GdkWin32KeymapKeyEntry;
typedef struct
{
HKL handle;
/* Keyboard layout identifier */
char name[KL_NAMELENGTH];
/* Path of the layout DLL */
char *file;
/* Handle of the layout DLL */
HINSTANCE lib;
/* The actual conversion tables provided by the layout DLL.
*
* This is a pointer to a KBDTABLES structure. The exact definition
* of this structure depends on the kernel on which the executable
* run and can in general only be determined at runtime. That's why
* we have to use a generic gpointer instead of the actual type here.
*
* See comment on GdkWin32KeymapImpl below for more information. */
gpointer tables;
/* VK -> chars lookup table so we don't have to do a linear scan
* every time we look up a key. */
GdkWin32KeymapTableAndIndex vk_lookup_table[256];
/* List of entries for reverse (char ->VKs) lookup. */
GArray *key_entries;
/* Reverse lookup table (char -> VKs). Key: Unichar. Value: int.
* The value is used to index into the key_entries array. The key_entries
* array can contain multiple consecutive entries for a given char.
* The end of the list for the char is marked by a key entry that has
* mod_bits and vk set to 0xFF. */
GHashTable *reverse_lookup_table;
/* Map level to modbits */
BYTE level_to_modbits[256];
/* Max Number of levels */
BYTE max_level;
/* Maximum possible value of a modbits bitset. */
BYTE max_modbit_value;
} GdkWin32KeymapLayoutInfo;
/* Some keyboard driver constants
* See https://github.com/microsoft/windows-rs/blob/0.28.0/crates/deps/sys/src/Windows/Win32/UI/Input/KeyboardAndMouse/mod.rs
*/
/* Modifier bits */
#define KBDBASE 0x00
#define KBDSHIFT 0x01
#define KBDCTRL 0x02
#define KBDALT 0x04
#define KBDKANA 0x08
#define KBDROYA 0x10
#define KBDLOYA 0x20
#define KBDGRPSELTAP 0x80
#define KBDALTGR (KBDCTRL| KBDALT)
/* */
#define SHFT_INVALID 0x0F
/* Char table constants */
#define WCH_NONE 0xF000
#define WCH_DEAD 0xF001
#define WCH_LGTR 0xF002
/* Char table flags */
#define CAPLOK 0x01
#define SGCAPS 0x02
#define CAPLOKALTGR 0x04
#define KANALOK 0x08
#define GRPSELTAP 0x80
/* IMPORTANT:
*
* Keyboard layout DLLs are dependent on the host architecture.
*
* - 32 bit systems have just one 32 bit DLL in System32.
* - 64 bit systems contain two versions of each layout DLL: One in System32
* for 64-bit applications, and one in SysWOW64 for 32-bit applications.
*
* Here comes the tricky part:
*
* The 32-bit DLL in SysWOW64 is *not* identical to the DLL you would find
* on a true 32 bit system, because all the pointers there are declared with
* the attribute `__ptr64` (which means they are 64 bits wide, but only the
* lower 32 bits are used).
*
* This leads to the following problems:
*
* (1) GCC does not support `__ptr64`
* (2) When compiling the 32-bit library, we need two versions of the same code
* and decide at run-time which one to execute, because we can't know at
* compile time whether we will be running on a true 32-bit system, or on
* WOW64.
*
* To solve this problem, we generate code for both cases (see
* gdkkeys-win32-impl.c + gdkkeys-win32-impl-wow64.c) and encapsulate
* the resulting functions in a struct of type GdkWin32KeymapImpl,
* allowing us to select the correct implementation at runtime.
*
*/
typedef struct
{
gboolean (*load_layout_dll) (const char *dll,
GdkWin32KeymapLayoutInfo *info);
void (*init_vk_lookup_table) (GdkWin32KeymapLayoutInfo *info);
BYTE (*keystate_to_modbits) (GdkWin32KeymapLayoutInfo *info,
const BYTE keystate[256]);
BYTE (*modbits_to_level) (GdkWin32KeymapLayoutInfo *info,
BYTE modbits);
WCHAR (*vk_to_char_fuzzy) (GdkWin32KeymapLayoutInfo *info,
BYTE mod_bits,
BYTE lock_bits,
BYTE *consumed_mod_bits,
gboolean *is_dead,
BYTE vk);
} GdkWin32KeymapImpl;
+8 -6
View File
@@ -52,9 +52,7 @@ static gboolean gdk_synchronize = FALSE;
void
_gdk_win32_surfaceing_init (void)
{
GdkWin32Keymap *win32_keymap;
win32_keymap = GDK_WIN32_KEYMAP (_gdk_win32_display_get_keymap (_gdk_display));
char buf[10];
if (gdk_synchronize)
GdiSetBatchLimit (1);
@@ -62,9 +60,13 @@ _gdk_win32_surfaceing_init (void)
_gdk_app_hmodule = GetModuleHandle (NULL);
_gdk_display_hdc = CreateDC ("DISPLAY", NULL, NULL, NULL);
_gdk_input_locale = GetKeyboardLayout (0);
_gdk_win32_keymap_set_active_layout (win32_keymap, _gdk_input_locale);
GDK_NOTE (EVENTS, g_print ("input_locale: %p\n", _gdk_input_locale));
_gdk_win32_keymap_set_active_layout (GDK_WIN32_KEYMAP (_gdk_win32_display_get_keymap (_gdk_display)), _gdk_input_locale);
GetLocaleInfo (MAKELCID (LOWORD (_gdk_input_locale), SORT_DEFAULT),
LOCALE_IDEFAULTANSICODEPAGE,
buf, sizeof (buf));
_gdk_input_codepage = atoi (buf);
GDK_NOTE (EVENTS, g_print ("input_locale:%p, codepage:%d\n",
_gdk_input_locale, _gdk_input_codepage));
_gdk_win32_clipdrop_init ();
}
+3 -9
View File
@@ -269,6 +269,7 @@ extern int _gdk_input_ignore_core;
*/
extern HKL _gdk_input_locale;
extern gboolean _gdk_input_locale_is_ime;
extern UINT _gdk_input_codepage;
extern guint _gdk_keymap_serial;
@@ -350,11 +351,12 @@ GList *_gdk_win32_display_list_devices (GdkDisplay *dpy);
gboolean _gdk_win32_display_has_pending (GdkDisplay *display);
void _gdk_win32_display_queue_events (GdkDisplay *display);
gboolean _gdk_win32_keymap_has_altgr (GdkWin32Keymap *keymap);
guint8 _gdk_win32_keymap_get_active_group (GdkWin32Keymap *keymap);
guint8 _gdk_win32_keymap_get_rshift_scancode (GdkWin32Keymap *keymap);
void _gdk_win32_keymap_set_active_layout (GdkWin32Keymap *keymap,
HKL hkl);
GdkModifierType _gdk_win32_keymap_get_mod_mask (GdkWin32Keymap *keymap);
GdkKeymap *_gdk_win32_display_get_keymap (GdkDisplay *display);
@@ -423,12 +425,4 @@ void _gdk_win32_surfaceing_init (void);
void _gdk_drag_init (void);
void _gdk_events_init (GdkDisplay *display);
typedef enum _GdkWin32ProcessorCheckType
{
GDK_WIN32_ARM64,
GDK_WIN32_WOW64,
} GdkWin32ProcessorCheckType;
gboolean _gdk_win32_check_processor (GdkWin32ProcessorCheckType check_type);
#endif /* __GDK_PRIVATE_WIN32_H__ */
-2
View File
@@ -19,8 +19,6 @@ gdk_win32_sources = files([
'gdkhdataoutputstream-win32.c',
'gdkinput-winpointer.c',
'gdkkeys-win32.c',
'gdkkeys-win32-impl.c',
'gdkkeys-win32-impl-wow64.c',
'gdkwin32langnotification.c',
'gdkmain-win32.c',
'gdkmonitor-win32.c',
+2 -2
View File
@@ -175,8 +175,8 @@ render_glyph (cairo_surface_t *surface,
glyph_info.glyph = key->glyph;
glyph_info.geometry.width = value->ink_rect.width * 1024;
glyph_info.geometry.x_offset = (0.25 * key->xshift - value->ink_rect.x) * 1024;
glyph_info.geometry.y_offset = (0.25 * key->yshift - value->ink_rect.y) * 1024;
glyph_info.geometry.x_offset = 0.25 * key->xshift - value->ink_rect.x * 1024;
glyph_info.geometry.y_offset = 0.25 * key->yshift - value->ink_rect.y * 1024;
glyph_string.num_glyphs = 1;
glyph_string.glyphs = &glyph_info;
+9 -7
View File
@@ -289,15 +289,10 @@ gsk_renderer_is_realized (GskRenderer *renderer)
*
* Since GTK 4.6, the surface may be `NULL`, which allows using
* renderers without having to create a surface.
*
* Note that it is mandatory to call [method@Gsk.Renderer.unrealize] before
* destroying the renderer.
*
* Returns: Whether the renderer was successfully realized
*/
gboolean
gsk_renderer_realize (GskRenderer *renderer,
GdkSurface *surface,
GdkSurface *surface,
GError **error)
{
GskRendererPrivate *priv = gsk_renderer_get_instance_private (renderer);
@@ -597,7 +592,14 @@ get_renderer_for_backend (GdkSurface *surface)
#endif
#ifdef GDK_WINDOWING_WIN32
if (GDK_IS_WIN32_SURFACE (surface))
return GSK_TYPE_GL_RENDERER;
/* remove check for OpenGL/ES when OpenGL/ES 2.0 shader is ready */
{
GdkDisplay *display = gdk_surface_get_display (surface);
if (!(GDK_DISPLAY_DEBUG_CHECK (display, GL_GLES) ||
GDK_WIN32_DISPLAY (display)->running_on_arm64))
return GSK_TYPE_GL_RENDERER;
}
#endif
return G_TYPE_INVALID;
+9 -9
View File
@@ -20,7 +20,7 @@
* GskRenderNode: (ref-func gsk_render_node_ref) (unref-func gsk_render_node_unref) (set-value-func gsk_value_set_render_node) (get-value-func gsk_value_get_render_node)
*
* `GskRenderNode` is the basic block in a scene graph to be
* rendered using [class@Gsk.Renderer].
* rendered using `GskRenderer`.
*
* Each node has a parent, except the top-level node; each node may have
* children nodes.
@@ -424,7 +424,7 @@ gsk_render_node_get_bounds (GskRenderNode *node,
*
* Typically, you'll use this function to implement fallback rendering
* of `GskRenderNode`s on an intermediate Cairo context, instead of using
* the drawing context associated to a [class@Gdk.Surface]'s rendering buffer.
* the drawing context associated to a `GdkSurface`'s rendering buffer.
*
* For advanced nodes that cannot be supported using Cairo, in particular
* for nodes doing 3D operations, this function may fail.
@@ -565,8 +565,8 @@ gsk_render_node_diff (GskRenderNode *node1,
* @filename: (type filename): the file to save it to.
* @error: Return location for a potential error
*
* This function is equivalent to calling [method@Gsk.RenderNode.serialize]
* followed by [func@GLib.file_set_contents].
* This function is equivalent to calling gsk_render_node_serialize()
* followed by g_file_set_contents().
*
* See those two functions for details on the arguments.
*
@@ -603,7 +603,7 @@ gsk_render_node_write_to_file (GskRenderNode *node,
* @error_func: (nullable) (scope call): Callback on parsing errors
* @user_data: (closure error_func): user_data for @error_func
*
* Loads data previously created via [method@Gsk.RenderNode.serialize].
* Loads data previously created via gsk_render_node_serialize().
*
* For a discussion of the supported format, see that function.
*
@@ -623,12 +623,12 @@ gsk_render_node_deserialize (GBytes *bytes,
/**
* gsk_value_set_render_node:
* @value: a [struct@GObject.Value] initialized with type `GSK_TYPE_RENDER_NODE`
* @value: a `GValue` initialized with type `GSK_TYPE_RENDER_NODE`
* @node: a `GskRenderNode`
*
* Stores the given `GskRenderNode` inside `value`.
*
* The [struct@GObject.Value] will acquire a reference to the `node`.
* The `GValue` will acquire a reference to the `node`.
*
* Since: 4.6
*/
@@ -659,7 +659,7 @@ gsk_value_set_render_node (GValue *value,
/**
* gsk_value_take_render_node:
* @value: a [struct@GObject.Value] initialized with type `GSK_TYPE_RENDER_NODE`
* @value: a `GValue` initialized with type `GSK_TYPE_RENDER_NODE`
* @node: (transfer full) (nullable): a `GskRenderNode`
*
* Stores the given `GskRenderNode` inside `value`.
@@ -713,7 +713,7 @@ gsk_value_get_render_node (const GValue *value)
/**
* gsk_value_dup_render_node:
* @value: a [struct@GObject.Value] initialized with type `GSK_TYPE_RENDER_NODE`
* @value: a `GValue` initialized with type `GSK_TYPE_RENDER_NODE`
*
* Retrieves the `GskRenderNode` stored inside the given `value`, and acquires
* a reference to it.
+9 -9
View File
@@ -623,7 +623,7 @@ static const GskTransformClass GSK_TRANSLATE_TRANSFORM_CLASS =
*
* Translates @next in 2-dimensional space by @point.
*
* Returns: (nullable): The new transform
* Returns: The new transform
**/
GskTransform *
gsk_transform_translate (GskTransform *next,
@@ -643,7 +643,7 @@ gsk_transform_translate (GskTransform *next,
*
* Translates @next by @point.
*
* Returns: (nullable): The new transform
* Returns: The new transform
**/
GskTransform *
gsk_transform_translate_3d (GskTransform *next,
@@ -859,7 +859,7 @@ normalize_angle (float angle)
*
* Rotates @next @angle degrees in 2D - or in 3D-speak, around the z axis.
*
* Returns: (nullable): The new transform
* Returns: The new transform
*/
GskTransform *
gsk_transform_rotate (GskTransform *next,
@@ -987,7 +987,7 @@ static const GskTransformClass GSK_ROTATE3D_TRANSFORM_CLASS =
*
* For a rotation in 2D space, use [method@Gsk.Transform.rotate]
*
* Returns: (nullable): The new transform
* Returns: The new transform
*/
GskTransform *
gsk_transform_rotate_3d (GskTransform *next,
@@ -1163,7 +1163,7 @@ static const GskTransformClass GSK_SKEW_TRANSFORM_CLASS =
*
* Applies a skew transform.
*
* Returns: (nullable): The new transform
* Returns: The new transform
*
* Since: 4.6
*/
@@ -1335,7 +1335,7 @@ static const GskTransformClass GSK_SCALE_TRANSFORM_CLASS =
*
* Use [method@Gsk.Transform.scale_3d] to scale in all 3 dimensions.
*
* Returns: (nullable): The new transform
* Returns: The new transform
**/
GskTransform *
gsk_transform_scale (GskTransform *next,
@@ -1354,7 +1354,7 @@ gsk_transform_scale (GskTransform *next,
*
* Scales @next by the given factors.
*
* Returns: (nullable): The new transform
* Returns: The new transform
**/
GskTransform *
gsk_transform_scale_3d (GskTransform *next,
@@ -1523,7 +1523,7 @@ gsk_transform_perspective (GskTransform *next,
*
* Acquires a reference on the given `GskTransform`.
*
* Returns: (nullable) (transfer none): the `GskTransform` with an additional reference
* Returns: (transfer none): the `GskTransform` with an additional reference
*/
GskTransform *
gsk_transform_ref (GskTransform *self)
@@ -1898,7 +1898,7 @@ gsk_transform_to_translate (GskTransform *self,
*
* Applies all the operations from @other to @next.
*
* Returns: (nullable): The new transform
* Returns: The new transform
*/
GskTransform *
gsk_transform_transform (GskTransform *next,
+42 -50
View File
@@ -126,22 +126,6 @@ pango_wrap_mode_to_string (PangoWrapMode mode)
}
}
static const char *
pango_align_to_string (PangoAlignment align)
{
switch (align)
{
case PANGO_ALIGN_LEFT:
return "left";
case PANGO_ALIGN_CENTER:
return "center";
case PANGO_ALIGN_RIGHT:
return "right";
default:
g_assert_not_reached ();
}
}
void
gtk_pango_get_font_attributes (PangoFontDescription *font,
GVariantBuilder *builder)
@@ -183,6 +167,9 @@ gtk_pango_get_default_attributes (PangoLayout *layout,
GVariantBuilder *builder)
{
PangoContext *context;
const char *val;
PangoAlignment align;
PangoWrapMode mode;
context = pango_layout_get_context (layout);
if (context)
@@ -199,12 +186,26 @@ gtk_pango_get_default_attributes (PangoLayout *layout,
if (font)
gtk_pango_get_font_attributes (font, builder);
}
if (pango_layout_get_justify (layout))
{
val = "fill";
}
else
{
align = pango_layout_get_alignment (layout);
if (align == PANGO_ALIGN_LEFT)
val = "left";
else if (align == PANGO_ALIGN_CENTER)
val = "center";
else
val = "right";
}
g_variant_builder_add (builder, "{ss}", "justification", val);
g_variant_builder_add (builder, "{ss}", "justification",
pango_align_to_string (pango_layout_get_alignment (layout)));
mode = pango_layout_get_wrap (layout);
g_variant_builder_add (builder, "{ss}", "wrap-mode",
pango_wrap_mode_to_string (pango_layout_get_wrap (layout)));
pango_wrap_mode_to_string (mode));
g_variant_builder_add (builder, "{ss}", "strikethrough", "false");
g_variant_builder_add (builder, "{ss}", "underline", "false");
g_variant_builder_add (builder, "{ss}", "rise", "0");
@@ -677,9 +678,7 @@ pango_layout_get_line_before (PangoLayout *layout,
{
PangoLayoutIter *iter;
PangoLayoutLine *line, *prev_line = NULL, *prev_prev_line = NULL;
int index, start_index, length, end_index;
int prev_start_index, prev_length;
int prev_prev_start_index, prev_prev_length;
int index, start_index, end_index;
const char *text;
gboolean found = FALSE;
@@ -689,9 +688,8 @@ pango_layout_get_line_before (PangoLayout *layout,
do
{
line = pango_layout_iter_get_line (iter);
start_index = pango_layout_line_get_start_index (line);
length = pango_layout_line_get_length (line);
end_index = start_index + length;
start_index = line->start_index;
end_index = start_index + line->length;
if (index >= start_index && index <= end_index)
{
@@ -702,14 +700,14 @@ pango_layout_get_line_before (PangoLayout *layout,
{
case ATSPI_TEXT_BOUNDARY_LINE_START:
end_index = start_index;
start_index = prev_start_index;
start_index = prev_line->start_index;
break;
case ATSPI_TEXT_BOUNDARY_LINE_END:
if (prev_prev_line)
start_index = prev_prev_start_index + prev_prev_length;
start_index = prev_prev_line->start_index + prev_prev_line->length;
else
start_index = 0;
end_index = prev_start_index + prev_length;
end_index = prev_line->start_index + prev_line->length;
break;
case ATSPI_TEXT_BOUNDARY_CHAR:
case ATSPI_TEXT_BOUNDARY_WORD_START:
@@ -728,17 +726,13 @@ pango_layout_get_line_before (PangoLayout *layout,
}
prev_prev_line = prev_line;
prev_prev_start_index = prev_start_index;
prev_prev_length = prev_length;
prev_line = line;
prev_start_index = start_index;
prev_length = length;
}
while (pango_layout_iter_next_line (iter));
if (!found)
{
start_index = prev_start_index + prev_length;
start_index = prev_line->start_index + prev_line->length;
end_index = start_index;
}
pango_layout_iter_free (iter);
@@ -756,7 +750,7 @@ pango_layout_get_line_at (PangoLayout *layout,
{
PangoLayoutIter *iter;
PangoLayoutLine *line, *prev_line = NULL;
int index, start_index, length, end_index;
int index, start_index, end_index;
const char *text;
gboolean found = FALSE;
@@ -766,9 +760,8 @@ pango_layout_get_line_at (PangoLayout *layout,
do
{
line = pango_layout_iter_get_line (iter);
start_index = pango_layout_line_get_start_index (line);
length = pango_layout_line_get_length (line);
end_index = start_index + length;
start_index = line->start_index;
end_index = start_index + line->length;
if (index >= start_index && index <= end_index)
{
@@ -777,11 +770,11 @@ pango_layout_get_line_at (PangoLayout *layout,
{
case ATSPI_TEXT_BOUNDARY_LINE_START:
if (pango_layout_iter_next_line (iter))
end_index = pango_layout_line_get_start_index (pango_layout_iter_get_line (iter));
end_index = pango_layout_iter_get_line (iter)->start_index;
break;
case ATSPI_TEXT_BOUNDARY_LINE_END:
if (prev_line)
start_index = pango_layout_line_get_start_index (prev_line) + pango_layout_line_get_length (prev_line);
start_index = prev_line->start_index + prev_line->length;
break;
case ATSPI_TEXT_BOUNDARY_CHAR:
case ATSPI_TEXT_BOUNDARY_WORD_START:
@@ -802,7 +795,7 @@ pango_layout_get_line_at (PangoLayout *layout,
if (!found)
{
start_index = pango_layout_line_get_start_index (prev_line) + pango_layout_line_get_length (prev_line);
start_index = prev_line->start_index + prev_line->length;
end_index = start_index;
}
pango_layout_iter_free (iter);
@@ -820,7 +813,7 @@ pango_layout_get_line_after (PangoLayout *layout,
{
PangoLayoutIter *iter;
PangoLayoutLine *line, *prev_line = NULL;
int index, start_index, length, end_index;
int index, start_index, end_index;
const char *text;
gboolean found = FALSE;
@@ -830,9 +823,8 @@ pango_layout_get_line_after (PangoLayout *layout,
do
{
line = pango_layout_iter_get_line (iter);
start_index = pango_layout_line_get_start_index (line);
length = pango_layout_line_get_length (line);
end_index = start_index + length;
start_index = line->start_index;
end_index = start_index + line->length;
if (index >= start_index && index <= end_index)
{
@@ -843,15 +835,15 @@ pango_layout_get_line_after (PangoLayout *layout,
switch (boundary_type)
{
case ATSPI_TEXT_BOUNDARY_LINE_START:
start_index = pango_layout_line_get_start_index (line);
start_index = line->start_index;
if (pango_layout_iter_next_line (iter))
end_index = pango_layout_line_get_start_index (pango_layout_iter_get_line (iter));
end_index = pango_layout_iter_get_line (iter)->start_index;
else
end_index = start_index + pango_layout_line_get_length (line);
end_index = start_index + line->length;
break;
case ATSPI_TEXT_BOUNDARY_LINE_END:
start_index = end_index;
end_index = pango_layout_line_get_start_index (line) + pango_layout_line_get_length (line);
end_index = line->start_index + line->length;
break;
case ATSPI_TEXT_BOUNDARY_CHAR:
case ATSPI_TEXT_BOUNDARY_WORD_START:
@@ -875,7 +867,7 @@ pango_layout_get_line_after (PangoLayout *layout,
if (!found)
{
start_index = pango_layout_line_get_start_index (prev_line) + pango_layout_line_get_length (prev_line);
start_index = prev_line->start_index + prev_line->length;
end_index = start_index;
}
pango_layout_iter_free (iter);
+1 -1
View File
@@ -36,7 +36,7 @@ G_BEGIN_DECLS
* Defines a part of a CSS document.
*
* Because sections are nested into one another, you can use
* [method@CssSection.get_parent] to get the containing region.
* gtk_css_section_get_parent() to get the containing region.
*/
typedef struct _GtkCssSection GtkCssSection;
+11 -11
View File
@@ -44,10 +44,10 @@
/**
* GtkActionableInterface:
* @get_action_name: virtual function for [method@Actionable.get_action_name]
* @set_action_name: virtual function for [method@Actionable.set_action_name]
* @get_action_target_value: virtual function for [method@Actionable.get_action_target_value]
* @set_action_target_value: virtual function for [method@Actionable.set_action_target_value]
* @get_action_name: virtual function for gtk_actionable_get_action_name()
* @set_action_name: virtual function for gtk_actionable_set_action_name()
* @get_action_target_value: virtual function for gtk_actionable_get_action_target_value()
* @set_action_target_value: virtual function for gtk_actionable_set_action_target_value()
*
* The interface vtable for `GtkActionable`.
**/
@@ -100,8 +100,8 @@ gtk_actionable_get_action_name (GtkActionable *actionable)
* located) within the hierarchy of a `GtkApplicationWindow`.
*
* Names are of the form win.save or app.quit for actions on the
* containing [class@ApplicationWindow] or its associated [class@Application],
* respectively. This is the same form used for actions in the [class@Gio.Menu]
* containing `GtkApplicationWindow` or its associated `GtkApplication`,
* respectively. This is the same form used for actions in the `GMenu`
* associated with the window.
*/
void
@@ -134,7 +134,7 @@ gtk_actionable_get_action_target_value (GtkActionable *actionable)
/**
* gtk_actionable_set_action_target_value: (attributes org.gtk.Method.set_property=action-target)
* @actionable: a `GtkActionable` widget
* @target_value: (nullable): a [struct@GLib.Variant] to set as the target value
* @target_value: (nullable): a `GVariant` to set as the target value
*
* Sets the target value of an actionable widget.
*
@@ -145,7 +145,7 @@ gtk_actionable_get_action_target_value (GtkActionable *actionable)
* Second, it is used to determine if the widget should be rendered as
* active the widget is active if the state is equal to the given target.
*
* Consider the example of associating a set of buttons with a [iface@Gio.Action]
* Consider the example of associating a set of buttons with a `GAction`
* with string state in a typical radio button situation. Each button
* will be associated with the same action, but with a different target
* value for that action. Clicking on a particular button will activate
@@ -168,12 +168,12 @@ gtk_actionable_set_action_target_value (GtkActionable *actionable,
/**
* gtk_actionable_set_action_target:
* @actionable: a `GtkActionable` widget
* @format_string: a [struct@GLib.Variant] format string
* @format_string: a GVariant format string
* @...: arguments appropriate for @format_string
*
* Sets the target of an actionable widget.
*
* This is a convenience function that calls [ctor@GLib.Variant.new] for
* This is a convenience function that calls g_variant_new() for
* @format_string and uses the result to call
* [method@Gtk.Actionable.set_action_target_value].
*
@@ -202,7 +202,7 @@ gtk_actionable_set_action_target (GtkActionable *actionable,
* actionable widget.
*
* @detailed_action_name is a string in the format accepted by
* [func@Gio.Action.parse_detailed_name].
* g_action_parse_detailed_name().
*/
void
gtk_actionable_set_detailed_action_name (GtkActionable *actionable,
-1
View File
@@ -1478,7 +1478,6 @@ gtk_assistant_set_current_page (GtkAssistant *assistant,
GtkAssistantPage *page;
g_return_if_fail (GTK_IS_ASSISTANT (assistant));
g_return_if_fail (assistant->pages != NULL);
if (page_num >= 0)
page = (GtkAssistantPage *) g_list_nth_data (assistant->pages, page_num);
-1
View File
@@ -38,7 +38,6 @@ GDK_AVAILABLE_IN_ALL
GtkBitset * gtk_bitset_ref (GtkBitset *self);
GDK_AVAILABLE_IN_ALL
void gtk_bitset_unref (GtkBitset *self);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkBitset, gtk_bitset_unref)
GDK_AVAILABLE_IN_ALL
gboolean gtk_bitset_contains (const GtkBitset *self,
+4 -4
View File
@@ -2858,7 +2858,7 @@ gtk_cell_area_activate (GtkCellArea *area,
/**
* gtk_cell_area_set_focus_cell:
* @area: a `GtkCellArea`
* @renderer: (nullable): the `GtkCellRenderer` to give focus to
* @renderer: the `GtkCellRenderer` to give focus to
*
* Explicitly sets the currently focused cell to @renderer.
*
@@ -2903,7 +2903,7 @@ gtk_cell_area_set_focus_cell (GtkCellArea *area,
*
* Retrieves the currently focused cell for @area
*
* Returns: (transfer none) (nullable): the currently focused cell in @area.
* Returns: (transfer none): the currently focused cell in @area.
*/
GtkCellRenderer *
gtk_cell_area_get_focus_cell (GtkCellArea *area)
@@ -3211,7 +3211,7 @@ gtk_cell_area_set_edit_widget (GtkCellArea *area,
* Gets the `GtkCellRenderer` in @area that is currently
* being edited.
*
* Returns: (transfer none) (nullable): The currently edited `GtkCellRenderer`
* Returns: (transfer none): The currently edited `GtkCellRenderer`
*/
GtkCellRenderer *
gtk_cell_area_get_edited_cell (GtkCellArea *area)
@@ -3230,7 +3230,7 @@ gtk_cell_area_get_edited_cell (GtkCellArea *area)
* Gets the `GtkCellEditable` widget currently used
* to edit the currently edited cell.
*
* Returns: (transfer none) (nullable): The currently active `GtkCellEditable` widget
* Returns: (transfer none): The currently active `GtkCellEditable` widget
*/
GtkCellEditable *
gtk_cell_area_get_edit_widget (GtkCellArea *area)
+1 -1
View File
@@ -379,7 +379,7 @@ gtk_column_view_column_new (const char *title,
{
GtkColumnViewColumn *result;
g_return_val_if_fail (factory == NULL || GTK_IS_LIST_ITEM_FACTORY (factory), NULL);
g_return_val_if_fail (GTK_IS_LIST_ITEM_FACTORY (factory), NULL);
result = g_object_new (GTK_TYPE_COLUMN_VIEW_COLUMN,
"factory", factory,
-1
View File
@@ -35,7 +35,6 @@ G_BEGIN_DECLS
#define GTK_IS_COLUMN_VIEW_COLUMN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GTK_TYPE_COLUMN_VIEW_COLUMN))
#define GTK_IS_COLUMN_VIEW_COLUMN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GTK_TYPE_COLUMN_VIEW_COLUMN))
#define GTK_COLUMN_VIEW_COLUMN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GTK_TYPE_COLUMN_VIEW_COLUMN, GtkColumnViewColumnClass))
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkColumnViewColumn, g_object_unref)
typedef struct _GtkColumnViewColumnClass GtkColumnViewColumnClass;
+5 -5
View File
@@ -854,10 +854,10 @@ parse_declaration (GtkCssScanner *scanner,
{
GtkCssStyleProperty *child = _gtk_css_shorthand_property_get_subproperty (shorthand, i);
GtkCssValue *sub = _gtk_css_array_value_get_nth (value, i);
gtk_css_ruleset_add (ruleset, child, _gtk_css_value_ref (sub), section);
}
_gtk_css_value_unref (value);
}
else if (GTK_IS_CSS_STYLE_PROPERTY (property))
@@ -1045,7 +1045,7 @@ gtk_css_provider_load_internal (GtkCssProvider *self,
}
else
{
gtk_css_parser_error (parent->parser,
gtk_css_parser_error (parent->parser,
GTK_CSS_PARSER_ERROR_IMPORT,
gtk_css_parser_get_block_location (parent->parser),
gtk_css_parser_get_end_location (parent->parser),
@@ -1146,7 +1146,7 @@ gtk_css_provider_load_from_file (GtkCssProvider *css_provider,
/**
* gtk_css_provider_load_from_path:
* @css_provider: a `GtkCssProvider`
* @path: (type filename): the path of a filename to load, in the GLib filename encoding
* @path: the path of a filename to load, in the GLib filename encoding
*
* Loads the data contained in @path into @css_provider.
*
@@ -1162,7 +1162,7 @@ gtk_css_provider_load_from_path (GtkCssProvider *css_provider,
g_return_if_fail (path != NULL);
file = g_file_new_for_path (path);
gtk_css_provider_load_from_file (css_provider, file);
g_object_unref (file);
+66 -188
View File
@@ -65,25 +65,6 @@ enum {
NUM_PROPERTIES
};
typedef struct _QueuedEvent QueuedEvent;
struct _QueuedEvent
{
GtkDirectoryList *list;
GFile *file;
GFileInfo *info;
GFileMonitorEvent event;
};
static void
free_queued_event (gpointer data)
{
QueuedEvent *event = data;
g_clear_object (&event->file);
g_clear_object (&event->info);
g_free (event);
}
struct _GtkDirectoryList
{
GObject parent_instance;
@@ -97,7 +78,6 @@ struct _GtkDirectoryList
GCancellable *cancellable;
GError *error; /* Error while loading */
GSequence *items; /* Use GPtrArray or GListStore here? */
GQueue events;
};
struct _GtkDirectoryListClass
@@ -160,6 +140,7 @@ gtk_directory_list_set_property (GObject *object,
case PROP_ATTRIBUTES:
gtk_directory_list_set_attributes (self, g_value_get_string (value));
break;
case PROP_FILE:
gtk_directory_list_set_file (self, g_value_get_object (value));
break;
@@ -257,9 +238,6 @@ gtk_directory_list_dispose (GObject *object)
g_clear_error (&self->error);
g_clear_pointer (&self->items, g_sequence_free);
g_queue_foreach (&self->events, (GFunc) free_queued_event, NULL);
g_queue_clear (&self->events);
G_OBJECT_CLASS (gtk_directory_list_parent_class)->dispose (object);
}
@@ -353,7 +331,6 @@ gtk_directory_list_init (GtkDirectoryList *self)
self->items = g_sequence_new (g_object_unref);
self->io_priority = G_PRIORITY_DEFAULT;
self->monitored = TRUE;
g_queue_init (&self->events);
}
/**
@@ -542,123 +519,24 @@ gtk_directory_list_start_loading (GtkDirectoryList *self)
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_LOADING]);
}
static GSequenceIter *
find_file (GSequence *sequence,
GFile *file)
{
GSequenceIter *iter;
for (iter = g_sequence_get_begin_iter (sequence);
!g_sequence_iter_is_end (iter);
iter = g_sequence_iter_next (iter))
{
GFileInfo *item = G_FILE_INFO (g_sequence_get (iter));
GFile *f = G_FILE (g_file_info_get_attribute_object (item, "standard::file"));
if (g_file_equal (f, file))
return iter;
}
return NULL;
}
static gboolean
handle_event (QueuedEvent *event)
{
GtkDirectoryList *self = event->list;
GFile *file = event->file;
GFileInfo *info = event->info;
GSequenceIter *iter;
unsigned int position;
switch ((int)event->event)
{
case G_FILE_MONITOR_EVENT_MOVED_IN:
case G_FILE_MONITOR_EVENT_CREATED:
if (!info)
return FALSE;
g_file_info_set_attribute_object (info, "standard::file", G_OBJECT (file));
iter = find_file (self->items, file);
if (iter)
{
position = g_sequence_iter_get_position (iter);
g_sequence_set (iter, g_object_ref (info));
g_list_model_items_changed (G_LIST_MODEL (self), position, 1, 1);
}
else
{
position = g_sequence_get_length (self->items);
g_sequence_append (self->items, g_object_ref (info));
g_list_model_items_changed (G_LIST_MODEL (self), position, 0, 1);
}
break;
case G_FILE_MONITOR_EVENT_MOVED_OUT:
case G_FILE_MONITOR_EVENT_DELETED:
iter = find_file (self->items, file);
if (iter)
{
position = g_sequence_iter_get_position (iter);
g_sequence_remove (iter);
g_list_model_items_changed (G_LIST_MODEL (self), position, 1, 0);
}
break;
case G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED:
if (!info)
return FALSE;
g_file_info_set_attribute_object (info, "standard::file", G_OBJECT (file));
iter = find_file (self->items, file);
if (iter)
{
position = g_sequence_iter_get_position (iter);
g_sequence_set (iter, g_object_ref (info));
g_list_model_items_changed (G_LIST_MODEL (self), position, 1, 1);
}
break;
default:
g_assert_not_reached ();
}
return TRUE;
}
static void
handle_events (GtkDirectoryList *self)
{
QueuedEvent *event;
do
{
event = g_queue_peek_tail (&self->events);
if (!event)
return;
if (!handle_event (event))
return;
event = g_queue_pop_tail (&self->events);
free_queued_event (event);
}
while (TRUE);
}
static void
got_new_file_info_cb (GObject *source,
GAsyncResult *res,
gpointer data)
{
QueuedEvent *event = data;
GtkDirectoryList *self = event->list;
GFile *file = event->file;
GFile *file = G_FILE (source);
GtkDirectoryList *self = GTK_DIRECTORY_LIST (data);
GFileInfo *info;
guint position;
event->info = g_file_query_info_finish (file, res, NULL);
handle_events (self);
info = g_file_query_info_finish (file, res, NULL);
if (!info)
return;
g_file_info_set_attribute_object (info, "standard::file", G_OBJECT (file));
position = g_sequence_get_length (self->items);
g_sequence_append (self->items, info);
g_list_model_items_changed (G_LIST_MODEL (self), position, 0, 1);
}
static void
@@ -666,12 +544,53 @@ got_existing_file_info_cb (GObject *source,
GAsyncResult *res,
gpointer data)
{
QueuedEvent *event = data;
GtkDirectoryList *self = event->list;
GFile *file = event->file;
GFile *file = G_FILE (source);
GtkDirectoryList *self = GTK_DIRECTORY_LIST (data);
GFileInfo *info;
GSequenceIter *iter;
event->info = g_file_query_info_finish (file, res, NULL);
handle_events (self);
info = g_file_query_info_finish (file, res, NULL);
if (!info)
return;
g_file_info_set_attribute_object (info, "standard::file", G_OBJECT (file));
for (iter = g_sequence_get_begin_iter (self->items);
!g_sequence_iter_is_end (iter);
iter = g_sequence_iter_next (iter))
{
GFileInfo *item = g_sequence_get (iter);
GFile *f = G_FILE (g_file_info_get_attribute_object (item, "standard::file"));
if (g_file_equal (f, file))
{
guint position = g_sequence_iter_get_position (iter);
g_sequence_set (iter, g_object_ref (info));
g_list_model_items_changed (G_LIST_MODEL (self), position, 1, 1);
break;
}
}
}
static void
gtk_directory_list_remove_file (GtkDirectoryList *self,
GFile *file)
{
GSequenceIter *iter;
for (iter = g_sequence_get_begin_iter (self->items);
!g_sequence_iter_is_end (iter);
iter = g_sequence_iter_next (iter))
{
GFileInfo *item = g_sequence_get (iter);
GFile *f = G_FILE (g_file_info_get_attribute_object (item, "standard::file"));
if (g_file_equal (f, file))
{
guint position = g_sequence_iter_get_position (iter);
g_sequence_remove (iter);
g_list_model_items_changed (G_LIST_MODEL (self), position, 1, 0);
break;
}
}
}
static void
@@ -682,74 +601,30 @@ directory_changed (GFileMonitor *monitor,
gpointer data)
{
GtkDirectoryList *self = GTK_DIRECTORY_LIST (data);
QueuedEvent *ev;
switch (event)
{
case G_FILE_MONITOR_EVENT_MOVED_IN:
case G_FILE_MONITOR_EVENT_CREATED:
ev = g_new0 (QueuedEvent, 1);
ev->list = self;
ev->event = event;
ev->file = g_object_ref (file);
g_queue_push_head (&self->events, ev);
g_file_query_info_async (file,
self->attributes,
G_FILE_QUERY_INFO_NONE,
self->io_priority,
self->cancellable,
got_new_file_info_cb,
ev);
self);
break;
case G_FILE_MONITOR_EVENT_MOVED_OUT:
case G_FILE_MONITOR_EVENT_DELETED:
ev = g_new0 (QueuedEvent, 1);
ev->list = self;
ev->event = event;
ev->file = g_object_ref (file);
g_queue_push_head (&self->events, ev);
handle_events (self);
gtk_directory_list_remove_file (self, file);
break;
case G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED:
ev = g_new0 (QueuedEvent, 1);
ev->list = self;
ev->event = event;
ev->file = g_object_ref (file);
g_queue_push_head (&self->events, ev);
g_file_query_info_async (file,
self->attributes,
G_FILE_QUERY_INFO_NONE,
self->io_priority,
self->cancellable,
got_existing_file_info_cb,
ev);
break;
case G_FILE_MONITOR_EVENT_RENAMED:
ev = g_new0 (QueuedEvent, 1);
ev->list = self;
ev->event = G_FILE_MONITOR_EVENT_DELETED;
ev->file = g_object_ref (file);
g_queue_push_head (&self->events, ev);
ev = g_new0 (QueuedEvent, 1);
ev->list = self;
ev->event = G_FILE_MONITOR_EVENT_CREATED;
ev->file = g_object_ref (other_file);
g_queue_push_head (&self->events, ev);
g_file_query_info_async (other_file,
self->attributes,
G_FILE_QUERY_INFO_NONE,
self->io_priority,
self->cancellable,
got_existing_file_info_cb,
ev);
self);
break;
case G_FILE_MONITOR_EVENT_CHANGED:
@@ -757,6 +632,9 @@ directory_changed (GFileMonitor *monitor,
case G_FILE_MONITOR_EVENT_PRE_UNMOUNT:
case G_FILE_MONITOR_EVENT_UNMOUNTED:
case G_FILE_MONITOR_EVENT_MOVED:
case G_FILE_MONITOR_EVENT_RENAMED:
case G_FILE_MONITOR_EVENT_MOVED_IN:
case G_FILE_MONITOR_EVENT_MOVED_OUT:
default:
break;
}
@@ -766,7 +644,7 @@ static void
gtk_directory_list_start_monitoring (GtkDirectoryList *self)
{
g_assert (self->monitor == NULL);
self->monitor = g_file_monitor_directory (self->file, G_FILE_MONITOR_WATCH_MOVES, NULL, NULL);
self->monitor = g_file_monitor_directory (self->file, G_FILE_MONITOR_NONE, NULL, NULL);
g_signal_connect (self->monitor, "changed", G_CALLBACK (directory_changed), self);
}
+1 -1
View File
@@ -895,7 +895,7 @@ gtk_drop_target_new (GType type,
*
* If the result is %NULL, all formats are expected to be supported.
*
* Returns: (nullable) (transfer none): the supported data formats
* Returns: (nullable): the supported data formats
*/
GdkContentFormats *
gtk_drop_target_get_formats (GtkDropTarget *self)
-8
View File
@@ -1211,8 +1211,6 @@ gtk_entry_completion_match_selected (GtkEntryCompletion *completion,
GtkTreeModel *model,
GtkTreeIter *iter)
{
g_assert (completion->entry != NULL);
char *str = NULL;
gtk_tree_model_get (model, iter, completion->text_column, &str, -1);
@@ -1231,8 +1229,6 @@ gtk_entry_completion_cursor_on_match (GtkEntryCompletion *completion,
GtkTreeModel *model,
GtkTreeIter *iter)
{
g_assert (completion->entry != NULL);
gtk_entry_completion_insert_completion (completion, model, iter);
return TRUE;
@@ -1321,8 +1317,6 @@ static gboolean
gtk_entry_completion_real_insert_prefix (GtkEntryCompletion *completion,
const char *prefix)
{
g_assert (completion->entry != NULL);
if (prefix)
{
int key_len;
@@ -1423,8 +1417,6 @@ gtk_entry_completion_insert_completion (GtkEntryCompletion *completion,
void
gtk_entry_completion_insert_prefix (GtkEntryCompletion *completion)
{
g_return_if_fail (completion->entry != NULL);
gboolean done;
char *prefix;
GtkText *text = gtk_entry_get_text_widget (GTK_ENTRY (completion->entry));
+38 -37
View File
@@ -48,7 +48,7 @@ G_BEGIN_DECLS
*
* Alignment only matters if the widget receives a too large allocation,
* for example if you packed the widget with the [property@Gtk.Widget:hexpand]
* property inside a [class@Box], then the widget might get extra space.
* property inside a `GtkBox`, then the widget might get extra space.
* If you have for example a 16x16 icon inside a 32x32 space, the icon
* could be scaled and stretched, it could be centered, or it could be
* positioned to one side of the space.
@@ -226,7 +226,7 @@ typedef enum
* @GTK_JUSTIFY_CENTER: The text is placed in the center of the label.
* @GTK_JUSTIFY_FILL: The text is placed is distributed across the label.
*
* Used for justifying the text inside a [class@Label] widget.
* Used for justifying the text inside a `GtkLabel` widget.
*/
typedef enum
{
@@ -244,7 +244,7 @@ typedef enum
* @GTK_MESSAGE_ERROR: Fatal error message
* @GTK_MESSAGE_OTHER: None of the above
*
* The type of message being displayed in a [class@MessageDialog].
* The type of message being displayed in a `GtkMessageDialog`.
*/
typedef enum
{
@@ -338,7 +338,7 @@ typedef enum
*
* Represents the orientation of widgets and other objects.
*
* Typical examples are [class@Box] or [class@GesturePan].
* Typical examples are `GtkBox or `GtkGesturePan`.
*/
typedef enum
{
@@ -372,7 +372,7 @@ typedef enum
*
* Represents the packing location of a children in its parent.
*
* See [class@WindowControls] for example.
* See `GtkWindowControls` for example.
*/
typedef enum
{
@@ -389,8 +389,8 @@ typedef enum
*
* Describes which edge of a widget a certain feature is positioned at.
*
* For examples, see the tabs of a [class@Notebook], or the label
* of a [class@Scale].
* For examples, see the tabs of a `GtkNotebook`, or the label
* of a `GtkScale`.
*/
typedef enum
{
@@ -567,7 +567,7 @@ typedef enum
*
* Describes the way two values can be compared.
*
* These values can be used with a [callback@GLib.CompareFunc]. However,
* These values can be used with a `GCompareFunc`. However,
* a `GCompareFunc` is allowed to return any integer values.
* For converting such a value to a `GtkOrdering` value, use
* [func@Gtk.Ordering.from_cmpfunc].
@@ -813,7 +813,7 @@ typedef enum {
* @GTK_LEVEL_BAR_MODE_CONTINUOUS: the bar has a continuous mode
* @GTK_LEVEL_BAR_MODE_DISCRETE: the bar has a discrete mode
*
* Describes how [class@LevelBar] contents should be rendered.
* Describes how `GtkLevelBar` contents should be rendered.
*
* Note that this enumeration could be extended with additional modes
* in the future.
@@ -898,7 +898,7 @@ typedef enum
* or applications.
*
* Note that input methods may already tailor their behaviour according
* to the [enum@InputPurpose] of the entry.
* to the `GtkInputPurpose` of the entry.
*
* Some common sense is expected when using these flags - mixing
* %GTK_INPUT_HINT_LOWERCASE with any of the uppercase hints makes no sense.
@@ -937,7 +937,7 @@ typedef enum
* note that widget implementations must chain up on button, motion, touch and
* grab broken handlers for controllers in this phase to be run.
*
* Describes the stage at which events are fed into a [class@EventController].
* Describes the stage at which events are fed into a `GtkEventController`.
*/
typedef enum
{
@@ -952,10 +952,10 @@ typedef enum
* @GTK_LIMIT_NONE: Events are handled regardless of what their
* target is.
* @GTK_LIMIT_SAME_NATIVE: Events are only handled if their target
* is in the same [iface@Native] as the event controllers widget. Note
* is in the same `GtkNative` as the event controllers widget. Note
* that some event types have two targets (origin and destination).
*
* Describes limits of a [class@EventController] for handling events
* Describes limits of a `GtkEventController` for handling events
* targeting other widgets.
*/
typedef enum
@@ -970,7 +970,7 @@ typedef enum
* @GTK_EVENT_SEQUENCE_CLAIMED: The sequence is handled and grabbed.
* @GTK_EVENT_SEQUENCE_DENIED: The sequence is denied.
*
* Describes the state of a [struct@Gdk.EventSequence] in a [class@Gesture].
* Describes the state of a `GdkEventSequence` in a `GtkGesture`.
*/
typedef enum
{
@@ -986,7 +986,7 @@ typedef enum
* @GTK_PAN_DIRECTION_UP: panned upwards
* @GTK_PAN_DIRECTION_DOWN: panned downwards
*
* Describes the panning direction of a [class@GesturePan].
* Describes the panning direction of a `GtkGesturePan`
*/
typedef enum
{
@@ -1001,12 +1001,12 @@ typedef enum
* @GTK_SHORTCUT_SCOPE_LOCAL: Shortcuts are handled inside
* the widget the controller belongs to.
* @GTK_SHORTCUT_SCOPE_MANAGED: Shortcuts are handled by
* the first ancestor that is a [iface@ShortcutManager]
* the first ancestor that is a `GtkShortcutManager`
* @GTK_SHORTCUT_SCOPE_GLOBAL: Shortcuts are handled by
* the root widget.
*
* Describes where [class@Shortcut]s added to a
* [class@ShortcutController] get handled.
* Describes where `GtkShortcut`s added to a
* `GtkShortcutController` get handled.
*/
typedef enum
{
@@ -1019,9 +1019,9 @@ typedef enum
* GtkPickFlags:
* @GTK_PICK_DEFAULT: The default behavior, include widgets that are receiving events
* @GTK_PICK_INSENSITIVE: Include widgets that are insensitive
* @GTK_PICK_NON_TARGETABLE: Include widgets that are marked as non-targetable. See [property@Widget:can-target]
* @GTK_PICK_NON_TARGETABLE: Include widgets that are marked as non-targetable. See `GtkWidget:can-target`
*
* Flags that influence the behavior of [method@Widget.pick].
* Flags that influence the behavior of gtk_widget_pick().
*/
typedef enum {
GTK_PICK_DEFAULT = 0,
@@ -1052,7 +1052,7 @@ typedef enum {
*
* The strength of a constraint, expressed as a symbolic constant.
*
* The strength of a [class@Constraint] can be expressed with any positive
* The strength of a `GtkConstraint` can be expressed with any positive
* integer; the values of this enumeration can be used for readability.
*/
typedef enum {
@@ -1086,7 +1086,7 @@ typedef enum {
* vertical axis
* @GTK_CONSTRAINT_ATTRIBUTE_BASELINE: The baseline of a widget
*
* The widget attributes that can be used when creating a [class@Constraint].
* The widget attributes that can be used when creating a `GtkConstraint`.
*/
typedef enum {
GTK_CONSTRAINT_ATTRIBUTE_NONE,
@@ -1144,7 +1144,7 @@ typedef enum {
* The values indicate which system setting has changed.
* Widgets may need to drop caches, or react otherwise.
*
* Most of the values correspond to [class@Settings] properties.
* Most of the values correspond to `GtkSettings` properties.
*
* More values may be added over time.
*/
@@ -1206,7 +1206,7 @@ typedef enum {
* @GTK_ACCESSIBLE_ROLE_GRID: A grid of items.
* @GTK_ACCESSIBLE_ROLE_GRID_CELL: An item in a grid or tree grid.
* @GTK_ACCESSIBLE_ROLE_GROUP: An element that groups multiple widgets. GTK uses
* this role for various containers, like [class@Box], [class@Viewport], and [class@HeaderBar].
* this role for various containers, like `GtkBox`, `GtkViewport`, and `GtkHeaderBar`.
* @GTK_ACCESSIBLE_ROLE_HEADING: Unused
* @GTK_ACCESSIBLE_ROLE_IMG: An image.
* @GTK_ACCESSIBLE_ROLE_INPUT: Abstract role.
@@ -1278,7 +1278,7 @@ typedef enum {
* interface. This is the role that GTK uses by default for widgets.
* @GTK_ACCESSIBLE_ROLE_WINDOW: An application window.
*
* The accessible role for a [iface@Accessible] implementation.
* The accessible role for a `GtkAccessible` implementation.
*
* Abstract roles are only used as part of the ontology; application
* developers must not use abstract roles in their code.
@@ -1368,27 +1368,27 @@ typedef enum {
* GtkAccessibleState:
* @GTK_ACCESSIBLE_STATE_BUSY: A busy state. This state has boolean values
* @GTK_ACCESSIBLE_STATE_CHECKED: A checked state; indicates the current
* state of a [class@CheckButton]. Value type: [enum@AccessibleTristate]
* state of a `GtkCheckButton`. Value type: `GtkAccessibleTristate`
* @GTK_ACCESSIBLE_STATE_DISABLED: A disabled state; corresponds to the
* [property@Widget:sensitive] property. It indicates a UI element
* `GtkWidget:sensitive` property on `GtkWidget`. It indicates a UI element
* that is perceivable, but not editable or operable. Value type: boolean
* @GTK_ACCESSIBLE_STATE_EXPANDED: An expanded state; corresponds to the
* [property@Expander:expanded] property. Value type: boolean
* `GtkExpander:expanded` property on `GtkExpander`. Value type: boolean
* or undefined
* @GTK_ACCESSIBLE_STATE_HIDDEN: A hidden state; corresponds to the
* [property@Widget:visible] property. You can use this state
* `GtkWidget:visible` property on `GtkWidget`. You can use this state
* explicitly on UI elements that should not be exposed to an assistive
* technology. Value type: boolean
* See also: %GTK_ACCESSIBLE_STATE_DISABLED
* @GTK_ACCESSIBLE_STATE_INVALID: An invalid state; set when a widget
* is showing an error. Value type: [enum@AccessibleInvalidState]
* is showing an error. Value type: `GtkAccessibleInvalidState`
* @GTK_ACCESSIBLE_STATE_PRESSED: A pressed state; indicates the current
* state of a [class@ToggleButton]. Value type: [enum@AccessibleTristate]
* state of a `GtkToggleButton`. Value type: `GtkAccessibleTristate`
* enumeration
* @GTK_ACCESSIBLE_STATE_SELECTED: A selected state; set when a widget
* is selected. Value type: boolean or undefined
*
* The possible accessible states of a [iface@Accessible].
* The possible accessible states of a `GtkAccessible`.
*/
typedef enum {
GTK_ACCESSIBLE_STATE_BUSY,
@@ -1414,7 +1414,7 @@ typedef enum {
* @GTK_ACCESSIBLE_PROPERTY_AUTOCOMPLETE: Indicates whether inputting text
* could trigger display of one or more predictions of the user's intended
* value for a combobox, searchbox, or textbox and specifies how predictions
* would be presented if they were made. Value type: [enum@AccessibleAutocomplete]
* would be presented if they were made. Value type: `GtkAccessibleAutocomplete`
* @GTK_ACCESSIBLE_PROPERTY_DESCRIPTION: Defines a string value that describes
* or annotates the current element. Value type: string
* @GTK_ACCESSIBLE_PROPERTY_HAS_POPUP: Indicates the availability and type of
@@ -1436,7 +1436,7 @@ typedef enum {
* boolean
* @GTK_ACCESSIBLE_PROPERTY_ORIENTATION: Indicates whether the element's
* orientation is horizontal, vertical, or unknown/ambiguous. Value type:
* [enum@Orientation]
* `GtkOrientation`
* @GTK_ACCESSIBLE_PROPERTY_PLACEHOLDER: Defines a short hint (a word or short
* phrase) intended to aid the user with data entry when the control has no
* value. A hint could be a sample value or a brief description of the expected
@@ -1448,7 +1448,8 @@ typedef enum {
* @GTK_ACCESSIBLE_PROPERTY_ROLE_DESCRIPTION: Defines a human-readable,
* author-localized description for the role of an element. Value type: string
* @GTK_ACCESSIBLE_PROPERTY_SORT: Indicates if items in a table or grid are
* sorted in ascending or descending order. Value type: [enum@AccessibleSort]
* sorted in ascending or descending order. Possible property values are in
* the `GtkAccessibleSort` enumeration. Value type: `GtkAccessibleSort`
* @GTK_ACCESSIBLE_PROPERTY_VALUE_MAX: Defines the maximum allowed value for a
* range widget. Value type: double
* @GTK_ACCESSIBLE_PROPERTY_VALUE_MIN: Defines the minimum allowed value for a
@@ -1458,7 +1459,7 @@ typedef enum {
* @GTK_ACCESSIBLE_PROPERTY_VALUE_TEXT: Defines the human readable text alternative
* of aria-valuenow for a range widget. Value type: string
*
* The possible accessible properties of a [iface@Accessible].
* The possible accessible properties of a `GtkAccessible`.
*/
typedef enum {
GTK_ACCESSIBLE_PROPERTY_AUTOCOMPLETE,
@@ -1528,7 +1529,7 @@ typedef enum {
* @GTK_ACCESSIBLE_RELATION_SET_SIZE: Defines the number of items in the current
* set of listitems or treeitems. Value type: integer
*
* The possible accessible relations of a [iface@Accessible].
* The possible accessible relations of a `GtkAccessible`.
*
* Accessible relations can be references to other widgets,
* integers or strings.
+1 -3
View File
@@ -551,8 +551,6 @@ gtk_event_controller_set_propagation_limit (GtkEventController *controller,
* @controller: a `GtkEventController`
*
* Gets the name of @controller.
*
* Returns: (nullable): The controller name
*/
const char *
gtk_event_controller_get_name (GtkEventController *controller)
@@ -567,7 +565,7 @@ gtk_event_controller_get_name (GtkEventController *controller)
/**
* gtk_event_controller_set_name: (attributes org.gtk.Method.set_property=name)
* @controller: a `GtkEventController`
* @name: (nullable): a name for @controller
* @name: a name for @controller
*
* Sets a name on the controller that can be used for debugging.
*/
+2 -2
View File
@@ -293,7 +293,7 @@ gtk_event_controller_key_new (void)
/**
* gtk_event_controller_key_set_im_context:
* @controller: a `GtkEventControllerKey`
* @im_context: (nullable): a `GtkIMContext`
* @im_context: a `GtkIMContext`
*
* Sets the input method context of the key @controller.
*/
@@ -316,7 +316,7 @@ gtk_event_controller_key_set_im_context (GtkEventControllerKey *controller,
*
* Gets the input method context of the key @controller.
*
* Returns: (transfer none) (nullable): the `GtkIMContext`
* Returns: (transfer none): the `GtkIMContext`
**/
GtkIMContext *
gtk_event_controller_key_get_im_context (GtkEventControllerKey *controller)
+18 -116
View File
@@ -66,7 +66,6 @@
#include "gtkprivate.h"
#define SCROLL_CAPTURE_THRESHOLD_MS 150
#define HOLD_TIMEOUT_MS 50
typedef struct
{
@@ -85,7 +84,6 @@ struct _GtkEventControllerScroll
double cur_dx;
double cur_dy;
guint hold_timeout_id;
guint active : 1;
};
@@ -195,7 +193,6 @@ gtk_event_controller_scroll_finalize (GObject *object)
GtkEventControllerScroll *scroll = GTK_EVENT_CONTROLLER_SCROLL (object);
g_array_unref (scroll->scroll_history);
g_clear_handle_id (&scroll->hold_timeout_id, g_source_remove);
G_OBJECT_CLASS (gtk_event_controller_scroll_parent_class)->finalize (object);
}
@@ -238,107 +235,6 @@ gtk_event_controller_scroll_get_property (GObject *object,
}
}
static gboolean
gtk_event_controller_scroll_begin (GtkEventController *controller)
{
GtkEventControllerScroll *scroll = GTK_EVENT_CONTROLLER_SCROLL (controller);
if (scroll->active)
return FALSE;
g_signal_emit (controller, signals[SCROLL_BEGIN], 0);
scroll_history_reset (scroll);
scroll->active = TRUE;
return TRUE;
}
static gboolean
gtk_event_controller_scroll_end (GtkEventController *controller)
{
GtkEventControllerScroll *scroll = GTK_EVENT_CONTROLLER_SCROLL (controller);
if (!scroll->active)
return FALSE;
g_signal_emit (controller, signals[SCROLL_END], 0);
scroll->active = FALSE;
if (scroll->flags & GTK_EVENT_CONTROLLER_SCROLL_KINETIC)
{
double vel_x, vel_y;
scroll_history_finish (scroll, &vel_x, &vel_y);
g_signal_emit (controller, signals[DECELERATE], 0, vel_x, vel_y);
}
return TRUE;
}
static gboolean
gtk_event_controller_scroll_hold_timeout (gpointer user_data)
{
GtkEventController *controller;
GtkEventControllerScroll *scroll;
controller = user_data;
scroll = GTK_EVENT_CONTROLLER_SCROLL (controller);
gtk_event_controller_scroll_end (controller);
scroll->hold_timeout_id = 0;
return G_SOURCE_REMOVE;
}
static gboolean
gtk_event_controller_scroll_handle_hold_event (GtkEventController *controller,
GdkEvent *event)
{
GtkEventControllerScroll *scroll = GTK_EVENT_CONTROLLER_SCROLL (controller);
gboolean handled = GDK_EVENT_PROPAGATE;
GdkTouchpadGesturePhase phase;
guint n_fingers = 0;
if (gdk_event_get_event_type (event) != GDK_TOUCHPAD_HOLD)
return handled;
n_fingers = gdk_touchpad_event_get_n_fingers (event);
if (n_fingers != 1 && n_fingers != 2)
return handled;
if (scroll->hold_timeout_id != 0)
return handled;
phase = gdk_touchpad_event_get_gesture_phase (event);
switch (phase)
{
case GDK_TOUCHPAD_GESTURE_PHASE_BEGIN:
handled = gtk_event_controller_scroll_begin (controller);
break;
case GDK_TOUCHPAD_GESTURE_PHASE_END:
handled = gtk_event_controller_scroll_end (controller);
break;
case GDK_TOUCHPAD_GESTURE_PHASE_CANCEL:
if (scroll->hold_timeout_id == 0)
{
scroll->hold_timeout_id =
g_timeout_add (HOLD_TIMEOUT_MS,
gtk_event_controller_scroll_hold_timeout,
controller);
}
break;
case GDK_TOUCHPAD_GESTURE_PHASE_UPDATE:
default:
break;
}
return handled;
}
static gboolean
gtk_event_controller_scroll_handle_event (GtkEventController *controller,
GdkEvent *event,
@@ -349,28 +245,26 @@ gtk_event_controller_scroll_handle_event (GtkEventController *controller,
GdkScrollDirection direction = GDK_SCROLL_SMOOTH;
double dx = 0, dy = 0;
gboolean handled = GDK_EVENT_PROPAGATE;
GdkEventType event_type;
event_type = gdk_event_get_event_type (event);
if (event_type == GDK_TOUCHPAD_HOLD)
return gtk_event_controller_scroll_handle_hold_event (controller, event);
if (event_type != GDK_SCROLL)
if (gdk_event_get_event_type (event) != GDK_SCROLL)
return FALSE;
if ((scroll->flags & (GTK_EVENT_CONTROLLER_SCROLL_VERTICAL |
GTK_EVENT_CONTROLLER_SCROLL_HORIZONTAL)) == 0)
return FALSE;
g_clear_handle_id (&scroll->hold_timeout_id, g_source_remove);
/* FIXME: Handle device changes */
direction = gdk_scroll_event_get_direction (event);
if (direction == GDK_SCROLL_SMOOTH)
{
gdk_scroll_event_get_deltas (event, &dx, &dy);
gtk_event_controller_scroll_begin (controller);
if (!scroll->active)
{
g_signal_emit (controller, signals[SCROLL_BEGIN], 0);
scroll_history_reset (scroll);
scroll->active = TRUE;
}
if ((scroll->flags & GTK_EVENT_CONTROLLER_SCROLL_VERTICAL) == 0)
dy = 0;
@@ -440,8 +334,17 @@ gtk_event_controller_scroll_handle_event (GtkEventController *controller,
if (scroll->active && gdk_scroll_event_is_stop (event))
{
gtk_event_controller_scroll_end (controller);
g_signal_emit (controller, signals[SCROLL_END], 0);
scroll->active = FALSE;
handled = FALSE;
if (scroll->flags & GTK_EVENT_CONTROLLER_SCROLL_KINETIC)
{
double vel_x, vel_y;
scroll_history_finish (scroll, &vel_x, &vel_y);
g_signal_emit (controller, signals[DECELERATE], 0, vel_x, vel_y);
}
}
return handled;
@@ -559,7 +462,6 @@ gtk_event_controller_scroll_init (GtkEventControllerScroll *scroll)
{
scroll->scroll_history = g_array_new (FALSE, FALSE,
sizeof (ScrollHistoryElem));
scroll->hold_timeout_id = 0;
}
/**
+3 -3
View File
@@ -335,7 +335,7 @@ gtk_file_chooser_set_current_name (GtkFileChooser *chooser,
* This is meant to be used in save dialogs, to get the currently typed
* filename when the file itself does not exist yet.
*
* Returns: (nullable): The raw text from the file choosers Name entry. Free with
* Returns: The raw text from the file choosers Name entry. Free with
* g_free(). Note that this string is not a full pathname or URI; it is
* whatever the contents of the entry are. Note also that this string is
* in UTF-8 encoding, which is not necessarily the systems encoding for
@@ -369,7 +369,7 @@ gtk_file_chooser_unselect_all (GtkFileChooser *chooser)
/**
* gtk_file_chooser_set_current_folder:
* @chooser: a `GtkFileChooser`
* @file: (nullable): the `GFile` for the new folder
* @file: the `GFile` for the new folder
* @error: location to store error
*
* Sets the current folder for @chooser from a `GFile`.
@@ -395,7 +395,7 @@ gtk_file_chooser_set_current_folder (GtkFileChooser *chooser,
*
* Gets the current folder of @chooser as `GFile`.
*
* Returns: (transfer full) (nullable): the `GFile` for the current folder.
* Returns: (transfer full): the `GFile` for the current folder.
*/
GFile *
gtk_file_chooser_get_current_folder (GtkFileChooser *chooser)
+1
View File
@@ -66,6 +66,7 @@
#include <hb-ot.h>
#include "language-names.h"
#include "script-names.h"
#include "open-type-layout.h"
/**
+8 -53
View File
@@ -162,7 +162,6 @@ struct _GtkGesturePrivate
GdkDevice *device;
GList *group_link;
guint n_points;
guint hold_timeout_id;
guint recognized : 1;
guint touchpad : 1;
};
@@ -172,10 +171,7 @@ static guint signals[N_SIGNALS] = { 0 };
#define BUTTONS_MASK (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK | GDK_BUTTON3_MASK)
#define EVENT_IS_TOUCHPAD_GESTURE(e) (gdk_event_get_event_type (e) == GDK_TOUCHPAD_SWIPE || \
gdk_event_get_event_type (e) == GDK_TOUCHPAD_PINCH || \
gdk_event_get_event_type (e) == GDK_TOUCHPAD_HOLD)
#define HOLD_TIMEOUT_MS 50
gdk_event_get_event_type (e) == GDK_TOUCHPAD_PINCH)
GList * _gtk_gesture_get_group_link (GtkGesture *gesture);
@@ -225,7 +221,6 @@ gtk_gesture_finalize (GObject *object)
gtk_gesture_ungroup (gesture);
g_list_free (priv->group_link);
g_clear_handle_id (&priv->hold_timeout_id, g_source_remove);
g_hash_table_destroy (priv->points);
@@ -247,7 +242,7 @@ _gtk_gesture_get_n_touchpad_points (GtkGesture *gesture,
if (!priv->touchpad)
return 0;
data = g_hash_table_lookup (priv->points, priv->last_sequence);
data = g_hash_table_lookup (priv->points, NULL);
if (!data)
return 0;
@@ -263,8 +258,7 @@ _gtk_gesture_get_n_touchpad_points (GtkGesture *gesture,
if (only_active &&
(data->state == GTK_EVENT_SEQUENCE_DENIED ||
(event_type == GDK_TOUCHPAD_SWIPE && phase == GDK_TOUCHPAD_GESTURE_PHASE_END) ||
(event_type == GDK_TOUCHPAD_PINCH && phase == GDK_TOUCHPAD_GESTURE_PHASE_END) ||
(event_type == GDK_TOUCHPAD_HOLD && phase == GDK_TOUCHPAD_GESTURE_PHASE_END)))
(event_type == GDK_TOUCHPAD_PINCH && phase == GDK_TOUCHPAD_GESTURE_PHASE_END)))
return 0;
return n_fingers;
@@ -396,8 +390,8 @@ _update_touchpad_deltas (PointData *data)
{
GdkEvent *event = data->event;
GdkTouchpadGesturePhase phase;
double dx = 0;
double dy = 0;
double dx;
double dy;
if (!event)
return;
@@ -405,10 +399,7 @@ _update_touchpad_deltas (PointData *data)
if (EVENT_IS_TOUCHPAD_GESTURE (event))
{
phase = gdk_touchpad_event_get_gesture_phase (event);
if (gdk_event_get_event_type (event) != GDK_TOUCHPAD_HOLD)
gdk_touchpad_event_get_deltas (event, &dx, &dy);
gdk_touchpad_event_get_deltas (event, &dx, &dy);
if (phase == GDK_TOUCHPAD_GESTURE_PHASE_BEGIN)
data->accum_dx = data->accum_dy = 0;
else if (phase == GDK_TOUCHPAD_GESTURE_PHASE_UPDATE)
@@ -583,22 +574,6 @@ _gtk_gesture_cancel_all (GtkGesture *gesture)
_gtk_gesture_check_empty (gesture);
}
static gboolean
gtk_gesture_hold_timeout (gpointer user_data)
{
GtkGesture *gesture;
GtkGesturePrivate *priv;
gesture = user_data;
priv = gtk_gesture_get_instance_private (gesture);
if (priv->touchpad)
_gtk_gesture_cancel_sequence (gesture, priv->last_sequence);
priv->hold_timeout_id = 0;
return G_SOURCE_REMOVE;
}
static gboolean
gesture_within_surface (GtkGesture *gesture,
GdkSurface *surface)
@@ -661,13 +636,8 @@ gtk_gesture_handle_event (GtkEventController *controller,
if (event_type == GDK_BUTTON_PRESS ||
event_type == GDK_TOUCH_BEGIN ||
(event_type == GDK_TOUCHPAD_SWIPE && phase == GDK_TOUCHPAD_GESTURE_PHASE_BEGIN) ||
(event_type == GDK_TOUCHPAD_PINCH && phase == GDK_TOUCHPAD_GESTURE_PHASE_BEGIN) ||
(event_type == GDK_TOUCHPAD_HOLD && phase == GDK_TOUCHPAD_GESTURE_PHASE_BEGIN))
(event_type == GDK_TOUCHPAD_PINCH && phase == GDK_TOUCHPAD_GESTURE_PHASE_BEGIN))
{
if ((event_type == GDK_TOUCHPAD_PINCH || event_type == GDK_TOUCHPAD_SWIPE) &&
_gtk_gesture_has_matching_touchpoints (gesture))
g_clear_handle_id (&priv->hold_timeout_id, g_source_remove);
if (_gtk_gesture_update_point (gesture, event, target, x, y, TRUE))
{
gboolean triggered_recognition;
@@ -698,8 +668,7 @@ gtk_gesture_handle_event (GtkEventController *controller,
else if (event_type == GDK_BUTTON_RELEASE ||
event_type == GDK_TOUCH_END ||
(event_type == GDK_TOUCHPAD_SWIPE && phase == GDK_TOUCHPAD_GESTURE_PHASE_END) ||
(event_type == GDK_TOUCHPAD_PINCH && phase == GDK_TOUCHPAD_GESTURE_PHASE_END) ||
(event_type == GDK_TOUCHPAD_HOLD && phase == GDK_TOUCHPAD_GESTURE_PHASE_END))
(event_type == GDK_TOUCHPAD_PINCH && phase == GDK_TOUCHPAD_GESTURE_PHASE_END))
{
gboolean was_claimed = FALSE;
@@ -743,15 +712,6 @@ gtk_gesture_handle_event (GtkEventController *controller,
if (priv->touchpad)
_gtk_gesture_cancel_sequence (gesture, sequence);
}
else if (event_type == GDK_TOUCHPAD_HOLD && phase == GDK_TOUCHPAD_GESTURE_PHASE_CANCEL)
{
if (priv->hold_timeout_id == 0)
{
priv->hold_timeout_id = g_timeout_add (HOLD_TIMEOUT_MS,
gtk_gesture_hold_timeout,
gesture);
}
}
else if (event_type == GDK_GRAB_BROKEN)
{
GdkSurface *surface;
@@ -777,10 +737,6 @@ gtk_gesture_handle_event (GtkEventController *controller,
static void
gtk_gesture_reset (GtkEventController *controller)
{
GtkGesture *gesture = GTK_GESTURE (controller);
GtkGesturePrivate *priv = gtk_gesture_get_instance_private (gesture);
g_clear_handle_id (&priv->hold_timeout_id, g_source_remove);
_gtk_gesture_cancel_all (GTK_GESTURE (controller));
}
@@ -952,7 +908,6 @@ gtk_gesture_init (GtkGesture *gesture)
priv->points = g_hash_table_new_full (NULL, NULL, NULL,
(GDestroyNotify) free_point_data);
priv->group_link = g_list_prepend (NULL, gesture);
priv->hold_timeout_id = 0;
}
/**
+2 -3
View File
@@ -172,9 +172,8 @@ static gboolean
gtk_gesture_rotate_filter_event (GtkEventController *controller,
GdkEvent *event)
{
/* Let 2-finger touchpad pinch and hold events go through */
if (gdk_event_get_event_type (event) == GDK_TOUCHPAD_PINCH ||
gdk_event_get_event_type (event) == GDK_TOUCHPAD_HOLD)
/* Let 2-finger touchpad pinch events go through */
if (gdk_event_get_event_type (event) == GDK_TOUCHPAD_PINCH)
{
guint n_fingers;
-4
View File
@@ -197,10 +197,6 @@ gtk_gesture_single_handle_event (GtkEventController *controller,
}
break;
case GDK_TOUCHPAD_HOLD:
if (gdk_touchpad_event_get_n_fingers (event) == 1)
return FALSE;
G_GNUC_FALLTHROUGH;
case GDK_TOUCH_CANCEL:
case GDK_GRAB_BROKEN:
case GDK_TOUCHPAD_SWIPE:
+2 -3
View File
@@ -84,9 +84,8 @@ static gboolean
gtk_gesture_swipe_filter_event (GtkEventController *controller,
GdkEvent *event)
{
/* Let touchpad swipe and hold events go through, only if they match n-points */
if (gdk_event_get_event_type (event) == GDK_TOUCHPAD_SWIPE ||
gdk_event_get_event_type (event) == GDK_TOUCHPAD_HOLD)
/* Let touchpad swipe events go through, only if they match n-points */
if (gdk_event_get_event_type (event) == GDK_TOUCHPAD_SWIPE)
{
guint n_points;
guint n_fingers;
+2 -3
View File
@@ -149,9 +149,8 @@ static gboolean
gtk_gesture_zoom_filter_event (GtkEventController *controller,
GdkEvent *event)
{
/* Let 2-finger touchpad pinch and hold events go through */
if (gdk_event_get_event_type (event) == GDK_TOUCHPAD_PINCH ||
gdk_event_get_event_type (event) == GDK_TOUCHPAD_HOLD)
/* Let 2-finger touchpad pinch events go through */
if (gdk_event_get_event_type (event) == GDK_TOUCHPAD_PINCH)
{
guint n_fingers;

Some files were not shown because too many files have changed in this diff Show More