Compare commits

..

468 Commits

Author SHA1 Message Date
Chun-wei Fan 728339e1ce gtk/gtkfontchooserwidget.c: Include FreeType Headers properly
Like what was done in the master branch, we ought to include the
FreeType headers via the macros that are defined via including ft2build.h.
2019-01-07 12:13:17 +08:00
John Ralls 70b7b89411 [Quartz]Check mode before setting the monitor scale factor.
CGDisplayModeGetWidth returns 0 if mode is NULL; that happens if the
CGDisplay is offline or mirroring another monitor and it leads to a
divide-by-zero crash.

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1565
2019-01-05 20:06:50 -08:00
Ryuta Fujii a8e07254d3 Update Japanese translation 2019-01-05 00:20:54 +00:00
Ryuta Fujii da54692ab7 Update Japanese translation 2019-01-04 23:52:50 +00:00
Emmanuele Bassi 69508b014d Merge branch 'wayland-key-theme-for-3-24' into 'gtk-3-24'
Wayland: Support key theme setting

See merge request GNOME/gtk!487
2019-01-04 16:19:09 +00:00
Matthias Clasen 3a1c5f7232 Wayland: Support key theme setting
GTK+ 3 has supported this all along, so we should support
it for Wayland as well, for feature parity.

Closes: #1553
2019-01-04 10:18:51 -05:00
Matthias Clasen 4eee51b0e5 Check for the session bus before using it
Patch by Chris Allen, #475
2019-01-02 20:38:18 -05:00
Matthias Clasen 06ffbb2a22 Merge branch 'wip/nbenitezl/move-bookmark-placeholder-index-3' into 'gtk-3-24'
gtkplacessidebar.c: move bookmark at the placeholder index

See merge request GNOME/gtk!458
2019-01-03 01:28:34 +00:00
Orivej Desh f6bc2415ab Zero-fill new GtkTextIter
iter_init_common() is used on uninitialized GtkTextIter, and since neither it
nor its callers initiliaze its padding fields, they contain garbage.

This is a problem for Go - which checks that structs passed to C functions do
not contain pointers to Go-allocated memory - when the garbage happens to be
such a pointer.  Although Go zero-fills all GtkTextIter that it allocates, this
does not help when GTK functions such as insert_pixbuf_or_widget_segment called
for gtk_text_buffer_create_child_anchor copy garbage from their stack-allocated
GtkTextIter into a clean iter.  To work around this a GtkTextIter has to be
discraded after use in text buffer anchor inserting functions:
https://github.com/gotk3/gotk3/pull/307
2019-01-02 20:05:10 -05:00
Matthias Clasen 5662f2e34f Fix XChangeProperty calls
They must be long...

Closes: #1556
2019-01-02 19:32:00 -05:00
Timm Bäder dea38f0222 Merge branch 'wip/carlosg/revealer-fix-interrupted-animations' into 'gtk-3-24'
revealer: Fully set the target state if unmapped during animation

See merge request GNOME/gtk!465
2019-01-02 08:50:36 +00:00
Daniel Boles 63e0eb5de5 Fix 'Fix "A11y: Add support for AtkTableCell"'...
...since one of the "fixes" there was wrong, at least cosmetically:
.get_position() is declared as returning a gboolean, which is in fact an
int in practice, but we should say what we mean, like we already did.
2018-12-30 18:11:50 +00:00
Chun-wei Fan c876c74eb7 Fix "A11y: Add support for AtkTableCell"
Make sure that the return types of the vfuncs match the ones that are
specified for post-atk-2.11.x AtkTableCellIface, since we already
require atk-2.15.1 and later.
2018-12-26 12:17:20 +08:00
Christoph Reiter cc329d36e0 Merge branch 'priority' into 'gtk-3-24'
Annotate values of PRIORITY constants

See merge request GNOME/gtk!472
2018-12-22 16:37:07 +00:00
Tomasz Miąsko d3b6d16d85 Annotate values of PRIORITY constants
g-ir-scanner incorrectly evaluates macro definition that include
references to other macro definitions. Provide a correct value as an
annotation.

Differences in generated gir files:

```diff
@@ -19017 +19017 @@
-    <constant name="PRIORITY_REDRAW" value="20" c:type="GDK_PRIORITY_REDRAW">
+    <constant name="PRIORITY_REDRAW" value="120" c:type="GDK_PRIORITY_REDRAW">
@@ -74229,3 +74229,3 @@
     </constant>
-    <constant name="PRIORITY_RESIZE" value="10" c:type="GTK_PRIORITY_RESIZE">
+    <constant name="PRIORITY_RESIZE" value="110" c:type="GTK_PRIORITY_RESIZE">
       <doc xml:space="preserve">Use this priority for functionality related to size allocation.
@@ -106786,3 +106786,3 @@
     <constant name="TEXT_VIEW_PRIORITY_VALIDATE"
-              value="5"
+              value="125"
               c:type="GTK_TEXT_VIEW_PRIORITY_VALIDATE">
```
2018-12-22 13:17:58 +01:00
Timm Bäder b69aae4ab3 Merge branch 'cherry-pick-5b049364' into 'gtk-3-24'
Merge branch 'fix-polygon-svg-recolor' into 'master'

See merge request GNOME/gtk!468
2018-12-22 09:10:49 +00:00
Christoph Reiter ea518ec2f5 Merge branch 'fix-typo-win32-compilation-speedup-macro' into 'gtk-3-24'
Win32: Fix typo on compilation speedup macro define

See merge request GNOME/gtk!470
2018-12-22 07:13:31 +00:00
Luca Bacci a9d7d41b59 Win32: Fix typo on compilation speedup macro define
There is a typo, the correct macro to define is WIN32_LEAN_AND_MEAN.
After this change <shellapi.h> must be included in order to use
ExtractIconExW().
2018-12-22 00:48:10 +01:00
Matthias Clasen b283b0b910 Merge branch 'fix-polygon-svg-recolor' into 'master'
icontheme: Recolor <polygon> elements in SVGs too

See merge request GNOME/gtk!443

(cherry picked from commit 5b049364dc)

284d9093 icontheme: Recolor <polygon> elements in SVGs too
2018-12-20 03:01:36 +00:00
Mike Gorse e9f527b328 A11y: Add support for AtkTableCell 2018-12-19 21:09:59 -05:00
Carlos Garnacho 32ad0ffa0f revealer: Fully set the target state if unmapped during animation
If the revealer is told do animate and then unrealize itself, we do
(correctly) stop the animation, but used to do a shortcut where we
just set the target state as current.

Other things are dependent on the animation properly finishing though,
like the contained widget child visibility. This may lead to inconsistent
state where gtk_revealer_get_child_revealed() returns TRUE but the child
widget is unmapped, or vice-versa.

Fully finish the animation here, so the child state is coherent the next
time the revealer is mapped. We can also skip notifying on the property
since it will be handled by gtk_revealer_set_position().

Closes: https://gitlab.gnome.org/GNOME/gnome-control-center/issues/316
2018-12-19 19:37:42 +01:00
Benjamin Otte 55894c48a5 Merge branch 'wip/dboles/revealer-underallocates-gadgets-3' into 'gtk-3-24'
Revealer: Don't (under)allocate child if not shown (+bonus: actually put enough filler text in testrevealer)

See merge request GNOME/gtk!463
2018-12-18 22:21:37 +00:00
Daniel Boles d179b0667d Revealer: Don’t (under)allocate child if not shown
If the child is not (partly) revealed, don’t allocate it, or we spam the
console with warnings about giving negative width to children’s gadgets.
We can check :child-visible, which is FALSE if (current&target)_pos == 0

Close https://gitlab.gnome.org/GNOME/gtk/issues/1057
2018-12-18 21:00:08 +00:00
Daniel Boles ee5873be19 testrevealer: Make filler text actually big enough
…to do what it says it does, i.e. avoid the window expanding/shifting as
e.g. the leftmost entry is revealed.

noticed during https://gitlab.gnome.org/GNOME/gtk/issues/1057
2018-12-18 21:00:08 +00:00
Carlos Garnacho 33faf46516 Merge branch 'wip/wacom-tool-type-from-property-3.24' into 'gtk-3-24'
Wacom tool type fixes

See merge request GNOME/gtk!453
2018-12-18 20:09:40 +00:00
John Ralls 1c1a86d0fc Merge Ignacio Casal Quintero's quartz-scale-factor' into gtk-3-24. 2018-12-18 10:55:35 -08:00
Ignacio Casal Quinteiro 1a9377bab9 quartz/display: add back scaling factor
With the last patches one thing that got lost if the scaling
factor. This is very visible when i.e loading a svg image
in a Retina display.
2018-12-18 18:08:47 +01:00
John Ralls e105fefc49 Fix copy-paste error. 2018-12-18 09:07:15 -08:00
Peter Hutterer 7b33369bfb x11: make the tool lookup dependent on the hw id as well
Tools on the same physical item have the same serial number, so the eraser
and the pen part of a single pen share that serial number. With the current
lookup code, we'll always return whichever tool comes first into proximity.

Change the code to use the hw id in addition to the serial number, this way we
can differ between two tools.
2018-12-18 10:48:03 +10:00
Peter Hutterer c6dd92294d x11: don't add unknown tools to our list
Generic tools (Bamboo, built-in tablets) always have the same serial number
assigned by the wacom driver. This includes the touch tool when the wacom
driver handles the touch evdev node (common where users require the wacom
gestures to work).

When the first device is the touch device, a tool is created with that serial.
All future tools now return the touch tool on lookup since they all share the
same serial number. Worse, this happens *across* devices, so the pen
event node gets assigned the touch tool because they all have the same serial.

Since we don't actually care about the touch as a tool, let's skip any unknown
tool. This captures pads as well.
2018-12-18 10:48:02 +10:00
Peter Hutterer f173d1bc5c x11: get the tool type from the wacom driver properties
Any wacom device currently sets the tool type to UNKNOWN. The wacom driver has
a property that exports the tool type as one of stylus, eraser, cursor, pad or
touch. Only three of those are useful here but that's better than having all
of them as unknown.
2018-12-18 10:47:26 +10:00
Daniel Boles 3986326bbf RGBA: tiny grammar improvements in to_string doc 2018-12-17 20:16:42 +00:00
Daniel Boles be60ddbec9 RGBA: Consistently use “” around inline arg names
instead of being inconsistent and not using them later, which leaves a
bunch of single letters floating among real words, not the prettiest.
2018-12-17 20:16:42 +00:00
Daniel Boles 33a966952a RGBA: Fix example to_string output for reality/CSS
* We don't output spaces anywhere in the code, unlike the doc suggested.
* CSS explicitly forbids whitespace between function names and lparens:
  https://stackoverflow.com/questions/13877198
2018-12-17 20:16:42 +00:00
Nelson Benítez León f7eb7efeb5 gtkplacessidebar.c: move bookmark at the placeholder index
As that index is set in drag_motion_callback() and visually shown
on the widget as a drop target hint.

https://bugzilla.gnome.org/show_bug.cgi?id=787356
https://gitlab.gnome.org/GNOME/gtk/issues/904
2018-12-17 19:17:17 +00:00
LRN eb821cb89b Merge branch 'gtk-3-24.ime-event.fixes' into 'gtk-3-24'
gdkevents-win32.c: Use g_strdup() in gdk_settings_notify()

See merge request GNOME/gtk!447
2018-12-17 05:00:06 +00:00
Chun-wei Fan 013b9cbc1f gdkevents-win32.c: Fix GDK_SETTING event notification on IME change
We need to call g_strdup() on the name that we pass in for notifying the
GDK_SETTING event so that when we do gdk_event_free() later we will not
get a crash (stack corruption) that results from attempting to g_free()
something that is not dynamically allocated.
2018-12-17 12:43:24 +08:00
John Ralls aeec73f53f Refine GdkQuartzNSWindow convertPointToScreen:
and convertPointFromScreen:, making them handle all MacOS versions
so that all of the if-deffing happens in the function definitions.
This happens to fix issue 1518 because it turns out that contrary
to the annotation in the 10.14 nNSWindow.h, convertPointToScreen and
convertPointFromScreen originate in 10.14, not 10.12.

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1518
2018-12-15 16:28:44 -08:00
John Ralls baa283b73b Don't make initializing return_val conditional.
Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1517
2018-12-15 16:28:44 -08:00
Daniel Boles 112645edf2 EventControllerKey: Add missing docs from master
These never got backported, meaning a pretty useless documentation page.

We still need to add other missing bits, but let's sync these up first.
2018-12-14 22:59:56 +00:00
Matthias Clasen 3e6fd50d96 Merge branch 'wip/carlosg/im-wayland-surrounding-limits' into 'gtk-3-24'
imwayland: Respect maximum length of 4000 Bytes on strings being sent.

See merge request GNOME/gtk!438
2018-12-14 20:09:18 +00:00
Matthias Clasen f879741e89 Merge branch 'imwayland_enable' into 'gtk-3-24'
imwayland: Handle enter and leave events

See merge request GNOME/gtk!369
2018-12-14 20:07:18 +00:00
Matthias Clasen 8b0fd8e148 Merge branch '1476-nautilus-does-not-enable-to-connect-to-an-nfs-share' into 'gtk-3-24'
Resolve "Nautilus does not enable to connect to an NFS share"

See merge request GNOME/gtk!427
2018-12-14 17:26:35 +00:00
Benjamin Otte 43aeb52b73 Merge branch 'wip/muktupavels/gtk-status-icon' into 'gtk-3-24'
statusicon: Create pixbuf at correct size

See merge request GNOME/gtk!451
2018-12-13 16:40:43 +00:00
Daniel Boles e3a1593a09 x11: Fix deprecation macro use
G_GNUC_END_IGNORE_DEPRECATIONS terminates the if statement and does not
consider the following block to be part of the if. So that block was
always taken irregardless of the pattern.

Fixes #1280
2018-12-13 17:22:22 +01:00
Timm Bäder 2a3c0ab841 Merge branch 'demo-combobox-typo-gtk3' into 'gtk-3-24'
demos/gtk-demo/combobox: fix typo

See merge request GNOME/gtk!446
2018-12-13 12:07:24 +00:00
Benjamin Otte 6a47e9a8b9 x11: Be a lot more careful about setting ParentRelative
We don't want to set ParentRelative when:

- the parent window is NULL
  In that case we are unsure about the depth, so better err on the side
  of caution and avoid a BadMatch by accepting ugly output.
- the cairo pattern is in an error status
  This should never happen - unless you start up in OOM - but better
  be safe than sorry.

Might help with the spurious crashes in #1280.
2018-12-13 05:28:54 +01:00
Daniel Boles 2905fc861a Revert "Fix deprecation warnings"
This reverts commit 5aedfe048b.

It had a typo that broke the build, only replaced half of the uses, and
replaced them with other functions that are also deprecated anyway.
2018-12-12 19:03:57 +00:00
Matthias Clasen 363df54e54 3.24.2 2018-12-12 13:35:04 -05:00
Matthias Clasen 38edc38f21 Skip GdkPixbuf in default-value tests 2018-12-12 13:35:04 -05:00
Matthias Clasen b26cdd6d27 Update some a11y test results 2018-12-12 13:35:04 -05:00
Alberts Muktupāvels 31d896c5cf statusicon: Create pixbuf at correct size
Surface returned from gtk_icon_helper_load_surface can be smaller
then requested pixel size. This happens when icon is embedded in
panel that has bigger size then loaded pixbuf.
2018-12-12 19:55:20 +02:00
Matthias Clasen 5aedfe048b Fix deprecation warnings 2018-12-12 12:46:09 -05:00
Szunti 4c8fcd6a6f Add gdk_x11_display_get_parent_relative_pattern().
Fixes #1280, tray icons not drawing background. This is a magic pattern only
usable for gdk_window_set_background_pattern() that sets the underlying
X window's background to ParentRelative.
2018-12-12 02:56:35 +01:00
Jakub Steiner 4247fb606a Adwaita: revert all gnome 3.32 changes
- all changes now in wip/jimmac/gnome-3-32 branch
2018-12-10 20:23:22 +01:00
Emmanuele Bassi 403f4c9dae Merge branch 'issue1507' into 'gtk-3-24'
a11y: Check X11 display at runtime

See merge request GNOME/gtk!450
2018-12-10 16:39:12 +00:00
Olivier Fourdan ffeacd5ae3 a11y: Check X11 display at runtime
`gtk_widget_accessible_grab_focus()` code checks that X11 isenabled at
build time and uses X11 specific functions such as
`gdk_x11_get_server_time()` regardless of the actual backend being used.

Check that we are using an X11 display when X11 is backend enabled, so
we do not crash when running on Wayland

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1507
2018-12-10 17:09:42 +01:00
Jakub Steiner fcecc761cb Adwaita: selected borders darker for :dark
- switches in particular looked undefined
2018-12-10 12:36:39 +01:00
Jakub Steiner ecfdd186fe Adwaita: tone down $base_color saturation 2018-12-10 12:29:08 +01:00
Jakub Steiner 720bc7083c Adwaita: special case round buttons
- defining gradients outside of _drawing while Lapo isn't
  looking. Surely this will bite us in the future.
2018-12-10 12:19:09 +01:00
Jakub Steiner ad7eeb7a23 Adwaita: gradient undershoots
- based on a patch by frederik.feichtmeier <frederik.feichtmeier@gmail.com>
  I'm certain this is something we had initially, but can't recall
  why we got rid of it for the more visually distracting dashed line.
  We can always revert when Lapo shows up and slams us with that broken
  use case. I'm guessing non-white bgs.

- So far it looks way less distracting than the dashed line
2018-12-10 11:57:13 +01:00
Chun-wei Fan 15935bb248 Merge branch 'win10-use-system-font' into 'gtk-3-24'
GDK W32: Always set gtk-font-name to the active UI font. Fixes #1484

See merge request GNOME/gtk!436
2018-12-10 06:20:34 +00:00
Jeremy Bicha f535443da6 demos/gtk-demo/combobox: fix typo
Fix typo that prevented the P-S submenu from displaying correctly

(cherry picked from commit 462193ae26)
2018-12-09 23:31:59 -05:00
Matej Urbančič f9a1453b94 Updated Slovenian translation 2018-12-09 21:26:10 +01:00
Charles Monzat fcb1da0969 Updated French translation 2018-12-09 15:25:59 +01:00
John Ralls 46bee8b9fe Merge branch 'quartz-monitor' into gtk-3-24 2018-12-08 11:28:32 -08:00
Christoph Reiter 8797deb4b2 Visual Studio builds: update for gdk now using pangowin32. See !436 2018-12-08 14:17:34 +01:00
John Ralls 833ddc6e8d Silence enum type warning in 10.9. 2018-12-07 16:59:46 -08:00
John Ralls 9e212cd981 Prevent crash if display->touch_implicit_grabs is NULL. 2018-12-07 16:59:45 -08:00
John Ralls 5294c4f6f3 Fix crash if there are no grabs in place. 2018-12-07 16:59:45 -08:00
John Ralls e786da9ca9 Complete GdkQuartzDisplay Implementation.
Changing FIXME on unneeded functions to X11-only where appropriate.
2018-12-07 16:59:45 -08:00
John Ralls 89c8c55fda Remove 2 unused functions. 2018-12-07 16:59:45 -08:00
John Ralls eb2799cd7a Make _gdk_quartz_window_flush a no-op for MacOS 10.14 and later.
According to Apple's docs it's no longer necessary as Cocoa will notice
any changes and call drawRect as needed.
2018-12-07 16:59:45 -08:00
John Ralls 1165ab9d27 Replace deprecated gestalt for 10.10 and later.
It was deprecated in 10.8 but no replacement until 10.10.
2018-12-07 16:59:44 -08:00
John Ralls ca6db9a79d Add compile-time check for NSGraphicsContext graphicsPort/CGContext.
Runtime check alone doesn't silence warning.
2018-12-07 16:59:44 -08:00
John Ralls f30ed5ddc7 Fix Cocoa style and event constants for MacOS X 10.12 and later. 2018-12-07 16:59:44 -08:00
John Ralls 941f3c3887 Move the CGDisplayReconfigurationCallback to gdkdisplay-quartz.c.
Handling more flags, handling them correctly, and emitting the requisite
signals.

Change screen layout to use CGGetActiveDisplayList instead of NSScreens,
eliminating the latency between updating screens and recomputing the
root window.
2018-12-07 16:39:13 -08:00
John Ralls 9773b1951c Clean up some unused variables. 2018-12-07 16:39:13 -08:00
John Ralls 85f52dceaa Replace NSInputManager for MacOS 10.6 and later. 2018-12-07 16:39:13 -08:00
John Ralls 08b871fa51 Replace the deprecated GdkDisplayManager with GdkSeat. 2018-12-07 16:39:13 -08:00
John Ralls 28b8bbda45 Implement the GdkMonitor/GdkDisplay API.
Moving the initialization of the GdkQuartzMonitors to GdkQuartzDisplay from
the now-obsolete GdkQuartzScreen. Use QuartzDisplayServices for
monitor enumeration and to populate the GdkMonitor properties. This is
better aligned with acting on the Quartz Services callbacks for monitor
changes and with Cairo which also uses CoreGraphics for drawing.
2018-12-07 16:39:13 -08:00
John Ralls cf279a14fa Don't attempt to dereference icon_theme until after checking it. 2018-12-07 16:39:12 -08:00
John Ralls 6ac81545ef Prevent crash from passing NULL style provider.
gtk_internal_return_val_if_fail operates only in debug mode,
quartz can call this with a NULL that crashes in
GTK_STYLE_PROVIDER_PRIVATE_GET_INTERFACE.
2018-12-07 16:39:12 -08:00
John Ralls 4d0cae4468 Replace convertBaseToScreen & convertScreenToBase.
With convertPointToScreen & convertPointFromScreen when
MacOS version is > =10.7, when the earlier functions were
deprecated and replaced.
2018-12-07 16:39:12 -08:00
John Ralls 74aecac6fe Remove commented-out code copied from X11 implementation. 2018-12-07 16:24:58 -08:00
John Ralls 2b1c3fba96 Reorder virtual method assignments and fill in missing ones.
Makes auditing easier.
2018-12-07 16:24:58 -08:00
Jakub Steiner 239c95af47 Adwaita: buttons
- less dramatic gradient on the buttons
2018-12-07 18:20:57 +01:00
Iñaki Larrañaga Murgoitio 9c6c1641f1 Update Basque translation 2018-12-07 12:45:50 +00:00
Iñaki Larrañaga Murgoitio 0fbb32a6fa Update Basque translation 2018-12-07 12:44:34 +00:00
Jakub Steiner a4f3021693 Adwaita: regenerate CSS
- for the previous patch
2018-12-07 12:04:17 +01:00
Jakub Steiner f4d2cb0b08 Merge branch 'context_menus_gtk-3-24' into 'gtk-3-24'
GtkTheme: Menu border-radius and box-shadow changes

See merge request GNOME/gtk!439
2018-12-07 10:27:00 +00:00
Christoph Reiter 9e7cc89f4a GDK W32: Always set gtk-font-name to the active UI font. Fixes #1484
This makes apps use "Segoe UI 9" by default instead of whatever matches "Sans 10".
It also cleans up the code and uses some new pango API while at it.

This was previously disabled in 9e686d1fb5 because it led to a poor glyph coverage
on certain versions of Windows which don't default to "Segoe UI 9" (Chinese, Korean, ..)
because the font fallback list was missing in pango.

This is about to get fixed in https://gitlab.gnome.org/GNOME/pango/merge_requests/34
so enable it again when we detect a new enough pango version.
2018-12-07 09:32:14 +01:00
Jakub Steiner 152b89e812 Adwaita: lower selection border contrast
- to mimic what happened to regular borders
2018-12-07 00:58:58 +01:00
frederik.feichtmeier 1d90c72f44 Menu border-radius and bos-shadow changes
- introduce $menu_radius
- use it for menus and context-menus
- use the popover box-shadow also for menus
- use padding for menus to avoid edge overlapping
- remove the background for menus to avoid bleeding out of the round edges
2018-12-06 22:49:38 +01:00
Carlos Garnacho e416aebe5f imwayland: Respect maximum length of 4000 Bytes on strings being sent.
Hitting the limit will raise protocol errors.
2018-12-06 20:10:47 +01:00
Jakub Steiner 5e127cff12 Adwaita: buttons & headerbar tweaks
- tone down the button z-depth
- flatter headerbars
2018-12-05 16:19:46 +01:00
Daniel Boles b0fdaf3bf0 Box, Grid: Improve various bits of documentation
Issue #1495 showed that the docs of GtkGrid retain outdated implications
that (as was once, but is no longer, the case) it is intended to replace
GtkBox, by discussing HfW and widget properties in a way that suggests
GtkBox can't handle them. But of course it does, and it's preferable for
simple single-row/column cases. Worse, we said GtkGrid “provides exactly
the same functionality” for the latter case, but the original point of
that Issues was that it doesn’t, at least for CSS positional selectors!

Box:
• Use an actually meaningful @Short_description.
• Remove unhelpful @See_also references to unrelated containers.
• Remove references to “rectangular area”: it might be another shape
  via CSS, or “rectangular” might falsely imply 2 dimensions of children.
• Mention Orientable:orientation.
• Emphasise usefulness of :[hv]align for allocating in the other axis.
• Don’t say that Grid “provides exactly the same functionality” for a
  single row or column, since (A) it is overkill for that case and (B)
  said Issue proved that it *doesn’t* for CSS child order, for example.
• Note in the child properties that are remove in master that we have
  better, preferred alternatives available now in GtkWidget/CSS props.
  There’s no nice way to deprecate these, though they’re gone in GTK+ 4.
• Correct a copy-paste-o from the blurb of :expand to :fill.

Grid:
• Remove references to deprecated widgets: GtkTable and Gtk[HV]Box.
• Don’t dwell on widget properties and height-for-width in a way that
  wrongly implies that Box can’t handle those (or Grid can better). In
  fact, just get rid of that bit altogether: Box handles them fine, and
  Table is so old as to be not worth mentioning (in anything except the
  2 => 3 migration guide) and points to Grid in its deprecation notice.
• Point to GtkBox as being preferred for the simple row/column use case.
2018-12-04 20:45:07 +00:00
Matthias Clasen b74e3209a5 emoji chooser: Actually force Emoji presentation
The previous commit was using the text presentation selector
instead of the Emoji one. Oops.
2018-12-03 21:47:09 -05:00
Christoph Reiter 2de5572076 Merge branch 'win32-fontconfig-defaults' into 'gtk-3-24'
GDK W32: set default settings for fontconfig

See merge request GNOME/gtk!437
2018-12-01 16:02:51 +00:00
Christoph Reiter 5a23c0f038 GDK W32: set default settings for fontconfig
Enables hinting, antialiasing and set the subpixel orientation according to the
active clear type setting. This ensures that font rendering with the fontconfig backend
looks similar to the win32 backend, at least with the default system font.
2018-12-01 10:43:53 +01:00
Matthias Clasen aac38198a3 Force emoji presentation
Append a variation selector to the Emoji sequences,
to force Emoji presentation. Without this, some
Emoji come out with text presentation by default.

Closes: Pango #334
2018-11-30 16:39:07 -05:00
Jakub Steiner be75460913 Adwaita: updated switch control
- might be nasty to hide labels with CSS. We can fix properly later.
- the blue border seesm aliased when :checked
2018-11-30 20:53:13 +01:00
Jakub Steiner ea7a7e0425 Adwaita: shade buttons
- it was a bit too flat
2018-11-29 21:54:56 +01:00
Jakub Steiner e68e75c34c Adwaita: unbreak icon-shadow again
- Somehow I keep messing this one up

fixes https://gitlab.gnome.org/GNOME/gtk/issues/1456
2018-11-29 20:49:43 +01:00
Jakub Steiner 8e3541b28f Adwaita: active state for dark buttons
- was a bit too light. Tricky to tell which is pushed when
  you have two stackswitcher buttons.
2018-11-29 20:21:58 +01:00
Jakub Steiner 9a8f92f068 Adwaita: button tweaks
- step back on toning down the borders. Flatness !> legibility.
- darker active state for light
- draw gradinets from bottom up, to keep px sized shading regardless
  of button size.
2018-11-29 20:18:08 +01:00
Jakub Steiner 4cceccd129 Adwaita: headerbar backdrop state 2018-11-29 14:35:57 +01:00
Jakub Steiner 96f0b541bb Adwaita: sync headerbar styling for devel mode 2018-11-29 13:14:09 +01:00
Jakub Steiner a386bc98d7 Adwaita: flatten the headerbar again 2018-11-28 20:27:44 +01:00
Jakub Steiner 9b9b15c1a0 Adwaita: tune button & hederbar colors 2018-11-28 14:17:37 +01:00
Jakub Steiner 00556bd6cb Adwaita: buttons & headerbars
- tone down the bottom border contrast (increase bottom lightness,
  decrease overall lightness)
- darken headerbars slightly (might require darkening wm colors when
  dust settles)
2018-11-28 00:19:25 +01:00
Matthias Clasen 1dd0b8e6aa Merge branch 'escape-included-svg' into 'gtk-3-24'
(#1471): base64-encode included SVGs to avoid mis-escaped characters

See merge request GNOME/gtk!429
2018-11-27 18:59:13 +00:00
Federico Mena Quintero 3312d78863 (#1471): base64-encode included SVGs to avoid mis-escaped characters
We wrap SVG data from icons within another SVG with extra styling
information.  The wrapped SVG may contain characters that cannot be
part of a data: URL (https://fetch.spec.whatwg.org/#data-urls).

Librsvg 2.45 got more strict in its parsing of data: URLs; whereas
previously it ignored '#' characters in them, now it considers them to
be the start of a fragment identifier, which is not allowed in data:
URLs anyway.

To avoid unallowed characters, we now create a data: URL with a
base-64 encoded SVG.

Fixes https://gitlab.gnome.org/GNOME/gtk/issues/1471
2018-11-27 12:13:31 -06:00
Jakub Steiner 0271471b81 Adwaita: app icon shadow fix
- of course I'd miss the _ to - change
2018-11-26 17:31:19 +01:00
Jakub Steiner ffde7d780d Adwaita: help fullcolor app icons
- draw a large dropshadow for aboutboxes
- draw an outline for low res

See issues #1434 and #1445.
2018-11-26 17:29:17 +01:00
António Fernandes bb3653ad7d placesview: List only available protocols as available
We display a list of supported protocols in the server_addresses_popover.

However, this curated list contains protocols which may or may not be
available, depending on the respective gvfs backend being installed.

So, populate the list only with protocols which are available.

https://gitlab.gnome.org/GNOME/gtk/issues/1476
2018-11-26 12:43:39 +00:00
António Fernandes 4bdf968702 placesview: Set .error style if unsupported protocol
When the user types an address with a schema that is not supported,
the Connect button doesn't become sensitive, but there is no visible
feedback at all.

This feels unresponsive and leaves the user clueless.

While it doesn't help explain why the address doesn't work, this will
provide a hint that the input was acknowledged but doesn't work.

https://gitlab.gnome.org/GNOME/gtk/issues/1476
2018-11-26 12:41:55 +00:00
Christoph Reiter d48c95a562 Merge branch 'win32-remove-scroll-multiplier' into 'gtk-3-24'
win32: Don't multiply the scroll event deltas by the Windows scroll lines setting. See #1408

See merge request GNOME/gtk!426
2018-11-24 09:33:35 +00:00
Christoph Reiter 83204dd882 win32: Don't multiply the scroll event deltas by the Windows scroll lines setting. See #1408
GTK widgets expect the scroll deltas to be 1 or -1 and calculate a scroll value from that.
Multiplying the delta by the Windows scroll line setting (which defaults to 3) results
in a much larger delta and vastly different behaviour for running a GTK app on Windows
vs on Linux. For example text view and tree view scroll by 9 lines per scroll wheel tick
per default this way while on Linux it is around 3.

Remove the multiplication for now.
2018-11-24 10:24:27 +01:00
Jakub Steiner a139b63304 Adwaita: tone down borders, buttons
- very contrasty lines feel dated in today's flat world
- tone down the contrast a little
2018-11-23 17:37:00 +01:00
Jakub Steiner f968fdf3a1 Adwaita: list buttons
- tone down buttons when inside lists

Fixes issue #1473
2018-11-22 13:20:10 +01:00
Timm Bäder 91129be95c Merge branch 'emit-transient-for' into 'gtk-3-24'
window: Actually emit notify::transient-for

See merge request GNOME/gtk!425
2018-11-21 06:31:23 +00:00
Zander Brown b150699510 window: Actually emit notify::transient-for
Because it seems we weren't doing that
2018-11-20 15:32:40 +01:00
Benjamin Berg 356f1f59ae container: Document that removal from foreach is permissible
It is permissable to remove a widget using gtk_container_remove from the
gtk_container_foreach callback handler. Document this fact to make it
more discoverable.

Fixes #1461
2018-11-19 18:39:58 +00:00
Timm Bäder 0040b256fe Merge branch 'gdk-cursor-new-deprecated-for' into 'gtk-3-24'
gdk: Add deprecated for macro for gdk_cursor_new

See merge request GNOME/gtk!416
2018-11-19 08:04:48 +00:00
Timm Bäder 5e78646256 Merge branch 'more-nullable-gtk3' into 'gtk-3-24'
g-i: Add some nullable annotations

See merge request GNOME/gtk!420
2018-11-19 07:40:41 +00:00
Christoph Reiter 31b810abca g-i: Add some nullable annotations
Based on grepping arg docs for NULL.
See https://gitlab.gnome.org/GNOME/pygobject/issues/261
2018-11-18 13:40:24 +01:00
Robert Ancell dea9525f68 gdk: Add deprecated for macro for gdk_cursor_new 2018-11-17 21:23:40 +13:00
Timm Bäder 446cb9a217 Merge branch 'fix-issue-1366' into 'gtk-3-24'
entry: Handle no-window events in gtk_entry_event

See merge request GNOME/gtk!363
2018-11-15 10:03:19 +00:00
Timm Bäder e8a8a534ac Merge branch 'bye-app-menu-gtk3' into 'gtk-3-24'
widget-factory: move app menu contents to primary menu

See merge request GNOME/gtk!364
2018-11-15 10:01:13 +00:00
Jakub Steiner 06162a08b6 Adwaita: tone down purple cast
- sync with gtk4 changes
2018-11-14 17:52:37 +01:00
Jakub Steiner b57a1a0b92 Revert "Adwaita: help fullcolor app icons"
- the app icon dropshadow patch was not meant to be part of the color changes

This reverts commit a8a545510d.
2018-11-14 17:32:41 +01:00
John Ralls bb376222c1 Reset the Quartz resolution to 72.0 dpi.
Further feedback on https://bugzilla.gnome.org/show_bug.cgi?id=787867
indicates that 96.0 dpi scales fonts 4/3 larger than native applications.
2018-11-14 09:02:45 +09:00
Ignacio Casal Quinteiro a3744d4761 gtkclipboard-quartz: remove unused variable 2018-11-13 15:39:17 +01:00
Matthias Clasen d21832719b wayland: Adapt to settings portal api change
ReadAll now accepts an array of patterns.
2018-11-12 14:10:13 -05:00
Timm Bäder 0d8dcccad2 Merge branch 'wl-framework' into 'gtk-3-24'
Use -Wl for the framework linker argument

See merge request GNOME/gtk!405
2018-11-12 08:56:49 +00:00
Jakub Steiner 6f2b0cfcf3 Adwaita: use HIG grey for bg_color
- refresh with a light bg color, use the new color palette
2018-11-09 15:57:06 +01:00
Jakub Steiner 5a12934e90 Adwaita: fix osd bg color
- don't try deriving from bg_color, osd should be consistent
  for light & dark.

FIxes issue #1449
2018-11-09 11:30:21 +01:00
Cheng-Chia Tseng 4902070cad Update Chinese (Taiwan) translation 2018-11-09 09:03:56 +00:00
Adrien Plazas f0e5b5bf88 Adwaita: Propagate bg color to titlebar separator descendants
Gives the same background color to all separators descending from a
title bar than to its direct childrens.

This prevents separators which are in a titlebar but not direct children
from the widget with the titlebar style class from being almost
transparent and hence it prevent them from revealing the clear color of
the window's titlebar (black).

https://gitlab.gnome.org/GNOME/gtk/issues/1231
2018-11-09 08:51:43 +01:00
Matej Urbančič f74154d5a1 Updated Slovenian translation 2018-11-09 08:47:33 +01:00
Matej Urbančič 333f496ad5 Updated Slovenian translation 2018-11-09 08:47:33 +01:00
Pieter Schalk Schoeman 4c348e5486 Update Afrikaans translation 2018-11-09 08:47:33 +01:00
Jakub Steiner 7034ab269f Merge branch 'wip/jimmac/hig-colors' into 'gtk-3-24'
Adwaita: use new HIG colors (gtk3)

See merge request GNOME/gtk!408
2018-11-09 07:23:46 +00:00
Timm Bäder f972ab8818 Merge branch 'plug_race' into 'gtk-3-24'
Fix race in GtkPlug window creation

See merge request GNOME/gtk!387
2018-11-08 04:49:25 +00:00
Daniel Boles ec1786fdbc Popover: Minimally document the ::closed signal
This is better than nothing at all. The wording is taken from Carlos's
commit message when he added this shortly before 3.12, so add Since too.
Skip the bit from his commit message explaining what this replaced; we
don't need to say all the less good things our convenience API replaces.
2018-11-07 20:32:34 +00:00
Daniel Boles 08bafb4a52 TreeMenu: Don't manually reinvent g_list_index()
g_list_index() "Gets the position of the element containing the given
data (starting from 0)." That is exactly what we were manually doing.
2018-11-07 20:31:45 +00:00
Timm Bäder 009c256991 Merge branch 'cherry-pick-9946dd2a' into 'gtk-3-24'
gtk-autocleanups: add cleanup function for GtkRecentInfo

See merge request GNOME/gtk!410
2018-11-06 09:52:23 +00:00
Matthias Clasen 8ef21cb32f wayland: Fix a thinko in settings portal support
When we decide to fall back because the settings portal
is not present, adhere to that decision elsewhere.
2018-11-05 18:34:57 -05:00
Marco Trevisan 4048a1965a gtk-autocleanups: add cleanup function for GtkRecentInfo
(cherry picked from commit 9946dd2ab7)
2018-11-05 21:39:35 +00:00
Jakub Steiner 39645ab6f0 Adwaita: use new HIG colors
- blue selection color, success & destructive colors updates
- blueish tint for dark

Addresses issue #1443
2018-11-05 16:10:50 +01:00
Jakub Steiner a8a545510d Adwaita: help fullcolor app icons
- draw a large dropshadow for aboutboxes
- draw an outline for low res

See issues #1434 and #1445.
2018-11-05 15:03:11 +01:00
Simon Wells 382ba0ca83 Use -Wl for the framework linker argument 2018-11-05 20:11:30 +13:00
Matthias Clasen 64427e9878 Merge branch 'settings-portal-for-3' into 'gtk-3-24'
Settings portal for 3

See merge request GNOME/gtk!404
2018-11-04 21:13:33 +00:00
Matthias Clasen 41562ab2c6 wayland: Support the settings portal
Under Wayland, we are currently directly using GSettings
for desktop settings. But in a sandbox, we may not have
access to dconf, so this may fail. Use the new settings
portal instead.
2018-11-04 15:50:16 -05:00
Matthias Clasen 4073d0217b Add a gdk_should_use_portal helper
We are going to use this in the following commits.
2018-11-04 08:20:52 -05:00
Matthias Clasen fb709e96f1 Use a simpler sandbox check
No need to use the runtime dir and allocate a string.
We can just check in /.
2018-11-04 08:20:11 -05:00
Dušan Kazik d6dedf5270 Update Slovak translation 2018-11-02 08:54:03 +00:00
Dušan Kazik 40400373e1 Update Slovak translation 2018-11-02 08:51:12 +00:00
Dušan Kazik 1837ae88f7 Update Slovak translation 2018-11-01 17:51:10 +00:00
Daniel Mustieles 8c5158a54e Updated Spanish translation 2018-10-31 13:50:01 +01:00
LRN d45537a743 Merge branch 'win32-honest-clipboard' into 'gtk-3-24'
GDK W32: be more honest about clipboard format support

See merge request GNOME/gtk!382
2018-10-31 05:13:18 +00:00
Carlos Garnacho 336f382728 imwayland: Plug leaks
The various strings (pending/current preedit, surrounding, and commit
buffer) are being leaked in the case of GtkIMContext destruction.
2018-10-30 22:00:07 +01:00
John Ralls 9c6cf4acab Fix indentation. 2018-10-29 14:25:31 -07:00
John Ralls 60dafa38c7 Merge branch '1411-handle-null-from-nsgraphicscontex' into gtk-3-24. 2018-10-29 11:32:10 -07:00
Matej Urbančič d483c0a05b Updated Slovenian translation 2018-10-25 22:07:50 +02:00
Carmen Bianca BAKKER 041ac5b45a Update Esperanto translation 2018-10-24 08:12:34 +00:00
Jakub Steiner c1dbf96413 Adwaita: prevent devel styling break selection mode
- Selection mode does not get the special devel styling.

    - removed teh last-child() selector for it doesn't work anymore.
      Better style all section of the headerbar than none. Proper fix pending.
2018-10-22 10:41:41 +02:00
John Ralls 7e4cda6c1c GdkQuartz: Handle NULL from [NSGraphicsContext currentContext].
By returning a default surface. The situation where there's no
currentContext arises when GtkCSS is trying to determine the
layout sizes so no actual display is necessary.

Closes: #1411
2018-10-20 12:31:25 -07:00
John Ralls 7600c4e3f7 Modify Quartz gtk_drag_begin_internal to match 4172138. 2018-10-20 12:26:13 -07:00
John Ralls 35d798dd31 Use [NSGraphicsContext CGContext] instead of graphicsPort after Yosemite. 2018-10-19 16:49:00 -07:00
John Ralls 0e831b774c Update GDK_OSX versions to current MacOS release. 2018-10-19 16:48:59 -07:00
Ignacio Casal Quinteiro 615fa7cfb6 Merge branch '379-fix-quartz-offscreen-window-crash' into 'gtk-3-24'
Resolve "gtkdnd-quartz crash when realizing a GtkOffscreenWindow"

See merge request GNOME/gtk!145
2018-10-19 06:11:51 +00:00
Philip Chimento df0e5cc8e6 quartz: Fix crash when realizing GtkOffscreenWindow
GtkOffscreenWindow doesn't have a NSView or NSWindow, so return NULL if
passed one of those.

Closes: #379
2018-10-19 05:38:28 +01:00
Dorota Czaplejewicz 28ac1a2cba imwayland.c: fix formatting 2018-10-17 12:51:07 +00:00
Matthias Clasen 00034c00be Merge branch '1371-flickering-tooltips-if-no-mouse-cursor-theme-loaded-gtk3' into 'gtk-3-24'
Tooltip: Fix the used cursor size if 0 in Settings

See merge request GNOME/gtk!374
2018-10-16 23:20:25 +00:00
Matthias Clasen c0b5d66069 Merge branch '1397-gtknotebook-built-in-popup-menu-listing-tabs-doesn-t-use-tab-label-text-for-the-last-tab' into 'gtk-3-24'
Notebook: Ensure menu label updates with tab_label

See merge request GNOME/gtk!385
2018-10-16 20:52:04 +00:00
Benjamin Otte 2453e71fd3 Merge branch 'win32-fix-dnd-info-disposal' into 'gtk-3-24'
Fix DND info disposal

See merge request GNOME/gtk!390
2018-10-16 19:41:03 +00:00
Руслан Ижбулатов 4172138154 DnD: fix setting icon in drag-begin
Commit 1c96b703 changed the way icon
information is given to DnD. Previously an icon helper was kept at
the drag source site. Now an image definition is stored there.
The difference is that icon helper is an object that changes its
state in response to an icon being set, thus the object survived
multiple icon changes. Whereas image definition is destroyed and
re-created from scratch every time a drag icon is changed.
This created a problem where gtk_drag_begin_internal() would receive
the value of site->image_def when a drag just began, then it emits
"drag-begin" signal, in response to which an application can
set drag icon, changing the value of site->image_def. However,
gtk_drag_begin_internal() is unable to know about that change and
continues to use the old value it received from up the stack.

Not only does it prevent drag icon from being set from "drag-begin",
it also can induce a crash, since the old image_def value used
by gtk_drag_begin_internal() points to a freed memory region.

Fix this by only setting a default icon (which is created in-place)
in gtk_drag_begin_internal() if the caller does not care about icons.
Otherwise gtk_drag_begin_internal() will return a boolean that indicates
whether an icon needs to be set. Then the caller can invoke
gtk_drag_set_icon_definition() to set the icon, if needed.

Fixes #1407.
2018-10-16 19:04:54 +00:00
Dorota Czaplejewicz 3d6510329f imwayland: rearrange functions to remove prototypes 2018-10-16 16:38:24 +00:00
Dorota Czaplejewicz c477201afc imwayland: Handle enter and leave events
Before this patch, imwayland would assume that text-input enter and leave events follow the general (wl_keyboard) focus, and was unable to handle the situation where they would not be provided at the same time.
2018-10-16 16:29:08 +00:00
Руслан Ижбулатов 5e00fd25da Fix GtkDragSourceInfo disposal
gtk_drag_clear_source_info() immediately unrefs the info attached
to the context (the very same info we're in the process of destroying
in gtk_drag_source_info_free()). If that reference was the last one,
then accessing the info object after that is a use-after-free error.
Also, change the order a bit to first free the event, and only then
unref the context.

Fix this by copying all the fields of the info that we need, and
then working with these copies.
2018-10-16 03:07:13 +00:00
LRN 05b11e9a5b Merge branch 'lrn/zorder-324' into 'gtk-3-24'
Don't let the OS maintain relative Z-order for windows

See merge request GNOME/gtk!196
2018-10-15 22:36:30 +00:00
Uli Schlachter 9ca38c4647 Fix race in GtkPlug window creation
According to the XEmbed specification, a window should be created
"elsewhere" and then reparented into the target parent window. Instead,
GTK+ creates the window directly in desired target parent window. This
allows some races to occur.

Another program that does not follow XEmbed is tabbed. XEmbed requires
an _XEMBED_INFO property on the to-be-embedded window, but tabbed does
not check for this property. Thus, as soon as GTK+ creates its window,
tabbed starts managing this window and now GTK+ setting up the window
races with tabbed starting to manage the window.

If tabbed is fast enough to map the window, GTK+ never sees a MapNotify
event, because it did not yet select StructureNotifyMask on its window.
This results in a black window inside of tabbed.

Note that this cannot really be fixed in tabbed, since XEmbed says that
the _XEMBED_INFO property must be already present when the window
appears. Thus, patching tabbed to wait for _XEMBED_INFO to appear is not
something that the spec requires/allows.

Instead, this commit changes GTK+ so that it directly sets the right
event mask when the window is created. This means that there is no more
race between tabbed mapping the window and GTK+ selecting
StructureNotifyMask.

Note that the proper fix would be to do as XEmbed requires: Create the
window elsewhere and then reparent it into the target window. However,
that would require a more invasive patch, so this commit only takes the
"easy approach" of fixing this one race. Hopefully, all the other races
that can occur during window setup are harmless, because the
embedder/socket will hopefully watch for PropertyNotify events as
needed.

Fixes: https://gitlab.gnome.org/GNOME/gtk/issues/757
See-also: https://github.com/awesomeWM/awesome/issues/2385
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-10-14 14:01:25 +02:00
Timm Bäder dbbc7b3859 emojichooser: Pass chooser to add_emoji
https://gitlab.gnome.org/GNOME/gtk/issues/1398
2018-10-13 14:01:08 +01:00
Daniel Boles 2856fb86a9 Adwaita: Regenerate CSS for new window.devel style
Commit 955aa8d54b forgot this, again.
2018-10-12 23:55:02 +01:00
Daniel Boles 80a3d7090a Notebook: Ensure menu_label updates with tab_label
This was noticed in Firefox and demonstrated using a GtkBuilder ui file.
buildable_add_child() calls set_tab_label(), but the latter did nothing
to update the menu_label corresponding to that tab with the new text.
Using Builder to populate the tab child, only tabs other than last got
the right non-default labels, and even that was mostly coincidental, as
adding the main child called update_labels() via real_insert_page(), so
it took effect when the 2nd last main child is added, updating the rest
but leaving the last with the default label, not that given in Builder.

Fix by factoring out the code from child_reordered() to a new helper
menu_item_recreate() and calling that in set_tab_label(), so that
whenever the tab_label is updated, so is its corresponding menu_label.

This fixes the reported case and presumably others that we could write.

fixes https://gitlab.gnome.org/GNOME/gtk/issues/1397
2018-10-12 23:49:29 +01:00
Daniel Boles 82c5308947 Notebook: Don't notify 2x from set_tab_label_text
It calls set_tab_label(), which already does that.
2018-10-12 23:38:52 +01:00
Daniel Boles d9f08c85f4 gtk-demo/main: Suppress implicit fallthru warning
Comments matched to reassure the compiler that fallthrough is
intentional are supposed to precede the case or default keywords, at
least in GCC, so the one here did not suppress the warning with GCC. We
can just the if condition and put the comment at the end to solve that.

https://developers.redhat.com/blog/2017/03/10/wimplicit-fallthrough-in-gcc-7/
2018-10-12 22:09:42 +01:00
Ignacio Casal Quinteiro 247b38eb42 Merge branch 'fix-crash-osx' into 'gtk-3-24'
quartz: do not cache the screen in the gdkmonitor

See merge request GNOME/gtk!375
2018-10-11 20:45:49 +00:00
Ignacio Casal Quinteiro 2a392c220d quartz: do not cache the screen in the gdkmonitor
Instead we just cache the monitor number and get
out of it the nsscreen when it is needed. This is
a requirement since it nsscreen it is not supposed
to be cached.

Fixes: https://gitlab.gnome.org/GNOME/gtk/issues/1312
2018-10-10 12:44:29 +02:00
Jakub Steiner 955aa8d54b Adwaita: backport nightly styling
- nightly apps get a headerbar styling
2018-10-10 09:38:50 +02:00
LRN caa5ba46ad Merge branch 'gtk-3-24.win.updated' into 'gtk-3-24'
gtkimcontextime.c: Fix Korean input

See merge request GNOME/gtk!356
2018-10-08 20:04:08 +00:00
Chun-wei Fan 1ece556200 gtkimcontextime.c: Fix Korean input
Commit c255ba68 inadvertently introduced a regression that broke Korean
text input because the changes there resulted that only the last input
string that we have from ImmGetCompositionStringW() for each time the
commit signal is emitted is kept, and also as a result the final Korean
character that is input by hitting space is also lost as a result, as we
didn't check for whether we are done with preediting.

Fix these issues by doing the following when we receive the
WM_IME_COMPOSITION message with GCS_RESULTSTR from Windows:
-Do not emit the commit signal during WM_IME_ENDCOMPOSITION, and...
-Emit the commit signal anyways, as we did before, c255ba68, however...
-We still save up the string to commit, because we need to re-compute
 the cursor position when we do ->get_preedit_string(), which needs to
 take the GCS_RESULTSTR string we get from WM_IME_COMPOSITION into
 account as well, so that we avoid getting the Pango criticals that
 occur during Chinese (and most likely Japanese) input as the cursor
 position is out-of-range.

Fixes issue #1350.
2018-10-08 15:55:44 +08:00
Hugo Lefeuvre adbaee796d gtkstack: fix null pointer dereference
The gtk_stack_snapshot_slide() function dereferences the
last_visible_child pointer without proper != NULL ckeck. This might
result in NULL pointer dereference and crash if last_visible_child is
invalid.

Add a != NULL check before dereferencing the pointer.

cherry-picked from https://gitlab.gnome.org/GNOME/gtk/merge_requests/361
2018-10-07 18:31:03 +01:00
Daniel Boles 9b7d886b72 Tooltip: Fix the used cursor size if 0 in Settings
Before the recent rework of positioning in GtkTooltip, the widget always
used the cursor_size of the GdkDisplay. That work redid this to instead
take GtkSettings::gtk-cursor-theme-size. But that property's doc says:

> Size to use for cursors, or 0 to use the default size.

and has 0 as its default. This is quite a likely scenario for anyone
whose desktop or settings.ini does not explicitly provide a cursor size,
which is the case for XFCE and win32, to name just two common platforms.

Then, it seems getting a cursor_size of 0 causes GtkTooltip to freak out
and hide/show itself at a very rapid speed, thus making it unusable.

So, we should check whether the Settings return 0 and, if so, still use
gdk_display_get_default_cursor_size (display) to ensure we get a size.

https://gitlab.gnome.org/GNOME/gtk/issues/1371
2018-10-07 18:26:30 +01:00
Aurimas Černius b10cde7bdc Updated Lithuanian translation 2018-10-07 16:56:11 +03:00
Руслан Ижбулатов 885672520a gtkselection: add a W32 tip about image/bmp support 2018-10-07 12:23:16 +00:00
Руслан Ижбулатов f0959c9c8d GDK W32: Be honest about supported clipboard formats
Do not lie to W32 about the formats that we provide or accept.

Originally the logic behind such lies was that GdkPixbuf allows
us to convert any supported image to BMP or PNG, and therefore
we should announce that we always provide/accept BMP and PNG along
with other formats.

But that's not how it works. The conversion between formats happens
at GTK level in GtkClipboard or, if GtkClipboard is not used, with
gtk_target_list_add_image_targets() to announce all supported image
formats, and with gtk_selection_data_set_pixbuf() to convert from
any GdkPixbuf formats to the format requested by the selection, and
with gtk_selection_data_get_pixbuf() to convert from the selection
format to GdkPixbuf, if supported.

GDK simply does not play any role in this. Therefore W32 GDK backend
should only offer formats that it can actually do conversion for
by itself (such as image/bmp <-> CF_DIB,
or text/uri-list <-> CFSTR_SHELLIDLIST).
2018-10-07 12:15:41 +00:00
LRN 259c8e6373 Merge branch 'win32-runtime-immodule-swap' into 'gtk-3-24'
GDK W32: Support switching input modules at runtime

See merge request GNOME/gtk!366
2018-10-06 15:52:52 +00:00
Руслан Ижбулатов d26c11f099 GDK W32: Support switching input modules at runtime
This leverages the normal input module switching mechanism in GTK
by making it think that the gtk-im-module setting changed.
The backend returns gtk-im-module value as "ime" if W32
IME API says that an IME is in use. Otherwise it returns
and empty string - this still triggers an input module
loading code, which, not being able to load the desired module
(which is and empty string), falls back to looking at current
keyboard layout.

Paired with the code that signals gtk-im-module change on keyboard layout
switches, this is sufficient to make GTK capable of loading appropriate
input modules at runtime. At least, the kinds of modules that specify
languages for which they are loaded automatically by default, and the
IME module.

Loading other kinds of input modules might still work via specifying
the gtk-im-module setting in gtk ini file, but doing so will likely
make GTK incapable of loading the IME input module that is used
for Korean, Chinese and Japanese (and some other languages).

Until someone figures out a way to actually change gtk-im-module
setting on Windows at runtime with meaningful values, the behaviour
introduced by this commit seems like a sufficient workaround.
2018-10-06 12:44:24 +00:00
Yi-Jyun Pan 220f77d8c1 Update Chinese (Taiwan) translation 2018-10-03 14:24:30 +00:00
Jeremy Bicha 4f424d0ead widget-factory: Add Keyboard Shortcuts menu item
Closes: https://gitlab.gnome.org/GNOME/gtk/issues/916
2018-09-30 20:50:51 -04:00
Jeremy Bicha 5a78039ab3 widget-factory: Rename About menu item to About Widget Factory
This follows the recommendation in
https://gitlab.gnome.org/GNOME/Initiatives/wikis/App-Menu-Retirement
2018-09-30 20:50:49 -04:00
Jeremy Bicha 9882bc9638 widget-factory: Move app menu contents to primary menu
GNOME Shell 3.32 will remove support for the app menu
so we need to move its contents to the primary (hamburger)
menu.

widget-factory already had a primary menu.

The only item in the app menu was About.

https://gitlab.gnome.org/GNOME/Initiatives/issues/4
2018-09-30 20:50:48 -04:00
Carlos Garnacho c8d47b0c84 imwayland: Collect return value from ::delete-surrounding signal
There's not much we can do about the signal not being handled, but
we should fetch the return value anyway.
2018-09-28 18:05:53 +02:00
Andrea Azzarone 2e24349fc6 entry: Handle no-window events in gtk_entry_event
gtk_entry_event's goal is to detect if a specific event concerns one of the two
entry icons. It can happen that this function is called during initialization
and/or before the entry is realized. In this case the entry icons (and the
event) will not yet have an associated window. The code should consider the
aforementioned situation and avoid matching a icon and an event with no
associated windows.

Fixes: https://gitlab.gnome.org/GNOME/gtk/issues/1366
2018-09-27 14:19:34 +02:00
Michael Catanzaro b4464e1274 wayland: Avoid crashes inside wl_proxy_marshal()
Suggested by Garnacho. Hopefully fixes #1349.

Note: I'm riskily committing this via web UI not because I'm lazy
(though I am :) but because I'm seeing a weird host key when I try to
push or pull from GitLab.
2018-09-24 20:19:26 +00:00
Rafael Fontenelle 41f2815e20 Update Brazilian Portuguese translation 2018-09-24 19:48:20 +00:00
Benjamin Otte 4ef082d2ed Merge branch 'wip/arnaudb/fix-dashed-border' into 'gtk-3-24'
Make dashed border-style work correctly

See merge request GNOME/gtk!349
2018-09-24 18:21:02 +00:00
Daniel Boles ed57e564a9 SidebarRow: Set ::no-show-all on end_icon_widget
All the other conditionally visible child widgets have this. Without it,
it seems some cases can wrongly reveal it, with a nonsensical home icon.

https://gitlab.gnome.org/GNOME/gtk/issues/1345
2018-09-22 19:57:59 +01:00
Arnaud B 0feebcf145 Make dashed border-style work correctly
There’s a short-path done for focus rectangles, but it can be taken in other conditions, and then fail occasionally to render a dashed line if the border-width is too big.
2018-09-21 12:25:23 +00:00
Emin Tufan Çetin 36656ea13a Update Turkish translation 2018-09-19 11:09:51 +00:00
Matthias Clasen f5ad1786e8 3.24.1 2018-09-18 21:42:55 -04:00
Stas Solovey ac41c3895f Update Russian translation 2018-09-18 20:09:23 +00:00
LRN d7cf221d8a Merge branch 'win32-scroll-both' into 'gtk-3-24'
GDK W32: send both smooth and discrete scrolling events

See merge request GNOME/gtk!335
2018-09-18 13:50:29 +00:00
Carlos Garnacho 6183f48ab3 Merge branch 'imwayland_serial' into 'gtk-3-24'
imwayland: Don't reset serial while text-input is alive

See merge request GNOME/gtk!339
2018-09-17 13:19:58 +00:00
Dorota Czaplejewicz af46ba27cc imwayland: Don't reset serial while text-input is alive
The serial number is a persistent property of the text-input object.
2018-09-14 20:33:38 +00:00
Matthias Clasen 8fd2d461fc gtk_application_inihit: allow no reason
We document this argument as nullable, so treat it as such.

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1327
2018-09-13 23:32:45 -04:00
Eduard Braun 46dfd139ef GDK W32: fix direction of horizontal smooth scrolling events
Commit 359df028be changed the
code to send GDK_SCROLL_SMOOTH with deltas instead of
GDK_SCROLL_(UP|DOWN|LEFT|RIGHT).

Windows defines deltas inversed for vertical direction
(positive values mean the wheel was turned forward)
but not for horizontal direction
(positive values mean the wheel was turned towards the right).

This commit fixes behavior as both axes were inverted previously.
2018-09-13 19:30:41 +00:00
Rūdolfs Mazurs 86751c4a25 Update Latvian translation 2018-09-13 15:30:28 +00:00
Matthias Clasen b1d3beedc3 Add a missing include
Closes https://gitlab.gnome.org/GNOME/gtk/issues/1325
2018-09-12 23:02:26 -04:00
Matthias Clasen f393d371e5 Merge branch 'wip/carlosg/issue-1317' into 'gtk-3-24'
modules: Check current context before retrieving surrounding

See merge request GNOME/gtk!326
2018-09-13 01:40:58 +00:00
Matthias Clasen 7d1d5119de Merge branch 'clear_preedit_fix' into 'gtk-3-24'
imwayland: Fix clearing of preedit text

See merge request GNOME/gtk!329
2018-09-13 01:32:11 +00:00
Matthias Clasen 7a404c32b5 Merge branch 'gtk-3-24-fix-glib-dep' into 'gtk-3-24'
gtk-3-24: build: Raise glib dependency for unicode 10.0 script names

See merge request GNOME/gtk!336
2018-09-13 01:26:35 +00:00
Руслан Ижбулатов db2c9a6ec8 GDK W32: send both smooth and discrete scrolling events
Commit 359df028be changed the
code to send GDK_SCROLL_SMOOTH with deltas instead of
GDK_SCROLL_(UP|DOWN|LEFT|RIGHT). Change it again, to send
both the GDK_SCROLL_SMOOTH and the GDK_SCROLL_(UP|DOWN|LEFT|RIGHT)
event separately (with the discrete event marked as emulated),
as this is what other backends (such as wayland) do.
2018-09-12 15:20:37 +00:00
Mart Raudsepp 9b563b9daa build: Raise glib dependency for unicode 10.0 script names
Unicode 10.0 script name enums are used in gtk/script-names.c, which
aren't defined before glib-2.53.4.
2018-09-12 13:30:18 +03:00
Dorota Czaplejewicz 99669503fb imwayland: Fix clearing of preedit text in webkitgtk
Fixes webkitgtk misbehaviour as outlined in https://gitlab.gnome.org/GNOME/gtk/issues/1316#note_312942 , which was introduced in 49b17e6c.
The preedit will be cleared on exit only if it is already present.
2018-09-11 12:12:28 +00:00
Dorota Czaplejewicz c22d5ab9f6 imwayland: Fix clearing of preedit text
Fixes terminal emulator misbehaviour as outlined in https://gitlab.gnome.org/GNOME/gtk/issues/1316, which was introduced in 49b17e6c. The original commit cleared preedit text by setting it to an empty string, which still counted as existing preedit. The fix sets preedit string to null, which is correctly understood as not present.
2018-09-11 12:11:10 +00:00
Chun-wei Fan 5d903cb094 builds: Fix introspection with MSVC builds
For building the introspection dumper program on Visual Studio, leave out
the G_LOG_DOMAIN as g-ir-scanner does not like it when it constructs the
compiler command line for Visual Studio.

Also ensure that we are looking for the freshly-built libraries by looking
for the .lib's from the output directories of the Visual Studio project files.
2018-09-11 18:13:10 +08:00
Jakub Steiner 416feacfe3 Merge branch 'adwaita-fixes-3' into 'gtk-3-24'
Adwaita: Fix errors in two recent MRs

See merge request GNOME/gtk!330
2018-09-10 19:07:26 +00:00
Adrien Plazas f893e668c8 Adwaita: Fix sidebar separator styling
Simplify the styling of sidebar separators by not setting their borders
and margins rather than trying to drop it afterward, which was actually
not working anyway.
2018-09-10 15:05:22 +02:00
Adrien Plazas a0acdcd08c Adwaita: Fix dropping the backgroud on nested headerbars
Make the selector less greedy to not remove the background on
non-titlebar headerbars contained in non-headerbar titlebars and only to
the ones contained in headerbar titlebars. This avoid issues in some
applications.

Also make dropping the background more agressive to actually remove it.
2018-09-10 14:54:19 +02:00
Jakub Steiner 6ab9a85ac9 Merge branch 'wip/adwaita/linked-entry-error-state-fix-3-24' into 'gtk-3-24'
Adwaita: Fix linked elements in error state

See merge request GNOME/gtk!316
2018-09-10 10:46:03 +00:00
Jakub Steiner 7e0aba77ff Merge branch 'selection-mode-ancestor-3' into 'gtk-3-24'
Adwaita: Set selection mode to headerbars if it's on ancestors

See merge request GNOME/gtk!325
2018-09-10 08:59:37 +00:00
Jakub Steiner cbf76d4693 Merge branch 'separator-sidebar-3' into 'gtk-3-24'
Adwaita: Style separator.sidebar

See merge request GNOME/gtk!323
2018-09-10 08:59:04 +00:00
Jakub Steiner 85a98d5d7c Merge branch 'nested-headerbar-3' into 'gtk-3-24'
Adwaita: Drop the background of nested headerbars

See merge request GNOME/gtk!322
2018-09-10 08:57:54 +00:00
Stas Solovey 87fa847b64 Update Russian translation 2018-09-09 20:44:39 +00:00
Stas Solovey 44fd2702da Update Russian translation 2018-09-09 20:06:36 +00:00
Fabio Tomat 4858f4b46e Update Friulian translation 2018-09-08 10:47:42 +00:00
Carlos Garnacho 88dc784256 modules: Check current context before retrieving surrounding
There may be situations where this might get called while the
currently focused context just went away (eg. after setting the
text widget unsensitive).

Closes: #1317
2018-09-07 17:01:12 +02:00
Adrien Plazas 43c458f45f Adwaita: Set selection mode to headerbars if it's on ancestors
This allows to set the container of the headerbars in selection mode
rather than having to set the mode to each element of the title bar.
2018-09-07 15:27:22 +02:00
Adrien Plazas f0696dfae0 Adwaita: Drop the background of nested headerbars
This is needed to work around headerbar sliding animation issues without
refactoring Adwaita's support of titlebars and headerbars as it may
break applications.

https://gitlab.gnome.org/GNOME/gtk/issues/1264
2018-09-07 13:07:46 +02:00
Adrien Plazas f9ba306116 Adwaita: Style separator.sidebar
Let separators be declared as sidebars to have the same style as those
drawn by GtkStackSidebar. This also let them handle the selection-mode
class, whether they are assigned it or they descend from something in
selection mode.

This is convenient when building a custom sidebar using a GtkSeparator
and to extend a sidebar to the title bar.
2018-09-07 12:42:26 +02:00
Matthias Clasen 47122288b8 Fix portal path handling
This was broken when I recently introduced this helper
function.
2018-09-05 19:58:03 -04:00
Matthias Clasen 6d5279f3c8 Merge branch 'gtk-3-24' into 'gtk-3-24'
GtkApplication: Fix CRITICAL on shutdown when register_session=FALSE

See merge request GNOME/gtk!320
2018-09-05 23:24:35 +00:00
Jan Alexander Steffens (heftig) 3c7d5e749c GtkApplication: Fix CRITICAL on shutdown when register_session=FALSE 2018-09-05 21:46:28 +02:00
Christoph Reiter 207e93f09c Merge branch 'ci-msys2-gtk-3-24' into 'gtk-3-24'
ci: Add an optional Windows build job using autotools and MSYS2

See merge request GNOME/gtk!319
2018-09-05 18:10:07 +00:00
Daniel Mustieles edf0e746ad Updated Spanish translation 2018-09-05 11:28:49 +02:00
Daniel Mustieles d1c119bc9f Updated Spanish translation 2018-09-05 11:26:10 +02:00
Marek Cernocky ef57e59af6 Updated Czech translation 2018-09-04 11:09:06 +02:00
Matthias Clasen ef1a1b5cb1 3.24.0 2018-09-03 12:41:53 -04:00
Christoph Reiter 003dc26a57 ci: Add an optional Windows build job using autotools and MSYS2
Set to "manual" because it takes 40-60 minutes depending on the ccache hit rate.
2018-09-03 17:10:40 +02:00
Efstathios Iosifidis 51a64c52b7 Update Greek translation 2018-09-03 10:46:15 +00:00
Anders Jonsson e357fc8ebb Update Swedish translation 2018-09-02 23:14:29 +00:00
Ask Hjorth Larsen f761fcc8ea Updated Danish translation of gtk-properties 2018-09-02 23:46:11 +02:00
Ask Hjorth Larsen d673bbce42 Updated Danish translation of gtk 2018-09-02 23:45:24 +02:00
Ask Hjorth Larsen 88bbc09bcc Updated Danish translation of gtk 2018-09-02 23:19:34 +02:00
gogo eaa8b0c76c Update Croatian translation 2018-09-02 21:16:16 +00:00
Ask Hjorth Larsen 01c81360ed Updated Danish translation of gtk-properties 2018-09-02 21:42:45 +02:00
gogo 351d9a75fe Update Croatian translation 2018-09-02 18:38:45 +00:00
Balázs Meskó c7e89d07eb Update Hungarian translation 2018-09-02 17:17:54 +00:00
Balázs Meskó f8d185d8df Update Hungarian translation 2018-09-02 17:12:37 +00:00
Alex Monday e33b93a97e themes: Fix linked elements in error state
Add instructions for color of linked elements border which ajoints
entry, when parent linked entry is in error state.
2018-09-02 14:43:13 +05:00
Fran Dieguez 2ea70c0318 Update Galician translation 2018-09-01 13:00:28 +00:00
Piotr Drąg db40563ab0 Update Polish translation 2018-08-31 19:46:22 +02:00
Rūdolfs Mazurs c57e98123f Update Latvian translation 2018-08-31 16:58:13 +00:00
Milo Casagrande c1ebaf6d81 Update Italian translation 2018-08-31 14:51:30 +00:00
Mario Blättermann abe3ccf572 Update German translation 2018-08-31 13:03:16 +00:00
Rafael Fontenelle cc1832ddde Update Brazilian Portuguese translation 2018-08-31 12:52:14 +00:00
Emin Tufan Çetin d54f330905 Update Turkish translation 2018-08-31 10:58:24 +00:00
Kukuh Syafaat ae2b356e86 Update Indonesian translation 2018-08-31 03:23:08 +00:00
Matthias Clasen 813c7b19ea GtkApplication: track screensaver state
A number of applications want to track the state of the screensaver.
Make this information available as a boolean property. We only listen
for state changes when ::register-session is set to TRUE.

This is implemented for unsandboxed D-Bus access by talking
directly to org.gnome.ScreenSaver or org.freedesktop.ScreenSaver,
and for sandboxed D-Bus by using a (new) portal API.
A Quartz implementation is missing.
2018-08-30 23:17:37 -04:00
Matthias Clasen 3fc319ff1b GtkApplication: Respect GTK_USE_PORTAL
When the environment variable is set, don't connect
to the session manager, but instead rely on the
inhibit portal.
2018-08-30 23:17:37 -04:00
Matthias Clasen f734c3d3b0 file chooser portal: use request path utilities
Less code duplication, more sticky toffee!
2018-08-30 23:10:13 -04:00
Matthias Clasen c3077467d0 print portal: use request path utilities
Less code duplication, more cookies!
2018-08-30 23:10:13 -04:00
Matthias Clasen e2d066a2ec color picker portal: Add request path utility
Less code duplication, more cake!
2018-08-30 23:10:13 -04:00
Matthias Clasen 6829719d6d Add utility functions for portal paths
The paths that we create for requests and sessions
need some icky code to create. Keep it in one place.
2018-08-30 23:10:13 -04:00
Fran Dieguez 3471349013 Update Galician translation 2018-08-30 17:42:44 +00:00
Marek Cernocky 33f77d86ff Updated Czech translation 2018-08-30 16:49:53 +02:00
Marek Cernocky f56a934a3a Updated Czech translation 2018-08-30 14:44:50 +02:00
Milo Casagrande 2dfed03b73 Update Italian translation 2018-08-30 12:24:38 +00:00
Tim Sabsch 8aa98cda45 Update German translation 2018-08-30 08:31:13 +00:00
Fran Dieguez 409a6b81e2 Update Galician translation 2018-08-29 21:49:56 +00:00
Claude Paroz 887b6f61a3 Updated French translation 2018-08-29 23:01:15 +02:00
Aurimas Černius 983739341d Updated Lithuanian translation 2018-08-29 22:22:58 +03:00
Emin Tufan Çetin 26f16c821b Update Turkish translation 2018-08-29 16:35:23 +00:00
Fran Dieguez 8234b065f6 Update Galician translation 2018-08-29 11:11:45 +00:00
Kukuh Syafaat 31354e1c68 Update Indonesian translation 2018-08-29 05:28:52 +00:00
Matthias Clasen 34c7eba642 3.23.3 2018-08-28 20:27:03 -04:00
Rafael Fontenelle 79c6c944ec Update Brazilian Portuguese translation 2018-08-28 22:32:57 +00:00
Anders Jonsson 3c265e8c1a Update Swedish translation 2018-08-28 21:10:24 +00:00
Matthias Clasen ceb69490a9 Merge branch 'app-private-recent-list' into 'gtk-3-24'
FileChooserWidget: Don't show recent items with private hint set

See merge request GNOME/gtk!172
2018-08-28 20:14:16 +00:00
Kai Willadsen 5111f7af99 FileChooserWidget: Don't show recent items with private hint set 2018-08-28 20:14:16 +00:00
Matthias Clasen aa69b3af5a Merge branch 'gtk-3-24.win.updated' into 'gtk-3-24'
Fix pre-C99 builds of the gtk-3-24 branch

See merge request GNOME/gtk!310
2018-08-28 20:10:04 +00:00
Matthias Clasen 2307f8ec67 Merge branch 'fix-warning-combobox-destroy' into 'gtk-3-24'
Fix warning on GtkComboBox destroy

See merge request GNOME/gtk!311
2018-08-28 19:27:24 +00:00
Piotr Drąg ea2bef06ec Update Polish translation 2018-08-28 18:48:15 +02:00
Luca Bacci aa5d926c84 Check for NULL priv->popup_window in gtk_combo_box_popdown()
Fixes issue #125
2018-08-28 18:39:05 +02:00
Matthias Clasen 61921eba57 Fix a typo
Its Hieroglyphs!

Closes: #1292
2018-08-28 12:26:49 -04:00
Changwoo Ryu 7ca98179fc Update Korean translation 2018-08-28 15:53:18 +00:00
Chun-wei Fan 608b44a9fa demos/gtk-demo/paint.c: Fix build on pre-C99
Use a const GdkRGBA to replace the compound literal use.
2018-08-28 17:43:11 +08:00
Chun-wei Fan 6cf7297653 gtk/gtkeventcontrollerscroll.c: Include fallback-c89.c
... instead of just math.h, as it uses the C99 function trunc().  This
is so that the code builds on pre-C99 compilers.
2018-08-28 17:43:11 +08:00
Chun-wei Fan 723e50990f gtk/fallback-c89.c: Add C89 fallback for trunc()
Check for trunc() during configure and provide a fallback implementation
for it if it is not found.
2018-08-28 17:43:04 +08:00
Rafael Fontenelle ab3527672e Update Brazilian Portuguese translation 2018-08-28 03:39:09 +00:00
Rafael Fontenelle 5dd2df75c9 Update Brazilian Portuguese translation 2018-08-28 02:56:52 +00:00
Changwoo Ryu 7f930b5ded Update Korean translation 2018-08-27 14:12:09 +00:00
Milo Casagrande a9df4a8f1b Update Italian translation 2018-08-27 08:02:19 +00:00
Matthias Clasen 0dc84df59b Merge branch 'clear_preedit' into 'gtk-3-24'
Clear preedit when a text input loses focus

See merge request GNOME/gtk!302
2018-08-26 23:48:26 +00:00
Matthias Clasen ac654740f3 Deprecate GtkRange::upper/lower-stepper-sensitivity
These properties have been removed in GTK+ 4.
Deprecate them here.
2018-08-26 18:58:59 -04:00
Kukuh Syafaat f459bd6c19 Update Indonesian translation 2018-08-26 13:43:56 +00:00
Kukuh Syafaat 4e690a3091 Update Indonesian translation 2018-08-26 13:43:26 +00:00
Baurzhan Muftakhidinov 4dfd44a84f Update Kazakh translation 2018-08-25 17:27:26 +00:00
Baurzhan Muftakhidinov a9ab1b1b39 Update Kazakh translation 2018-08-25 17:26:55 +00:00
Baurzhan Muftakhidinov 5dd8befca4 Update Kazakh translation 2018-08-25 17:26:07 +00:00
Christian Kirbach 49242af74c Update German translation 2018-08-25 10:48:51 +00:00
Dorota Czaplejewicz 49b17e6c1e imwayland: clear preedit on focus out 2018-08-23 22:03:01 +02:00
Benjamin Otte da8994f941 Don't deprecate gtk_widget_show_all()
After discussions on IRC, the conclusion was reached that deprecations
only make sense if an action can be taken to not use the deprecated code
that makes the code more current and simplifies a later port to a newer
GTK version.

In this particular case, the suitable action would be adding
gtk_widget_show() calls whenever a widget is created, so that a call to
show_all() is not necessary.
However, in GTK4 these calls would not be necessary and end up just
bloating the codebase unnecessarily.

So it was decided the better solution would be to not deprecate the API
and instead leave this work to be done during potential GTK4 ports of
applications.

This reverts commit 4d71d2303d.

Fixes !1282
2018-08-22 19:48:20 +02:00
Cheng-Chia Tseng 2b9f5e9e32 Update Chinese (Taiwan) translation 2018-08-21 16:23:16 +00:00
Cheng-Chia Tseng 6fa28bdaac Update Chinese (Taiwan) translation 2018-08-21 16:15:54 +00:00
Rico Tzschichholz 2306c82df7 gesturestylus: Add missing array g-i annotation for *_get_axes params 2018-08-20 17:01:59 +02:00
Bruce Cowan 009b7dcf1e Update British English translation 2018-08-19 16:50:48 +00:00
Matthias Clasen 45b434c28c Merge branch 'win32-scroll-deltas' into 'gtk-3-24'
GDK W32: Support smooth scrolling

See merge request GNOME/gtk!292
2018-08-18 20:44:24 +00:00
Tim Sabsch a6a2745a2a Update German translation 2018-08-18 15:41:45 +00:00
Jordi Mas 645ad9fb62 Update Catalan translation 2018-08-18 08:29:58 +02:00
Jordi Mas 3a8056f2d1 Update Catalan translation 2018-08-18 08:23:10 +02:00
Iain Lane dce33fa830 colorpickershell: Unpack the tuple returned from PickColor()
When calling PickColor on org.gnome.Shell, we get back an "a{sv}", which
GDBus provides to us as "(a{sv})".

At the minute we're not unpacking this tuple, and so picking fails with
messages like:

  GLib-CRITICAL **: 13:38:19.439: g_variant_lookup_value: assertion 'g_variant_is_of_type (dictionary, G_VARIANT_TYPE ("a{s*}")) || g_variant_is_of_type (dictionary, G_VARIANT_TYPE ("a{o*}"))' failed

  Gtk-WARNING **: 13:38:19.439: Picking color failed: No color received

Let's unpack it.
2018-08-17 09:10:59 -04:00
Ricardo Silva Veloso 25d512c186 Update Brazilian Portuguese translation 2018-08-17 08:32:13 +00:00
Matthias Clasen c9f875bd77 Merge branch 'fix-shifted-scrolling-gtk3' into 'gtk-3-24'
gtkscrolledwindow: Consider shift key presses when decelerating [gtk3]

See merge request GNOME/gtk!287
2018-08-15 22:02:45 +00:00
Matthias Clasen 677627346d Merge branch 'wip/tooltip-move-to-rect' into 'gtk-3-24'
Make tooltips use gdk_window_move_to_rect()

See merge request GNOME/gtk!293
2018-08-15 22:01:20 +00:00
Jonas Ådahl 436c8802a2 Merge branch 'wip/carlosg/issue-844' into 'gtk-3-24'
gdk/wayland: Avoid idempotent wl_subsurface.set_position calls

See merge request GNOME/gtk!294
2018-08-14 17:52:59 +00:00
Carlos Garnacho 935bb5db32 gdk/wayland: Avoid idempotent wl_subsurface.set_position calls
These may not result on wl_surface.frame callbacks, yet we do trigger
a frame clock tick that would get stuck on the lack of such callback.

https://bugzilla.gnome.org/show_bug.cgi?id=784314
https://gitlab.gnome.org/GNOME/gtk/issues/844

Closes: #844
2018-08-14 18:52:07 +02:00
Claude Paroz c4f2420e9a Updated French translation 2018-08-14 13:41:09 +02:00
Emin Tufan Çetin 96ea85a991 Update Turkish translation 2018-08-12 11:07:37 +00:00
Emin Tufan Çetin b5333aec99 Update Turkish translation 2018-08-12 10:27:10 +00:00
Emin Tufan Çetin f2f11a7f4d Update Turkish translation 2018-08-12 10:21:06 +00:00
Yi-Jyun Pan 9c4f684e1c Update Chinese (Taiwan) translation 2018-08-12 10:08:50 +00:00
Piotr Drąg fbdf100712 Update Polish translation 2018-08-11 23:57:28 +02:00
Aurimas Černius de9b22a137 Updated Lithuanian translation 2018-08-11 18:09:03 +03:00
Jonas Ådahl 14d22cb323 tooltip: Implement positioning using gdk_window_move_to_rect()
In order to make tooltip positioning portable, make use of the
move_to_rect API. Some semantical changes are made, as identical
semantics cannot be implemented using the move-to-rect API.

Primarily the implemented semantics are:

Position the tooltip in the center pixels slightly below (defaults to 4
units below) the tooltipped widget. This is always the case for keyboard
driven tooltips; the case where it tries to avoid the pointer cursor is
not implemented.

For pointer position triggered tooltips, implement the following
additional semantics:

Use the current cursor size to determine the padding used to enlarge the
anchor rectangle. This is to try to avoid the cursor overlapping the
tooltip.

If the anchor rectangle is too tall (meaning if we'd be constrained
and flip on the Y axis, it'd flip too far away from the originally
intended position), rely only on the pointer position to position the
tooltip. The approximate pointer cursor rectangle is used as a anchor
rectangle. Ideally we should use the actual pointer cursor rectangle
(image used as well as hotspot coordinate), but we don't have API to
get that information.

If the anchor rectangle isn't to tall, just make sure the tooltip isn't
too far away from the pointer position on the X axis.

Closes: #134
Closes: #432
Closes: #574
Closes: #579
Closes: #878
2018-08-10 18:32:54 +02:00
Jonas Ådahl 595f3902c8 gdk/wayland: Always map windows 'moved-to-rect' as popups
Only popups can make use of the move-to-rect semantics so it makes no
sense to try anything other surface type.
2018-08-10 18:32:54 +02:00
Jonas Ådahl 1ed53199c5 gdk/wayland: Don't remap non-subsurface as subsurface
Let's just use the fact that a window was mapped as a subsurface to
remap it above another transient parent instead of relying on the more
complicated 'should-map-as-subsurface' helper function.
2018-08-10 18:32:54 +02:00
Claude Paroz 2e9439b017 Update French translation 2018-08-09 10:37:29 +00:00
Matthias Clasen 2dde4e2ff8 Merge branch 'gtk-3-24-improve-error-message' into 'gtk-3-24'
gtkplacessidebar: Improve error message when unlocking volume fails

See merge request GNOME/gtk!266
2018-08-08 09:18:32 +00:00
Руслан Ижбулатов 359df028be GDK W32: Support smooth scrolling
Set delta_x or delta_y for GdkScrollEvent.
HIWORD (wParam) in WM_MOUSE(H)WHEEL is the scroll delta.
A delta value of WHEEL_DELTA (which is 120) means scrolling
one full unit of something (for example, a line).

The delta should also be multiplied by the value that the
SystemParametersInfo (SPI_GETWHEELSCROLL(LINES|CHARS), 0, &value, 0)
call gives back, unless it gives back 0xffffffff, in which case
it indicates that scrolling is page- or screen-based, not line-based
(GDK doesn't support that at the moment).

Also, all deltas should be inverted, since MS sends negative deltas
when scrolling down (rotating the wheel back, in the direction of
the user).

With deltas set the mode should be set to GDK_SCROLL_SMOOTH.

Fixes issue 1263.
2018-08-07 22:15:07 +00:00
Baurzhan Muftakhidinov 08f53740a5 Update Kazakh translation 2018-08-06 17:16:43 +00:00
Piotr Drąg a1f1144ff3 Update Polish translation 2018-08-06 18:55:14 +02:00
Matthias Clasen 290c5b6b85 Merge branch 'gtk-3-24-fix-link-error' into 'gtk-3-24'
font chooser widget: Add missing build flags

See merge request GNOME/gtk!290
2018-08-06 12:14:29 +00:00
Kouhei Sutou 4c94a76237 font chooser widget: Add missing build flags
If we detect HarfBuzz and PangoFT2, GtkFontChooserWidget uses them. So
we need to add CFLAGS and LIBS of them to GTK_DEP_CFLAGS/LIBS. If we
don't add them, MinGW build fails to link.
2018-08-06 16:19:35 +09:00
Aurimas Černius ac030fd5e1 Updated Lithuanian translation 2018-08-05 16:02:30 +03:00
Matthias Clasen 6b6e53fd23 Make color picker circular
The need for center alignment was pointed out by Timm Baeder.
2018-08-05 01:50:01 +00:00
Matthias Clasen 926f25aaec color picker: Also try kwin
use a kwin color picker when we run under kwin.
2018-08-05 01:48:29 +00:00
Matthias Clasen 7e74beec5b Only use the portal color picker when appropriate
This is just moving this check around.
2018-08-05 01:47:35 +00:00
Matthias Clasen fc44f9755a Add a kwin color picker
This uses the org.kde.kwin.ColorPicker interface.
2018-08-05 01:47:04 +00:00
Piotr Drąg e4a31bc9bc Update Polish translation 2018-08-04 19:39:31 +02:00
Sebastian Keller 5c6596ad99 gtkscrolledwindow: Consider shift key presses when decelerating
Otherwise horizontal scrolling using the shift key would decelerate
vertically.

Fixes https://gitlab.gnome.org/GNOME/gtk/issues/770
2018-08-04 16:36:47 +02:00
Benjamin Otte 6e4da8fbdb container: Deprecate focus chains 2018-07-31 22:46:15 +02:00
Matthias Clasen 4d71d2303d Deprecate show_all apis
These functions are gone in GTK+ 4, so deprecate them here.
2018-07-31 13:32:55 -04:00
Andrea Azzarone 06800b22ff window: Fallback to CSD titlebar in focus-chain
CSD titlebar are included in the focus-chain. The logic used makes sure that the
initial focus avoids the titlebar, but tabbing around will eventually get there.
This logic fails in case the window has no other focusable widgets apart from
the ones in the header-bar. If this happens keynav focus will be lost. To handle
the above scenario, we need to fallback to focus the header-bar (if any).

Fixes: https://gitlab.gnome.org/GNOME/gnome-software/issues/404
2018-07-31 02:37:12 +00:00
Matthias Clasen 9417389659 Update a11y test results
The color picker shows up here.
2018-07-31 02:06:46 +00:00
Matthias Clasen 69c85be8b2 3.23.2 2018-07-30 18:33:32 -04:00
Matthias Clasen 9bae0758eb color picker: Better debug spew
This will help in debugging issues.
2018-07-30 18:10:27 -04:00
Matthias Clasen 7f290426dc Add a color picker implementation for gnome-shell
This adds a GtkColorPicker implementation that talks
to gnome-shell to get a color.
2018-07-30 18:10:17 -04:00
Matthias Clasen 740fc3eeff Add a color picker implementation for portals
This adds a GtkColorPicker implementation that talks
to the screnshot portal to get a color.
2018-07-30 18:10:17 -04:00
Matthias Clasen 6b3272e4b0 color editor: Add a color picker button
The button is shown if we have a GtkColorPicker implementation.
Currently, there are none, so the button is never shown.
2018-07-30 18:10:17 -04:00
Matthias Clasen 543fb6d7b6 Add a color picker interface
This will be used in the color chooser, in subsequent commits.
2018-07-30 17:33:52 -04:00
Piotr Drąg ed1617334f Update POTFILES.in 2018-07-30 22:44:10 +02:00
Matthias Clasen 77b4c4432e Merge branch 'wl_text_input_clean' into 'gtk-3-24'
Replace gtk_text_input with text_input_unstable_v3 support

See merge request GNOME/gtk!272
2018-07-30 19:31:37 +00:00
Dorota Czaplejewicz 8d77256d53 imwayland: Add text-input-unstable-v3 support
The wayland input module now represents text-input-unstable-v3 support, while the old module supporting gtk-text-input was renamed to gtkwayland.
2018-07-30 20:27:22 +02:00
Matthias Clasen 5f0a14fa2a Merge branch 'issue1214-tooltips-win32' into 'gtk-3-24'
Gdk-Win32: Correct handling of transient state changes

See merge request GNOME/gtk!248
2018-07-30 14:53:48 +00:00
Piotr Drąg 4693fb9461 Update Polish translation 2018-07-29 20:24:41 +02:00
Matthias Clasen 8be955571d Updates 2018-07-29 13:08:05 +00:00
Matthias Clasen 7fa5c361be Include Emoji category icons as resources too
These icons are very new in the Adwaita icon theme, so we can't
rely on them being widely available, and will just include them
for now.
2018-07-29 09:02:23 -04:00
Matthias Clasen ff24c82dd4 Emoji chooser: Use icons for sections
This is more reliable than using text-style Emoji
which may not be present.

Based on work by Julian Sparber.
2018-07-29 09:02:07 -04:00
Aurimas Černius 7becabebe1 Updated Lithuanian translation 2018-07-28 20:31:14 +03:00
Carlos Garnacho ffa4e2308a Merge branch 'wip/chergert/imwayland-leak' into 'gtk-3-24'
imwayland: fix potential leak of attr list

See merge request GNOME/gtk!277
2018-07-28 10:14:56 +00:00
Christian Hergert 508e0648b5 imwayland: fix potential leak of attr list
This fixes a potential leak of a PangoAttrList that is set when chaining
up to the parent get_preedit_string(). We check to see if the attr list
was created and reuse it instead of leaking the previous value.
2018-07-27 23:46:31 -07:00
Luca Bacci 6348a7d48f Gdk-Win32: Correct handling of transient state changes
gdk_win32_window_set_transient_for() behaves incorrectly when
called in sequence with the same arguments. This fix ensures it
always operates correctly.
In some cases this function gets called multiple times with the
same arguments, e.g. when tooltips are shown.

See issue #1214
2018-07-27 12:11:18 +02:00
Benjamin Otte e0807fcf54 gtk; Deprecate gtk_render_frame_gap()
Use gtk_render_frame() instead.
2018-07-24 20:32:26 +02:00
Benjamin Otte 8fd5b567dc gdk: Add GDK_DEPRECATED_IN_3_24() macros 2018-07-24 20:32:26 +02:00
Daniel Mustieles a6de3ed7b4 Updated Spanish translation 2018-07-24 10:13:50 +02:00
segfault 138c196e53 gtkplacessidebar: Improve error message when unlocking volume fails 2018-07-23 23:38:06 +02:00
Daniel Mustieles 3658b8f709 Update Spanish translation 2018-07-23 10:07:23 +00:00
Daniel Mustieles c0b03564f5 Update Spanish translation 2018-07-23 10:02:39 +00:00
Matthias Clasen 8535610b19 Merge branch 'gtk-3-24-add-spinner-to-sidebar-row' into 'gtk-3-24'
gtkplacessidebar: Show busy spinner in sidebar row during mount ops

See merge request GNOME/gtk!260
2018-07-22 17:14:27 +00:00
segfault 0e7228b267 gtkplacessidebar: Show busy spinner in sidebar row during mount ops 2018-07-22 17:04:05 +02:00
Bastien Nocera 5b527d6910 test: Fix compile-time warnings
testsuite/gtk/notify.c: In function ‘test_type’:
testsuite/gtk/notify.c:434:14: warning: assignment to ‘GObject *’ {aka ‘struct _GObject *’} from incompatible pointer type ‘GtkSettings *’ {aka ‘struct _GtkSettings *’} [-Wincompatible-pointer-types]
     instance = g_object_ref (gtk_settings_get_default ());
              ^
testsuite/gtk/notify.c:443:16: warning: assignment to ‘GObject *’ {aka ‘struct _GObject *’} from incompatible pointer type ‘GdkWindow *’ {aka ‘struct _GdkWindow *’} [-Wincompatible-pointer-types]
       instance = g_object_ref (gdk_window_new (NULL, &attributes, 0));
                ^
2018-07-21 14:55:30 +02:00
Carlos Garnacho eb3fd5e941 gtksettings: Remove leftover code
The immodule variable is unused
2018-07-21 14:55:01 +02:00
Tim Sabsch ca192a87c2 Update German translation 2018-07-20 20:31:47 +00:00
Matthias Clasen fa77925da2 Merge branch 'gtk-3-24' into 'gtk-3-24'
Remove deprecated functions

See merge request GNOME/gtk!255
2018-07-20 14:07:44 +00:00
Benjamin Otte 172dc3e79a Merge branch 'wip/muktupavels/deprecate-gtk-css-provider-get-default' into 'gtk-3-24'
gtkcssprovider: deprecate gtk_css_provider_get_default

See merge request GNOME/gtk!257
2018-07-20 14:05:12 +00:00
Alberts Muktupāvels cb39169ba7 gtkcssprovider: deprecate gtk_css_provider_get_default
This function is unused since cdc6e82720 commit and does not
contain fallback style.

https://gitlab.gnome.org/GNOME/gtk/issues/1226
2018-07-20 14:55:27 +03:00
Emin Tufan Çetin 577dfb9e2f Update Turkish translation 2018-07-20 11:21:46 +00:00
Yi-Soo An db7f085315 tests/animated-resizing: Remove deprecated functions
The functions as below are deprecated
- gdk_screen_get_monitor_geometry
- gdk_screen_get_primary_monitor

Instead of them, use functions below
- gdk_monitor_get_geometry
- gdk_display_get_primary_monitor
2018-07-20 15:42:26 +09:00
Yi-Soo An de18859249 demos/gtk-demo/changedisplay: Remove deprecated gdk_flush
Use gdk_display_flush instead of it.
2018-07-20 15:40:37 +09:00
Yi-Soo An 5fb999010c modules/input/gtkimcontextthai: Remove deprecated gdk_beep
Use gdk_display_beep instead of it.
2018-07-20 15:39:49 +09:00
Timm Bäder 2c3a7c63ef Merge branch '628-text-view-width' into 'gtk-3-24'
Resolve #628: "TextView: spaces acting as non-breaking whitespace if :left- or :right-margin is set"

See merge request GNOME/gtk!236
2018-07-20 06:24:14 +00:00
Matthias Clasen 078870f604 Emoji chooser: Also check for hex boxes
We don't want to see those either.
2018-07-19 20:51:22 -04:00
Matthias Clasen c52d9cfc14 moji chooser: Try harder to avoid fallback
We don't want to see any fallback rendering.
The current check was still letting some fallback
combinations through.

Based on work by Julian Sparber.
2018-07-19 20:51:07 -04:00
Matthias Clasen e37e1dfcb0 Merge branch 'gtk-3-24-defaultvalues-ignore-more' into 'gtk-3-24'
defaultvalue: Ignore more style properties that Adwaita overrides

See merge request GNOME/gtk!253
2018-07-19 20:23:29 +00:00
Iain Lane 2e5307daea defaultvalue: Ignore more style properties that Adwaita overrides
These broke once we switched away from Raleigh
2018-07-19 16:29:14 +01:00
Daniel Boles cb4ea3fc65 NEWS: Remove an accidental tab 2018-07-18 23:09:12 +01:00
Timm Bäder 56033a8d27 gesturestylus: Clarify a documentation comment
Use the proper gtkdoc syntax for signals.
2018-07-18 23:05:06 +01:00
Matthias Clasen f7f3939b04 3.23.1 2018-07-18 16:58:17 -04:00
Piotr Drąg 13a36e81dc Update POTFILES.in 2018-07-18 17:00:11 +02:00
Matthias Clasen affb4ff5f4 Fix up version annotations
The new api here was introduced in 3.24.
2018-07-18 07:18:21 -04:00
Matthias Clasen ee22277f18 Add new API to the docs 2018-07-18 07:12:41 -04:00
Matthias Clasen cc73241c7b Merge branch 'wip/carlosg/controllers-backport' into 'gtk-3-24'
Wip/carlosg/controllers backport

See merge request GNOME/gtk!246
2018-07-18 00:23:37 +00:00
Balázs Meskó ac358d2507 Update Hungarian translation 2018-07-17 23:11:18 +00:00
Carlos Garnacho 9ee60777e7 sm scroll 2018-07-16 15:44:35 +02:00
Carlos Garnacho effdf3af74 demos: Add "Paint" demo 2018-07-16 15:43:43 +02:00
Carlos Garnacho a8463953a4 gtk: Add GtkGestureStylus
This is a GtkGesture done to deal with stylus events from drawing tablets.
Those have a special number of characteristics that extend a regular
pointer, so it makes sense to wrap that.
2018-07-16 15:43:43 +02:00
Carlos Garnacho 7793aab5f0 gtkeventcontrollerkey: Add ::focus-in/out signals
And handle GDK_FOCUS_CHANGE events in order to emit those.
2018-07-16 15:43:43 +02:00
Carlos Garnacho ecf9fa65b8 gtkeventcontrollerkey: Add get_group() call
Callers can use this function on a key-pressed/released signal
to find out the key event group, useful in a few places.
2018-07-16 15:43:43 +02:00
Carlos Garnacho a32933b056 eventcontrollerkey: Add function to forward stuff elsewhere 2018-07-16 15:43:43 +02:00
Carlos Garnacho e0f3e8a7e5 gtk: Add GtkEventControllerKey
This event controller is meant to replace usage from key-press/release-event
handlers all through. Optionally it can be set a GtkIMContext, so interaction
is carried by the controller.
2018-07-16 15:43:43 +02:00
Matthias Clasen 1f9de707f7 Add x/y to GtkEventControllerMotion::enter
We have this information available in enter events,
and having it in the controller signal as well makes
porting easier.

Update existing users.
2018-07-16 15:43:43 +02:00
Matthias Clasen 8b2c3a8c1a Add a simple motion eventcontroller
This can serve as a replacement for the legacy
event signals for enter/leave/motion notify.
2018-07-16 15:43:43 +02:00
Matthias Clasen e7af3410cf Avoid excess notification for GdkEventControllerScroll::flags
We have a test that checks this, and it is the right thing to do.
2018-07-16 15:43:43 +02:00
Carlos Garnacho 84d3bfb6fd gtk: Remove CONSTRUCT_ONLY flag from GtkEventControllerScroll::flags
There is a gtk_event_controller_scroll_set_flags() call that's meant
to be called after construction (eg. due to scrolledwindow relayouts
hiding/showing scrollbars). The property shouldn't be construct-only
for consistence.
2018-07-16 15:43:43 +02:00
Carlos Garnacho 448551f31c gtkeventcontrollerscroll: Add some docs 2018-07-16 15:43:43 +02:00
Timm Bäder 7b8c036f8f eventcontrollerscroll: Emit ::scroll for -1/+1 discrete steps
The > 1 meant it only emits the signal for -2/+2 steps.
2018-07-16 15:43:43 +02:00
Carlos Garnacho 747be0f499 gtk: Add GtkEventControllerScroll
This is a GtkEventController implementation to handle mouse
scrolling. It handles both smooth and discrete events and
offers a way for callers to tell their preference too, so
smooth events shall be accumulated and coalesced on request.

On capable devices, it can also emit ::scroll-begin and
::scroll-end enclosing all ::scroll events for a scroll
operation.

It also has builtin kinetic scrolling capabilities, reporting
the initial velocity for both axes after ::scroll-end if
requested.
2018-07-16 15:43:43 +02:00
Benjamin Otte 9008f7702d window: Update opaque region if background-color changes
The opaque region is only set when the background color is opaque. So
we need to do something about it when the background color changes.

However, in the case where a size allocation is going to happen, we
already do this update in size_allocate(), so in that case avoid doing
it twice.
2018-07-13 15:02:47 +02:00
Bruno Lopes da Silva df0454236c Update Brazilian Portuguese translation 2018-07-10 13:02:08 +00:00
Jakub Steiner 8373b906d4 Merge branch 'expander-size-3' into 'gtk-3-24'
HighContrast: Restore expander size

See merge request GNOME/gtk!210
2018-07-09 15:27:51 +00:00
Peter Bloomfield 4b4ae4464c text-view: Do not double-allocate borders
Reverts part of Commit 25b67af3

The 'width' part of the commit is the cause of #628: requisition->width
is first set to priv->layout->width, which already includes
priv->left_border + priv->right_border. It's a bit labyrinthine, but
essentially:

*  layout->width is set in update_layout_size() (gtktextlayout.c line 992)
   as the maximum line width, and
*  the line width is set to display->width in gtk_text_layout_real_wrap()
   (gtktextlayout.c line 1183), and
*  display->width is set to text_pixel_width + h_margin + h_padding in
   gtk_text_layout_get_line_display() (gtktextlayout.c line 2584), and
*  h_margin + h_padding is the same as priv->left_border +
   priv->right_border.

Adding it again leads to an increase in the size-request, which
results in wider lines; rinse and repeat.
2018-07-08 17:24:07 -04:00
Mario Blättermann 0bca6969d4 Update German translation 2018-07-07 19:48:26 +00:00
Samuel Thibault 660087db42 HighContrast: Restore expander size
Expanders used to be 16px high. With the move from the gtk2 rendering
to gtk3 rendering they shrunk to 12px, making them hard to see, because
it's now the icon which is 16px high and the icon contains transparent
borders.

This makes the HighContrast theme use 24px icons instead, to restore
16px expanders. This may expander some containers a bit.

Closes #1046
2018-07-03 19:27:15 +02:00
Jonas Ådahl 927004178f Merge branch 'fix_wayland_csd_announce' into 'gtk-3-24'
Fix gdk_wayland_window_announce_csd

See merge request GNOME/gtk!221
2018-07-03 10:14:57 +00:00
Daniel Boles 1b8de2d5fa Adwaita: Drop some unneeded overrides
The pseudoclasses work fine on the subnodes without having to also apply
`parent:class subnode`.
2018-07-02 21:45:06 +01:00
Daniel Boles 483d25f418 ModelButton: Add Since annotation on new prop 2018-07-02 20:31:45 +01:00
Daniel Boles 1d30ada735 ScrolledWindow: a couple of spelling/grammar fixes
(A) Put a space in "scrolled window" like the other doc comments
(B) Say "i.e." rather than "ie."
(C) Fix grammar from "makes [...] exactly reaches" to "exactly reach"
2018-07-02 20:11:12 +01:00
Daniel Boles 8a00551871 ScrolledWindow: Fix/improve doc of key bindings
Saying 'key + modifiers' is really weird, so reverse that, and explain
why there are 2 cited and what the difference between them is.
2018-07-02 20:09:37 +01:00
Daniel Boles 0ed3a77d29 ScrolledWindow: Add missing apostrophes 2018-07-02 20:07:23 +01:00
Matthias Clasen 29b61176bb Merge branch 'wip/gtk324.win.egl' into 'gtk-3-24'
Add an EGL renderer for GDK-Win32 for GTK+-3.24 (was: merge request !126)

See merge request GNOME/gtk!191
2018-07-02 17:18:26 +00:00
Matthias Clasen 174c4fa7ee Merge branch 'wip/aplazas/modelbutton-markup' into 'gtk-3-24'
ModelButton: Add 'use-markup' property

See merge request GNOME/gtk!219
2018-07-02 17:16:59 +00:00
Daniel Boles 08adcb6318 PlacesSidebar: Fix warning about signal parameters
@open_flags was not documented, and so:

jhbuild/checkout/gnome/gtk+-3/gtk/gtkplacessidebar.c:4743: Warning: Gtk:
incorrect number of parameters in comment block, parameter annotations
will be ignored.
2018-07-01 16:08:06 +01:00
Adrien Plazas 504eb89155 ModelButton: Add 'use-markup' property
Binds this property to the button's label, allowing a model button to
have text with markup.

This will be convenient for buttons like 'Online Accounts <sup>↗</sup>'.
2018-06-29 23:02:21 +02:00
Daniel Boles b75b5e900a themes: Remove Raleigh
It has been extremely broken since the move to CSS gadgets/nodes, so
clearly no one is depending on it; nor does anyone seem to want to
resurrect it, and writing a Raleigh-inspired theme from scratch would be
faster if they did. So let's drop the dead weight from the build and lib

Now that we don't have Raleigh, the defaultvalue test has to be changed
to set Adwaita before checking the default values of style properties -
some of which Adwaita overrides in its CSS, meaning those would fail.
Not that it passed before anyway! But it does now after my other commit.

Note that I leave the last reference in gtk-zip.sh.in alone since that
hasn't been touched in 8 years and probably has plenty other problems...

Close https://gitlab.gnome.org/GNOME/gtk/issues/1187
2018-06-29 20:12:19 +01:00
Daniel Boles ca4ec52c54 defaultvalue: Fix some very broken indentation
and while here, use the more typical : to separate the type and property
2018-06-29 19:57:06 +01:00
Daniel Boles 908d4f1d1f defaultvalue: Ignore property to actually pass
GtkFontChooserWidget:tweak-action gets set in init(), so we have to skip
testing that it is the default NULL for a GObject, or the test fails.
2018-06-29 18:57:43 +01:00
Daniel Boles 62573f299c defaultvalue: Stop warnings via new g_object_ref()
Now that it can propagate the type, we must explicitly cast to GObject*
to assign it, otherwise gcc shouts.
2018-06-29 18:46:09 +01:00
Daniel Boles c0bf48c8ab defaultvalue test: Remove obsolete properties 2018-06-29 18:46:09 +01:00
Matthias Clasen 26f35fb941 Merge branch 'wip/cursor-output-scale-changes-3-24' into 'gtk-3-24'
wayland: Update cursor surface scale when output scale changes

See merge request GNOME/gtk!223
2018-06-29 14:30:51 +00:00
David Edmundson d49335c59a wayland: Use correct enums in server_decoration_request_mode
The enum is duplicated in the spec for the manager and the decoration
object. We should be using the right ones. In practice they have the
same value, so this bug didn't cause any issues.
2018-06-28 18:51:12 +01:00
David Edmundson f62c92783a wayland: Respond to server_decoration.mode events 2018-06-28 18:51:12 +01:00
David Edmundson f3f4d40b89 wayland: Fix memory leak in server decoration object
The server decoration object becomes invaid when the wl_surface is
deleted. We should tidy it up then.
2018-06-28 18:51:12 +01:00
David Edmundson b0bfe606aa wayland: Reset server decoration interface on window mapping
The wl_surface is destroyed and recreated when the window is
mapped/unmapped. As we have a new wl_surface we need to create a new
server_decoration object for that surface.
2018-06-28 18:50:50 +01:00
David Edmundson 32ae97f13a wayland: Explicitly request mode for both CSD and SSD modes
According to the spec compositors were to assume surfaces are CSD until
told otherwise. This means we need to send
org_kde_kwin_server_decoration_request_mode in both cases.

This fixes libreoffice under kwin, which would remove it's own headers
as per the manager's request but not inform kwin leaving it in the even
more broken state of having none.
2018-06-28 18:50:50 +01:00
Jonas Ådahl 3354d91090 wayland: Update cursor surface scale when output scale changes
Cursor surfaces didn't listen for output scale changes, meaning they
didn't adapt their scale when an output changed scale, which could
happen for example when changing the monitor scale via Settings.
2018-06-28 12:01:48 +02:00
Chun-wei Fan b6db96cd1a GDK/Win32: Cleanup and further fix OpenGL/ES glitches
We also need to invalidate the OpenGL/ES window when we resize the
window via a mouse drag operation, so that we don't get glitches in such
situations, because they are not covered in GdkWindow's
impl_class->move_resize().

Make sure that we only force the invalidation when necessary (as it is
expensive), and clean up the gdkevents-win32.c code so that we include
gdkglcontext-win32.h in the right place instead of using an extern, as
we need to invalidate the window accordingly.
2018-06-28 15:33:42 +08:00
Chun-wei Fan b2ea707614 GDK-Win32: Fix glitches when using EGL/ANGLE
We need to force redraws of the whole window when we are using EGL/ANGLE
during maximize, restore and Aerosnap ops so that we do not get glitches
in the resulting window.
2018-06-28 15:33:42 +08:00
Chun-wei Fan af66faf604 Add a EGL renderer (via ANGLE) for Windows
This is for adding a EGL-based renderer which is done via the ANGLE
project, which translate EGL calls to Direct3D 9/11.  This is done as a
possible solution to issue #105, especially for cases where the needed
full GL extensions to map OpenGL to Direc3D is unavailable or
unreliable, or when the OpenGL implementation from the graphics drivers
are problematic.

To enable this, do the following:
-Build ANGLE and ensure the ANGLE libEGL.dll and libGLESv2.dll are
 available.  A sufficiently-recent ANGLE is needed for things to
 work correctly--note that the copy of ANGLE that is included in
 qtbase-5.10.1 is sufficient.  ANGLE is licensed under a BSD 3-clause
 license.  Note also that Visual Studio 2013 or later is required to
 build ANGLE from QT-5.10.1, but the 2013-built ANGLE DLLs can work
 without without problems for GTK+ that is built with Visual Studio
 2008 or later.
-Build libepoxy on Windows with EGL support enabled.
-Define GDK_WIN32_ENABLE_EGL when building gdk-win32.lib when building
 with Visual Studio, or pass in --enable-win32-gles during configure
 when building with MinGW/mingw-w64.
-Prior to running GTK+ programs, the GDK_GL envvar needs to contain
 gles.

Known issues:
-Only OpenGL ES 3 is supported, ANGLE's ES 2 does not support the needed
 extensions, notably GL_OES_vertex_array_object, but its ES 3 support is
 sufficient.
-There is no autodetection or fallback mechanism to enable using
 EGL/Angle automatically yet.  There is no plans to do this in this
 commit.

Thanks to LRN for pointing out that we should #include
"win32/gdkwin32.h" instead of #include "gdkwin32.h" for gdkgl.c.  LRN
also did the autotools portion of this patch.

Further notes about the autotools --enable-win32-gles option, fom LRN:

This adds --enable-win32-gles option, which enables the
code for GLES renderer.  This commit also adds tests for WGL and
EGL in epoxy.  The absence of WGL is highly unlikely (it's enabled
by default), but checking for EGL when GLES is enabled is necessary,
as EGL is disabled in Windows builds of epoxy by default.
2018-06-28 15:33:42 +08:00
Emmanuele Bassi 5afc01d995 Merge branch '324.win32.build' into 'gtk-3-24'
GTK+: Fix dist and build on Windows

See merge request GNOME/gtk!207
2018-06-27 18:26:02 +00:00
Chun-wei Fan f353ba3acb demos/gtk-demo/gtkfishbowl.c: Include gtk/fallback-c89.c
...in place of math.h, as we are using round(), which is possibly not
provided by the compiler since we don't require a C99 compiler in
GTK+-3.x and gtk/fallback-c89.c does include math.h anyways.
2018-06-26 16:40:18 +08:00
Chun-wei Fan eebf151f2a gtk/: Fix build without PangoFT2 and HarfBuzz
On Windows HarfBuzz and PangoFT2 are optional, so we need to ensure that
we only build the bits that require HarfBuzz and PangoFT2 when needed.
We may need to see later whether we can get the needed functionality in
gtkfontchooserwidget.c with the Windows APIs without the need of
HarfBuzz nor PangoFT2 (and starting programs on Windows using FontConfig
is very slow).
2018-06-26 16:40:18 +08:00
Chun-wei Fan e8d3899461 gtk/Makefile.am: Dist the newly-added private headers
We need to dist language-names.h and script-names.h so that we won't
be missing headers in a dist tarball.
2018-06-26 16:40:11 +08:00
Benjamin Otte e7bb83988f progressbar: Never stop never stopping
Reinstate code that was accidentally deleted during the port to
GtkProgressTracker in commit d57ebe2de7.

Without that code, pulsing the progressbar will stop doing anything
after 3 iterations.
2018-06-26 04:14:25 +02:00
Matthias Clasen b9b62fca0c Don't forget to dist open-type-layout.h
This is a private header, but it still needs to end up in the tarball.
2018-06-25 18:51:45 -04:00
Matthias Clasen 03c1c604dd Merge branch 'issue1170' into 'gtk-3-24'
modules: fix gtk-2.0 paths to gtk-3.0

See merge request GNOME/gtk!211
2018-06-25 21:13:24 +00:00
Matthias Clasen 504574b6be Merge branch 'mcatanzaro/#1174' into 'gtk-3-24'
imwayland: Fix a small leak

See merge request GNOME/gtk!218
2018-06-25 18:57:52 +00:00
Michael Catanzaro efb934c07f imwayland: Fix a small leak
If the parent get_preedit_string implementation returns a nonnull
zero-length string, then we ignore it, which is almost fine. We have to
free it, though.

Fixes #1174
2018-06-24 15:49:46 -05:00
Timm Bäder 69adcc46c9 Merge branch 'wip/chergert/no-compressed-ui' into 'gtk-3-24'
build: use xml-stripblanks with .ui resources

See merge request GNOME/gtk!216
2018-06-24 06:26:13 +00:00
Jehan 593edacb48 gtk: also recolor circle and ellipse in symbolic SVG icons. 2018-06-23 16:14:01 -04:00
Christian Hergert f05865ad3a build: use xml-stripblanks with .ui resources
This adds a preprocess step to the .ui files to strip them of blank
characters. It also removes the compressed='true' from the .ui files since
that involves creating lots of decompressor objects when creating widgets.
Doing so has runtime overhead and slows down the creation of initial
application windows.

The .ui files are left compressed for the Inspector, since that is not in
the core performance path of application startup.
2018-06-23 12:42:25 -07:00
Matthias Clasen 0997ffbc5b Update NEWS 2018-06-21 18:56:00 -04:00
Руслан Ижбулатов fc2008f240 GDK W32: Use SWP_NOOWNERZORDER everywhere it can be applied
There is no reason why we shouldn't pass this flag every time
Z-order changes. We have separate routines that are used to
maintain relative Z-order, so it should be completely OK to
pass SWP_NOOWNERZORDER to let the OS know that it shouldn't try
to maintain relative Z-order of the windows when raising them.
2018-06-17 10:48:48 +00:00
Руслан Ижбулатов 96be612c48 GDK W32: Don't let TEMP surfaces cause zorder side-effects
Pass SWP_NOOWNERZORDER when rising TEMP surfaces to the top. This ensures that
they don't drag anything else to the top with them. The use-case for this is
a tooltip (which must be on top) appearing for a non-foreground surface,
causing said surface to rise above other surfaces, some of which may
be foreground at the moment.

https://bugzilla.gnome.org/show_bug.cgi?id=784766

Fixes issue #852
2018-06-17 10:44:04 +00:00
291 changed files with 71049 additions and 24639 deletions
+12 -5
View File
@@ -3,11 +3,6 @@ image: registry.gitlab.gnome.org/gnome/gtk/gtk-3-24:v1
stages:
- build
before_script:
- mkdir -p _ccache
- export CCACHE_BASEDIR=${PWD}
- export CCACHE_DIR=${PWD}/_ccache
cache:
paths:
- _ccache/
@@ -16,3 +11,15 @@ build:
stage: build
script:
- bash -x ./.gitlab-ci/test-docker.sh
msys2-mingw32:
when: manual
variables:
MSYSTEM: "MINGW32"
CHERE_INVOKING: "yes"
stage: build
tags:
- win32
script:
- C:\msys64\usr\bin\pacman --noconfirm -Syyuu
- C:\msys64\usr\bin\bash -lc "bash -x ./.gitlab-ci/test-msys2.sh"
+4
View File
@@ -2,5 +2,9 @@
set -e
mkdir -p _ccache
export CCACHE_BASEDIR="$(pwd)"
export CCACHE_DIR="${CCACHE_BASEDIR}/_ccache"
./autogen.sh
make -j8
+45
View File
@@ -0,0 +1,45 @@
#!/bin/bash
set -e
if [[ "$MSYSTEM" == "MINGW32" ]]; then
export MSYS2_ARCH="i686"
else
export MSYS2_ARCH="x86_64"
fi
# Update everything
pacman --noconfirm -Suy
# Install the required packages
pacman --noconfirm -S --needed \
base-devel \
git \
mingw-w64-$MSYS2_ARCH-toolchain \
mingw-w64-$MSYS2_ARCH-ccache \
mingw-w64-$MSYS2_ARCH-pkg-config \
mingw-w64-$MSYS2_ARCH-gobject-introspection \
mingw-w64-$MSYS2_ARCH-adwaita-icon-theme \
mingw-w64-$MSYS2_ARCH-atk \
mingw-w64-$MSYS2_ARCH-cairo \
mingw-w64-$MSYS2_ARCH-gdk-pixbuf2 \
mingw-w64-$MSYS2_ARCH-glib2 \
mingw-w64-$MSYS2_ARCH-json-glib \
mingw-w64-$MSYS2_ARCH-libepoxy \
mingw-w64-$MSYS2_ARCH-pango \
mingw-w64-$MSYS2_ARCH-shared-mime-info \
mingw-w64-$MSYS2_ARCH-gtk-doc
mkdir -p _ccache
export CCACHE_BASEDIR="$(pwd)"
export CCACHE_DIR="${CCACHE_BASEDIR}/_ccache"
export CC="ccache gcc"
# Build
ccache --zero-stats
ccache --show-stats
./autogen.sh
make -j4
ccache --show-stats
+202
View File
@@ -1,3 +1,188 @@
Overview of Changes in GTK+ 3.24.2
==================================
* new api: gdk_x11_display_get_parent_relative pattern
* wayland: Use the settings portal when sandboxed
* Bugs fixed:
widget-factory: Move app menu contents to primary menu
Make dashed border-style work correctly
gtkstack: fix null pointer dereference
GDK W32: Support switching input modules at runtime
Tooltip: Fix the used cursor size if 0 in Settings
quartz: Fix crash when realizing GtkOffscreenWindow
win32 dnd: Fix setting icon on drag-begin
Fix race in GtkPlug window creation
widget-factory: Add Keyboard Shortcuts menu item
quartz: do not cache the screen in the gdkmonitor
Trash in side bar sometimes contains a home icon
wayland: Avoid crashes inside wl_proxy_marshal
gtkimcontextime.c: Fix Korean input
entry: Handle no-window events in gtk_entry_event
Tooltip: Fix the used cursor size if 0 in Setting
Notebook: Ensure menu_label updates with tab_label
Adwaita: Improve headerbar theming
win32: Make scroll behavior similar to Linux
fix symbolic icon rendering with new librsvg
emoji selector: force Emoji presentation
a11y: fix a crash under wayland
* Translation updates:
- Africaans
- Basque
- Brazilian Portuguese
- Chinese (Taiwan)
- Esperanto
- Lithuanian
- Slovak
- Slovenian
- Spanish
- Turkish
Overview of Changes in GTK+ 3.24.1
==================================
* Adwaita:
- Improvements to headerbar styling
* Wayland:
- Fix handling of preedit text
* Windows:
- Implement smooth scrolling
* Fix critical warnings on shutdown
* Translation updates:
- Czech
- Friulian
- Russian
- Spanish
Overview of Changes in GTK+ 3.24.0
==================================
* GtkApplication can now track screensaver state
* Translation updates:
- Brazilian Portuguese
- Croatian
- Czech
- Danish
- French
- Galician
- German
- Greek
- Hungarian
- Indonesian
- Italian
- Latvian
- Lithuanian
- Polish
- Swedish
- Turkish
Overview of Changes in GTK+ 3.23.3
==================================
* Deprecate a few APIs that are gone in GTK+ 4:
- focus chains in GtkContainer
- stepper sensitivity in GtkRange
* Allow picking colors under kwin
* Bug fixes:
#404 window: Fallback to CSD titlebar in focus-chain
#770 scrolledwindow: Fix horizontal decleration
#1263 win32: Implement smooth scrolling
#134 #432 #574 #579 #878
tooltip: Position using move-to-rect
#844 wayland: avoid idempotent wl_subsurface_set_position
#2393 Fix a typo
#125 combobox: Fix a critical warning
!290 fontchooser: Add missing build flags
!172 filechooser: Don't show private recent items
* Translation updates:
- Brazilian Portuguese
- British English
- Catalan
- Chinese (Taiwan)
- French
- German
- Indonesian
- Italian
- Kazakh
- Korean
- Lithuanian
- Polish
- Turkish
Overview of Changes in GTK+ 3.23.2
==================================
* Emoji chooser improvements
- Try harder to avoid fallback rendering
- Avoid hex boxes
- Use icons for sections
* Color chooser improvements
- Allow picking colors from the screen again. The current
implementation can use either the screnshot portal or
a recent gnome-shell API
* GtkPlacesSidebar now shows a spinner during mount operations
* Wayland
- Support both gtk-text-input and text-input-unstable-v3 as
input protocol
* Bug fixes:
#628 TextView: spaces acting as non-breaking whitespace...
!248 win32: Correct handling of transient state changes
!272 Replace gtk_text_input with text_input_unstable_v3 support
* Translation updates:
- German
- Lithuanian
- Polish
- Spanish
- Turkish
Overview of Changes in GTK+ 3.23.1
==================================
* Backported event controllers from GTK+ 4:
- GtkEventControllerScroll
- GtkEventControllerMotion
- GtkEventControllerKey
- GtkGestureStylus
* Support markup in GtkModelButtons
* Themes
- The Raleigh theme has been removed
- Expander size in HighContrast has been increased
* Wayland
- Update cursor scale when needed
- Decoration negotiation protocol fixes
* Windows
- Add an EGL renderer based on ANGLE
* Translation updates:
- Brazilian Portuguese
- German
- Hungarian
Overview of Changes in GTK+ 3.23.0
==================================
@@ -15,6 +200,12 @@ Overview of Changes in GTK+ 3.23.0
- Support a completion popup for Emoji
- Drop Ctrl-Shift-e shortcut
* Other new apis:
- gdk_window_move_to_rect
* Wayland:
- Use anonymous shared memory on FreeBSD
* Bugs fixed:
#85 widgetDragDestFindTarget introspection data does not show nullable...
#154 Documentation: Lifecycle of Editables inside GtkCellRenderers is no...
@@ -24,15 +215,26 @@ Overview of Changes in GTK+ 3.23.0
#450 Menu navigation triangle doesn't work anymore
#792 Focus events are not always matched
#898 emoji-chooser: search for flags doesn't work
#997 gdk: Make gdk_window_move_to_rect public
#1053 Scroll cursor gets left behind if a child widget steals the scroll
#1059 -Wparentheses warnings in GTK+ headers when compiling C++ code with...
#1065 GtkScrollbar horizontal mouse wheel scroll direction is wrong
#1069 Thread 1 "glade" received signal SIGFPE, Arithmetic exception.
#1088 CssGadget: Round px values up for min-width|height
#1115 gtk icon theme searches system dirs before user dirs
#1134 x11: Always set None pixmap for no background
#1160 a11y/entry: Fix copy-pasteo re 2ndary icon tooltip
#1165 InfoBar: Fix wrong type in copy-pasted param doc
#1166 EmojiCompletion: Use Box:spacing instead of CSS
!125 HC: Avoid same BG/FG colors in flat treeview entry
!157 wayland: Implement 'gtk-fontconfig-timestamp' & 'gtk-modules'
!181 W32: Don't forget to check VK_MENU and set MK_ALT
!206 searchenginetracker: Don't leak the hits' GFiles
407242 GtkScale: Up/Down keys decrease/increase value, which is opposite...
686109 gtk_print_context_get_hard_margins should return page size specif...
765327 GtkPlug scaled to half the expected size on HiDPI screens
772817 File Chooser: Path arrow button frames are reversed and detached ...
773299 gtk/language-names.c: Fix build on non-GCC/CLang
775279 early calls to libepoxy cause all gtk3 programs to abort when the...
786524 ocument GTK_OVERLAY_SCROLLING environment variable
787867 OSX macports pango text size appears to vary between version 1.40...
+1
View File
@@ -109,6 +109,7 @@ $(top_builddir)/build/win32/$(1).msvc.introspect:
echo ' --cflags-end \'>>$(top_builddir)/build/win32/$(1).msvc.introspect
echo ' '$($(_gir_name)_MSVC_SCANNERFLAGS)' \'>>$(top_builddir)/build/win32/$(1).msvc.introspect
echo ' --filelist='$(_gir_name)'_list \'>>$(top_builddir)/build/win32/$(1).msvc.introspect
echo ' -L.\vs$$$$(VSVER)\$$$$(CFG)\$$$$(PLAT)\bin \'>>$(top_builddir)/build/win32/$(1).msvc.introspect
echo ' -o $$$$@'>>$(top_builddir)/build/win32/$(1).msvc.introspect
echo '' >>$(top_builddir)/build/win32/$(1).msvc.introspect
+1
View File
@@ -42,6 +42,7 @@ EXTRA_DIST += \
replace.py \
pc_base.py \
gtkpc.py \
README_EGL_MSVC.txt \
$(GENERATED_ITEMS)
-include $(top_srcdir)/git.mk
+29
View File
@@ -0,0 +1,29 @@
Notes on enabling EGL (ANGLE/D3D support) for Windows/Visual Studio builds
==========================================================================
There is now support in the GL context creation code for Windows in GDK for
creating and using EGL (OpenGL ES 3) contexts, which can be used instead of
the existing OpenGL (Desktop) support, especially when the graphics drivers
do not support OpenGL adequately.
This support is not enabled by default in the project files. In order to do
so, please do the following:
-Obtain or compile a build of recent version of ANGLE. The one that comes
with QT 5.10.x is sufficiently recent, but not the one that comes with QT-
5.6.x. Note that Visual Studio 2013 or later is required for building
ANGLE from QT-5.10.x, but the Visual Studio 2013-built ANGLE DLLs does work
without problems with GTK+ built with Visual Studio 2008~2013. You may
need to obtain D3Dcompiler_[47|43|42].dll if it does not come with the
system (which is part of the DirectX runtimes). Its headers and .lib
needs to be set to be found by the compiler and linker respectively before
building libepoxy.
-Build libepoxy with EGL support, which has to be enabled explicitly on
Windows builds. Pass in -Degl=yes when building libepoxy using Meson.
Build and install, making sure the headers and .lib can be located by the
compiler and linker respectively.
-Open the vsX/gtk+.sln, and open the project properties in the "gdk3-win32"
project. Under "C/C++", add GDK_WIN32_ENABLE_EGL in the "Preprocessor
Definitions" to the existing definitions in there for the configuration
that is being built. Then build the solution.
-To force the use of the EGL code, set the envvar GDK_GL=(...,)gles , where (...,)
are the other GDK_GL options desired.
+2 -2
View File
@@ -10,10 +10,10 @@
<GdkDefines>GDK_COMPILATION;G_LOG_DOMAIN="Gdk"</GdkDefines>
<GtkIncludedImmodulesDefines>INCLUDE_IM_am_et;INCLUDE_IM_cedilla;INCLUDE_IM_cyrillic_translit;INCLUDE_IM_ime;INCLUDE_IM_inuktitut;INCLUDE_IM_ipa;INCLUDE_IM_multipress;INCLUDE_IM_thai;INCLUDE_IM_ti_er;INCLUDE_IM_ti_et;INCLUDE_IM_viqr</GtkIncludedImmodulesDefines>
<GtkDefines>GTK_COMPILATION;G_LOG_DOMAIN="Gtk";GTK_HOST="i686-pc-vs$(VSVer)";GTK_PRINT_BACKENDS="file";GTK_PRINT_BACKEND_ENABLE_UNSUPPORTED;$(GtkIncludedImmodulesDefines);GTK_LIBDIR="$(GtkDummyPrefix)/lib";GTK_DATADIR="$(GtkDummyPrefix)/share";GTK_DATA_PREFIX="$(GtkDummyPrefix)";GTK_SYSCONFDIR="$(GtkDummyPrefix)/etc";MULTIPRESS_CONFDIR="$(GtkDummyPrefix)/etc/gtk-$(ApiVersion)";MULTIPRESS_LOCALEDIR="$(GtkDummyPrefix)/share/locale";GTK_VERSION="$(GtkVersion)/etc";GTK_BINARY_VERSION="$(GtkBinaryVersion)/etc";GDK_DISABLE_DEPRECATED;ISOLATION_AWARE_ENABLED</GtkDefines>
<GtkGdkCommonLibs>imm32.lib</GtkGdkCommonLibs>
<GtkGdkCommonLibs>pangowin32-1.0.lib;imm32.lib</GtkGdkCommonLibs>
<GdkAdditionalLibs>winmm.lib;dwmapi.lib;setupapi.lib;$(GtkGdkCommonLibs)</GdkAdditionalLibs>
<GdkBroadwayAdditionalLibs>ws2_32.lib</GdkBroadwayAdditionalLibs>
<GtkAdditionalLibs>atk-1.0.lib;pangowin32-1.0.lib;winspool.lib;comctl32.lib;$(GtkGdkCommonLibs)</GtkAdditionalLibs>
<GtkAdditionalLibs>atk-1.0.lib;winspool.lib;comctl32.lib;$(GtkGdkCommonLibs)</GtkAdditionalLibs>
<GtkIntrospectNMakeCmd>cd ..
set VCInstallDir=$(VCInstallDir)
nmake -f gtk-introspection-msvc.mak CFG=$(Configuration) PREFIX=$(GlibEtcInstallRoot)</GtkIntrospectNMakeCmd>
+2 -2
View File
@@ -45,7 +45,7 @@
/>
<UserMacro
Name="GtkGdkCommonLibs"
Value="imm32.lib"
Value="pangowin32-1.0.lib imm32.lib"
/>
<UserMacro
Name="GdkBroadwayAdditionalLibs"
@@ -57,7 +57,7 @@
/>
<UserMacro
Name="GtkAdditionalLibs"
Value="atk-1.0.lib pangowin32-1.0.lib winspool.lib comctl32.lib $(GtkGdkCommonLibs)"
Value="atk-1.0.lib winspool.lib comctl32.lib $(GtkGdkCommonLibs)"
/>
<UserMacro
Name="GtkIntrospectNMakeCmd"
+5
View File
@@ -209,6 +209,11 @@
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if trunc() is available */
#if !defined (_MSC_VER) || (_MSC_VER >= 1800)
# define HAVE_TRUNC 1
#endif
/* Define to 1 if you have the <unistd.h> header file. */
#ifndef _MSC_VER
#define HAVE_UNISTD_H 1
+60 -19
View File
@@ -9,8 +9,8 @@
# set GTK_BINARY_AGE and GTK_INTERFACE_AGE to 0.
m4_define([gtk_major_version], [3])
m4_define([gtk_minor_version], [23])
m4_define([gtk_micro_version], [0])
m4_define([gtk_minor_version], [24])
m4_define([gtk_micro_version], [2])
m4_define([gtk_interface_age], [0])
m4_define([gtk_binary_age],
[m4_eval(100 * gtk_minor_version + gtk_micro_version)])
@@ -42,7 +42,7 @@ m4_define([gtk_binary_version], [3.0.0])
# required versions of other packages
m4_define([glib_required_major], [2])
m4_define([glib_required_minor], [49])
m4_define([glib_required_minor], [53])
m4_define([glib_required_micro], [4])
m4_define([glib_required_version],
[glib_required_major.glib_required_minor.glib_required_micro])
@@ -409,7 +409,7 @@ if test "x$enable_quartz_backend" = xyes; then
backend_immodules="$backend_immodules,quartz"
GDK_WINDOWING="$GDK_WINDOWING
#define GDK_WINDOWING_QUARTZ"
GDK_EXTRA_LIBS="$GDK_EXTRA_LIBS -framework Cocoa"
GDK_EXTRA_LIBS="$GDK_EXTRA_LIBS -Wl,-framework,Cocoa"
DISABLE_ON_QUARTZ='%'
AM_CONDITIONAL(USE_QUARTZ, true)
if test "x$quartz_relocation" = xyes; then
@@ -876,9 +876,10 @@ AC_CHECK_FUNCS(mallinfo)
AC_CHECK_FUNCS(getresuid)
AC_TYPE_UID_T
# Check for round(), rint(), isnan(), isinf() and nearbyint()
# Check for round(), rint(), isnan() and isinf()
# Check for log2(), exp2(), nearbyint() and trunc()
AC_CHECK_LIB(m,round,,)
AC_CHECK_FUNCS(round rint nearbyint sincos exp2 log2)
AC_CHECK_FUNCS(round rint nearbyint sincos exp2 log2 trunc)
AC_CHECK_DECLS([isnan, isinf], [], [], [[#include <math.h>]])
# Checks for gdkspawn
@@ -1426,6 +1427,22 @@ if test x"$os_win32" = xyes; then
GTK_EXTRA_CFLAGS="$msnative_struct"
fi
##################################################
# Check for harfbuzz and pangoft2
##################################################
PKG_CHECK_MODULES(GTK_FONT_CHOOSER_WIDGET,
harfbuzz >= 0.9 pangoft2,
build_font_demo=yes,
build_font_demo=no)
AM_CONDITIONAL(BUILD_FONT_DEMO, [ test "x$build_font_demo" = xyes ])
if test "x$build_font_demo" = xyes; then
AC_DEFINE([HAVE_HARFBUZZ], 1, [defines whether we have HarfBuzz])
AC_DEFINE([HAVE_PANGOFT], 1, [defines whether we have pangoft2])
GTK_DEP_CFLAGS="$GTK_DEP_CFLAGS $GTK_FONT_CHOOSER_WIDGET_CFLAGS"
GTK_DEP_LIBS="$GTK_DEP_LIBS $GTK_FONT_CHOOSER_WIDGET_LIBS"
fi
if $PKG_CONFIG --exists x11; then
X11_PREFIX="`$PKG_CONFIG --variable=prefix x11`"
elif test x"$prefix" != xNONE; then
@@ -1434,6 +1451,43 @@ else
X11_PREFIX="$ac_default_prefix"
fi
AC_ARG_ENABLE(win32-gles,
[AS_HELP_STRING([--enable-win32-gles],
[enable OpenGL ES rendering in Win32 backend, disabled by default])],
[win32_gles=yes],
[win32_gles=no])
if test x"$enable_win32_backend" = xyes; then
AC_MSG_CHECKING(WGL support in epoxy)
WGL_SUPPORT="`$PKG_CONFIG --variable=epoxy_has_wgl epoxy`"
if test x"$WGL_SUPPORT" = x1; then
AC_MSG_RESULT([supported])
else
AC_MSG_ERROR([
*** epoxy was not built with WGL support or epoxy version is too old.
*** WGL support in epoxy is enabled by default for all Windows builds,
*** and is used by GTK+ uncondititonally. If it is not there, then
*** something is very wrong.
])
fi
if test x"$win32_gles" = xyes; then
AC_MSG_CHECKING(EGL support in epoxy)
EGL_SUPPORT="`$PKG_CONFIG --variable=epoxy_has_egl epoxy`"
if test x"$EGL_SUPPORT" = x1; then
AC_MSG_RESULT([supported])
else
AC_MSG_ERROR([
*** epoxy was not built with EGL support or epoxy version is too old.
*** EGL support in epoxy is disabled by default in Windows builds,
*** you might need to rebuild epoxy with explicit --enable-egl=yes.
*** EGL support is needed for OpenGL ES rendering.
])
fi
fi
fi
AM_CONDITIONAL(WIN32_GLES, test x"$platform_win32" = xyes -a x"$win32_gles" = xyes)
GLIB_PREFIX="`$PKG_CONFIG --variable=prefix glib-2.0`"
ATK_PREFIX="`$PKG_CONFIG --variable=prefix atk`"
PANGO_PREFIX="`$PKG_CONFIG --variable=prefix pango`"
@@ -1740,19 +1794,6 @@ if test "$have_colord" = "yes"; then
fi
AM_CONDITIONAL(HAVE_COLORD, test "x$have_colord" = "xyes")
##################################################
# Check for harfbuzz and pangoft2
##################################################
PKG_CHECK_MODULES(FONTDEMO, harfbuzz >= 0.9 pangoft2, build_font_demo=yes, build_font_demo=no)
AC_SUBST(FONTDEMO_CFLAGS)
AC_SUBST(FONTDEMO_LIBS)
AM_CONDITIONAL(BUILD_FONT_DEMO, [ test "x$build_font_demo" = xyes ])
if test "x$build_font_demo" = xyes; then
AC_DEFINE([HAVE_HARFBUZZ], 1, [defines whether we have HarfBuzz])
AC_DEFINE([HAVE_PANGOFT], 1, [defines whether we have pangoft2])
fi
##################################################
# Checks for gtk-doc and docbook-tools
##################################################
+1 -5
View File
@@ -48,6 +48,7 @@ demos_base = \
offscreen_window2.c \
overlay.c \
overlay2.c \
paint.c \
panes.c \
pickers.c \
pixbufs.c \
@@ -103,11 +104,6 @@ LDADDS = \
$(GDK_DEP_LIBS) \
-lm
if BUILD_FONT_DEMO
AM_CPPFLAGS += $(FONTDEMO_CFLAGS)
LDADDS += $(FONTDEMO_LIBS)
endif
bin_PROGRAMS = gtk3-demo gtk3-demo-application
desktopdir = $(datadir)/applications
+1 -1
View File
@@ -151,7 +151,7 @@ query_for_toplevel (GdkScreen *screen,
g_object_unref (cursor);
gtk_widget_destroy (popup);
gdk_flush (); /* Really release the grab */
gdk_display_flush (display); /* Really release the grab */
return toplevel;
}
+2 -2
View File
@@ -144,7 +144,7 @@ create_capital_store (void)
{ NULL, "Jackson" },
{ NULL, "Jefferson City" },
{ NULL, "Juneau" },
{ "K - O" },
{ "K - O", NULL },
{ NULL, "Lansing" },
{ NULL, "Lincoln" },
{ NULL, "Little Rock" },
@@ -154,7 +154,7 @@ create_capital_store (void)
{ NULL, "Nashville" },
{ NULL, "Oklahoma City" },
{ NULL, "Olympia" },
{ NULL, "P - S" },
{ "P - S", NULL },
{ NULL, "Phoenix" },
{ NULL, "Pierre" },
{ NULL, "Providence" },
+1
View File
@@ -177,6 +177,7 @@
<file>offscreen_window2.c</file>
<file>overlay.c</file>
<file>overlay2.c</file>
<file>paint.c</file>
<file>pagesetup.c</file>
<file>panes.c</file>
<file>pickers.c</file>
+1 -1
View File
@@ -19,7 +19,7 @@
#include "gtkfishbowl.h"
#include <math.h>
#include "gtk/fallback-c89.c"
typedef struct _GtkFishbowlPrivate GtkFishbowlPrivate;
typedef struct _GtkFishbowlChild GtkFishbowlChild;
+6 -7
View File
@@ -762,15 +762,14 @@ load_file (const gchar *demoname,
/* Skipping blank lines */
while (g_ascii_isspace (*p))
p++;
if (*p)
{
p = lines[i];
state++;
/* Fall through */
}
else
if (!*p)
break;
p = lines[i];
state++;
/* Fall through */
case 3:
/* Reading program body */
gtk_text_buffer_insert (source_buffer, &start, p, -1);
+257
View File
@@ -0,0 +1,257 @@
/* Paint
*
* Demonstrates practical handling of drawing tablets in a real world
* usecase.
*/
#include <gtk/gtk.h>
typedef struct
{
GtkEventBox parent_instance;
cairo_surface_t *surface;
cairo_t *cr;
GdkRGBA draw_color;
GtkGesture *stylus_gesture;
} DrawingArea;
typedef struct
{
GtkEventBoxClass parent_class;
} DrawingAreaClass;
G_DEFINE_TYPE (DrawingArea, drawing_area, GTK_TYPE_EVENT_BOX)
static void
drawing_area_ensure_surface (DrawingArea *area,
gint width,
gint height)
{
if (!area->surface ||
cairo_image_surface_get_width (area->surface) != width ||
cairo_image_surface_get_height (area->surface) != height)
{
cairo_surface_t *surface;
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
width, height);
if (area->surface)
{
cairo_t *cr;
cr = cairo_create (surface);
cairo_set_source_surface (cr, area->surface, 0, 0);
cairo_paint (cr);
cairo_surface_destroy (area->surface);
cairo_destroy (area->cr);
cairo_destroy (cr);
}
area->surface = surface;
area->cr = cairo_create (surface);
}
}
static void
drawing_area_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
DrawingArea *area = (DrawingArea *) widget;
drawing_area_ensure_surface (area, allocation->width, allocation->height);
GTK_WIDGET_CLASS (drawing_area_parent_class)->size_allocate (widget, allocation);
}
static void
drawing_area_map (GtkWidget *widget)
{
GtkAllocation allocation;
GTK_WIDGET_CLASS (drawing_area_parent_class)->map (widget);
gdk_window_set_event_compression (gtk_widget_get_window (widget), TRUE);
gtk_widget_get_allocation (widget, &allocation);
drawing_area_ensure_surface ((DrawingArea *) widget,
allocation.width, allocation.height);
}
static void
drawing_area_unmap (GtkWidget *widget)
{
DrawingArea *area = (DrawingArea *) widget;
g_clear_pointer (&area->cr, cairo_destroy);
g_clear_pointer (&area->surface, cairo_surface_destroy);
GTK_WIDGET_CLASS (drawing_area_parent_class)->unmap (widget);
}
static gboolean
drawing_area_draw (GtkWidget *widget,
cairo_t *cr)
{
DrawingArea *area = (DrawingArea *) widget;
GtkAllocation allocation;
gtk_widget_get_allocation (widget, &allocation);
cairo_set_source_rgb (cr, 1, 1, 1);
cairo_paint (cr);
cairo_set_source_surface (cr, area->surface, 0, 0);
cairo_paint (cr);
cairo_set_source_rgb (cr, 0.6, 0.6, 0.6);
cairo_rectangle (cr, 0, 0, allocation.width, allocation.height);
cairo_stroke (cr);
return TRUE;
}
static void
drawing_area_class_init (DrawingAreaClass *klass)
{
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
widget_class->size_allocate = drawing_area_size_allocate;
widget_class->draw = drawing_area_draw;
widget_class->map = drawing_area_map;
widget_class->unmap = drawing_area_unmap;
}
static void
drawing_area_apply_stroke (DrawingArea *area,
GdkDeviceTool *tool,
gdouble x,
gdouble y,
gdouble pressure)
{
if (gdk_device_tool_get_tool_type (tool) == GDK_DEVICE_TOOL_TYPE_ERASER)
{
cairo_set_line_width (area->cr, 10 * pressure);
cairo_set_operator (area->cr, CAIRO_OPERATOR_DEST_OUT);
}
else
{
cairo_set_line_width (area->cr, 4 * pressure);
cairo_set_operator (area->cr, CAIRO_OPERATOR_SATURATE);
}
cairo_set_source_rgba (area->cr, area->draw_color.red,
area->draw_color.green, area->draw_color.blue,
area->draw_color.alpha * pressure);
//cairo_set_source_rgba (area->cr, 0, 0, 0, pressure);
cairo_line_to (area->cr, x, y);
cairo_stroke (area->cr);
cairo_move_to (area->cr, x, y);
}
static void
stylus_gesture_down (GtkGestureStylus *gesture,
gdouble x,
gdouble y,
DrawingArea *area)
{
cairo_new_path (area->cr);
}
static void
stylus_gesture_motion (GtkGestureStylus *gesture,
gdouble x,
gdouble y,
DrawingArea *area)
{
GdkDeviceTool *tool;
gdouble pressure;
tool = gtk_gesture_stylus_get_device_tool (gesture);
if (!gtk_gesture_stylus_get_axis (gesture, GDK_AXIS_PRESSURE, &pressure))
pressure = 1;
drawing_area_apply_stroke (area, tool, x, y, pressure);
gtk_widget_queue_draw (GTK_WIDGET (area));
}
static void
drawing_area_init (DrawingArea *area)
{
const GdkRGBA draw_rgba = { 0, 0, 0, 1 };
gtk_event_box_set_visible_window (GTK_EVENT_BOX (area), TRUE);
area->stylus_gesture = gtk_gesture_stylus_new (GTK_WIDGET (area));
g_signal_connect (area->stylus_gesture, "down",
G_CALLBACK (stylus_gesture_down), area);
g_signal_connect (area->stylus_gesture, "motion",
G_CALLBACK (stylus_gesture_motion), area);
area->draw_color = draw_rgba;
}
GtkWidget *
drawing_area_new (void)
{
return g_object_new (drawing_area_get_type (), NULL);
}
void
drawing_area_set_color (DrawingArea *area,
GdkRGBA *color)
{
area->draw_color = *color;
}
static void
color_button_color_set (GtkColorButton *button,
DrawingArea *draw_area)
{
GdkRGBA color;
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (button), &color);
drawing_area_set_color (draw_area, &color);
}
GtkWidget *
do_paint (GtkWidget *toplevel)
{
static GtkWidget *window = NULL;
if (!window)
{
GtkWidget *draw_area, *headerbar, *colorbutton;
const GdkRGBA draw_rgba = { 0, 0, 0, 1 };
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
draw_area = drawing_area_new ();
gtk_container_add (GTK_CONTAINER (window), draw_area);
headerbar = gtk_header_bar_new ();
gtk_header_bar_set_title (GTK_HEADER_BAR (headerbar), "Paint");
gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (headerbar), TRUE);
colorbutton = gtk_color_button_new ();
g_signal_connect (colorbutton, "color-set",
G_CALLBACK (color_button_color_set), draw_area);
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (colorbutton),
&draw_rgba);
gtk_header_bar_pack_end (GTK_HEADER_BAR (headerbar), colorbutton);
gtk_window_set_titlebar (GTK_WINDOW (window), headerbar);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show_all (window);
else
gtk_widget_destroy (window);
return window;
}
-1
View File
@@ -63,7 +63,6 @@ uninstall-update-icon-cache:
EXTRA_DIST += \
widget-factory.ui \
widget-factory.css \
menus.ui \
help-overlay.ui \
widget-factory.gresource.xml \
data/source.svg \
-19
View File
@@ -1,19 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<menu id="app-menu">
<section>
<item>
<attribute name="label" translatable="yes">About</attribute>
<attribute name="action">app.about</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">_Quit</attribute>
<attribute name="action">app.quit</attribute>
<attribute name="accel">&lt;Primary&gt;q</attribute>
</item>
</section>
</menu>
</interface>
@@ -6,9 +6,6 @@
<gresource prefix="/org/gtk/WidgetFactory">
<file>widget-factory.css</file>
</gresource>
<gresource prefix="/org/gtk/WidgetFactory/gtk">
<file preprocess="xml-stripblanks">menus.ui</file>
</gresource>
<gresource prefix="/org/gtk/WidgetFactory/gtk">
<file preprocess="xml-stripblanks">help-overlay.ui</file>
</gresource>
+10
View File
@@ -16,6 +16,16 @@
<attribute name="action">win.transition</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
<attribute name="action">win.show-help-overlay</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_About Widget Factory</attribute>
<attribute name="action">app.about</attribute>
</item>
</section>
</menu>
<menu id="dinner_menu">
<section>
+1
View File
@@ -1124,6 +1124,7 @@ gdk_x11_get_default_screen
gdk_x11_get_default_xdisplay
gdk_x11_grab_server
gdk_x11_ungrab_server
gdk_x11_get_parent_relative_pattern
gdk_x11_cursor_get_xcursor
gdk_x11_cursor_get_xdisplay
gdk_x11_keymap_get_group_for_state
+4
View File
@@ -301,6 +301,9 @@
<chapter id="Gestures">
<title>Gestures and event handling</title>
<xi:include href="xml/gtkeventcontroller.xml" />
<xi:include href="xml/gtkeventcontrollerkey.xml" />
<xi:include href="xml/gtkeventcontrollerscroll.xml" />
<xi:include href="xml/gtkeventcontrollermotion.xml" />
<xi:include href="xml/gtkgesture.xml" />
<xi:include href="xml/gtkgesturesingle.xml" />
<xi:include href="xml/gtkgesturedrag.xml" />
@@ -310,6 +313,7 @@
<xi:include href="xml/gtkgestureswipe.xml" />
<xi:include href="xml/gtkgesturerotate.xml" />
<xi:include href="xml/gtkgesturezoom.xml" />
<xi:include href="xml/gtkgesturestylus.xml" />
<xi:include href="xml/gtkpadcontroller.xml" />
</chapter>
+81
View File
@@ -8266,6 +8266,63 @@ GtkEventControllerPriv
gtk_event_controller_get_type
</SECTION>
<SECTION>
<FILE>gtkeventcontrollerscroll</FILE>
<TITLE>GtkEventControllerScroll</TITLE>
GtkEventControllerScroll
GtkEventControllerScrollFlags
gtk_event_controller_scroll_new
gtk_event_controller_scroll_set_flags
gtk_event_controller_scroll_get_flags
<SUBSECTION Standard>
GTK_TYPE_EVENT_CONTROLLER_SCROLL
GTK_EVENT_CONTROLLER_SCROLL
GTK_EVENT_CONTROLLER_SCROLL_CLASS
GTK_IS_EVENT_CONTROLLER_SCROLL
GTK_IS_EVENT_CONTROLLER_SCROLL_CLASS
GTK_EVENT_CONTROLLER_SCROLL_GET_CLASS
<SUBSECTION Private>
gtk_event_controller_scroll_get_type
</SECTION>
<SECTION>
<FILE>gtkeventcontrollermotion</FILE>
<TITLE>GtkEventControllerMotion</TITLE>
GtkEventControllerMotion
gtk_event_controller_motion_new
<SUBSECTION Standard>
GTK_TYPE_EVENT_CONTROLLER_MOTION
GTK_EVENT_CONTROLLER_MOTION
GTK_EVENT_CONTROLLER_MOTION_CLASS
GTK_IS_EVENT_CONTROLLER_MOTION
GTK_IS_EVENT_CONTROLLER_MOTION_CLASS
GTK_EVENT_CONTROLLER_MOTION_GET_CLASS
<SUBSECTION Private>
gtk_event_controller_motion_get_type
</SECTION>
<SECTION>
<FILE>gtkeventcontrollerkey</FILE>
<TITLE>GtkEventControllerKey</TITLE>
GtkEventControllerKey
gtk_event_controller_key_new
<SUBSECTION Standard>
GTK_TYPE_EVENT_CONTROLLER_KEY
GTK_EVENT_CONTROLLER_KEY
GTK_EVENT_CONTROLLER_KEY_CLASS
GTK_IS_EVENT_CONTROLLER_KEY
GTK_IS_EVENT_CONTROLLER_KEY_CLASS
GTK_EVENT_CONTROLLER_KEY_GET_CLASS
<SUBSECTION Private>
gtk_event_controller_key_get_type
</SECTION>
<SECTION>
<FILE>gtkgesture</FILE>
<TITLE>GtkGesture</TITLE>
@@ -8490,6 +8547,30 @@ GTK_PAD_CONTROLLER_GET_CLASS
gtk_pad_controller_get_type
</SECTION>
<SECTION>
<FILE>gtkgesturestylus</FILE>
<TITLE>GtkGestureStylus</TITLE>
GtkGestureStylus
gtk_gesture_stylus_new
gtk_gesture_stylus_get_axis
gtk_gesture_stylus_get_axes
gtk_gesture_stylus_get_backlog
gtk_gesture_stylus_get_device_tool
<SUBSECTION Standard>
GTK_TYPE_GESTURE_STYLUS
GTK_GESTURE_STYLUS
GTK_GESTURE_STYLUS_CLASS
GTK_IS_GESTURE_STYLUS
GTK_IS_GESTURE_STYLUS_CLASS
GTK_GESTURE_STYLUS_GET_CLASS
GtkGestureStylusClass
<SUBSECTION Private>
gtk_gesture_stylus_get_type
</SECTION>
<SECTION>
<FILE>gtkstacksidebar</FILE>
GtkStackSidebar
+4
View File
@@ -65,6 +65,9 @@ gtk_entry_completion_get_type
gtk_entry_get_type
gtk_event_box_get_type
gtk_event_controller_get_type
gtk_event_controller_key_get_type
gtk_event_controller_motion_get_type
gtk_event_controller_scroll_get_type
gtk_expander_get_type
gtk_file_chooser_button_get_type
gtk_file_chooser_dialog_get_type
@@ -88,6 +91,7 @@ gtk_gesture_multi_press_get_type
gtk_gesture_pan_get_type
gtk_gesture_rotate_get_type
gtk_gesture_single_get_type
gtk_gesture_stylus_get_type
gtk_gesture_swipe_get_type
gtk_gesture_zoom_get_type
gtk_gl_area_get_type
+1 -1
View File
@@ -34,12 +34,12 @@ EXTRA_DIST += \
gdkversionmacros.h.in
GDK_CFLAGS_DEFINES = \
-DG_LOG_DOMAIN=\"Gdk\" \
-DG_LOG_USE_STRUCTURED=1 \
-DGDK_COMPILATION
AM_CPPFLAGS = \
-DG_LOG_DOMAIN=\"Gdk\" \
$(GDK_CFLAGS_DEFINES) \
-I$(top_builddir) \
-I$(top_builddir)/gdk \
+1
View File
@@ -62,5 +62,6 @@ GDK_AVAILABLE_IN_ALL
GdkPrivateVTable * gdk__private__ (void);
gboolean gdk_running_in_sandbox (void);
gboolean gdk_should_use_portal (void);
#endif /* __GDK__PRIVATE_H__ */
+19 -6
View File
@@ -471,14 +471,27 @@ gdk_display_open_default (void)
gboolean
gdk_running_in_sandbox (void)
{
char *path;
gboolean ret;
return g_file_test ("/.flatpak-info", G_FILE_TEST_EXISTS);
}
path = g_build_filename (g_get_user_runtime_dir (), "flatpak-info", NULL);
ret = g_file_test (path, G_FILE_TEST_EXISTS);
g_free (path);
gboolean
gdk_should_use_portal (void)
{
static const char *use_portal = NULL;
return ret;
if (G_UNLIKELY (use_portal == NULL))
{
if (gdk_running_in_sandbox ())
use_portal = "1";
else
{
use_portal = g_getenv ("GTK_USE_PORTAL");
if (!use_portal)
use_portal = "";
}
}
return use_portal[0] == '1';
}
/**
+1 -1
View File
@@ -224,7 +224,7 @@ GType gdk_cursor_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GdkCursor* gdk_cursor_new_for_display (GdkDisplay *display,
GdkCursorType cursor_type);
GDK_DEPRECATED_IN_3_16
GDK_DEPRECATED_IN_3_16_FOR(gdk_cursor_new_for_display)
GdkCursor* gdk_cursor_new (GdkCursorType cursor_type);
GDK_AVAILABLE_IN_ALL
GdkCursor* gdk_cursor_new_from_pixbuf (GdkDisplay *display,
+10
View File
@@ -1257,6 +1257,11 @@ _gdk_display_has_touch_grab (GdkDisplay *display,
{
guint i;
g_return_val_if_fail (display, NULL);
if (!display->touch_implicit_grabs)
return NULL;
for (i = 0; i < display->touch_implicit_grabs->len; i++)
{
GdkTouchGrabInfo *info;
@@ -1318,6 +1323,11 @@ _gdk_display_check_grab_ownership (GdkDisplay *display,
GdkGrabOwnership higher_ownership, device_ownership;
gboolean device_is_keyboard;
g_return_val_if_fail (display, TRUE);
if (!display->device_grabs)
return TRUE; /* No hash table, no grabs. */
g_hash_table_iter_init (&iter, display->device_grabs);
higher_ownership = device_ownership = GDK_OWNERSHIP_NONE;
device_is_keyboard = (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD);
+1 -1
View File
@@ -62,7 +62,7 @@ G_BEGIN_DECLS
#define GDK_PRIORITY_EVENTS (G_PRIORITY_DEFAULT)
/**
* GDK_PRIORITY_REDRAW:
* GDK_PRIORITY_REDRAW: (value 120)
*
* This is the priority that the idle handler processing window updates
* is given in the
+12 -1
View File
@@ -22,6 +22,10 @@
#include "gdkinternals.h"
#ifdef GDK_WINDOWING_WIN32
# include "win32/gdkwin32.h"
#endif
#include <epoxy/gl.h>
#include <math.h>
#include <string.h>
@@ -641,6 +645,13 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
{
/* Software fallback */
int major, minor, version;
gboolean es_read_bgra = FALSE;
#ifdef GDK_WINDOWING_WIN32
/* on ANGLE GLES, we need to set the glReadPixel() format as GL_BGRA instead */
if (GDK_WIN32_IS_GL_CONTEXT(paint_context))
es_read_bgra = TRUE;
#endif
gdk_gl_context_get_version (paint_context, &major, &minor);
version = major * 100 + minor;
@@ -683,7 +694,7 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
glReadPixels (x, y, width, height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
cairo_image_surface_get_data (image));
else
glReadPixels (x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE,
glReadPixels (x, y, width, height, es_read_bgra ? GL_BGRA : GL_RGBA, GL_UNSIGNED_BYTE,
cairo_image_surface_get_data (image));
glPixelStorei (GL_PACK_ROW_LENGTH, 0);
+8 -2
View File
@@ -793,11 +793,17 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
has_npot = priv->gl_version >= 20;
has_texture_rectangle = FALSE;
/* This should check for GL_NV_framebuffer_blit - see extension at:
/* This should check for GL_NV_framebuffer_blit as well - see extension at:
*
* https://www.khronos.org/registry/gles/extensions/NV/NV_framebuffer_blit.txt
*
* for ANGLE, we can enable bit blitting if we have the
* GL_ANGLE_framebuffer_blit extension
*/
priv->has_gl_framebuffer_blit = FALSE;
if (epoxy_has_gl_extension ("GL_ANGLE_framebuffer_blit"))
priv->has_gl_framebuffer_blit = TRUE;
else
priv->has_gl_framebuffer_blit = FALSE;
/* No OES version */
priv->has_frame_terminator = FALSE;
+8 -8
View File
@@ -149,7 +149,7 @@ parse_rgb_value (const gchar *str,
* - A RGBA color in the form “rgba(r,g,b,a)”
*
* Where “r”, “g”, “b” and “a” are respectively the red, green, blue and
* alpha color values. In the last two cases, r g and b are either integers
* alpha color values. In the last two cases, “r”, “g”, and “b” are either integers
* in the range 0 to 255 or percentage values in the range 0% to 100%, and
* a is a floating point value in the range 0 to 1.
*
@@ -333,18 +333,18 @@ gdk_rgba_equal (gconstpointer p1,
* @rgba: a #GdkRGBA
*
* Returns a textual specification of @rgba in the form
* `rgb (r, g, b)` or
* `rgba (r, g, b, a)`,
* `rgb(r,g,b)` or
* `rgba(r g,b,a)`,
* where “r”, “g”, “b” and “a” represent the red, green,
* blue and alpha values respectively. r, g, and b are
* represented as integers in the range 0 to 255, and a
* is represented as floating point value in the range 0 to 1.
* blue and alpha values respectively. “r”, “g”, and “b” are
* represented as integers in the range 0 to 255, and “a”
* is represented as a floating point value in the range 0 to 1.
*
* These string forms are string forms those supported by
* These string forms are string forms that are supported by
* the CSS3 colors module, and can be parsed by gdk_rgba_parse().
*
* Note that this string representation may lose some
* precision, since r, g and b are represented as 8-bit
* precision, since “r”, “g” and “b” are represented as 8-bit
* integers. If this is a concern, you should use a
* different representation.
*
+3 -2
View File
@@ -449,12 +449,13 @@ gdk_seat_tool_removed (GdkSeat *seat,
GdkDeviceTool *
gdk_seat_get_tool (GdkSeat *seat,
guint64 serial)
guint64 serial,
guint64 hw_id)
{
GdkSeatClass *seat_class;
g_return_val_if_fail (GDK_IS_SEAT (seat), NULL);
seat_class = GDK_SEAT_GET_CLASS (seat);
return seat_class->get_tool (seat, serial);
return seat_class->get_tool (seat, serial, hw_id);
}
+4 -4
View File
@@ -275,7 +275,8 @@ gdk_seat_default_get_slaves (GdkSeat *seat,
static GdkDeviceTool *
gdk_seat_default_get_tool (GdkSeat *seat,
guint64 serial)
guint64 serial,
guint64 hw_id)
{
GdkSeatDefaultPrivate *priv;
GdkDeviceTool *tool;
@@ -290,7 +291,7 @@ gdk_seat_default_get_tool (GdkSeat *seat,
{
tool = g_ptr_array_index (priv->tools, i);
if (tool->serial == serial)
if (tool->serial == serial && tool->hw_id == hw_id)
return tool;
}
@@ -436,8 +437,7 @@ gdk_seat_default_remove_tool (GdkSeatDefault *seat,
priv = gdk_seat_default_get_instance_private (seat);
if (tool != gdk_seat_get_tool (GDK_SEAT (seat),
gdk_device_tool_get_serial (tool)))
if (tool != gdk_seat_get_tool (GDK_SEAT (seat), tool->serial, tool->hw_id))
return;
g_signal_emit_by_name (seat, "tool-removed", tool);
+4 -2
View File
@@ -57,7 +57,8 @@ struct _GdkSeatClass
GdkSeatCapabilities capabilities);
GdkDeviceTool * (* get_tool) (GdkSeat *seat,
guint64 serial);
guint64 serial,
guint64 tool_id);
};
void gdk_seat_device_added (GdkSeat *seat,
@@ -72,6 +73,7 @@ void gdk_seat_tool_removed (GdkSeat *seat,
GdkDeviceTool *
gdk_seat_get_tool (GdkSeat *seat,
guint64 serial);
guint64 serial,
guint64 hw_id);
#endif /* __GDK_SEAT_PRIVATE_H__ */
+8
View File
@@ -422,6 +422,14 @@
# define GDK_AVAILABLE_IN_3_22 _GDK_EXTERN
#endif
#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_24
# define GDK_DEPRECATED_IN_3_24 GDK_DEPRECATED
# define GDK_DEPRECATED_IN_3_24_FOR(f) GDK_DEPRECATED_FOR(f)
#else
# define GDK_DEPRECATED_IN_3_24 _GDK_EXTERN
# define GDK_DEPRECATED_IN_3_24_FOR(f) _GDK_EXTERN
#endif
#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_3_24
# define GDK_AVAILABLE_IN_3_24 GDK_UNAVAILABLE(3, 24)
#else
+5 -6
View File
@@ -6442,8 +6442,9 @@ G_GNUC_END_IGNORE_DEPRECATIONS
*
* Sets the background of @window.
*
* A background of %NULL means that the window will inherit its
* background from its parent window.
* A background of %NULL means that the window won't have any background. On the
* X11 backend it's also possible to inherit the background from the parent
* window using gdk_x11_get_parent_relative_pattern().
*
* The windowing system will normally fill a window with its background
* when the window is obscured then exposed.
@@ -6478,12 +6479,10 @@ gdk_window_set_background_pattern (GdkWindow *window,
* gdk_window_get_background_pattern:
* @window: a window
*
* Gets the pattern used to clear the background on @window. If @window
* does not have its own background and reuses the parent's, %NULL is
* returned and youll have to query it yourself.
* Gets the pattern used to clear the background on @window.
*
* Returns: (nullable) (transfer none): The pattern to use for the
* background or %NULL to use the parents background.
* background or %NULL if there is no background.
*
* Since: 2.22
*
+78 -20
View File
@@ -120,6 +120,13 @@
inMove = YES;
}
#ifdef AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER
#define NSLeftMouseUp NSEventTypeLeftMouseUp
#define NSLeftMouseDragged NSEventTypeLeftMouseDragged
#define NSMouseEntered NSEventTypeMouseEntered
#endif
-(void)sendEvent:(NSEvent *)event
{
switch ([event type])
@@ -189,7 +196,6 @@
GdkWindow *window = [[self contentView] gdkWindow];
GdkEvent *event;
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
gboolean maximized = gdk_window_get_state (window) & GDK_WINDOW_STATE_MAXIMIZED;
/* In case the window is changed when maximized remove the maximized state */
@@ -220,7 +226,6 @@
NSRect content_rect = [self contentRectForFrameRect:[self frame]];
GdkWindow *window = [[self contentView] gdkWindow];
GdkEvent *event;
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
gboolean maximized = gdk_window_get_state (window) & GDK_WINDOW_STATE_MAXIMIZED;
/* see same in windowDidMove */
@@ -256,7 +261,15 @@
[self checkSendEnterNotify];
}
-(id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)styleMask backing:(NSBackingStoreType)backingType defer:(BOOL)flag screen:(NSScreen *)screen
-(id)initWithContentRect:(NSRect)contentRect
#if MAC_OS_X_VERSION_MIN_REQUIRED < 101200
styleMask:(NSUInteger)styleMask
#else
styleMask:(NSWindowStyleMask)styleMask
#endif
backing:(NSBackingStoreType)backingType
defer:(BOOL)flag
screen:(NSScreen *)screen
{
self = [super initWithContentRect:contentRect
styleMask:styleMask
@@ -367,6 +380,46 @@
initialPositionKnown = NO;
}
- (NSPoint)convertPointToScreen:(NSPoint)point
{
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
if (gdk_quartz_osx_version () >= GDK_OSX_MOJAVE)
{
return [super convertPointToScreen: point];
}
#endif
if (gdk_quartz_osx_version () >= GDK_OSX_LION)
{
NSRect inrect = NSMakeRect (point.x, point.y, 0.0, 0.0);
NSRect outrect = [self convertRectToScreen: inrect];
return (NSPoint)((CGRect)outrect).origin;
}
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
return [self convertBaseToScreen:point];
#endif
}
- (NSPoint)convertPointFromScreen:(NSPoint)point
{
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
if (gdk_quartz_osx_version () >= GDK_OSX_MOJAVE)
{
return [super convertPointFromScreen: point];
}
#endif
if (gdk_quartz_osx_version () >= GDK_OSX_LION)
{
NSRect inrect = NSMakeRect (point.x, point.y, 0.0, 0.0);
NSRect outrect = [self convertRectFromScreen: inrect];
return (NSPoint)((CGRect)outrect).origin;
}
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
return [self convertScreenToBase:point];
#endif
}
- (BOOL)trackManualMove
{
GdkWindow *window = [[self contentView] gdkWindow];
@@ -379,7 +432,7 @@
if (!inManualMove)
return NO;
currentLocation = [self convertBaseToScreen:[self mouseLocationOutsideOfEventStream]];
currentLocation = [self convertPointToScreen:[self mouseLocationOutsideOfEventStream]];
newOrigin.x = currentLocation.x - initialMoveLocation.x;
newOrigin.y = currentLocation.y - initialMoveLocation.y;
@@ -410,7 +463,7 @@
inManualMove = YES;
initialMoveLocation = [self convertBaseToScreen:[self mouseLocationOutsideOfEventStream]];
initialMoveLocation = [self convertPointToScreen:[self mouseLocationOutsideOfEventStream]];
initialMoveLocation.x -= frame.origin.x;
initialMoveLocation.y -= frame.origin.y;
}
@@ -426,8 +479,7 @@
return NO;
inTrackManualResize = YES;
mouse_location = [self convertBaseToScreen:[self mouseLocationOutsideOfEventStream]];
mouse_location = [self convertPointToScreen:[self mouseLocationOutsideOfEventStream]];
mdx = initialResizeLocation.x - mouse_location.x;
mdy = initialResizeLocation.y - mouse_location.y;
@@ -512,7 +564,7 @@
resizeEdge = edge;
initialResizeFrame = [self frame];
initialResizeLocation = [self convertBaseToScreen:[self mouseLocationOutsideOfEventStream]];
initialResizeLocation = [self convertPointToScreen:[self mouseLocationOutsideOfEventStream]];
}
@@ -578,7 +630,7 @@ update_context_from_dragging_info (id <NSDraggingInfo> sender)
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
{
GdkDeviceManager *device_manager;
GdkSeat *seat = NULL;
GdkEvent *event;
GdkWindow *window;
@@ -592,10 +644,8 @@ update_context_from_dragging_info (id <NSDraggingInfo> sender)
current_context->display = gdk_window_get_display (window);
device_manager = gdk_display_get_device_manager (gdk_display_get_default ());
gdk_drag_context_set_device (current_context,
gdk_device_manager_get_client_pointer (device_manager));
seat = gdk_display_get_default_seat (gdk_display_get_default ());
gdk_drag_context_set_device (current_context, gdk_seat_get_pointer (seat));
event = gdk_event_new (GDK_DRAG_ENTER);
event->dnd.window = g_object_ref (window);
event->dnd.send_event = FALSE;
@@ -647,7 +697,7 @@ update_context_from_dragging_info (id <NSDraggingInfo> sender)
- (NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender
{
NSPoint point = [sender draggingLocation];
NSPoint screen_point = [self convertBaseToScreen:point];
NSPoint screen_point = [self convertPointToScreen:point];
GdkEvent *event;
int gx, gy;
@@ -675,7 +725,7 @@ update_context_from_dragging_info (id <NSDraggingInfo> sender)
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
{
NSPoint point = [sender draggingLocation];
NSPoint screen_point = [self convertBaseToScreen:point];
NSPoint screen_point = [self convertPointToScreen:point];
GdkEvent *event;
int gy, gx;
@@ -761,17 +811,27 @@ update_context_from_dragging_info (id <NSDraggingInfo> sender)
}
#ifdef AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER
#if MAC_OS_X_VERSION_MIN_REQUIRED < 101200
typedef enum
{
GDK_QUARTZ_FULL_SCREEN_MASK = NSFullScreenWindowMask,
} GdkQuartzFullScreen;
#else
typedef enum
{
GDK_QUARTZ_FULL_SCREEN_MASK = NSWindowStyleMaskFullScreen,
} GdkQuartzFullScreen;
#endif
- (void)setStyleMask:(NSUInteger)styleMask
{
gboolean was_fullscreen;
gboolean is_fullscreen;
was_fullscreen = (([self styleMask] & NSFullScreenWindowMask) != 0);
was_fullscreen = (([self styleMask] & GDK_QUARTZ_FULL_SCREEN_MASK) != 0);
[super setStyleMask:styleMask];
is_fullscreen = (([self styleMask] & NSFullScreenWindowMask) != 0);
is_fullscreen = (([self styleMask] & GDK_QUARTZ_FULL_SCREEN_MASK) != 0);
if (was_fullscreen != is_fullscreen)
_gdk_quartz_window_update_fullscreen_state ([[self contentView] gdkWindow]);
@@ -800,7 +860,6 @@ update_context_from_dragging_info (id <NSDraggingInfo> sender)
{
NSRect screenFrame = [[self screen] visibleFrame];
GdkWindow *window = [[self contentView] gdkWindow];
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
gboolean maximized = gdk_window_get_state (window) & GDK_WINDOW_STATE_MAXIMIZED;
if (!maximized)
@@ -814,7 +873,6 @@ update_context_from_dragging_info (id <NSDraggingInfo> sender)
{
GdkWindow *window = [[self contentView] gdkWindow];
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
gboolean maximized = gdk_window_get_state (window) & GDK_WINDOW_STATE_MAXIMIZED;
if (maximized)
+2 -1
View File
@@ -53,7 +53,8 @@
#ifdef AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER
-(void)setStyleMask:(NSUInteger)styleMask;
#endif
- (NSPoint)convertPointToScreen:(NSPoint)point;
- (NSPoint)convertPointFromScreen:(NSPoint)point;
@end
+5 -3
View File
@@ -17,6 +17,7 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include <AvailabilityMacros.h>
#include "config.h"
#import "GdkQuartzView.h"
#include "gdkquartzwindow.h"
@@ -123,7 +124,6 @@
-(void)unmarkText
{
GDK_NOTE (EVENTS, g_message ("unmarkText"));
gchar *prev_str;
markedRange = selectedRange = NSMakeRange (NSNotFound, 0);
g_object_set_data_full (G_OBJECT (gdk_window), TIC_MARKED_TEXT, NULL, g_free);
@@ -133,7 +133,6 @@
{
GDK_NOTE (EVENTS, g_message ("setMarkedText"));
const char *str;
gchar *prev_str;
if (replacementRange.location == NSNotFound)
{
@@ -183,7 +182,6 @@
GDK_NOTE (EVENTS, g_message ("insertText"));
const char *str;
NSString *string;
gchar *prev_str;
if ([self hasMarkedText])
[self unmarkText];
@@ -201,8 +199,12 @@
/* discard invalid text input with Chinese input methods */
str = "";
[self unmarkText];
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
NSInputManager *currentInputManager = [NSInputManager currentInputManager];
[currentInputManager markedTextAbandoned:self];
#else
[[NSTextInputContext currentInputContext] discardMarkedText];
#endif
}
else
{
+1 -1
View File
@@ -130,7 +130,7 @@ gdk_quartz_device_core_get_state (GdkDevice *device,
{
gint x_int, y_int;
gdk_window_get_pointer (window, &x_int, &y_int, mask);
gdk_window_get_device_position (window, device, &x_int, &y_int, mask);
if (axes)
{
@@ -22,6 +22,7 @@
#include <gdk/gdkdeviceprivate.h>
#include <gdk/gdkseatdefaultprivate.h>
#include <gdk/gdkdevicemanagerprivate.h>
#include <gdk/gdkdisplayprivate.h>
#include "gdkdevicemanager-core-quartz.h"
#include "gdkquartzdevice-core.h"
#include "gdkkeysyms.h"
+219 -36
View File
@@ -20,6 +20,7 @@
#include <gdk/gdk.h>
#include <gdk/gdkdisplayprivate.h>
#include <gdk/gdkmonitorprivate.h>
#include "gdkprivate-quartz.h"
#include "gdkquartzscreen.h"
@@ -29,15 +30,18 @@
#include "gdkscreen.h"
#include "gdkmonitorprivate.h"
#include "gdkdisplay-quartz.h"
#include "gdkmonitor-quartz.h"
static gint MONITORS_CHANGED = 0;
static void display_reconfiguration_callback (CGDirectDisplayID display,
CGDisplayChangeSummaryFlags flags,
void *data);
static GdkWindow *
gdk_quartz_display_get_default_group (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
/* FIXME: Implement */
/* X11-only. */
return NULL;
}
@@ -110,51 +114,49 @@ gdk_quartz_display_beep (GdkDisplay *display)
static void
gdk_quartz_display_sync (GdkDisplay *display)
{
/* Not supported. */
/* Not needed. */
}
static void
gdk_quartz_display_flush (GdkDisplay *display)
{
/* Not supported. */
/* Not needed. */
}
static gboolean
gdk_quartz_display_supports_selection_notification (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
/* FIXME: Implement */
/* X11-only. */
return FALSE;
}
static gboolean
gdk_quartz_display_request_selection_notification (GdkDisplay *display,
GdkAtom selection)
{
/* FIXME: Implement */
/* X11-only. */
return FALSE;
}
static gboolean
gdk_quartz_display_supports_clipboard_persistence (GdkDisplay *display)
{
/* FIXME: Implement */
/* X11-only */
return FALSE;
}
static gboolean
gdk_quartz_display_supports_shapes (GdkDisplay *display)
{
/* FIXME: Implement */
/* Not needed, nothing ever calls this.*/
return FALSE;
}
static gboolean
gdk_quartz_display_supports_input_shapes (GdkDisplay *display)
{
/* FIXME: Implement */
/* Not needed, nothign ever calls this. */
return FALSE;
}
@@ -165,20 +167,23 @@ gdk_quartz_display_store_clipboard (GdkDisplay *display,
const GdkAtom *targets,
gint n_targets)
{
/* FIXME: Implement */
/* MacOS persists pasteboard items automatically, no application
* action is required.
*/
}
static gboolean
gdk_quartz_display_supports_composite (GdkDisplay *display)
{
/* FIXME: Implement */
/* X11-only. */
return FALSE;
}
static gulong
gdk_quartz_display_get_next_serial (GdkDisplay *display)
{
/* X11-only. */
return 0;
}
@@ -186,26 +191,141 @@ static void
gdk_quartz_display_notify_startup_complete (GdkDisplay *display,
const gchar *startup_id)
{
/* FIXME: Implement? */
/* This should call finishLaunching, but doing so causes Quartz to throw
* "_createMenuRef called with existing principal MenuRef already"
* " associated with menu".
[NSApp finishLaunching];
*/
}
static void
gdk_quartz_display_push_error_trap (GdkDisplay *display)
{
/* X11-only. */
}
static gint
gdk_quartz_display_pop_error_trap (GdkDisplay *display, gboolean ignore)
{
/* X11 only. */
return 0;
}
/* The display monitor list comprises all of the CGDisplays connected
to the system, some of which may not be drawable either because
they're asleep or are mirroring another monitor. The NSScreens
array contains only the monitors that are currently drawable and we
use the index of the screens array placing GdkNSViews, so we'll use
the same for determining the number of monitors and indexing them.
*/
int
get_active_displays (CGDirectDisplayID **screens)
{
unsigned int displays = 0;
CGGetActiveDisplayList (0, NULL, &displays);
if (screens)
{
*screens = g_new0 (CGDirectDisplayID, displays);
CGGetActiveDisplayList (displays, *screens, &displays);
}
return displays;
}
static void
configure_monitor (GdkMonitor *monitor)
{
GdkQuartzMonitor *quartz_monitor = GDK_QUARTZ_MONITOR (monitor);
CGSize disp_size = CGDisplayScreenSize (quartz_monitor->id);
gint width = (int)trunc (disp_size.width);
gint height = (int)trunc (disp_size.height);
CGRect disp_bounds = CGDisplayBounds (quartz_monitor->id);
GdkRectangle disp_geometry = {(int)trunc (disp_bounds.origin.x),
(int)trunc (disp_bounds.origin.y),
(int)trunc (disp_bounds.size.width),
(int)trunc (disp_bounds.size.height)};
CGDisplayModeRef mode = CGDisplayCopyDisplayMode (quartz_monitor->id);
gint refresh_rate = (int)trunc (CGDisplayModeGetRefreshRate (mode));
monitor->width_mm = width;
monitor->height_mm = height;
monitor->geometry = disp_geometry;
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
if (mode && gdk_quartz_osx_version () >= GDK_OSX_MOUNTAIN_LION)
{
monitor->scale_factor = CGDisplayModeGetPixelWidth (mode) / CGDisplayModeGetWidth (mode);
CGDisplayModeRelease (mode);
}
else
#endif
monitor->scale_factor = 1;
monitor->refresh_rate = refresh_rate;
monitor->subpixel_layout = GDK_SUBPIXEL_LAYOUT_UNKNOWN;
}
static void
display_reconfiguration_callback (CGDirectDisplayID cg_display,
CGDisplayChangeSummaryFlags flags,
void *data)
{
GdkQuartzDisplay *display = data;
GdkQuartzMonitor *monitor;
/* Ignore the begin configuration signal. */
if (flags & kCGDisplayBeginConfigurationFlag)
return;
if (flags & (kCGDisplayMovedFlag | kCGDisplayAddFlag | kCGDisplayEnabledFlag |
kCGDisplaySetMainFlag | kCGDisplayDesktopShapeChangedFlag |
kCGDisplayMirrorFlag | kCGDisplayUnMirrorFlag))
{
monitor = g_hash_table_lookup (display->monitors,
GINT_TO_POINTER (cg_display));
if (!monitor)
{
monitor = g_object_new (GDK_TYPE_QUARTZ_MONITOR,
"display", display, NULL);
monitor->id = cg_display;
g_hash_table_insert (display->monitors, GINT_TO_POINTER (monitor->id),
monitor);
gdk_display_monitor_added (GDK_DISPLAY (display),
GDK_MONITOR (monitor));
}
configure_monitor (GDK_MONITOR (monitor));
}
else if (flags & (kCGDisplayRemoveFlag | kCGDisplayDisabledFlag))
{
GdkMonitor *monitor = g_hash_table_lookup (display->monitors,
GINT_TO_POINTER (cg_display));
gdk_display_monitor_removed (GDK_DISPLAY (display),
GDK_MONITOR (monitor));
g_hash_table_remove (display->monitors, GINT_TO_POINTER (cg_display));
}
g_signal_emit (display, MONITORS_CHANGED, 0);
}
static int
gdk_quartz_display_get_n_monitors (GdkDisplay *display)
{
GdkQuartzDisplay *quartz_display = GDK_QUARTZ_DISPLAY (display);
return quartz_display->monitors->len;
return get_active_displays (NULL);
}
static GdkMonitor *
gdk_quartz_display_get_monitor (GdkDisplay *display,
int monitor_num)
{
GdkQuartzDisplay *quartz_display = GDK_QUARTZ_DISPLAY (display);
CGDirectDisplayID *screens = NULL;
if (0 <= monitor_num || monitor_num < quartz_display->monitors->len)
return (GdkMonitor *)quartz_display->monitors->pdata[monitor_num];
int count = get_active_displays (&screens);
if (monitor_num >= 0 && monitor_num < count)
return g_hash_table_lookup (quartz_display->monitors,
GINT_TO_POINTER (screens[monitor_num]));
return NULL;
}
@@ -214,8 +334,23 @@ static GdkMonitor *
gdk_quartz_display_get_primary_monitor (GdkDisplay *display)
{
GdkQuartzDisplay *quartz_display = GDK_QUARTZ_DISPLAY (display);
CGDirectDisplayID primary_id = CGMainDisplayID ();
return quartz_display->monitors->pdata[0];
return g_hash_table_lookup (quartz_display->monitors,
GINT_TO_POINTER (primary_id));
}
static GdkMonitor *
gdk_quartz_display_get_monitor_at_window (GdkDisplay *display,
GdkWindow *window)
{
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
NSWindow *nswindow = impl->toplevel;
NSScreen *screen = [nswindow screen];
CGDirectDisplayID id = [[[screen deviceDescription]
objectForKey: @"NSScreenNumber"] unsignedIntValue];
return g_hash_table_lookup (GDK_QUARTZ_DISPLAY (display)->monitors,
GINT_TO_POINTER (id));
}
G_DEFINE_TYPE (GdkQuartzDisplay, gdk_quartz_display, GDK_TYPE_DISPLAY)
@@ -223,11 +358,26 @@ G_DEFINE_TYPE (GdkQuartzDisplay, gdk_quartz_display, GDK_TYPE_DISPLAY)
static void
gdk_quartz_display_init (GdkQuartzDisplay *display)
{
GDK_QUARTZ_ALLOC_POOL;
uint32_t max_displays = 0, disp;
CGDirectDisplayID *displays;
display->monitors = g_ptr_array_new_with_free_func (g_object_unref);
GDK_QUARTZ_RELEASE_POOL;
CGGetActiveDisplayList (0, NULL, &max_displays);
display->monitors = g_hash_table_new_full (g_direct_hash, NULL,
NULL, g_object_unref);
displays = g_new0 (CGDirectDisplayID, max_displays);
CGGetActiveDisplayList (max_displays, displays, &max_displays);
for (disp = 0; disp < max_displays; ++disp)
{
GdkQuartzMonitor *monitor = g_object_new (GDK_TYPE_QUARTZ_MONITOR,
"display", display, NULL);
monitor->id = displays[disp];
g_hash_table_insert (display->monitors, GINT_TO_POINTER (monitor->id),
monitor);
configure_monitor (GDK_MONITOR (monitor));
}
CGDisplayRegisterReconfigurationCallback (display_reconfiguration_callback,
display);
g_signal_emit (display, MONITORS_CHANGED, 0);
}
static void
@@ -235,7 +385,9 @@ gdk_quartz_display_dispose (GObject *object)
{
GdkQuartzDisplay *display_quartz = GDK_QUARTZ_DISPLAY (object);
g_ptr_array_free (display_quartz->monitors, TRUE);
g_hash_table_destroy (display_quartz->monitors);
CGDisplayRemoveReconfigurationCallback (display_reconfiguration_callback,
display_quartz);
G_OBJECT_CLASS (gdk_quartz_display_parent_class)->dispose (object);
}
@@ -262,24 +414,28 @@ gdk_quartz_display_class_init (GdkQuartzDisplayClass *class)
display_class->beep = gdk_quartz_display_beep;
display_class->sync = gdk_quartz_display_sync;
display_class->flush = gdk_quartz_display_flush;
display_class->queue_events = _gdk_quartz_display_queue_events;
display_class->has_pending = _gdk_quartz_display_has_pending;
display_class->queue_events = _gdk_quartz_display_queue_events;
display_class->get_default_group = gdk_quartz_display_get_default_group;
display_class->supports_selection_notification = gdk_quartz_display_supports_selection_notification;
display_class->request_selection_notification = gdk_quartz_display_request_selection_notification;
display_class->supports_clipboard_persistence = gdk_quartz_display_supports_clipboard_persistence;
display_class->store_clipboard = gdk_quartz_display_store_clipboard;
display_class->supports_shapes = gdk_quartz_display_supports_shapes;
display_class->supports_input_shapes = gdk_quartz_display_supports_input_shapes;
display_class->supports_composite = gdk_quartz_display_supports_composite;
display_class->get_cursor_for_type = _gdk_quartz_display_get_cursor_for_type;
display_class->get_cursor_for_name = _gdk_quartz_display_get_cursor_for_name;
display_class->get_cursor_for_surface = _gdk_quartz_display_get_cursor_for_surface;
display_class->get_default_cursor_size = _gdk_quartz_display_get_default_cursor_size;
display_class->get_maximal_cursor_size = _gdk_quartz_display_get_maximal_cursor_size;
display_class->supports_cursor_alpha = _gdk_quartz_display_supports_cursor_alpha;
display_class->supports_cursor_color = _gdk_quartz_display_supports_cursor_color;
display_class->supports_clipboard_persistence = gdk_quartz_display_supports_clipboard_persistence;
display_class->store_clipboard = gdk_quartz_display_store_clipboard;
display_class->get_default_cursor_size = _gdk_quartz_display_get_default_cursor_size;
display_class->get_maximal_cursor_size = _gdk_quartz_display_get_maximal_cursor_size;
display_class->get_cursor_for_type = _gdk_quartz_display_get_cursor_for_type;
display_class->get_cursor_for_name = _gdk_quartz_display_get_cursor_for_name;
display_class->get_cursor_for_surface = _gdk_quartz_display_get_cursor_for_surface;
/* display_class->get_app_launch_context = NULL; Has default. */
display_class->before_process_all_updates = _gdk_quartz_display_before_process_all_updates;
display_class->after_process_all_updates = _gdk_quartz_display_after_process_all_updates;
display_class->get_next_serial = gdk_quartz_display_get_next_serial;
@@ -288,15 +444,42 @@ gdk_quartz_display_class_init (GdkQuartzDisplayClass *class)
display_class->event_data_free = _gdk_quartz_display_event_data_free;
display_class->create_window_impl = _gdk_quartz_display_create_window_impl;
display_class->get_keymap = _gdk_quartz_display_get_keymap;
display_class->push_error_trap = gdk_quartz_display_push_error_trap;
display_class->pop_error_trap = gdk_quartz_display_pop_error_trap;
display_class->get_selection_owner = _gdk_quartz_display_get_selection_owner;
display_class->set_selection_owner = _gdk_quartz_display_set_selection_owner;
display_class->send_selection_notify = NULL; /* Ignore. X11 stuff removed in master. */
display_class->get_selection_property = _gdk_quartz_display_get_selection_property;
display_class->convert_selection = _gdk_quartz_display_convert_selection;
display_class->text_property_to_utf8_list = _gdk_quartz_display_text_property_to_utf8_list;
display_class->utf8_to_string_target = _gdk_quartz_display_utf8_to_string_target;
/* display_class->get_default_seat; The parent class default works fine. */
display_class->get_n_monitors = gdk_quartz_display_get_n_monitors;
display_class->get_monitor = gdk_quartz_display_get_monitor;
display_class->get_primary_monitor = gdk_quartz_display_get_primary_monitor;
display_class->get_monitor_at_window = gdk_quartz_display_get_monitor_at_window;
/**
* GdkQuartzDisplay::monitors-changed:
* @display: The object on which the signal is emitted
*
* The ::monitors-changed signal is emitted whenever the arrangement
* of the monitors changes, either because of the addition or
* removal of a monitor or because of some other configuration
* change in System Preferences>Displays including a resolution
* change or a position change. Note that enabling or disabling
* mirroring will result in the addition or removal of the mirror
* monitor(s).
*/
MONITORS_CHANGED =
g_signal_new (g_intern_static_string ("monitors-changed"),
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE | G_SIGNAL_NO_HOOKS,
0, NULL, NULL, NULL,
G_TYPE_NONE, 0, NULL);
ProcessSerialNumber psn = { 0, kCurrentProcess };
+1 -123
View File
@@ -32,119 +32,7 @@ G_BEGIN_DECLS
struct _GdkQuartzDisplay
{
GdkDisplay parent_instance;
/*Display *xdisplay;
GdkScreen *screen;
GList *screens;
GSource *event_source;
gint grab_count;
*/
/* Visual infos for creating Windows */
/*int window_depth;
Visual *window_visual;
Colormap window_colormap;
*/
/* Keyboard related information */
/*gint xkb_event_type;
gboolean use_xkb;
*/
/* Whether we were able to turn on detectable-autorepeat using
* XkbSetDetectableAutorepeat. If FALSE, we'll fall back
* to checking the next event with XPending().
*/
/*gboolean have_xkb_autorepeat;
GdkKeymap *keymap;
guint keymap_serial;
gboolean have_xfixes;
gint xfixes_event_base;
gboolean have_xcomposite;
gboolean have_xdamage;
gint xdamage_event_base;
gboolean have_randr12;
gboolean have_randr13;
gboolean have_randr15;
gint xrandr_event_base;
*/
/* If the SECURITY extension is in place, whether this client holds
* a trusted authorization and so is allowed to make various requests
* (grabs, properties etc.) Otherwise always TRUE.
*/
/*gboolean trusted_client;
*/
/* drag and drop information */
/*GdkDragContext *current_dest_drag;
*/
/* Mapping to/from virtual atoms */
/*GHashTable *atom_from_virtual;
GHashTable *atom_to_virtual;
*/
/* Session Management leader window see ICCCM */
/*Window leader_window;
GdkWindow *leader_gdk_window;
gboolean leader_window_title_set;
*/
/* List of functions to go from extension event => X window */
/*GSList *event_types;
*/
/* X ID hashtable */
/*GHashTable *xid_ht;
*/
/* translation queue */
/*GQueue *translate_queue;
*/
/* input GdkWindow list */
/*GList *input_windows;
*/
GPtrArray *monitors;
/* Startup notification */
/*gchar *startup_notification_id;
*/
/* Time of most recent user interaction. */
/*gulong user_time;
*/
/* Sets of atoms for DND */
/*guint base_dnd_atoms_precached : 1;
guint xdnd_atoms_precached : 1;
guint motif_atoms_precached : 1;
guint use_sync : 1;
guint have_shapes : 1;
guint have_input_shapes : 1;
gint shape_event_base;
GSList *error_traps;
gint wm_moveresize_button;
*/
/* GLX information */
/*gint glx_version;
gint glx_error_base;
gint glx_event_base;
*/
/* Translation between X server time and system-local monotonic time */
/*gint64 server_time_query_time;
gint64 server_time_offset;
*/
/*guint server_time_is_monotonic_time : 1;
guint have_glx : 1;
*/
/* GLX extensions we check */
/*guint has_glx_swap_interval : 1;
guint has_glx_create_context : 1;
guint has_glx_texture_from_pixmap : 1;
guint has_glx_video_sync : 1;
guint has_glx_buffer_age : 1;
guint has_glx_sync_control : 1;
guint has_glx_multisample : 1;
guint has_glx_visual_rating : 1;
guint has_glx_create_es2_context : 1;*/
GHashTable *monitors;
};
struct _GdkQuartzDisplayClass
@@ -220,16 +108,6 @@ gint _gdk_quartz_display_text_property_to_utf8_list (GdkDisplay *disp
gchar ***list);
gchar * _gdk_quartz_display_utf8_to_string_target (GdkDisplay *displayt,
const gchar *str);
/*
GdkScreen *_gdk_x11_display_screen_for_xrootwin (GdkDisplay *display,
Window xrootwin);
void _gdk_x11_display_error_event (GdkDisplay *display,
XErrorEvent *error);
GdkFilterReturn _gdk_wm_protocols_filter (GdkXEvent *xev,
GdkEvent *event,
gpointer data);
*/
G_END_DECLS
#endif /* __GDK_QUARTZ_DISPLAY__ */
-1
View File
@@ -55,7 +55,6 @@ static void
gdk_quartz_display_manager_class_init (GdkQuartzDisplayManagerClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
GdkDisplayManagerClass *manager_class = GDK_DISPLAY_MANAGER_CLASS (class);
object_class->finalize = gdk_quartz_display_manager_finalize;
}
+15 -3
View File
@@ -292,13 +292,19 @@ select_thread_func (void *arg)
}
}
#if MAC_OS_X_VERSION_MIN_REQUIRED < 101200
#define GDK_QUARTZ_APPLICATION_DEFINED NSApplicationDefined
#else
#define GDK_QUARTZ_APPLICATION_DEFINED NSEventTypeApplicationDefined
#endif
static void
got_fd_activity (void *info)
{
NSEvent *event;
/* Post a message so we'll break out of the message loop */
event = [NSEvent otherEventWithType: NSApplicationDefined
event = [NSEvent otherEventWithType: GDK_QUARTZ_APPLICATION_DEFINED
location: NSZeroPoint
modifierFlags: 0
timestamp: 0
@@ -714,6 +720,12 @@ static GSourceFuncs event_funcs = {
********* Our Poll Function *********
************************************************************/
#if MAC_OS_X_VERSION_MIN_REQUIRED < 101200
#define GDK_QUARTZ_EVENT_MASK_ANY NSAnyEventMask
#else
#define GDK_QUARTZ_EVENT_MASK_ANY NSEventMaskAny
#endif
static gint
poll_func (GPollFD *ufds,
guint nfds,
@@ -739,7 +751,7 @@ poll_func (GPollFD *ufds,
limit_date = [NSDate dateWithTimeIntervalSinceNow:timeout_/1000.0];
getting_events++;
event = [NSApp nextEventMatchingMask: NSAnyEventMask
event = [NSApp nextEventMatchingMask: GDK_QUARTZ_EVENT_MASK_ANY
untilDate: limit_date
inMode: NSDefaultRunLoopMode
dequeue: YES];
@@ -758,7 +770,7 @@ poll_func (GPollFD *ufds,
n_ready = select_thread_collect_poll (ufds, nfds);
if (event &&
[event type] == NSApplicationDefined &&
[event type] == GDK_QUARTZ_APPLICATION_DEFINED &&
[event subtype] == GDK_QUARTZ_EVENT_SUBTYPE_EVENTLOOP)
{
/* Just used to wake us up; if an event and a FD arrived at the same
+138 -157
View File
@@ -35,6 +35,7 @@
#include "gdkquartzdisplay.h"
#include "gdkprivate-quartz.h"
#include "gdkquartzdevicemanager-core.h"
#include "gdkquartzkeys.h"
#define GRIP_WIDTH 15
#define GRIP_HEIGHT 15
@@ -128,27 +129,8 @@ _gdk_quartz_display_has_pending (GdkDisplay *display)
void
_gdk_quartz_events_break_all_grabs (guint32 time)
{
GList *list, *l;
GdkDeviceManager *device_manager;
device_manager = gdk_display_get_device_manager (_gdk_display);
list = gdk_device_manager_list_devices (device_manager,
GDK_DEVICE_TYPE_MASTER);
for (l = list; l; l = l->next)
{
GdkDeviceGrabInfo *grab;
grab = _gdk_display_get_last_device_grab (_gdk_display, l->data);
if (grab)
{
grab->serial_end = 0;
grab->implicit_ungrab = TRUE;
}
_gdk_display_device_grab_update (_gdk_display, l->data, NULL, 0);
}
g_list_free (list);
GdkSeat *seat = gdk_display_get_default_seat (_gdk_display);
gdk_seat_ungrab (seat);
}
static void
@@ -289,15 +271,15 @@ get_keyboard_modifiers_from_ns_flags (NSUInteger nsflags)
{
GdkModifierType modifiers = 0;
if (nsflags & NSAlphaShiftKeyMask)
if (nsflags & GDK_QUARTZ_ALPHA_SHIFT_KEY_MASK)
modifiers |= GDK_LOCK_MASK;
if (nsflags & NSShiftKeyMask)
if (nsflags & GDK_QUARTZ_SHIFT_KEY_MASK)
modifiers |= GDK_SHIFT_MASK;
if (nsflags & NSControlKeyMask)
if (nsflags & GDK_QUARTZ_CONTROL_KEY_MASK)
modifiers |= GDK_CONTROL_MASK;
if (nsflags & NSAlternateKeyMask)
if (nsflags & GDK_QUARTZ_ALTERNATE_KEY_MASK)
modifiers |= GDK_MOD1_MASK;
if (nsflags & NSCommandKeyMask)
if (nsflags & GDK_QUARTZ_COMMAND_KEY_MASK)
modifiers |= GDK_MOD2_MASK;
return modifiers;
@@ -315,31 +297,31 @@ get_event_mask_from_ns_event (NSEvent *nsevent)
{
switch ([nsevent type])
{
case NSLeftMouseDown:
case NSRightMouseDown:
case NSOtherMouseDown:
case GDK_QUARTZ_LEFT_MOUSE_DOWN:
case GDK_QUARTZ_RIGHT_MOUSE_DOWN:
case GDK_QUARTZ_OTHER_MOUSE_DOWN:
return GDK_BUTTON_PRESS_MASK;
case NSLeftMouseUp:
case NSRightMouseUp:
case NSOtherMouseUp:
case GDK_QUARTZ_LEFT_MOUSE_UP:
case GDK_QUARTZ_RIGHT_MOUSE_UP:
case GDK_QUARTZ_OTHER_MOUSE_UP:
return GDK_BUTTON_RELEASE_MASK;
case NSMouseMoved:
case GDK_QUARTZ_MOUSE_MOVED:
return GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK;
case NSScrollWheel:
case GDK_QUARTZ_SCROLL_WHEEL:
/* Since applications that want button press events can get
* scroll events on X11 (since scroll wheel events are really
* button press events there), we need to use GDK_BUTTON_PRESS_MASK too.
*/
return GDK_SCROLL_MASK | GDK_BUTTON_PRESS_MASK;
case NSLeftMouseDragged:
case GDK_QUARTZ_LEFT_MOUSE_DRAGGED:
return (GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_MOTION_MASK | GDK_BUTTON1_MOTION_MASK |
GDK_BUTTON1_MASK);
case NSRightMouseDragged:
case GDK_QUARTZ_RIGHT_MOUSE_DRAGGED:
return (GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_MOTION_MASK | GDK_BUTTON3_MOTION_MASK |
GDK_BUTTON3_MASK);
case NSOtherMouseDragged:
case GDK_QUARTZ_OTHER_MOUSE_DRAGGED:
{
GdkEventMask mask;
@@ -356,9 +338,9 @@ get_event_mask_from_ns_event (NSEvent *nsevent)
case NSEventTypeMagnify:
case NSEventTypeRotate:
return GDK_TOUCHPAD_GESTURE_MASK;
case NSKeyDown:
case NSKeyUp:
case NSFlagsChanged:
case GDK_QUARTZ_KEY_DOWN:
case GDK_QUARTZ_KEY_UP:
case GDK_QUARTZ_FLAGS_CHANGED:
{
switch (_gdk_quartz_keys_event_type (nsevent))
{
@@ -374,10 +356,10 @@ get_event_mask_from_ns_event (NSEvent *nsevent)
}
break;
case NSMouseEntered:
case GDK_QUARTZ_MOUSE_ENTERED:
return GDK_ENTER_NOTIFY_MASK;
case NSMouseExited:
case GDK_QUARTZ_MOUSE_EXITED:
return GDK_LEAVE_NOTIFY_MASK;
default:
@@ -394,12 +376,10 @@ get_window_point_from_screen_point (GdkWindow *window,
gint *y)
{
NSPoint point;
NSWindow *nswindow;
nswindow = ((GdkWindowImplQuartz *)window->impl)->toplevel;
point = [nswindow convertScreenToBase:screen_point];
GdkQuartzNSWindow *nswindow;
nswindow = (GdkQuartzNSWindow*)(((GdkWindowImplQuartz *)window->impl)->toplevel);
point = [nswindow convertPointFromScreen:screen_point];
*x = point.x;
*y = window->height - point.y;
}
@@ -409,10 +389,12 @@ is_mouse_button_press_event (NSEventType type)
{
switch (type)
{
case NSLeftMouseDown:
case NSRightMouseDown:
case NSOtherMouseDown:
case GDK_QUARTZ_LEFT_MOUSE_DOWN:
case GDK_QUARTZ_RIGHT_MOUSE_DOWN:
case GDK_QUARTZ_OTHER_MOUSE_DOWN:
return TRUE;
default:
return FALSE;
}
return FALSE;
@@ -473,8 +455,7 @@ get_toplevel_from_ns_event (NSEvent *nsevent,
}
else
{
*screen_point = [[nsevent window] convertBaseToScreen:point];
*screen_point = [(GdkQuartzNSWindow*)[nsevent window] convertPointToScreen:point];
*x = point.x;
*y = toplevel->height - point.y;
}
@@ -502,15 +483,15 @@ create_focus_event (GdkWindow *window,
gboolean in)
{
GdkEvent *event;
GdkQuartzDeviceManagerCore *device_manager;
GdkDisplay *display = gdk_window_get_display (window);
GdkSeat *seat = gdk_display_get_default_seat (display);
event = gdk_event_new (GDK_FOCUS_CHANGE);
event->focus_change.window = window;
event->focus_change.in = in;
device_manager = GDK_QUARTZ_DEVICE_MANAGER_CORE (_gdk_display->device_manager);
gdk_event_set_device (event, device_manager->core_keyboard);
gdk_event_set_seat (event, gdk_device_get_seat (device_manager->core_keyboard));
gdk_event_set_device (event, gdk_seat_get_keyboard (seat));
gdk_event_set_seat (event, seat);
return event;
}
@@ -522,7 +503,8 @@ generate_motion_event (GdkWindow *window)
NSPoint screen_point;
GdkEvent *event;
gint x, y, x_root, y_root;
GdkQuartzDeviceManagerCore *device_manager;
GdkDisplay *display = gdk_window_get_display (window);
GdkSeat *seat = gdk_display_get_default_seat (display);
event = gdk_event_new (GDK_MOTION_NOTIFY);
event->any.window = NULL;
@@ -544,9 +526,8 @@ generate_motion_event (GdkWindow *window)
event->motion.state = _gdk_quartz_events_get_current_keyboard_modifiers () |
_gdk_quartz_events_get_current_mouse_modifiers ();
event->motion.is_hint = FALSE;
device_manager = GDK_QUARTZ_DEVICE_MANAGER_CORE (_gdk_display->device_manager);
event->motion.device = device_manager->core_pointer;
gdk_event_set_seat (event, gdk_device_get_seat (device_manager->core_pointer));
event->motion.device = gdk_seat_get_pointer (seat);
gdk_event_set_seat (event, seat);
append_event (event, TRUE);
}
@@ -623,8 +604,9 @@ find_toplevel_under_pointer (GdkDisplay *display,
{
GdkWindow *toplevel;
GdkPointerWindowInfo *info;
GdkSeat *seat = gdk_display_get_default_seat (display);
info = _gdk_display_get_pointer_info (display, GDK_QUARTZ_DEVICE_MANAGER_CORE (display->device_manager)->core_pointer);
info = _gdk_display_get_pointer_info (display, gdk_seat_get_pointer (seat));
toplevel = info->toplevel_under_pointer;
if (toplevel && WINDOW_IS_TOPLEVEL (toplevel))
get_window_point_from_screen_point (toplevel, screen_point, x, y);
@@ -651,24 +633,20 @@ find_toplevel_for_keyboard_event (NSEvent *nsevent)
GdkWindow *window;
GdkDisplay *display;
GdkQuartzView *view;
GdkDeviceManager *device_manager;
GdkSeat *seat;
view = (GdkQuartzView *)[[nsevent window] contentView];
window = [view gdkWindow];
display = gdk_window_get_display (window);
seat = gdk_display_get_default_seat (display);
device_manager = gdk_display_get_device_manager (display);
list = gdk_device_manager_list_devices (device_manager,
GDK_DEVICE_TYPE_MASTER);
list = gdk_seat_get_slaves (seat, GDK_SEAT_CAPABILITY_KEYBOARD);
for (l = list; l; l = l->next)
{
GdkDeviceGrabInfo *grab;
GdkDevice *device = l->data;
if (gdk_device_get_source(device) != GDK_SOURCE_KEYBOARD)
continue;
grab = _gdk_display_get_last_device_grab (display, device);
if (grab && grab->window && !grab->owner_events)
{
@@ -692,11 +670,13 @@ find_toplevel_for_mouse_event (NSEvent *nsevent,
GdkWindow *toplevel;
GdkDisplay *display;
GdkDeviceGrabInfo *grab;
GdkSeat *seat;
toplevel = get_toplevel_from_ns_event (nsevent, &screen_point, x, y);
display = gdk_window_get_display (toplevel);
seat = gdk_display_get_default_seat (_gdk_display);
event_type = [nsevent type];
/* From the docs for XGrabPointer:
@@ -709,7 +689,7 @@ find_toplevel_for_mouse_event (NSEvent *nsevent,
* events are discarded.
*/
grab = _gdk_display_get_last_device_grab (display,
GDK_QUARTZ_DEVICE_MANAGER_CORE (display->device_manager)->core_pointer);
gdk_seat_get_pointer (seat));
if (WINDOW_IS_TOPLEVEL (toplevel) && grab)
{
/* Implicit grabs do not go through XGrabPointer and thus the
@@ -766,7 +746,7 @@ find_toplevel_for_mouse_event (NSEvent *nsevent,
* gdk gets confused about getting e.g. button presses with no
* window (the title bar is not known to it).
*/
if (event_type != NSMouseMoved)
if (event_type != GDK_QUARTZ_MOUSE_MOVED)
if (*y < 0)
return NULL;
@@ -821,23 +801,23 @@ find_window_for_ns_event (NSEvent *nsevent,
switch (event_type)
{
case NSLeftMouseDown:
case NSRightMouseDown:
case NSOtherMouseDown:
case NSLeftMouseUp:
case NSRightMouseUp:
case NSOtherMouseUp:
case NSMouseMoved:
case NSScrollWheel:
case NSLeftMouseDragged:
case NSRightMouseDragged:
case NSOtherMouseDragged:
case GDK_QUARTZ_LEFT_MOUSE_DOWN:
case GDK_QUARTZ_RIGHT_MOUSE_DOWN:
case GDK_QUARTZ_OTHER_MOUSE_DOWN:
case GDK_QUARTZ_LEFT_MOUSE_UP:
case GDK_QUARTZ_RIGHT_MOUSE_UP:
case GDK_QUARTZ_OTHER_MOUSE_UP:
case GDK_QUARTZ_MOUSE_MOVED:
case GDK_QUARTZ_SCROLL_WHEEL:
case GDK_QUARTZ_LEFT_MOUSE_DRAGGED:
case GDK_QUARTZ_RIGHT_MOUSE_DRAGGED:
case GDK_QUARTZ_OTHER_MOUSE_DRAGGED:
case NSEventTypeMagnify:
case NSEventTypeRotate:
return find_toplevel_for_mouse_event (nsevent, x, y);
case NSMouseEntered:
case NSMouseExited:
case GDK_QUARTZ_MOUSE_ENTERED:
case GDK_QUARTZ_MOUSE_EXITED:
/* Only handle our own entered/exited events, not the ones for the
* titlebar buttons.
*/
@@ -846,9 +826,9 @@ find_window_for_ns_event (NSEvent *nsevent,
else
return NULL;
case NSKeyDown:
case NSKeyUp:
case NSFlagsChanged:
case GDK_QUARTZ_KEY_DOWN:
case GDK_QUARTZ_KEY_UP:
case GDK_QUARTZ_FLAGS_CHANGED:
return find_toplevel_for_keyboard_event (nsevent);
default:
@@ -871,7 +851,7 @@ fill_crossing_event (GdkWindow *toplevel,
GdkCrossingMode mode,
GdkNotifyType detail)
{
GdkQuartzDeviceManagerCore *device_manager;
GdkSeat *seat = gdk_display_get_default_seat (_gdk_display);
event->any.type = event_type;
event->crossing.window = toplevel;
@@ -886,9 +866,8 @@ fill_crossing_event (GdkWindow *toplevel,
event->crossing.state = get_keyboard_modifiers_from_ns_event (nsevent) |
_gdk_quartz_events_get_current_mouse_modifiers ();
device_manager = GDK_QUARTZ_DEVICE_MANAGER_CORE (_gdk_display->device_manager);
gdk_event_set_device (event, device_manager->core_pointer);
gdk_event_set_seat (event, gdk_device_get_seat (device_manager->core_pointer));
gdk_event_set_device (event, gdk_seat_get_pointer (seat));
gdk_event_set_seat (event, seat);
/* FIXME: Focus and button state? */
}
@@ -921,9 +900,7 @@ fill_pinch_event (GdkWindow *window,
FP_STATE_IDLE,
FP_STATE_UPDATE
} last_state = FP_STATE_IDLE;
GdkQuartzDeviceManagerCore *device_manager;
device_manager = GDK_QUARTZ_DEVICE_MANAGER_CORE (_gdk_display->device_manager);
GdkSeat *seat = gdk_display_get_default_seat (_gdk_display);
event->any.type = GDK_TOUCHPAD_PINCH;
event->touchpad_pinch.window = window;
@@ -936,7 +913,7 @@ fill_pinch_event (GdkWindow *window,
event->touchpad_pinch.n_fingers = 2;
event->touchpad_pinch.dx = 0.0;
event->touchpad_pinch.dy = 0.0;
gdk_event_set_device (event, device_manager->core_pointer);
gdk_event_set_device (event, gdk_seat_get_pointer (seat));
switch ([nsevent phase])
{
@@ -1015,23 +992,23 @@ fill_button_event (GdkWindow *window,
{
GdkEventType type;
gint state;
GdkQuartzDeviceManagerCore *device_manager;
GdkSeat *seat = gdk_display_get_default_seat (_gdk_display);
state = get_keyboard_modifiers_from_ns_event (nsevent) |
_gdk_quartz_events_get_current_mouse_modifiers ();
switch ([nsevent type])
{
case NSLeftMouseDown:
case NSRightMouseDown:
case NSOtherMouseDown:
case GDK_QUARTZ_LEFT_MOUSE_DOWN:
case GDK_QUARTZ_RIGHT_MOUSE_DOWN:
case GDK_QUARTZ_OTHER_MOUSE_DOWN:
type = GDK_BUTTON_PRESS;
state &= ~get_mouse_button_modifiers_from_ns_event (nsevent);
break;
case NSLeftMouseUp:
case NSRightMouseUp:
case NSOtherMouseUp:
case GDK_QUARTZ_LEFT_MOUSE_UP:
case GDK_QUARTZ_RIGHT_MOUSE_UP:
case GDK_QUARTZ_OTHER_MOUSE_UP:
type = GDK_BUTTON_RELEASE;
state |= get_mouse_button_modifiers_from_ns_event (nsevent);
break;
@@ -1050,9 +1027,9 @@ fill_button_event (GdkWindow *window,
/* FIXME event->axes */
event->button.state = state;
event->button.button = get_mouse_button_from_ns_event (nsevent);
device_manager = GDK_QUARTZ_DEVICE_MANAGER_CORE (_gdk_display->device_manager);
event->button.device = device_manager->core_pointer;
gdk_event_set_seat (event, gdk_device_get_seat (device_manager->core_pointer));
event->button.device = gdk_seat_get_pointer (seat);
gdk_event_set_seat (event, seat);
}
static void
@@ -1064,7 +1041,7 @@ fill_motion_event (GdkWindow *window,
gint x_root,
gint y_root)
{
GdkQuartzDeviceManagerCore *device_manager;
GdkSeat *seat = gdk_display_get_default_seat (_gdk_display);
event->any.type = GDK_MOTION_NOTIFY;
event->motion.window = window;
@@ -1077,9 +1054,8 @@ fill_motion_event (GdkWindow *window,
event->motion.state = get_keyboard_modifiers_from_ns_event (nsevent) |
_gdk_quartz_events_get_current_mouse_modifiers ();
event->motion.is_hint = FALSE;
device_manager = GDK_QUARTZ_DEVICE_MANAGER_CORE (_gdk_display->device_manager);
event->motion.device = device_manager->core_pointer;
gdk_event_set_seat (event, gdk_device_get_seat (device_manager->core_pointer));
event->motion.device = gdk_seat_get_pointer (seat);
gdk_event_set_seat (event, seat);
}
static void
@@ -1094,11 +1070,10 @@ fill_scroll_event (GdkWindow *window,
gdouble delta_y,
GdkScrollDirection direction)
{
GdkQuartzDeviceManagerCore *device_manager;
GdkSeat *seat = gdk_display_get_default_seat (_gdk_display);
NSPoint point;
point = [nsevent locationInWindow];
device_manager = GDK_QUARTZ_DEVICE_MANAGER_CORE (_gdk_display->device_manager);
event->any.type = GDK_SCROLL;
event->scroll.window = window;
@@ -1109,10 +1084,10 @@ fill_scroll_event (GdkWindow *window,
event->scroll.y_root = y_root;
event->scroll.state = get_keyboard_modifiers_from_ns_event (nsevent);
event->scroll.direction = direction;
event->scroll.device = device_manager->core_pointer;
event->scroll.device = gdk_seat_get_pointer (seat);
event->scroll.delta_x = delta_x;
event->scroll.delta_y = delta_y;
gdk_event_set_seat (event, gdk_device_get_seat (device_manager->core_pointer));
gdk_event_set_seat (event, seat);
}
static void
@@ -1122,7 +1097,7 @@ fill_key_event (GdkWindow *window,
GdkEventType type)
{
GdkEventPrivate *priv;
GdkQuartzDeviceManagerCore *device_manager;
GdkSeat *seat = gdk_display_get_default_seat (_gdk_display);
gchar buf[7];
gunichar c = 0;
@@ -1135,16 +1110,15 @@ fill_key_event (GdkWindow *window,
event->key.state = get_keyboard_modifiers_from_ns_event (nsevent);
event->key.hardware_keycode = [nsevent keyCode];
gdk_event_set_scancode (event, [nsevent keyCode]);
event->key.group = ([nsevent modifierFlags] & NSAlternateKeyMask) ? 1 : 0;
event->key.group = ([nsevent modifierFlags] & GDK_QUARTZ_ALTERNATE_KEY_MASK) ? 1 : 0;
event->key.keyval = GDK_KEY_VoidSymbol;
device_manager = GDK_QUARTZ_DEVICE_MANAGER_CORE (_gdk_display->device_manager);
gdk_event_set_device (event, device_manager->core_keyboard);
gdk_event_set_seat (event, gdk_device_get_seat (device_manager->core_keyboard));
gdk_event_set_device (event, gdk_seat_get_keyboard (seat));
gdk_event_set_seat (event, seat);
gdk_keymap_translate_keyboard_state (gdk_keymap_get_for_display (_gdk_display),
event->key.hardware_keycode,
event->key.state,
event->key.state,
event->key.group,
&event->key.keyval,
NULL, NULL, NULL);
@@ -1256,7 +1230,7 @@ synthesize_crossing_event (GdkWindow *window,
{
switch ([nsevent type])
{
case NSMouseEntered:
case GDK_QUARTZ_MOUSE_ENTERED:
/* Enter events are considered always to be from another toplevel
* window, this shouldn't negatively affect any app or gtk code,
* and is the only way to make GtkMenu work. EEK EEK EEK.
@@ -1272,7 +1246,7 @@ synthesize_crossing_event (GdkWindow *window,
GDK_NOTIFY_NONLINEAR);
return TRUE;
case NSMouseExited:
case GDK_QUARTZ_MOUSE_EXITED:
/* See above */
if (!(window->event_mask & GDK_LEAVE_NOTIFY_MASK))
return FALSE;
@@ -1296,7 +1270,7 @@ void
_gdk_quartz_synthesize_null_key_event (GdkWindow *window)
{
GdkEvent *event;
GdkQuartzDeviceManagerCore *device_manager;
GdkSeat *seat = gdk_display_get_default_seat (_gdk_display);
event = gdk_event_new (GDK_KEY_PRESS);
event->any.type = GDK_KEY_PRESS;
@@ -1305,9 +1279,9 @@ _gdk_quartz_synthesize_null_key_event (GdkWindow *window)
event->key.hardware_keycode = 0;
event->key.group = 0;
event->key.keyval = GDK_KEY_VoidSymbol;
device_manager = GDK_QUARTZ_DEVICE_MANAGER_CORE (_gdk_display->device_manager);
gdk_event_set_device (event, device_manager->core_keyboard);
gdk_event_set_seat (event, gdk_device_get_seat (device_manager->core_keyboard));
gdk_event_set_device (event, gdk_seat_get_keyboard (seat));
gdk_event_set_seat (event, seat);
append_event(event, FALSE);
}
@@ -1359,12 +1333,12 @@ test_resize (NSEvent *event, GdkWindow *toplevel, gint x, gint y)
GdkWindowImplQuartz *toplevel_impl;
gboolean lion;
/* Resizing from the resize indicator only begins if an NSLeftMouseButton
/* Resizing from the resize indicator only begins if an GDK_QUARTZ_LEFT_MOUSE_BUTTON
* event is received in the resizing area.
*/
toplevel_impl = (GdkWindowImplQuartz *)toplevel->impl;
if ([toplevel_impl->toplevel showsResizeIndicator])
if ([event type] == NSLeftMouseDown &&
if ([event type] == GDK_QUARTZ_LEFT_MOUSE_DOWN &&
[toplevel_impl->toplevel showsResizeIndicator])
{
NSRect frame;
@@ -1403,9 +1377,9 @@ test_resize (NSEvent *event, GdkWindow *toplevel, gint x, gint y)
*/
lion = gdk_quartz_osx_version () >= GDK_OSX_LION;
if (lion &&
([event type] == NSLeftMouseDown ||
[event type] == NSRightMouseDown ||
[event type] == NSOtherMouseDown))
([event type] == GDK_QUARTZ_LEFT_MOUSE_DOWN ||
[event type] == GDK_QUARTZ_RIGHT_MOUSE_DOWN ||
[event type] == GDK_QUARTZ_OTHER_MOUSE_DOWN))
{
if (x < GDK_LION_RESIZE ||
x > toplevel->width - GDK_LION_RESIZE ||
@@ -1416,6 +1390,14 @@ test_resize (NSEvent *event, GdkWindow *toplevel, gint x, gint y)
return FALSE;
}
#if MAC_OS_X_VERSION_MIN_REQUIRED < 101200
#define GDK_QUARTZ_APP_KIT_DEFINED NSAppKitDefined
#define GDK_QUARTZ_APPLICATION_DEACTIVATED NSApplicationDeactivatedEventType
#else
#define GDK_QUARTZ_APP_KIT_DEFINED NSEventTypeAppKitDefined
#define GDK_QUARTZ_APPLICATION_DEACTIVATED NSEventSubtypeApplicationDeactivated
#endif
static gboolean
gdk_event_translate (GdkEvent *event,
NSEvent *nsevent)
@@ -1431,9 +1413,9 @@ gdk_event_translate (GdkEvent *event,
* grabs when the application loses focus (gets deactivated).
*/
event_type = [nsevent type];
if (event_type == NSAppKitDefined)
if (event_type == GDK_QUARTZ_APP_KIT_DEFINED)
{
if ([nsevent subtype] == NSApplicationDeactivatedEventType)
if ([nsevent subtype] == GDK_QUARTZ_APPLICATION_DEACTIVATED)
_gdk_quartz_events_break_all_grabs (get_time_from_ns_event (nsevent));
/* This could potentially be used to break grabs when clicking
@@ -1469,7 +1451,7 @@ gdk_event_translate (GdkEvent *event,
{
GdkWindow *toplevel = NULL;
if (event_type == NSMouseMoved)
if (event_type == GDK_QUARTZ_MOUSE_MOVED)
{
/* Motion events received after clicking the menu bar do not have the
* window field set. Instead of giving up on the event immediately,
@@ -1540,9 +1522,9 @@ gdk_event_translate (GdkEvent *event,
* native apps). If the app is active, we focus the window and then handle
* the event, also to match native apps.
*/
if ((event_type == NSRightMouseDown ||
event_type == NSOtherMouseDown ||
event_type == NSLeftMouseDown))
if ((event_type == GDK_QUARTZ_RIGHT_MOUSE_DOWN ||
event_type == GDK_QUARTZ_OTHER_MOUSE_DOWN ||
event_type == GDK_QUARTZ_LEFT_MOUSE_DOWN))
{
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
@@ -1554,11 +1536,10 @@ gdk_event_translate (GdkEvent *event,
else if (![impl->toplevel isKeyWindow])
{
GdkDeviceGrabInfo *grab;
GdkSeat *seat = gdk_display_get_default_seat (_gdk_display);
grab = _gdk_display_get_last_device_grab (_gdk_display,
GDK_QUARTZ_DEVICE_MANAGER_CORE (_gdk_display->device_manager)->core_pointer);
if (!grab)
[impl->toplevel makeKeyWindow];
gdk_seat_get_pointer (seat));
}
}
@@ -1566,23 +1547,23 @@ gdk_event_translate (GdkEvent *event,
switch (event_type)
{
case NSLeftMouseDown:
case NSRightMouseDown:
case NSOtherMouseDown:
case NSLeftMouseUp:
case NSRightMouseUp:
case NSOtherMouseUp:
case GDK_QUARTZ_LEFT_MOUSE_DOWN:
case GDK_QUARTZ_RIGHT_MOUSE_DOWN:
case GDK_QUARTZ_OTHER_MOUSE_DOWN:
case GDK_QUARTZ_LEFT_MOUSE_UP:
case GDK_QUARTZ_RIGHT_MOUSE_UP:
case GDK_QUARTZ_OTHER_MOUSE_UP:
fill_button_event (window, event, nsevent, x, y, x_root, y_root);
break;
case NSLeftMouseDragged:
case NSRightMouseDragged:
case NSOtherMouseDragged:
case NSMouseMoved:
case GDK_QUARTZ_LEFT_MOUSE_DRAGGED:
case GDK_QUARTZ_RIGHT_MOUSE_DRAGGED:
case GDK_QUARTZ_OTHER_MOUSE_DRAGGED:
case GDK_QUARTZ_MOUSE_MOVED:
fill_motion_event (window, event, nsevent, x, y, x_root, y_root);
break;
case NSScrollWheel:
case GDK_QUARTZ_SCROLL_WHEEL:
{
GdkScrollDirection direction;
float dx;
@@ -1659,17 +1640,17 @@ gdk_event_translate (GdkEvent *event,
return_val = FALSE;
break;
#endif
case NSMouseExited:
case GDK_QUARTZ_MOUSE_EXITED:
if (WINDOW_IS_TOPLEVEL (window))
[[NSCursor arrowCursor] set];
/* fall through */
case NSMouseEntered:
case GDK_QUARTZ_MOUSE_ENTERED:
return_val = synthesize_crossing_event (window, event, nsevent, x, y, x_root, y_root);
break;
case NSKeyDown:
case NSKeyUp:
case NSFlagsChanged:
case GDK_QUARTZ_KEY_DOWN:
case GDK_QUARTZ_KEY_UP:
case GDK_QUARTZ_FLAGS_CHANGED:
{
GdkEventType type;
+7
View File
@@ -32,9 +32,16 @@ gdk_quartz_osx_version (void)
if (minor == GDK_OSX_UNSUPPORTED)
{
#if MAC_OS_X_VERSION_MIN_REQUIRED < 101000
OSErr err = Gestalt (gestaltSystemVersionMinor, (SInt32*)&minor);
g_return_val_if_fail (err == noErr, GDK_OSX_UNSUPPORTED);
#else
NSOperatingSystemVersion version;
version = [[NSProcessInfo processInfo] operatingSystemVersion];
minor = version.minorVersion;
#endif
}
if (minor < GDK_OSX_MIN)
+12 -44
View File
@@ -87,52 +87,20 @@ _gdk_quartz_display_get_keymap (GdkDisplay *display)
*/
static guint *keyval_array = NULL;
static inline UniChar
macroman2ucs (unsigned char c)
{
/* Precalculated table mapping MacRoman-128 to Unicode. Generated
by creating single element CFStringRefs then extracting the
first character. */
static const unsigned short table[128] = {
0xc4, 0xc5, 0xc7, 0xc9, 0xd1, 0xd6, 0xdc, 0xe1,
0xe0, 0xe2, 0xe4, 0xe3, 0xe5, 0xe7, 0xe9, 0xe8,
0xea, 0xeb, 0xed, 0xec, 0xee, 0xef, 0xf1, 0xf3,
0xf2, 0xf4, 0xf6, 0xf5, 0xfa, 0xf9, 0xfb, 0xfc,
0x2020, 0xb0, 0xa2, 0xa3, 0xa7, 0x2022, 0xb6, 0xdf,
0xae, 0xa9, 0x2122, 0xb4, 0xa8, 0x2260, 0xc6, 0xd8,
0x221e, 0xb1, 0x2264, 0x2265, 0xa5, 0xb5, 0x2202, 0x2211,
0x220f, 0x3c0, 0x222b, 0xaa, 0xba, 0x3a9, 0xe6, 0xf8,
0xbf, 0xa1, 0xac, 0x221a, 0x192, 0x2248, 0x2206, 0xab,
0xbb, 0x2026, 0xa0, 0xc0, 0xc3, 0xd5, 0x152, 0x153,
0x2013, 0x2014, 0x201c, 0x201d, 0x2018, 0x2019, 0xf7, 0x25ca,
0xff, 0x178, 0x2044, 0x20ac, 0x2039, 0x203a, 0xfb01, 0xfb02,
0x2021, 0xb7, 0x201a, 0x201e, 0x2030, 0xc2, 0xca, 0xc1,
0xcb, 0xc8, 0xcd, 0xce, 0xcf, 0xcc, 0xd3, 0xd4,
0xf8ff, 0xd2, 0xda, 0xdb, 0xd9, 0x131, 0x2c6, 0x2dc,
0xaf, 0x2d8, 0x2d9, 0x2da, 0xb8, 0x2dd, 0x2db, 0x2c7
};
if (c < 128)
return c;
else
return table[c - 128];
}
const static struct {
guint keycode;
guint keyval;
unsigned int modmask; /* So we can tell when a mod key is pressed/released */
} modifier_keys[] = {
{ 54, GDK_KEY_Meta_R, NSCommandKeyMask },
{ 55, GDK_KEY_Meta_L, NSCommandKeyMask },
{ 56, GDK_KEY_Shift_L, NSShiftKeyMask },
{ 57, GDK_KEY_Caps_Lock, NSAlphaShiftKeyMask },
{ 58, GDK_KEY_Alt_L, NSAlternateKeyMask },
{ 59, GDK_KEY_Control_L, NSControlKeyMask },
{ 60, GDK_KEY_Shift_R, NSShiftKeyMask },
{ 61, GDK_KEY_Alt_R, NSAlternateKeyMask },
{ 62, GDK_KEY_Control_R, NSControlKeyMask }
{ 54, GDK_KEY_Meta_R, GDK_QUARTZ_COMMAND_KEY_MASK },
{ 55, GDK_KEY_Meta_L, GDK_QUARTZ_COMMAND_KEY_MASK },
{ 56, GDK_KEY_Shift_L, GDK_QUARTZ_SHIFT_KEY_MASK },
{ 57, GDK_KEY_Caps_Lock, GDK_QUARTZ_ALPHA_SHIFT_KEY_MASK },
{ 58, GDK_KEY_Alt_L, GDK_QUARTZ_ALTERNATE_KEY_MASK },
{ 59, GDK_KEY_Control_L, GDK_QUARTZ_CONTROL_KEY_MASK },
{ 60, GDK_KEY_Shift_R, GDK_QUARTZ_SHIFT_KEY_MASK },
{ 61, GDK_KEY_Alt_R, GDK_QUARTZ_ALTERNATE_KEY_MASK },
{ 62, GDK_KEY_Control_R, GDK_QUARTZ_CONTROL_KEY_MASK }
};
const static struct {
@@ -783,11 +751,11 @@ _gdk_quartz_keys_event_type (NSEvent *event)
switch ([event type])
{
case NSKeyDown:
case GDK_QUARTZ_KEY_DOWN:
return GDK_KEY_PRESS;
case NSKeyUp:
case GDK_QUARTZ_KEY_UP:
return GDK_KEY_RELEASE;
case NSFlagsChanged:
case GDK_QUARTZ_FLAGS_CHANGED:
break;
default:
g_assert_not_reached ();
+12 -5
View File
@@ -35,12 +35,19 @@ gdk_quartz_monitor_get_workarea (GdkMonitor *monitor,
GDK_QUARTZ_ALLOC_POOL;
NSRect rect = [quartz_monitor->nsscreen visibleFrame];
NSArray *array = [NSScreen screens];
if (quartz_monitor->monitor_num < [array count])
{
NSScreen *screen = [array objectAtIndex:quartz_monitor->monitor_num];
NSRect rect = [screen visibleFrame];
dest->x = rect.origin.x - quartz_screen->min_x;
dest->y = quartz_screen->height - (rect.origin.y + rect.size.height) + quartz_screen->min_y;
dest->width = rect.size.width;
dest->height = rect.size.height;
dest->x = rect.origin.x - quartz_screen->min_x;
dest->y = quartz_screen->height - (rect.origin.y + rect.size.height) + quartz_screen->min_y;
dest->width = rect.size.width;
dest->height = rect.size.height;
}
else
*dest = monitor->geometry;
GDK_QUARTZ_RELEASE_POOL;
}
+2 -3
View File
@@ -29,8 +29,8 @@
struct _GdkQuartzMonitor
{
GdkMonitor parent;
NSScreen *nsscreen;
gint monitor_num;
CGDirectDisplayID id;
};
struct _GdkQuartzMonitorClass {
@@ -38,4 +38,3 @@ struct _GdkQuartzMonitorClass {
};
#endif
-20
View File
@@ -128,26 +128,6 @@ ensure_atom_tables (void)
}
}
static GdkAtom
intern_atom_internal (const gchar *atom_name, gboolean allocate)
{
gpointer result;
gchar *name;
g_return_val_if_fail (atom_name != NULL, GDK_NONE);
ensure_atom_tables ();
if (g_hash_table_lookup_extended (names_to_atoms, atom_name, NULL, &result))
return result;
result = GINT_TO_POINTER (atoms_to_names->len);
name = allocate ? g_strdup (atom_name) : (gchar *)atom_name;
g_hash_table_insert(names_to_atoms, name, result);
g_ptr_array_add(atoms_to_names, name);
return result;
}
void
_gdk_quartz_window_delete_property (GdkWindow *window,
GdkAtom property)
+3 -1
View File
@@ -53,7 +53,9 @@ typedef enum
GDK_OSX_YOSEMITE = 10,
GDK_OSX_EL_CAPITAN = 11,
GDK_OSX_SIERRA = 12,
GDK_OSX_CURRENT = 12,
GDK_OSX_HIGH_SIERRA = 13,
GDK_OSX_MOJAVE = 14,
GDK_OSX_CURRENT = 14,
GDK_OSX_NEW = 99
} GdkOSXVersion;
+73
View File
@@ -45,6 +45,79 @@ typedef struct _GdkQuartzKeymapClass GdkQuartzKeymapClass;
GDK_AVAILABLE_IN_ALL
GType gdk_quartz_keymap_get_type (void);
#if MAC_OS_X_VERSION_MIN_REQUIRED < 101200
typedef enum
{
GDK_QUARTZ_FLAGS_CHANGED = NSFlagsChanged,
GDK_QUARTZ_KEY_UP = NSKeyUp,
GDK_QUARTZ_KEY_DOWN = NSKeyDown,
GDK_QUARTZ_MOUSE_ENTERED = NSMouseEntered,
GDK_QUARTZ_MOUSE_EXITED = NSMouseExited,
GDK_QUARTZ_SCROLL_WHEEL = NSScrollWheel,
GDK_QUARTZ_MOUSE_MOVED = NSMouseMoved,
GDK_QUARTZ_OTHER_MOUSE_DRAGGED = NSOtherMouseDragged,
GDK_QUARTZ_RIGHT_MOUSE_DRAGGED = NSRightMouseDragged,
GDK_QUARTZ_LEFT_MOUSE_DRAGGED = NSLeftMouseDragged,
GDK_QUARTZ_OTHER_MOUSE_UP = NSOtherMouseUp,
GDK_QUARTZ_RIGHT_MOUSE_UP = NSRightMouseUp,
GDK_QUARTZ_LEFT_MOUSE_UP = NSLeftMouseUp,
GDK_QUARTZ_OTHER_MOUSE_DOWN = NSOtherMouseDown,
GDK_QUARTZ_RIGHT_MOUSE_DOWN = NSRightMouseDown,
GDK_QUARTZ_LEFT_MOUSE_DOWN = NSLeftMouseDown,
} GdkQuartzEventType;
typedef enum
{
GDK_QUARTZ_ALTERNATE_KEY_MASK = NSAlternateKeyMask,
GDK_QUARTZ_CONTROL_KEY_MASK = NSControlKeyMask,
GDK_QUARTZ_SHIFT_KEY_MASK = NSShiftKeyMask,
GDK_QUARTZ_ALPHA_SHIFT_KEY_MASK = NSAlphaShiftKeyMask,
GDK_QUARTZ_COMMAND_KEY_MASK = NSCommandKeyMask,
GDK_QUARTZ_ANY_EVENT_MASK = NSAnyEventMask,
} GdkQuartzEventModifierFlags;
typedef enum
{
GDK_QUARTZ_EVENT_MASK_ANY = NSAnyEventMask,
} GdkQuartzEventMask;
#else
typedef enum
{
GDK_QUARTZ_FLAGS_CHANGED = NSEventTypeFlagsChanged,
GDK_QUARTZ_KEY_UP = NSEventTypeKeyUp,
GDK_QUARTZ_KEY_DOWN = NSEventTypeKeyDown,
GDK_QUARTZ_MOUSE_ENTERED = NSEventTypeMouseEntered,
GDK_QUARTZ_MOUSE_EXITED = NSEventTypeMouseExited,
GDK_QUARTZ_SCROLL_WHEEL = NSEventTypeScrollWheel,
GDK_QUARTZ_MOUSE_MOVED = NSEventTypeMouseMoved,
GDK_QUARTZ_OTHER_MOUSE_DRAGGED = NSEventTypeOtherMouseDragged,
GDK_QUARTZ_RIGHT_MOUSE_DRAGGED = NSEventTypeRightMouseDragged,
GDK_QUARTZ_LEFT_MOUSE_DRAGGED = NSEventTypeLeftMouseDragged,
GDK_QUARTZ_OTHER_MOUSE_UP = NSEventTypeOtherMouseUp,
GDK_QUARTZ_RIGHT_MOUSE_UP = NSEventTypeRightMouseUp,
GDK_QUARTZ_LEFT_MOUSE_UP = NSEventTypeLeftMouseUp,
GDK_QUARTZ_OTHER_MOUSE_DOWN = NSEventTypeOtherMouseDown,
GDK_QUARTZ_RIGHT_MOUSE_DOWN = NSEventTypeRightMouseDown,
GDK_QUARTZ_LEFT_MOUSE_DOWN = NSEventTypeLeftMouseDown,
} GdkQuartzEventType;
typedef enum
{
GDK_QUARTZ_ALTERNATE_KEY_MASK = NSEventModifierFlagOption,
GDK_QUARTZ_CONTROL_KEY_MASK = NSEventModifierFlagControl,
GDK_QUARTZ_SHIFT_KEY_MASK = NSEventModifierFlagShift,
GDK_QUARTZ_ALPHA_SHIFT_KEY_MASK = NSEventModifierFlagCapsLock,
GDK_QUARTZ_COMMAND_KEY_MASK = NSEventModifierFlagCommand,
} GdkQuartzEventModifierFlags;
typedef enum
{
GDK_QUARTZ_EVENT_MASK_ANY = NSEventMaskAny,
} GdkQuartzEventMask;
#endif
G_END_DECLS
#endif /* __GDK_QUARTZ_KEYS_H__ */
+24 -141
View File
@@ -63,12 +63,10 @@
static void gdk_quartz_screen_dispose (GObject *object);
static void gdk_quartz_screen_finalize (GObject *object);
static void gdk_quartz_screen_calculate_layout (GdkQuartzScreen *screen);
static void gdk_quartz_screen_reconfigure (GdkQuartzDisplay *dispplay,
GdkQuartzScreen *screen);
static void display_reconfiguration_callback (CGDirectDisplayID display,
CGDisplayChangeSummaryFlags flags,
void *userInfo);
static const double dpi = 96.0;
static gint get_mm_from_pixels (NSScreen *screen, int pixels);
static const double dpi = 72.0;
G_DEFINE_TYPE (GdkQuartzScreen, gdk_quartz_screen, GDK_TYPE_SCREEN);
@@ -86,13 +84,11 @@ gdk_quartz_screen_init (GdkQuartzScreen *quartz_screen)
* pangocairo-coretext needs to default to that scaling factor.
*/
g_signal_connect (_gdk_display, "monitors-changed",
G_CALLBACK (gdk_quartz_screen_reconfigure), quartz_screen);
/* The first monitors-changed should have fired already. */
_gdk_screen_set_resolution (screen, dpi);
gdk_quartz_screen_calculate_layout (quartz_screen);
CGDisplayRegisterReconfigurationCallback (display_reconfiguration_callback,
screen);
quartz_screen->emit_monitors_changed = FALSE;
}
@@ -107,9 +103,6 @@ gdk_quartz_screen_dispose (GObject *object)
screen->screen_changed_id = 0;
}
CGDisplayRemoveReconfigurationCallback (display_reconfiguration_callback,
screen);
G_OBJECT_CLASS (gdk_quartz_screen_parent_class)->dispose (object);
}
@@ -127,77 +120,42 @@ gdk_quartz_screen_finalize (GObject *object)
static void
gdk_quartz_screen_calculate_layout (GdkQuartzScreen *screen)
{
NSArray *array;
int i;
int i, monitors;
int max_x, max_y;
GdkDisplay *display = gdk_screen_get_display (GDK_SCREEN (screen));
GdkQuartzDisplay *display_quartz = GDK_QUARTZ_DISPLAY (display);
g_ptr_array_free (display_quartz->monitors, TRUE);
display_quartz->monitors = g_ptr_array_new_with_free_func (g_object_unref);
GDK_QUARTZ_ALLOC_POOL;
array = [NSScreen screens];
screen->width = 0;
screen->height = 0;
screen->min_x = 0;
screen->min_y = 0;
max_x = max_y = 0;
screen->mm_width = 0;
screen->mm_height = 0;
/* We determine the minimum and maximum x and y coordinates
* covered by the monitors. From this we can deduce the width
* and height of the root screen.
*/
for (i = 0; i < [array count]; i++)
monitors = gdk_display_get_n_monitors (display);
for (i = 0; i < monitors; ++i)
{
GdkQuartzMonitor *monitor = g_object_new (GDK_TYPE_QUARTZ_MONITOR,
"display", display,
NULL);
g_ptr_array_add (display_quartz->monitors, monitor);
monitor->nsscreen = [array objectAtIndex:i];
GdkQuartzMonitor *monitor =
GDK_QUARTZ_MONITOR (gdk_display_get_monitor (display, i));
GdkRectangle rect;
NSRect rect = [[array objectAtIndex:i] frame];
gdk_monitor_get_geometry (GDK_MONITOR (monitor), &rect);
screen->min_x = MIN (screen->min_x, rect.x);
max_x = MAX (max_x, rect.x + rect.width);
screen->min_x = MIN (screen->min_x, rect.origin.x);
max_x = MAX (max_x, rect.origin.x + rect.size.width);
screen->min_y = MIN (screen->min_y, rect.y);
max_y = MAX (max_y, rect.y + rect.height);
screen->min_y = MIN (screen->min_y, rect.origin.y);
max_y = MAX (max_y, rect.origin.y + rect.size.height);
screen->mm_height += GDK_MONITOR (monitor)->height_mm;
screen->mm_width += GDK_MONITOR (monitor)->width_mm;
}
screen->width = max_x - screen->min_x;
screen->height = max_y - screen->min_y;
for (i = 0; i < [array count] ; i++)
{
NSScreen *nsscreen;
NSRect rect;
GdkMonitor *monitor;
monitor = GDK_MONITOR(display_quartz->monitors->pdata[i]);
nsscreen = [array objectAtIndex:i];
rect = [nsscreen frame];
monitor->geometry.x = rect.origin.x - screen->min_x;
monitor->geometry.y
= screen->height - (rect.origin.y + rect.size.height) + screen->min_y;
monitor->geometry.width = rect.size.width;
monitor->geometry.height = rect.size.height;
if (gdk_quartz_osx_version() >= GDK_OSX_LION)
monitor->scale_factor = [(id <ScaleFactor>) nsscreen backingScaleFactor];
else
monitor->scale_factor = 1;
monitor->width_mm = get_mm_from_pixels(nsscreen, monitor->geometry.width);
monitor->height_mm = get_mm_from_pixels(nsscreen, monitor->geometry.height);
monitor->refresh_rate = 0; // unknown
monitor->manufacturer = NULL; // unknown
monitor->model = NULL; // unknown
monitor->subpixel_layout = GDK_SUBPIXEL_LAYOUT_UNKNOWN; // unknown
}
GDK_QUARTZ_RELEASE_POOL;
}
void
@@ -236,7 +194,7 @@ _gdk_quartz_screen_update_window_sizes (GdkScreen *screen)
}
static void
process_display_reconfiguration (GdkQuartzScreen *screen)
gdk_quartz_screen_reconfigure (GdkQuartzDisplay *display, GdkQuartzScreen *screen)
{
int width, height;
@@ -258,56 +216,6 @@ process_display_reconfiguration (GdkQuartzScreen *screen)
g_signal_emit_by_name (screen, "size-changed");
}
static gboolean
screen_changed_idle (gpointer data)
{
GdkQuartzScreen *screen = data;
process_display_reconfiguration (data);
screen->screen_changed_id = 0;
return FALSE;
}
static void
display_reconfiguration_callback (CGDirectDisplayID display,
CGDisplayChangeSummaryFlags flags,
void *userInfo)
{
GdkQuartzScreen *screen = userInfo;
if (flags & kCGDisplayBeginConfigurationFlag)
{
/* Ignore the begin configuration signal. */
return;
}
else
{
/* We save information about the changes, so we can emit
* ::monitors-changed when appropriate. This signal must be
* emitted when the number, size of position of one of the
* monitors changes.
*/
if (flags & kCGDisplayMovedFlag
|| flags & kCGDisplayAddFlag
|| flags & kCGDisplayRemoveFlag
|| flags & kCGDisplayEnabledFlag
|| flags & kCGDisplayDisabledFlag)
screen->emit_monitors_changed = TRUE;
/* At this point Cocoa does not know about the new screen data
* yet, so we delay our refresh into an idle handler.
*/
if (!screen->screen_changed_id)
{
screen->screen_changed_id = gdk_threads_add_idle (screen_changed_idle,
screen);
g_source_set_name_by_id (screen->screen_changed_id, "[gtk+] screen_changed_idle");
}
}
}
static GdkDisplay *
gdk_quartz_screen_get_display (GdkScreen *screen)
{
@@ -338,13 +246,6 @@ gdk_quartz_screen_get_height (GdkScreen *screen)
return GDK_QUARTZ_SCREEN (screen)->height;
}
static gint
get_mm_from_pixels (NSScreen *screen, int pixels)
{
const float mm_per_inch = 25.4;
return (pixels / dpi) * mm_per_inch;
}
static gchar *
gdk_quartz_screen_make_display_name (GdkScreen *screen)
{
@@ -369,34 +270,16 @@ gdk_quartz_screen_is_composited (GdkScreen *screen)
return TRUE;
}
static NSScreen *
get_nsscreen_for_monitor (gint monitor_num)
{
NSArray *array;
NSScreen *screen;
GDK_QUARTZ_ALLOC_POOL;
array = [NSScreen screens];
screen = [array objectAtIndex:monitor_num];
GDK_QUARTZ_RELEASE_POOL;
return screen;
}
static gint
gdk_quartz_screen_get_width_mm (GdkScreen *screen)
{
return get_mm_from_pixels (get_nsscreen_for_monitor (0),
GDK_QUARTZ_SCREEN (screen)->width);
return GDK_QUARTZ_SCREEN (screen)->mm_width;
}
static gint
gdk_quartz_screen_get_height_mm (GdkScreen *screen)
{
return get_mm_from_pixels (get_nsscreen_for_monitor (0),
GDK_QUARTZ_SCREEN (screen)->height);
return GDK_QUARTZ_SCREEN (screen)->mm_height;
}
static void
+2
View File
@@ -35,6 +35,8 @@ struct _GdkQuartzScreen
gint width;
gint height;
gint mm_width;
gint mm_height;
guint screen_changed_id;
+20 -8
View File
@@ -172,16 +172,28 @@ _gdk_quartz_display_text_property_to_utf8_list (GdkDisplay *display,
}
}
#if MAC_OS_X_VERSION_MIN_REQUIRED < 101400
#define GDK_QUARTZ_URL_PBOARD_TYPE NSURLPboardType
#define GDK_QUARTZ_COLOR_PBOARD_TYPE NSColorPboardType
#define GDK_QUARTZ_STRING_PBOARD_TYPE NSStringPboardType
#define GDK_QUARTZ_TIFF_PBOARD_TYPE NSTIFFPboardType
#else
#define GDK_QUARTZ_URL_PBOARD_TYPE NSPasteboardTypeURL
#define GDK_QUARTZ_COLOR_PBOARD_TYPE NSPasteboardTypeColor
#define GDK_QUARTZ_STRING_PBOARD_TYPE NSPasteboardTypeString
#define GDK_QUARTZ_TIFF_PBOARD_TYPE NSPasteboardTypeTIFF
#endif
GdkAtom
gdk_quartz_pasteboard_type_to_atom_libgtk_only (NSString *type)
{
if ([type isEqualToString:NSStringPboardType])
if ([type isEqualToString:GDK_QUARTZ_STRING_PBOARD_TYPE])
return gdk_atom_intern_static_string ("UTF8_STRING");
else if ([type isEqualToString:NSTIFFPboardType])
else if ([type isEqualToString:GDK_QUARTZ_TIFF_PBOARD_TYPE])
return gdk_atom_intern_static_string ("image/tiff");
else if ([type isEqualToString:NSColorPboardType])
else if ([type isEqualToString:GDK_QUARTZ_COLOR_PBOARD_TYPE])
return gdk_atom_intern_static_string ("application/x-color");
else if ([type isEqualToString:NSURLPboardType])
else if ([type isEqualToString:GDK_QUARTZ_URL_PBOARD_TYPE])
return gdk_atom_intern_static_string ("text/uri-list");
else
return gdk_atom_intern ([type UTF8String], FALSE);
@@ -191,13 +203,13 @@ NSString *
gdk_quartz_target_to_pasteboard_type_libgtk_only (const char *target)
{
if (strcmp (target, "UTF8_STRING") == 0)
return NSStringPboardType;
return GDK_QUARTZ_STRING_PBOARD_TYPE;
else if (strcmp (target, "image/tiff") == 0)
return NSTIFFPboardType;
return GDK_QUARTZ_TIFF_PBOARD_TYPE;
else if (strcmp (target, "application/x-color") == 0)
return NSColorPboardType;
return GDK_QUARTZ_COLOR_PBOARD_TYPE;
else if (strcmp (target, "text/uri-list") == 0)
return NSURLPboardType;
return GDK_QUARTZ_URL_PBOARD_TYPE;
else
return [NSString stringWithUTF8String:target];
}
+95 -96
View File
@@ -52,6 +52,27 @@ typedef struct
GdkWMDecoration decor;
} FullscreenSavedGeometry;
#if MAC_OS_X_VERSION_MIN_REQUIRED < 101200
typedef enum
{
GDK_QUARTZ_BORDERLESS_WINDOW = NSBorderlessWindowMask,
GDK_QUARTZ_CLOSABLE_WINDOW = NSClosableWindowMask,
GDK_QUARTZ_FULLSCREEN_WINDOW = NSFullScreenWindowMask,
GDK_QUARTZ_MINIATURIZABLE_WINDOW = NSMiniaturizableWindowMask,
GDK_QUARTZ_RESIZABLE_WINDOW = NSResizableWindowMask,
GDK_QUARTZ_TITLED_WINDOW = NSTitledWindowMask,
} GdkQuartzWindowMask;
#else
typedef enum
{
GDK_QUARTZ_BORDERLESS_WINDOW = NSWindowStyleMaskBorderless,
GDK_QUARTZ_CLOSABLE_WINDOW = NSWindowStyleMaskClosable,
GDK_QUARTZ_FULLSCREEN_WINDOW = NSWindowStyleMaskFullScreen,
GDK_QUARTZ_MINIATURIZABLE_WINDOW = NSWindowStyleMaskMiniaturizable,
GDK_QUARTZ_RESIZABLE_WINDOW = NSWindowStyleMaskResizable,
GDK_QUARTZ_TITLED_WINDOW = NSWindowStyleMaskTitled,
} GdkQuartzWindowMask;
#endif
#ifndef AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER
static FullscreenSavedGeometry *get_fullscreen_geometry (GdkWindow *window);
@@ -120,7 +141,7 @@ static CGContextRef
gdk_window_impl_quartz_get_context (GdkWindowImplQuartz *window_impl,
gboolean antialias)
{
CGContextRef cg_context;
CGContextRef cg_context = NULL;
CGSize scale;
if (GDK_WINDOW_DESTROYED (window_impl->wrapper))
@@ -137,8 +158,17 @@ gdk_window_impl_quartz_get_context (GdkWindowImplQuartz *window_impl,
if (![window_impl->view lockFocusIfCanDraw])
return NULL;
}
#if MAC_OS_X_VERSION_MAX_ALLOWED < 101000
cg_context = [[NSGraphicsContext currentContext] graphicsPort];
#else
if (gdk_quartz_osx_version () < GDK_OSX_YOSEMITE)
cg_context = [[NSGraphicsContext currentContext] graphicsPort];
else
cg_context = [[NSGraphicsContext currentContext] CGContext];
#endif
cg_context = [[NSGraphicsContext currentContext] graphicsPort];
if (!cg_context)
return NULL;
CGContextSaveGState (cg_context);
CGContextSetAllowsAntialiasing (cg_context, antialias);
@@ -166,58 +196,14 @@ gdk_window_impl_quartz_release_context (GdkWindowImplQuartz *window_impl,
}
}
static void
check_grab_unmap (GdkWindow *window)
{
GList *list, *l;
GdkDisplay *display = gdk_window_get_display (window);
GdkDeviceManager *device_manager;
device_manager = gdk_display_get_device_manager (display);
list = gdk_device_manager_list_devices (device_manager,
GDK_DEVICE_TYPE_FLOATING);
for (l = list; l; l = l->next)
{
_gdk_display_end_device_grab (display, l->data, 0, window, TRUE);
}
g_list_free (list);
}
static void
check_grab_destroy (GdkWindow *window)
{
GList *list, *l;
GdkDisplay *display = gdk_window_get_display (window);
GdkDeviceManager *device_manager;
/* Make sure there is no lasting grab in this native window */
device_manager = gdk_display_get_device_manager (display);
list = gdk_device_manager_list_devices (device_manager,
GDK_DEVICE_TYPE_MASTER);
for (l = list; l; l = l->next)
{
GdkDeviceGrabInfo *grab;
grab = _gdk_display_get_last_device_grab (display, l->data);
if (grab && grab->native_window == window)
{
/* Serials are always 0 in quartz, but for clarity: */
grab->serial_end = grab->serial_start;
grab->implicit_ungrab = TRUE;
}
}
g_list_free (list);
}
static void
gdk_window_impl_quartz_finalize (GObject *object)
{
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (object);
GdkDisplay *display = gdk_window_get_display (impl->wrapper);
GdkSeat *seat = gdk_display_get_default_seat (display);
check_grab_destroy (GDK_WINDOW_IMPL_QUARTZ (object)->wrapper);
gdk_seat_ungrab (seat);
if (impl->transient_for)
g_object_unref (impl->transient_for);
@@ -235,10 +221,14 @@ gdk_window_impl_quartz_finalize (GObject *object)
*
* If drawable NULL, no flushing is done, only registering that a flush was
* done externally.
*
* Note: As of MacOS 10.14 NSWindow flushWindow is deprecated because
* Quartz has the ability to handle deferred drawing on its own.
*/
void
_gdk_quartz_window_flush (GdkWindowImplQuartz *window_impl)
{
#if MAC_OS_X_VERSION_MIN_REQUIRED < 101400
static struct timeval prev_tv;
static gint intervals[4];
static gint index;
@@ -264,6 +254,7 @@ _gdk_quartz_window_flush (GdkWindowImplQuartz *window_impl)
}
else
prev_tv = tv;
#endif
}
static cairo_user_data_key_t gdk_quartz_cairo_key;
@@ -297,15 +288,15 @@ gdk_quartz_create_cairo_surface (GdkWindowImplQuartz *impl,
cg_context = gdk_quartz_window_get_context (impl, TRUE);
if (!cg_context)
return NULL;
surface_data = g_new (GdkQuartzCairoSurfaceData, 1);
surface_data->window_impl = impl;
surface_data->cg_context = cg_context;
surface = cairo_quartz_surface_create_for_cg_context (cg_context,
width, height);
if (cg_context)
surface = cairo_quartz_surface_create_for_cg_context (cg_context,
width, height);
else
surface = cairo_quartz_surface_create(CAIRO_FORMAT_ARGB32, width, height);
cairo_surface_set_user_data (surface, &gdk_quartz_cairo_key,
surface_data,
@@ -394,7 +385,7 @@ _gdk_quartz_window_process_updates_recurse (GdkWindow *window,
toplevel_impl = (GdkWindowImplQuartz *)toplevel->impl;
nswindow = toplevel_impl->toplevel;
#if MAC_OS_X_VERSION_MIN_REQUIRED < 101400
/* In theory, we could skip the flush disabling, since we only
* have one NSView.
*/
@@ -404,6 +395,7 @@ _gdk_quartz_window_process_updates_recurse (GdkWindow *window,
[nswindow disableFlushWindow];
update_nswindows = g_slist_prepend (update_nswindows, nswindow);
}
#endif
}
}
@@ -427,10 +419,12 @@ _gdk_quartz_display_before_process_all_updates (GdkDisplay *display)
{
[NSAnimationContext endGrouping];
}
#if MAC_OS_X_VERSION_MIN_REQUIRED < 101100
else
{
NSDisableScreenUpdates ();
}
#endif
}
void
@@ -448,9 +442,10 @@ _gdk_quartz_display_after_process_all_updates (GdkDisplay *display)
[[nswindow contentView] displayIfNeeded];
_gdk_quartz_window_flush (NULL);
#if MAC_OS_X_VERSION_MIN_REQUIRED < 101400
[nswindow enableFlushWindow];
[nswindow flushWindow];
#endif
[nswindow release];
tmp_list = tmp_list->next;
@@ -464,10 +459,12 @@ _gdk_quartz_display_after_process_all_updates (GdkDisplay *display)
{
[NSAnimationContext beginGrouping];
}
#if MAC_OS_X_VERSION_MIN_REQUIRED < 101100
else
{
NSEnableScreenUpdates ();
}
#endif
}
static const gchar *
@@ -549,7 +546,11 @@ _gdk_quartz_window_debug_highlight (GdkWindow *window, gint number)
[debug_window[number] close];
debug_window[number] = [[NSWindow alloc] initWithContentRect:rect
styleMask:NSBorderlessWindowMask
#if MAC_OS_X_VERSION_MIN_REQUIRED < 101200
styleMask:(NSUInteger)GDK_QUARTZ_BORDERLESS_WINDOW
#else
styleMask:(NSWindowStyleMask)GDK_QUARTZ_BORDERLESS_WINDOW
#endif
backing:NSBackingStoreBuffered
defer:NO];
@@ -876,14 +877,14 @@ _gdk_quartz_display_create_window_impl (GdkDisplay *display,
((attributes_mask & GDK_WA_TYPE_HINT) &&
attributes->type_hint == GDK_WINDOW_TYPE_HINT_SPLASHSCREEN))
{
style_mask = NSBorderlessWindowMask;
style_mask = GDK_QUARTZ_BORDERLESS_WINDOW;
}
else
{
style_mask = (NSTitledWindowMask |
NSClosableWindowMask |
NSMiniaturizableWindowMask |
NSResizableWindowMask);
style_mask = (GDK_QUARTZ_TITLED_WINDOW |
GDK_QUARTZ_CLOSABLE_WINDOW |
GDK_QUARTZ_MINIATURIZABLE_WINDOW |
GDK_QUARTZ_RESIZABLE_WINDOW);
}
impl->toplevel = [[GdkQuartzNSWindow alloc] initWithContentRect:content_rect
@@ -1143,6 +1144,9 @@ void
gdk_window_quartz_hide (GdkWindow *window)
{
GdkWindowImplQuartz *impl;
GdkDisplay *display = gdk_window_get_display (window);
GdkSeat *seat = gdk_display_get_default_seat (display);
gdk_seat_ungrab (seat);
/* Make sure we're not stuck in fullscreen mode. */
#ifndef AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER
@@ -1150,8 +1154,6 @@ gdk_window_quartz_hide (GdkWindow *window)
SetSystemUIMode (kUIModeNormal, 0);
#endif
check_grab_unmap (window);
_gdk_window_clear_update_area (window);
impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
@@ -1622,7 +1624,7 @@ gdk_window_quartz_get_geometry (GdkWindow *window,
* windows with borders and the root relative coordinates
* otherwise.
*/
if ([impl->toplevel styleMask] == NSBorderlessWindowMask)
if ([impl->toplevel styleMask] == GDK_QUARTZ_BORDERLESS_WINDOW)
{
_gdk_quartz_window_xy_to_gdk_xy (ns_rect.origin.x,
ns_rect.origin.y + ns_rect.size.height,
@@ -2349,13 +2351,14 @@ gdk_quartz_window_set_decorations (GdkWindow *window,
if (decorations == 0 || GDK_WINDOW_TYPE (window) == GDK_WINDOW_TEMP ||
impl->type_hint == GDK_WINDOW_TYPE_HINT_SPLASHSCREEN )
{
new_mask = NSBorderlessWindowMask;
new_mask = GDK_QUARTZ_BORDERLESS_WINDOW;
}
else
{
/* FIXME: Honor other GDK_DECOR_* flags. */
new_mask = (NSTitledWindowMask | NSClosableWindowMask |
NSMiniaturizableWindowMask | NSResizableWindowMask);
new_mask = (GDK_QUARTZ_TITLED_WINDOW | GDK_QUARTZ_CLOSABLE_WINDOW |
GDK_QUARTZ_MINIATURIZABLE_WINDOW |
GDK_QUARTZ_RESIZABLE_WINDOW);
}
GDK_QUARTZ_ALLOC_POOL;
@@ -2373,14 +2376,14 @@ gdk_quartz_window_set_decorations (GdkWindow *window,
/* Properly update the size of the window when the titlebar is
* added or removed.
*/
if (old_mask == NSBorderlessWindowMask &&
new_mask != NSBorderlessWindowMask)
if (old_mask == GDK_QUARTZ_BORDERLESS_WINDOW &&
new_mask != GDK_QUARTZ_BORDERLESS_WINDOW)
{
rect = [NSWindow frameRectForContentRect:rect styleMask:new_mask];
}
else if (old_mask != NSBorderlessWindowMask &&
new_mask == NSBorderlessWindowMask)
else if (old_mask != GDK_QUARTZ_BORDERLESS_WINDOW &&
new_mask == GDK_QUARTZ_BORDERLESS_WINDOW)
{
rect = [NSWindow contentRectForFrameRect:rect styleMask:old_mask];
}
@@ -2396,13 +2399,14 @@ gdk_quartz_window_set_decorations (GdkWindow *window,
[(id<CanSetStyleMask>)impl->toplevel setStyleMask:new_mask];
/* It appears that unsetting and then resetting NSTitledWindowMask
* does not reset the title in the title bar as might be expected.
/* It appears that unsetting and then resetting
* GDK_QUARTZ_TITLED_WINDOW does not reset the title in the
* title bar as might be expected.
*
* In theory we only need to set this if new_mask includes
* NSTitledWindowMask. This behaved extremely oddly when
* GDK_QUARTZ_TITLED_WINDOW. This behaved extremely oddly when
* conditionalized upon that and since it has no side effects (i.e.
* if NSTitledWindowMask is not requested, the title will not be
* if GDK_QUARTZ_TITLED_WINDOW is not requested, the title will not be
* displayed) just do it unconditionally. We also must null check
* 'title' before setting it to avoid crashing.
*/
@@ -2435,7 +2439,7 @@ gdk_quartz_window_set_decorations (GdkWindow *window,
[impl->toplevel setContentView:old_view];
}
if (new_mask == NSBorderlessWindowMask)
if (new_mask == GDK_QUARTZ_BORDERLESS_WINDOW)
{
[impl->toplevel setContentSize:rect.size];
[impl->toplevel setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
@@ -2470,7 +2474,7 @@ gdk_quartz_window_get_decorations (GdkWindow *window,
if (decorations)
{
/* Borderless is 0, so we can't check it as a bit being set. */
if ([impl->toplevel styleMask] == NSBorderlessWindowMask)
if ([impl->toplevel styleMask] == GDK_QUARTZ_BORDERLESS_WINDOW)
{
*decorations = 0;
}
@@ -2513,19 +2517,19 @@ gdk_quartz_window_set_functions (GdkWindow *window,
NSUInteger mask = [impl->toplevel styleMask];
if (min)
mask = mask | NSMiniaturizableWindowMask;
mask = mask | GDK_QUARTZ_MINIATURIZABLE_WINDOW;
else
mask = mask & ~NSMiniaturizableWindowMask;
mask = mask & ~GDK_QUARTZ_MINIATURIZABLE_WINDOW;
if (max)
mask = mask | NSResizableWindowMask;
mask = mask | GDK_QUARTZ_RESIZABLE_WINDOW;
else
mask = mask & ~NSResizableWindowMask;
mask = mask & ~GDK_QUARTZ_RESIZABLE_WINDOW;
if (close)
mask = mask | NSClosableWindowMask;
mask = mask | GDK_QUARTZ_CLOSABLE_WINDOW;
else
mask = mask & ~NSClosableWindowMask;
mask = mask & ~GDK_QUARTZ_CLOSABLE_WINDOW;
[impl->toplevel setStyleMask:mask];
}
@@ -2658,7 +2662,7 @@ window_is_fullscreen (GdkWindow *window)
{
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
return ([impl->toplevel styleMask] & NSFullScreenWindowMask) != 0;
return ([impl->toplevel styleMask] & GDK_QUARTZ_FULLSCREEN_WINDOW) != 0;
}
static void
@@ -2834,31 +2838,26 @@ gdk_quartz_window_set_keep_below (GdkWindow *window,
[impl->toplevel setLevel: level - (setting ? 1 : 0)];
}
/* X11 "feature" not useful in other backends. */
static GdkWindow *
gdk_quartz_window_get_group (GdkWindow *window)
{
g_return_val_if_fail (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD, NULL);
if (GDK_WINDOW_DESTROYED (window) ||
!WINDOW_IS_TOPLEVEL (window))
return NULL;
/* FIXME: Implement */
return NULL;
}
/* X11 "feature" not useful in other backends. */
static void
gdk_quartz_window_set_group (GdkWindow *window,
GdkWindow *leader)
{
/* FIXME: Implement */
}
static void
gdk_quartz_window_destroy_notify (GdkWindow *window)
{
check_grab_destroy (window);
GdkDisplay *display = gdk_window_get_display (window);
GdkSeat *seat = gdk_display_get_default_seat (display);
gdk_seat_ungrab (seat);
}
static void
@@ -3104,7 +3103,7 @@ gdk_root_window_impl_quartz_get_context (GdkWindowImplQuartz *window,
colorspace = CGColorSpaceCreateWithName (kCGColorSpaceGenericRGB);
cg_context = CGBitmapContextCreate (NULL,
1, 1, 8, 4, colorspace,
kCGImageAlphaPremultipliedLast);
(CGBitmapInfo)kCGImageAlphaPremultipliedLast);
CGColorSpaceRelease (colorspace);
return cg_context;
+14
View File
@@ -310,6 +310,9 @@ struct _GdkWaylandDeviceManagerClass
GdkDeviceManagerClass parent_class;
};
static void
pointer_surface_update_scale (GdkDevice *device);
static void deliver_key_event (GdkWaylandSeat *seat,
uint32_t time_,
uint32_t key,
@@ -4501,10 +4504,18 @@ static const struct zwp_tablet_seat_v2_listener tablet_seat_listener = {
tablet_seat_handle_pad_added,
};
static void
on_monitors_changed (GdkScreen *screen,
GdkWaylandSeat *seat)
{
pointer_surface_update_scale (seat->master_pointer);
}
static void
init_devices (GdkWaylandSeat *seat)
{
GdkWaylandDeviceManager *device_manager = GDK_WAYLAND_DEVICE_MANAGER (seat->device_manager);
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (seat->display);
/* pointer */
seat->master_pointer = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
@@ -4524,6 +4535,9 @@ init_devices (GdkWaylandSeat *seat)
g_list_prepend (device_manager->devices, seat->master_pointer);
g_signal_emit_by_name (device_manager, "device-added", seat->master_pointer);
g_signal_connect (display->screen, "monitors-changed",
G_CALLBACK (on_monitors_changed), seat);
/* keyboard */
seat->master_keyboard = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", "Core Keyboard",
+331 -51
View File
@@ -29,6 +29,7 @@
#include "gdkmonitor-wayland.h"
#include "gdkwayland.h"
#include "gdkprivate-wayland.h"
#include "gdk-private.h"
#include "wm-button-layout-translation.h"
@@ -71,6 +72,7 @@ struct _GdkWaylandScreen
GHashTable *settings;
GsdXftSettings xft_settings;
GsdExtSettings dbus_settings;
GDBusProxy *settings_portal;
GDBusProxy *dbus_proxy;
GCancellable *dbus_cancellable;
@@ -126,7 +128,10 @@ gdk_wayland_screen_finalize (GObject *object)
g_object_unref (screen_wayland->visual);
g_hash_table_destroy (screen_wayland->settings);
if (screen_wayland->settings)
g_hash_table_destroy (screen_wayland->settings);
g_clear_object (&screen_wayland->settings_portal);
g_free (screen_wayland->dbus_settings.modules);
@@ -238,6 +243,19 @@ typedef enum
GSD_FONT_ANTIALIASING_MODE_RGBA
} GsdFontAntialiasingMode;
static int
get_antialiasing (const char *s)
{
const char *names[] = { "none", "grayscale", "rgba" };
int i;
for (i = 0; i < G_N_ELEMENTS (names); i++)
if (strcmp (s, names[i]) == 0)
return i;
return 0;
}
typedef enum
{
GSD_FONT_HINTING_NONE,
@@ -246,6 +264,19 @@ typedef enum
GSD_FONT_HINTING_FULL
} GsdFontHinting;
static int
get_hinting (const char *s)
{
const char *names[] = { "none", "slight", "medium", "full" };
int i;
for (i = 0; i < G_N_ELEMENTS (names); i++)
if (strcmp (s, names[i]) == 0)
return i;
return 0;
}
typedef enum
{
GSD_FONT_RGBA_ORDER_RGBA,
@@ -255,6 +286,19 @@ typedef enum
GSD_FONT_RGBA_ORDER_VBGR
} GsdFontRgbaOrder;
static int
get_order (const char *s)
{
const char *names[] = { "rgba", "rgb", "bgr", "vrgb", "vbgr" };
int i;
for (i = 0; i < G_N_ELEMENTS (names); i++)
if (strcmp (s, names[i]) == 0)
return i;
return 0;
}
static gdouble
get_dpi_from_gsettings (GdkWaylandScreen *screen_wayland)
{
@@ -271,6 +315,25 @@ get_dpi_from_gsettings (GdkWaylandScreen *screen_wayland)
return 96.0 * factor;
}
/* When using the Settings portal, we cache the value in
* the fallback member, and we ignore the valid field
*/
typedef struct _TranslationEntry TranslationEntry;
struct _TranslationEntry {
gboolean valid;
const gchar *schema;
const gchar *key;
const gchar *setting;
GType type;
union {
const char *s;
gint i;
gboolean b;
} fallback;
};
static TranslationEntry * find_translation_entry_by_schema (const char *schema,
const char *key);
static void
update_xft_settings (GdkScreen *screen)
{
@@ -281,25 +344,48 @@ update_xft_settings (GdkScreen *screen)
GsdFontRgbaOrder order;
gboolean use_rgba = FALSE;
GsdXftSettings xft_settings;
double dpi;
settings = g_hash_table_lookup (screen_wayland->settings, "org.gnome.settings-daemon.plugins.xsettings");
if (settings)
if (screen_wayland->settings_portal)
{
antialiasing = g_settings_get_enum (settings, "antialiasing");
hinting = g_settings_get_enum (settings, "hinting");
order = g_settings_get_enum (settings, "rgba-order");
TranslationEntry *entry;
entry = find_translation_entry_by_schema ("org.gnome.settings-daemon.plugins.xsettings", "antialiasing");
antialiasing = entry->fallback.i;
entry = find_translation_entry_by_schema ("org.gnome.settings-daemon.plugins.xsettings", "hinting");
hinting = entry->fallback.i;
entry = find_translation_entry_by_schema ("org.gnome.settings-daemon.plugins.xsettings", "rgba-order");
order = entry->fallback.i;
entry = find_translation_entry_by_schema ("org.gnome.desktop.interface", "text-scaling-factor");
dpi = 96.0 * entry->fallback.i / 65536.0 * 1024; /* Xft wants 1/1024th of an inch */
}
else
{
antialiasing = GSD_FONT_ANTIALIASING_MODE_GRAYSCALE;
hinting = GSD_FONT_HINTING_MEDIUM;
order = GSD_FONT_RGBA_ORDER_RGB;
settings = g_hash_table_lookup (screen_wayland->settings,
"org.gnome.settings-daemon.plugins.xsettings");
if (settings)
{
antialiasing = g_settings_get_enum (settings, "antialiasing");
hinting = g_settings_get_enum (settings, "hinting");
order = g_settings_get_enum (settings, "rgba-order");
}
else
{
antialiasing = GSD_FONT_ANTIALIASING_MODE_GRAYSCALE;
hinting = GSD_FONT_HINTING_MEDIUM;
order = GSD_FONT_RGBA_ORDER_RGB;
}
dpi = get_dpi_from_gsettings (screen_wayland) * 1024;
}
xft_settings.antialias = (antialiasing != GSD_FONT_ANTIALIASING_MODE_NONE);
xft_settings.hinting = (hinting != GSD_FONT_HINTING_NONE);
xft_settings.dpi = get_dpi_from_gsettings (screen_wayland) * 1024; /* Xft wants 1/1024ths of an inch */
xft_settings.dpi = dpi;
xft_settings.rgba = "rgb";
xft_settings.hintstyle = "hintfull";
@@ -403,22 +489,9 @@ update_xft_settings (GdkScreen *screen)
#define WM_SETTINGS_SCHEMA "org.gnome.desktop.wm.preferences"
#define CLASSIC_WM_SETTINGS_SCHEMA "org.gnome.shell.extensions.classic-overrides"
typedef struct _TranslationEntry TranslationEntry;
struct _TranslationEntry {
gboolean valid;
const gchar *schema;
const gchar *key;
const gchar *setting;
GType type;
union {
const gchar *s;
gint i;
gboolean b;
} fallback;
};
static TranslationEntry translations[] = {
{ FALSE, "org.gnome.desktop.interface", "gtk-theme", "gtk-theme-name" , G_TYPE_STRING, { .s = "Adwaita" } },
{ FALSE, "org.gnome.desktop.interface", "gtk-key-theme", "gtk-key-theme-name" , G_TYPE_STRING, { .s = "Default" } },
{ FALSE, "org.gnome.desktop.interface", "icon-theme", "gtk-icon-theme-name", G_TYPE_STRING, { .s = "gnome" } },
{ FALSE, "org.gnome.desktop.interface", "cursor-theme", "gtk-cursor-theme-name", G_TYPE_STRING, { .s = "Adwaita" } },
{ FALSE, "org.gnome.desktop.interface", "cursor-size", "gtk-cursor-theme-size", G_TYPE_INT, { .i = 32 } },
@@ -446,31 +519,39 @@ static TranslationEntry translations[] = {
{ FALSE, "org.gnome.desktop.wm.preferences", "action-double-click-titlebar", "gtk-titlebar-double-click", G_TYPE_STRING, { .s = "toggle-maximize" } },
{ FALSE, "org.gnome.desktop.wm.preferences", "action-middle-click-titlebar", "gtk-titlebar-middle-click", G_TYPE_STRING, { .s = "none" } },
{ FALSE, "org.gnome.desktop.wm.preferences", "action-right-click-titlebar", "gtk-titlebar-right-click", G_TYPE_STRING, { .s = "menu" } },
{ FALSE, "org.gnome.desktop.a11y", "always-show-text-caret", "gtk-keynav-use-caret", G_TYPE_BOOLEAN, { .b = FALSE } }
{ FALSE, "org.gnome.desktop.a11y", "always-show-text-caret", "gtk-keynav-use-caret", G_TYPE_BOOLEAN, { .b = FALSE } },
{ FALSE, "org.gnome.fontconfig", "serial", "gtk-fontconfig-timestamp", G_TYPE_INT, { .i = 0 } }
};
static TranslationEntry *
find_translation_entry_by_key (GSettings *settings,
const gchar *key)
find_translation_entry_by_schema (const char *schema,
const gchar *key)
{
guint i;
gchar *schema;
g_object_get (settings, "schema", &schema, NULL);
for (i = 0; i < G_N_ELEMENTS (translations); i++)
{
if (g_str_equal (schema, translations[i].schema) &&
g_str_equal (key, translations[i].key))
{
g_free (schema);
return &translations[i];
}
return &translations[i];
}
return NULL;
}
static TranslationEntry *
find_translation_entry_by_key (GSettings *settings,
const char *key)
{
char *schema;
TranslationEntry *entry;
g_object_get (settings, "schema", &schema, NULL);
entry = find_translation_entry_by_schema (schema, key);
g_free (schema);
return NULL;
return entry;
}
static TranslationEntry *
@@ -505,6 +586,78 @@ settings_changed (GSettings *settings,
}
}
static void
apply_portal_setting (TranslationEntry *entry,
GVariant *value,
GdkScreen *screen)
{
switch (entry->type)
{
case G_TYPE_STRING:
entry->fallback.s = g_intern_string (g_variant_get_string (value, NULL));
break;
case G_TYPE_INT:
entry->fallback.i = g_variant_get_int32 (value);
break;
case G_TYPE_BOOLEAN:
entry->fallback.b = g_variant_get_boolean (value);
break;
case G_TYPE_NONE:
if (strcmp (entry->key, "antialiasing") == 0)
entry->fallback.i = get_antialiasing (g_variant_get_string (value, NULL));
else if (strcmp (entry->key, "hinting") == 0)
entry->fallback.i = get_hinting (g_variant_get_string (value, NULL));
else if (strcmp (entry->key, "rgba-order") == 0)
entry->fallback.i = get_order (g_variant_get_string (value, NULL));
else if (strcmp (entry->key, "text-scaling-factor") == 0)
entry->fallback.i = (int) (g_variant_get_double (value) * 65536.0);
update_xft_settings (screen);
break;
default:
break;
}
}
static void
settings_portal_changed (GDBusProxy *proxy,
const char *sender_name,
const char *signal_name,
GVariant *parameters,
GdkScreen *screen)
{
if (strcmp (signal_name, "SettingChanged") == 0)
{
const char *namespace;
const char *name;
GVariant *value;
TranslationEntry *entry;
g_variant_get (parameters, "(&s&sv)", &namespace, &name, &value);
entry = find_translation_entry_by_schema (namespace, name);
if (entry != NULL)
{
char *a = g_variant_print (value, FALSE);
g_debug ("Using changed portal setting %s %s: %s", namespace, name, a);
g_free (a);
apply_portal_setting (entry, value, screen);
notify_setting (screen, entry->setting);
}
else
g_debug ("Ignoring portal setting %s %s", namespace, name);
g_variant_unref (value);
}
}
static void fontconfig_dbus_proxy_open_cb (GObject *object,
GAsyncResult *result,
gpointer user_data);
#define PORTAL_BUS_NAME "org.freedesktop.portal.Desktop"
#define PORTAL_OBJECT_PATH "/org/freedesktop/portal/desktop"
#define PORTAL_SETTINGS_INTERFACE "org.freedesktop.portal.Settings"
static void
init_settings (GdkScreen *screen)
{
@@ -514,6 +667,96 @@ init_settings (GdkScreen *screen)
GSettings *settings;
gint i;
if (gdk_should_use_portal ())
{
GVariant *ret;
GError *error = NULL;
const char *schema;
GVariant *val;
GVariantIter *iter;
const char *patterns[] = { "org.gnome.*", NULL };
screen_wayland->settings_portal = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
G_DBUS_PROXY_FLAGS_NONE,
NULL,
PORTAL_BUS_NAME,
PORTAL_OBJECT_PATH,
PORTAL_SETTINGS_INTERFACE,
NULL,
&error);
if (error)
{
g_warning ("Settings portal not found: %s", error->message);
g_error_free (error);
goto fallback;
}
ret = g_dbus_proxy_call_sync (screen_wayland->settings_portal,
"ReadAll",
g_variant_new ("(^as)", patterns),
G_DBUS_CALL_FLAGS_NONE,
G_MAXINT,
NULL,
&error);
if (error)
{
g_warning ("Failed to read portal settings: %s", error->message);
g_error_free (error);
g_clear_object (&screen_wayland->settings_portal);
goto fallback;
}
g_variant_get (ret, "(a{sa{sv}})", &iter);
while (g_variant_iter_loop (iter, "{s@a{sv}}", &schema, &val))
{
GVariantIter *iter2 = g_variant_iter_new (val);
const char *key;
GVariant *v;
while (g_variant_iter_loop (iter2, "{sv}", &key, &v))
{
TranslationEntry *entry = find_translation_entry_by_schema (schema, key);
if (entry)
{
char *a = g_variant_print (v, FALSE);
g_debug ("Using portal setting for %s %s: %s\n", schema, key, a);
g_free (a);
apply_portal_setting (entry, v, screen);
}
else
{
g_debug ("Ignoring portal setting for %s %s", schema, key);
}
}
g_variant_iter_free (iter2);
}
g_variant_iter_free (iter);
g_variant_unref (ret);
g_signal_connect (screen_wayland->settings_portal, "g-signal",
G_CALLBACK (settings_portal_changed), screen_wayland);
return;
fallback:
g_debug ("Failed to use Settings portal; falling back to gsettings");
}
screen_wayland->dbus_cancellable = g_cancellable_new ();
g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION,
G_DBUS_PROXY_FLAGS_NONE,
NULL,
GTK_SETTINGS_DBUS_NAME,
GTK_SETTINGS_DBUS_PATH,
GTK_SETTINGS_DBUS_NAME,
screen_wayland->dbus_cancellable,
fontconfig_dbus_proxy_open_cb,
screen_wayland);
screen_wayland->settings = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_object_unref);
source = g_settings_schema_source_get_default ();
@@ -581,6 +824,44 @@ set_value_from_entry (GdkScreen *screen,
GdkWaylandScreen *screen_wayland = GDK_WAYLAND_SCREEN (screen);
GSettings *settings;
if (screen_wayland->settings_portal)
{
switch (entry->type)
{
case G_TYPE_STRING:
g_value_set_string (value, entry->fallback.s);
break;
case G_TYPE_INT:
if (g_str_equal (entry->setting, "gtk-fontconfig-timestamp"))
g_value_set_uint (value, (guint)entry->fallback.i);
else
g_value_set_int (value, entry->fallback.i);
break;
case G_TYPE_BOOLEAN:
g_value_set_boolean (value, entry->fallback.b);
break;
case G_TYPE_NONE:
if (g_str_equal (entry->setting, "gtk-xft-antialias"))
g_value_set_int (value, screen_wayland->xft_settings.antialias);
else if (g_str_equal (entry->setting, "gtk-xft-hinting"))
g_value_set_int (value, screen_wayland->xft_settings.hinting);
else if (g_str_equal (entry->setting, "gtk-xft-hintstyle"))
g_value_set_static_string (value, screen_wayland->xft_settings.hintstyle);
else if (g_str_equal (entry->setting, "gtk-xft-rgba"))
g_value_set_static_string (value, screen_wayland->xft_settings.rgba);
else if (g_str_equal (entry->setting, "gtk-xft-dpi"))
g_value_set_int (value, screen_wayland->xft_settings.dpi);
else
g_assert_not_reached ();
break;
default:
g_assert_not_reached ();
break;
}
return;
}
settings = (GSettings *)g_hash_table_lookup (screen_wayland->settings, entry->schema);
switch (entry->type)
{
@@ -598,9 +879,12 @@ set_value_from_entry (GdkScreen *screen,
}
break;
case G_TYPE_INT:
g_value_set_int (value, settings && entry->valid
? g_settings_get_int (settings, entry->key)
: entry->fallback.i);
if (g_str_equal (entry->setting, "gtk-fontconfig-timestamp"))
g_value_set_uint (value, screen_wayland->dbus_settings.fontconfig_timestamp);
else
g_value_set_int (value, settings && entry->valid
? g_settings_get_int (settings, entry->key)
: entry->fallback.i);
break;
case G_TYPE_BOOLEAN:
g_value_set_boolean (value, settings && entry->valid
@@ -635,6 +919,12 @@ set_decoration_layout_from_entry (GdkScreen *screen,
GSettings *settings = NULL;
const char *session;
if (screen_wayland->settings_portal)
{
g_value_set_string (value, entry->fallback.s);
return;
}
/* Hack: until we get session-dependent defaults in GSettings,
* swap out the usual schema for the "classic" one when
* running in classic mode
@@ -683,7 +973,8 @@ gdk_wayland_screen_get_setting (GdkScreen *screen,
g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE);
if (g_settings_schema_source_get_default () == NULL)
if (wayland_screen->settings != NULL &&
g_hash_table_size (wayland_screen->settings) == 0)
return FALSE;
entry = find_translation_entry_by_setting (name);
@@ -984,17 +1275,6 @@ _gdk_wayland_screen_new (GdkDisplay *display)
screen_wayland->width,
screen_wayland->height);
screen_wayland->dbus_cancellable = g_cancellable_new ();
g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION,
G_DBUS_PROXY_FLAGS_NONE,
NULL,
GTK_SETTINGS_DBUS_NAME,
GTK_SETTINGS_DBUS_PATH,
GTK_SETTINGS_DBUS_NAME,
screen_wayland->dbus_cancellable,
fontconfig_dbus_proxy_open_cb,
screen_wayland);
init_settings (screen);
return screen;
+3
View File
@@ -80,6 +80,9 @@ gboolean gdk_wayland_window_set_transient_for_exported (GdkWindo
GDK_AVAILABLE_IN_3_22
void gdk_wayland_window_announce_csd (GdkWindow *window);
GDK_AVAILABLE_IN_3_24
void gdk_wayland_window_announce_ssd (GdkWindow *window);
G_END_DECLS
#endif /* __GDK_WAYLAND_WINDOW_H__ */
+114 -19
View File
@@ -145,6 +145,7 @@ struct _GdkWindowImplWayland
unsigned int pending_buffer_attached : 1;
unsigned int pending_commit : 1;
unsigned int awaiting_frame : 1;
unsigned int using_csd : 1;
GdkWindowTypeHint hint;
GdkWindow *transient_for;
GdkWindow *popup_parent;
@@ -157,6 +158,9 @@ struct _GdkWindowImplWayland
int pending_buffer_offset_x;
int pending_buffer_offset_y;
int subsurface_x;
int subsurface_y;
gchar *title;
struct {
@@ -258,6 +262,7 @@ static void calculate_moved_to_rect_result (GdkWindow *window,
static gboolean gdk_wayland_window_is_exported (GdkWindow *window);
static void gdk_wayland_window_unexport (GdkWindow *window);
static void gdk_wayland_window_announce_decoration_mode (GdkWindow *window);
GType _gdk_window_impl_wayland_get_type (void);
@@ -388,6 +393,8 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
impl->scale = gdk_screen_get_monitor_scale_factor (screen, 0);
G_GNUC_END_IGNORE_DEPRECATIONS
impl->using_csd = TRUE;
/* logical 1x1 fake buffer */
impl->staging_cairo_surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
impl->scale,
@@ -691,6 +698,7 @@ _gdk_wayland_display_create_window_impl (GdkDisplay *display,
window->impl = GDK_WINDOW_IMPL (impl);
impl->wrapper = GDK_WINDOW (window);
impl->shortcuts_inhibitors = g_hash_table_new (NULL, NULL);
impl->using_csd = TRUE;
if (window->width > 65535)
{
@@ -924,6 +932,9 @@ gdk_window_impl_wayland_end_paint (GdkWindow *window)
cairo_rectangle_int_t rect;
int i, n;
if (!GDK_WINDOW_IS_MAPPED (window))
return;
if (impl->staging_cairo_surface &&
_gdk_wayland_is_shm_surface (impl->staging_cairo_surface) &&
!window->current_paint.use_gl &&
@@ -1415,6 +1426,22 @@ on_parent_surface_committed (GdkWindowImplWayland *parent_impl,
gdk_wayland_set_input_region_if_empty (window);
}
static void
gdk_wayland_window_set_subsurface_position (GdkWindow *window,
int x,
int y)
{
GdkWindowImplWayland *impl;
impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
wl_subsurface_set_position (impl->display_server.wl_subsurface, x, y);
impl->subsurface_x = x;
impl->subsurface_y = y;
gdk_window_request_transient_parent_commit (window);
}
static void
gdk_wayland_window_create_subsurface (GdkWindow *window)
{
@@ -1438,9 +1465,6 @@ gdk_wayland_window_create_subsurface (GdkWindow *window)
impl->display_server.wl_subsurface =
wl_subcompositor_get_subsurface (display_wayland->subcompositor,
impl->display_server.wl_surface, parent_impl->display_server.wl_surface);
wl_subsurface_set_position (impl->display_server.wl_subsurface,
window->x + window->abs_x,
window->y + window->abs_y);
/* In order to synchronize the initial position with the initial frame
* content, wait with making the subsurface desynchronized until after
@@ -1450,7 +1474,10 @@ gdk_wayland_window_create_subsurface (GdkWindow *window)
g_signal_connect_object (parent_impl, "committed",
G_CALLBACK (on_parent_surface_committed),
window, 0);
gdk_window_request_transient_parent_commit (window);
gdk_wayland_window_set_subsurface_position (window,
window->x + window->abs_x,
window->y + window->abs_y);
}
}
@@ -1872,6 +1899,8 @@ gdk_wayland_window_handle_configure_popup (GdkWindow *window,
&flipped_x,
&flipped_y);
impl->position_method = POSITION_METHOD_MOVE_TO_RECT;
g_signal_emit_by_name (window,
"moved-to-rect",
&flipped_rect,
@@ -2064,19 +2093,68 @@ window_anchor_to_gravity_legacy (GdkGravity rect_anchor)
}
}
void
gdk_wayland_window_announce_csd (GdkWindow *window)
static void
kwin_server_decoration_mode_set (void *data, struct org_kde_kwin_server_decoration *org_kde_kwin_server_decoration, uint32_t mode)
{
GdkWindow *window = GDK_WINDOW (data);
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
if ((mode == ORG_KDE_KWIN_SERVER_DECORATION_MODE_SERVER && impl->using_csd) ||
(mode == ORG_KDE_KWIN_SERVER_DECORATION_MODE_CLIENT && !impl->using_csd))
gdk_wayland_window_announce_decoration_mode (window);
}
static const struct org_kde_kwin_server_decoration_listener kwin_server_decoration_listener = {
kwin_server_decoration_mode_set
};
static void
gdk_wayland_window_announce_decoration_mode (GdkWindow *window)
{
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
if (!display_wayland->server_decoration_manager)
return;
impl->display_server.server_decoration =
org_kde_kwin_server_decoration_manager_create (display_wayland->server_decoration_manager,
impl->display_server.wl_surface);
if (!impl->display_server.server_decoration)
{
impl->display_server.server_decoration =
org_kde_kwin_server_decoration_manager_create (display_wayland->server_decoration_manager,
impl->display_server.wl_surface);
org_kde_kwin_server_decoration_add_listener (impl->display_server.server_decoration,
&kwin_server_decoration_listener,
window);
}
if (impl->display_server.server_decoration)
org_kde_kwin_server_decoration_request_mode (impl->display_server.server_decoration,
ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_CLIENT);
{
if (impl->using_csd)
org_kde_kwin_server_decoration_request_mode (impl->display_server.server_decoration,
ORG_KDE_KWIN_SERVER_DECORATION_MODE_CLIENT);
else
org_kde_kwin_server_decoration_request_mode (impl->display_server.server_decoration,
ORG_KDE_KWIN_SERVER_DECORATION_MODE_SERVER);
}
}
void
gdk_wayland_window_announce_csd (GdkWindow *window)
{
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
impl->using_csd = TRUE;
if (impl->mapped)
gdk_wayland_window_announce_decoration_mode (window);
}
void
gdk_wayland_window_announce_ssd (GdkWindow *window)
{
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
impl->using_csd = FALSE;
if (impl->mapped)
gdk_wayland_window_announce_decoration_mode (window);
}
static GdkWindow *
@@ -2752,6 +2830,9 @@ should_map_as_popup (GdkWindow *window)
break;
}
if (impl->position_method == POSITION_METHOD_MOVE_TO_RECT)
return TRUE;
return FALSE;
}
@@ -2906,11 +2987,13 @@ gdk_wayland_window_map (GdkWindow *window)
else
{
gdk_wayland_window_create_xdg_toplevel (window);
gdk_wayland_window_announce_decoration_mode (window);
}
}
else
{
gdk_wayland_window_create_xdg_toplevel (window);
gdk_wayland_window_announce_decoration_mode (window);
}
impl->mapped = TRUE;
@@ -3074,6 +3157,12 @@ gdk_wayland_window_hide_surface (GdkWindow *window)
impl->application.was_set = FALSE;
}
if (impl->display_server.server_decoration)
{
org_kde_kwin_server_decoration_release (impl->display_server.server_decoration);
impl->display_server.server_decoration = NULL;
}
wl_surface_destroy (impl->display_server.wl_surface);
impl->display_server.wl_surface = NULL;
@@ -3198,12 +3287,13 @@ gdk_window_wayland_move_resize (GdkWindow *window,
window->y = y;
impl->position_method = POSITION_METHOD_MOVE_RESIZE;
if (impl->display_server.wl_subsurface)
if (impl->display_server.wl_subsurface &&
(x + window->abs_x != impl->subsurface_x ||
y + window->abs_y != impl->subsurface_y))
{
wl_subsurface_set_position (impl->display_server.wl_subsurface,
window->x + window->abs_x,
window->y + window->abs_y);
gdk_window_request_transient_parent_commit (window);
gdk_wayland_window_set_subsurface_position (window,
x + window->abs_x,
y + window->abs_y);
}
}
}
@@ -3737,6 +3827,7 @@ gdk_wayland_window_set_transient_for (GdkWindow *window,
GdkWaylandDisplay *display_wayland =
GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
GdkWindow *previous_parent;
gboolean was_subsurface = FALSE;
g_assert (parent == NULL ||
gdk_window_get_display (window) == gdk_window_get_display (parent));
@@ -3750,7 +3841,10 @@ gdk_wayland_window_set_transient_for (GdkWindow *window,
unset_transient_for_exported (window);
if (impl->display_server.wl_subsurface)
unmap_subsurface (window);
{
was_subsurface = TRUE;
unmap_subsurface (window);
}
previous_parent = impl->transient_for;
impl->transient_for = parent;
@@ -3763,9 +3857,10 @@ gdk_wayland_window_set_transient_for (GdkWindow *window,
display_wayland->orphan_dialogs =
g_list_remove (display_wayland->orphan_dialogs, window);
}
gdk_wayland_window_sync_parent (window, NULL);
if (should_map_as_subsurface (window) &&
parent && gdk_window_is_visible (window))
if (was_subsurface && parent)
gdk_wayland_window_create_subsurface (window);
}
+4
View File
@@ -17,6 +17,10 @@ AM_CPPFLAGS = \
$(GDK_WIN32_EXTRA_CFLAGS) \
-DGDK_COMPILATION
if WIN32_GLES
AM_CPPFLAGS += "-DGDK_WIN32_ENABLE_EGL=1"
endif #WIN32_GLES
LDADDS = $(GDK_DEP_LIBS)
noinst_LTLIBRARIES = libgdk-win32.la
+12
View File
@@ -31,6 +31,10 @@
#include "gdkmonitor-win32.h"
#include "gdkwin32.h"
#ifdef GDK_WIN32_ENABLE_EGL
# include <epoxy/egl.h>
#endif
static int debug_indent = 0;
static GdkMonitor *
@@ -825,6 +829,14 @@ gdk_win32_display_dispose (GObject *object)
_gdk_screen_close (display_win32->screen);
#ifdef GDK_WIN32_ENABLE_EGL
if (display_win32->egl_disp != EGL_NO_DISPLAY)
{
eglTerminate (display_win32->egl_disp);
display_win32->egl_disp = EGL_NO_DISPLAY;
}
#endif
if (display_win32->hwnd != NULL)
{
DestroyWindow (display_win32->hwnd);
+18
View File
@@ -19,6 +19,10 @@
#include "gdkdisplayprivate.h"
#ifdef GDK_WIN32_ENABLE_EGL
# include <epoxy/egl.h>
#endif
#ifndef __GDK_DISPLAY__WIN32_H__
#define __GDK_DISPLAY__WIN32_H__
@@ -75,6 +79,14 @@ struct _GdkWin32Display
guint gl_version;
HWND gl_hwnd;
#ifdef GDK_WIN32_ENABLE_EGL
/* EGL (Angle) Items */
guint have_egl : 1;
guint egl_version;
EGLDisplay egl_disp;
HDC hdc_egl_temp;
#endif
GPtrArray *monitors;
guint hasWglARBCreateContext : 1;
@@ -83,6 +95,12 @@ struct _GdkWin32Display
guint hasWglARBPixelFormat : 1;
guint hasWglARBmultisample : 1;
#ifdef GDK_WIN32_ENABLE_EGL
guint hasEglKHRCreateContext : 1;
guint hasEglSurfacelessContext : 1;
EGLint egl_min_swap_interval;
#endif
/* HiDPI Items */
guint have_at_least_win81 : 1;
GdkWin32ProcessDpiAwareness dpi_aware_type;
+54 -7
View File
@@ -51,6 +51,7 @@
#include "gdkmonitorprivate.h"
#include "gdkwin32.h"
#include "gdkkeysyms.h"
#include "gdkglcontext-win32.h"
#include "gdkdevicemanager-win32.h"
#include "gdkdeviceprivate.h"
#include "gdkdevice-wintab.h"
@@ -1929,7 +1930,7 @@ ensure_stacking_on_unminimize (MSG *msg)
g_print (" restacking %p above %p",
msg->hwnd, lowest_transient));
SetWindowPos (msg->hwnd, lowest_transient, 0, 0, 0, 0,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOOWNERZORDER);
}
}
@@ -2010,7 +2011,7 @@ ensure_stacking_on_activate_app (MSG *msg,
impl->transient_owner != NULL)
{
SetWindowPos (msg->hwnd, HWND_TOP, 0, 0, 0, 0,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOOWNERZORDER);
return;
}
@@ -2052,7 +2053,7 @@ ensure_stacking_on_activate_app (MSG *msg,
g_print (" restacking %p above %p",
msg->hwnd, rover));
SetWindowPos (msg->hwnd, rover, 0, 0, 0, 0,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOOWNERZORDER);
break;
}
}
@@ -2241,6 +2242,25 @@ _gdk_win32_window_fill_min_max_info (GdkWindow *window,
return TRUE;
}
static void
gdk_settings_notify (GdkWindow *window,
const char *name,
GdkSettingAction action)
{
GdkEvent *new_event;
if (!g_str_has_prefix (name, "gtk-"))
return;
new_event = gdk_event_new (GDK_SETTING);
new_event->setting.window = window;
new_event->setting.send_event = FALSE;
new_event->setting.action = action;
new_event->setting.name = g_strdup (name);
_gdk_win32_append_event (new_event);
}
#define GDK_ANY_BUTTON_MASK (GDK_BUTTON1_MASK | \
GDK_BUTTON2_MASK | \
GDK_BUTTON3_MASK | \
@@ -2455,6 +2475,7 @@ gdk_event_translate (MSG *msg,
(gulong) msg->wParam,
(gpointer) msg->lParam, _gdk_input_locale_is_ime ? " (IME)" : "",
_gdk_input_codepage));
gdk_settings_notify (window, "gtk-im-module", GDK_SETTING_ACTION_CHANGED);
break;
case WM_SYSKEYUP:
@@ -3070,13 +3091,20 @@ gdk_event_translate (MSG *msg,
event = gdk_event_new (GDK_SCROLL);
event->scroll.window = window;
event->scroll.direction = GDK_SCROLL_SMOOTH;
if (msg->message == WM_MOUSEWHEEL)
event->scroll.direction = (((short) HIWORD (msg->wParam)) > 0) ?
GDK_SCROLL_UP : GDK_SCROLL_DOWN;
{
event->scroll.delta_y = (gdouble) GET_WHEEL_DELTA_WPARAM (msg->wParam) / (gdouble) WHEEL_DELTA;
}
else if (msg->message == WM_MOUSEHWHEEL)
event->scroll.direction = (((short) HIWORD (msg->wParam)) > 0) ?
GDK_SCROLL_RIGHT : GDK_SCROLL_LEFT;
{
event->scroll.delta_x = (gdouble) GET_WHEEL_DELTA_WPARAM (msg->wParam) / (gdouble) WHEEL_DELTA;
}
/* Positive delta scrolls up, not down,
see API documentation for WM_MOUSEWHEEL message.
*/
event->scroll.delta_y *= -1.0;
event->scroll.time = _gdk_win32_get_next_tick (msg->time);
event->scroll.x = (gint16) point.x / impl->window_scale;
event->scroll.y = (gint16) point.y / impl->window_scale;
@@ -3086,6 +3114,20 @@ gdk_event_translate (MSG *msg,
gdk_event_set_device (event, device_manager_win32->core_pointer);
gdk_event_set_source_device (event, device_manager_win32->system_pointer);
gdk_event_set_seat (event, gdk_device_get_seat (device_manager_win32->core_pointer));
gdk_event_set_pointer_emulated (event, FALSE);
_gdk_win32_append_event (gdk_event_copy (event));
/* Append the discrete version too */
if (msg->message == WM_MOUSEWHEEL)
event->scroll.direction = (((short) HIWORD (msg->wParam)) > 0) ?
GDK_SCROLL_UP : GDK_SCROLL_DOWN;
else if (msg->message == WM_MOUSEHWHEEL)
event->scroll.direction = (((short) HIWORD (msg->wParam)) > 0) ?
GDK_SCROLL_RIGHT : GDK_SCROLL_LEFT;
event->scroll.delta_x = 0;
event->scroll.delta_y = 0;
gdk_event_set_pointer_emulated (event, TRUE);
_gdk_win32_append_event (event);
@@ -3248,6 +3290,9 @@ gdk_event_translate (MSG *msg,
case SC_MINIMIZE:
case SC_RESTORE:
do_show_window (window, msg->wParam == SC_MINIMIZE ? TRUE : FALSE);
if (msg->wParam == SC_RESTORE)
_gdk_win32_window_invalidate_egl_framebuffer (window);
break;
case SC_MAXIMIZE:
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
@@ -3337,6 +3382,8 @@ gdk_event_translate (MSG *msg,
{
MINMAXINFO our_mmi;
_gdk_win32_window_invalidate_egl_framebuffer (window);
if (_gdk_win32_window_fill_min_max_info (window, &our_mmi))
{
windowpos = (WINDOWPOS *) msg->lParam;
+594 -142
View File
@@ -41,6 +41,10 @@
#include <cairo.h>
#include <epoxy/wgl.h>
#ifdef GDK_WIN32_ENABLE_EGL
# include <epoxy/egl.h>
#endif
G_DEFINE_TYPE (GdkWin32GLContext, gdk_win32_gl_context, GDK_TYPE_GL_CONTEXT)
static void
@@ -50,6 +54,7 @@ _gdk_win32_gl_context_dispose (GObject *gobject)
GdkWin32GLContext *context_win32 = GDK_WIN32_GL_CONTEXT (gobject);
GdkWin32Display *display_win32 = GDK_WIN32_DISPLAY (gdk_gl_context_get_display (context));
GdkWindow *window = gdk_gl_context_get_window (context);
GdkWindowImplWin32 *impl = NULL;
if (context_win32->hglrc != NULL)
{
@@ -64,9 +69,28 @@ _gdk_win32_gl_context_dispose (GObject *gobject)
ReleaseDC (display_win32->gl_hwnd, context_win32->gl_hdc);
}
#ifdef GDK_WIN32_ENABLE_EGL
if (context_win32->egl_context != EGL_NO_CONTEXT)
{
if (eglGetCurrentContext () == context_win32->egl_context)
eglMakeCurrent(display_win32->egl_disp, EGL_NO_SURFACE, EGL_NO_SURFACE,
EGL_NO_CONTEXT);
GDK_NOTE (OPENGL, g_message ("Destroying EGL (ANGLE) context"));
eglDestroyContext (display_win32->egl_disp,
context_win32->egl_context);
context_win32->egl_context = EGL_NO_CONTEXT;
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
ReleaseDC (display_win32->gl_hwnd, context_win32->gl_hdc);
}
#endif
if (window != NULL && window->impl != NULL)
{
GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
if (impl->suppress_layered > 0)
impl->suppress_layered--;
@@ -117,6 +141,35 @@ gdk_gl_blit_region (GdkWindow *window, cairo_region_t *region)
}
}
static gboolean
_get_is_egl_force_redraw (GdkWindow *window)
{
/* We only need to call gdk_window_invalidate_rect () if necessary */
#ifdef GDK_WIN32_ENABLE_EGL
if (window->gl_paint_context != NULL && gdk_gl_context_get_use_es (window->gl_paint_context))
{
GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
return impl->egl_force_redraw_all;
}
#endif
return FALSE;
}
static void
_reset_egl_force_redraw (GdkWindow *window)
{
#ifdef GDK_WIN32_ENABLE_EGL
if (window->gl_paint_context != NULL && gdk_gl_context_get_use_es (window->gl_paint_context))
{
GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
if (impl->egl_force_redraw_all)
impl->egl_force_redraw_all = FALSE;
}
#endif
}
void
_gdk_win32_gl_context_end_frame (GdkGLContext *context,
cairo_region_t *painted,
@@ -126,11 +179,12 @@ _gdk_win32_gl_context_end_frame (GdkGLContext *context,
GdkWindow *window = gdk_gl_context_get_window (context);
GdkWin32Display *display = (GDK_WIN32_DISPLAY (gdk_gl_context_get_display (context)));
gboolean can_wait = display->hasWglOMLSyncControl;
gdk_gl_context_make_current (context);
if (context_win32->do_frame_sync)
if (!gdk_gl_context_get_use_es (context))
{
gboolean can_wait = display->hasWglOMLSyncControl;
if (context_win32->do_frame_sync)
{
glFinish ();
@@ -147,21 +201,44 @@ _gdk_win32_gl_context_end_frame (GdkGLContext *context,
&ust, &msc, &sbc);
}
}
if (context_win32->do_blit_swap)
{
glDrawBuffer(GL_FRONT);
glReadBuffer(GL_BACK);
gdk_gl_blit_region (window, painted);
glDrawBuffer(GL_BACK);
glFlush();
if (gdk_gl_context_has_frame_terminator (context))
glFrameTerminatorGREMEDY ();
}
else
SwapBuffers (context_win32->gl_hdc);
}
if (context_win32->do_blit_swap)
{
glDrawBuffer(GL_FRONT);
glReadBuffer(GL_BACK);
gdk_gl_blit_region (window, painted);
glDrawBuffer(GL_BACK);
glFlush();
if (gdk_gl_context_has_frame_terminator (context))
glFrameTerminatorGREMEDY ();
}
#ifdef GDK_WIN32_ENABLE_EGL
else
SwapBuffers (context_win32->gl_hdc);
{
EGLSurface egl_surface = _gdk_win32_window_get_egl_surface (window, context_win32->egl_config, FALSE);
gboolean force_egl_redraw_all = _get_is_egl_force_redraw (window);
if (context_win32->do_blit_swap && !force_egl_redraw_all)
gdk_gl_blit_region (window, painted);
else if (force_egl_redraw_all)
{
GdkRectangle rect = {0, 0, gdk_window_get_width (window), gdk_window_get_height (window)};
/* We need to do gdk_window_invalidate_rect() so that we don't get glitches after maximizing or
* restoring or using aerosnap
*/
gdk_window_invalidate_rect (window, &rect, TRUE);
_reset_egl_force_redraw (window);
}
eglSwapBuffers (display->egl_disp, egl_surface);
}
#endif
}
void
@@ -453,64 +530,152 @@ _gdk_init_dummy_context (GdkWGLDummy *dummy,
return best_idx;
}
#ifdef GDK_WIN32_ENABLE_EGL
#ifndef EGL_PLATFORM_ANGLE_ANGLE
#define EGL_PLATFORM_ANGLE_ANGLE 0x3202
#endif
#ifndef EGL_PLATFORM_ANGLE_TYPE_ANGLE
#define EGL_PLATFORM_ANGLE_TYPE_ANGLE 0x3203
#endif
#ifndef EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE
#define EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE 0x3208
#endif
static EGLDisplay
_gdk_win32_get_egl_display (GdkWin32Display *display)
{
EGLDisplay disp;
gboolean success = FALSE;
if (epoxy_has_egl_extension (NULL, "EGL_EXT_platform_base"))
{
PFNEGLGETPLATFORMDISPLAYEXTPROC getPlatformDisplay = (void *) eglGetProcAddress ("eglGetPlatformDisplayEXT");
if (getPlatformDisplay)
{
EGLint disp_attr[] = {EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, EGL_NONE};
disp = getPlatformDisplay (EGL_PLATFORM_ANGLE_ANGLE, display->hdc_egl_temp, disp_attr);
if (disp != EGL_NO_DISPLAY)
return disp;
}
}
return eglGetDisplay (display->hdc_egl_temp);
}
#endif
static gboolean
_gdk_win32_display_init_gl (GdkDisplay *display,
const gboolean need_alpha_bits)
{
GdkWin32Display *display_win32 = GDK_WIN32_DISPLAY (display);
gint best_idx = 0;
GdkWGLDummy dummy;
gboolean disable_wgl = FALSE;
if (display_win32->have_wgl)
#ifdef GDK_WIN32_ENABLE_EGL
EGLDisplay egl_disp;
disable_wgl = (_gdk_gl_flags & GDK_GL_GLES) != 0;
#endif
if (display_win32->have_wgl
#ifdef GDK_WIN32_ENABLE_EGL
|| display_win32->have_egl
#endif
)
return TRUE;
memset (&dummy, 0, sizeof (GdkWGLDummy));
if (!disable_wgl)
{
/* acquire and cache dummy Window (HWND & HDC) and
* dummy GL Context, it is used to query functions
* and used for other stuff as well
*/
GdkWGLDummy dummy;
memset (&dummy, 0, sizeof (GdkWGLDummy));
/* acquire and cache dummy Window (HWND & HDC) and
* dummy GL Context, it is used to query functions
* and used for other stuff as well
*/
best_idx = _gdk_init_dummy_context (&dummy, need_alpha_bits);
best_idx = _gdk_init_dummy_context (&dummy, need_alpha_bits);
if (best_idx == 0 || !wglMakeCurrent (dummy.hdc, dummy.hglrc))
return FALSE;
if (best_idx == 0 || !wglMakeCurrent (dummy.hdc, dummy.hglrc))
return FALSE;
display_win32->have_wgl = TRUE;
display_win32->gl_version = epoxy_gl_version ();
display_win32->have_wgl = TRUE;
display_win32->gl_version = epoxy_gl_version ();
display_win32->hasWglARBCreateContext =
epoxy_has_wgl_extension (dummy.hdc, "WGL_ARB_create_context");
display_win32->hasWglEXTSwapControl =
epoxy_has_wgl_extension (dummy.hdc, "WGL_EXT_swap_control");
display_win32->hasWglOMLSyncControl =
epoxy_has_wgl_extension (dummy.hdc, "WGL_OML_sync_control");
display_win32->hasWglARBPixelFormat =
epoxy_has_wgl_extension (dummy.hdc, "WGL_ARB_pixel_format");
display_win32->hasWglARBmultisample =
epoxy_has_wgl_extension (dummy.hdc, "WGL_ARB_multisample");
GDK_NOTE (OPENGL,
g_print ("WGL API version %d.%d found\n"
" - Vendor: %s\n"
" - Checked extensions:\n"
"\t* WGL_ARB_pixel_format: %s\n"
"\t* WGL_ARB_create_context: %s\n"
"\t* WGL_EXT_swap_control: %s\n"
"\t* WGL_OML_sync_control: %s\n"
"\t* WGL_ARB_multisample: %s\n",
display_win32->gl_version / 10,
display_win32->gl_version % 10,
glGetString (GL_VENDOR),
display_win32->hasWglARBPixelFormat ? "yes" : "no",
display_win32->hasWglARBCreateContext ? "yes" : "no",
display_win32->hasWglEXTSwapControl ? "yes" : "no",
display_win32->hasWglOMLSyncControl ? "yes" : "no",
display_win32->hasWglARBmultisample ? "yes" : "no"));
wglMakeCurrent (NULL, NULL);
_destroy_dummy_gl_context (dummy);
return TRUE;
}
#ifdef GDK_WIN32_ENABLE_EGL
egl_disp = _gdk_win32_get_egl_display (display_win32);
if (egl_disp == EGL_NO_DISPLAY ||
!eglInitialize (egl_disp, NULL, NULL))
{
if (egl_disp != EGL_NO_DISPLAY)
{
eglTerminate (egl_disp);
egl_disp = EGL_NO_DISPLAY;
}
return FALSE;
}
display_win32->egl_disp = egl_disp;
display_win32->have_egl = TRUE;
display_win32->egl_version = epoxy_egl_version (egl_disp);
eglBindAPI(EGL_OPENGL_ES_API);
display_win32->hasEglSurfacelessContext =
epoxy_has_egl_extension (egl_disp, "EGL_KHR_surfaceless_context");
display_win32->hasWglARBCreateContext =
epoxy_has_wgl_extension (dummy.hdc, "WGL_ARB_create_context");
display_win32->hasWglEXTSwapControl =
epoxy_has_wgl_extension (dummy.hdc, "WGL_EXT_swap_control");
display_win32->hasWglOMLSyncControl =
epoxy_has_wgl_extension (dummy.hdc, "WGL_OML_sync_control");
display_win32->hasWglARBPixelFormat =
epoxy_has_wgl_extension (dummy.hdc, "WGL_ARB_pixel_format");
display_win32->hasWglARBmultisample =
epoxy_has_wgl_extension (dummy.hdc, "WGL_ARB_multisample");
GDK_NOTE (OPENGL,
g_print ("WGL API version %d.%d found\n"
g_print ("EGL API version %d.%d found\n"
" - Vendor: %s\n"
" - Checked extensions:\n"
"\t* WGL_ARB_pixel_format: %s\n"
"\t* WGL_ARB_create_context: %s\n"
"\t* WGL_EXT_swap_control: %s\n"
"\t* WGL_OML_sync_control: %s\n"
"\t* WGL_ARB_multisample: %s\n",
display_win32->gl_version / 10,
display_win32->gl_version % 10,
glGetString (GL_VENDOR),
display_win32->hasWglARBPixelFormat ? "yes" : "no",
display_win32->hasWglARBCreateContext ? "yes" : "no",
display_win32->hasWglEXTSwapControl ? "yes" : "no",
display_win32->hasWglOMLSyncControl ? "yes" : "no",
display_win32->hasWglARBmultisample ? "yes" : "no"));
wglMakeCurrent (NULL, NULL);
_destroy_dummy_gl_context (dummy);
"\t* EGL_KHR_surfaceless_context: %s\n",
display_win32->egl_version / 10,
display_win32->egl_version % 10,
eglQueryString (display_win32->egl_disp, EGL_VENDOR),
display_win32->hasEglSurfacelessContext ? "yes" : "no"));
return TRUE;
#endif
}
/* Setup the legacy context after creating it */
@@ -688,6 +853,132 @@ _set_pixformat_for_hdc (HDC hdc,
return TRUE;
}
#ifdef GDK_WIN32_ENABLE_EGL
#define MAX_EGL_ATTRS 30
static gboolean
find_eglconfig_for_window (GdkWin32Display *display,
EGLConfig *egl_config_out,
EGLint *min_swap_interval_out,
gboolean need_alpha_bits,
GError **error)
{
EGLint attrs[MAX_EGL_ATTRS];
EGLint count;
EGLConfig *configs, chosen_config;
int i = 0;
EGLDisplay egl_disp = display->egl_disp;
attrs[i++] = EGL_CONFORMANT;
attrs[i++] = EGL_OPENGL_ES2_BIT;
attrs[i++] = EGL_SURFACE_TYPE;
attrs[i++] = EGL_WINDOW_BIT;
attrs[i++] = EGL_COLOR_BUFFER_TYPE;
attrs[i++] = EGL_RGB_BUFFER;
attrs[i++] = EGL_RED_SIZE;
attrs[i++] = 1;
attrs[i++] = EGL_GREEN_SIZE;
attrs[i++] = 1;
attrs[i++] = EGL_BLUE_SIZE;
attrs[i++] = 1;
if (need_alpha_bits)
{
attrs[i++] = EGL_ALPHA_SIZE;
attrs[i++] = 1;
}
else
{
attrs[i++] = EGL_ALPHA_SIZE;
attrs[i++] = EGL_DONT_CARE;
}
attrs[i++] = EGL_NONE;
g_assert (i < MAX_EGL_ATTRS);
if (!eglChooseConfig (display->egl_disp, attrs, NULL, 0, &count) || count < 1)
{
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_UNSUPPORTED_FORMAT,
_("No available configurations for the given pixel format"));
return FALSE;
}
configs = g_new (EGLConfig, count);
if (!eglChooseConfig (display->egl_disp, attrs, configs, count, &count) || count < 1)
{
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_UNSUPPORTED_FORMAT,
_("No available configurations for the given pixel format"));
return FALSE;
}
/* Pick first valid configuration i guess? */
chosen_config = configs[0];
if (!eglGetConfigAttrib (display->egl_disp, chosen_config,
EGL_MIN_SWAP_INTERVAL, min_swap_interval_out))
{
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_NOT_AVAILABLE,
"Could not retrieve the minimum swap interval");
g_free (configs);
return FALSE;
}
if (egl_config_out != NULL)
*egl_config_out = chosen_config;
g_free (configs);
return TRUE;
}
#define N_EGL_ATTRS 16
static EGLContext
_create_egl_context (EGLDisplay display,
EGLConfig config,
GdkGLContext *share,
int flags,
int major,
int minor,
gboolean *is_legacy)
{
EGLContext ctx;
EGLint context_attribs[N_EGL_ATTRS];
int i = 0;
/* ANGLE does not support the GL_OES_vertex_array_object extension, so we need to use ES3 directly */
context_attribs[i++] = EGL_CONTEXT_CLIENT_VERSION;
context_attribs[i++] = 3;
/* Specify the flags */
context_attribs[i++] = EGL_CONTEXT_FLAGS_KHR;
context_attribs[i++] = flags;
context_attribs[i++] = EGL_NONE;
g_assert (i < N_EGL_ATTRS);
ctx = eglCreateContext (display,
config,
share != NULL ? GDK_WIN32_GL_CONTEXT (share)->egl_context
: EGL_NO_CONTEXT,
context_attribs);
if (ctx != EGL_NO_CONTEXT)
GDK_NOTE (OPENGL, g_message ("Created EGL context[%p]", ctx));
return ctx;
}
#endif /* GDK_WIN32_ENABLE_EGL */
gboolean
_gdk_win32_gl_context_realize (GdkGLContext *context,
GError **error)
@@ -695,83 +986,143 @@ _gdk_win32_gl_context_realize (GdkGLContext *context,
GdkGLContext *share = gdk_gl_context_get_shared_context (context);
GdkWin32GLContext *context_win32 = GDK_WIN32_GL_CONTEXT (context);
/* These are the real WGL/EGL context items that we will want to use later */
gboolean debug_bit, compat_bit, legacy_bit;
/* These are the real WGL context items that we will want to use later */
HGLRC hglrc;
gint pixel_format;
gboolean debug_bit, compat_bit, legacy_bit;
gboolean use_es = FALSE;
/* request flags and specific versions for core (3.2+) WGL context */
gint flags = 0;
gint glver_major = 0;
gint glver_minor = 0;
gint major = 0;
gint minor = 0;
#ifdef GDK_WIN32_ENABLE_EGL
EGLContext egl_context;
#endif
GdkWindow *window = gdk_gl_context_get_window (context);
GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
GdkWin32Display *win32_display = GDK_WIN32_DISPLAY (gdk_window_get_display (window));
if (!_set_pixformat_for_hdc (context_win32->gl_hdc,
&pixel_format,
context_win32->need_alpha_bits,
win32_display))
{
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_UNSUPPORTED_FORMAT,
_("No available configurations for the given pixel format"));
return FALSE;
}
gdk_gl_context_get_required_version (context, &glver_major, &glver_minor);
debug_bit = gdk_gl_context_get_debug_enabled (context);
compat_bit = gdk_gl_context_get_forward_compatible (context);
/* if there isn't wglCreateContextAttribsARB(), or if GDK_GL_LEGACY is set, we default to a legacy context */
legacy_bit = !win32_display->hasWglARBCreateContext ||
g_getenv ("GDK_GL_LEGACY") != NULL;
/*
* A legacy context cannot be shared with core profile ones, so this means we
* must stick to a legacy context if the shared context is a legacy context
*/
if (share != NULL && gdk_gl_context_is_legacy (share))
if ((_gdk_gl_flags & GDK_GL_LEGACY) != 0 ||
share != NULL && gdk_gl_context_is_legacy (share))
legacy_bit = TRUE;
if (debug_bit)
flags |= WGL_CONTEXT_DEBUG_BIT_ARB;
if (compat_bit)
flags |= WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
if ((_gdk_gl_flags & GDK_GL_GLES) != 0 ||
(share != NULL && gdk_gl_context_get_use_es (share)))
use_es = TRUE;
GDK_NOTE (OPENGL,
g_print ("Creating %s WGL context (version:%d.%d, debug:%s, forward:%s, legacy: %s)\n",
compat_bit ? "core" : "compat",
glver_major,
glver_minor,
debug_bit ? "yes" : "no",
compat_bit ? "yes" : "no",
legacy_bit ? "yes" : "no"));
gdk_gl_context_get_required_version (context, &major, &minor);
debug_bit = gdk_gl_context_get_debug_enabled (context);
compat_bit = gdk_gl_context_get_forward_compatible (context);
hglrc = _create_gl_context (context_win32->gl_hdc,
share,
flags,
glver_major,
glver_minor,
&legacy_bit,
win32_display->hasWglARBCreateContext);
if (hglrc == NULL)
if (win32_display->have_wgl)
{
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_NOT_AVAILABLE,
_("Unable to create a GL context"));
return FALSE;
if (!_set_pixformat_for_hdc (context_win32->gl_hdc,
&pixel_format,
context_win32->need_alpha_bits,
win32_display))
{
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_UNSUPPORTED_FORMAT,
_("No available configurations for the given pixel format"));
return FALSE;
}
/* if there isn't wglCreateContextAttribsARB(), or if GDK_GL_LEGACY is set, we default to a legacy context */
legacy_bit = !win32_display->hasWglARBCreateContext ||
g_getenv ("GDK_GL_LEGACY") != NULL;
if (debug_bit)
flags |= WGL_CONTEXT_DEBUG_BIT_ARB;
if (compat_bit)
flags |= WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
GDK_NOTE (OPENGL,
g_print ("Creating %s WGL context (version:%d.%d, debug:%s, forward:%s, legacy: %s)\n",
compat_bit ? "core" : "compat",
major,
minor,
debug_bit ? "yes" : "no",
compat_bit ? "yes" : "no",
legacy_bit ? "yes" : "no"));
hglrc = _create_gl_context (context_win32->gl_hdc,
share,
flags,
major,
minor,
&legacy_bit,
win32_display->hasWglARBCreateContext);
if (hglrc == NULL)
{
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_NOT_AVAILABLE,
_("Unable to create a GL context"));
return FALSE;
}
GDK_NOTE (OPENGL,
g_print ("Created WGL context[%p], pixel_format=%d\n",
hglrc,
pixel_format));
context_win32->hglrc = hglrc;
}
GDK_NOTE (OPENGL,
g_print ("Created WGL context[%p], pixel_format=%d\n",
hglrc,
pixel_format));
#ifdef GDK_WIN32_ENABLE_EGL
if (win32_display->have_egl)
{
EGLContext ctx;
context_win32->hglrc = hglrc;
if (debug_bit)
flags |= EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR;
if (compat_bit)
flags |= EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR;
GDK_NOTE (OPENGL, g_message ("Creating EGL context version %d.%d (debug:%s, forward:%s, legacy:%s)",
major, minor,
debug_bit ? "yes" : "no",
compat_bit ? "yes" : "no",
legacy_bit ? "yes" : "no"));
ctx = _create_egl_context (win32_display->egl_disp,
context_win32->egl_config,
share,
flags,
major,
minor,
&legacy_bit);
if (ctx == EGL_NO_CONTEXT)
{
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_NOT_AVAILABLE,
_("Unable to create a GL context"));
return FALSE;
}
GDK_NOTE (OPENGL,
g_print ("Created EGL context[%p]\n",
ctx));
context_win32->egl_context = ctx;
use_es = TRUE;
}
#endif
/* set whether we are using GLES */
gdk_gl_context_set_use_es(context, use_es);
/* OpenGL does not work with WS_EX_LAYERED enabled, so we need to
* disable WS_EX_LAYERED when we acquire a valid HGLRC
@@ -804,9 +1155,21 @@ _gdk_win32_window_create_gl_context (GdkWindow *window,
gboolean need_alpha_bits = (visual == gdk_screen_get_rgba_visual (gdk_display_get_default_screen (display)));
/* Acquire and store up the Windows-specific HWND and HDC */
HWND hwnd;
HDC hdc;
#ifdef GDK_WIN32_ENABLE_EGL
EGLContext egl_context;
EGLConfig config;
#endif
display_win32->gl_hwnd = GDK_WINDOW_HWND (window);
hdc = GetDC (display_win32->gl_hwnd);
#ifdef GDK_WIN32_ENABLE_EGL
/* display_win32->hdc_egl_temp should *not* be destroyed here! It is destroyed at dispose()! */
display_win32->hdc_egl_temp = hdc;
#endif
if (!_gdk_win32_display_init_gl (display, need_alpha_bits))
{
g_set_error_literal (error, GDK_GL_ERROR,
@@ -815,10 +1178,12 @@ _gdk_win32_window_create_gl_context (GdkWindow *window,
return NULL;
}
hwnd = GDK_WINDOW_HWND (window);
hdc = GetDC (hwnd);
display_win32->gl_hwnd = hwnd;
#ifdef GDK_WIN32_ENABLE_EGL
if (display_win32->have_egl && !find_eglconfig_for_window (display_win32, &config,
&display_win32->egl_min_swap_interval, need_alpha_bits,
error))
return NULL;
#endif
context = g_object_new (GDK_TYPE_WIN32_GL_CONTEXT,
"display", display,
@@ -828,6 +1193,12 @@ _gdk_win32_window_create_gl_context (GdkWindow *window,
context->need_alpha_bits = need_alpha_bits;
context->gl_hdc = hdc;
#ifdef GDK_WIN32_ENABLE_EGL
if (display_win32->have_egl)
context->egl_config = config;
#endif
context->is_attached = attached;
return GDK_GL_CONTEXT (context);
@@ -842,45 +1213,89 @@ _gdk_win32_display_make_gl_context_current (GdkDisplay *display,
GdkWindow *window;
GdkScreen *screen;
#if GDK_WIN32_ENABLE_EGL
EGLSurface egl_surface;
#endif
gboolean do_frame_sync = FALSE;
if (context == NULL)
{
wglMakeCurrent(NULL, NULL);
if (display_win32->have_wgl)
wglMakeCurrent(NULL, NULL);
#ifdef GDK_WIN32_ENABLE_EGL
else if (display_win32->have_egl)
eglMakeCurrent (display_win32->egl_disp, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
#endif
return TRUE;
}
context_win32 = GDK_WIN32_GL_CONTEXT (context);
window = gdk_gl_context_get_window (context);
if (!wglMakeCurrent (context_win32->gl_hdc, context_win32->hglrc))
if (!gdk_gl_context_get_use_es (context))
{
GDK_NOTE (OPENGL,
g_print ("Making WGL context current failed\n"));
return FALSE;
}
if (context_win32->is_attached && display_win32->hasWglEXTSwapControl)
{
window = gdk_gl_context_get_window (context);
/* If there is compositing there is no particular need to delay
* the swap when drawing on the offscreen, rendering to the screen
* happens later anyway, and its up to the compositor to sync that
* to the vblank. */
screen = gdk_window_get_screen (window);
do_frame_sync = ! gdk_screen_is_composited (screen);
if (do_frame_sync != context_win32->do_frame_sync)
if (!wglMakeCurrent (context_win32->gl_hdc, context_win32->hglrc))
{
context_win32->do_frame_sync = do_frame_sync;
GDK_NOTE (OPENGL,
g_print ("Making WGL context current failed\n"));
return FALSE;
}
if (do_frame_sync)
wglSwapIntervalEXT (1);
else
wglSwapIntervalEXT (0);
if (context_win32->is_attached)
{
if (display_win32->hasWglEXTSwapControl)
{
/* If there is compositing there is no particular need to delay
* the swap when drawing on the offscreen, rendering to the screen
* happens later anyway, and its up to the compositor to sync that
* to the vblank. */
screen = gdk_window_get_screen (window);
do_frame_sync = ! gdk_screen_is_composited (screen);
if (do_frame_sync != context_win32->do_frame_sync)
{
context_win32->do_frame_sync = do_frame_sync;
if (do_frame_sync)
wglSwapIntervalEXT (1);
else
wglSwapIntervalEXT (0);
}
}
}
}
#ifdef GDK_WIN32_ENABLE_EGL
else
{
if (context_win32->is_attached)
egl_surface = _gdk_win32_window_get_egl_surface (window, context_win32->egl_config, FALSE);
else
{
if (display_win32->hasEglSurfacelessContext)
egl_surface = EGL_NO_SURFACE;
else
egl_surface = _gdk_win32_window_get_egl_surface (window, context_win32->egl_config, TRUE);
}
if (!eglMakeCurrent (display_win32->egl_disp,
egl_surface,
egl_surface,
context_win32->egl_context))
{
g_warning ("eglMakeCurrent failed");
return FALSE;
}
if (display_win32->egl_min_swap_interval == 0)
eglSwapInterval (display_win32->egl_disp, 0);
else
g_debug ("Can't disable GL swap interval");
}
#endif
return TRUE;
}
@@ -901,18 +1316,55 @@ gdk_win32_display_get_wgl_version (GdkDisplay *display,
gint *major,
gint *minor)
{
GdkWin32Display *display_win32 = NULL;
g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
if (!GDK_IS_WIN32_DISPLAY (display))
return FALSE;
if (!_gdk_win32_display_init_gl (display, FALSE))
display_win32 = GDK_WIN32_DISPLAY (display);
if (!_gdk_win32_display_init_gl (display, FALSE) || !display_win32->have_wgl
#ifdef GDK_WIN32_ENABLE_EGL
|| !display_win32->have_egl
#endif
)
return FALSE;
if (major != NULL)
*major = GDK_WIN32_DISPLAY (display)->gl_version / 10;
if (minor != NULL)
*minor = GDK_WIN32_DISPLAY (display)->gl_version % 10;
if (display_win32->have_wgl)
{
if (major != NULL)
*major = GDK_WIN32_DISPLAY (display)->gl_version / 10;
if (minor != NULL)
*minor = GDK_WIN32_DISPLAY (display)->gl_version % 10;
}
#ifdef GDK_WIN32_ENABLE_EGL
else if (display_win32->have_egl)
{
if (major != NULL)
*major = GDK_WIN32_DISPLAY (display)->egl_version / 10;
if (minor != NULL)
*minor = GDK_WIN32_DISPLAY (display)->egl_version % 10;
}
#endif
return TRUE;
}
void
_gdk_win32_window_invalidate_egl_framebuffer (GdkWindow *window)
{
/* If we are using ANGLE, we need to force redraw of the whole Window and its child windows
* as we need to re-acquire the EGL surfaces that we rendered to upload to Cairo explicitly,
* using gdk_window_invalidate_rect (), when we maximize or restore or use aerosnap
*/
#ifdef GDK_WIN32_ENABLE_EGL
if (window->gl_paint_context != NULL && gdk_gl_context_get_use_es (window->gl_paint_context))
{
GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
impl->egl_force_redraw_all = TRUE;
}
#endif
}
+13
View File
@@ -24,6 +24,10 @@
#include <epoxy/gl.h>
#include <epoxy/wgl.h>
#ifdef GDK_WIN32_ENABLE_EGL
# include <epoxy/egl.h>
#endif
#include "gdkglcontextprivate.h"
#include "gdkdisplayprivate.h"
#include "gdkvisual.h"
@@ -46,6 +50,12 @@ struct _GdkWin32GLContext
guint is_attached : 1;
guint do_frame_sync : 1;
guint do_blit_swap : 1;
#ifdef GDK_WIN32_ENABLE_EGL
/* EGL (Angle) Context Items */
EGLContext egl_context;
EGLConfig egl_config;
#endif
};
struct _GdkWin32GLContextClass
@@ -76,6 +86,9 @@ gboolean
_gdk_win32_gl_context_realize (GdkGLContext *context,
GError **error);
void
_gdk_win32_window_invalidate_egl_framebuffer (GdkWindow *window);
G_END_DECLS
#endif /* __GDK_WIN32_GL_CONTEXT__ */
+89 -48
View File
@@ -27,6 +27,7 @@
#include <string.h>
#include <stdlib.h>
#include <glib/gprintf.h>
#include <pango/pangowin32.h>
#include "gdkscreen.h"
#include "gdkproperty.h"
@@ -239,6 +240,32 @@ _gdk_win32_window_delete_property (GdkWindow *window,
}
}
static gchar*
_get_system_font_name (HDC hdc)
{
NONCLIENTMETRICSW ncm;
PangoFontDescription *font_desc;
gchar *result, *font_desc_string;
int logpixelsy;
gint font_size;
ncm.cbSize = sizeof(NONCLIENTMETRICSW);
if (!SystemParametersInfoW (SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0))
return NULL;
logpixelsy = GetDeviceCaps (hdc, LOGPIXELSY);
font_desc = pango_win32_font_description_from_logfontw (&ncm.lfMessageFont);
font_desc_string = pango_font_description_to_string (font_desc);
pango_font_description_free (font_desc);
/* https://docs.microsoft.com/en-us/windows/desktop/api/wingdi/ns-wingdi-taglogfonta */
font_size = -MulDiv (ncm.lfMessageFont.lfHeight, 72, logpixelsy);
result = g_strdup_printf ("%s %d", font_desc_string, font_size);
g_free (font_desc_string);
return result;
}
/*
For reference, from gdk/x11/gdksettings.c:
@@ -333,61 +360,75 @@ _gdk_win32_screen_get_setting (GdkScreen *screen,
g_value_set_boolean (value, TRUE);
return TRUE;
}
else if (strcmp ("gtk-xft-hinting", name) == 0)
{
GDK_NOTE(MISC, g_print ("gdk_screen_get_setting(\"%s\") : 1\n", name));
g_value_set_int (value, 1);
return TRUE;
}
else if (strcmp ("gtk-xft-antialias", name) == 0)
{
GDK_NOTE(MISC, g_print ("gdk_screen_get_setting(\"%s\") : 1\n", name));
g_value_set_int (value, 1);
return TRUE;
}
else if (strcmp ("gtk-xft-hintstyle", name) == 0)
{
g_value_set_static_string (value, "hintfull");
GDK_NOTE(MISC, g_print ("gdk_screen_get_setting(\"%s\") : %s\n", name, g_value_get_string (value)));
return TRUE;
}
else if (strcmp ("gtk-xft-rgba", name) == 0)
{
unsigned int orientation = 0;
if (SystemParametersInfoW (SPI_GETFONTSMOOTHINGORIENTATION, 0, &orientation, 0))
{
if (orientation == FE_FONTSMOOTHINGORIENTATIONRGB)
g_value_set_static_string (value, "rgb");
else if (orientation == FE_FONTSMOOTHINGORIENTATIONBGR)
g_value_set_static_string (value, "bgr");
else
g_value_set_static_string (value, "none");
}
else
g_value_set_static_string (value, "none");
GDK_NOTE(MISC, g_print ("gdk_screen_get_setting(\"%s\") : %s\n", name, g_value_get_string (value)));
return TRUE;
}
else if (strcmp ("gtk-font-name", name) == 0)
{
NONCLIENTMETRICS ncm;
CPINFOEX cpinfoex_default, cpinfoex_curr_thread;
OSVERSIONINFO info;
BOOL result_default, result_curr_thread;
gchar *font_name = _get_system_font_name (_gdk_display_hdc);
info.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
/* TODO: Fallback to using Pango on Windows 8 and later,
* as this method of handling gtk-font-name does not work
* well there, where garbled text will be displayed for texts
* that are not supported by the default menu font. Look for
* whether there is a better solution for this on Windows 8 and
* later
*/
if (!GetVersionEx (&info) ||
info.dwMajorVersion > 6 ||
(info.dwMajorVersion == 6 && info.dwMinorVersion >= 2))
return FALSE;
/* check whether the system default ANSI codepage matches the
* ANSI code page of the running thread. If so, continue, otherwise
* fall back to using Pango to handle gtk-font-name
*/
result_default = GetCPInfoEx (CP_ACP, 0, &cpinfoex_default);
result_curr_thread = GetCPInfoEx (CP_THREAD_ACP, 0, &cpinfoex_curr_thread);
if (!result_default ||
!result_curr_thread ||
cpinfoex_default.CodePage != cpinfoex_curr_thread.CodePage)
return FALSE;
ncm.cbSize = sizeof(NONCLIENTMETRICS);
if (SystemParametersInfo (SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, FALSE))
if (font_name)
{
/* Pango finally uses GetDeviceCaps to scale, we use simple
* approximation here.
*/
int nHeight = (0 > ncm.lfMenuFont.lfHeight ? - 3 * ncm.lfMenuFont.lfHeight / 4 : 10);
if (OUT_STRING_PRECIS == ncm.lfMenuFont.lfOutPrecision)
GDK_NOTE(MISC, g_print("gdk_screen_get_setting(%s) : ignoring bitmap font '%s'\n",
name, ncm.lfMenuFont.lfFaceName));
else if (ncm.lfMenuFont.lfFaceName && strlen(ncm.lfMenuFont.lfFaceName) > 0 &&
/* Avoid issues like those described in bug #135098 */
g_utf8_validate (ncm.lfMenuFont.lfFaceName, -1, NULL))
/* The pango font fallback list got fixed during 1.43, before that
* using anything but "Segoe UI" would lead to a poor glyph coverage */
if (pango_version_check (1, 43, 0) != NULL &&
g_ascii_strncasecmp (font_name, "Segoe UI", strlen ("Segoe UI")) != 0)
{
char *s = g_strdup_printf ("%s %d", ncm.lfMenuFont.lfFaceName, nHeight);
GDK_NOTE(MISC, g_print("gdk_screen_get_setting(%s) : %s\n", name, s));
g_value_set_string (value, s);
g_free(s);
return TRUE;
g_free (font_name);
return FALSE;
}
GDK_NOTE(MISC, g_print("gdk_screen_get_setting(\"%s\") : %s\n", name, font_name));
g_value_take_string (value, font_name);
return TRUE;
}
else
{
g_warning ("gdk_screen_get_setting: Detecting the system font failed");
return FALSE;
}
}
else if (strcmp ("gtk-im-module", name) == 0)
{
if (_gdk_input_locale_is_ime)
g_value_set_string (value, "ime");
else
g_value_set_string (value, "");
return TRUE;
}
return FALSE;
-36
View File
@@ -490,10 +490,6 @@ gdk_win32_selection_init (GdkWin32Selection *win32_selection)
fmt.format = _gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_PNG);
g_array_append_val (comp, fmt);
fmt.format = CF_DIB;
fmt.transmute = TRUE;
g_array_append_val (comp, fmt);
g_hash_table_replace (win32_selection->compatibility_formats, fmt.target, comp);
@@ -507,13 +503,6 @@ gdk_win32_selection_init (GdkWin32Selection *win32_selection)
fmt.format = _gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_JFIF);
g_array_append_val (comp, fmt);
fmt.format = _gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_PNG);
fmt.transmute = TRUE;
g_array_append_val (comp, fmt);
fmt.format = CF_DIB;
g_array_append_val (comp, fmt);
g_hash_table_replace (win32_selection->compatibility_formats, fmt.target, comp);
@@ -527,13 +516,6 @@ gdk_win32_selection_init (GdkWin32Selection *win32_selection)
fmt.format = _gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_GIF);
g_array_append_val (comp, fmt);
fmt.format = _gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_PNG);
fmt.transmute = TRUE;
g_array_append_val (comp, fmt);
fmt.format = CF_DIB;
g_array_append_val (comp, fmt);
g_hash_table_replace (win32_selection->compatibility_formats, fmt.target, comp);
@@ -606,10 +588,6 @@ gdk_win32_selection_init (GdkWin32Selection *win32_selection)
fmt.target = _gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_IMAGE_PNG);
g_array_append_val (comp, fmt);
fmt.target = _gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_IMAGE_BMP);
fmt.transmute = TRUE;
g_array_append_val (comp, fmt);
g_hash_table_replace (win32_selection->compatibility_targets, GINT_TO_POINTER (_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_PNG)), comp);
@@ -623,13 +601,6 @@ gdk_win32_selection_init (GdkWin32Selection *win32_selection)
fmt.target = _gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_IMAGE_JPEG);
g_array_append_val (comp, fmt);
fmt.target = _gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_IMAGE_PNG);
fmt.transmute = TRUE;
g_array_append_val (comp, fmt);
fmt.target = _gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_IMAGE_BMP);
g_array_append_val (comp, fmt);
g_hash_table_replace (win32_selection->compatibility_targets, GINT_TO_POINTER (_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_JFIF)), comp);
@@ -643,13 +614,6 @@ gdk_win32_selection_init (GdkWin32Selection *win32_selection)
fmt.target = _gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_IMAGE_GIF);
g_array_append_val (comp, fmt);
fmt.target = _gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_IMAGE_PNG);
fmt.transmute = TRUE;
g_array_append_val (comp, fmt);
fmt.target = _gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_IMAGE_BMP);
g_array_append_val (comp, fmt);
g_hash_table_replace (win32_selection->compatibility_targets, GINT_TO_POINTER (_gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_GIF)), comp);
+82 -30
View File
@@ -1074,6 +1074,7 @@ gdk_win32_window_destroy (GdkWindow *window,
{
GdkWindowImplWin32 *window_impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
GSList *tmp;
GdkWin32Display *display = NULL;
g_return_if_fail (GDK_IS_WINDOW (window));
@@ -1084,17 +1085,27 @@ gdk_win32_window_destroy (GdkWindow *window,
_gdk_remove_modal_window (window);
/* Remove all our transient children */
tmp = window_impl->transient_children;
while (tmp != NULL)
while (window_impl->transient_children != NULL)
{
GdkWindow *child = tmp->data;
GdkWindowImplWin32 *child_impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW (child)->impl);
child_impl->transient_owner = NULL;
tmp = tmp->next;
GdkWindow *child = window_impl->transient_children->data;
gdk_window_set_transient_for (child, NULL);
}
g_slist_free (window_impl->transient_children);
window_impl->transient_children = NULL;
#ifdef GDK_WIN32_ENABLE_EGL
display = GDK_WIN32_DISPLAY (gdk_window_get_display (window));
/* Get rid of any EGLSurfaces that we might have created */
if (window_impl->egl_surface != EGL_NO_SURFACE)
{
eglDestroySurface (display->egl_disp, window_impl->egl_surface);
window_impl->egl_surface = EGL_NO_SURFACE;
}
if (window_impl->egl_dummy_surface != EGL_NO_SURFACE)
{
eglDestroySurface (display->egl_disp, window_impl->egl_dummy_surface);
window_impl->egl_dummy_surface = EGL_NO_SURFACE;
}
#endif
/* Remove ourself from our transient owner */
if (window_impl->transient_owner != NULL)
@@ -1463,7 +1474,7 @@ show_window_internal (GdkWindow *window,
API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window),
(window->state & GDK_WINDOW_STATE_ABOVE)?HWND_TOPMOST:HWND_NOTOPMOST,
0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE));
SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOOWNERZORDER));
}
}
@@ -1695,6 +1706,7 @@ gdk_win32_window_move_resize (GdkWindow *window,
}
else
{
_gdk_win32_window_invalidate_egl_framebuffer (window);
if (with_move)
{
gdk_win32_window_move_resize_internal (window, x, y, width, height);
@@ -1812,7 +1824,7 @@ gdk_win32_window_raise (GdkWindow *window)
if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_TEMP)
API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window), HWND_TOPMOST,
0, 0, 0, 0,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE));
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOOWNERZORDER));
else if (window->accept_focus)
/* Do not wrap this in an API_CALL macro as SetForegroundWindow might
* fail when for example dragging a window belonging to a different
@@ -1822,7 +1834,7 @@ gdk_win32_window_raise (GdkWindow *window)
else
API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window), HWND_TOP,
0, 0, 0, 0,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE));
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOOWNERZORDER));
}
}
@@ -1839,7 +1851,7 @@ gdk_win32_window_lower (GdkWindow *window)
API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window), HWND_BOTTOM,
0, 0, 0, 0,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE));
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOOWNERZORDER));
}
}
@@ -2109,27 +2121,29 @@ gdk_win32_window_set_transient_for (GdkWindow *window,
return;
}
if (parent == NULL)
if (window_impl->transient_owner == parent)
return;
if (GDK_IS_WINDOW (window_impl->transient_owner))
{
GdkWindowImplWin32 *trans_impl = GDK_WINDOW_IMPL_WIN32 (window_impl->transient_owner->impl);
if (trans_impl->transient_children != NULL)
{
item = g_slist_find (trans_impl->transient_children, window);
item->data = NULL;
trans_impl->transient_children = g_slist_delete_link (trans_impl->transient_children, item);
trans_impl->num_transients--;
item = g_slist_find (trans_impl->transient_children, window);
item->data = NULL;
trans_impl->transient_children = g_slist_delete_link (trans_impl->transient_children, item);
trans_impl->num_transients--;
if (!trans_impl->num_transients)
{
trans_impl->transient_children = NULL;
}
if (!trans_impl->num_transients)
{
trans_impl->transient_children = NULL;
}
g_object_unref (G_OBJECT (window_impl->transient_owner));
g_object_unref (G_OBJECT (window));
window_impl->transient_owner = NULL;
}
else
if (parent)
{
parent_impl = GDK_WINDOW_IMPL_WIN32 (parent->impl);
@@ -2896,7 +2910,7 @@ _gdk_win32_window_update_style_bits (GdkWindow *window)
rect.right += after.right - before.right;
rect.bottom += after.bottom - before.bottom;
flags = SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOREPOSITION;
flags = SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOREPOSITION | SWP_NOOWNERZORDER;
if (will_be_topmost && !was_topmost)
{
@@ -4759,6 +4773,9 @@ gdk_win32_window_end_move_resize_drag (GdkWindow *window)
GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
GdkW32DragMoveResizeContext *context = &impl->drag_move_resize_context;
if (context->op == GDK_WIN32_DRAGOP_RESIZE)
_gdk_win32_window_invalidate_egl_framebuffer (window);
context->op = GDK_WIN32_DRAGOP_NONE;
gdk_device_ungrab (context->device, GDK_CURRENT_TIME);
@@ -5278,6 +5295,8 @@ gdk_win32_window_unmaximize (GdkWindow *window)
GDK_WINDOW_HWND (window),
_gdk_win32_window_state_to_string (window->state)));
_gdk_win32_window_invalidate_egl_framebuffer (window);
if (GDK_WINDOW_IS_MAPPED (window))
GtkShowWindow (window, SW_RESTORE);
else
@@ -5334,7 +5353,7 @@ gdk_win32_window_fullscreen (GdkWindow *window)
API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window), HWND_TOP,
x, y, width, height,
SWP_NOCOPYBITS | SWP_SHOWWINDOW));
SWP_NOCOPYBITS | SWP_SHOWWINDOW | SWP_NOOWNERZORDER));
}
}
@@ -5357,7 +5376,7 @@ gdk_win32_window_unfullscreen (GdkWindow *window)
API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window), HWND_NOTOPMOST,
fi->r.left, fi->r.top,
fi->r.right - fi->r.left, fi->r.bottom - fi->r.top,
SWP_NOCOPYBITS | SWP_SHOWWINDOW));
SWP_NOCOPYBITS | SWP_SHOWWINDOW | SWP_NOOWNERZORDER));
g_object_set_data (G_OBJECT (window), "fullscreen-info", NULL);
g_free (fi);
@@ -5383,7 +5402,7 @@ gdk_win32_window_set_keep_above (GdkWindow *window,
API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window),
setting ? HWND_TOPMOST : HWND_NOTOPMOST,
0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE));
SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOOWNERZORDER));
}
gdk_synthesize_window_state (window,
@@ -5409,7 +5428,7 @@ gdk_win32_window_set_keep_below (GdkWindow *window,
API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window),
setting ? HWND_BOTTOM : HWND_NOTOPMOST,
0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE));
SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOOWNERZORDER));
}
gdk_synthesize_window_state (window,
@@ -6017,6 +6036,7 @@ GtkShowWindow (GdkWindow *window,
case SW_SHOWNA:
case SW_SHOWNOACTIVATE:
case SW_SHOWNORMAL:
if (IsWindowVisible (hwnd))
break;
@@ -6276,3 +6296,35 @@ gdk_win32_window_get_handle (GdkWindow *window)
return GDK_WINDOW_HWND (window);
}
#ifdef GDK_WIN32_ENABLE_EGL
EGLSurface
_gdk_win32_window_get_egl_surface (GdkWindow *window,
EGLConfig config,
gboolean is_dummy)
{
EGLSurface surface;
GdkWin32Display *display = GDK_WIN32_DISPLAY (gdk_window_get_display (window));
GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
if (is_dummy)
{
if (impl->egl_dummy_surface == EGL_NO_SURFACE)
{
EGLint attribs[] = {EGL_WIDTH, 1, EGL_WIDTH, 1, EGL_NONE};
impl->egl_dummy_surface = eglCreatePbufferSurface (display->egl_disp,
config,
attribs);
}
return impl->egl_dummy_surface;
}
else
{
if (impl->egl_surface == EGL_NO_SURFACE)
impl->egl_surface = eglCreateWindowSurface (display->egl_disp, config, display->gl_hwnd, NULL);
return impl->egl_surface;
}
}
#endif
+16
View File
@@ -31,6 +31,10 @@
#include <windows.h>
#ifdef GDK_WIN32_ENABLE_EGL
#include <epoxy/egl.h>
#endif
G_BEGIN_DECLS
/* Window implementation for Win32
@@ -352,6 +356,12 @@ struct _GdkWindowImplWin32
gint window_scale;
gint unscaled_width;
gint unscaled_height;
#ifdef GDK_WIN32_ENABLE_EGL
EGLSurface egl_surface;
EGLSurface egl_dummy_surface;
guint egl_force_redraw_all : 1;
#endif
};
struct _GdkWindowImplWin32Class
@@ -373,6 +383,12 @@ void _gdk_win32_window_update_style_bits (GdkWindow *window);
gint _gdk_win32_window_get_scale_factor (GdkWindow *window);
#ifdef GDK_WIN32_ENABLE_EGL
EGLSurface _gdk_win32_window_get_egl_surface (GdkWindow *window,
EGLConfig config,
gboolean is_dummy);
#endif
G_END_DECLS
#endif /* __GDK_WINDOW_WIN32_H__ */
+1 -1
View File
@@ -441,7 +441,7 @@ update_cursor (gpointer data,
/**
* gdk_x11_display_set_cursor_theme:
* @display: (type GdkX11Display): a #GdkDisplay
* @theme: the name of the cursor theme to use, or %NULL to unset
* @theme: (nullable): the name of the cursor theme to use, or %NULL to unset
* a previously set value
* @size: the cursor size to use, or 0 to keep the previous size
*
+86 -4
View File
@@ -38,6 +38,23 @@
#include <string.h>
static const char *wacom_type_atoms[] = {
"STYLUS",
"CURSOR",
"ERASER",
"PAD",
"TOUCH"
};
#define N_WACOM_TYPE_ATOMS G_N_ELEMENTS (wacom_type_atoms)
enum {
WACOM_TYPE_STYLUS,
WACOM_TYPE_CURSOR,
WACOM_TYPE_ERASER,
WACOM_TYPE_PAD,
WACOM_TYPE_TOUCH,
};
struct _GdkX11DeviceManagerXI2
{
GdkX11DeviceManagerCore parent_object;
@@ -1018,6 +1035,66 @@ device_get_tool_serial_and_id (GdkDevice *device,
return TRUE;
}
static GdkDeviceToolType
device_get_tool_type (GdkDevice *device)
{
GdkDisplay *display;
gulong nitems, bytes_after;
guint32 *data;
int rc, format;
Atom type;
Atom device_type;
Atom types[N_WACOM_TYPE_ATOMS];
GdkDeviceToolType tool_type = GDK_DEVICE_TOOL_TYPE_UNKNOWN;
display = gdk_device_get_display (device);
gdk_x11_display_error_trap_push (display);
rc = XIGetProperty (GDK_DISPLAY_XDISPLAY (display),
gdk_x11_device_get_id (device),
gdk_x11_get_xatom_by_name_for_display (display, "Wacom Tool Type"),
0, 1, False, XA_ATOM, &type, &format, &nitems, &bytes_after,
(guchar **) &data);
gdk_x11_display_error_trap_pop_ignored (display);
if (rc != Success)
return GDK_DEVICE_TOOL_TYPE_UNKNOWN;
if (type != XA_ATOM || format != 32 || nitems != 1)
{
XFree (data);
return GDK_DEVICE_TOOL_TYPE_UNKNOWN;
}
device_type = *data;
XFree (data);
if (device_type == 0)
return GDK_DEVICE_TOOL_TYPE_UNKNOWN;
gdk_x11_display_error_trap_push (display);
rc = XInternAtoms (GDK_DISPLAY_XDISPLAY (display),
(char **) wacom_type_atoms,
N_WACOM_TYPE_ATOMS,
False,
types);
gdk_x11_display_error_trap_pop_ignored (display);
if (rc == 0)
return GDK_DEVICE_TOOL_TYPE_UNKNOWN;
if (device_type == types[WACOM_TYPE_STYLUS])
tool_type = GDK_DEVICE_TOOL_TYPE_PEN;
else if (device_type == types[WACOM_TYPE_CURSOR])
tool_type = GDK_DEVICE_TOOL_TYPE_MOUSE;
else if (device_type == types[WACOM_TYPE_ERASER])
tool_type = GDK_DEVICE_TOOL_TYPE_ERASER;
else if (device_type == types[WACOM_TYPE_TOUCH])
tool_type = GDK_DEVICE_TOOL_TYPE_UNKNOWN;
return tool_type;
}
static void
handle_property_change (GdkX11DeviceManagerXI2 *device_manager,
XIPropertyEvent *ev)
@@ -1038,13 +1115,18 @@ handle_property_change (GdkX11DeviceManagerXI2 *device_manager,
device_get_tool_serial_and_id (device, &serial_id, &tool_id))
{
seat = gdk_device_get_seat (device);
tool = gdk_seat_get_tool (seat, serial_id);
tool = gdk_seat_get_tool (seat, serial_id, tool_id);
if (!tool && serial_id > 0)
{
tool = gdk_device_tool_new (serial_id, tool_id,
GDK_DEVICE_TOOL_TYPE_UNKNOWN, 0);
gdk_seat_default_add_tool (GDK_SEAT_DEFAULT (seat), tool);
GdkDeviceToolType tool_type;
tool_type = device_get_tool_type (device);
if (tool_type != GDK_DEVICE_TOOL_TYPE_UNKNOWN)
{
tool = gdk_device_tool_new (serial_id, tool_id, tool_type, 0);
gdk_seat_default_add_tool (GDK_SEAT_DEFAULT (seat), tool);
}
}
}
+3 -3
View File
@@ -1728,7 +1728,7 @@ _gdk_x11_display_open (const gchar *display_name)
if (!gdk_running_in_sandbox ())
{
/* if sandboxed, we're likely in a pid namespace and would only confuse the wm with this */
pid_t pid = getpid ();
long pid = getpid ();
XChangeProperty (display_x11->xdisplay,
display_x11->leader_window,
gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_PID"),
@@ -3006,8 +3006,8 @@ gdk_x11_display_error_trap_pop_ignored (GdkDisplay *display)
/**
* gdk_x11_set_sm_client_id:
* @sm_client_id: the client id assigned by the session manager when the
* connection was opened, or %NULL to remove the property.
* @sm_client_id: (nullable): the client id assigned by the session manager
* when the connection was opened, or %NULL to remove the property.
*
* Sets the `SM_CLIENT_ID` property on the applications leader window so that
* the window manager can save the applications state using the X11R6 ICCCM
+22
View File
@@ -465,3 +465,25 @@ gdk_x11_get_default_xdisplay (void)
{
return GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
}
/**
* gdk_x11_get_parent_relative_pattern:
*
* Used with gdk_window_set_background_pattern() to inherit background from
* parent window. Useful for imitating transparency when compositing is not
* available. Otherwise behaves like a transparent pattern.
*
* Since: 3.24.2
*
* Deprecated: 3.24: Don't use this function
**/
cairo_pattern_t *
gdk_x11_get_parent_relative_pattern (void)
{
static cairo_pattern_t *parent_relative_pattern = NULL;
if (G_UNLIKELY (parent_relative_pattern == NULL))
parent_relative_pattern = cairo_pattern_create_rgba (0.0, 0.0, 0.0, 0.0);
return parent_relative_pattern;
}
+36 -1
View File
@@ -935,7 +935,7 @@ setup_toplevel_window (GdkWindow *window,
if (!gdk_running_in_sandbox ())
{
/* if sandboxed, we're likely in a pid namespace and would only confuse the wm with this */
pid_t pid = getpid ();
long pid = getpid ();
XChangeProperty (xdisplay, xid,
gdk_x11_get_xatom_by_name_for_display (x11_screen->display, "_NET_WM_PID"),
XA_CARDINAL, 32,
@@ -1053,6 +1053,12 @@ _gdk_x11_display_create_window_impl (GdkDisplay *display,
impl->override_redirect = xattributes.override_redirect;
/* This event mask will be set near the end of the function, but to avoid some
* races, the window has to be created with this mask already.
*/
xattributes.event_mask = StructureNotifyMask | PropertyChangeMask;
xattributes_mask |= CWEventMask;
/* Sanity checks */
switch (window->window_type)
{
@@ -2979,6 +2985,7 @@ gdk_window_x11_set_background (GdkWindow *window,
double r, g, b, a;
cairo_surface_t *surface;
cairo_matrix_t matrix;
cairo_pattern_t *parent_relative_pattern;
if (GDK_WINDOW_DESTROYED (window))
return;
@@ -2990,6 +2997,34 @@ gdk_window_x11_set_background (GdkWindow *window,
return;
}
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
parent_relative_pattern = gdk_x11_get_parent_relative_pattern ();
G_GNUC_END_IGNORE_DEPRECATIONS
if (pattern == parent_relative_pattern)
{
GdkWindow *parent;
/* X throws BadMatch if the parent has a different depth when
* using ParentRelative */
parent = gdk_window_get_parent (window);
if (parent != NULL && window->depth == parent->depth &&
cairo_pattern_status (pattern) == CAIRO_STATUS_SUCCESS)
{
XSetWindowBackgroundPixmap (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window), ParentRelative);
return;
}
else
{
g_warning ("Can't set ParentRelative background for window %#lx, depth of parent doesn't match",
GDK_WINDOW_XID (window));
XSetWindowBackgroundPixmap (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window), None);
return;
}
}
switch (cairo_pattern_get_type (pattern))
{
case CAIRO_PATTERN_TYPE_SOLID:
+3
View File
@@ -72,6 +72,9 @@ void gdk_x11_grab_server (void);
GDK_AVAILABLE_IN_ALL
void gdk_x11_ungrab_server (void);
GDK_DEPRECATED_IN_3_24
cairo_pattern_t *gdk_x11_get_parent_relative_pattern (void);
G_END_DECLS
#endif /* __GDK_X11_UTILS_H__ */
+26 -11
View File
@@ -3,7 +3,6 @@ AUTOMAKE_OPTIONS = subdir-objects
include $(top_srcdir)/Makefile.decl
GTK_BASE_CFLAGS_DEFINES = \
-DG_LOG_DOMAIN=\"Gtk\" \
-DG_LOG_USE_STRUCTURED=1 \
-DGTK_VERSION=\"$(GTK_VERSION)\" \
-DGTK_BINARY_VERSION=\"$(GTK_BINARY_VERSION)\" \
@@ -20,6 +19,7 @@ GTK_PLAT_CFLAGS_DEFINES = \
-DGTK_PRINT_BACKENDS=\"$(GTK_PRINT_BACKENDS)\"
AM_CPPFLAGS = \
-DG_LOG_DOMAIN=\"Gtk\" \
$(GTK_BASE_CFLAGS_DEFINES) \
$(GTK_PLAT_CFLAGS_DEFINES) \
-DX11_DATA_PREFIX=\"$(X11_PREFIX)\" \
@@ -192,6 +192,9 @@ gtk_public_h_sources = \
gtkenums.h \
gtkeventbox.h \
gtkeventcontroller.h \
gtkeventcontrollerkey.h \
gtkeventcontrollermotion.h \
gtkeventcontrollerscroll.h \
gtkexpander.h \
gtkfilechooser.h \
gtkfilechooserbutton.h \
@@ -213,6 +216,7 @@ gtk_public_h_sources = \
gtkgesturepan.h \
gtkgesturerotate.h \
gtkgesturesingle.h \
gtkgesturestylus.h \
gtkgestureswipe.h \
gtkgesturezoom.h \
gtkglarea.h \
@@ -394,6 +398,10 @@ gtk_private_h_sources = \
gtkclipboardprivate.h \
gtkcolorswatchprivate.h \
gtkcoloreditorprivate.h \
gtkcolorpickerprivate.h \
gtkcolorpickerkwinprivate.h \
gtkcolorpickerportalprivate.h \
gtkcolorpickershellprivate.h \
gtkcolorplaneprivate.h \
gtkcolorscaleprivate.h \
gtkcolorchooserprivate.h \
@@ -491,6 +499,7 @@ gtk_private_h_sources = \
gtkgesturepanprivate.h \
gtkgesturerotateprivate.h \
gtkgesturesingleprivate.h \
gtkgesturestylusprivate.h \
gtkgestureswipeprivate.h \
gtkgesturezoomprivate.h \
gtkheaderbarprivate.h \
@@ -592,7 +601,10 @@ gtk_private_h_sources = \
gtkwin32themeprivate.h \
gtkwindowprivate.h \
gtktreemenu.h \
gdkpixbufutilsprivate.h
gdkpixbufutilsprivate.h \
open-type-layout.h \
language-names.h \
script-names.h
# GTK+ C sources to build the library from
gtk_base_c_sources = \
@@ -667,6 +679,10 @@ gtk_base_c_sources = \
gtkcolorchooserwidget.c \
gtkcolorchooserdialog.c \
gtkcoloreditor.c \
gtkcolorpicker.c \
gtkcolorpickerkwin.c \
gtkcolorpickerportal.c \
gtkcolorpickershell.c \
gtkcolorplane.c \
gtkcolorscale.c \
gtkcolorswatch.c \
@@ -754,6 +770,9 @@ gtk_base_c_sources = \
gtkentrycompletion.c \
gtkeventbox.c \
gtkeventcontroller.c \
gtkeventcontrollerkey.c \
gtkeventcontrollermotion.c \
gtkeventcontrollerscroll.c \
gtkexpander.c \
gtkfilechooser.c \
gtkfilechooserbutton.c \
@@ -783,6 +802,7 @@ gtk_base_c_sources = \
gtkgesturepan.c \
gtkgesturerotate.c \
gtkgesturesingle.c \
gtkgesturestylus.c \
gtkgestureswipe.c \
gtkgesturezoom.c \
gtkglarea.c \
@@ -1269,10 +1289,6 @@ gtk.gresource.xml: Makefile.am inspector/Makefile.inc
$(AM_V_GEN) echo "<?xml version='1.0' encoding='UTF-8'?>" > $@; \
echo "<gresources>" >> $@; \
echo " <gresource prefix='/org/gtk/libgtk'>" >> $@; \
for f in $(srcdir)/theme/Raleigh/*.css; do \
n=`basename $$f`; \
echo " <file alias='theme/Raleigh/gtk.css'>theme/Raleigh/$$n</file>" >> $@; \
done; \
echo " <file>theme/Adwaita/gtk.css</file>" >> $@; \
echo " <file>theme/Adwaita/gtk-dark.css</file>" >> $@; \
echo " <file>theme/Adwaita/gtk-contained.css</file>" >> $@; \
@@ -1309,10 +1325,10 @@ gtk.gresource.xml: Makefile.am inspector/Makefile.inc
done; \
for f in $(srcdir)/ui/*.ui; do \
n=`basename $$f`; \
echo " <file compressed='true'>ui/$$n</file>" >> $@; \
echo " <file preprocess='xml-stripblanks'>ui/$$n</file>" >> $@; \
done; \
for s in 16x16 22x22 24x24 32x32 48x48; do \
for c in actions status; do \
for c in actions status categories; do \
for f in $(srcdir)/icons/$$s/$$c/*.png; do \
test "$$f" = "$(srcdir)/icons/$$s/$$c/*.png" && continue; \
n=`basename $$f`; \
@@ -1322,7 +1338,7 @@ gtk.gresource.xml: Makefile.am inspector/Makefile.inc
done; \
for f in $(srcdir)/inspector/*.ui; do \
n=`basename $$f`; \
echo " <file compressed='true'>inspector/$$n</file>" >> $@; \
echo " <file compressed='true' preprocess='xml-stripblanks'>inspector/$$n</file>" >> $@; \
done; \
echo " <file>inspector/logo.png</file>" >> $@; \
echo " <file>emoji/emoji.data</file>" >> $@; \
@@ -1393,8 +1409,7 @@ theme_sources = \
theme/HighContrast/gtk-contained.css \
theme/HighContrast/gtk-contained-inverse.css \
theme/HighContrast/gtk.css \
theme/HighContrast/gtk-inverse.css \
theme/Raleigh/gtk-default.css
theme/HighContrast/gtk-inverse.css
resource_files = $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(builddir)/gtk.gresource.xml)
+87 -1
View File
@@ -46,11 +46,13 @@ static const struct {
static GtkCellRendererState gtk_cell_accessible_get_state (GtkCellAccessible *cell);
static void atk_action_interface_init (AtkActionIface *iface);
static void atk_component_interface_init (AtkComponentIface *iface);
static void atk_table_cell_interface_init (AtkTableCellIface *iface);
G_DEFINE_TYPE_WITH_CODE (GtkCellAccessible, gtk_cell_accessible, GTK_TYPE_ACCESSIBLE,
G_ADD_PRIVATE (GtkCellAccessible)
G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_interface_init)
G_IMPLEMENT_INTERFACE (ATK_TYPE_COMPONENT, atk_component_interface_init))
G_IMPLEMENT_INTERFACE (ATK_TYPE_COMPONENT, atk_component_interface_init)
G_IMPLEMENT_INTERFACE (ATK_TYPE_TABLE_CELL, atk_table_cell_interface_init))
static gint
gtk_cell_accessible_get_index_in_parent (AtkObject *obj)
@@ -366,6 +368,90 @@ atk_component_interface_init (AtkComponentIface *iface)
iface->grab_focus = gtk_cell_accessible_grab_focus;
}
static int
gtk_cell_accessible_get_column_span (AtkTableCell *table_cell)
{
return 1;
}
static GPtrArray *
gtk_cell_accessible_get_column_header_cells (AtkTableCell *table_cell)
{
GtkCellAccessible *cell;
AtkObject *parent;
cell = GTK_CELL_ACCESSIBLE (table_cell);
parent = gtk_widget_get_accessible (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell)));
return gtk_cell_accessible_parent_get_column_header_cells (GTK_CELL_ACCESSIBLE_PARENT (parent),
cell);
}
static gboolean
gtk_cell_accessible_get_position (AtkTableCell *table_cell,
gint *row,
gint *column)
{
GtkCellAccessible *cell;
AtkObject *parent;
cell = GTK_CELL_ACCESSIBLE (table_cell);
parent = gtk_widget_get_accessible (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell)));
gtk_cell_accessible_parent_get_cell_position (GTK_CELL_ACCESSIBLE_PARENT (parent),
cell,
row, column);
return ((row && *row > 0) || (column && *column > 0));
}
static int
gtk_cell_accessible_get_row_span (AtkTableCell *table_cell)
{
return 1;
}
static GPtrArray *
gtk_cell_accessible_get_row_header_cells (AtkTableCell *table_cell)
{
GtkCellAccessible *cell;
AtkObject *parent;
cell = GTK_CELL_ACCESSIBLE (table_cell);
parent = gtk_widget_get_accessible (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell)));
return gtk_cell_accessible_parent_get_row_header_cells (GTK_CELL_ACCESSIBLE_PARENT (parent),
cell);
}
static AtkObject *
gtk_cell_accessible_get_table (AtkTableCell *table_cell)
{
AtkObject *obj;
obj = ATK_OBJECT (table_cell);
do
{
AtkRole role;
obj = atk_object_get_parent (obj);
role = atk_object_get_role (obj);
if (role == ATK_ROLE_TABLE || role == ATK_ROLE_TREE_TABLE)
break;
}
while (obj);
return obj;
}
static void
atk_table_cell_interface_init (AtkTableCellIface *iface)
{
iface->get_column_span = gtk_cell_accessible_get_column_span;
iface->get_column_header_cells = gtk_cell_accessible_get_column_header_cells;
iface->get_position = gtk_cell_accessible_get_position;
iface->get_row_span = gtk_cell_accessible_get_row_span;
iface->get_row_header_cells = gtk_cell_accessible_get_row_header_cells;
iface->get_table = gtk_cell_accessible_get_table;
}
static GtkCellRendererState
gtk_cell_accessible_get_state (GtkCellAccessible *cell)
{
+66
View File
@@ -187,3 +187,69 @@ gtk_cell_accessible_parent_update_relationset (GtkCellAccessibleParent *parent,
if (iface->update_relationset)
(iface->update_relationset) (parent, cell, relationset);
}
void
gtk_cell_accessible_parent_get_cell_position (GtkCellAccessibleParent *parent,
GtkCellAccessible *cell,
gint *row,
gint *column)
{
GtkCellAccessibleParentIface *iface;
g_return_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent));
g_return_if_fail (GTK_IS_CELL_ACCESSIBLE (cell));
iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent);
if (iface->get_cell_position)
(iface->get_cell_position) (parent, cell, row, column);
else
{
if (row)
*row = -1;
if (column)
*column = -1;
}
}
/**
* gtk_cell_accessible_parent_get_column_header_cells:
* Returns: (transfer full) (element-type AtkObject)
*/
GPtrArray *
gtk_cell_accessible_parent_get_column_header_cells (GtkCellAccessibleParent *parent,
GtkCellAccessible *cell)
{
GtkCellAccessibleParentIface *iface;
g_return_val_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent), NULL);
g_return_val_if_fail (GTK_IS_CELL_ACCESSIBLE (cell), NULL);
iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent);
if (iface->get_column_header_cells)
return (iface->get_column_header_cells) (parent, cell);
else
return NULL;
}
/**
* gtk_cell_accessible_parent_get_row_header_cells:
* Returns: (transfer full) (element-type AtkObject)
*/
GPtrArray *
gtk_cell_accessible_parent_get_row_header_cells (GtkCellAccessibleParent *parent,
GtkCellAccessible *cell)
{
GtkCellAccessibleParentIface *iface;
g_return_val_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent), NULL);
g_return_val_if_fail (GTK_IS_CELL_ACCESSIBLE (cell), NULL);
iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent);
if (iface->get_row_header_cells)
return (iface->get_row_header_cells) (parent, cell);
else
return NULL;
}
+19
View File
@@ -75,6 +75,14 @@ struct _GtkCellAccessibleParentIface
void ( *update_relationset) (GtkCellAccessibleParent *parent,
GtkCellAccessible *cell,
AtkRelationSet *relationset);
void ( *get_cell_position) (GtkCellAccessibleParent *parent,
GtkCellAccessible *cell,
gint *row,
gint *column);
GPtrArray * ( *get_column_header_cells) (GtkCellAccessibleParent *parent,
GtkCellAccessible *cell);
GPtrArray * ( *get_row_header_cells) (GtkCellAccessibleParent *parent,
GtkCellAccessible *cell);
};
GDK_AVAILABLE_IN_ALL
@@ -115,6 +123,17 @@ GDK_AVAILABLE_IN_3_12
void gtk_cell_accessible_parent_update_relationset (GtkCellAccessibleParent *parent,
GtkCellAccessible *cell,
AtkRelationSet *relationset);
GDK_AVAILABLE_IN_ALL
void gtk_cell_accessible_parent_get_cell_position(GtkCellAccessibleParent *parent,
GtkCellAccessible *cell,
gint *row,
gint *column);
GPtrArray *gtk_cell_accessible_parent_get_column_header_cells (GtkCellAccessibleParent *parent,
GtkCellAccessible *cell);
GPtrArray *gtk_cell_accessible_parent_get_row_header_cells (GtkCellAccessibleParent *parent,
GtkCellAccessible *cell);
G_END_DECLS
+52
View File
@@ -1391,6 +1391,56 @@ gtk_tree_view_accessible_update_relationset (GtkCellAccessibleParent *parent,
}
}
static void
gtk_tree_view_accessible_get_cell_position (GtkCellAccessibleParent *parent,
GtkCellAccessible *cell,
gint *row,
gint *column)
{
GtkWidget *widget;
GtkTreeView *tree_view;
GtkTreeViewAccessibleCellInfo *cell_info;
GtkTreeViewAccessible *accessible;
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (parent));
if (widget == NULL)
return;
tree_view = GTK_TREE_VIEW (widget);
accessible = GTK_TREE_VIEW_ACCESSIBLE (parent);
cell_info = find_cell_info (accessible, cell);
if (!cell_info)
return;
if (row)
(*row) = _gtk_rbtree_node_get_index (cell_info->tree, cell_info->node);
if (column)
(*column) = get_column_number (tree_view, cell_info->cell_col_ref);
}
static GPtrArray *
gtk_tree_view_accessible_get_column_header_cells (GtkCellAccessibleParent *parent,
GtkCellAccessible *cell)
{
GtkWidget *widget;
GtkTreeViewAccessibleCellInfo *cell_info;
GtkTreeViewAccessible *accessible;
GPtrArray *array;
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (parent));
if (widget == NULL)
return NULL;
accessible = GTK_TREE_VIEW_ACCESSIBLE (parent);
cell_info = find_cell_info (accessible, cell);
if (!cell_info)
return NULL;
array = g_ptr_array_new_full (1, g_object_unref);
g_ptr_array_add (array, g_object_ref (get_header_from_column ( (cell_info->cell_col_ref))));
return array;
}
static void
gtk_cell_accessible_parent_interface_init (GtkCellAccessibleParentIface *iface)
{
@@ -1403,6 +1453,8 @@ gtk_cell_accessible_parent_interface_init (GtkCellAccessibleParentIface *iface)
iface->activate = gtk_tree_view_accessible_activate;
iface->edit = gtk_tree_view_accessible_edit;
iface->update_relationset = gtk_tree_view_accessible_update_relationset;
iface->get_cell_position = gtk_tree_view_accessible_get_cell_position;
iface->get_column_header_cells = gtk_tree_view_accessible_get_column_header_cells;
}
void
+5 -4
View File
@@ -642,11 +642,12 @@ gtk_widget_accessible_grab_focus (AtkComponent *component)
if (gtk_widget_is_toplevel (toplevel))
{
#ifdef GDK_WINDOWING_X11
gtk_window_present_with_time (GTK_WINDOW (toplevel),
gdk_x11_get_server_time (gtk_widget_get_window (widget)));
#else
gtk_window_present (GTK_WINDOW (toplevel));
if (GDK_IS_X11_DISPLAY (gtk_widget_get_display (toplevel)))
gtk_window_present_with_time (GTK_WINDOW (toplevel),
gdk_x11_get_server_time (gtk_widget_get_window (widget)));
else
#endif
gtk_window_present (GTK_WINDOW (toplevel));
}
return TRUE;
}
+3 -1
View File
@@ -1420,7 +1420,9 @@ gtk_status_icon_update_image (GtkStatusIcon *status_icon)
surface = gtk_icon_helper_load_surface (icon_helper, 1);
if (surface)
{
pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0, round_size, round_size);
pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0,
cairo_image_surface_get_width (surface),
cairo_image_surface_get_height (surface));
cairo_surface_destroy (surface);
}
else
+2 -1
View File
@@ -966,7 +966,8 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
else
{
/* Set a parent-relative background pixmap */
gdk_window_set_background_pattern (window, NULL);
cairo_pattern_t *parent_relative = gdk_x11_get_parent_relative_pattern ();
gdk_window_set_background_pattern (window, parent_relative);
}
G_GNUC_END_IGNORE_DEPRECATIONS
+2 -2
View File
@@ -79,7 +79,7 @@ load_symbolic_svg (char *file_data, gsize file_len,
svg_height = g_strdup_printf ("%d",gdk_pixbuf_get_height (pixbuf));
g_object_unref (pixbuf);
escaped_file_data = g_markup_escape_text (file_data, file_len);
escaped_file_data = g_base64_encode ((guchar *) file_data, file_len);
data = g_strconcat ("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"
"<svg version=\"1.1\"\n"
@@ -101,7 +101,7 @@ load_symbolic_svg (char *file_data, gsize file_len,
" fill: ", css_success, " !important;\n"
" }\n"
" </style>\n"
" <xi:include href=\"data:text/xml,", escaped_file_data, "\"/>\n"
" <xi:include href=\"data:text/xml;base64,", escaped_file_data, "\"/>\n"
"</svg>",
NULL);
g_free (escaped_file_data);
+8
View File
@@ -106,3 +106,11 @@ exp2 (double x)
return pow (2.0, x);
}
#endif
#ifndef HAVE_TRUNC
static inline double
trunc (double x)
{
return (x > 0 ? floor (x) : ceil (x));
}
#endif
+1
View File
@@ -193,6 +193,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkViewport, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkVolumeButton, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkPaperSize, gtk_paper_size_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkRecentInfo, gtk_recent_info_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkSelectionData, gtk_selection_data_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkTargetList, gtk_target_list_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkTextAttributes, gtk_text_attributes_unref)
+4
View File
@@ -94,6 +94,9 @@
#include <gtk/gtkenums.h>
#include <gtk/gtkeventbox.h>
#include <gtk/gtkeventcontroller.h>
#include <gtk/gtkeventcontrollerkey.h>
#include <gtk/gtkeventcontrollermotion.h>
#include <gtk/gtkeventcontrollerscroll.h>
#include <gtk/gtkexpander.h>
#include <gtk/gtkfixed.h>
#include <gtk/gtkfilechooser.h>
@@ -115,6 +118,7 @@
#include <gtk/gtkgesturepan.h>
#include <gtk/gtkgesturerotate.h>
#include <gtk/gtkgesturesingle.h>
#include <gtk/gtkgesturestylus.h>
#include <gtk/gtkgestureswipe.h>
#include <gtk/gtkgesturezoom.h>
#include <gtk/gtkglarea.h>
+1 -1
View File
@@ -152,7 +152,7 @@ gtk_actionable_get_action_target_value (GtkActionable *actionable)
/**
* gtk_actionable_set_action_target_value:
* @actionable: a #GtkActionable widget
* @target_value: a #GVariant to set as the target value, or %NULL
* @target_value: (nullable): a #GVariant to set as the target value, or %NULL
*
* Sets the target value of an actionable widget.
*
+139 -2
View File
@@ -24,6 +24,7 @@
#include "gtkapplicationprivate.h"
#include "gtksettings.h"
#include "gtkprivate.h"
G_DEFINE_TYPE (GtkApplicationImplDBus, gtk_application_impl_dbus, GTK_TYPE_APPLICATION_IMPL)
@@ -35,6 +36,9 @@ G_DEFINE_TYPE (GtkApplicationImplDBus, gtk_application_impl_dbus, GTK_TYPE_APPLI
#define XFCE_DBUS_OBJECT_PATH "/org/xfce/SessionManager"
#define XFCE_DBUS_INTERFACE "org.xfce.Session.Manager"
#define XFCE_DBUS_CLIENT_INTERFACE "org.xfce.Session.Client"
#define GNOME_SCREENSAVER_DBUS_NAME "org.gnome.ScreenSaver"
#define GNOME_SCREENSAVER_DBUS_OBJECT_PATH "/org/gnome/ScreenSaver"
#define GNOME_SCREENSAVER_DBUS_INTERFACE "org.gnome.ScreenSaver"
static void
unregister_client (GtkApplicationImplDBus *dbus)
@@ -171,6 +175,63 @@ stash_desktop_autostart_id (void)
g_unsetenv ("DESKTOP_AUTOSTART_ID");
}
static void
screensaver_signal_session (GDBusProxy *proxy,
const char *sender_name,
const char *signal_name,
GVariant *parameters,
GtkApplication *application)
{
gboolean active;
if (!g_str_equal (signal_name, "ActiveChanged"))
return;
g_variant_get (parameters, "(b)", &active);
gtk_application_set_screensaver_active (application, active);
}
static void
screensaver_signal_portal (GDBusConnection *connection,
const char *sender_name,
const char *object_path,
const char *interface_name,
const char *signal_name,
GVariant *parameters,
gpointer data)
{
GtkApplication *application = data;
gboolean active;
GVariant *state;
if (!g_str_equal (signal_name, "StateChanged"))
return;
g_variant_get (parameters, "(o@a{sv})", NULL, &state);
g_variant_lookup (state, "screensaver-active", "b", &active);
gtk_application_set_screensaver_active (application, active);
}
static void
create_monitor_cb (GObject *source,
GAsyncResult *result,
gpointer data)
{
GDBusProxy *proxy = G_DBUS_PROXY (source);
GError *error = NULL;
GVariant *ret = NULL;
ret = g_dbus_proxy_call_finish (proxy, result, &error);
if (ret == NULL)
{
g_warning ("Creating a portal monitor failed: %s", error->message);
g_error_free (error);
return;
}
g_variant_unref (ret);
}
static void
gtk_application_impl_dbus_startup (GtkApplicationImpl *impl,
gboolean register_session)
@@ -195,6 +256,9 @@ gtk_application_impl_dbus_startup (GtkApplicationImpl *impl,
dbus->object_path = g_application_get_dbus_object_path (G_APPLICATION (impl->application));
dbus->unique_name = g_dbus_connection_get_unique_name (dbus->session);
if (gtk_should_use_portal ())
goto out;
g_debug ("Connecting to session manager");
/* Try the GNOME session manager first */
@@ -236,6 +300,27 @@ gtk_application_impl_dbus_startup (GtkApplicationImpl *impl,
if (!register_session)
goto out;
dbus->ss_proxy = gtk_application_get_proxy_if_service_present (dbus->session,
G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START |
G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES |
G_DBUS_PROXY_FLAGS_NONE,
GNOME_SCREENSAVER_DBUS_NAME,
GNOME_SCREENSAVER_DBUS_OBJECT_PATH,
GNOME_SCREENSAVER_DBUS_INTERFACE,
&error);
if (error)
{
g_debug ("Failed to get the GNOME screensaver proxy: %s", error->message);
g_clear_error (&error);
g_clear_object (&dbus->ss_proxy);
}
if (dbus->ss_proxy)
{
g_signal_connect (dbus->ss_proxy, "g-signal",
G_CALLBACK (screensaver_signal_session), impl->application);
}
g_debug ("Registering client '%s' '%s'", dbus->application_id, client_id);
res = g_dbus_proxy_call_sync (dbus->sm_proxy,
@@ -336,7 +421,7 @@ gtk_application_impl_dbus_startup (GtkApplicationImpl *impl,
"gtk-shell-shows-menubar", FALSE,
NULL);
if (dbus->sm_proxy == NULL)
if (dbus->sm_proxy == NULL && dbus->session)
{
dbus->inhibit_proxy = gtk_application_get_proxy_if_service_present (dbus->session,
G_DBUS_PROXY_FLAGS_NONE,
@@ -348,8 +433,43 @@ gtk_application_impl_dbus_startup (GtkApplicationImpl *impl,
{
g_debug ("Failed to get an inhibit portal proxy: %s", error->message);
g_clear_error (&error);
goto end;
}
if (register_session)
{
char *token;
GVariantBuilder opt_builder;
/* Monitor screensaver state */
dbus->session_id = gtk_get_portal_session_path (dbus->session, &token);
dbus->state_changed_handler =
g_dbus_connection_signal_subscribe (dbus->session,
"org.freedesktop.portal.Desktop",
"org.freedesktop.portal.Inhibit",
"StateChanged",
"/org/freedesktop/portal/desktop",
NULL,
G_DBUS_SIGNAL_FLAGS_NO_MATCH_RULE,
screensaver_signal_portal,
impl->application,
NULL);
g_variant_builder_init (&opt_builder, G_VARIANT_TYPE_VARDICT);
g_variant_builder_add (&opt_builder, "{sv}",
"session_handle_token", g_variant_new_string (token));
g_dbus_proxy_call (dbus->inhibit_proxy,
"CreateMonitor",
g_variant_new ("(sa{sv})", "", &opt_builder),
G_DBUS_CALL_FLAGS_NONE,
G_MAXINT,
NULL,
create_monitor_cb, dbus);
g_free (token);
}
}
end:;
}
static void
@@ -510,7 +630,7 @@ gtk_application_impl_dbus_inhibit (GtkApplicationImpl *impl,
g_variant_new ("(s@usu)",
dbus->application_id,
window ? gtk_application_impl_dbus_get_window_system_id (dbus, window) : g_variant_new_uint32 (0),
reason,
reason ? reason : "",
flags),
G_DBUS_CALL_FLAGS_NONE,
G_MAXINT,
@@ -706,11 +826,28 @@ gtk_application_impl_dbus_finalize (GObject *object)
{
GtkApplicationImplDBus *dbus = (GtkApplicationImplDBus *) object;
if (dbus->session_id)
{
g_dbus_connection_call (dbus->session,
"org.freedesktop.portal.Desktop",
dbus->session_id,
"org.freedesktop.portal.Session",
"Close",
NULL, NULL, 0, -1, NULL, NULL, NULL);
g_free (dbus->session_id);
}
if (dbus->state_changed_handler)
g_dbus_connection_signal_unsubscribe (dbus->session,
dbus->state_changed_handler);
g_clear_object (&dbus->inhibit_proxy);
g_slist_free_full (dbus->inhibit_handles, inhibit_handle_free);
g_free (dbus->app_menu_path);
g_free (dbus->menubar_path);
g_clear_object (&dbus->sm_proxy);
g_clear_object (&dbus->ss_proxy);
G_OBJECT_CLASS (gtk_application_impl_dbus_parent_class)->finalize (object);
}
+37
View File
@@ -137,6 +137,7 @@ static guint gtk_application_signals[LAST_SIGNAL];
enum {
PROP_ZERO,
PROP_REGISTER_SESSION,
PROP_SCREENSAVER_ACTIVE,
PROP_APP_MENU,
PROP_MENUBAR,
PROP_ACTIVE_WINDOW,
@@ -157,6 +158,7 @@ struct _GtkApplicationPrivate
guint last_window_id;
gboolean register_session;
gboolean screensaver_active;
GtkActionMuxer *muxer;
GtkBuilder *menus_builder;
gchar *help_overlay_path;
@@ -521,6 +523,10 @@ gtk_application_get_property (GObject *object,
g_value_set_boolean (value, application->priv->register_session);
break;
case PROP_SCREENSAVER_ACTIVE:
g_value_set_boolean (value, application->priv->screensaver_active);
break;
case PROP_APP_MENU:
g_value_set_object (value, gtk_application_get_app_menu (application));
break;
@@ -652,6 +658,24 @@ gtk_application_class_init (GtkApplicationClass *class)
FALSE,
G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS);
/**
* GtkApplication:screensaver-active:
*
* This property is %TRUE if GTK+ believes that the screensaver is
* currently active. GTK+ only tracks session state (including this)
* when #GtkApplication::register-session is set to %TRUE.
*
* Tracking the screensaver state is supported on Linux.
*
* Since: 3.24
*/
gtk_application_props[PROP_SCREENSAVER_ACTIVE] =
g_param_spec_boolean ("screensaver-active",
P_("Screensaver Active"),
P_("Whether the screensaver is active"),
FALSE,
G_PARAM_READABLE|G_PARAM_STATIC_STRINGS);
gtk_application_props[PROP_APP_MENU] =
g_param_spec_object ("app-menu",
P_("Application menu"),
@@ -1460,3 +1484,16 @@ gtk_application_get_menu_by_id (GtkApplication *application,
return G_MENU (object);
}
void
gtk_application_set_screensaver_active (GtkApplication *application,
gboolean active)
{
GtkApplicationPrivate *priv = gtk_application_get_instance_private (application);
if (priv->screensaver_active != active)
{
priv->screensaver_active = active;
g_object_notify (G_OBJECT (application), "screensaver-active");
}
}
+6
View File
@@ -45,6 +45,9 @@ void gtk_application_insert_action_group (GtkAppl
GtkApplicationAccels * gtk_application_get_application_accels (GtkApplication *application);
void gtk_application_set_screensaver_active (GtkApplication *application,
gboolean active);
#define GTK_TYPE_APPLICATION_IMPL (gtk_application_impl_get_type ())
#define GTK_APPLICATION_IMPL_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
GTK_TYPE_APPLICATION_IMPL, \
@@ -129,10 +132,13 @@ typedef struct
GDBusProxy *sm_proxy;
GDBusProxy *client_proxy;
gchar *client_path;
GDBusProxy *ss_proxy;
/* Portal support */
GDBusProxy *inhibit_proxy;
GSList *inhibit_handles;
guint state_changed_handler;
char * session_id;
} GtkApplicationImplDBus;
typedef struct
+23 -18
View File
@@ -24,16 +24,15 @@
/**
* SECTION:gtkbox
* @Short_description: A container box
* @Short_description: A container for packing widgets in a single row or column
* @Title: GtkBox
* @See_also: #GtkFrame, #GtkGrid, #GtkLayout
* @See_also: #GtkGrid
*
* The GtkBox widget organizes child widgets into a rectangular area.
*
* The rectangular area of a GtkBox is organized into either a single row
* or a single column of child widgets depending upon the orientation.
* Thus, all children of a GtkBox are allocated one dimension in common,
* which is the height of a row, or the width of a column.
* The GtkBox widget arranges child widgets into a single row or column,
* depending upon the value of its #GtkOrientable:orientation property. Within
* the other dimension, all children are allocated the same size. Of course,
* the #GtkWidget:halign and #GtkWidget:valign properties can be used on
* the children to influence their allocation.
*
* GtkBox uses a notion of packing. Packing refers
* to adding widgets with reference to a particular position in a
@@ -69,9 +68,6 @@
* fill and padding child properties.
* Use gtk_box_query_child_packing() to query these fields.
*
* Note that a single-row or single-column #GtkGrid provides exactly
* the same functionality as #GtkBox.
*
* # CSS nodes
*
* GtkBox uses a single CSS node with name box.
@@ -310,9 +306,9 @@ gtk_box_class_init (GtkBoxClass *class)
* but #GtkHBox, #GtkVBox and other subclasses use the old default
* of %TRUE.
*
* Note that the #GtkWidget:halign, #GtkWidget:valign, #GtkWidget:hexpand
* and #GtkWidget:vexpand properties are the preferred way to influence
* child size allocation in containers.
* Note: The #GtkWidget:hexpand or #GtkWidget:vexpand properties are the
* preferred way to influence whether the child receives extra space, by
* setting the childs expand property corresponding to the boxs orientation.
*
* In contrast to #GtkWidget:hexpand, the expand child property does
* not cause the box to expand itself.
@@ -327,11 +323,12 @@ gtk_box_class_init (GtkBoxClass *class)
/**
* GtkBox:fill:
*
* Whether the child should receive extra space when the parent grows.
* Whether the child should fill extra space or use it as padding.
*
* Note that the #GtkWidget:halign, #GtkWidget:valign, #GtkWidget:hexpand
* and #GtkWidget:vexpand properties are the preferred way to influence
* child size allocation in containers.
* Note: The #GtkWidget:halign or #GtkWidget:valign properties are the
* preferred way to influence whether the child fills available space, by
* setting the childs align property corresponding to the boxs orientation
* to %GTK_ALIGN_FILL to fill, or to something else to refrain from filling.
*/
child_props[CHILD_PROP_FILL] =
g_param_spec_boolean ("fill",
@@ -340,6 +337,14 @@ gtk_box_class_init (GtkBoxClass *class)
TRUE,
GTK_PARAM_READWRITE);
/**
* GtkBox:padding:
*
* Extra space to put between the child and its neighbors, in pixels.
*
* Note: The CSS padding properties are the preferred way to add space among
* widgets, by setting the paddings corresponding to the boxs orientation.
*/
child_props[CHILD_PROP_PADDING] =
g_param_spec_uint ("padding",
P_("Padding"),
-1
View File
@@ -881,7 +881,6 @@ GdkPixbuf *
gtk_clipboard_wait_for_image (GtkClipboard *clipboard)
{
GdkAtom target = gdk_atom_intern_static_string("image/tiff");
int i;
GtkSelectionData *data;
data = gtk_clipboard_wait_for_contents (clipboard, target);
+42
View File
@@ -24,7 +24,9 @@
#include "gtkcolorscaleprivate.h"
#include "gtkcolorswatchprivate.h"
#include "gtkcolorutils.h"
#include "gtkcolorpickerprivate.h"
#include "gtkgrid.h"
#include "gtkbutton.h"
#include "gtkintl.h"
#include "gtkorientable.h"
#include "gtkentry.h"
@@ -61,6 +63,9 @@ struct _GtkColorEditorPrivate
GtkAdjustment *v_adj;
GtkAdjustment *a_adj;
GtkWidget *picker_button;
GtkColorPicker *picker;
gint popup_position;
guint text_changed : 1;
@@ -353,6 +358,36 @@ popup_draw (GtkWidget *popup,
return FALSE;
}
static void
color_picked (GObject *source,
GAsyncResult *res,
gpointer data)
{
GtkColorPicker *picker = GTK_COLOR_PICKER (source);
GtkColorEditor *editor = data;
GError *error = NULL;
GdkRGBA *color;
color = gtk_color_picker_pick_finish (picker, res, &error);
if (color == NULL)
{
g_warning ("Picking color failed: %s", error->message);
g_error_free (error);
}
else
{
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (editor), color);
gdk_rgba_free (color);
}
}
static void
pick_color (GtkButton *button,
GtkColorEditor *editor)
{
gtk_color_picker_pick (editor->priv->picker, color_picked, editor);
}
static void
gtk_color_editor_init (GtkColorEditor *editor)
{
@@ -394,6 +429,10 @@ gtk_color_editor_init (GtkColorEditor *editor)
gtk_overlay_add_overlay (GTK_OVERLAY (editor->priv->overlay), editor->priv->a_popup);
gtk_style_context_remove_class (gtk_widget_get_style_context (editor->priv->swatch), "activatable");
editor->priv->picker = gtk_color_picker_new ();
if (editor->priv->picker == NULL)
gtk_widget_hide (editor->priv->picker_button);
}
static void
@@ -402,6 +441,7 @@ gtk_color_editor_dispose (GObject *object)
GtkColorEditor *editor = GTK_COLOR_EDITOR (object);
dismiss_current_popup (editor);
g_clear_object (&editor->priv->picker);
G_OBJECT_CLASS (gtk_color_editor_parent_class)->dispose (object);
}
@@ -504,6 +544,7 @@ gtk_color_editor_class_init (GtkColorEditorClass *class)
gtk_widget_class_bind_template_child_private (widget_class, GtkColorEditor, s_adj);
gtk_widget_class_bind_template_child_private (widget_class, GtkColorEditor, v_adj);
gtk_widget_class_bind_template_child_private (widget_class, GtkColorEditor, a_adj);
gtk_widget_class_bind_template_child_private (widget_class, GtkColorEditor, picker_button);
gtk_widget_class_bind_template_callback (widget_class, hsv_changed);
gtk_widget_class_bind_template_callback (widget_class, popup_draw);
@@ -514,6 +555,7 @@ gtk_color_editor_class_init (GtkColorEditorClass *class)
gtk_widget_class_bind_template_callback (widget_class, entry_apply);
gtk_widget_class_bind_template_callback (widget_class, entry_focus_out);
gtk_widget_class_bind_template_callback (widget_class, popup_edit);
gtk_widget_class_bind_template_callback (widget_class, pick_color);
}
static void

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