Compare commits
218 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9d60d2f788 | |||
| c49a4cca55 | |||
| c73d106200 | |||
| 1503e29f8a | |||
| 120edb93a9 | |||
| 77c9240982 | |||
| 43c9822aa7 | |||
| 64a2c11178 | |||
| 5f2e8e864d | |||
| 388f0fddbd | |||
| 01202d42ee | |||
| 1ea83021a3 | |||
| 2b54632ebf | |||
| ad7746360b | |||
| 885c2d0427 | |||
| 9c823ce5b5 | |||
| a46e7c33b8 | |||
| 31287afcee | |||
| 88ac222ffe | |||
| e00bfd5442 | |||
| ebdabc5e87 | |||
| db9bb17b7d | |||
| e947fe9675 | |||
| efe5668f9a | |||
| d0ae410ca7 | |||
| b3840c6a0d | |||
| 34ed130fab | |||
| bfa2b7ff68 | |||
| 2fb975b22e | |||
| d64f9360c3 | |||
| 2d75485c24 | |||
| 89e2b98ff4 | |||
| 5d158f583c | |||
| 106d35f2f4 | |||
| c09e7fabc8 | |||
| 481ab5cf49 | |||
| ae1eb55271 | |||
| 3eb1ca3ecb | |||
| 4fa318fa19 | |||
| 3090fbac82 | |||
| 56e61fc645 | |||
| f41d98d104 | |||
| b1943e03e6 | |||
| 63583c15db | |||
| 0028267228 | |||
| 9cdc332e8a | |||
| c0fc8f796b | |||
| 5a2f94b7ef | |||
| 59dd0dccbf | |||
| 78d5f16bf7 | |||
| faba065161 | |||
| 19adb3b8b3 | |||
| 4c9c180e27 | |||
| 41a662ad2a | |||
| c12d398fa2 | |||
| ca4bf8b0d1 | |||
| 16c3864e4a | |||
| 1fa97e1808 | |||
| a107ebdc0d | |||
| 161259e9ea | |||
| cc5a7b153d | |||
| 0476b5a34c | |||
| 4b25b43f83 | |||
| 0d94a4fcc8 | |||
| bcf062a578 | |||
| 252ce5a5c7 | |||
| ac7bdabe95 | |||
| d94ebd469e | |||
| de17c618fc | |||
| 1133bff614 | |||
| aa07cb4f64 | |||
| f99b35162c | |||
| 3ae2ebac67 | |||
| 4cf9f6382f | |||
| 9ffb3e5ece | |||
| 72ffe46e74 | |||
| f7b5c886b3 | |||
| 5b186fab1a | |||
| d2c610148e | |||
| 66ef08921d | |||
| 137a62cb94 | |||
| 022b396a06 | |||
| afb9378405 | |||
| abe7407abe | |||
| 1038b94ab1 | |||
| 07381e2b14 | |||
| 965ca1b607 | |||
| e67e51be14 | |||
| eab7c19dfb | |||
| 66804b9b49 | |||
| b48e158ef8 | |||
| 4e42006d41 | |||
| 946914a2d0 | |||
| 9c1bce629d | |||
| d67982d5e0 | |||
| ca02700a63 | |||
| 65b955fe26 | |||
| 4a884ed706 | |||
| 36cb2e932c | |||
| 4f5264d1b7 | |||
| ff2345a8f8 | |||
| 2a4b90a81c | |||
| 6aa6ab85f6 | |||
| c293a243d9 | |||
| 6681bbf8d2 | |||
| 5b2aa196e0 | |||
| 83b3c7d826 | |||
| 4b9260608a | |||
| 7f0d7aff0b | |||
| 3c90385716 | |||
| 2492729238 | |||
| b7988d869d | |||
| d79b52ce55 | |||
| 14f31183b8 | |||
| 5959dcc112 | |||
| dc77823787 | |||
| 4e08ec0ea1 | |||
| cc70eaca93 | |||
| fbf09f6e31 | |||
| c0c18459f5 | |||
| e230579149 | |||
| 2155486ffd | |||
| 73861c1178 | |||
| db82ff6ae2 | |||
| 6fd90929b4 | |||
| a48e978b39 | |||
| 7b967e1f4a | |||
| b245e8c9ef | |||
| 77572104a6 | |||
| 1a70c49acd | |||
| ea63309512 | |||
| df0f886e77 | |||
| 9b7147e085 | |||
| 75e35cf646 | |||
| c08ba636d4 | |||
| f8cd883e0d | |||
| d198754ce8 | |||
| 3a0d4d3d13 | |||
| 9f393f8a33 | |||
| 8b5b02454e | |||
| 6d1233d3a6 | |||
| 21cd0f942e | |||
| 345b06bbbf | |||
| cbd3d5a4aa | |||
| 7f5cbc2234 | |||
| b57e70fdaf | |||
| 75aa1a757b | |||
| 362208523d | |||
| dc7dc6285d | |||
| f2c92f7e8b | |||
| 301e72cb23 | |||
| 4cbfd49456 | |||
| c3cb16126a | |||
| 9cfa472cde | |||
| f4ef0c61a0 | |||
| fe30ac8e6b | |||
| baa4c12322 | |||
| 8ffd7e9f87 | |||
| f433c543fe | |||
| 33e00c9087 | |||
| e507ff96ac | |||
| 4b19e5d58d | |||
| 7a6a1c8f32 | |||
| 1742de2f2d | |||
| 9c8b297223 | |||
| 462115a57e | |||
| bb72acf9cd | |||
| 63d829bbc1 | |||
| 19af960163 | |||
| 0768addbb3 | |||
| edbcd7d36e | |||
| 8ae31322a0 | |||
| 0a5af76932 | |||
| 2dbcad428a | |||
| 817cfcacce | |||
| 5053e9917e | |||
| 4f5d959a94 | |||
| 8407ebe1d8 | |||
| d2efdaba59 | |||
| da12386faf | |||
| 7f9f097c3d | |||
| 71f6ba92ee | |||
| 11c1b97d5c | |||
| d36b27cc3a | |||
| eec783b922 | |||
| edebd48b24 | |||
| ede1348cd8 | |||
| 951844a0f5 | |||
| ddbafa4d1a | |||
| d0d982e2ed | |||
| 6ad047ab79 | |||
| e7479db2ba | |||
| 3799c9d51e | |||
| 4bb230d7d7 | |||
| 33a4ae12ef | |||
| 0c343d3aad | |||
| 6697b738ad | |||
| e441f75ca6 | |||
| 581004aa7d | |||
| e1fbcbb93e | |||
| cd9735eab1 | |||
| 8f5a1471cc | |||
| f9efd103a9 | |||
| 85ad1db8ef | |||
| 6e467de751 | |||
| ae5b6395ad | |||
| dcc899b621 | |||
| 16ad555709 | |||
| f6387a636c | |||
| 9ac48a3b67 | |||
| ba33e80cad | |||
| 6f3535f35f | |||
| 434ffd16ce | |||
| 58fb124afb | |||
| 50c81dfc91 | |||
| 410ea1049b | |||
| 09a5828ccf | |||
| 6377b23bd6 |
+2
-2
@@ -21,11 +21,11 @@ stages:
|
||||
|
||||
# Common variables
|
||||
variables:
|
||||
COMMON_MESON_FLAGS: "-Dwerror=true -Dglib:werror=false -Dpango:werror=false -Dgtk-doc:werror=false -Dwayland-protocols:werror=false -Dsysprof:werror=false"
|
||||
COMMON_MESON_FLAGS: "-Dwerror=false"
|
||||
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:v33"
|
||||
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v34"
|
||||
FLATPAK_IMAGE: "registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master"
|
||||
|
||||
.only-default:
|
||||
|
||||
@@ -1,3 +1,107 @@
|
||||
Overview of Changes in 4.4.2, 15-02-2022
|
||||
========================================
|
||||
|
||||
* GtkEntry:
|
||||
- Update placeholder visibility when needed
|
||||
|
||||
* Work with newer pango
|
||||
|
||||
* Translation updates:
|
||||
German
|
||||
Icelandic
|
||||
Italian
|
||||
Japanese
|
||||
Occitan
|
||||
|
||||
|
||||
Overview of Changes in 4.4.1
|
||||
============================
|
||||
|
||||
* input:
|
||||
- Fix compose data on bigendian systems
|
||||
- Accept long replacement strings for compose sequences
|
||||
|
||||
* a11y:
|
||||
- Fix accessible relations for menu buttons
|
||||
- Fix accessible descriptions in some cases
|
||||
- Simplify atspi context a bit
|
||||
|
||||
* Theme:
|
||||
- Improve styling for toggle buttons in toolbars
|
||||
|
||||
* gsk:
|
||||
- Avoid coordinate overflow with big text selections
|
||||
|
||||
* GtkTextView:
|
||||
- Fix applying css properties such as
|
||||
letterspacing, line decoration, font
|
||||
features, etc
|
||||
- Improve grouping for undo
|
||||
- Invalidate Pango contexts when font settings change
|
||||
- Fix a crash
|
||||
|
||||
* GtkFileChooser:
|
||||
- Fix handling of choices
|
||||
|
||||
* GtkStackSwitcher:
|
||||
- Expand child buttons
|
||||
|
||||
* GtkCalendar:
|
||||
- Fix day names for weeks that start on monday
|
||||
|
||||
* GtkWindow:
|
||||
- Prefer menubars when handling F10
|
||||
|
||||
* GtkFontButton:
|
||||
- Make sure the dialog is on the same display
|
||||
|
||||
* X11:
|
||||
- Fix handling of randr events
|
||||
|
||||
* Windows:
|
||||
- Fix DND coordinates
|
||||
- Fix build
|
||||
|
||||
* macOS:
|
||||
- Fix handling of scale on macOS 12
|
||||
|
||||
* build:
|
||||
- Fix detection of pre-compiled css files
|
||||
|
||||
* Translation updates
|
||||
Basque
|
||||
Brazilian Portuguese
|
||||
Catalan
|
||||
Chinese (China)
|
||||
Croatian
|
||||
Czech
|
||||
Danish
|
||||
Finnish
|
||||
French
|
||||
Galician
|
||||
German
|
||||
Hebrew
|
||||
Hungarian
|
||||
Icelandic
|
||||
Indonesian
|
||||
Kazakh
|
||||
Korean
|
||||
Latvian
|
||||
Lithuanian
|
||||
Persian
|
||||
Polish
|
||||
Portuguese
|
||||
Romanian
|
||||
Russian
|
||||
Serbian
|
||||
Slovak
|
||||
Slovenian
|
||||
Spanish
|
||||
Swedish
|
||||
Turkish
|
||||
Ukrainian
|
||||
|
||||
|
||||
Overview of Changes in 4.4.0
|
||||
============================
|
||||
|
||||
|
||||
@@ -10,10 +10,12 @@ GTK is a multi-platform toolkit for creating graphical user interfaces.
|
||||
Offering a complete set of widgets, GTK is suitable for projects ranging
|
||||
from small one-off projects to complete application suites.
|
||||
|
||||
GTK is free software and part of the GNU Project. However, the
|
||||
licensing terms for GTK, the GNU LGPL, allow it to be used by all
|
||||
developers, including those developing proprietary software, without any
|
||||
license fees or royalties.
|
||||
GTK is a free and open-source software project. However, the licensing terms
|
||||
for GTK, the GNU LGPL, allow it to be used by all developers, including those
|
||||
developing proprietary software, without any license fees or royalties.
|
||||
|
||||
GTK is hosted by the GNOME project (thanks!) and used by a wide variety
|
||||
of applications and projects.
|
||||
|
||||
The official download location
|
||||
|
||||
@@ -151,6 +153,9 @@ Contributing to GTK
|
||||
Please, follow the [contribution guide](./CONTRIBUTING.md) to know how to
|
||||
start contributing to GTK.
|
||||
|
||||
If you want to support GTK financially, please consider donating to
|
||||
the GNOME project, which runs the infrastructure hosting GTK.
|
||||
|
||||
Release notes
|
||||
-------------
|
||||
|
||||
|
||||
@@ -271,6 +271,12 @@ insert_tags_for_attributes (GtkTextBuffer *buffer,
|
||||
|
||||
#if PANGO_VERSION_CHECK(1,49,0)
|
||||
case PANGO_ATTR_TEXT_TRANSFORM:
|
||||
#endif
|
||||
#if PANGO_VERSION_CHECK(1,49,1)
|
||||
case PANGO_ATTR_WORD:
|
||||
case PANGO_ATTR_SENTENCE:
|
||||
case PANGO_ATTR_BASELINE_SHIFT:
|
||||
case PANGO_ATTR_FONT_SCALE:
|
||||
break;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<developer_name>Matthias Clasen and others</developer_name>
|
||||
<content_rating type="oars-1.1"/>
|
||||
<releases>
|
||||
<release version="@BUILD_VERSION@" date="@BUILD_DATE@">
|
||||
<release version="@BUILD_VERSION@">
|
||||
<description>
|
||||
<p>A new build of GTK.</p>
|
||||
</description>
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<developer_name>Matthias Clasen and others</developer_name>
|
||||
<content_rating type="oars-1.1"/>
|
||||
<releases>
|
||||
<release version="@BUILD_VERSION@" date="@BUILD_DATE@">
|
||||
<release version="@BUILD_VERSION@">
|
||||
<description>
|
||||
<p>A new build of GTK.</p>
|
||||
</description>
|
||||
|
||||
@@ -12,19 +12,9 @@ demo_conf_h = declare_dependency(
|
||||
)
|
||||
|
||||
# appdata
|
||||
today = 'unknown'
|
||||
date = find_program('date',
|
||||
required: false)
|
||||
if date.found()
|
||||
r = run_command(date, '-I')
|
||||
if r.returncode() == 0
|
||||
today = r.stdout().strip()
|
||||
endif
|
||||
endif
|
||||
|
||||
appdata_config = configuration_data()
|
||||
appdata_config.set('BUILD_VERSION', meson.project_version())
|
||||
appdata_config.set('BUILD_DATE', today)
|
||||
|
||||
subdir('constraint-editor')
|
||||
subdir('gtk-demo')
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
<developer_name>Matthias Clasen and others</developer_name>
|
||||
<content_rating type="oars-1.1"/>
|
||||
<releases>
|
||||
<release version="@BUILD_VERSION@" date="@BUILD_DATE@">
|
||||
<release version="@BUILD_VERSION@">
|
||||
<description>
|
||||
<p>A new build of GTK.</p>
|
||||
</description>
|
||||
|
||||
@@ -315,7 +315,7 @@ have been added to `GdkDisplay`.
|
||||
|
||||
The root window is an X11-centric concept that is no longer exposed in the
|
||||
backend-neutral GDK API. If you need to interact with the X11 root window,
|
||||
you can use [method@GdkX11.Display.get_xrootwindow] to get its XID.
|
||||
you can use [`method@GdkX11.Display.get_xrootwindow`] to get its XID.
|
||||
|
||||
### Stop using `GdkVisual`
|
||||
|
||||
@@ -333,9 +333,9 @@ had replacements in GTK 3 and were deprecated in favor of `GdkSeat`.
|
||||
|
||||
In GTK 4, the two roles of a standalone toplevel window and of a popup that
|
||||
is placed relative to a parent window have been separated out into two
|
||||
interfaces, [class@Gdk.Toplevel] and [class@Gdk.Popup]. Surfaces
|
||||
implementing these interfaces are created with [ctor@Gdk.Surface.new_toplevel]
|
||||
and [ctor@Gdk.Surface.new_popup], respectively, and they are presented on
|
||||
interfaces, [iface@Gdk.Toplevel] and [iface@Gdk.Popup]. Surfaces
|
||||
implementing these interfaces are created with [`ctor@Gdk.Surface.new_toplevel`]
|
||||
and [`ctor@Gdk.Surface.new_popup`], respectively, and they are presented on
|
||||
screen using [method@Gdk.Toplevel.present] and [method@Gdk.Popup.present].
|
||||
The `present()` functions take parameters in the form of an auxiliary layout
|
||||
struct, [struct@Gdk.PopupLayout] or [struct@Gdk.ToplevelLayout].
|
||||
@@ -362,9 +362,9 @@ windows, you you will have to use Xlib apis.
|
||||
|
||||
A number of minor API cleanups have happened in `GdkSurface`
|
||||
as well. For example, `gdk_surface_input_shape_combine_region()`
|
||||
has been renamed to [method@Gdk.Surface.set_input_region], and
|
||||
has been renamed to [`method@Gdk.Surface.set_input_region`], and
|
||||
`gdk_surface_begin_resize_drag()` has been renamed to
|
||||
[method@Gdk.Toplevel.begin_resize].
|
||||
[`method@Gdk.Toplevel.begin_resize`].
|
||||
|
||||
### The "iconified" window state has been renamed to "minimized"
|
||||
|
||||
@@ -388,7 +388,7 @@ have accessors that you will have to use.
|
||||
|
||||
Event compression is always enabled in GTK 4, for both motion and
|
||||
scroll events. If you need to see the uncoalesced motion or scroll
|
||||
history, use [method@Gdk.Event.get_history] on the latest event.
|
||||
history, use [`method@Gdk.Event.get_history`] on the latest event.
|
||||
|
||||
### Stop using grabs
|
||||
|
||||
@@ -1051,7 +1051,7 @@ Observing widget contents and widget size is now done by using the
|
||||
|
||||
### Monitor handling has changed
|
||||
|
||||
Instead of a monitor number, [class@Gdk.Monitor] is now used throughout.
|
||||
Instead of a monitor number, [class@Gdk.Monitor] is now used throughout.
|
||||
[method@Gdk.Display.get_monitors] returns the list of monitors that can be queried
|
||||
or observed for monitors to pass to APIs like [method@Gtk.Window.fullscreen_on_monitor].
|
||||
|
||||
@@ -1332,6 +1332,18 @@ pointer coordinates as inout arguments any more, but as normal in ones.
|
||||
|
||||
See: [method@Gtk.TreeView.get_tooltip_context], [method@Gtk.IconView.get_tooltip_context]
|
||||
|
||||
### Adapt to GtkPopover changes
|
||||
|
||||
In GTK 3, a `GtkPopover` could be attached to any widget, using the `relative-to`
|
||||
property. This is no longer possible in GTK 4. The parent widget has to be aware
|
||||
of its popover children, and manage their size allocation. Therefore, only widgets
|
||||
with dedicated popover support can have them, such as [class@Gtk.MenuButton] or
|
||||
[class@Gtk.PopoverMenuBar].
|
||||
|
||||
If you want to make a custom widget that has an attached popover, you need to call
|
||||
[method@Gtk.Popover.present] in your [vfunc@Gtk.Widget.size_allocate] vfunc, in order
|
||||
to update the positioning of the popover.
|
||||
|
||||
### Stop using GtkFileChooserButton
|
||||
|
||||
The `GtkFileChooserButton` widget was removed, due to its shortcomings in
|
||||
|
||||
@@ -14,7 +14,7 @@ the question you have, this list is a good place to start.
|
||||
(most of it about GTK 2.x and 3.x, but still somewhat applicable). This
|
||||
reference manual also contains a introductory
|
||||
[Getting Started](#gtk-getting-started) part.
|
||||
|
||||
|
||||
More documentation ranging from whitepapers to online books can be found at
|
||||
the [GNOME developer's site](https://developer.gnome.org). After studying these
|
||||
materials you should be well prepared to come back to this reference manual for details.
|
||||
@@ -93,11 +93,11 @@ the question you have, this list is a good place to start.
|
||||
|
||||
`gi18n.h` provides the following shorthand macros for convenience.
|
||||
Conventionally, people define macros as follows for convenience:
|
||||
|
||||
|
||||
#define _(x) gettext (x)
|
||||
#define N_(x) x
|
||||
#define C_(ctx,x) pgettext (ctx, x)
|
||||
|
||||
|
||||
You use `N_()` (N stands for no-op) to mark a string for translation in
|
||||
a location where a function call to gettext() is not allowed, such as
|
||||
in an array initializer. You eventually have to call gettext() on the
|
||||
@@ -205,14 +205,14 @@ the question you have, this list is a good place to start.
|
||||
Here is an example showing the three approaches using the copyright
|
||||
sign © which has Unicode and ISO-8859-1 codepoint 169 and is represented
|
||||
in UTF-8 by the two bytes 194, 169, or `"\302\251"` as a string literal:
|
||||
|
||||
|
||||
g_print ("direct UTF-8: ©");
|
||||
g_print ("escaped UTF-8: \302\251");
|
||||
text = g_convert ("runtime conversion: ©", -1,
|
||||
"ISO-8859-1", "UTF-8", NULL, NULL, NULL);
|
||||
g_print (text);
|
||||
g_free (text);
|
||||
|
||||
|
||||
If you are using gettext() to localize your application, you need
|
||||
to call bind_textdomain_codeset() to ensure that translated strings
|
||||
are returned in UTF-8 encoding.
|
||||
@@ -432,10 +432,10 @@ the question you have, this list is a good place to start.
|
||||
|
||||
26. How do I associate some data with a row in the tree?
|
||||
|
||||
Remember that the [class@Gtk.TreeModel] columns don't necessarily have to be
|
||||
Remember that the [iface@Gtk.TreeModel] columns don't necessarily have to be
|
||||
displayed. So you can put non-user-visible data in your model just
|
||||
like any other data, and retrieve it with [method@Gtk.TreeModel.get].
|
||||
See the [tree widget overview](#TreeWidget).
|
||||
See the [tree widget overview](#TreeWidget).
|
||||
|
||||
27. How do I put an image and some text in the same column?
|
||||
|
||||
@@ -447,7 +447,7 @@ the question you have, this list is a good place to start.
|
||||
28. I can set data easily on my [class@Gtk.TreeStore] or [class@Gtk.ListStore] models using
|
||||
[method@Gtk.ListStore.set] and [method@Gtk.TreeStore.set], but can't read it back?
|
||||
|
||||
Both the [class@Gtk.TreeStore] and the [class@Gtk.ListStore] implement the [class@Gtk.TreeModel]
|
||||
Both the [class@Gtk.TreeStore] and the [class@Gtk.ListStore] implement the [iface@Gtk.TreeModel]
|
||||
interface. As a consequence, you can use any function this interface
|
||||
implements. The easiest way to read a set of data back is to use
|
||||
[method@Gtk.TreeModel.get].
|
||||
|
||||
@@ -5,6 +5,10 @@ gidocgen = find_program('gi-docgen', required: get_option('gtk_doc'))
|
||||
|
||||
docs_dir = gtk_datadir / 'doc'
|
||||
|
||||
if get_option('gtk_doc') and not build_gir
|
||||
error('API reference requires introspection.')
|
||||
endif
|
||||
|
||||
subdir('gdk')
|
||||
subdir('gsk')
|
||||
subdir('gtk')
|
||||
|
||||
@@ -214,7 +214,7 @@ _gdk_broadway_display_open (const char *display_name)
|
||||
broadway_display->server = _gdk_broadway_server_new (display, display_name, &error);
|
||||
if (broadway_display->server == NULL)
|
||||
{
|
||||
g_printerr ("Unable to init Broadway server: %s\n", error->message);
|
||||
GDK_NOTE (MISC, g_message ("Unable to init Broadway server: %s\n", error->message));
|
||||
g_error_free (error);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ static const GdkDebugKey gdk_debug_keys[] = {
|
||||
{ "gl-wgl", GDK_DEBUG_GL_WGL, "Use WGL on Windows" },
|
||||
{ "vulkan-disable", GDK_DEBUG_VULKAN_DISABLE, "Disable Vulkan support" },
|
||||
{ "vulkan-validate", GDK_DEBUG_VULKAN_VALIDATE, "Load the Vulkan validation layer" },
|
||||
{ "default-settings",GDK_DEBUG_DEFAULT_SETTINGS, "Force default values for xsettings" },
|
||||
{ "default-settings",GDK_DEBUG_DEFAULT_SETTINGS, "Force default values for xsettings", TRUE },
|
||||
};
|
||||
|
||||
|
||||
|
||||
+7
-1
@@ -1253,9 +1253,15 @@ gdk_clipboard_set_content (GdkClipboard *clipboard,
|
||||
* @...: value contents conforming to @type
|
||||
*
|
||||
* Sets the clipboard to contain the value collected from the given varargs.
|
||||
*
|
||||
* Values should be passed the same way they are passed to other value
|
||||
* collecting APIs, such as [`method@GObject.Object.set`] or
|
||||
* [`id@g_signal_emit`].
|
||||
*
|
||||
* ```c
|
||||
* gdk_clipboard_set (clipboard, GTK_TYPE_TEXT_BUFFER, buffer);
|
||||
* gdk_clipboard_set (clipboard, GTK_TYPE_STRING, "Hello World");
|
||||
*
|
||||
* gdk_clipboard_set (clipboard, GDK_TYPE_TEXTURE, some_texture);
|
||||
* ```
|
||||
*/
|
||||
void
|
||||
|
||||
@@ -928,11 +928,13 @@ init (void)
|
||||
if (!g_get_charset (&charset))
|
||||
{
|
||||
char *mime = g_strdup_printf ("text/plain;charset=%s", charset);
|
||||
|
||||
gdk_content_register_deserializer (mime,
|
||||
G_TYPE_STRING,
|
||||
string_deserializer,
|
||||
(gpointer) charset,
|
||||
g_free);
|
||||
g_free (mime);
|
||||
}
|
||||
gdk_content_register_deserializer ("text/plain",
|
||||
G_TYPE_STRING,
|
||||
|
||||
@@ -1233,6 +1233,8 @@ gdk_display_init_gl (GdkDisplay *self)
|
||||
*/
|
||||
priv->gl_context = context;
|
||||
|
||||
gdk_gl_backend_use (GDK_GL_CONTEXT_GET_CLASS (context)->backend_type);
|
||||
|
||||
gdk_profiler_end_mark (before, "initialize OpenGL", NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ struct _GdkDeleteEvent
|
||||
* GdkMotionEvent:
|
||||
* @state: (type GdkModifierType): a bit-mask representing the state of
|
||||
* the modifier keys (e.g. Control, Shift and Alt) set during the motion
|
||||
* event. See [enum@Gdk.ModifierType]
|
||||
* event. See [flags@Gdk.ModifierType]
|
||||
* @x: the x coordinate of the pointer relative to the surface.
|
||||
* @y: the y coordinate of the pointer relative to the surface.
|
||||
* @axes: @x, @y translated to the axes of @device, or %NULL if @device is
|
||||
@@ -132,7 +132,7 @@ struct _GdkMotionEvent
|
||||
* GdkButtonEvent:
|
||||
* @state: (type GdkModifierType): a bit-mask representing the state of
|
||||
* the modifier keys (e.g. Control, Shift and Alt) and the pointer
|
||||
* buttons. See [enum@Gdk.ModifierType]
|
||||
* buttons. See [flags@Gdk.ModifierType]
|
||||
* @button: the button which was pressed or released, numbered from 1 to 5.
|
||||
* Normally button 1 is the left mouse button, 2 is the middle button,
|
||||
* and 3 is the right button. On 2-button mice, the middle button can
|
||||
@@ -162,7 +162,7 @@ struct _GdkButtonEvent
|
||||
* GdkTouchEvent:
|
||||
* @state: (type GdkModifierType): a bit-mask representing the state of
|
||||
* the modifier keys (e.g. Control, Shift and Alt) and the pointer
|
||||
* buttons. See [enum@Gdk.ModifierType]
|
||||
* buttons. See [flags@Gdk.ModifierType]
|
||||
* @x: the x coordinate of the pointer relative to the surface
|
||||
* @y: the y coordinate of the pointer relative to the surface
|
||||
* @axes: @x, @y translated to the axes of the event's device, or %NULL
|
||||
@@ -200,7 +200,7 @@ struct _GdkTouchEvent
|
||||
* @y: the y coordinate of the pointer relative to the surface.
|
||||
* @state: (type GdkModifierType): a bit-mask representing the state of
|
||||
* the modifier keys (e.g. Control, Shift and Alt) and the pointer
|
||||
* buttons. See [enum@Gdk.ModifierType]
|
||||
* buttons. See [flags@Gdk.ModifierType]
|
||||
* @direction: the direction to scroll to (one of %GDK_SCROLL_UP,
|
||||
* %GDK_SCROLL_DOWN, %GDK_SCROLL_LEFT, %GDK_SCROLL_RIGHT or
|
||||
* %GDK_SCROLL_SMOOTH).
|
||||
@@ -256,7 +256,7 @@ typedef struct {
|
||||
* GdkKeyEvent:
|
||||
* @state: (type GdkModifierType): a bit-mask representing the state of
|
||||
* the modifier keys (e.g. Control, Shift and Alt) and the pointer
|
||||
* buttons. See [enum@Gdk.ModifierType]
|
||||
* buttons. See [flags@Gdk.ModifierType]
|
||||
* @keycode: the raw code of the key that was pressed or released.
|
||||
* @translated: the result of translating @keycode. First with the full
|
||||
* @state, then while ignoring Caps Lock.
|
||||
@@ -277,7 +277,7 @@ struct _GdkKeyEvent
|
||||
* GdkCrossingEvent:
|
||||
* @state: (type GdkModifierType): a bit-mask representing the state of
|
||||
* the modifier keys (e.g. Control, Shift and Alt) and the pointer
|
||||
* buttons. See [enum@Gdk.ModifierType]
|
||||
* buttons. See [flags@Gdk.ModifierType]
|
||||
* @mode: the crossing mode (%GDK_CROSSING_NORMAL, %GDK_CROSSING_GRAB,
|
||||
* %GDK_CROSSING_UNGRAB, %GDK_CROSSING_GTK_GRAB, %GDK_CROSSING_GTK_UNGRAB or
|
||||
* %GDK_CROSSING_STATE_CHANGED). %GDK_CROSSING_GTK_GRAB, %GDK_CROSSING_GTK_UNGRAB,
|
||||
@@ -383,7 +383,7 @@ struct _GdkDNDEvent
|
||||
* GdkTouchpadEvent:
|
||||
* @state: (type GdkModifierType): a bit-mask representing the state of
|
||||
* the modifier keys (e.g. Control, Shift and Alt) and the pointer
|
||||
* buttons. See [enum@Gdk.ModifierType]
|
||||
* buttons. See [flags@Gdk.ModifierType]
|
||||
* @phase: (type GdkTouchpadGesturePhase): the current phase of the gesture
|
||||
* @n_fingers: The number of fingers triggering the pinch
|
||||
* @time: the time of the event in milliseconds
|
||||
|
||||
+70
-3
@@ -75,11 +75,13 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "gdkglcontextprivate.h"
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include "gdkmemorytextureprivate.h"
|
||||
#include "gdkinternals.h"
|
||||
|
||||
#include "gdkdebug.h"
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkintl.h"
|
||||
#include "gdkmemorytextureprivate.h"
|
||||
|
||||
#include "gdk-private.h"
|
||||
|
||||
#ifdef GDK_WINDOWING_WIN32
|
||||
@@ -1335,3 +1337,68 @@ gdk_gl_context_use_es_bgra (GdkGLContext *context)
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static GdkGLBackend the_gl_backend_type = GDK_GL_NONE;
|
||||
|
||||
static const char *gl_backend_names[] = {
|
||||
[GDK_GL_NONE] = "No GL (You should never read this)",
|
||||
[GDK_GL_EGL] = "EGL",
|
||||
[GDK_GL_GLX] = "X11 GLX",
|
||||
[GDK_GL_WGL] = "Windows WGL",
|
||||
[GDK_GL_CGL] = "Apple CGL"
|
||||
};
|
||||
|
||||
/*<private>
|
||||
* gdk_gl_backend_can_be_used:
|
||||
* @backend_type: Type of backend to check
|
||||
* @error: Return location for an error
|
||||
*
|
||||
* Checks if this backend type can be used. When multiple displays
|
||||
* are opened that use different GL backends, conflicts can arise,
|
||||
* so this function checks that all displays use compatible GL
|
||||
* backends.
|
||||
*
|
||||
* Returns: %TRUE if the backend can still be used
|
||||
*/
|
||||
gboolean
|
||||
gdk_gl_backend_can_be_used (GdkGLBackend backend_type,
|
||||
GError **error)
|
||||
{
|
||||
if (the_gl_backend_type == GDK_GL_NONE ||
|
||||
the_gl_backend_type == backend_type)
|
||||
return TRUE;
|
||||
|
||||
g_set_error (error, GDK_GL_ERROR, GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
/* translators: This is about OpenGL backend names, like
|
||||
* "Trying to use X11 GLX, but EGL is already in use" */
|
||||
_("Trying to use %s, but %s is already in use"),
|
||||
gl_backend_names[backend_type],
|
||||
gl_backend_names[the_gl_backend_type]);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*<private>
|
||||
* gdk_gl_backend_use:
|
||||
* @backend_type: Type of backend
|
||||
*
|
||||
* Ensures that the backend in use is the given one. If another backend
|
||||
* is already in use, this function will abort the program. It should
|
||||
* have previously checked via gdk_gl_backend_can_be_used().
|
||||
**/
|
||||
void
|
||||
gdk_gl_backend_use (GdkGLBackend backend_type)
|
||||
{
|
||||
/* Check that the context class is properly initializing its backend type */
|
||||
g_assert (backend_type != GDK_GL_NONE);
|
||||
|
||||
if (the_gl_backend_type == GDK_GL_NONE)
|
||||
{
|
||||
the_gl_backend_type = backend_type;
|
||||
/* This is important!!!11eleven
|
||||
* (But really: How do I print a message in 2 categories?) */
|
||||
GDK_NOTE (OPENGL, g_print ("Using OpenGL backend %s\n", gl_backend_names[the_gl_backend_type]));
|
||||
GDK_NOTE (MISC, g_message ("Using Opengl backend %s", gl_backend_names[the_gl_backend_type]));
|
||||
}
|
||||
|
||||
g_assert (the_gl_backend_type == backend_type);
|
||||
}
|
||||
|
||||
@@ -34,6 +34,14 @@ G_BEGIN_DECLS
|
||||
#define GDK_EGL_MIN_VERSION_MAJOR (1)
|
||||
#define GDK_EGL_MIN_VERSION_MINOR (4)
|
||||
|
||||
typedef enum {
|
||||
GDK_GL_NONE = 0,
|
||||
GDK_GL_EGL,
|
||||
GDK_GL_GLX,
|
||||
GDK_GL_WGL,
|
||||
GDK_GL_CGL
|
||||
} GdkGLBackend;
|
||||
|
||||
#define GDK_GL_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_GL_CONTEXT, GdkGLContextClass))
|
||||
#define GDK_IS_GL_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_GL_CONTEXT))
|
||||
#define GDK_GL_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_GL_CONTEXT, GdkGLContextClass))
|
||||
@@ -52,6 +60,8 @@ struct _GdkGLContextClass
|
||||
{
|
||||
GdkDrawContextClass parent_class;
|
||||
|
||||
GdkGLBackend backend_type;
|
||||
|
||||
gboolean (* realize) (GdkGLContext *context,
|
||||
GError **error);
|
||||
|
||||
@@ -86,6 +96,10 @@ typedef struct {
|
||||
guint use_es : 1;
|
||||
} GdkGLContextPaintData;
|
||||
|
||||
gboolean gdk_gl_backend_can_be_used (GdkGLBackend backend_type,
|
||||
GError **error);
|
||||
void gdk_gl_backend_use (GdkGLBackend backend_type);
|
||||
|
||||
GdkGLContext * gdk_gl_context_new_for_surface (GdkSurface *surface);
|
||||
|
||||
void gdk_gl_context_set_is_legacy (GdkGLContext *context,
|
||||
|
||||
+5
-5
@@ -70,17 +70,17 @@ typedef enum {
|
||||
* snapshot at or 0 if none. This is purely a hint. The object must still
|
||||
* be able to render at any size.
|
||||
* @get_intrinsic_aspect_ratio: The preferred aspect ratio for this object
|
||||
* or 0 if none. If both [vfunc@Gdk.PaintableInterface.get_intrinsic_width]
|
||||
* and [vfunc@Gdk.PaintableInterface.get_intrinsic_height] return non-zero
|
||||
* or 0 if none. If both [vfunc@Gdk.Paintable.get_intrinsic_width]
|
||||
* and [vfunc@Gdk.Paintable.get_intrinsic_height] return non-zero
|
||||
* values, this function should return the aspect ratio computed from those.
|
||||
*
|
||||
* The list of functions that can be implemented for the `GdkPaintable`
|
||||
* interface.
|
||||
*
|
||||
* Note that apart from the [vfunc@Gdk.PaintableInterface.snapshot] function,
|
||||
* Note that apart from the [vfunc@Gdk.Paintable.snapshot] function,
|
||||
* no virtual function of this interface is mandatory to implement, though it
|
||||
* is a good idea to implement [vfunc@Gdk.PaintableInterface.get_current_image]
|
||||
* for non-static paintables and [vfunc@Gdk.PaintableInterface.get_flags] if the
|
||||
* is a good idea to implement [vfunc@Gdk.Paintable.get_current_image]
|
||||
* for non-static paintables and [vfunc@Gdk.Paintable.get_flags] if the
|
||||
* image is not dynamic as the default implementation returns no flags and
|
||||
* that will make the implementation likely quite slow.
|
||||
*/
|
||||
|
||||
+3
-3
@@ -59,8 +59,8 @@
|
||||
* It’s a low-level object, used to implement high-level objects
|
||||
* such as [class@Gtk.Window] or [class@Gtk.Dialog] in GTK.
|
||||
*
|
||||
* The surfaces you see in practice are either [class@Gdk.Toplevel] or
|
||||
* [class@Gdk.Popup], and those interfaces provide much of the required
|
||||
* The surfaces you see in practice are either [iface@Gdk.Toplevel] or
|
||||
* [iface@Gdk.Popup], and those interfaces provide much of the required
|
||||
* API to interact with these surfaces. Other, more specialized surface
|
||||
* types exist, but you will rarely interact with them directly.
|
||||
*/
|
||||
@@ -2028,7 +2028,7 @@ gdk_surface_get_root_coords (GdkSurface *surface,
|
||||
*root_y = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
GDK_SURFACE_GET_CLASS (surface)->get_root_coords (surface, x, y, root_x, root_y);
|
||||
}
|
||||
|
||||
|
||||
@@ -641,6 +641,9 @@ static GdkGLContext *
|
||||
gdk_macos_display_init_gl (GdkDisplay *display,
|
||||
GError **error)
|
||||
{
|
||||
if (!gdk_gl_backend_can_be_used (GDK_GL_CGL, error))
|
||||
return FALSE;
|
||||
|
||||
return g_object_new (GDK_TYPE_MACOS_GL_CONTEXT,
|
||||
"display", display,
|
||||
NULL);
|
||||
|
||||
@@ -32,6 +32,8 @@
|
||||
#include "gdkmacoseventsource-private.h"
|
||||
#include "gdkmacosdisplay-private.h"
|
||||
|
||||
#include "gdk-private.h"
|
||||
|
||||
/*
|
||||
* This file implementations integration between the GLib main loop and
|
||||
* the native system of the Core Foundation run loop and Cocoa event
|
||||
|
||||
@@ -514,7 +514,11 @@ gdk_macos_gl_context_class_init (GdkMacosGLContextClass *klass)
|
||||
draw_context_class->surface_resized = gdk_macos_gl_context_surface_resized;
|
||||
|
||||
gl_class->get_damage = gdk_macos_gl_context_get_damage;
|
||||
gl_class->clear_current = gdk_macos_gl_context_clear_current;
|
||||
gl_class->make_current = gdk_macos_gl_context_make_current;
|
||||
gl_class->realize = gdk_macos_gl_context_real_realize;
|
||||
|
||||
gl_class->backend_type = GDK_GL_CGL;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -807,7 +807,7 @@ _gdk_macos_surface_acquire_context (GdkMacosSurface *self,
|
||||
scale = CGSizeMake (1.0, 1.0);
|
||||
scale = CGContextConvertSizeToDeviceSpace (cg_context, scale);
|
||||
|
||||
CGContextScaleCTM (cg_context, 1.0 / scale.width, 1.0 / scale.height);
|
||||
CGContextScaleCTM (cg_context, 1.0 / fabs (scale.width), 1.0 / fabs (scale.height));
|
||||
}
|
||||
|
||||
return cg_context;
|
||||
|
||||
@@ -2117,7 +2117,7 @@ gdk_wayland_display_get_setting (GdkDisplay *display,
|
||||
{
|
||||
TranslationEntry *entry;
|
||||
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (display, DEFAULT_SETTINGS))
|
||||
if (gdk_display_get_debug_flags (display) & GDK_DEBUG_DEFAULT_SETTINGS)
|
||||
return FALSE;
|
||||
|
||||
if (GDK_WAYLAND_DISPLAY (display)->settings != NULL &&
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "gdkprivate-wayland.h"
|
||||
|
||||
#include "gdkinternals.h"
|
||||
#include "gdk-private.h"
|
||||
#include "gdksurfaceprivate.h"
|
||||
#include "gdkprofilerprivate.h"
|
||||
|
||||
@@ -357,6 +358,8 @@ gdk_wayland_gl_context_class_init (GdkWaylandGLContextClass *klass)
|
||||
context_class->make_current = gdk_wayland_gl_context_make_current;
|
||||
context_class->clear_current = gdk_wayland_gl_context_clear_current;
|
||||
context_class->get_damage = gdk_wayland_gl_context_get_damage;
|
||||
|
||||
context_class->backend_type = GDK_GL_EGL;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -474,14 +477,31 @@ gdk_wayland_display_init_gl (GdkDisplay *display,
|
||||
G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
|
||||
G_GNUC_UNUSED gint64 start_time2;
|
||||
|
||||
if (!gdk_gl_backend_can_be_used (GDK_GL_EGL, error))
|
||||
return FALSE;
|
||||
|
||||
if (!epoxy_has_egl ())
|
||||
{
|
||||
gboolean sandboxed = gdk_running_in_sandbox ();
|
||||
|
||||
g_set_error_literal (error, GDK_GL_ERROR,
|
||||
GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
sandboxed ? _("libEGL not available in this sandbox")
|
||||
: _("libEGL not available"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
start_time2 = GDK_PROFILER_CURRENT_TIME;
|
||||
dpy = get_egl_display (display_wayland);
|
||||
gdk_profiler_end_mark (start_time, "get_egl_display", NULL);
|
||||
if (dpy == NULL)
|
||||
{
|
||||
gboolean sandboxed = gdk_running_in_sandbox ();
|
||||
|
||||
g_set_error_literal (error, GDK_GL_ERROR,
|
||||
GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
_("Failed to create EGL display"));
|
||||
sandboxed ? _("Sandbox does not provide an OpenGL implementation")
|
||||
: _("No OpenGL implementation available"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -3009,6 +3009,7 @@ gdk_wayland_surface_hide_surface (GdkSurface *surface)
|
||||
|
||||
impl->has_uncommitted_ack_configure = FALSE;
|
||||
impl->input_region_dirty = TRUE;
|
||||
impl->opaque_region_dirty = TRUE;
|
||||
|
||||
unset_transient_for_exported (surface);
|
||||
|
||||
|
||||
@@ -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 = join_paths(wlproto_dir, '@0@/@1@/@2@.xml'.format(proto_stability, proto_name, output_base))
|
||||
input = files(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))
|
||||
|
||||
@@ -100,15 +100,6 @@ gdk_device_win32_query_state (GdkDevice *device,
|
||||
if (win_y)
|
||||
*win_y = point.y / scale;
|
||||
|
||||
if (window)
|
||||
{
|
||||
if (win_x)
|
||||
*win_x += _gdk_offset_x;
|
||||
|
||||
if (win_y)
|
||||
*win_y += _gdk_offset_y;
|
||||
}
|
||||
|
||||
if (hwnd && child_window)
|
||||
{
|
||||
hwndc = ChildWindowFromPoint (hwnd, point);
|
||||
|
||||
@@ -91,15 +91,6 @@ gdk_device_winpointer_query_state (GdkDevice *device,
|
||||
if (win_y)
|
||||
*win_y = point.y / scale;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
if (win_x)
|
||||
*win_x += _gdk_offset_x;
|
||||
|
||||
if (win_y)
|
||||
*win_y += _gdk_offset_y;
|
||||
}
|
||||
|
||||
if (hwnd && child_window)
|
||||
{
|
||||
hwndc = ChildWindowFromPoint (hwnd, point);
|
||||
|
||||
@@ -99,15 +99,6 @@ gdk_device_wintab_query_state (GdkDevice *device,
|
||||
if (win_y)
|
||||
*win_y = point.y / scale;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
if (win_x)
|
||||
*win_x += _gdk_offset_x;
|
||||
|
||||
if (win_y)
|
||||
*win_y += _gdk_offset_y;
|
||||
}
|
||||
|
||||
if (hwnd && child_window)
|
||||
{
|
||||
hwndc = ChildWindowFromPoint (hwnd, point);
|
||||
|
||||
@@ -1150,6 +1150,8 @@ static gboolean
|
||||
gdk_win32_display_init_gl_backend (GdkDisplay *display,
|
||||
GError **error)
|
||||
{
|
||||
gboolean result = FALSE;
|
||||
|
||||
#ifdef GDK_WIN32_ENABLE_EGL
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (display, GL_EGL))
|
||||
return gdk_win32_display_init_egl (display, error);
|
||||
@@ -1161,17 +1163,17 @@ gdk_win32_display_init_gl_backend (GdkDisplay *display,
|
||||
* as WGL is the more tried-and-tested configuration.
|
||||
*/
|
||||
|
||||
if (gdk_win32_display_init_wgl (display, error))
|
||||
return TRUE;
|
||||
g_clear_error (error);
|
||||
result = gdk_win32_display_init_wgl (display, error);
|
||||
|
||||
#ifdef GDK_WIN32_ENABLE_EGL
|
||||
if (gdk_win32_display_init_egl (display, error))
|
||||
return TRUE;
|
||||
if (!result)
|
||||
{
|
||||
g_clear_error (error);
|
||||
result = gdk_win32_display_init_egl (display, error);
|
||||
}
|
||||
#endif
|
||||
g_clear_error (error);
|
||||
|
||||
return gdk_win32_display_init_wgl (display, error);
|
||||
return result;
|
||||
}
|
||||
|
||||
static GdkGLContext *
|
||||
|
||||
@@ -2081,8 +2081,8 @@ gdk_dnd_handle_motion_event (GdkDrag *drag,
|
||||
API_CALL (PostThreadMessage, (clipdrop->dnd_thread_id,
|
||||
WM_MOUSEMOVE,
|
||||
key_state,
|
||||
MAKELPARAM (x * drag_win32->scale,
|
||||
y * drag_win32->scale)));
|
||||
MAKELPARAM (x_root * drag_win32->scale,
|
||||
y_root * drag_win32->scale)));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
+50
-11
@@ -426,6 +426,26 @@ set_source_actions_helper (GdkDrop *drop,
|
||||
return actions;
|
||||
}
|
||||
|
||||
/* Utility function to translate screen coordinates to surface-relative
|
||||
* coordinates. This routine only works with pixel values that aren't
|
||||
* scaled by any GDK DPI scale factor.
|
||||
*/
|
||||
static void
|
||||
unscaled_screen_to_client (GdkSurface* surface,
|
||||
double screen_x,
|
||||
double screen_y,
|
||||
double *client_x,
|
||||
double *client_y)
|
||||
{
|
||||
POINT client_origin;
|
||||
|
||||
client_origin.x = 0;
|
||||
client_origin.y = 0;
|
||||
ClientToScreen (GDK_SURFACE_HWND (surface), &client_origin);
|
||||
*client_x = screen_x - client_origin.x;
|
||||
*client_y = screen_y - client_origin.y;
|
||||
}
|
||||
|
||||
/* The pdwEffect here initially points
|
||||
* to a DWORD that contains the value of dwOKEffects argument in DoDragDrop,
|
||||
* i.e. the drag action that the drag source deems acceptable.
|
||||
@@ -446,6 +466,8 @@ idroptarget_dragenter (LPDROPTARGET This,
|
||||
GdkDisplay *display;
|
||||
int pt_x;
|
||||
int pt_y;
|
||||
double x = 0.0;
|
||||
double y = 0.0;
|
||||
GdkDrag *drag;
|
||||
GdkDragAction source_actions;
|
||||
GdkDragAction dest_actions;
|
||||
@@ -488,9 +510,14 @@ idroptarget_dragenter (LPDROPTARGET This,
|
||||
grfKeyState);
|
||||
|
||||
set_data_object (&ctx->data_object, pDataObj);
|
||||
pt_x = pt.x / drop_win32->scale + _gdk_offset_x;
|
||||
pt_y = pt.y / drop_win32->scale + _gdk_offset_y;
|
||||
gdk_drop_emit_enter_event (drop, TRUE, pt_x, pt_y, GDK_CURRENT_TIME);
|
||||
pt_x = pt.x / drop_win32->scale;
|
||||
pt_y = pt.y / drop_win32->scale;
|
||||
|
||||
unscaled_screen_to_client (ctx->surface, pt.x, pt.y, &x, &y);
|
||||
x /= drop_win32->scale;
|
||||
y /= drop_win32->scale;
|
||||
|
||||
gdk_drop_emit_enter_event (drop, TRUE, x, y, GDK_CURRENT_TIME);
|
||||
drop_win32->last_key_state = grfKeyState;
|
||||
drop_win32->last_x = pt_x;
|
||||
drop_win32->last_y = pt_y;
|
||||
@@ -523,8 +550,8 @@ idroptarget_dragover (LPDROPTARGET This,
|
||||
{
|
||||
drop_target_context *ctx = (drop_target_context *) This;
|
||||
GdkWin32Drop *drop_win32 = GDK_WIN32_DROP (ctx->drop);
|
||||
int pt_x = pt.x / drop_win32->scale + _gdk_offset_x;
|
||||
int pt_y = pt.y / drop_win32->scale + _gdk_offset_y;
|
||||
int pt_x = pt.x / drop_win32->scale;
|
||||
int pt_y = pt.y / drop_win32->scale;
|
||||
GdkDragAction source_actions;
|
||||
GdkDragAction dest_actions;
|
||||
|
||||
@@ -545,7 +572,14 @@ idroptarget_dragover (LPDROPTARGET This,
|
||||
pt_y != drop_win32->last_y ||
|
||||
grfKeyState != drop_win32->last_key_state)
|
||||
{
|
||||
gdk_drop_emit_motion_event (ctx->drop, TRUE, pt_x, pt_y, GDK_CURRENT_TIME);
|
||||
double x = 0.0;
|
||||
double y = 0.0;
|
||||
|
||||
unscaled_screen_to_client (ctx->surface, pt.x, pt.y, &x, &y);
|
||||
x /= drop_win32->scale;
|
||||
y /= drop_win32->scale;
|
||||
|
||||
gdk_drop_emit_motion_event (ctx->drop, TRUE, x, y, GDK_CURRENT_TIME);
|
||||
drop_win32->last_key_state = grfKeyState;
|
||||
drop_win32->last_x = pt_x;
|
||||
drop_win32->last_y = pt_y;
|
||||
@@ -586,8 +620,8 @@ idroptarget_drop (LPDROPTARGET This,
|
||||
{
|
||||
drop_target_context *ctx = (drop_target_context *) This;
|
||||
GdkWin32Drop *drop_win32 = GDK_WIN32_DROP (ctx->drop);
|
||||
int pt_x = pt.x / drop_win32->scale + _gdk_offset_x;
|
||||
int pt_y = pt.y / drop_win32->scale + _gdk_offset_y;
|
||||
double x = 0.0;
|
||||
double y = 0.0;
|
||||
GdkDragAction dest_action;
|
||||
|
||||
GDK_NOTE (DND, g_print ("idroptarget_drop %p ", This));
|
||||
@@ -607,7 +641,12 @@ idroptarget_drop (LPDROPTARGET This,
|
||||
grfKeyState);
|
||||
|
||||
drop_win32->drop_finished = FALSE;
|
||||
gdk_drop_emit_drop_event (ctx->drop, TRUE, pt_x, pt_y, GDK_CURRENT_TIME);
|
||||
|
||||
unscaled_screen_to_client (ctx->surface, pt.x, pt.y, &x, &y);
|
||||
x /= drop_win32->scale;
|
||||
y /= drop_win32->scale;
|
||||
|
||||
gdk_drop_emit_drop_event (ctx->drop, TRUE, x, y, GDK_CURRENT_TIME);
|
||||
|
||||
while (!drop_win32->drop_finished)
|
||||
g_main_context_iteration (NULL, FALSE);
|
||||
@@ -889,8 +928,8 @@ gdk_dropfiles_filter (GdkWin32Display *display,
|
||||
|
||||
gdk_drop_emit_drop_event (drop,
|
||||
FALSE,
|
||||
pt.x / drop_win32->scale + _gdk_offset_x,
|
||||
pt.y / drop_win32->scale + _gdk_offset_y,
|
||||
pt.x / drop_win32->scale,
|
||||
pt.y / drop_win32->scale,
|
||||
_gdk_win32_get_next_tick (msg->time));
|
||||
|
||||
DragFinish (hdrop);
|
||||
|
||||
@@ -1290,13 +1290,12 @@ make_crossing_event (GdkDevice *physical_device,
|
||||
}
|
||||
|
||||
/* Acquires actual client area size of the underlying native window.
|
||||
* Rectangle is in GDK screen coordinates (_gdk_offset_* is added).
|
||||
* Returns FALSE if configure events should be inhibited,
|
||||
* TRUE otherwise.
|
||||
*/
|
||||
gboolean
|
||||
_gdk_win32_get_window_rect (GdkSurface *window,
|
||||
RECT *rect)
|
||||
RECT *rect)
|
||||
{
|
||||
RECT client_rect;
|
||||
POINT point;
|
||||
@@ -1311,11 +1310,7 @@ _gdk_win32_get_window_rect (GdkSurface *window,
|
||||
|
||||
/* top level windows need screen coords */
|
||||
if (GDK_IS_TOPLEVEL (window))
|
||||
{
|
||||
ClientToScreen (hwnd, &point);
|
||||
point.x += _gdk_offset_x * impl->surface_scale;
|
||||
point.y += _gdk_offset_y * impl->surface_scale;
|
||||
}
|
||||
ClientToScreen (hwnd, &point);
|
||||
|
||||
rect->left = point.x;
|
||||
rect->top = point.y;
|
||||
@@ -2409,15 +2404,15 @@ gdk_event_translate (MSG *msg,
|
||||
impl = GDK_WIN32_SURFACE (window);
|
||||
|
||||
/* If we haven't moved, don't create any GDK event. Windows
|
||||
* sends WM_MOUSEMOVE messages after a new window is shows under
|
||||
* sends WM_MOUSEMOVE messages after a new window is shown under
|
||||
* the mouse, even if the mouse hasn't moved. This disturbs gtk.
|
||||
*/
|
||||
if ((msg->pt.x + _gdk_offset_x) / impl->surface_scale == current_root_x &&
|
||||
(msg->pt.y + _gdk_offset_y) / impl->surface_scale == current_root_y)
|
||||
break;
|
||||
if (msg->pt.x / impl->surface_scale == current_root_x &&
|
||||
msg->pt.y / impl->surface_scale == current_root_y)
|
||||
break;
|
||||
|
||||
current_root_x = (msg->pt.x + _gdk_offset_x) / impl->surface_scale;
|
||||
current_root_y = (msg->pt.y + _gdk_offset_y) / impl->surface_scale;
|
||||
current_root_x = msg->pt.x / impl->surface_scale;
|
||||
current_root_y = msg->pt.y / impl->surface_scale;
|
||||
|
||||
if (impl->drag_move_resize_context.op != GDK_WIN32_DRAGOP_NONE)
|
||||
gdk_win32_surface_do_move_resize_drag (window, current_root_x, current_root_y);
|
||||
|
||||
@@ -256,6 +256,9 @@ gdk_win32_display_init_egl (GdkDisplay *display,
|
||||
int best_idx = 0;
|
||||
EGLDisplay egl_disp;
|
||||
|
||||
if (!gdk_gl_backend_can_be_used (GDK_GL_EGL, error))
|
||||
return FALSE;
|
||||
|
||||
if (display_win32->egl_disp != EGL_NO_DISPLAY)
|
||||
return TRUE;
|
||||
|
||||
@@ -488,6 +491,8 @@ gdk_win32_gl_context_egl_class_init (GdkWin32GLContextClass *klass)
|
||||
GdkDrawContextClass *draw_context_class = GDK_DRAW_CONTEXT_CLASS(klass);
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
context_class->backend_type = GDK_GL_EGL;
|
||||
|
||||
context_class->realize = gdk_win32_gl_context_egl_realize;
|
||||
context_class->make_current = gdk_win32_gl_context_egl_make_current;
|
||||
context_class->clear_current = gdk_win32_gl_context_egl_clear_current;
|
||||
|
||||
@@ -265,6 +265,9 @@ gdk_win32_display_init_wgl (GdkDisplay *display,
|
||||
GdkWin32Display *display_win32 = GDK_WIN32_DISPLAY (display);
|
||||
HDC hdc;
|
||||
|
||||
if (!gdk_gl_backend_can_be_used (GDK_GL_WGL, error))
|
||||
return FALSE;
|
||||
|
||||
if (display_win32->wgl_pixel_format != 0)
|
||||
return TRUE;
|
||||
|
||||
@@ -288,7 +291,6 @@ gdk_win32_display_init_wgl (GdkDisplay *display,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
display_win32->wgl_pixel_format = best_idx;
|
||||
display_win32->gl_version = epoxy_gl_version ();
|
||||
|
||||
/* We must have OpenGL/WGL 2.0 or later, or have the GL_ARB_shader_objects extension */
|
||||
@@ -307,6 +309,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 =
|
||||
@@ -697,6 +701,8 @@ gdk_win32_gl_context_wgl_class_init (GdkWin32GLContextWGLClass *klass)
|
||||
GdkDrawContextClass *draw_context_class = GDK_DRAW_CONTEXT_CLASS (klass);
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
context_class->backend_type = GDK_GL_WGL;
|
||||
|
||||
context_class->realize = gdk_win32_gl_context_wgl_realize;
|
||||
context_class->make_current = gdk_win32_gl_context_wgl_make_current;
|
||||
context_class->clear_current = gdk_win32_gl_context_wgl_clear_current;
|
||||
|
||||
@@ -30,8 +30,6 @@
|
||||
GdkDisplay *_gdk_display = NULL;
|
||||
GdkDeviceManagerWin32 *_gdk_device_manager = NULL;
|
||||
|
||||
int _gdk_offset_x, _gdk_offset_y;
|
||||
|
||||
HDC _gdk_display_hdc;
|
||||
HINSTANCE _gdk_dll_hinstance;
|
||||
HINSTANCE _gdk_app_hmodule;
|
||||
|
||||
@@ -563,7 +563,7 @@ enum_monitor (HMONITOR hmonitor,
|
||||
GdkWin32Monitor *w32mon;
|
||||
GdkMonitor *mon;
|
||||
GdkRectangle rect;
|
||||
guint scale;
|
||||
int scale;
|
||||
|
||||
memset (&dd_monitor, 0, sizeof (dd_monitor));
|
||||
dd_monitor.cb = sizeof (dd_monitor);
|
||||
@@ -673,9 +673,6 @@ enum_monitor (HMONITOR hmonitor,
|
||||
HMONITOR hmonitor;
|
||||
POINT pt;
|
||||
|
||||
/* Not subtracting _gdk_offset_x and _gdk_offset_y because they will only
|
||||
* be added later on, in _gdk_win32_display_get_monitor_list().
|
||||
*/
|
||||
pt.x = w32mon->work_rect.x + w32mon->work_rect.width / 2;
|
||||
pt.y = w32mon->work_rect.y + w32mon->work_rect.height / 2;
|
||||
hmonitor = MonitorFromPoint (pt, MONITOR_DEFAULTTONEAREST);
|
||||
@@ -772,45 +769,6 @@ _gdk_win32_display_get_monitor_list (GdkWin32Display *win32_display)
|
||||
prune_monitors (&data);
|
||||
}
|
||||
|
||||
_gdk_offset_x = G_MININT;
|
||||
_gdk_offset_y = G_MININT;
|
||||
|
||||
for (i = 0; i < data.monitors->len; i++)
|
||||
{
|
||||
GdkWin32Monitor *m;
|
||||
GdkRectangle rect;
|
||||
|
||||
m = g_ptr_array_index (data.monitors, i);
|
||||
|
||||
/* Calculate offset */
|
||||
gdk_monitor_get_geometry (GDK_MONITOR (m), &rect);
|
||||
_gdk_offset_x = MAX (_gdk_offset_x, -rect.x);
|
||||
_gdk_offset_y = MAX (_gdk_offset_y, -rect.y);
|
||||
}
|
||||
|
||||
GDK_NOTE (MISC, g_print ("Multi-monitor offset: (%d,%d)\n",
|
||||
_gdk_offset_x, _gdk_offset_y));
|
||||
|
||||
/* Translate monitor coords into GDK coordinate space */
|
||||
for (i = 0; i < data.monitors->len; i++)
|
||||
{
|
||||
GdkWin32Monitor *m;
|
||||
GdkRectangle rect;
|
||||
|
||||
m = g_ptr_array_index (data.monitors, i);
|
||||
|
||||
gdk_monitor_get_geometry (GDK_MONITOR (m), &rect);
|
||||
rect.x += _gdk_offset_x;
|
||||
rect.y += _gdk_offset_y;
|
||||
gdk_monitor_set_geometry (GDK_MONITOR (m), &rect);
|
||||
|
||||
m->work_rect.x += _gdk_offset_x;
|
||||
m->work_rect.y += _gdk_offset_y;
|
||||
|
||||
GDK_NOTE (MISC, g_print ("Monitor %d: %dx%d@%+d%+d\n", i,
|
||||
rect.width, rect.height, rect.x, rect.y));
|
||||
}
|
||||
|
||||
return data.monitors;
|
||||
}
|
||||
|
||||
|
||||
@@ -259,13 +259,6 @@ extern GdkDisplay *_gdk_display;
|
||||
|
||||
extern GdkDeviceManagerWin32 *_gdk_device_manager;
|
||||
|
||||
/* Offsets to add to Windows coordinates (which are relative to the
|
||||
* primary monitor's origin, and thus might be negative for monitors
|
||||
* to the left and/or above the primary monitor) to get GDK
|
||||
* coordinates, which should be non-negative on the whole screen.
|
||||
*/
|
||||
extern int _gdk_offset_x, _gdk_offset_y;
|
||||
|
||||
extern HDC _gdk_display_hdc;
|
||||
extern HINSTANCE _gdk_dll_hinstance;
|
||||
extern HINSTANCE _gdk_app_hmodule;
|
||||
|
||||
@@ -472,7 +472,6 @@ _gdk_win32_display_create_surface (GdkDisplay *display,
|
||||
wchar_t *wtitle;
|
||||
int window_width, window_height;
|
||||
int window_x, window_y;
|
||||
int offset_x = 0, offset_y = 0;
|
||||
int real_x = 0, real_y = 0;
|
||||
GdkFrameClock *frame_clock;
|
||||
|
||||
@@ -527,8 +526,6 @@ _gdk_win32_display_create_surface (GdkDisplay *display,
|
||||
dwExStyle = 0;
|
||||
owner = NULL;
|
||||
|
||||
offset_x = _gdk_offset_x;
|
||||
offset_y = _gdk_offset_y;
|
||||
/* MSDN: We need WS_CLIPCHILDREN and WS_CLIPSIBLINGS for GL Context Creation */
|
||||
dwStyle = WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
|
||||
|
||||
@@ -560,8 +557,8 @@ _gdk_win32_display_create_surface (GdkDisplay *display,
|
||||
|
||||
AdjustWindowRectEx (&rect, dwStyle, FALSE, dwExStyle);
|
||||
|
||||
real_x = (x - offset_x) * impl->surface_scale;
|
||||
real_y = (y - offset_y) * impl->surface_scale;
|
||||
real_x = x * impl->surface_scale;
|
||||
real_y = y * impl->surface_scale;
|
||||
|
||||
if (surface_type == GDK_SURFACE_TOPLEVEL)
|
||||
{
|
||||
@@ -583,12 +580,6 @@ _gdk_win32_display_create_surface (GdkDisplay *display,
|
||||
if (!title || !*title)
|
||||
title = "";
|
||||
|
||||
/* WS_EX_TRANSPARENT means "try draw this window last, and ignore input".
|
||||
* It's the last part we're after. We don't want DND indicator to accept
|
||||
* input, because that will make it a potential drop target, and if it's
|
||||
* under the mouse cursor, this will kill any DND.
|
||||
*/
|
||||
|
||||
klass = RegisterGdkClass (surface_type);
|
||||
|
||||
wtitle = g_utf8_to_utf16 (title, -1, NULL, NULL, NULL);
|
||||
@@ -632,8 +623,8 @@ _gdk_win32_display_create_surface (GdkDisplay *display,
|
||||
GDK_NOTE (MISC, g_print ("... \"%s\" %dx%d@%+d%+d %p = %p\n",
|
||||
title,
|
||||
window_width, window_height,
|
||||
surface->x - offset_x,
|
||||
surface->y - offset_y,
|
||||
surface->x,
|
||||
surface->y,
|
||||
owner,
|
||||
hwndNew));
|
||||
|
||||
@@ -651,6 +642,7 @@ _gdk_win32_display_create_surface (GdkDisplay *display,
|
||||
|
||||
_gdk_win32_surface_enable_transparency (surface);
|
||||
_gdk_win32_surface_register_dnd (surface);
|
||||
_gdk_win32_surface_update_style_bits (surface);
|
||||
|
||||
g_signal_connect (frame_clock,
|
||||
"after-paint",
|
||||
@@ -868,8 +860,8 @@ show_window_internal (GdkSurface *window,
|
||||
{
|
||||
GdkSurface *owner = surface->transient_owner;
|
||||
/* Center on transient parent */
|
||||
center_on_rect.left = (owner->x - _gdk_offset_x) * surface->surface_scale;
|
||||
center_on_rect.top = (owner->y - _gdk_offset_y) * surface->surface_scale;
|
||||
center_on_rect.left = owner->x * surface->surface_scale;
|
||||
center_on_rect.top = owner->y * surface->surface_scale;
|
||||
center_on_rect.right = center_on_rect.left + owner->width * surface->surface_scale;
|
||||
center_on_rect.bottom = center_on_rect.top + owner->height * surface->surface_scale;
|
||||
|
||||
@@ -1051,13 +1043,13 @@ gdk_win32_surface_do_move (GdkSurface *window,
|
||||
GDK_NOTE (MISC, g_print ("... SetWindowPos(%p,NULL,%d,%d,0,0,"
|
||||
"NOACTIVATE|NOSIZE|NOZORDER)\n",
|
||||
GDK_SURFACE_HWND (window),
|
||||
(x - _gdk_offset_x) * impl->surface_scale,
|
||||
(y - _gdk_offset_y) * impl->surface_scale));
|
||||
x * impl->surface_scale,
|
||||
y * impl->surface_scale));
|
||||
|
||||
API_CALL (SetWindowPos, (GDK_SURFACE_HWND (window),
|
||||
SWP_NOZORDER_SPECIFIED,
|
||||
(x - _gdk_offset_x) * impl->surface_scale,
|
||||
(y - _gdk_offset_y) * impl->surface_scale,
|
||||
x * impl->surface_scale,
|
||||
y * impl->surface_scale,
|
||||
0, 0,
|
||||
SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER));
|
||||
}
|
||||
@@ -1137,15 +1129,15 @@ gdk_win32_surface_do_move_resize (GdkSurface *window,
|
||||
GDK_NOTE (MISC, g_print ("... SetWindowPos(%p,NULL,%d,%d,%ld,%ld,"
|
||||
"NOACTIVATE|NOZORDER)\n",
|
||||
GDK_SURFACE_HWND (window),
|
||||
(x - _gdk_offset_x) * impl->surface_scale,
|
||||
(y - _gdk_offset_y) * impl->surface_scale,
|
||||
x * impl->surface_scale,
|
||||
y * impl->surface_scale,
|
||||
outer_rect.right - outer_rect.left,
|
||||
outer_rect.bottom - outer_rect.top));
|
||||
|
||||
API_CALL (SetWindowPos, (GDK_SURFACE_HWND (window),
|
||||
SWP_NOZORDER_SPECIFIED,
|
||||
(x - _gdk_offset_x) * impl->surface_scale,
|
||||
(y - _gdk_offset_y) * impl->surface_scale,
|
||||
x * impl->surface_scale,
|
||||
y * impl->surface_scale,
|
||||
outer_rect.right - outer_rect.left,
|
||||
outer_rect.bottom - outer_rect.top,
|
||||
SWP_NOACTIVATE | SWP_NOZORDER));
|
||||
@@ -1688,14 +1680,6 @@ gdk_win32_surface_get_geometry (GdkSurface *window,
|
||||
|
||||
rect.right = pt.x;
|
||||
rect.bottom = pt.y;
|
||||
|
||||
if (parent == NULL)
|
||||
{
|
||||
rect.left += _gdk_offset_x * impl->surface_scale;
|
||||
rect.top += _gdk_offset_y * impl->surface_scale;
|
||||
rect.right += _gdk_offset_x * impl->surface_scale;
|
||||
rect.bottom += _gdk_offset_y * impl->surface_scale;
|
||||
}
|
||||
}
|
||||
|
||||
if (x)
|
||||
@@ -1734,16 +1718,16 @@ gdk_win32_surface_get_root_coords (GdkSurface *window,
|
||||
ty = pt.y;
|
||||
|
||||
if (root_x)
|
||||
*root_x = (tx + _gdk_offset_x) / impl->surface_scale;
|
||||
*root_x = tx / impl->surface_scale;
|
||||
if (root_y)
|
||||
*root_y = (ty + _gdk_offset_y) / impl->surface_scale;
|
||||
*root_y = ty / impl->surface_scale;
|
||||
|
||||
GDK_NOTE (MISC, g_print ("gdk_win32_surface_get_root_coords: %p: %+d%+d %+d%+d\n",
|
||||
GDK_SURFACE_HWND (window),
|
||||
x * impl->surface_scale,
|
||||
y * impl->surface_scale,
|
||||
(tx + _gdk_offset_x) / impl->surface_scale,
|
||||
(ty + _gdk_offset_y) / impl->surface_scale));
|
||||
tx / impl->surface_scale,
|
||||
ty / impl->surface_scale));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -1841,6 +1825,8 @@ _gdk_win32_surface_update_style_bits (GdkSurface *window)
|
||||
RECT rect, before, after;
|
||||
gboolean was_topmost;
|
||||
gboolean will_be_topmost;
|
||||
gboolean was_layered;
|
||||
gboolean will_be_layered;
|
||||
HWND insert_after;
|
||||
UINT flags;
|
||||
|
||||
@@ -1855,7 +1841,9 @@ _gdk_win32_surface_update_style_bits (GdkSurface *window)
|
||||
AdjustWindowRectEx (&before, old_style, FALSE, old_exstyle);
|
||||
|
||||
was_topmost = (old_exstyle & WS_EX_TOPMOST) ? TRUE : FALSE;
|
||||
was_layered = (old_exstyle & WS_EX_LAYERED) ? TRUE : FALSE;
|
||||
will_be_topmost = was_topmost;
|
||||
will_be_layered = was_layered;
|
||||
|
||||
old_exstyle &= ~WS_EX_TOPMOST;
|
||||
|
||||
@@ -1865,7 +1853,14 @@ _gdk_win32_surface_update_style_bits (GdkSurface *window)
|
||||
if (GDK_IS_DRAG_SURFACE (window))
|
||||
{
|
||||
new_exstyle |= WS_EX_TOOLWINDOW;
|
||||
|
||||
/* WS_EX_LAYERED | WS_EX_TRANSPARENT makes the drag surface behave
|
||||
* in pointer input passthrough mode, so it doesn't interfere with
|
||||
* the drag and drop operation.
|
||||
*/
|
||||
new_exstyle |= WS_EX_LAYERED | WS_EX_TRANSPARENT;
|
||||
will_be_topmost = TRUE;
|
||||
will_be_layered = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1910,6 +1905,14 @@ _gdk_win32_surface_update_style_bits (GdkSurface *window)
|
||||
_gdk_win32_surface_exstyle_to_string (new_exstyle)));
|
||||
|
||||
SetWindowLong (GDK_SURFACE_HWND (window), GWL_EXSTYLE, new_exstyle);
|
||||
|
||||
if (!was_layered && will_be_layered)
|
||||
{
|
||||
/* We have to call SetLayeredWindowAttributes when setting the
|
||||
* WS_EX_LAYERED style anew, otherwise the window won't show up
|
||||
*/
|
||||
API_CALL (SetLayeredWindowAttributes, (GDK_SURFACE_HWND (window), 0, 255, LWA_ALPHA));
|
||||
}
|
||||
}
|
||||
|
||||
AdjustWindowRectEx (&after, new_style, FALSE, new_exstyle);
|
||||
@@ -2872,8 +2875,8 @@ redraw_indicator (gpointer user_data)
|
||||
|
||||
last_draw = draw_indicator (context, context->draw_timestamp);
|
||||
|
||||
window_position.x = (context->indicator_window_rect.x - _gdk_offset_x) * impl->surface_scale;
|
||||
window_position.y = (context->indicator_window_rect.y - _gdk_offset_y) * impl->surface_scale;
|
||||
window_position.x = context->indicator_window_rect.x * impl->surface_scale;
|
||||
window_position.y = context->indicator_window_rect.y * impl->surface_scale;
|
||||
window_size.cx = context->indicator_window_rect.width * impl->surface_scale;
|
||||
window_size.cy = context->indicator_window_rect.height * impl->surface_scale;
|
||||
|
||||
@@ -3564,8 +3567,8 @@ setup_drag_move_resize_context (GdkSurface *window,
|
||||
GDK_NOTE (MISC, g_print ("W32 WM unmaximized window placement is %ld x %ld @ %ld : %ld\n",
|
||||
placement.rcNormalPosition.right - placement.rcNormalPosition.left,
|
||||
placement.rcNormalPosition.bottom - placement.rcNormalPosition.top,
|
||||
placement.rcNormalPosition.left + _gdk_offset_x * impl->surface_scale,
|
||||
placement.rcNormalPosition.top + _gdk_offset_y * impl->surface_scale));
|
||||
placement.rcNormalPosition.left,
|
||||
placement.rcNormalPosition.top));
|
||||
|
||||
unmax_width = placement.rcNormalPosition.right - placement.rcNormalPosition.left;
|
||||
unmax_height = placement.rcNormalPosition.bottom - placement.rcNormalPosition.top;
|
||||
@@ -3576,40 +3579,36 @@ setup_drag_move_resize_context (GdkSurface *window,
|
||||
if (offsetx * impl->surface_scale < (shadow_unmax_width / 2) &&
|
||||
offsety * impl->surface_scale < (shadow_unmax_height / 2))
|
||||
{
|
||||
placement.rcNormalPosition.top = (root_y - offsety + impl->shadow.top - _gdk_offset_y) * impl->surface_scale;
|
||||
placement.rcNormalPosition.top = (root_y - offsety + impl->shadow.top) * impl->surface_scale;
|
||||
placement.rcNormalPosition.bottom = placement.rcNormalPosition.top + unmax_height;
|
||||
|
||||
if (left_half)
|
||||
{
|
||||
placement.rcNormalPosition.left = (root_x - offsetx + impl->shadow.left - _gdk_offset_x) * impl->surface_scale;
|
||||
placement.rcNormalPosition.left = (root_x - offsetx + impl->shadow.left) * impl->surface_scale;
|
||||
placement.rcNormalPosition.right = placement.rcNormalPosition.left + unmax_width;
|
||||
}
|
||||
else
|
||||
{
|
||||
placement.rcNormalPosition.right = (root_x + offsetx + impl->shadow.right - _gdk_offset_x) * impl->surface_scale;
|
||||
placement.rcNormalPosition.right = (root_x + offsetx + impl->shadow.right) * impl->surface_scale;
|
||||
placement.rcNormalPosition.left = placement.rcNormalPosition.right - unmax_width;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
placement.rcNormalPosition.left = (root_x * impl->surface_scale) -
|
||||
(unmax_width / 2) -
|
||||
(_gdk_offset_x * impl->surface_scale);
|
||||
placement.rcNormalPosition.left = root_x * impl->surface_scale - unmax_width / 2;
|
||||
|
||||
if (offsety * impl->surface_scale < shadow_unmax_height / 2)
|
||||
placement.rcNormalPosition.top = (root_y - offsety + impl->shadow.top - _gdk_offset_y) * impl->surface_scale;
|
||||
placement.rcNormalPosition.top = (root_y - offsety + impl->shadow.top) * impl->surface_scale;
|
||||
else
|
||||
placement.rcNormalPosition.top = (root_y * impl->surface_scale) -
|
||||
(unmax_height / 2) -
|
||||
(_gdk_offset_y * impl->surface_scale);
|
||||
placement.rcNormalPosition.top = root_y * impl->surface_scale - unmax_height / 2;
|
||||
|
||||
placement.rcNormalPosition.right = placement.rcNormalPosition.left + unmax_width;
|
||||
placement.rcNormalPosition.bottom = placement.rcNormalPosition.top + unmax_height;
|
||||
}
|
||||
|
||||
GDK_NOTE (MISC, g_print ("Unmaximized window will be at %ld : %ld\n",
|
||||
placement.rcNormalPosition.left + _gdk_offset_x * impl->surface_scale,
|
||||
placement.rcNormalPosition.top + _gdk_offset_y * impl->surface_scale));
|
||||
placement.rcNormalPosition.left,
|
||||
placement.rcNormalPosition.top));
|
||||
|
||||
API_CALL (SetWindowPlacement, (GDK_SURFACE_HWND (window), &placement));
|
||||
}
|
||||
@@ -3667,7 +3666,7 @@ setup_drag_move_resize_context (GdkSurface *window,
|
||||
* the titlebar is, if any.
|
||||
*/
|
||||
root_y = wy + wheight / 2;
|
||||
SetCursorPos (root_x - _gdk_offset_x, root_y - _gdk_offset_y);
|
||||
SetCursorPos (root_x, root_y);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3788,12 +3787,6 @@ gdk_win32_get_window_size_and_position_from_client_rect (GdkSurface *window,
|
||||
/* Turn client area into window area */
|
||||
_gdk_win32_adjust_client_rect (window, window_rect);
|
||||
|
||||
/* Convert GDK screen coordinates to W32 desktop coordinates */
|
||||
window_rect->left -= _gdk_offset_x * impl->surface_scale;
|
||||
window_rect->right -= _gdk_offset_x * impl->surface_scale;
|
||||
window_rect->top -= _gdk_offset_y * impl->surface_scale;
|
||||
window_rect->bottom -= _gdk_offset_y * impl->surface_scale;
|
||||
|
||||
window_position->x = window_rect->left;
|
||||
window_position->y = window_rect->top;
|
||||
window_size->cx = window_rect->right - window_rect->left;
|
||||
@@ -5093,12 +5086,6 @@ gdk_win32_surface_get_queued_window_rect (GdkSurface *surface,
|
||||
/* Turn client area into window area */
|
||||
_gdk_win32_adjust_client_rect (surface, &window_rect);
|
||||
|
||||
/* Convert GDK screen coordinates to W32 desktop coordinates */
|
||||
window_rect.left -= _gdk_offset_x * impl->surface_scale;
|
||||
window_rect.right -= _gdk_offset_x * impl->surface_scale;
|
||||
window_rect.top -= _gdk_offset_y * impl->surface_scale;
|
||||
window_rect.bottom -= _gdk_offset_y * impl->surface_scale;
|
||||
|
||||
*return_window_rect = window_rect;
|
||||
}
|
||||
|
||||
|
||||
@@ -1037,8 +1037,8 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
|
||||
if (xevent->type - display_x11->xrandr_event_base == RRScreenChangeNotify ||
|
||||
xevent->type - display_x11->xrandr_event_base == RRNotify)
|
||||
{
|
||||
if (x11_screen)
|
||||
_gdk_x11_screen_size_changed (x11_screen, xevent);
|
||||
if (display_x11->screen)
|
||||
_gdk_x11_screen_size_changed (display_x11->screen, xevent);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
||||
@@ -642,6 +642,8 @@ gdk_x11_gl_context_egl_class_init (GdkX11GLContextEGLClass *klass)
|
||||
GdkDrawContextClass *draw_context_class = GDK_DRAW_CONTEXT_CLASS (klass);
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
context_class->backend_type = GDK_GL_EGL;
|
||||
|
||||
context_class->realize = gdk_x11_gl_context_egl_realize;
|
||||
context_class->make_current = gdk_x11_gl_context_egl_make_current;
|
||||
context_class->clear_current = gdk_x11_gl_context_egl_clear_current;
|
||||
@@ -670,6 +672,9 @@ gdk_x11_display_init_egl (GdkX11Display *self,
|
||||
Display *dpy;
|
||||
int major, minor;
|
||||
|
||||
if (!gdk_gl_backend_can_be_used (GDK_GL_EGL, error))
|
||||
return FALSE;
|
||||
|
||||
dpy = gdk_x11_display_get_xdisplay (display);
|
||||
|
||||
if (!epoxy_has_egl ())
|
||||
|
||||
@@ -692,6 +692,8 @@ gdk_x11_gl_context_glx_class_init (GdkX11GLContextGLXClass *klass)
|
||||
GdkDrawContextClass *draw_context_class = GDK_DRAW_CONTEXT_CLASS (klass);
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
context_class->backend_type = GDK_GL_GLX;
|
||||
|
||||
context_class->realize = gdk_x11_gl_context_glx_realize;
|
||||
context_class->make_current = gdk_x11_gl_context_glx_make_current;
|
||||
context_class->clear_current = gdk_x11_gl_context_glx_clear_current;
|
||||
@@ -905,6 +907,9 @@ gdk_x11_display_init_glx (GdkX11Display *display_x11,
|
||||
Display *dpy;
|
||||
int screen_num;
|
||||
|
||||
if (!gdk_gl_backend_can_be_used (GDK_GL_GLX, error))
|
||||
return FALSE;
|
||||
|
||||
dpy = gdk_x11_display_get_xdisplay (display);
|
||||
|
||||
if (!epoxy_has_glx (dpy))
|
||||
|
||||
@@ -1923,8 +1923,13 @@ gdk_x11_surface_update_popups (GdkSurface *parent)
|
||||
{
|
||||
GdkX11Surface *popup_impl = l->data;
|
||||
GdkSurface *popup = GDK_SURFACE (popup_impl);
|
||||
int new_x = GDK_X11_SURFACE (parent)->abs_x + popup->x;
|
||||
int new_y = GDK_X11_SURFACE (parent)->abs_y + popup->y;
|
||||
int new_x, new_y;
|
||||
|
||||
if (GDK_SURFACE_DESTROYED (popup))
|
||||
continue;
|
||||
|
||||
new_x = GDK_X11_SURFACE (parent)->abs_x + popup->x;
|
||||
new_y = GDK_X11_SURFACE (parent)->abs_y + popup->y;
|
||||
|
||||
if (new_x != popup_impl->abs_x || new_y != popup_impl->abs_y)
|
||||
x11_surface_move (popup, new_x, new_y);
|
||||
|
||||
@@ -89,7 +89,7 @@ get_boolean_default (GdkX11Screen *x11_screen,
|
||||
char *v;
|
||||
int i;
|
||||
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (GDK_SCREEN_DISPLAY (x11_screen), DEFAULT_SETTINGS))
|
||||
if (gdk_display_get_debug_flags (GDK_SCREEN_DISPLAY (x11_screen)) & GDK_DEBUG_DEFAULT_SETTINGS)
|
||||
return FALSE;
|
||||
|
||||
v = XGetDefault (dpy, "Xft", option);
|
||||
@@ -114,7 +114,7 @@ get_double_default (GdkX11Screen *x11_screen,
|
||||
Display *dpy = GDK_SCREEN_XDISPLAY (x11_screen);
|
||||
char *v, *e;
|
||||
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (GDK_SCREEN_DISPLAY (x11_screen), DEFAULT_SETTINGS))
|
||||
if (gdk_display_get_debug_flags (GDK_SCREEN_DISPLAY (x11_screen)) & GDK_DEBUG_DEFAULT_SETTINGS)
|
||||
return FALSE;
|
||||
|
||||
v = XGetDefault (dpy, "Xft", option);
|
||||
@@ -141,7 +141,7 @@ get_integer_default (GdkX11Screen *x11_screen,
|
||||
Display *dpy = GDK_SCREEN_XDISPLAY (x11_screen);
|
||||
char *v, *e;
|
||||
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (GDK_SCREEN_DISPLAY (x11_screen), DEFAULT_SETTINGS))
|
||||
if (gdk_display_get_debug_flags (GDK_SCREEN_DISPLAY (x11_screen)) & GDK_DEBUG_DEFAULT_SETTINGS)
|
||||
return FALSE;
|
||||
|
||||
v = XGetDefault (dpy, "Xft", option);
|
||||
|
||||
@@ -1408,7 +1408,10 @@ gsk_ngl_render_job_visit_color_node (GskNglRenderJob *job,
|
||||
program = CHOOSE_PROGRAM (job, coloring);
|
||||
batch = gsk_ngl_command_queue_get_batch (job->command_queue);
|
||||
|
||||
if (batch->any.kind == GSK_NGL_COMMAND_KIND_DRAW &&
|
||||
/* Limit the size, or we end up with a coordinate overflow somwhere. */
|
||||
if (node->bounds.size.width < 300 &&
|
||||
node->bounds.size.height < 300 &&
|
||||
batch->any.kind == GSK_NGL_COMMAND_KIND_DRAW &&
|
||||
batch->any.program == program->id)
|
||||
{
|
||||
GskNglRenderOffscreen offscreen = {0};
|
||||
|
||||
@@ -90,9 +90,6 @@ struct _GtkAtSpiContext
|
||||
/* The root object, used as a entry point */
|
||||
GtkAtSpiRoot *root;
|
||||
|
||||
/* The address for the ATSPI accessibility bus */
|
||||
char *bus_address;
|
||||
|
||||
/* The object path of the ATContext on the bus */
|
||||
char *context_path;
|
||||
|
||||
@@ -111,15 +108,6 @@ struct _GtkAtSpiContext
|
||||
guint n_registered_objects;
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_BUS_ADDRESS = 1,
|
||||
|
||||
N_PROPS
|
||||
};
|
||||
|
||||
static GParamSpec *obj_props[N_PROPS];
|
||||
|
||||
G_DEFINE_TYPE (GtkAtSpiContext, gtk_at_spi_context, GTK_TYPE_AT_CONTEXT)
|
||||
|
||||
/* {{{ State handling */
|
||||
@@ -1437,61 +1425,21 @@ gtk_at_spi_context_finalize (GObject *gobject)
|
||||
|
||||
g_clear_object (&self->root);
|
||||
|
||||
g_free (self->bus_address);
|
||||
g_free (self->context_path);
|
||||
|
||||
G_OBJECT_CLASS (gtk_at_spi_context_parent_class)->finalize (gobject);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_at_spi_context_set_property (GObject *gobject,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkAtSpiContext *self = GTK_AT_SPI_CONTEXT (gobject);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_BUS_ADDRESS:
|
||||
self->bus_address = g_value_dup_string (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_at_spi_context_get_property (GObject *gobject,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkAtSpiContext *self = GTK_AT_SPI_CONTEXT (gobject);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_BUS_ADDRESS:
|
||||
g_value_set_string (value, self->bus_address);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_at_spi_context_constructed (GObject *gobject)
|
||||
{
|
||||
GtkAtSpiContext *self G_GNUC_UNUSED = GTK_AT_SPI_CONTEXT (gobject);
|
||||
|
||||
/* Make sure that we were properly constructed */
|
||||
g_assert (self->bus_address);
|
||||
|
||||
G_OBJECT_CLASS (gtk_at_spi_context_parent_class)->constructed (gobject);
|
||||
}
|
||||
|
||||
static const char *get_bus_address (GdkDisplay *display);
|
||||
|
||||
static void
|
||||
gtk_at_spi_context_realize (GtkATContext *context)
|
||||
{
|
||||
@@ -1508,7 +1456,7 @@ gtk_at_spi_context_realize (GtkATContext *context)
|
||||
|
||||
if (self->root == NULL)
|
||||
{
|
||||
self->root = gtk_at_spi_root_new (self->bus_address);
|
||||
self->root = gtk_at_spi_root_new (get_bus_address (display));
|
||||
g_object_set_data_full (G_OBJECT (display), "-gtk-atspi-root",
|
||||
g_object_ref (self->root),
|
||||
g_object_unref);
|
||||
@@ -1594,8 +1542,6 @@ gtk_at_spi_context_class_init (GtkAtSpiContextClass *klass)
|
||||
GtkATContextClass *context_class = GTK_AT_CONTEXT_CLASS (klass);
|
||||
|
||||
gobject_class->constructed = gtk_at_spi_context_constructed;
|
||||
gobject_class->set_property = gtk_at_spi_context_set_property;
|
||||
gobject_class->get_property = gtk_at_spi_context_get_property;
|
||||
gobject_class->finalize = gtk_at_spi_context_finalize;
|
||||
|
||||
context_class->realize = gtk_at_spi_context_realize;
|
||||
@@ -1604,15 +1550,6 @@ gtk_at_spi_context_class_init (GtkAtSpiContextClass *klass)
|
||||
context_class->platform_change = gtk_at_spi_context_platform_change;
|
||||
context_class->bounds_change = gtk_at_spi_context_bounds_change;
|
||||
context_class->child_change = gtk_at_spi_context_child_change;
|
||||
|
||||
obj_props[PROP_BUS_ADDRESS] =
|
||||
g_param_spec_string ("bus-address", NULL, NULL,
|
||||
NULL,
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (gobject_class, N_PROPS, obj_props);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1766,6 +1703,7 @@ get_bus_address (GdkDisplay *display)
|
||||
out:
|
||||
return bus_address;
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
/* {{{ API */
|
||||
GtkATContext *
|
||||
@@ -1773,18 +1711,15 @@ gtk_at_spi_create_context (GtkAccessibleRole accessible_role,
|
||||
GtkAccessible *accessible,
|
||||
GdkDisplay *display)
|
||||
{
|
||||
const char *bus_address;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_ACCESSIBLE (accessible), NULL);
|
||||
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
|
||||
|
||||
static const char *bus_address;
|
||||
bus_address = get_bus_address (display);
|
||||
|
||||
if (bus_address == NULL)
|
||||
{
|
||||
bus_address = get_bus_address (display);
|
||||
|
||||
if (bus_address == NULL)
|
||||
bus_address = "";
|
||||
}
|
||||
bus_address = "";
|
||||
|
||||
if (*bus_address == '\0')
|
||||
return NULL;
|
||||
@@ -1795,7 +1730,6 @@ gtk_at_spi_create_context (GtkAccessibleRole accessible_role,
|
||||
"accessible-role", accessible_role,
|
||||
"accessible", accessible,
|
||||
"display", display,
|
||||
"bus-address", bus_address,
|
||||
NULL);
|
||||
#endif
|
||||
#if defined(GDK_WINDOWING_X11)
|
||||
@@ -1804,7 +1738,6 @@ gtk_at_spi_create_context (GtkAccessibleRole accessible_role,
|
||||
"accessible-role", accessible_role,
|
||||
"accessible", accessible,
|
||||
"display", display,
|
||||
"bus-address", bus_address,
|
||||
NULL);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -40,8 +40,17 @@ pango_variant_to_string (PangoVariant variant)
|
||||
{
|
||||
switch (variant)
|
||||
{
|
||||
#if PANGO_VERSION_CHECK(1,49,3)
|
||||
case PANGO_VARIANT_UNICASE:
|
||||
case PANGO_VARIANT_TITLE_CAPS:
|
||||
#endif
|
||||
case PANGO_VARIANT_NORMAL:
|
||||
return "normal";
|
||||
#if PANGO_VERSION_CHECK(1,49,3)
|
||||
case PANGO_VARIANT_ALL_SMALL_CAPS:
|
||||
case PANGO_VARIANT_PETITE_CAPS:
|
||||
case PANGO_VARIANT_ALL_PETITE_CAPS:
|
||||
#endif
|
||||
case PANGO_VARIANT_SMALL_CAPS:
|
||||
return "small_caps";
|
||||
default:
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
* character data, and definitions for the builtin compose table of GTK.
|
||||
* Run it like this:
|
||||
*
|
||||
* compose-parse Compose sequences chars gtkcomposedata.h
|
||||
* cpp -DXCOMM='#' Compose.pre | sed -e 's/^ *#/#/' > Compose
|
||||
* compose-parse Compose sequences-little-endian sequences-big-endian chars gtkcomposedata.h
|
||||
*
|
||||
* The GTK build expects the output files to be in the source tree, in
|
||||
* the gtk/compose directory.
|
||||
@@ -15,15 +16,19 @@
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
const guint16 *sequences_le;
|
||||
const guint16 *sequences_be;
|
||||
guint16 *other_sequences;
|
||||
GtkComposeTable *table;
|
||||
GError *error = NULL;
|
||||
GString *str;
|
||||
gsize i;
|
||||
|
||||
setlocale (LC_ALL, "");
|
||||
|
||||
if (argc < 5)
|
||||
{
|
||||
g_print ("Usage: compose-parse INPUT OUTPUT1 OUTPUT2 OUTPUT3\n");
|
||||
g_print ("Usage: compose-parse INPUT SEQUENCES-LE SEQUENCES-BE CHARS HEADER\n");
|
||||
exit (1);
|
||||
}
|
||||
|
||||
@@ -31,11 +36,26 @@ main (int argc, char *argv[])
|
||||
if (!table)
|
||||
g_error ("Failed to parse %s", argv[1]);
|
||||
|
||||
#if G_BYTE_ORDER == G_BIG_ENDIAN
|
||||
sequences_le = other_sequences = g_new0 (guint16, table->data_size);
|
||||
sequences_be = (const guint16 *) table->data;
|
||||
#else
|
||||
sequences_le = (const guint16 *) table->data;
|
||||
sequences_be = other_sequences = g_new0 (guint16, table->data_size);
|
||||
#endif
|
||||
|
||||
for (i = 0; i < table->data_size; i++)
|
||||
other_sequences[i] = GUINT16_SWAP_LE_BE (table->data[i]);
|
||||
|
||||
/* data_size is the size in guint16 */
|
||||
if (!g_file_set_contents (argv[2], (char *)table->data, 2 * table->data_size, &error))
|
||||
if (!g_file_set_contents (argv[2], (char *) sequences_le, 2 * table->data_size, &error))
|
||||
g_error ("%s", error->message);
|
||||
|
||||
if (!g_file_set_contents (argv[3], table->char_data, table->n_chars + 1, &error))
|
||||
/* data_size is the size in guint16 */
|
||||
if (!g_file_set_contents (argv[3], (char *) sequences_be, 2 * table->data_size, &error))
|
||||
g_error ("%s", error->message);
|
||||
|
||||
if (!g_file_set_contents (argv[4], table->char_data, table->n_chars + 1, &error))
|
||||
g_error ("%s", error->message);
|
||||
|
||||
str = g_string_new ("");
|
||||
@@ -55,10 +75,11 @@ main (int argc, char *argv[])
|
||||
"\n"
|
||||
"#endif\n");
|
||||
|
||||
if (!g_file_set_contents (argv[4], str->str, str->len, &error))
|
||||
if (!g_file_set_contents (argv[5], str->str, str->len, &error))
|
||||
g_error ("%s", error->message);
|
||||
|
||||
g_string_free (str, TRUE);
|
||||
g_free (other_sequences);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#define MAX_SEQ_LEN 5
|
||||
#define N_INDEX_SIZE 30
|
||||
#define DATA_SIZE 16447
|
||||
#define DATA_SIZE 16477
|
||||
#define N_CHARS 1241
|
||||
|
||||
#endif
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -21,6 +21,7 @@ def replace_if_changed(new, old):
|
||||
os.remove(new)
|
||||
|
||||
srcdir = sys.argv[1]
|
||||
endian = sys.argv[2]
|
||||
|
||||
xml = '''<?xml version='1.0' encoding='UTF-8'?>
|
||||
<gresources>
|
||||
@@ -54,7 +55,7 @@ for f in get_files('theme/Default/assets', '.png'):
|
||||
xml += '\n'
|
||||
|
||||
for f in get_files('theme/Default/assets', '.svg'):
|
||||
xml += ' <file>theme/Default/assets/{0}</file>\n'.format(f)
|
||||
xml += ' <file preprocess=\'xml-stripblanks\'>theme/Default/assets/{0}</file>\n'.format(f)
|
||||
|
||||
for f in get_files('theme/Default/assets-hc', '.png'):
|
||||
xml += ' <file>theme/Default/assets-hc/{0}</file>\n'.format(f)
|
||||
@@ -62,10 +63,10 @@ for f in get_files('theme/Default/assets-hc', '.png'):
|
||||
xml += '\n'
|
||||
|
||||
for f in get_files('theme/Default/assets-hc', '.svg'):
|
||||
xml += ' <file>theme/Default/assets-hc/{0}</file>\n'.format(f)
|
||||
xml += ' <file preprocess=\'xml-stripblanks\'>theme/Default/assets-hc/{0}</file>\n'.format(f)
|
||||
|
||||
for f in get_files('ui', '.ui'):
|
||||
xml += ' <file preprocess=\'xml-stripblanks\'>ui/{0}</file>\n'.format(f)
|
||||
xml += ' <file>ui/{0}</file>\n'.format(f)
|
||||
|
||||
xml += '\n'
|
||||
|
||||
@@ -76,7 +77,7 @@ for s in ['16x16', '32x32', '64x64', 'scalable']:
|
||||
for f in get_files(icons_dir, '.png'):
|
||||
xml += ' <file>icons/{0}/{1}/{2}</file>\n'.format(s,c,f)
|
||||
for f in get_files(icons_dir, '.svg'):
|
||||
xml += ' <file>icons/{0}/{1}/{2}</file>\n'.format(s,c,f)
|
||||
xml += ' <file preprocess=\'xml-stripblanks\'>icons/{0}/{1}/{2}</file>\n'.format(s,c,f)
|
||||
|
||||
for f in get_files('inspector', '.ui'):
|
||||
xml += ' <file preprocess=\'xml-stripblanks\'>inspector/{0}</file>\n'.format(f)
|
||||
@@ -84,13 +85,13 @@ for f in get_files('inspector', '.ui'):
|
||||
xml += '''
|
||||
<file>inspector/inspector.css</file>
|
||||
<file>emoji/en.data</file>
|
||||
<file>compose/sequences</file>
|
||||
<file alias="compose/sequences">compose/sequences-{0}-endian</file>
|
||||
<file>compose/chars</file>
|
||||
</gresource>
|
||||
</gresources>'''
|
||||
</gresources>'''.format(endian)
|
||||
|
||||
if len(sys.argv) > 2:
|
||||
outfile = sys.argv[2]
|
||||
if len(sys.argv) > 3:
|
||||
outfile = sys.argv[3]
|
||||
tmpfile = outfile + '~'
|
||||
with open(tmpfile, 'w') as f:
|
||||
f.write(xml)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <winuser.h>
|
||||
#include <winver.h>
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
GTK_ICON ICON "gtk.ico"
|
||||
|
||||
|
||||
+17
-6
@@ -484,15 +484,26 @@ out:
|
||||
*
|
||||
* Parses a string representing an accelerator.
|
||||
*
|
||||
* The format looks like “<Control>a” or “<Shift><Alt>F1”.
|
||||
* The format looks like “`<Control>a`” or “`<Shift><Alt>F1`”.
|
||||
*
|
||||
* The parser is fairly liberal and allows lower or upper case, and also
|
||||
* abbreviations such as “<Ctl>” and “<Ctrl>”. Key names are parsed using
|
||||
* [func@Gdk.keyval_from_name]. For character keys the name is not the symbol,
|
||||
* but the lowercase name, e.g. one would use “<Ctrl>minus” instead of
|
||||
* “<Ctrl>-”.
|
||||
* abbreviations such as “`<Ctl>`” and “`<Ctrl>`”.
|
||||
*
|
||||
* If the parse fails, @accelerator_key and @accelerator_mods will
|
||||
* Key names are parsed using [func@Gdk.keyval_from_name]. For character keys
|
||||
* the name is not the symbol, but the lowercase name, e.g. one would use
|
||||
* “`<Ctrl>minus`” instead of “`<Ctrl>-`”.
|
||||
*
|
||||
* Modifiers are enclosed in angular brackets `<>`, and match the
|
||||
* [flags@Gdk.ModifierType] mask:
|
||||
*
|
||||
* - `<Shift>` for `GDK_SHIFT_MASK`
|
||||
* - `<Ctrl>` for `GDK_CONTROL_MASK`
|
||||
* - `<Alt>` for `GDK_ALT_MASK`
|
||||
* - `<Meta>` for `GDK_META_MASK`
|
||||
* - `<Super>` for `GDK_SUPER_MASK`
|
||||
* - `<Hyper>` for `GDK_HYPER_MASK`
|
||||
*
|
||||
* If the parse operation fails, @accelerator_key and @accelerator_mods will
|
||||
* be set to 0 (zero).
|
||||
*/
|
||||
gboolean
|
||||
|
||||
@@ -294,6 +294,9 @@ gtk_application_local_command_line (GApplication *application,
|
||||
char ***arguments,
|
||||
int *exit_status)
|
||||
{
|
||||
/* We need to call setlocale() here so --help output works */
|
||||
setlocale_initialization ();
|
||||
|
||||
return G_APPLICATION_CLASS (gtk_application_parent_class)->local_command_line (application, arguments, exit_status);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1032,7 +1032,7 @@ gtk_at_context_get_description_accumulate (GtkATContext *self,
|
||||
|
||||
GList *list = gtk_reference_list_accessible_value_get (value);
|
||||
|
||||
for (GList *l = list; l != NULL; l = l->data)
|
||||
for (GList *l = list; l != NULL; l = l->next)
|
||||
{
|
||||
GtkAccessible *rel = GTK_ACCESSIBLE (l->data);
|
||||
GtkATContext *rel_context = gtk_accessible_get_at_context (rel);
|
||||
|
||||
+6
-10
@@ -617,16 +617,12 @@ gtk_builder_get_parameters (GtkBuilder *builder,
|
||||
continue;
|
||||
}
|
||||
|
||||
if (prop->pspec->flags & filter_flags)
|
||||
{
|
||||
if (filtered_parameters)
|
||||
object_properties_add (filtered_parameters, property_name, &property_value);
|
||||
}
|
||||
if ((prop->pspec->flags & filter_flags) != 0 && filtered_parameters)
|
||||
object_properties_add (filtered_parameters, property_name, &property_value);
|
||||
else if ((prop->pspec->flags & filter_flags) == 0 && parameters)
|
||||
object_properties_add (parameters, property_name, &property_value);
|
||||
else
|
||||
{
|
||||
if (parameters)
|
||||
object_properties_add (parameters, property_name, &property_value);
|
||||
}
|
||||
g_value_unset (&property_value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2752,7 +2748,7 @@ _gtk_builder_get_template_type (GtkBuilder *builder)
|
||||
* Creates a closure to invoke the function called @function_name.
|
||||
*
|
||||
* This is using the create_closure() implementation of @builder's
|
||||
* [class@Gtk.BuilderScope].
|
||||
* [iface@Gtk.BuilderScope].
|
||||
*
|
||||
* If no closure could be created, %NULL will be returned and @error
|
||||
* will be set.
|
||||
|
||||
@@ -1035,6 +1035,12 @@ gtk_button_get_action_helper (GtkButton *button)
|
||||
* @child: (nullable): the child widget
|
||||
*
|
||||
* Sets the child widget of @button.
|
||||
*
|
||||
* Note that by using this API, you take full responsibility for setting
|
||||
* up the proper accessibility label and description information for @button.
|
||||
* Most likely, you'll either set the accessibility label or description
|
||||
* for @button explicitly, or you'll set a labelled-by or described-by
|
||||
* relations from @child to @button.
|
||||
*/
|
||||
void
|
||||
gtk_button_set_child (GtkButton *button,
|
||||
|
||||
+53
-49
@@ -633,11 +633,58 @@ gtk_calendar_init (GtkCalendar *calendar)
|
||||
calendar);
|
||||
gtk_widget_add_controller (GTK_WIDGET (calendar), controller);
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
calendar->week_start = 0;
|
||||
week_start = NULL;
|
||||
|
||||
if (GetLocaleInfoW (GetThreadLocale (), LOCALE_IFIRSTDAYOFWEEK,
|
||||
wbuffer, G_N_ELEMENTS (wbuffer)))
|
||||
week_start = g_utf16_to_utf8 (wbuffer, -1, NULL, NULL, NULL);
|
||||
|
||||
if (week_start != NULL)
|
||||
{
|
||||
calendar->week_start = (week_start[0] - '0' + 1) % 7;
|
||||
g_free(week_start);
|
||||
}
|
||||
#else
|
||||
#ifdef HAVE__NL_TIME_FIRST_WEEKDAY
|
||||
langinfo.string = nl_langinfo (_NL_TIME_FIRST_WEEKDAY);
|
||||
first_weekday = langinfo.string[0];
|
||||
langinfo.string = nl_langinfo (_NL_TIME_WEEK_1STDAY);
|
||||
week_origin = langinfo.word;
|
||||
if (week_origin == 19971130) /* Sunday */
|
||||
week_1stday = 0;
|
||||
else if (week_origin == 19971201) /* Monday */
|
||||
week_1stday = 1;
|
||||
else
|
||||
g_warning ("Unknown value of _NL_TIME_WEEK_1STDAY.");
|
||||
|
||||
calendar->week_start = (week_1stday + first_weekday - 1) % 7;
|
||||
#else
|
||||
/* Translate to calendar:week_start:0 if you want Sunday to be the
|
||||
* first day of the week to calendar:week_start:1 if you want Monday
|
||||
* to be the first day of the week, and so on.
|
||||
*/
|
||||
week_start = _("calendar:week_start:0");
|
||||
|
||||
if (strncmp (week_start, "calendar:week_start:", 20) == 0)
|
||||
calendar->week_start = *(week_start + 20) - '0';
|
||||
else
|
||||
calendar->week_start = -1;
|
||||
|
||||
if (calendar->week_start < 0 || calendar->week_start > 6)
|
||||
{
|
||||
g_warning ("Whoever translated calendar:week_start:0 did so wrongly.");
|
||||
calendar->week_start = 0;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (!default_abbreviated_dayname[0])
|
||||
for (i=0; i<7; i++)
|
||||
{
|
||||
#ifndef G_OS_WIN32
|
||||
tmp_time= (i+3)*86400;
|
||||
tmp_time= (i+3)*86400; /* epoch was a Thursday, so add 3 days for Sunday */
|
||||
strftime (buffer, sizeof (buffer), "%a", gmtime (&tmp_time));
|
||||
default_abbreviated_dayname[i] = g_locale_to_utf8 (buffer, -1, NULL, NULL, NULL);
|
||||
#else
|
||||
@@ -692,7 +739,11 @@ gtk_calendar_init (GtkCalendar *calendar)
|
||||
/* Day name labels */
|
||||
for (i = 0; i < 7; i ++)
|
||||
{
|
||||
GtkWidget *label = gtk_label_new (default_abbreviated_dayname[i]);
|
||||
int day;
|
||||
GtkWidget *label;
|
||||
|
||||
day = (i + calendar->week_start) % 7;
|
||||
label = gtk_label_new (default_abbreviated_dayname[day]);
|
||||
|
||||
gtk_widget_set_hexpand (label, TRUE);
|
||||
gtk_widget_set_vexpand (label, TRUE);
|
||||
@@ -771,53 +822,6 @@ gtk_calendar_init (GtkCalendar *calendar)
|
||||
else if (strcmp (year_before, "calendar:MY") != 0)
|
||||
g_warning ("Whoever translated calendar:MY did so wrongly.");
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
calendar->week_start = 0;
|
||||
week_start = NULL;
|
||||
|
||||
if (GetLocaleInfoW (GetThreadLocale (), LOCALE_IFIRSTDAYOFWEEK,
|
||||
wbuffer, G_N_ELEMENTS (wbuffer)))
|
||||
week_start = g_utf16_to_utf8 (wbuffer, -1, NULL, NULL, NULL);
|
||||
|
||||
if (week_start != NULL)
|
||||
{
|
||||
calendar->week_start = (week_start[0] - '0' + 1) % 7;
|
||||
g_free(week_start);
|
||||
}
|
||||
#else
|
||||
#ifdef HAVE__NL_TIME_FIRST_WEEKDAY
|
||||
langinfo.string = nl_langinfo (_NL_TIME_FIRST_WEEKDAY);
|
||||
first_weekday = langinfo.string[0];
|
||||
langinfo.string = nl_langinfo (_NL_TIME_WEEK_1STDAY);
|
||||
week_origin = langinfo.word;
|
||||
if (week_origin == 19971130) /* Sunday */
|
||||
week_1stday = 0;
|
||||
else if (week_origin == 19971201) /* Monday */
|
||||
week_1stday = 1;
|
||||
else
|
||||
g_warning ("Unknown value of _NL_TIME_WEEK_1STDAY.");
|
||||
|
||||
calendar->week_start = (week_1stday + first_weekday - 1) % 7;
|
||||
#else
|
||||
/* Translate to calendar:week_start:0 if you want Sunday to be the
|
||||
* first day of the week to calendar:week_start:1 if you want Monday
|
||||
* to be the first day of the week, and so on.
|
||||
*/
|
||||
week_start = _("calendar:week_start:0");
|
||||
|
||||
if (strncmp (week_start, "calendar:week_start:", 20) == 0)
|
||||
calendar->week_start = *(week_start + 20) - '0';
|
||||
else
|
||||
calendar->week_start = -1;
|
||||
|
||||
if (calendar->week_start < 0 || calendar->week_start > 6)
|
||||
{
|
||||
g_warning ("Whoever translated calendar:week_start:0 did so wrongly.");
|
||||
calendar->week_start = 0;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
gtk_orientable_set_orientation (GTK_ORIENTABLE (gtk_widget_get_layout_manager (GTK_WIDGET (calendar))),
|
||||
GTK_ORIENTATION_VERTICAL);
|
||||
|
||||
|
||||
+11
-11
@@ -24,10 +24,10 @@
|
||||
*
|
||||
* An abstract class for laying out GtkCellRenderers
|
||||
*
|
||||
* The `GtkCellArea` is an abstract class for `GtkCellLayout` widgets
|
||||
* (also referred to as "layouting widgets") to interface with an
|
||||
* arbitrary number of `GtkCellRenderer`s and interact with the user
|
||||
* for a given `GtkTreeModel` row.
|
||||
* The `GtkCellArea` is an abstract class for [iface@Gtk.CellLayout]
|
||||
* widgets (also referred to as "layouting widgets") to interface with
|
||||
* an arbitrary number of [class@Gtk.CellRenderer]s and interact with the user
|
||||
* for a given [iface@Gtk.TreeModel] row.
|
||||
*
|
||||
* The cell area handles events, focus navigation, drawing and
|
||||
* size requests and allocations for a given row of data.
|
||||
@@ -979,7 +979,7 @@ gtk_cell_area_real_add (GtkCellArea *area,
|
||||
g_type_name (G_TYPE_FROM_INSTANCE (area)));
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
gtk_cell_area_real_remove (GtkCellArea *area,
|
||||
GtkCellRenderer *renderer)
|
||||
{
|
||||
@@ -1727,8 +1727,8 @@ gtk_cell_area_foreach_alloc (GtkCellArea *area,
|
||||
g_return_if_fail (cell_area != NULL);
|
||||
g_return_if_fail (callback != NULL);
|
||||
|
||||
GTK_CELL_AREA_GET_CLASS (area)->foreach_alloc (area, context, widget,
|
||||
cell_area, background_area,
|
||||
GTK_CELL_AREA_GET_CLASS (area)->foreach_alloc (area, context, widget,
|
||||
cell_area, background_area,
|
||||
callback, callback_data);
|
||||
}
|
||||
|
||||
@@ -2018,7 +2018,7 @@ gtk_cell_area_get_preferred_width (GtkCellArea *area,
|
||||
g_return_if_fail (GTK_IS_CELL_AREA (area));
|
||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||
|
||||
GTK_CELL_AREA_GET_CLASS (area)->get_preferred_width (area, context, widget,
|
||||
GTK_CELL_AREA_GET_CLASS (area)->get_preferred_width (area, context, widget,
|
||||
minimum_width, natural_width);
|
||||
}
|
||||
|
||||
@@ -2090,7 +2090,7 @@ gtk_cell_area_get_preferred_height (GtkCellArea *area,
|
||||
g_return_if_fail (GTK_IS_CELL_AREA (area));
|
||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||
|
||||
GTK_CELL_AREA_GET_CLASS (area)->get_preferred_height (area, context, widget,
|
||||
GTK_CELL_AREA_GET_CLASS (area)->get_preferred_height (area, context, widget,
|
||||
minimum_height, natural_height);
|
||||
}
|
||||
|
||||
@@ -3369,7 +3369,7 @@ gtk_cell_area_stop_editing (GtkCellArea *area,
|
||||
gtk_cell_renderer_stop_editing (priv->edited_cell, canceled);
|
||||
|
||||
/* When editing is explicitly halted either
|
||||
* the "editing-canceled" signal is emitted on the cell
|
||||
* the "editing-canceled" signal is emitted on the cell
|
||||
* renderer or the "editing-done" signal on the GtkCellEditable widget
|
||||
*/
|
||||
if (!canceled)
|
||||
@@ -3527,7 +3527,7 @@ _gtk_cell_area_set_cell_data_func_with_proxy (GtkCellArea *area,
|
||||
|
||||
/* Note we do not take a reference to the proxy, the proxy is a GtkCellLayout
|
||||
* that is forwarding its implementation to a delegate GtkCellArea therefore
|
||||
* its life-cycle is longer than the area's life cycle.
|
||||
* its life-cycle is longer than the area's life cycle.
|
||||
*/
|
||||
if (info)
|
||||
{
|
||||
|
||||
@@ -193,7 +193,7 @@ gtk_color_button_class_init (GtkColorButtonClass *klass)
|
||||
*
|
||||
* Note that this signal is only emitted when the user changes the color.
|
||||
* If you need to react to programmatic color changes as well, use
|
||||
* the notify::color signal.
|
||||
* the notify::rgba signal.
|
||||
*/
|
||||
color_button_signals[COLOR_SET] = g_signal_new (I_("color-set"),
|
||||
G_TYPE_FROM_CLASS (gobject_class),
|
||||
|
||||
@@ -447,9 +447,6 @@ gtk_color_editor_dispose (GObject *object)
|
||||
|
||||
dismiss_current_popup (editor);
|
||||
g_clear_object (&editor->picker);
|
||||
g_clear_object (&editor->h_adj);
|
||||
g_clear_object (&editor->s_adj);
|
||||
g_clear_object (&editor->v_adj);
|
||||
|
||||
G_OBJECT_CLASS (gtk_color_editor_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
@@ -936,8 +936,6 @@ parser_get_compose_table (GtkComposeParser *parser)
|
||||
}
|
||||
else
|
||||
{
|
||||
g_assert (strlen (value) < 20);
|
||||
|
||||
if (char_data->len > 0)
|
||||
g_string_append_c (char_data, 0);
|
||||
|
||||
@@ -1437,7 +1435,6 @@ gtk_compose_table_foreach (const GtkComposeTable *table,
|
||||
int char_offset = encoded_value & ~(1 << 15);
|
||||
g_assert (char_offset < table->n_chars);
|
||||
value = &table->char_data[char_offset];
|
||||
g_assert (strlen (value) < 20);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -2141,7 +2141,7 @@ gtk_constraint_layout_add_constraints_from_descriptionv (GtkConstraintLayout *la
|
||||
* @error: return location for a `GError`
|
||||
* @first_view: the name of a view in the VFL description, followed by the
|
||||
* [iface@Gtk.ConstraintTarget] to which it maps
|
||||
* @...: a `NULL`-terminated list of view names and [class@Gtk.ConstraintTarget]s
|
||||
* @...: a `NULL`-terminated list of view names and [iface@Gtk.ConstraintTarget]s
|
||||
*
|
||||
* Creates a list of constraints from a VFL description.
|
||||
*
|
||||
@@ -2209,10 +2209,10 @@ gtk_constraint_layout_add_constraints_from_description (GtkConstraintLayout *lay
|
||||
/**
|
||||
* gtk_constraint_layout_observe_constraints:
|
||||
* @layout: a `GtkConstraintLayout`
|
||||
*
|
||||
*
|
||||
* Returns a `GListModel` to track the constraints that are
|
||||
* part of the layout.
|
||||
*
|
||||
*
|
||||
* Calling this function will enable extra internal bookkeeping
|
||||
* to track constraints and emit signals on the returned listmodel.
|
||||
* It may slow down operations a lot.
|
||||
@@ -2249,10 +2249,10 @@ gtk_constraint_layout_observe_constraints (GtkConstraintLayout *layout)
|
||||
/**
|
||||
* gtk_constraint_layout_observe_guides:
|
||||
* @layout: a `GtkConstraintLayout`
|
||||
*
|
||||
*
|
||||
* Returns a `GListModel` to track the guides that are
|
||||
* part of the layout.
|
||||
*
|
||||
*
|
||||
* Calling this function will enable extra internal bookkeeping
|
||||
* to track guides and emit signals on the returned listmodel.
|
||||
* It may slow down operations a lot.
|
||||
|
||||
@@ -178,7 +178,7 @@ gtk_css_image_radial_snapshot (GtkCssImage *image,
|
||||
else
|
||||
pos = MIN (1.0, _gtk_css_number_value_get (stop->offset, hradius) / hradius);
|
||||
|
||||
pos = MAX (pos, 0);
|
||||
pos = MAX (pos, offset);
|
||||
step = (pos - offset) / (i - last);
|
||||
for (last = last + 1; last <= i; last++)
|
||||
{
|
||||
|
||||
@@ -42,6 +42,12 @@ gtk_css_image_url_load_image (GtkCssImageUrl *url,
|
||||
if (url->loaded_image)
|
||||
return url->loaded_image;
|
||||
|
||||
if (url->file == NULL)
|
||||
{
|
||||
url->loaded_image = gtk_css_image_invalid_new ();
|
||||
return url->loaded_image;
|
||||
}
|
||||
|
||||
/* We special case resources here so we can use gdk_texture_new_from_resource. */
|
||||
if (g_file_has_uri_scheme (url->file, "resource"))
|
||||
{
|
||||
@@ -148,6 +154,10 @@ gtk_css_image_url_equal (GtkCssImage *image1,
|
||||
{
|
||||
GtkCssImageUrl *url1 = GTK_CSS_IMAGE_URL (image1);
|
||||
GtkCssImageUrl *url2 = GTK_CSS_IMAGE_URL (image2);
|
||||
|
||||
/* FIXME: We don't save data: urls, so we can't compare them here */
|
||||
if (url1->file == NULL || url2->file == NULL)
|
||||
return FALSE;
|
||||
|
||||
return g_file_equal (url1->file, url2->file);
|
||||
}
|
||||
|
||||
+66
-55
@@ -428,64 +428,14 @@ append_separated (GString **s,
|
||||
g_string_append (*s, text);
|
||||
}
|
||||
|
||||
PangoAttrList *
|
||||
gtk_css_style_get_pango_attributes (GtkCssStyle *style)
|
||||
char *
|
||||
gtk_css_style_compute_font_features (GtkCssStyle *style)
|
||||
{
|
||||
PangoAttrList *attrs = NULL;
|
||||
GtkTextDecorationLine decoration_line;
|
||||
GtkTextDecorationStyle decoration_style;
|
||||
const GdkRGBA *color;
|
||||
const GdkRGBA *decoration_color;
|
||||
int letter_spacing;
|
||||
GtkCssFontVariantLigature ligatures;
|
||||
GtkCssFontVariantNumeric numeric;
|
||||
GtkCssFontVariantEastAsian east_asian;
|
||||
GString *s;
|
||||
char *settings;
|
||||
|
||||
/* text-decoration */
|
||||
decoration_line = _gtk_css_text_decoration_line_value_get (style->font_variant->text_decoration_line);
|
||||
decoration_style = _gtk_css_text_decoration_style_value_get (style->font_variant->text_decoration_style);
|
||||
color = gtk_css_color_value_get_rgba (style->core->color);
|
||||
decoration_color = gtk_css_color_value_get_rgba (style->font_variant->text_decoration_color
|
||||
? style->font_variant->text_decoration_color
|
||||
: style->core->color);
|
||||
|
||||
if (decoration_line & GTK_CSS_TEXT_DECORATION_LINE_UNDERLINE)
|
||||
{
|
||||
attrs = add_pango_attr (attrs, pango_attr_underline_new (get_pango_underline_from_style (decoration_style)));
|
||||
if (!gdk_rgba_equal (color, decoration_color))
|
||||
attrs = add_pango_attr (attrs, pango_attr_underline_color_new (decoration_color->red * 65535. + 0.5,
|
||||
decoration_color->green * 65535. + 0.5,
|
||||
decoration_color->blue * 65535. + 0.5));
|
||||
}
|
||||
if (decoration_line & GTK_CSS_TEXT_DECORATION_LINE_OVERLINE)
|
||||
{
|
||||
attrs = add_pango_attr (attrs, pango_attr_overline_new (get_pango_overline_from_style (decoration_style)));
|
||||
if (!gdk_rgba_equal (color, decoration_color))
|
||||
attrs = add_pango_attr (attrs, pango_attr_overline_color_new (decoration_color->red * 65535. + 0.5,
|
||||
decoration_color->green * 65535. + 0.5,
|
||||
decoration_color->blue * 65535. + 0.5));
|
||||
}
|
||||
if (decoration_line & GTK_CSS_TEXT_DECORATION_LINE_LINE_THROUGH)
|
||||
{
|
||||
attrs = add_pango_attr (attrs, pango_attr_strikethrough_new (TRUE));
|
||||
if (!gdk_rgba_equal (color, decoration_color))
|
||||
attrs = add_pango_attr (attrs, pango_attr_strikethrough_color_new (decoration_color->red * 65535. + 0.5,
|
||||
decoration_color->green * 65535. + 0.5,
|
||||
decoration_color->blue * 65535. + 0.5));
|
||||
}
|
||||
|
||||
/* letter-spacing */
|
||||
letter_spacing = _gtk_css_number_value_get (style->font->letter_spacing, 100);
|
||||
if (letter_spacing != 0)
|
||||
{
|
||||
attrs = add_pango_attr (attrs, pango_attr_letter_spacing_new (letter_spacing * PANGO_SCALE));
|
||||
}
|
||||
|
||||
/* OpenType features */
|
||||
|
||||
s = NULL;
|
||||
GString *s = NULL;
|
||||
|
||||
switch (_gtk_css_font_kerning_value_get (style->font_variant->font_kerning))
|
||||
{
|
||||
@@ -635,10 +585,71 @@ gtk_css_style_get_pango_attributes (GtkCssStyle *style)
|
||||
}
|
||||
|
||||
if (s)
|
||||
return g_string_free (s, FALSE);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PangoAttrList *
|
||||
gtk_css_style_get_pango_attributes (GtkCssStyle *style)
|
||||
{
|
||||
PangoAttrList *attrs = NULL;
|
||||
GtkTextDecorationLine decoration_line;
|
||||
GtkTextDecorationStyle decoration_style;
|
||||
const GdkRGBA *color;
|
||||
const GdkRGBA *decoration_color;
|
||||
int letter_spacing;
|
||||
|
||||
/* text-decoration */
|
||||
decoration_line = _gtk_css_text_decoration_line_value_get (style->font_variant->text_decoration_line);
|
||||
decoration_style = _gtk_css_text_decoration_style_value_get (style->font_variant->text_decoration_style);
|
||||
color = gtk_css_color_value_get_rgba (style->core->color);
|
||||
decoration_color = gtk_css_color_value_get_rgba (style->font_variant->text_decoration_color
|
||||
? style->font_variant->text_decoration_color
|
||||
: style->core->color);
|
||||
|
||||
if (decoration_line & GTK_CSS_TEXT_DECORATION_LINE_UNDERLINE)
|
||||
{
|
||||
attrs = add_pango_attr (attrs, pango_attr_font_features_new (s->str));
|
||||
g_string_free (s, TRUE);
|
||||
attrs = add_pango_attr (attrs, pango_attr_underline_new (get_pango_underline_from_style (decoration_style)));
|
||||
if (!gdk_rgba_equal (color, decoration_color))
|
||||
attrs = add_pango_attr (attrs, pango_attr_underline_color_new (decoration_color->red * 65535. + 0.5,
|
||||
decoration_color->green * 65535. + 0.5,
|
||||
decoration_color->blue * 65535. + 0.5));
|
||||
}
|
||||
if (decoration_line & GTK_CSS_TEXT_DECORATION_LINE_OVERLINE)
|
||||
{
|
||||
attrs = add_pango_attr (attrs, pango_attr_overline_new (get_pango_overline_from_style (decoration_style)));
|
||||
if (!gdk_rgba_equal (color, decoration_color))
|
||||
attrs = add_pango_attr (attrs, pango_attr_overline_color_new (decoration_color->red * 65535. + 0.5,
|
||||
decoration_color->green * 65535. + 0.5,
|
||||
decoration_color->blue * 65535. + 0.5));
|
||||
}
|
||||
if (decoration_line & GTK_CSS_TEXT_DECORATION_LINE_LINE_THROUGH)
|
||||
{
|
||||
attrs = add_pango_attr (attrs, pango_attr_strikethrough_new (TRUE));
|
||||
if (!gdk_rgba_equal (color, decoration_color))
|
||||
attrs = add_pango_attr (attrs, pango_attr_strikethrough_color_new (decoration_color->red * 65535. + 0.5,
|
||||
decoration_color->green * 65535. + 0.5,
|
||||
decoration_color->blue * 65535. + 0.5));
|
||||
}
|
||||
|
||||
/* letter-spacing */
|
||||
letter_spacing = _gtk_css_number_value_get (style->font->letter_spacing, 100);
|
||||
if (letter_spacing != 0)
|
||||
{
|
||||
attrs = add_pango_attr (attrs, pango_attr_letter_spacing_new (letter_spacing * PANGO_SCALE));
|
||||
}
|
||||
|
||||
/* OpenType features */
|
||||
{
|
||||
char *font_features = gtk_css_style_compute_font_features (style);
|
||||
|
||||
if (font_features)
|
||||
{
|
||||
attrs = add_pango_attr (attrs, pango_attr_font_features_new (font_features));
|
||||
g_free (font_features);
|
||||
}
|
||||
}
|
||||
|
||||
return attrs;
|
||||
}
|
||||
|
||||
@@ -254,17 +254,17 @@ GtkCssValue * gtk_css_style_get_value (GtkCssStyle
|
||||
GtkCssSection * gtk_css_style_get_section (GtkCssStyle *style,
|
||||
guint id) G_GNUC_PURE;
|
||||
gboolean gtk_css_style_is_static (GtkCssStyle *style) G_GNUC_PURE;
|
||||
GtkCssStaticStyle * gtk_css_style_get_static_style (GtkCssStyle *style);
|
||||
|
||||
char * gtk_css_style_to_string (GtkCssStyle *style);
|
||||
gboolean gtk_css_style_print (GtkCssStyle *style,
|
||||
GString *string,
|
||||
guint indent,
|
||||
gboolean skip_initial);
|
||||
|
||||
char * gtk_css_style_compute_font_features (GtkCssStyle *style);
|
||||
PangoAttrList * gtk_css_style_get_pango_attributes (GtkCssStyle *style);
|
||||
|
||||
PangoFontDescription * gtk_css_style_get_pango_font (GtkCssStyle *style);
|
||||
GtkCssStaticStyle * gtk_css_style_get_static_style (GtkCssStyle *style);
|
||||
|
||||
|
||||
GtkCssValues *gtk_css_values_new (GtkCssValuesType type);
|
||||
GtkCssValues *gtk_css_values_ref (GtkCssValues *values);
|
||||
|
||||
+5
-1
@@ -945,11 +945,15 @@ gtk_editable_set_enable_undo (GtkEditable *editable,
|
||||
* @object_class: a `GObjectClass`
|
||||
* @first_prop: property ID to use for the first property
|
||||
*
|
||||
* Installs the `GtkEditable` properties for @class.
|
||||
* Overrides the `GtkEditable` properties for @class.
|
||||
*
|
||||
* This is a helper function that should be called in class_init,
|
||||
* after installing your own properties.
|
||||
*
|
||||
* Note that your class must have "text", "cursor-position",
|
||||
* "selection-bound", "editable", "width-chars", "max-width-chars",
|
||||
* "xalign" and "enable-undo" properties for this function to work.
|
||||
*
|
||||
* To handle the properties in your set_property and get_property
|
||||
* functions, you can either use [func@Gtk.Editable.delegate_set_property]
|
||||
* and [func@Gtk.Editable.delegate_get_property] (if you are using
|
||||
|
||||
+1
-1
@@ -2278,7 +2278,7 @@ gtk_entry_get_overwrite_mode (GtkEntry *entry)
|
||||
* Sets the maximum allowed length of the contents of the widget.
|
||||
*
|
||||
* If the current contents are longer than the given length, then
|
||||
* they will be truncated to fit.
|
||||
* they will be truncated to fit. The length is is in characters.
|
||||
*
|
||||
* This is equivalent to getting @entry's `GtkEntryBuffer` and
|
||||
* calling [method@Gtk.EntryBuffer.set_max_length] on it.
|
||||
|
||||
@@ -367,10 +367,10 @@ gtk_event_controller_handle_event (GtkEventController *controller,
|
||||
|
||||
g_object_ref (controller);
|
||||
retval = controller_class->handle_event (controller, event, x, y);
|
||||
g_object_unref (controller);
|
||||
|
||||
g_clear_object (&priv->target);
|
||||
g_clear_pointer (&priv->event, gdk_event_unref);
|
||||
g_object_unref (controller);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
+19
-6
@@ -582,6 +582,10 @@ gtk_expander_dispose (GObject *object)
|
||||
expander->expand_timer = 0;
|
||||
}
|
||||
|
||||
/* If the expander is not expanded, we own the child */
|
||||
if (!expander->expanded)
|
||||
g_clear_object (&expander->child);
|
||||
|
||||
if (expander->box)
|
||||
{
|
||||
gtk_widget_unparent (expander->box);
|
||||
@@ -900,6 +904,9 @@ gtk_expander_set_expanded (GtkExpander *expander,
|
||||
|
||||
if (child)
|
||||
{
|
||||
/* Transfer the ownership of the child to the box when
|
||||
* expanded is set, and then back to us when it is unset
|
||||
*/
|
||||
if (expander->expanded)
|
||||
{
|
||||
gtk_box_append (GTK_BOX (expander->box), child);
|
||||
@@ -1196,25 +1203,31 @@ gtk_expander_set_child (GtkExpander *expander,
|
||||
g_return_if_fail (GTK_IS_EXPANDER (expander));
|
||||
g_return_if_fail (child == NULL || GTK_IS_WIDGET (child));
|
||||
|
||||
if (expander->child == child)
|
||||
return;
|
||||
|
||||
if (expander->child)
|
||||
{
|
||||
gtk_box_remove (GTK_BOX (expander->box), expander->child);
|
||||
if (!expander->expanded)
|
||||
g_object_unref (expander->child);
|
||||
else
|
||||
gtk_box_remove (GTK_BOX (expander->box), expander->child);
|
||||
}
|
||||
|
||||
expander->child = child;
|
||||
|
||||
if (expander->child)
|
||||
{
|
||||
/* We only add the child to the box if the expander is
|
||||
* expanded; otherwise we just claim ownership of the
|
||||
* child by sinking its floating reference, or acquiring
|
||||
* an additional reference to it. The reference will be
|
||||
* dropped once the expander is expanded
|
||||
*/
|
||||
if (expander->expanded)
|
||||
gtk_box_append (GTK_BOX (expander->box), expander->child);
|
||||
else
|
||||
{
|
||||
if (g_object_is_floating (expander->child))
|
||||
g_object_ref_sink (expander->child);
|
||||
g_object_ref (expander->child);
|
||||
}
|
||||
g_object_ref_sink (expander->child);
|
||||
|
||||
gtk_accessible_update_relation (GTK_ACCESSIBLE (expander),
|
||||
GTK_ACCESSIBLE_RELATION_CONTROLS, expander->child, NULL,
|
||||
|
||||
@@ -79,6 +79,8 @@ filechooser_portal_data_free (FilechooserPortalData *data)
|
||||
if (data->exported_window)
|
||||
gtk_window_unexport_handle (data->exported_window);
|
||||
|
||||
g_clear_object (&data->exported_window);
|
||||
|
||||
g_free (data->portal_handle);
|
||||
|
||||
g_free (data);
|
||||
@@ -501,7 +503,7 @@ gtk_file_chooser_native_portal_show (GtkFileChooserNative *self,
|
||||
}
|
||||
else
|
||||
{
|
||||
data->exported_window = transient_for;
|
||||
data->exported_window = g_object_ref (transient_for);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -8028,15 +8028,15 @@ gtk_file_chooser_widget_set_choice (GtkFileChooser *chooser,
|
||||
if (GTK_IS_BOX (widget))
|
||||
{
|
||||
guint i;
|
||||
const char **choices;
|
||||
const char **options;
|
||||
GtkWidget *dropdown;
|
||||
|
||||
dropdown = gtk_widget_get_last_child (widget);
|
||||
|
||||
choices = (const char **) g_object_get_data (G_OBJECT (dropdown), "choices");
|
||||
for (i = 0; choices[i]; i++)
|
||||
options = (const char **) g_object_get_data (G_OBJECT (dropdown), "options");
|
||||
for (i = 0; options[i]; i++)
|
||||
{
|
||||
if (strcmp (option, choices[i]) == 0)
|
||||
if (strcmp (option, options[i]) == 0)
|
||||
{
|
||||
gtk_drop_down_set_selected (GTK_DROP_DOWN (dropdown), i);
|
||||
break;
|
||||
@@ -8060,10 +8060,13 @@ gtk_file_chooser_widget_get_choice (GtkFileChooser *chooser,
|
||||
widget = (GtkWidget *)g_hash_table_lookup (impl->choices, id);
|
||||
if (GTK_IS_DROP_DOWN (widget))
|
||||
{
|
||||
gpointer selected = gtk_drop_down_get_selected_item (GTK_DROP_DOWN (widget));
|
||||
if (GTK_IS_STRING_OBJECT (selected))
|
||||
return gtk_string_object_get_string (GTK_STRING_OBJECT (selected));
|
||||
return NULL;
|
||||
const char **options;
|
||||
guint selected;
|
||||
|
||||
options = (const char **) g_object_get_data (G_OBJECT (widget), "options");
|
||||
selected = gtk_drop_down_get_selected (GTK_DROP_DOWN (widget));
|
||||
|
||||
return options[selected];
|
||||
}
|
||||
else if (GTK_IS_CHECK_BUTTON (widget))
|
||||
{
|
||||
|
||||
+21
-3
@@ -461,6 +461,16 @@ gtk_font_button_activate (GtkFontButton *self)
|
||||
gtk_widget_activate (self->button);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_font_button_unrealize (GtkWidget *widget)
|
||||
{
|
||||
GtkFontButton *font_button = GTK_FONT_BUTTON (widget);
|
||||
|
||||
g_clear_pointer ((GtkWindow **) &font_button->font_dialog, gtk_window_destroy);
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_font_button_parent_class)->unrealize (widget);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_font_button_class_init (GtkFontButtonClass *klass)
|
||||
{
|
||||
@@ -476,6 +486,7 @@ gtk_font_button_class_init (GtkFontButtonClass *klass)
|
||||
|
||||
widget_class->grab_focus = gtk_widget_grab_focus_child;
|
||||
widget_class->focus = gtk_widget_focus_child;
|
||||
widget_class->unrealize = gtk_font_button_unrealize;
|
||||
|
||||
klass->font_set = NULL;
|
||||
klass->activate = gtk_font_button_activate;
|
||||
@@ -628,9 +639,6 @@ gtk_font_button_finalize (GObject *object)
|
||||
{
|
||||
GtkFontButton *font_button = GTK_FONT_BUTTON (object);
|
||||
|
||||
if (font_button->font_dialog != NULL)
|
||||
gtk_window_destroy (GTK_WINDOW (font_button->font_dialog));
|
||||
|
||||
g_free (font_button->title);
|
||||
|
||||
clear_font_data (font_button);
|
||||
@@ -968,6 +976,7 @@ gtk_font_button_clicked (GtkButton *button,
|
||||
font_button->font_dialog = gtk_font_chooser_dialog_new (font_button->title, NULL);
|
||||
gtk_window_set_hide_on_close (GTK_WINDOW (font_button->font_dialog), TRUE);
|
||||
gtk_window_set_modal (GTK_WINDOW (font_button->font_dialog), font_button->modal);
|
||||
gtk_window_set_display (GTK_WINDOW (font_button->font_dialog), gtk_widget_get_display (GTK_WIDGET (button)));
|
||||
|
||||
font_dialog = GTK_FONT_CHOOSER (font_button->font_dialog);
|
||||
|
||||
@@ -1181,8 +1190,17 @@ pango_font_description_to_css (PangoFontDescription *desc,
|
||||
g_string_append (s, "font-variant: normal; ");
|
||||
break;
|
||||
case PANGO_VARIANT_SMALL_CAPS:
|
||||
#if PANGO_VERSION_CHECK(1,49,3)
|
||||
case PANGO_VARIANT_ALL_SMALL_CAPS:
|
||||
case PANGO_VARIANT_PETITE_CAPS:
|
||||
case PANGO_VARIANT_ALL_PETITE_CAPS:
|
||||
#endif
|
||||
g_string_append (s, "font-variant: small-caps; ");
|
||||
break;
|
||||
#if PANGO_VERSION_CHECK(1,49,3)
|
||||
case PANGO_VARIANT_UNICASE:
|
||||
case PANGO_VARIANT_TITLE_CAPS:
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
+2
-2
@@ -6516,10 +6516,10 @@ gtk_icon_view_get_dest_item_at_pos (GtkIconView *icon_view,
|
||||
* @icon_view: a `GtkIconView`
|
||||
* @path: a `GtkTreePath` in @icon_view
|
||||
*
|
||||
* Creates a `cairo_surface_t` representation of the item at @path.
|
||||
* Creates a `GdkPaintable` representation of the item at @path.
|
||||
* This image is used for a drag icon.
|
||||
*
|
||||
* Returns: (transfer full): a newly-allocated surface of the drag icon.
|
||||
* Returns: (transfer full): a newly-allocated `GdkPaintable` of the drag icon.
|
||||
**/
|
||||
GdkPaintable *
|
||||
gtk_icon_view_create_drag_icon (GtkIconView *icon_view,
|
||||
|
||||
@@ -724,7 +724,7 @@ gtk_im_context_ime_focus_out (GtkIMContext *context)
|
||||
context_ime->priv->pretend_empty_preedit = FALSE;
|
||||
g_free (utf8str);
|
||||
}
|
||||
/* fallthrough */
|
||||
G_GNUC_FALLTHROUGH;
|
||||
case GTK_WIN32_IME_FOCUS_BEHAVIOR_DISCARD:
|
||||
gtk_im_context_ime_reset (context);
|
||||
|
||||
@@ -1054,7 +1054,7 @@ gtk_im_context_ime_message_filter (GdkWin32Display *display,
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
+19
-2
@@ -464,6 +464,7 @@ gtk_level_bar_allocate_trough_discrete (GtkLevelBar *self,
|
||||
GtkAllocation block_area;
|
||||
int num_blocks, i;
|
||||
int block_width, block_height;
|
||||
int extra_space;
|
||||
|
||||
gtk_level_bar_get_min_block_size (self, &block_width, &block_height);
|
||||
num_blocks = gtk_level_bar_get_num_blocks (self);
|
||||
@@ -473,13 +474,21 @@ gtk_level_bar_allocate_trough_discrete (GtkLevelBar *self,
|
||||
|
||||
if (self->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
{
|
||||
block_width = MAX (block_width, (int) floor (width / num_blocks));
|
||||
block_width = MAX (block_width, (int) floor ((double) width / num_blocks));
|
||||
block_height = height;
|
||||
extra_space = width - block_width * num_blocks;
|
||||
|
||||
if (extra_space > 0)
|
||||
block_width++;
|
||||
}
|
||||
else
|
||||
{
|
||||
block_width = width;
|
||||
block_height = MAX (block_height, (int) floor (height / num_blocks));
|
||||
block_height = MAX (block_height, (int) floor ((double) height / num_blocks));
|
||||
extra_space = height - block_height * num_blocks;
|
||||
|
||||
if (extra_space > 0)
|
||||
block_height++;
|
||||
}
|
||||
|
||||
block_area.x = 0;
|
||||
@@ -489,6 +498,14 @@ gtk_level_bar_allocate_trough_discrete (GtkLevelBar *self,
|
||||
|
||||
for (i = 0; i < num_blocks; i++)
|
||||
{
|
||||
if (extra_space > 0 && i == extra_space)
|
||||
{
|
||||
if (self->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
block_area.width--;
|
||||
else
|
||||
block_area.height--;
|
||||
}
|
||||
|
||||
gtk_widget_size_allocate (self->block_widget[i],
|
||||
&block_area,
|
||||
baseline);
|
||||
|
||||
+1
-1
@@ -362,7 +362,7 @@ enum_locale_proc (LPTSTR locale)
|
||||
|
||||
#endif
|
||||
|
||||
static void
|
||||
void
|
||||
setlocale_initialization (void)
|
||||
{
|
||||
static gboolean initialized = FALSE;
|
||||
|
||||
@@ -633,6 +633,10 @@ gtk_menu_button_init (GtkMenuButton *self)
|
||||
gtk_widget_set_sensitive (self->button, FALSE);
|
||||
|
||||
gtk_widget_add_css_class (GTK_WIDGET (self), "popup");
|
||||
|
||||
gtk_accessible_update_relation (GTK_ACCESSIBLE (self->button), GTK_ACCESSIBLE_RELATION_LABELLED_BY, self, NULL,
|
||||
GTK_ACCESSIBLE_RELATION_DESCRIBED_BY, self, NULL,
|
||||
-1);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -949,6 +953,9 @@ gtk_menu_button_set_icon_name (GtkMenuButton *menu_button,
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
gtk_widget_set_halign (box, GTK_ALIGN_CENTER);
|
||||
|
||||
// Because we are setting only an icon, let the inner button be labeled by us, so the accessible label can be overridden
|
||||
gtk_accessible_update_relation (GTK_ACCESSIBLE (menu_button->button), GTK_ACCESSIBLE_RELATION_LABELLED_BY, menu_button, NULL, -1);
|
||||
|
||||
image_widget = g_object_new (GTK_TYPE_IMAGE,
|
||||
"accessible-role", GTK_ACCESSIBLE_ROLE_PRESENTATION,
|
||||
"icon-name", icon_name,
|
||||
@@ -1071,6 +1078,9 @@ gtk_menu_button_set_label (GtkMenuButton *menu_button,
|
||||
gtk_button_set_child (GTK_BUTTON (menu_button->button), box);
|
||||
menu_button->label_widget = label_widget;
|
||||
|
||||
// When the user explicitly set a label assume that it should be announced by assistive technologies as well
|
||||
gtk_accessible_update_relation (GTK_ACCESSIBLE (menu_button->button), GTK_ACCESSIBLE_RELATION_LABELLED_BY, menu_button->label_widget, NULL, -1);
|
||||
|
||||
menu_button->image_widget = NULL;
|
||||
|
||||
update_arrow (menu_button);
|
||||
|
||||
@@ -262,6 +262,12 @@ attribute_from_text (GtkBuilder *builder,
|
||||
if (gtk_builder_value_from_string_type (builder, PANGO_TYPE_TEXT_TRANSFORM, value, &val, error))
|
||||
attribute = pango_attr_text_transform_new (g_value_get_enum (&val));
|
||||
break;
|
||||
#endif
|
||||
#if PANGO_VERSION_CHECK(1, 49, 1)
|
||||
case PANGO_ATTR_WORD:
|
||||
case PANGO_ATTR_SENTENCE:
|
||||
case PANGO_ATTR_BASELINE_SHIFT:
|
||||
case PANGO_ATTR_FONT_SCALE:
|
||||
#endif
|
||||
case PANGO_ATTR_INVALID:
|
||||
default:
|
||||
|
||||
@@ -150,6 +150,8 @@ GBytes *get_emoji_data (void);
|
||||
|
||||
char * _gtk_elide_underscores (const char *original);
|
||||
|
||||
void setlocale_initialization (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_PRIVATE_H__ */
|
||||
|
||||
@@ -366,6 +366,7 @@ gtk_search_bar_init (GtkSearchBar *bar)
|
||||
gtk_widget_set_hexpand (bar->box_center, TRUE);
|
||||
|
||||
bar->close_button = gtk_button_new_from_icon_name ("window-close-symbolic");
|
||||
gtk_widget_set_valign (bar->close_button, GTK_ALIGN_CENTER);
|
||||
gtk_widget_add_css_class (bar->close_button, "close");
|
||||
gtk_center_box_set_end_widget (GTK_CENTER_BOX (bar->box_center), bar->close_button);
|
||||
gtk_widget_hide (bar->close_button);
|
||||
|
||||
@@ -81,6 +81,7 @@ do_search (gpointer data)
|
||||
GtkSearchEngineModel *model = data;
|
||||
GtkTreeIter iter;
|
||||
GList *hits = NULL;
|
||||
gboolean got_results = FALSE;
|
||||
|
||||
if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (model->model), &iter))
|
||||
{
|
||||
@@ -107,11 +108,14 @@ do_search (gpointer data)
|
||||
{
|
||||
_gtk_search_engine_hits_added (GTK_SEARCH_ENGINE (model), hits);
|
||||
g_list_free_full (hits, (GDestroyNotify)_gtk_search_hit_free);
|
||||
got_results = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
model->idle = 0;
|
||||
|
||||
_gtk_search_engine_finished (GTK_SEARCH_ENGINE (model), got_results);
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
|
||||
+4
-3
@@ -690,13 +690,14 @@ gtk_stack_dispose (GObject *obj)
|
||||
GtkStack *stack = GTK_STACK (obj);
|
||||
GtkStackPrivate *priv = gtk_stack_get_instance_private (stack);
|
||||
GtkWidget *child;
|
||||
|
||||
if (priv->pages)
|
||||
g_list_model_items_changed (G_LIST_MODEL (priv->pages), 0, g_list_length (priv->children), 0);
|
||||
guint n_pages = g_list_length (priv->children);
|
||||
|
||||
while ((child = gtk_widget_get_first_child (GTK_WIDGET (stack))))
|
||||
stack_remove (stack, child, TRUE);
|
||||
|
||||
if (priv->pages)
|
||||
g_list_model_items_changed (G_LIST_MODEL (priv->pages), 0, n_pages, 0);
|
||||
|
||||
G_OBJECT_CLASS (gtk_stack_parent_class)->dispose (obj);
|
||||
}
|
||||
|
||||
|
||||
@@ -273,6 +273,8 @@ add_child (guint position,
|
||||
|
||||
button = g_object_new (GTK_TYPE_TOGGLE_BUTTON,
|
||||
"accessible-role", GTK_ACCESSIBLE_ROLE_TAB,
|
||||
"hexpand", TRUE,
|
||||
"vexpand", TRUE,
|
||||
NULL);
|
||||
gtk_widget_set_focus_on_click (button, FALSE);
|
||||
|
||||
|
||||
+1
-16
@@ -20,31 +20,16 @@
|
||||
#include "gtkstylecontextprivate.h"
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <gobject/gvaluecollector.h>
|
||||
|
||||
#include "gtkcsscolorvalueprivate.h"
|
||||
#include "gtkcssenumvalueprivate.h"
|
||||
#include "gtkcssimagevalueprivate.h"
|
||||
#include "gtkcssnodedeclarationprivate.h"
|
||||
#include "gtkcssnumbervalueprivate.h"
|
||||
#include "gtkcsscolorvalueprivate.h"
|
||||
#include "gtkcsscolorvalueprivate.h"
|
||||
#include "gtkcssstylepropertyprivate.h"
|
||||
#include "gtkcsstransientnodeprivate.h"
|
||||
#include "gtkcsswidgetnodeprivate.h"
|
||||
#include "gtkdebug.h"
|
||||
#include "gtkintl.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkrenderbackgroundprivate.h"
|
||||
#include "gtkrendericonprivate.h"
|
||||
#include "gtksettings.h"
|
||||
#include "gtksettingsprivate.h"
|
||||
#include "gtkstylecascadeprivate.h"
|
||||
#include "gtkstyleproviderprivate.h"
|
||||
#include "gtktypebuiltins.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
#include "gtksnapshot.h"
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
* adding `GtkStyleProviders`.
|
||||
*
|
||||
* GTK uses the `GtkStyleProvider` implementation for CSS in
|
||||
* [iface@Gtk.CssProvider].
|
||||
* [class@Gtk.CssProvider].
|
||||
*/
|
||||
|
||||
enum {
|
||||
|
||||
+49
-47
@@ -386,9 +386,9 @@ static void gtk_text_set_editable (GtkText *self,
|
||||
static void gtk_text_set_text (GtkText *self,
|
||||
const char *text);
|
||||
static void gtk_text_set_width_chars (GtkText *self,
|
||||
int n_chars);
|
||||
int n_chars);
|
||||
static void gtk_text_set_max_width_chars (GtkText *self,
|
||||
int n_chars);
|
||||
int n_chars);
|
||||
static void gtk_text_set_alignment (GtkText *self,
|
||||
float xalign);
|
||||
|
||||
@@ -415,7 +415,7 @@ static void gtk_text_toggle_overwrite (GtkText *self);
|
||||
static void gtk_text_insert_emoji (GtkText *self);
|
||||
static void gtk_text_select_all (GtkText *self);
|
||||
static void gtk_text_real_activate (GtkText *self);
|
||||
|
||||
|
||||
static void direction_changed (GdkDevice *keyboard,
|
||||
GParamSpec *pspec,
|
||||
GtkText *self);
|
||||
@@ -438,19 +438,19 @@ static gboolean gtk_text_delete_surrounding_cb (GtkIMContext *context,
|
||||
|
||||
/* Entry buffer signal handlers
|
||||
*/
|
||||
static void buffer_inserted_text (GtkEntryBuffer *buffer,
|
||||
static void buffer_inserted_text (GtkEntryBuffer *buffer,
|
||||
guint position,
|
||||
const char *chars,
|
||||
guint n_chars,
|
||||
GtkText *self);
|
||||
static void buffer_deleted_text (GtkEntryBuffer *buffer,
|
||||
static void buffer_deleted_text (GtkEntryBuffer *buffer,
|
||||
guint position,
|
||||
guint n_chars,
|
||||
GtkText *self);
|
||||
static void buffer_notify_text (GtkEntryBuffer *buffer,
|
||||
static void buffer_notify_text (GtkEntryBuffer *buffer,
|
||||
GParamSpec *spec,
|
||||
GtkText *self);
|
||||
static void buffer_notify_max_length (GtkEntryBuffer *buffer,
|
||||
static void buffer_notify_max_length (GtkEntryBuffer *buffer,
|
||||
GParamSpec *spec,
|
||||
GtkText *self);
|
||||
|
||||
@@ -700,7 +700,7 @@ add_move_binding (GtkWidgetClass *widget_class,
|
||||
int count)
|
||||
{
|
||||
g_return_if_fail ((modmask & GDK_SHIFT_MASK) == 0);
|
||||
|
||||
|
||||
gtk_widget_class_add_binding_signal (widget_class,
|
||||
keyval, modmask,
|
||||
"move-cursor",
|
||||
@@ -997,7 +997,7 @@ gtk_text_class_init (GtkTextClass *class)
|
||||
gtk_editable_install_properties (gobject_class, NUM_PROPERTIES);
|
||||
|
||||
/* Action signals */
|
||||
|
||||
|
||||
/**
|
||||
* GtkText::activate:
|
||||
* @self: The widget on which the signal is emitted
|
||||
@@ -1044,7 +1044,7 @@ gtk_text_class_init (GtkTextClass *class)
|
||||
* - <kbd>Ctrl</kbd>-<kbd>→</kbd>, etc. move by words/paragraphs
|
||||
* - <kbd>Home</kbd>, <kbd>End</kbd> move to the ends of the buffer
|
||||
*/
|
||||
signals[MOVE_CURSOR] =
|
||||
signals[MOVE_CURSOR] =
|
||||
g_signal_new (I_("move-cursor"),
|
||||
G_OBJECT_CLASS_TYPE (gobject_class),
|
||||
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
|
||||
@@ -1068,7 +1068,7 @@ gtk_text_class_init (GtkTextClass *class)
|
||||
*
|
||||
* This signal has no default bindings.
|
||||
*/
|
||||
signals[INSERT_AT_CURSOR] =
|
||||
signals[INSERT_AT_CURSOR] =
|
||||
g_signal_new (I_("insert-at-cursor"),
|
||||
G_OBJECT_CLASS_TYPE (gobject_class),
|
||||
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
|
||||
@@ -1096,7 +1096,7 @@ gtk_text_class_init (GtkTextClass *class)
|
||||
* for deleting a character and <kbd>Ctrl</kbd>-<kbd>Delete</kbd>
|
||||
* for deleting a word.
|
||||
*/
|
||||
signals[DELETE_FROM_CURSOR] =
|
||||
signals[DELETE_FROM_CURSOR] =
|
||||
g_signal_new (I_("delete-from-cursor"),
|
||||
G_OBJECT_CLASS_TYPE (gobject_class),
|
||||
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
|
||||
@@ -1249,7 +1249,7 @@ gtk_text_class_init (GtkTextClass *class)
|
||||
NULL, NULL,
|
||||
NULL,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
@@ -1281,7 +1281,7 @@ gtk_text_class_init (GtkTextClass *class)
|
||||
/**
|
||||
* GtkText|selection.delete:
|
||||
*
|
||||
* Deletes the current selection.
|
||||
* Deletes the current selection.
|
||||
*/
|
||||
gtk_widget_class_install_action (widget_class, "selection.delete", NULL,
|
||||
gtk_text_activate_selection_delete);
|
||||
@@ -1306,7 +1306,7 @@ gtk_text_class_init (GtkTextClass *class)
|
||||
* GtkText|misc.toggle-visibility:
|
||||
*
|
||||
* Toggles the `GtkText`:visibility property.
|
||||
*/
|
||||
*/
|
||||
gtk_widget_class_install_property_action (widget_class,
|
||||
"misc.toggle-visibility",
|
||||
"visibility");
|
||||
@@ -1315,7 +1315,7 @@ gtk_text_class_init (GtkTextClass *class)
|
||||
* GtkText|text.undo:
|
||||
*
|
||||
* Undoes the last change to the contents.
|
||||
*/
|
||||
*/
|
||||
gtk_widget_class_install_action (widget_class, "text.undo", NULL, gtk_text_real_undo);
|
||||
|
||||
/**
|
||||
@@ -1328,8 +1328,8 @@ gtk_text_class_init (GtkTextClass *class)
|
||||
/**
|
||||
* GtkText|menu.popup:
|
||||
*
|
||||
* Opens the context menu.
|
||||
*/
|
||||
* Opens the context menu.
|
||||
*/
|
||||
gtk_widget_class_install_action (widget_class, "menu.popup", NULL, gtk_text_popup_menu);
|
||||
|
||||
/*
|
||||
@@ -1348,16 +1348,16 @@ gtk_text_class_init (GtkTextClass *class)
|
||||
/* Moving the insertion point */
|
||||
add_move_binding (widget_class, GDK_KEY_Right, 0,
|
||||
GTK_MOVEMENT_VISUAL_POSITIONS, 1);
|
||||
|
||||
|
||||
add_move_binding (widget_class, GDK_KEY_Left, 0,
|
||||
GTK_MOVEMENT_VISUAL_POSITIONS, -1);
|
||||
|
||||
add_move_binding (widget_class, GDK_KEY_KP_Right, 0,
|
||||
GTK_MOVEMENT_VISUAL_POSITIONS, 1);
|
||||
|
||||
|
||||
add_move_binding (widget_class, GDK_KEY_KP_Left, 0,
|
||||
GTK_MOVEMENT_VISUAL_POSITIONS, -1);
|
||||
|
||||
|
||||
add_move_binding (widget_class, GDK_KEY_Right, GDK_CONTROL_MASK,
|
||||
GTK_MOVEMENT_WORDS, 1);
|
||||
|
||||
@@ -1369,7 +1369,7 @@ gtk_text_class_init (GtkTextClass *class)
|
||||
|
||||
add_move_binding (widget_class, GDK_KEY_KP_Left, GDK_CONTROL_MASK,
|
||||
GTK_MOVEMENT_WORDS, -1);
|
||||
|
||||
|
||||
add_move_binding (widget_class, GDK_KEY_Home, 0,
|
||||
GTK_MOVEMENT_DISPLAY_LINE_ENDS, -1);
|
||||
|
||||
@@ -1381,7 +1381,7 @@ gtk_text_class_init (GtkTextClass *class)
|
||||
|
||||
add_move_binding (widget_class, GDK_KEY_KP_End, 0,
|
||||
GTK_MOVEMENT_DISPLAY_LINE_ENDS, 1);
|
||||
|
||||
|
||||
add_move_binding (widget_class, GDK_KEY_Home, GDK_CONTROL_MASK,
|
||||
GTK_MOVEMENT_BUFFER_ENDS, -1);
|
||||
|
||||
@@ -1405,7 +1405,7 @@ gtk_text_class_init (GtkTextClass *class)
|
||||
GDK_KEY_slash, GDK_CONTROL_MASK,
|
||||
(GtkShortcutFunc) gtk_text_select_all,
|
||||
NULL);
|
||||
/* Unselect all
|
||||
/* Unselect all
|
||||
*/
|
||||
gtk_widget_class_add_binding_signal (widget_class,
|
||||
GDK_KEY_backslash, GDK_CONTROL_MASK,
|
||||
@@ -1427,7 +1427,7 @@ gtk_text_class_init (GtkTextClass *class)
|
||||
gtk_widget_class_add_binding_signal (widget_class, GDK_KEY_KP_Enter, 0,
|
||||
"activate",
|
||||
NULL);
|
||||
|
||||
|
||||
/* Deleting text */
|
||||
gtk_widget_class_add_binding_signal (widget_class,
|
||||
GDK_KEY_Delete, 0,
|
||||
@@ -1438,7 +1438,7 @@ gtk_text_class_init (GtkTextClass *class)
|
||||
GDK_KEY_KP_Delete, 0,
|
||||
"delete-from-cursor",
|
||||
"(ii)", GTK_DELETE_CHARS, 1);
|
||||
|
||||
|
||||
gtk_widget_class_add_binding_signal (widget_class,
|
||||
GDK_KEY_BackSpace, 0,
|
||||
"backspace",
|
||||
@@ -1464,7 +1464,7 @@ gtk_text_class_init (GtkTextClass *class)
|
||||
GDK_KEY_KP_Delete, GDK_CONTROL_MASK,
|
||||
"delete-from-cursor",
|
||||
"(ii)", GTK_DELETE_WORD_ENDS, 1);
|
||||
|
||||
|
||||
gtk_widget_class_add_binding_signal (widget_class,
|
||||
GDK_KEY_BackSpace, GDK_CONTROL_MASK,
|
||||
"delete-from-cursor",
|
||||
@@ -2233,7 +2233,7 @@ gtk_text_unrealize (GtkWidget *widget)
|
||||
GdkClipboard *clipboard;
|
||||
|
||||
gtk_text_reset_layout (self);
|
||||
|
||||
|
||||
gtk_im_context_set_client_widget (priv->im_context, NULL);
|
||||
|
||||
clipboard = gtk_widget_get_primary_clipboard (widget);
|
||||
@@ -2619,14 +2619,14 @@ gtk_text_get_pixel_ranges (GtkText *self,
|
||||
if (ranges)
|
||||
{
|
||||
int *r = *ranges;
|
||||
|
||||
|
||||
for (i = 0; i < real_n_ranges; ++i)
|
||||
{
|
||||
r[2 * i + 1] = (r[2 * i + 1] - r[2 * i]) / PANGO_SCALE;
|
||||
r[2 * i] = r[2 * i] / PANGO_SCALE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (n_ranges)
|
||||
*n_ranges = real_n_ranges;
|
||||
}
|
||||
@@ -3531,7 +3531,7 @@ gtk_text_update_cached_style_values (GtkText *self)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
gtk_text_css_changed (GtkWidget *widget,
|
||||
GtkCssStyleChange *change)
|
||||
{
|
||||
@@ -3809,7 +3809,7 @@ gtk_text_move_cursor (GtkText *self,
|
||||
|
||||
if (count <= 0)
|
||||
new_pos = current_x < bound_x ? priv->current_pos : priv->selection_bound;
|
||||
else
|
||||
else
|
||||
new_pos = current_x > bound_x ? priv->current_pos : priv->selection_bound;
|
||||
}
|
||||
break;
|
||||
@@ -3919,7 +3919,7 @@ gtk_text_move_cursor (GtkText *self,
|
||||
gtk_text_set_selection_bounds (self, priv->selection_bound, new_pos);
|
||||
else
|
||||
gtk_text_set_selection_bounds (self, new_pos, new_pos);
|
||||
|
||||
|
||||
gtk_text_pend_cursor_blink (self);
|
||||
}
|
||||
|
||||
@@ -3961,7 +3961,7 @@ gtk_text_delete_from_cursor (GtkText *self,
|
||||
gtk_text_delete_selection (self);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case GTK_DELETE_CHARS:
|
||||
@@ -4595,7 +4595,7 @@ get_layout_position (GtkText *self,
|
||||
y_pos = 0;
|
||||
else if (y_pos + logical_rect.height > area_height)
|
||||
y_pos = area_height - logical_rect.height;
|
||||
|
||||
|
||||
y_pos = y_pos / PANGO_SCALE;
|
||||
|
||||
if (x)
|
||||
@@ -4853,7 +4853,7 @@ gtk_text_find_position (GtkText *self,
|
||||
int trailing;
|
||||
const char *text;
|
||||
int cursor_index;
|
||||
|
||||
|
||||
layout = gtk_text_ensure_layout (self, TRUE);
|
||||
text = pango_layout_get_text (layout);
|
||||
cursor_index = g_utf8_offset_to_pointer (text, priv->current_pos) - text;
|
||||
@@ -4891,7 +4891,7 @@ gtk_text_get_cursor_locations (GtkText *self,
|
||||
{
|
||||
if (strong_x)
|
||||
*strong_x = 0;
|
||||
|
||||
|
||||
if (weak_x)
|
||||
*weak_x = 0;
|
||||
}
|
||||
@@ -4901,14 +4901,14 @@ gtk_text_get_cursor_locations (GtkText *self,
|
||||
const char *text = pango_layout_get_text (layout);
|
||||
PangoRectangle strong_pos, weak_pos;
|
||||
int index;
|
||||
|
||||
|
||||
index = g_utf8_offset_to_pointer (text, priv->current_pos + priv->preedit_cursor) - text;
|
||||
|
||||
pango_layout_get_cursor_pos (layout, index, &strong_pos, &weak_pos);
|
||||
|
||||
|
||||
if (strong_x)
|
||||
*strong_x = strong_pos.x / PANGO_SCALE;
|
||||
|
||||
|
||||
if (weak_x)
|
||||
*weak_x = weak_pos.x / PANGO_SCALE;
|
||||
}
|
||||
@@ -5135,7 +5135,7 @@ gtk_text_move_logically (GtkText *self,
|
||||
do
|
||||
new_pos++;
|
||||
while (new_pos < length && !log_attrs[new_pos].is_cursor_position);
|
||||
|
||||
|
||||
count--;
|
||||
}
|
||||
while (count < 0 && new_pos > 0)
|
||||
@@ -5143,7 +5143,7 @@ gtk_text_move_logically (GtkText *self,
|
||||
do
|
||||
new_pos--;
|
||||
while (new_pos > 0 && !log_attrs[new_pos].is_cursor_position);
|
||||
|
||||
|
||||
count++;
|
||||
}
|
||||
}
|
||||
@@ -5208,7 +5208,7 @@ gtk_text_move_backward_word (GtkText *self,
|
||||
new_pos = start - 1;
|
||||
|
||||
/* Find the previous word boundary */
|
||||
while (new_pos > 0 && !(log_attrs[new_pos].is_word_start ||
|
||||
while (new_pos > 0 && !(log_attrs[new_pos].is_word_start ||
|
||||
(log_attrs[new_pos].is_word_end && allow_whitespace)))
|
||||
new_pos--;
|
||||
}
|
||||
@@ -5295,7 +5295,7 @@ paste_received (GObject *clipboard,
|
||||
gtk_text_set_selection_bounds (self, pos, pos);
|
||||
priv->insert_pos = -1;
|
||||
}
|
||||
|
||||
|
||||
if (priv->truncate_multiline)
|
||||
length = truncate_multiline (text);
|
||||
|
||||
@@ -5329,7 +5329,7 @@ gtk_text_update_primary_selection (GtkText *self)
|
||||
return;
|
||||
|
||||
clipboard = gtk_widget_get_primary_clipboard (GTK_WIDGET (self));
|
||||
|
||||
|
||||
if (priv->selection_bound != priv->current_pos)
|
||||
{
|
||||
gdk_clipboard_set_content (clipboard, priv->selection_content);
|
||||
@@ -5448,6 +5448,8 @@ gtk_text_set_buffer (GtkText *self,
|
||||
buffer_connect_signals (self);
|
||||
}
|
||||
|
||||
update_placeholder_visibility (self);
|
||||
|
||||
obj = G_OBJECT (self);
|
||||
g_object_freeze_notify (obj);
|
||||
g_object_notify_by_pspec (obj, text_props[PROP_BUFFER]);
|
||||
@@ -5884,7 +5886,7 @@ PangoLayout *
|
||||
gtk_text_get_layout (GtkText *self)
|
||||
{
|
||||
PangoLayout *layout;
|
||||
|
||||
|
||||
g_return_val_if_fail (GTK_IS_TEXT (self), NULL);
|
||||
|
||||
layout = gtk_text_ensure_layout (self, TRUE);
|
||||
@@ -6339,7 +6341,7 @@ gtk_text_drag_drop (GtkDropTarget *dest,
|
||||
gtk_editable_insert_text (GTK_EDITABLE (self), str, length, &pos);
|
||||
end_change (self);
|
||||
}
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -4713,6 +4713,12 @@ insert_tags_for_attributes (GtkTextBuffer *buffer,
|
||||
|
||||
#if PANGO_VERSION_CHECK(1, 49, 0)
|
||||
case PANGO_ATTR_TEXT_TRANSFORM:
|
||||
#endif
|
||||
#if PANGO_VERSION_CHECK(1, 49, 1)
|
||||
case PANGO_ATTR_WORD:
|
||||
case PANGO_ATTR_SENTENCE:
|
||||
case PANGO_ATTR_BASELINE_SHIFT:
|
||||
case PANGO_ATTR_FONT_SCALE:
|
||||
break;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -224,6 +224,12 @@ action_chain (Action *action,
|
||||
|
||||
if (other->kind == ACTION_KIND_BARRIER)
|
||||
{
|
||||
/* If we're not in a user action, this barrier is meant to
|
||||
* stop items from coallescing into this group.
|
||||
*/
|
||||
if (!in_user_action && action->u.group.depth == 0)
|
||||
return FALSE;
|
||||
|
||||
action_free (other);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
+162
-20
@@ -57,6 +57,7 @@
|
||||
#include "gtknative.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
#include "gtkjoinedmenuprivate.h"
|
||||
#include "gtkcssenumvalueprivate.h"
|
||||
|
||||
/**
|
||||
* GtkTextView:
|
||||
@@ -394,6 +395,8 @@ static void gtk_text_view_css_changed (GtkWidget *widget,
|
||||
GtkCssStyleChange *change);
|
||||
static void gtk_text_view_direction_changed (GtkWidget *widget,
|
||||
GtkTextDirection previous_direction);
|
||||
static void gtk_text_view_system_setting_changed (GtkWidget *widget,
|
||||
GtkSystemSetting setting);
|
||||
static void gtk_text_view_state_flags_changed (GtkWidget *widget,
|
||||
GtkStateFlags previous_state);
|
||||
|
||||
@@ -570,6 +573,7 @@ static void gtk_text_view_update_im_spot_location (GtkTextView *text_view);
|
||||
static void gtk_text_view_insert_emoji (GtkTextView *text_view);
|
||||
|
||||
static void update_node_ordering (GtkWidget *widget);
|
||||
static void gtk_text_view_update_pango_contexts (GtkTextView *text_view);
|
||||
|
||||
/* GtkTextHandle handlers */
|
||||
static void gtk_text_view_handle_drag_started (GtkTextHandle *handle,
|
||||
@@ -816,6 +820,7 @@ gtk_text_view_class_init (GtkTextViewClass *klass)
|
||||
widget_class->map = gtk_text_view_map;
|
||||
widget_class->css_changed = gtk_text_view_css_changed;
|
||||
widget_class->direction_changed = gtk_text_view_direction_changed;
|
||||
widget_class->system_setting_changed = gtk_text_view_system_setting_changed;
|
||||
widget_class->state_flags_changed = gtk_text_view_state_flags_changed;
|
||||
widget_class->measure = gtk_text_view_measure;
|
||||
widget_class->size_allocate = gtk_text_view_size_allocate;
|
||||
@@ -4981,7 +4986,6 @@ gtk_text_view_css_changed (GtkWidget *widget,
|
||||
{
|
||||
GtkTextView *text_view;
|
||||
GtkTextViewPrivate *priv;
|
||||
PangoContext *ltr_context, *rtl_context;
|
||||
|
||||
text_view = GTK_TEXT_VIEW (widget);
|
||||
priv = text_view->priv;
|
||||
@@ -4990,6 +4994,7 @@ gtk_text_view_css_changed (GtkWidget *widget,
|
||||
|
||||
if ((change == NULL ||
|
||||
gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_TEXT |
|
||||
GTK_CSS_AFFECTS_TEXT_ATTRS |
|
||||
GTK_CSS_AFFECTS_BACKGROUND |
|
||||
GTK_CSS_AFFECTS_CONTENT)) &&
|
||||
priv->layout && priv->layout->default_style)
|
||||
@@ -4997,16 +5002,13 @@ gtk_text_view_css_changed (GtkWidget *widget,
|
||||
gtk_text_view_set_attributes_from_style (text_view,
|
||||
priv->layout->default_style);
|
||||
gtk_text_layout_default_style_changed (priv->layout);
|
||||
}
|
||||
|
||||
ltr_context = gtk_widget_create_pango_context (widget);
|
||||
pango_context_set_base_dir (ltr_context, PANGO_DIRECTION_LTR);
|
||||
rtl_context = gtk_widget_create_pango_context (widget);
|
||||
pango_context_set_base_dir (rtl_context, PANGO_DIRECTION_RTL);
|
||||
|
||||
gtk_text_layout_set_contexts (priv->layout, ltr_context, rtl_context);
|
||||
|
||||
g_object_unref (ltr_context);
|
||||
g_object_unref (rtl_context);
|
||||
if ((change == NULL ||
|
||||
gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_TEXT)) &&
|
||||
priv->layout)
|
||||
{
|
||||
gtk_text_view_update_pango_contexts (text_view);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5024,6 +5026,42 @@ gtk_text_view_direction_changed (GtkWidget *widget,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_text_view_update_pango_contexts (GtkTextView *text_view)
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET (text_view);
|
||||
GtkTextViewPrivate *priv = text_view->priv;
|
||||
gboolean update_ltr, update_rtl;
|
||||
|
||||
if (!priv->layout)
|
||||
return;
|
||||
|
||||
update_ltr = gtk_widget_update_pango_context (widget, priv->layout->ltr_context, GTK_TEXT_DIR_LTR);
|
||||
|
||||
update_rtl = gtk_widget_update_pango_context (widget, priv->layout->rtl_context, GTK_TEXT_DIR_RTL);
|
||||
|
||||
if (update_ltr || update_rtl)
|
||||
{
|
||||
GtkTextIter start, end;
|
||||
|
||||
gtk_text_buffer_get_bounds (get_buffer (text_view), &start, &end);
|
||||
gtk_text_layout_invalidate (priv->layout, &start, &end);
|
||||
gtk_widget_queue_draw (widget);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_text_view_system_setting_changed (GtkWidget *widget,
|
||||
GtkSystemSetting setting)
|
||||
{
|
||||
if (setting == GTK_SYSTEM_SETTING_DPI ||
|
||||
setting == GTK_SYSTEM_SETTING_FONT_NAME ||
|
||||
setting == GTK_SYSTEM_SETTING_FONT_CONFIG)
|
||||
{
|
||||
gtk_text_view_update_pango_contexts (GTK_TEXT_VIEW (widget));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_text_view_state_flags_changed (GtkWidget *widget,
|
||||
GtkStateFlags previous_state)
|
||||
@@ -6162,7 +6200,7 @@ gtk_text_view_check_cursor_blink (GtkTextView *text_view)
|
||||
static void
|
||||
gtk_text_view_pend_cursor_blink (GtkTextView *text_view)
|
||||
{
|
||||
if (cursor_blinks (text_view))
|
||||
if (cursor_blinks (text_view) && cursor_visible (text_view))
|
||||
{
|
||||
remove_blink_timeout (text_view);
|
||||
add_blink_timeout (text_view, TRUE);
|
||||
@@ -7633,6 +7671,29 @@ gtk_text_view_end_selection_drag (GtkTextView *text_view)
|
||||
* Layout utils
|
||||
*/
|
||||
|
||||
static PangoUnderline
|
||||
get_pango_underline_from_style (GtkTextDecorationStyle style)
|
||||
{
|
||||
switch (style)
|
||||
{
|
||||
case GTK_CSS_TEXT_DECORATION_STYLE_DOUBLE:
|
||||
return PANGO_UNDERLINE_DOUBLE;
|
||||
case GTK_CSS_TEXT_DECORATION_STYLE_WAVY:
|
||||
return PANGO_UNDERLINE_ERROR;
|
||||
case GTK_CSS_TEXT_DECORATION_STYLE_SOLID:
|
||||
default:
|
||||
return PANGO_UNDERLINE_SINGLE;
|
||||
}
|
||||
|
||||
g_return_val_if_reached (PANGO_UNDERLINE_SINGLE);
|
||||
}
|
||||
|
||||
static PangoOverline
|
||||
get_pango_overline_from_style (GtkTextDecorationStyle style)
|
||||
{
|
||||
return PANGO_OVERLINE_SINGLE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_text_view_set_attributes_from_style (GtkTextView *text_view,
|
||||
GtkTextAttributes *values)
|
||||
@@ -7640,6 +7701,9 @@ gtk_text_view_set_attributes_from_style (GtkTextView *text_view,
|
||||
GtkCssStyle *style;
|
||||
const GdkRGBA black = { 0, };
|
||||
const GdkRGBA *color;
|
||||
const GdkRGBA *decoration_color;
|
||||
GtkTextDecorationLine decoration_line;
|
||||
GtkTextDecorationStyle decoration_style;
|
||||
|
||||
if (!values->appearance.bg_rgba)
|
||||
values->appearance.bg_rgba = gdk_rgba_copy (&black);
|
||||
@@ -7657,6 +7721,69 @@ gtk_text_view_set_attributes_from_style (GtkTextView *text_view,
|
||||
pango_font_description_free (values->font);
|
||||
|
||||
values->font = gtk_css_style_get_pango_font (style);
|
||||
|
||||
values->letter_spacing = _gtk_css_number_value_get (style->font->letter_spacing, 100) * PANGO_SCALE;
|
||||
|
||||
/* text-decoration */
|
||||
|
||||
decoration_line = _gtk_css_text_decoration_line_value_get (style->font_variant->text_decoration_line);
|
||||
decoration_style = _gtk_css_text_decoration_style_value_get (style->font_variant->text_decoration_style);
|
||||
color = gtk_css_color_value_get_rgba (style->core->color);
|
||||
decoration_color = gtk_css_color_value_get_rgba (style->font_variant->text_decoration_color
|
||||
? style->font_variant->text_decoration_color
|
||||
: style->core->color);
|
||||
|
||||
if (decoration_line & GTK_CSS_TEXT_DECORATION_LINE_UNDERLINE)
|
||||
{
|
||||
values->appearance.underline = get_pango_underline_from_style (decoration_style);
|
||||
if (values->appearance.underline_rgba)
|
||||
*values->appearance.underline_rgba = *decoration_color;
|
||||
else
|
||||
values->appearance.underline_rgba = gdk_rgba_copy (decoration_color);
|
||||
}
|
||||
else
|
||||
{
|
||||
values->appearance.underline = PANGO_UNDERLINE_NONE;
|
||||
gdk_rgba_free (values->appearance.underline_rgba);
|
||||
values->appearance.underline_rgba = NULL;
|
||||
}
|
||||
|
||||
if (decoration_line & GTK_CSS_TEXT_DECORATION_LINE_OVERLINE)
|
||||
{
|
||||
values->appearance.overline = get_pango_overline_from_style (decoration_style);
|
||||
if (values->appearance.overline_rgba)
|
||||
*values->appearance.overline_rgba = *decoration_color;
|
||||
else
|
||||
values->appearance.overline_rgba = gdk_rgba_copy (decoration_color);
|
||||
}
|
||||
else
|
||||
{
|
||||
values->appearance.overline = PANGO_OVERLINE_NONE;
|
||||
gdk_rgba_free (values->appearance.overline_rgba);
|
||||
values->appearance.overline_rgba = NULL;
|
||||
}
|
||||
|
||||
if (decoration_line & GTK_CSS_TEXT_DECORATION_LINE_LINE_THROUGH)
|
||||
{
|
||||
values->appearance.strikethrough = TRUE;
|
||||
if (values->appearance.strikethrough_rgba)
|
||||
*values->appearance.strikethrough_rgba = *decoration_color;
|
||||
else
|
||||
values->appearance.strikethrough_rgba = gdk_rgba_copy (decoration_color);
|
||||
}
|
||||
else
|
||||
{
|
||||
values->appearance.strikethrough = FALSE;
|
||||
gdk_rgba_free (values->appearance.strikethrough_rgba);
|
||||
values->appearance.strikethrough_rgba = NULL;
|
||||
}
|
||||
|
||||
/* letter-spacing */
|
||||
values->letter_spacing = _gtk_css_number_value_get (style->font->letter_spacing, 100) * PANGO_SCALE;
|
||||
|
||||
/* OpenType features */
|
||||
g_free (values->font_features);
|
||||
values->font_features = gtk_css_style_compute_font_features (style);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -7715,8 +7842,8 @@ gtk_text_view_ensure_layout (GtkTextView *text_view)
|
||||
if (priv->layout == NULL)
|
||||
{
|
||||
GtkTextAttributes *style;
|
||||
PangoContext *ltr_context, *rtl_context;
|
||||
const GList *iter;
|
||||
PangoContext *ltr_context, *rtl_context;
|
||||
|
||||
DV(g_print(G_STRLOC"\n"));
|
||||
|
||||
@@ -7749,15 +7876,15 @@ gtk_text_view_ensure_layout (GtkTextView *text_view)
|
||||
priv->overwrite_mode && priv->editable);
|
||||
|
||||
ltr_context = gtk_widget_create_pango_context (GTK_WIDGET (text_view));
|
||||
pango_context_set_base_dir (ltr_context, PANGO_DIRECTION_LTR);
|
||||
rtl_context = gtk_widget_create_pango_context (GTK_WIDGET (text_view));
|
||||
pango_context_set_base_dir (ltr_context, PANGO_DIRECTION_LTR);
|
||||
pango_context_set_base_dir (rtl_context, PANGO_DIRECTION_RTL);
|
||||
|
||||
gtk_text_layout_set_contexts (priv->layout, ltr_context, rtl_context);
|
||||
|
||||
g_object_unref (ltr_context);
|
||||
g_object_unref (rtl_context);
|
||||
|
||||
gtk_text_view_update_pango_contexts (text_view);
|
||||
|
||||
gtk_text_view_check_keymap_direction (text_view);
|
||||
|
||||
style = gtk_text_attributes_new ();
|
||||
@@ -8310,17 +8437,32 @@ gtk_text_view_commit_text (GtkTextView *text_view,
|
||||
{
|
||||
GtkTextViewPrivate *priv;
|
||||
gboolean had_selection;
|
||||
GtkTextIter begin, end;
|
||||
guint length;
|
||||
|
||||
priv = text_view->priv;
|
||||
|
||||
gtk_text_view_obscure_mouse_cursor (text_view);
|
||||
gtk_text_buffer_begin_user_action (get_buffer (text_view));
|
||||
|
||||
had_selection = gtk_text_buffer_get_selection_bounds (get_buffer (text_view),
|
||||
NULL, NULL);
|
||||
|
||||
gtk_text_buffer_delete_selection (get_buffer (text_view), TRUE,
|
||||
priv->editable);
|
||||
had_selection = gtk_text_buffer_get_selection_bounds (get_buffer (text_view), &begin, &end);
|
||||
gtk_text_iter_order (&begin, &end);
|
||||
length = gtk_text_iter_get_offset (&end) - gtk_text_iter_get_offset (&begin);
|
||||
|
||||
if (gtk_text_buffer_delete_selection (get_buffer (text_view), TRUE, priv->editable))
|
||||
{
|
||||
/* If something was deleted, create a second group for the insert. This
|
||||
* ensures that there are two undo operations. One for the deletion, and
|
||||
* one for the insertion of new text. However, if there is only a single
|
||||
* character overwritten, that isn't very useful, just keep the single
|
||||
* undo group.
|
||||
*/
|
||||
if (length > 1)
|
||||
{
|
||||
gtk_text_buffer_end_user_action (get_buffer (text_view));
|
||||
gtk_text_buffer_begin_user_action (get_buffer (text_view));
|
||||
}
|
||||
}
|
||||
|
||||
if (!strcmp (str, "\n"))
|
||||
{
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@
|
||||
* etc. It supports autoplay, looping, and simple media controls. It does
|
||||
* not have support for video overlays, multichannel audio, device
|
||||
* selection, or input. If you are writing a full-fledged video player,
|
||||
* you may want to use the [class@Gdk.Paintable] API and a media framework
|
||||
* you may want to use the [iface@Gdk.Paintable] API and a media framework
|
||||
* such as Gstreamer directly.
|
||||
*/
|
||||
|
||||
|
||||
+29
-19
@@ -572,7 +572,7 @@ static void gtk_widget_pop_verify_invariants (GtkWidget
|
||||
#define gtk_widget_pop_verify_invariants(widget)
|
||||
#endif
|
||||
static PangoContext* gtk_widget_peek_pango_context (GtkWidget *widget);
|
||||
static void gtk_widget_update_pango_context (GtkWidget *widget);
|
||||
static void gtk_widget_update_default_pango_context (GtkWidget *widget);
|
||||
static void gtk_widget_propagate_state (GtkWidget *widget,
|
||||
const GtkStateData *data);
|
||||
static gboolean gtk_widget_real_mnemonic_activate (GtkWidget *widget,
|
||||
@@ -4957,7 +4957,7 @@ gtk_widget_real_css_changed (GtkWidget *widget,
|
||||
const gboolean has_text = gtk_widget_peek_pango_context (widget) != NULL;
|
||||
|
||||
if (has_text && gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_TEXT))
|
||||
gtk_widget_update_pango_context (widget);
|
||||
gtk_widget_update_default_pango_context (widget);
|
||||
|
||||
if (priv->root)
|
||||
{
|
||||
@@ -4980,7 +4980,7 @@ gtk_widget_real_css_changed (GtkWidget *widget,
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_update_pango_context (widget);
|
||||
gtk_widget_update_default_pango_context (widget);
|
||||
|
||||
if (priv->root)
|
||||
gtk_widget_queue_resize (widget);
|
||||
@@ -4997,7 +4997,7 @@ gtk_widget_real_system_setting_changed (GtkWidget *widget,
|
||||
setting == GTK_SYSTEM_SETTING_FONT_NAME ||
|
||||
setting == GTK_SYSTEM_SETTING_FONT_CONFIG)
|
||||
{
|
||||
gtk_widget_update_pango_context (widget);
|
||||
gtk_widget_update_default_pango_context (widget);
|
||||
if (gtk_widget_peek_pango_context (widget))
|
||||
gtk_widget_queue_resize (widget);
|
||||
}
|
||||
@@ -6427,15 +6427,19 @@ gtk_widget_get_effective_font_map (GtkWidget *widget)
|
||||
return pango_cairo_font_map_get_default ();
|
||||
}
|
||||
|
||||
static void
|
||||
update_pango_context (GtkWidget *widget,
|
||||
PangoContext *context)
|
||||
gboolean
|
||||
gtk_widget_update_pango_context (GtkWidget *widget,
|
||||
PangoContext *context,
|
||||
GtkTextDirection direction)
|
||||
{
|
||||
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
|
||||
GtkCssStyle *style = gtk_css_node_get_style (priv->cssnode);
|
||||
PangoFontDescription *font_desc;
|
||||
GtkSettings *settings;
|
||||
cairo_font_options_t *font_options;
|
||||
guint old_serial;
|
||||
|
||||
old_serial = pango_context_get_serial (context);
|
||||
|
||||
font_desc = gtk_css_style_get_pango_font (style);
|
||||
pango_context_set_font_description (context, font_desc);
|
||||
@@ -6444,9 +6448,10 @@ update_pango_context (GtkWidget *widget,
|
||||
if (cairo_version () >= CAIRO_VERSION_ENCODE (1, 17, 4))
|
||||
pango_context_set_round_glyph_positions (context, FALSE);
|
||||
|
||||
pango_context_set_base_dir (context,
|
||||
_gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR ?
|
||||
PANGO_DIRECTION_LTR : PANGO_DIRECTION_RTL);
|
||||
if (direction != GTK_TEXT_DIR_NONE)
|
||||
pango_context_set_base_dir (context, direction == GTK_TEXT_DIR_LTR
|
||||
? PANGO_DIRECTION_LTR
|
||||
: PANGO_DIRECTION_RTL);
|
||||
|
||||
pango_cairo_context_set_resolution (context, _gtk_css_number_value_get (style->core->dpi, 100));
|
||||
|
||||
@@ -6468,15 +6473,20 @@ update_pango_context (GtkWidget *widget,
|
||||
}
|
||||
|
||||
pango_context_set_font_map (context, gtk_widget_get_effective_font_map (widget));
|
||||
|
||||
return old_serial != pango_context_get_serial (context);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_widget_update_pango_context (GtkWidget *widget)
|
||||
gtk_widget_update_default_pango_context (GtkWidget *widget)
|
||||
{
|
||||
PangoContext *context = gtk_widget_peek_pango_context (widget);
|
||||
|
||||
if (context)
|
||||
update_pango_context (widget, context);
|
||||
if (!context)
|
||||
return;
|
||||
|
||||
if (gtk_widget_update_pango_context (widget, context, _gtk_widget_get_direction (widget)))
|
||||
gtk_widget_queue_draw (widget);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -6507,7 +6517,7 @@ gtk_widget_set_font_options (GtkWidget *widget,
|
||||
options ? cairo_font_options_copy (options) : NULL,
|
||||
(GDestroyNotify)cairo_font_options_destroy);
|
||||
|
||||
gtk_widget_update_pango_context (widget);
|
||||
gtk_widget_update_default_pango_context (widget);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6536,7 +6546,7 @@ gtk_widget_set_font_map_recurse (GtkWidget *widget, gpointer user_data)
|
||||
if (g_object_get_qdata (G_OBJECT (widget), quark_font_map))
|
||||
return;
|
||||
|
||||
gtk_widget_update_pango_context (widget);
|
||||
gtk_widget_update_default_pango_context (widget);
|
||||
|
||||
gtk_widget_forall (widget, gtk_widget_set_font_map_recurse, user_data);
|
||||
}
|
||||
@@ -6573,7 +6583,7 @@ gtk_widget_set_font_map (GtkWidget *widget,
|
||||
g_object_ref (font_map),
|
||||
g_object_unref);
|
||||
|
||||
gtk_widget_update_pango_context (widget);
|
||||
gtk_widget_update_default_pango_context (widget);
|
||||
|
||||
gtk_widget_forall (widget, gtk_widget_set_font_map_recurse, NULL);
|
||||
}
|
||||
@@ -6616,7 +6626,7 @@ gtk_widget_create_pango_context (GtkWidget *widget)
|
||||
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
|
||||
|
||||
context = pango_font_map_create_context (pango_cairo_font_map_get_default ());
|
||||
update_pango_context (widget, context);
|
||||
gtk_widget_update_pango_context (widget, context, _gtk_widget_get_direction (widget));
|
||||
pango_context_set_language (context, gtk_get_default_language ());
|
||||
|
||||
return context;
|
||||
@@ -7201,7 +7211,7 @@ gtk_widget_emit_direction_changed (GtkWidget *widget,
|
||||
GtkTextDirection direction;
|
||||
GtkStateFlags state;
|
||||
|
||||
gtk_widget_update_pango_context (widget);
|
||||
gtk_widget_update_default_pango_context (widget);
|
||||
|
||||
direction = _gtk_widget_get_direction (widget);
|
||||
|
||||
@@ -10365,7 +10375,7 @@ gtk_widget_get_allocated_baseline (GtkWidget *widget)
|
||||
* toplevel. The opacity value itself is not inherited by child
|
||||
* widgets (since that would make widgets deeper in the hierarchy
|
||||
* progressively more translucent). As a consequence, [class@Gtk.Popover]s
|
||||
* and other [class@Gtk.Native] widgets with their own surface will use their
|
||||
* and other [iface@Gtk.Native] widgets with their own surface will use their
|
||||
* own opacity value, and thus by default appear non-translucent,
|
||||
* even if they are attached to a toplevel that is translucent.
|
||||
*/
|
||||
|
||||
@@ -370,6 +370,10 @@ void gtk_widget_update_orientation (GtkWidget *widget,
|
||||
void gtk_widget_realize_at_context (GtkWidget *widget);
|
||||
void gtk_widget_unrealize_at_context (GtkWidget *widget);
|
||||
|
||||
gboolean gtk_widget_update_pango_context (GtkWidget *widget,
|
||||
PangoContext *context,
|
||||
GtkTextDirection direction);
|
||||
|
||||
/* inline getters */
|
||||
|
||||
static inline GtkWidget *
|
||||
|
||||
+6
-8
@@ -5796,16 +5796,14 @@ gtk_window_activate_menubar (GtkWidget *widget,
|
||||
GtkWidget *focus;
|
||||
GtkWidget *first;
|
||||
|
||||
focus = gtk_window_get_focus (window);
|
||||
|
||||
if (priv->title_box != NULL &&
|
||||
(focus == NULL || !gtk_widget_is_ancestor (focus, priv->title_box)) &&
|
||||
gtk_widget_child_focus (priv->title_box, GTK_DIR_TAB_FORWARD))
|
||||
return TRUE;
|
||||
|
||||
tmp_menubars = gtk_popover_menu_bar_get_viewable_menu_bars (window);
|
||||
if (tmp_menubars == NULL)
|
||||
return FALSE;
|
||||
{
|
||||
focus = gtk_window_get_focus (window);
|
||||
return priv->title_box != NULL &&
|
||||
(focus == NULL || !gtk_widget_is_ancestor (focus, priv->title_box)) &&
|
||||
gtk_widget_child_focus (priv->title_box, GTK_DIR_TAB_FORWARD);
|
||||
}
|
||||
|
||||
menubars = g_ptr_array_sized_new (g_list_length (tmp_menubars));;
|
||||
for (l = tmp_menubars; l; l = l->next)
|
||||
|
||||
@@ -343,7 +343,7 @@ perform_titlebar_action (GtkWindowHandle *self,
|
||||
gesture = GDK_TITLEBAR_GESTURE_RIGHT_CLICK;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (gdk_toplevel_titlebar_gesture (GDK_TOPLEVEL (surface), gesture))
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user