Compare commits

...

412 Commits

Author SHA1 Message Date
Matthias Clasen
9159e70473 quartz: Add monitor support
This is a backport of a patch by Tom Schoonjans,

https://bugzilla.gnome.org/show_bug.cgi?id=779184
2017-03-10 08:48:36 -05:00
Matthias Clasen
6a02bd4fa9 quartz: Fix another typo 2017-03-10 07:27:12 -05:00
Matthias Clasen
9caa50ca0d quartz: Fix the build
A ; was left out inadvertently.
2017-03-10 07:10:26 -05:00
William Hua
b4df881542 mir: log additional event types 2017-03-10 00:30:38 -05:00
TingPing
e387f807e4 Improve GContentType usage
Convert to content type where needed.
Should fix various issues on Windows and OS X.

https://bugzilla.gnome.org/show_bug.cgi?id=734946
2017-03-08 23:08:56 -05:00
Andika Triwidada
504321019e Update Indonesian translation 2017-03-09 03:57:10 +00:00
Andika Triwidada
4a8ad03e10 Update Indonesian translation 2017-03-09 03:56:48 +00:00
GNOME Translation Robot
112437f5ad Update Scottish Gaelic translation 2017-03-07 12:17:26 +00:00
GNOME Translation Robot
2fdcdfa403 Update Scottish Gaelic translation 2017-03-07 12:11:43 +00:00
Philip Withnall
c00448f7c6 tests: Fix use of C99 inline declaration
We don’t claim to use them yet, even if we perhaps should.
2017-03-07 09:48:44 +00:00
Daniel Boles
5bdc85d34e testheightforwidth: cleanups 2017-03-07 09:17:29 +00:00
Daniel Boles
5f24d87a5b testframe: Don’t unnecessarily query the padding
The [hv]padding variables control and hence track this.
Also, simplify the CSS using shorthand 2-value notation (again).
2017-03-07 01:32:24 +00:00
Daniel Boles
ec30a03153 testframe: Actually set the padding
The CSS was targeting node GtkFrame, which is wrong: it is called frame.

This commit also assumes the interesting padding is that between the
border and the child widget, not the padding around the entire Frame.
Some additional hoops must be jumped through to preserve padding values
not being changed in either callback. However, the way this is done
means I must set the initial paddings to 0, which simplifies main().
2017-03-07 01:04:34 +00:00
Daniel Boles
685493075f testframe: Add CheckButton to toggle border off/on
We should test this.
2017-03-07 01:04:34 +00:00
Daniel Boles
39d5f22774 testframe: Order controls better & improve labels
The :label-widget is drawn before the child, so put the controls that
set the alignment of the :label-widget before those that pad the child.

We set (horizontal|vertical) padding, not "[xy]thickness". Also change
to "label [xy]align" & use grid spacing, not spaces at end of Labels.
2017-03-07 01:04:34 +00:00
Daniel Boles
9f1916f29e testframe: Minimise typecasts 2017-03-07 01:02:08 +00:00
Daniel Boles
5059348d9f testframe: Set value before connecting callbacks
The value comes from the widget, and we were setting this after
connecting the callback, which applies the value to the widget…
2017-03-07 01:02:08 +00:00
Daniel Boles
4bec5432ce testframe: Use a generic widget pointer 2017-03-07 01:02:08 +00:00
Daniel Boles
0349574b47 testheightforwidth: Add missing unref 2017-03-06 20:57:17 +00:00
Daniel Boles
77f01c374b testheightforwidth: Remove deprecations & clean up
cherry-pick of master commit bf0ea7b7bc
2017-03-06 20:50:33 +00:00
William Hua
e63d4111a4 mir: don't create GDK_INPUT_ONLY windows 2017-03-06 13:12:22 -05:00
Jakub Steiner
41d3f99e44 Adwaita: border for selmode checkboxes
- there was an extra border for selection mode
2017-03-06 15:35:14 +01:00
Daniel Boles
629c931f1f Frame: Fix another piece of .flat documentation 2017-03-06 07:19:30 +00:00
Matthias Clasen
7160e3a12f Quartz: Implement gdk_window_set_functions
This is useful, and easy to implement.
2017-03-05 22:53:03 -05:00
Daniel Boles
31832f8648 Revert move of .flat from frame > border to frame
Changing code to agree with docs, which said frame.flat, was backwards.
Mea culpa. Theme authors ran with the actual behaviour, not the docs. As
stability is more important, let’s go back to frame > border.flat, and
fix the docs to reflect what the code does and how to set .flat in code.

N.B. This retains the change in HighContrast of "frame border" to "frame
> border". Not using the direct child selector contradicted Adwaita &
could conceivably have unwanted results on nested nodes named border.

https://bugzilla.gnome.org/show_bug.cgi?id=778905
2017-03-05 18:23:43 +00:00
Inaki Larranaga Murgoitio
06cf2c84a4 Update Basque language 2017-03-04 17:43:00 +01:00
Changwoo Ryu
e4bbb5bb0b Update Korean translation 2017-03-03 17:01:12 +00:00
Changwoo Ryu
d65851f7db Update Korean translation 2017-03-03 17:00:52 +00:00
Inaki Larranaga Murgoitio
7dcb94579a Update Basque language 2017-03-03 12:58:52 +01:00
Inaki Larranaga Murgoitio
de9a399eaa Update Basque language 2017-03-03 12:57:34 +01:00
Inaki Larranaga Murgoitio
a6432cc6d0 Update Basque language 2017-03-03 12:50:41 +01:00
Inaki Larranaga Murgoitio
ff779af97f Update Basque language 2017-03-03 12:47:55 +01:00
Chun-wei Fan
76d7c0bbed build/Makefile.msvcproj: Remove MSVC 2017 projects before re-generation
This ensures a fresh version from the 2010 projects are copied and
processed.
2017-03-03 17:35:28 +08:00
Daniel Boles
02b5886975 themes: Actually fix the frame.flat style class
by changing the source scss, not just the generated css files.

Thanks to Christoph Reiter for pointing this out!
2017-03-03 08:44:30 +00:00
Daniel Boles
0bada2506e HighContrast/parse-sass.sh: Use a reliable shebang
/usr/bin/sh does not exist on e.g. Debian sid.
Use the same shebang as Adwaita/parse-sass.sh
2017-03-03 08:42:34 +00:00
Daniel Boles
17da1e9f35 Adwaita: :insensitive is deprecated; use :disabled 2017-03-02 18:59:25 +00:00
Daniel Boles
d6166921a8 Adwaita: Restore documented behaviour of .flat
This was changed in commit 0c20604932
but got clobbered by commit 8817c1ad6d
2017-03-02 18:45:37 +00:00
Timm Bäder
f7479bf369 placesview: Simplify button construction 2017-03-02 18:16:58 +00:00
Timm Bäder
1880cf48ad placessidebar: Fix css node name typo 2017-03-02 18:16:58 +00:00
Timm Bäder
e44e7ba0df widgetnode: Remove unused define 2017-03-02 18:16:58 +00:00
Timm Bäder
ec8192420e cssnodestylecache: Use const pointer in lookup 2017-03-02 18:16:58 +00:00
Carlos Garnacho
4b38a39c9d gtk-demo: Add 3fg touchpad swipe handling to gestures demo
We can handle those on wayland, so we should show it's possible.
2017-03-02 18:21:36 +01:00
Carlos Garnacho
76af1904db gtkgesturesingle: Fallback to GtkGesture handling on GDK_TOUCHPAD_SWIPE
There are GtkGestureSingle subclasses that can be made to handle multiple
fingers (GtkGestureSingle is a subclass of GtkGesture, and not the
opposite, after all). And GtkGestureSwipe already tries to handle
GDK_TOUCHPAD_SWIPE events, except this event handler silently ignores
those.

Falling back to the GtkGesture generic handler which already
handles touchpad gesture events fixes this.
2017-03-02 18:21:36 +01:00
Matthias Clasen
cf1e2b9042 Convince OS X to fully fullscreen windows
We typically want to have the full screen given to
the content, not the aspect-ratio preserving behavior
that newer OS X has.

https://bugzilla.gnome.org/show_bug.cgi?id=779383
2017-03-02 08:12:37 -05:00
Sveinn í Felli
36e1761c84 Update Icelandic translation 2017-03-02 12:59:38 +00:00
Ask Hjorth Larsen
313ae3ad01 Updated Danish translation 2017-03-02 13:23:27 +01:00
Ask Hjorth Larsen
ecdd353266 Updated Danish translation 2017-03-02 13:21:24 +01:00
Sveinn í Felli
fb53855fc8 Update Icelandic translation 2017-03-02 11:54:46 +00:00
Jakub Steiner
fc81dc17d4 Adwaita: style selectionmode checks for flowbox tiles
- continue being asset based rather than drawn by CSS
- using node 'check' rather than style '.check'

https://bugzilla.gnome.org/show_bug.cgi?id=779074
2017-03-02 12:39:02 +01:00
Jakub Steiner
8817c1ad6d Adwaita: style flowbox tiles
https://bugzilla.gnome.org/show_bug.cgi?id=779073
2017-03-02 12:29:20 +01:00
William Hua
6f3d1e1046 mir: deprecate gdk_mir_window_get_mir_surface () 2017-03-01 15:31:54 -05:00
William Hua
45d33b063f mir: delete commented debug output 2017-03-01 15:31:52 -05:00
William Hua
7949069b9d mir: migrate away from deprecated mir api 2017-03-01 15:31:41 -05:00
William Hua
a497938358 mir: move #include to correct file 2017-03-01 15:31:32 -05:00
Matthias Clasen
953abc19da Implement backdrop for Quartz
We need to send window state change events to make GTK+
pick up on focus changed for backdrop.

https://bugzilla.gnome.org/show_bug.cgi?id=779392
2017-03-01 11:49:42 -05:00
Matthias Clasen
60e7e15f54 quartz: Let CSD windows be fullscreen
I've found that I need this patch to make it possible for
windows with headerbar to be made fullscreen on OS X.

https://bugzilla.gnome.org/show_bug.cgi?id=779383
2017-03-01 11:49:31 -05:00
Olivier Fourdan
aebe3a74ec wayland: make sure to clear up the number of keys
Make sure to clear up the number of keys being pressed on enter/leave so
that we don't end up with leftovers if a new window is mapped by a
keyboard shortcut.

https://bugzilla.gnome.org/show_bug.cgi?id=779374
2017-03-01 16:09:40 +01:00
cedlemo
75e98fd252 Fix bad check of GtkActionPadType in gtk_pad_controller_set_action
https://bugzilla.gnome.org/show_bug.cgi?id=779317
2017-03-01 12:56:45 +01:00
Matthias Clasen
c391417838 3.22.9 2017-02-27 17:57:11 -05:00
Daniel Boles
ce1b2bef2b Range: Remove leftover comment about update policy
Update policies were removed way back in 2011… in
commit c43a31ea33
2017-02-27 20:04:51 +00:00
Daniel Mustieles
20ee36f9e0 Updated Spanish translation 2017-02-27 18:51:24 +01:00
Daniel Mustieles
bd4f861727 Updated Spanish translation 2017-02-27 18:50:54 +01:00
Balázs Meskó
a9c70c4fe6 Update Hungarian translation 2017-02-27 14:19:41 +00:00
Olivier Fourdan
4146d7f3cc wayland: do not cancel key repeat on key press
The key repeat is stopped as soon as a key is pressed, so if the user
quickly presses a key while another is already pressed and being
repeated, key repeat gets cancelled:

 - key1 press
 - key1 repeat
 - key2 press -> key1 repeat stopped
 - key1 release
 - key 2 is not repeated even though it's kept depressed

This is a different behavior from X11, which confuses migrating users.

To mimic the X11 behavior, keep track of the number of keys pressed
simultaneously and cancel key repeat only when none is pressed.

This way, if a user pressed a key while another one is being repeated,
the new key press can possibly be repeated as well.

Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=778019
2017-02-27 10:14:49 +01:00
Chao-Hsiung Liao
7c09153d20 Update Chinese (Taiwan) translation 2017-02-27 00:02:49 +00:00
Chao-Hsiung Liao
e2666ba96d Update Chinese (Taiwan) translation 2017-02-26 23:59:54 +00:00
Fran Dieguez
c676d4268e Update Galician translation 2017-02-26 21:45:21 +00:00
Fran Dieguez
6259794709 Update Galician translation 2017-02-26 21:42:22 +00:00
Мирослав Николић
a6c925e836 Updated Serbian translation 2017-02-26 15:33:37 +01:00
Christian Kirbach
8d3102e1a9 Update German translation 2017-02-25 19:51:35 +00:00
Aurimas Černius
375a68fc6b Updated Lithuanian translation 2017-02-25 18:21:42 +02:00
Milo Casagrande
29f2da5587 Update Italian translation 2017-02-24 13:16:16 +00:00
Olivier Fourdan
68188fc948 wayland: Fix a race condition with xdg_popup resize
When resizing an xdg_popup immediately after the initial mapping, there
is a race condition between the client and the compositor which is
processing the initial size given by the xdg_positioner, leading to the
xdg_popup to be eventually of the wrong size.

Only way to make sure the size is correct in that case is to hide and
show the window again. Considering this occurs before the initial
configure is processed, it should not be noticeable.

https://bugzilla.gnome.org/show_bug.cgi?id=772505
2017-02-24 10:03:50 +01:00
Daniel Boles
c3a2e0035c Revert "Inspector: Use Title Case for labels & menu items"
This reverts commit 85f2c5f830.

I absent-mindedly forgot the string freeze; sorry.

https://bugzilla.gnome.org/show_bug.cgi?id=779147
2017-02-23 19:22:39 +00:00
Daniel Boles
85f2c5f830 Inspector: Use Title Case for labels & menu items
https://developer.gnome.org/hig/stable/writing-style.html.en

https://bugzilla.gnome.org/show_bug.cgi?id=779147
2017-02-23 19:15:03 +00:00
Daniel Boles
06f7728631 ComboBox: rm pointless var in get_popup_accessible 2017-02-23 18:47:19 +00:00
Olivier Fourdan
e5b6375914 gdkwindow: subsurface in gdk_window_get_effective_parent()
When the GtkWidget hierarchy does not match the GdkWindow hierarchy, the
GtkWidget code may find a common ancestor that cannot be found while
traversing the GdkWindow tree using gdk_window_get_effective_parent().

This happens with for example on Wayland, a GtkPopover has another
GtkPopover as parent, in this case, the GdkWindow parent is the root
window, whereas the GtkWidget parent is the other GtkPopover.

That confuses the gtk_widget_translate_coordinates() logic which will
bail out in this case and won't return the translated coordinates.

Make gdk_window_get_effective_parent() aware of subsurfaces and use the
transient_for which represents the actual parent (whereas the parent
might be pointing to the root window).

Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=774148
2017-02-23 14:10:56 +01:00
Daniel Boles
03429df872 TextView—Avoid pointless Pango in iter_line_is_rtl
Get the direction that was already worked out and stored in the
TextLineDisplay, rather than making Pango figure it out again.

https://bugzilla.gnome.org/show_bug.cgi?id=136059
2017-02-22 21:29:16 +00:00
Daniel Boles
00b8b18795 TextView—Plug a memory leak
Thanks to Nelson Benitez for pointing this out.

https://bugzilla.gnome.org/show_bug.cgi?id=136059
2017-02-22 21:29:16 +00:00
Daniel Boles
188929e2ea Revert "testsuite/scrolledwindow—Test non-overlay/non-auto"
This reverts commit fbd876fe93.

Reverting until I can be sure gtkscrolledwindow.c does the right thing.

https://bugzilla.gnome.org/show_bug.cgi?id=778853
2017-02-22 19:32:32 +00:00
Daniel Boles
555847d44f Revert "ScrolledWindow—Don’t req size for auto-hidden bars"
This reverts commit 367e021652.

This causes criticals in e.g. the Text View: Multiple Buffers demo.
More work is required to get a fix for Bug 778853 that does not cause
anything else to regress.

https://bugzilla.gnome.org/show_bug.cgi?id=778853
2017-02-22 19:16:33 +00:00
Daniel Boles
4e61aaa0a4 Scale: Fix erroneously removed : in a signal doc 2017-02-22 08:53:05 +00:00
Daniel Boles
13f781d99d Frame—Note set_label always destroys :label-widget
The fact that it doesn’t reuse the existing GtkLabel if present is not
immediately obvious to users (or is it just me?), so clarify that the
pre-existing :label-widget, if any, is always removed and replaced.
2017-02-21 21:21:25 +00:00
Daniel Boles
42108a82c7 Frame—Clarify relationship of :shadow-type & .flat 2017-02-21 21:13:43 +00:00
Florian Müllner
2e4fb45435 GtkFrame: Fix shadow after theme changes
Commit 0c20604932 changed the theme to expect the .flat class on
the frame node rather than the border one, but didn't update the
code that applies the style according to the :shadow-type property.

https://bugzilla.gnome.org/show_bug.cgi?id=779005
2017-02-21 13:03:39 +00:00
Rafael Fontenelle
f3b3acfe53 Update Brazilian Portuguese translation 2017-02-21 10:21:52 +00:00
Anders Jonsson
4f7e9bf25f Update Swedish translation 2017-02-19 18:11:34 +00:00
Piotr Drąg
22ca110a60 Update Polish translation 2017-02-19 18:26:19 +01:00
Daniel Boles
cc0e6eb374 Frame: Explain the .flat style class 2017-02-19 17:17:41 +00:00
Daniel Boles
fbd876fe93 testsuite/scrolledwindow—Test non-overlay/non-auto
It was only testing the default configuration where overlay-scrolling is
TRUE and the policy is POLICY_AUTOMATIC. We should also test FALSE and
POLICY_ALWAYS. This commit adds those tests and makes the !overlay &&
POLICY_ALWAYS case pass by excluding the size of the relevant scrollbar,
as we are only interested in whether the content size is as requested.

https://bugzilla.gnome.org/show_bug.cgi?id=778853
2017-02-19 12:48:22 +00:00
Daniel Boles
367e021652 ScrolledWindow—Don’t req size for auto-hidden bars
POLICY_AUTOMATIC means scrollbars are only shown when needed, i.e. when
the size of the window is not large enough to show the entire child. So
when measuring the preferred size, such scrollbars should be ignored.

But measure() was adding size for bars for which policy_may_be_visible()
was TRUE, which it returns for POLICY_ALWAYS (good) & _AUTOMATIC (bad).
So we reserved space for child plus scrollbars, & because we have enough
space for the child, POLICY_AUTOMATIC hides the scrollbar, leaving the
extra reserved space empty at the right/bottom sides of the child. This
is very noticeable/inconvenient for non-overlay, automatic scrollbars.

Fix this by only requesting size for scrollbars that use POLICY_ALWAYS,
rather than basing the decision on policy_may_be_visible().

https://bugzilla.gnome.org/show_bug.cgi?id=778853
2017-02-19 12:48:22 +00:00
Daniel Boles
3e5d5f8899 TextView—Fix inverted movements by arrows in RTL
Using Ctrl + left/right to skip between words, or left/right to cancel a
selection, were causing movement on the screen in the opposite direction
of the glyph on the key. This was surprising and awful UX for RTL users.

This is based on a patch covering the former case by:
Author:    Mehdi Sadeghi <mehdi@mehdix.org>
Date:      Sat Feb 18 02:16:00 2017 +0000

https://bugzilla.gnome.org/show_bug.cgi?id=136059
2017-02-19 12:38:54 +00:00
Daniel Boles
393e7aacc6 Entry: Add newlines to ease reading huge switches
These are monstrosities!
2017-02-19 12:38:54 +00:00
Daniel Boles
a3d70b4ab2 Entry—Fix inverted movements by arrow keys in RTL
Using Ctrl + left/right to skip between words, or left/right to cancel a
selection, were causing movement on the screen in the opposite direction
of the glyph on the key. This was surprising and awful UX for RTL users.

This is based on a patch covering the former case by:
Author:    Ori Avtalion <ori@avtalion.name>
Date:      Tue Apr 20 08:06:23 2010 +0000

https://bugzilla.gnome.org/show_bug.cgi?id=136059
2017-02-19 12:38:53 +00:00
Daniel Boles
0c20604932 themes: Actually apply the frame.flat style class
The docs say that this class should be put on the frame node, and that’s
all we can do from C code, but the CSS was selecting on the border node.
The result was that adding .flat did not disable the border as expected.

https://bugzilla.gnome.org/show_bug.cgi?id=778905
2017-02-19 12:22:48 +00:00
Daniel Boles
563063d66b Scale: Fix signal documentation syntax
Oops, sorry. Thanks to Cristoph Reiter for correcting me on this.
2017-02-19 10:13:34 +00:00
Daniel Boles
0478bfd37b Scale: Improve docs of format-value property 2017-02-19 09:12:17 +00:00
Daniel Boles
b3b2f6b5d4 Scale: Improve docs of prop digits in other places
There were places still implying that it was only used for display.
2017-02-19 09:04:17 +00:00
Daniel Boles
ee6c514406 Scale: consistent #Class:signal-or-property syntax
Use : everywhere, not a mixture of : and ::
2017-02-19 09:04:17 +00:00
Руслан Ижбулатов
f9df0fc94c GDK W32: Handle drivers that do not send WT_CSRCHANGE after WT_PROXIMITY
Some drivers don't do that (not sure whether that is the correct behaviour
or not). Remember each WT_PROXIMITY with LOWORD(lParam) != 0 that we get,
then look for a WT_CSRCHANGE. If WT_CSRCHANGE doesn't come, but a WT_PACKET
does, assume that this device is the one that sent WT_PROXIMITY.

Also include fallback code to ensure that WT_PACKETs for an enabled device
disable the system pointer, because WT_PROXIMITY handler might have
enabled it by mistake, since it's not possible to know which device left
the proximity (it might have been a disabled device).

https://bugzilla.gnome.org/show_bug.cgi?id=778328
2017-02-19 07:12:13 +00:00
Руслан Ижбулатов
1d0fad3d70 GDK W32: Apply HiDPI scale properly to monitors
Previously HiDPI scale was retrieved and applied too late in the initialization
process to affect monitor size and monitor workarea size, but the code that
initializes these sizes *did* try to use the scale, even though it was always
getting scale=1.

To fix this, move the too-late code into monitor enumeration routine.
This also fixes a probable semantic bug where width and height were divided
by scale, again.

Now monitor and workarea should be in application pixels (i.e. divided by scale),
as intended.

https://bugzilla.gnome.org/show_bug.cgi?id=778835
2017-02-19 07:00:17 +00:00
Daniel Boles
11f81e77f9 CssSelector: Fix warning for bad pseudo-class name
It was "Missing name of pseudo-class", but the real problem is exactly
the opposite: we /have/ been given a name, but it is not a valid one.
Change it to "Invalid name of pseudo-class" to minimise confusion.
2017-02-18 21:03:47 +00:00
Daniel Boles
a6ba8df4b7 testsuite/gtk/textiter: Add missing assertion
gboolean ret for whether gtk_text_iter_backward_line() moved the iter
was declared but not used anywhere. I presume it was meant to be
checked, and it passes now, so let’s do it.
2017-02-18 20:18:05 +00:00
Nelson Benítez León
c4874aeaa5 textiter: fix bug in gtk_text_iter_backward_line()
gtk_text_iter_backward_line() checks the value of
real->line_char_offset without previously calling
ensure_char_offsets (real) to make sure the former
is up-to-date.

As a consequence of this, when gtk_text_iter_backward_line()
is called after a gtk_text_buffer_insert_range() in the
first line of buffer, the iter is not moved to the start of
the line, and the return value is wrong.

Fixed by adding the ensure_char_offsets() call.

A test case for this bug is added to the textiter gtk testsuite.
2017-02-18 20:00:32 +00:00
Daniel Boles
6cdeac1c6a Image—Add some more missing (nullable) annotations 2017-02-17 22:13:48 +00:00
Timm Bäder
a729eeab0a filechooserentry: Avoid an uninitialized value
|= with a garbage value on the left side results in a still-garbage
value.
2017-02-17 21:46:51 +00:00
Timm Bäder
42d8b70b0e filechooserwidget: Fix profiling code compilation 2017-02-17 21:46:51 +00:00
Timm Bäder
8aa9fb38a3 Add a few missing (nullable) annotations 2017-02-17 21:46:51 +00:00
Timm Bäder
98c04230c3 builder: avoid an uninitialized value
When g_module_supported() returns FALSE, args.module is garbage
otherwise.
2017-02-17 21:46:51 +00:00
Timm Bäder
26cab782cd filechooserwidget: Fix rename popover position calculation
Since the browse_file_popover is positioned correctly, just convert the
coordinates in the same way we do there.

https://bugzilla.gnome.org/show_bug.cgi?id=778746
2017-02-17 21:46:51 +00:00
Carlos Garnacho
d825c34ca3 gdk: Ensure GdkDragContext instantly updates drag window position
Otherwise we wait for the next gdk_drag_motion() call, which will
happen on the next motion event, making the drag window briefly visible
on the 0,0 root coordinates.

https://bugzilla.gnome.org/show_bug.cgi?id=778203
2017-02-17 19:30:46 +01:00
Daniel Boles
fdc79c804a docs/css-properties: Fix info on 3value properties
https://developer.mozilla.org/en/docs/Web/CSS/margin#Values
2017-02-17 15:18:16 +00:00
Chun-wei Fan
c6f0df26f6 Visual Studio builds: Support Visual Studio 2017
Update the autotools scripts so that we can support Visual Studio 2017
by copying the 2010 projects and updating items as needed to obtain
the 2017 projects.

Note that since the toolset version string changed for Visual Studio
2017, so allow the use of a custom toolset version string, otherwise
just generate the toolset version string as we did before.

Also, note that Visual Studio 2017 aims to be compatible with 2015
on the CRT level, so there should not be any problems using 2017-compiled
binaries with 2015-compiled ones.
2017-02-17 15:09:16 +08:00
Bastien Nocera
eca35180f9 docs: Advise to use gtk_show_uri_on_window()
Instead of gtk_show_uri() which is now deprecated, and mention an
additional benefit of doing so.

https://bugzilla.gnome.org/show_bug.cgi?id=778726
2017-02-16 16:35:29 +01:00
Emmanuele Bassi
d93dd81e65 Use gtk_show_uri_on_window() in GtkLabel
Avoid the deprecated gtk_show_uri(), and allow activating link in
sandboxed applications.

https://bugzilla.gnome.org/show_bug.cgi?id=778726
2017-02-16 16:34:42 +01:00
Bastien Nocera
72ac208052 GtkMountOperation: We use gtk_show_uri_on_window() by default
Not gtk_show_uri().

https://bugzilla.gnome.org/show_bug.cgi?id=778726
2017-02-16 16:34:42 +01:00
Bastien Nocera
e4fbfde07b gtk: Ignore gtk_show_uri() deprecation warnings
https://bugzilla.gnome.org/show_bug.cgi?id=778726
2017-02-16 16:34:42 +01:00
Bastien Nocera
da0291950d GtkLinkButton: We use gtk_show_uri_on_window() by default
Not gtk_show_uri().

https://bugzilla.gnome.org/show_bug.cgi?id=778726
2017-02-16 16:34:42 +01:00
Bastien Nocera
f2febf7c71 GtkAboutDialog: We use gtk_show_uri_on_window() by default
Not gtk_show_uri().

https://bugzilla.gnome.org/show_bug.cgi?id=778726
2017-02-16 16:34:42 +01:00
Bastien Nocera
c495ffb1ba docs: Fix reference to non-existent gtk_show_uri_on_parent()
It's called gtk_show_uri_on_window().

https://bugzilla.gnome.org/show_bug.cgi?id=778726
2017-02-16 16:33:44 +01:00
Lionel Landwerlin
977b26dcf5 widget: propagate scale factor upon reparenting a widget
When a widget is created, its default scale is the scale of the
primary screen (for instance 2). But once parented to another widget
its scale factor should be the one of its parent (if parented to a
widget on a screen at scale factor 1, it should be 1).

The problem is that we don't emit the notify::scale-factor signal when
reparenting happens.

https://bugzilla.gnome.org/show_bug.cgi?id=776821
2017-02-16 12:31:57 +00:00
Daniel Boles
f8af23553b widget: Document signal mnemonic-activate
Name the extra bool argument, and move the explanatory paragraph from
the emitting method to the signal, with some minor tweaks to wording.

https://bugzilla.gnome.org/show_bug.cgi?id=778534
2017-02-15 21:45:01 +00:00
Bastien Nocera
104c9ac845 gtkshow: Prefer gtk_show_uri_on_window() which works for sandboxed apps
gtk_show_uri_on_window() will pass enough information for Portal helpers
to allow dialogue parenting in Flatpak, gtk_show_uri() won't, so
deprecate it.

https://bugzilla.gnome.org/show_bug.cgi?id=778678
2017-02-15 16:23:48 +01:00
Tong Hui
9589505e19 Update zh_CN translation 2017-02-15 20:11:27 +08:00
Matthias Clasen
dad4aecfc0 3.22.8 2017-02-13 13:28:00 -05:00
Руслан Ижбулатов
dca4f1e715 GDK W32: Different maximized window position for non-CSD windows
It seems that WM interprets the same MINMAXINFO contents differently
depending on which styles the window has. Play along.

https://bugzilla.gnome.org/show_bug.cgi?id=765161
2017-02-10 18:21:13 +00:00
Lapo Calamandrei
8f01d6c5f4 HC: insensitive styling for views. 2017-02-08 16:53:10 +01:00
Lapo Calamandrei
efde7d15aa adwaita: insensitive styling for views
Add an insensitive style to views, somehow we didn't ship one, so
for example, disabled textviews looked the same as sensitive ones.
2017-02-08 16:45:51 +01:00
Olivier Fourdan
7ec16c5c53 wayland: do not clamp anchor values
Clamping the anchor values as introduced in commit 9a5ffcd to fix bug
777176 breaks menu positioning.

By keeping the anchors rectangle size greater than zero, we end up
deducting some positive value from the original position, so there is no
need to clamp() actually, keeping the values positive is enough and
avoids the issue with menu positioning on the menubar.

An additional benefit is to make the code a lot simpler.

https://bugzilla.gnome.org/show_bug.cgi?id=778009
2017-02-06 09:19:26 +01:00
Philip Chimento
e338b4589d quartz: Implement gtk_clipboard_get_selection
This function is trivial and can be copied from the X11 implementation.

https://bugzilla.gnome.org/show_bug.cgi?id=772281
2017-02-05 14:54:37 -08:00
Chris Martin
eaf9fc60bf getting-started: typo tie->the
https://bugzilla.gnome.org/show_bug.cgi?id=775864
2017-02-05 20:01:41 +00:00
Michael Catanzaro
644c2d9617 notebook: redraw arrows after closing a tab
Thanks to Daniel Boles for helping with a crash in an earlier version of
this patch.

https://bugzilla.gnome.org/show_bug.cgi?id=777547
2017-02-04 12:54:12 -06:00
Sveinn í Felli
494d8f36aa Update Icelandic translation 2017-02-04 15:32:13 +00:00
Matthias Clasen
09b2c54d41 range: Add a queue_resize call
This is a workaround for a regression in updating scrollbars in
some applications; notably eog. We haven't fully tracked down yet
why a queue_allocation is not sufficient here, it should.

https://bugzilla.gnome.org/show_bug.cgi?id=765410
2017-02-01 21:16:29 +01:00
Daniel Boles
43de771574 searchentry: Fix typo in documentation 2017-01-31 09:47:42 +00:00
William Hua
d9947b671a mir: handle surface placement events
This allows the Mir backend to properly emit "moved-to-rect."
2017-01-30 03:40:18 -05:00
William Hua
14c8e25cb2 mir: use mir_surface_spec_set_placement for menus
This API was added to Mir for GTK menus, combo boxes, etc.
2017-01-30 03:23:50 -05:00
Michael Catanzaro
3708e5cc7c Revert "notebook: redraw arrows after closing a tab"
This reverts commit 8caaba82cc.
2017-01-27 08:53:54 -06:00
Carlos Garnacho
baa83e9753 wayland: Ensure to set gtk_surface dbus properties after hide()
Currently hiding destroys the wl_surface and all related interfaces,
(including the gtk_surface1) so the next time the GdkWindow is mapped,
we don't bother to set the DBus properties. Toggle the check off so
it's actually issued again after the GdkWindow gets a gtk_surface1.

https://bugzilla.gnome.org/show_bug.cgi?id=773686
2017-01-25 18:01:26 +01:00
Michael Catanzaro
8caaba82cc notebook: redraw arrows after closing a tab
https://bugzilla.gnome.org/show_bug.cgi?id=777547
2017-01-24 08:32:53 -06:00
William Hua
5d7db3246e mir: use modal window hint 2017-01-23 10:58:09 -05:00
William Hua
a95feb4984 mir: fix compile-time warnings 2017-01-22 11:14:34 -05:00
Daniel Boles
aff42686ce combobox: Fix documentation typo bx => box 2017-01-21 16:11:54 +00:00
Daniel Boles
167ef42c5c menushell: Don’t dereference before typechecking 2017-01-20 22:18:40 +00:00
Daniel Boles
f705d0a5fa combobox: If typechecking, don’t reference before 2017-01-20 21:07:26 +00:00
Daniel Boles
7401794de6 combobox: popdown() the menu during unmap()
combo_box_popdown() of course doesn’t popdown our menu if it is NULL.
But the required call to this at end-of-life was in destroy(), by which
point dispose() already NULLed the menu, so Menu::popdown() would never
run, even if it should. Fix this by trying popdown() earlier in unmap().
Also, add a converse assurance that we don’t popup() while not mapped.
2017-01-20 13:47:33 +00:00
Руслан Ижбулатов
4a5cd127ff GDK W32: Ensure that we use made-up monitors when there are none
Previously GDK only made up monitors when it initially found none. Now it
also makes up monitors when it initially finds some, but later fails to get
their informatin in a normal way and finally prunes them out, being left with
zero monitors.

Having zero-length monitor array is unexpected and causes a number
of critical warnings and some critical functionality (such as displaying
drop-down menus) fails in such cases.

Ideally, there might be such a way to interrogate W32 API that produces the
information about non-real (but active) monitors out of it so that it isn't
necessary for us to make stuff up. However, this code is already complicated,
and i am not prepared to dig W32 API to find a way to do this.

This fixes the issues people had when they accessed a Windows desktop via RDP.

https://bugzilla.gnome.org/show_bug.cgi?id=777527
2017-01-20 12:45:57 +00:00
Mandy Wang
e831bb6ce7 update zh_CN translation 2017-01-20 20:37:01 +08:00
Chun-wei Fan
1063460db2 demos: Fix build
Include gtk/fallback-c89.c so that we can ensure that we have round(), and
that file already includes math.h
2017-01-20 18:17:33 +08:00
Руслан Ижбулатов
a7ff95ce73 GDK W32: Fix idiotic gdk_win32_display_get_monitor() implementation
Replace the code borrowed from the X11 backend with the code borrowed from Wayland backend. Now GTK doesn't crash when the number of monitors is zero.
2017-01-20 09:08:41 +00:00
Carlos Garnacho
bbcc3ee456 Revert "wayland: Push NULL buffer when hiding a GdkWindow"
This reverts commit 0f2e19c010.
2017-01-19 21:21:57 +01:00
David King
bd3d7b8a9a docs: Add gtk_print_job_set_source_fd() 2017-01-19 18:06:38 +00:00
Carlos Garnacho
0f2e19c010 wayland: Push NULL buffer when hiding a GdkWindow
This is how windows are meant to be hidden as per the wayland
protocol, there's no need to destroy the xdg_surface and other
interfaces.

Also, rename gdk_wayland_window_hide_surface() to clear_surface(),
as that's what it does.

https://bugzilla.gnome.org/show_bug.cgi?id=773686
2017-01-19 16:18:22 +01:00
Daniel Boles
eb26b57cba combobox: Avoid a pointless assignment
Don’t get the active item pointer before the grid/non-grid conditional,
because if we’re in grid mode, we re-get it before selecting it anyway.
2017-01-19 03:26:09 +00:00
Daniel Boles
b7cfe3c778 combobox: Also preselect active item in grid popup
i.e. when wrap-width > 0. This was only being done for non-grid cases.
So, ComboBoxes in grid mode did not indicate their selection when popped
up and required users to keynav from ‘nothing’ (at the top-left) to the
item they wanted to select. By selecting the active item in advance, now
it’s highlighted & acts as the starting point for keynav around the grid
2017-01-19 03:12:32 +00:00
Daniel Boles
a58dd993b2 scale: Really fix documentation of set_digits()
This previously only mentioned its effect on the displayed value, and
even after the previous commit, its rounding of the actual value upon
change still reads like too much of an afterthought. Worse, it wasn’t
mentioned at all in the doc for the @digits parameter. Change this to
emphasise rounding always occurs and the displayed value is secondary.
2017-01-19 00:44:35 +00:00
Daniel Boles
8377850127 scale: doc: set_digits doesn’t round retroactively
Whether it should is an open question, but for now, the documentation
should clearly indicate that currently rounding is only applied upon
changes to the value, not to the existing value when ::digits changes.
This is already clear in the doc for the underlying Range::round-digits.

https://bugzilla.gnome.org/show_bug.cgi?id=358970
2017-01-19 00:17:40 +00:00
Daniel Boles
4a6bd134bd Scale: Always sync ::digits to Range::round-digits
The documents state that gtk_scale_set_digits() “causes the value of the
adjustment to be rounded off to this number of digits, so the retrieved
value matches the value the user saw.” Note the lack of any condition.

But in fact, if draw-value was false, rounding was disabled on the base
Range, so values that weren’t displayed weren’t rounded. This made the
docs wrong and made an apparently cosmetic detail alter functionality.

Fix by ensuring the number of digits set on Scale is always propagated
along to gtk_range_set_round_digits(), thus rounding to it in all cases
when the value changes, regardless of whether the value is displayed.

This doesn’t address the other idea from Bugzilla: that changing the
number of digits should clamp the _existing_ value if it’s more precise.
This contradicts digits docs in the base Range, but the above from Scale
can be read as implying it’ll happen. For now, that’s an open question.

https://bugzilla.gnome.org/show_bug.cgi?id=358970
2017-01-19 00:17:40 +00:00
Daniel Boles
ccba2eaace Remove executable bit from C source files in tests 2017-01-19 00:17:40 +00:00
Daniel Boles
e98e6f73be combobox: Work around popup handler altering model
GtkFileChooserButton installs a handler for the popped-up signal, which
refilters the menu, in order to hide the “(None)” item from the popup
if it was previously selected in the ComboBox. This oddity means that:

 • Until recently, this item would be selected in the menu shell, which
   would then be popped up and change the selection away from that item.
   This was therefore redundant (more on which below!) but benign.

 • After the patch for https://bugzilla.gnome.org/show_bug.cgi?id=771242
   however, this causes a critical assertion fail, as now we stash the
   originally selected item in a pointer so that it can be selected only
   after realisation/popup – but by that stage, the model has just been
   refiltered and the previous pointer no longer refers to a valid item.

This commit works around this problem by, after popping up the menu,
getting the active item again, in case a popped-up handler has gone and
invalidated the pointer to the active item that we saved before popup.

If a handler does this, everything done to find/use the original item is
pointless. But this avoids the ugly critical in FileChooserButton, while
not harming every other ComboBox that doesn’t mess with its model while
popping up (hopefully the vast majority), and it’s very difficult to
imagine a way to check if the active item is /going to/ be hidden later)
2017-01-18 22:22:52 +00:00
Daniel Boles
dfe89a381f combobox: Don’t select active item if it’s hidden
I hope no one ever actually brings such a silly item into this world,
but this achieves symmetry with the similar checks immediately after.
2017-01-18 22:17:37 +00:00
Daniel Boles
ac4e1625f5 combobox: Move variables into narrowest scopes 2017-01-18 21:43:42 +00:00
Matthias Clasen
31fee675e4 Revert "filechooser portal: Make sure we can save"
This reverts commit 4875c689a0.

This was a thinko. Writable is not actually settable from the
application side, but only for the user, from the backend side.
2017-01-17 14:15:39 -05:00
Matthias Clasen
f4a0f2e5ca filechooser portal: Make sure we can save
Explicitly request files for saving to be writable, otherwise
we are at the mercy of the portal, which currently gets it wrong.
2017-01-17 14:10:50 -05:00
Rui Matos
4f80d234bf gdk/wayland: Always get the seat's key modifiers from the GdkKeymap
Elsewhere we already go through the keymap to get modifiers so we
should do the same here. In fact, this was relying on xkb modifier
mask values being bitwise compatible with GdkModifierType which isn't
necessarily true.

https://bugzilla.gnome.org/show_bug.cgi?id=770112
2017-01-17 18:12:54 +01:00
Rui Matos
33c10204e4 gdk/wayland: Don't add GDK_META_MASK to gdk mod masks if MOD1 is set
Gtk+ treats MOD1 as a synonym for Alt, and does not expect it to be
mapped around, so we should avoid adding GDK_META_MASK if MOD1 is
already included to avoid confusing gtk+ and applications that rely on
that behavior.

https://bugzilla.gnome.org/show_bug.cgi?id=770112
2017-01-17 18:12:54 +01:00
William Hua
248ef2d6a0 mir: properly handle empty clipboard
https://bugzilla.gnome.org/show_bug.cgi?id=775732
2017-01-16 17:11:16 -05:00
William Hua
41732391d8 mir: paste clipboard data from content-hub
https://bugzilla.gnome.org/show_bug.cgi?id=775732
2017-01-16 17:11:16 -05:00
William Hua
5c4c3f1afd mir: copy clipboard data to content-hub
https://bugzilla.gnome.org/show_bug.cgi?id=775732
2017-01-16 17:11:16 -05:00
William Hua
210d1279e5 mir: connect to content-hub
https://bugzilla.gnome.org/show_bug.cgi?id=775732
2017-01-16 17:11:16 -05:00
William Hua
0acb58b40f mir: track focused window
https://bugzilla.gnome.org/show_bug.cgi?id=775732
2017-01-16 17:11:16 -05:00
William Hua
b6baa088dc mir: implement window properties
https://bugzilla.gnome.org/show_bug.cgi?id=775732
2017-01-16 17:11:16 -05:00
Matthias Clasen
a22e80122e 3.22.7 2017-01-16 14:10:47 -05:00
Olivier Fourdan
9a5ffcd1b5 wayland: avoid 0 width/height anchor rectangle
Passing a rectangle with zero width or height to xdg_shell-v6
set_anchor_rect() will cause a protocol error and terminate the client,
as with gedit when pressing the Win key.

Reason for this is because the rectangle used to set the anchor comes
from gtk_text_layout_get_iter_location() which uses the pango layout
width/height, which can be empty if there is not character at the given
location.

Make sure we don't use 0 as width or height as an anchor rectangle to
avoid the protocol error, and compensate the logical position of the
given rectangle if the size is changed, so that the actual position
remains as expected by the client.

https://bugzilla.gnome.org/show_bug.cgi?id=777176
2017-01-16 13:55:36 +01:00
Daniel Boles
afd19e9433 grid: Fix plural error in docs' @Short_description 2017-01-15 20:39:43 +00:00
Benjamin Otte
21a71e94c6 cssimage: Fallback images have no aspect ratio
The aspect ratio for fallback image was incorrectly set to 1.

Reftest is included.
2017-01-13 03:39:50 +01:00
Benjamin Otte
2e7d5c08cb cssimage: Scale images to contain, not cover
Images with just an aspect ratio, but without a size, should be scaled
to be fully visible in the given area.
But we scaled them to completely cover the given area, which made them
partially invisible.

Reftest included.
2017-01-13 03:39:49 +01:00
Matthias Clasen
6da8cbc87e Deprecate gdk_window_process[_all]_updates
These functions should not be used anymore now that we have a
frame clock, and are gone in GTK+ 4
2017-01-10 20:25:15 -05:00
Rui Matos
99abc6363a gdk/wayland: Handle non-existant gsettings keys
Since we're a library, crashing on gsettings keys, whose presence is out
of our control, isn't appropriate.

https://bugzilla.gnome.org/show_bug.cgi?id=775846
2017-01-10 15:18:09 +01:00
Rui Matos
22b1e0b678 gdk/wayland: Add support for the gtk-enable-primary-paste gsetting
The gsetting was recently added so that we can have this configurable
on the wayland backend too.

https://bugzilla.gnome.org/show_bug.cgi?id=775846
2017-01-10 15:18:09 +01:00
Руслан Ижбулатов
eece8a7dd2 GDK W32: Use keyboard hook to detect AeroSnap combinations better
Windows WM handles AeroSnap for normal windows on keydown. We did this
on keyup only because we do not get a keydown message, even if Windows WM
does nothing with a combination. However, in some specific cases it DOES
do something - and we have no way to detect that. Specifically, winkey+downarrow
causes maximized window to be restored by WM, and GDK fails to detect that. Then
GDK gets a keyup message, figures that winkey+downarrow was pressed and released,
and handles the combination - by minimizing the window.

To overcome this, install a low-level keyboard hook (high-level ones have
the same problem as normal message loop - they don't get messages when
Windows WM handles combinations) and use it to detect interesting key combinations
before Windows WM has a chance to block them from being processed.

Once an interesting combination is detected, post a message to the window, which
will be handled in due order.

It should be noted that this code handles key repetitions in a very crude manner.

The downside is that AeroSnap will not work if hook installation function call fails.
Also, this is a global hook, and if the hook procedure does something wrong, bad things
can happen.

https://bugzilla.gnome.org/show_bug.cgi?id=776031
2017-01-10 12:54:43 +00:00
Руслан Ижбулатов
ca79296061 GDK W32: Handle CapsLock as part of the key shift level
Instead of using some kind of flawed logic about modifying a keypress result
when CapsLock is toggled, just add a CapsLock shift level (and all derived
shift levels, i.e. Shift+CapsLock and CapsLock+AltGr and Shift+CapsLock+AltGr)
and query Windows keyboard layout API about the result of keypresses involving
CapsLock.

Keysym table is going to be (roughly) twice as large now, but CapsLock'ed
keypresses will give correct results for some keyboard layouts (such as
Czech keyboard layout, which without this change produces lowercase letters
for CapsLock->[0,2,3,4...] instead of uppercase ones).

Keymap update time also increases accordingly.

https://bugzilla.gnome.org/show_bug.cgi?id=165385
2017-01-10 07:59:53 +00:00
Daniel Boles
cc4ea94d8b revealer: Fix a typo in a function doc
Also, "ie" wasn't very clear, but fixing that to "i.e." would cause
truncation of the summary when processed by bindings using doxygen. So,
I replaced it with "in other words", which is no _less_ clear, at least.
2017-01-09 22:46:21 +00:00
Carlos Garnacho
ab66c3d7bf wayland: Disable EGL swap interval
We have a frame clock that ensures rendering is done as per the
output vsync. There is no need to have Mesa do the same for us.

This, most notably, ensures Mesa doesn't schedule frame callbacks
that will be left unattended if the compositor stops throttling
frames for its surface, this is eg. the case if the toplevel is
moved to another workspace.

Also, given a SwapInterval!=0 will always bring these unexpected
side effects, check that it's possible to disable it, and spew
a debug message if that isn't the case.

https://bugzilla.gnome.org/show_bug.cgi?id=769835
2017-01-09 19:04:23 +01:00
Carlos Garnacho
eb57651ff7 gtkdnd: Remove unnecessary call
drag-data-delete is emitted based on the interchange of the
DELETE atom, which may well be set or bypassed locally by
the app. As such emitting it here is not right, the other
paths handling the DELETE atom interchange are still valid
and there.

https://bugzilla.gnome.org/show_bug.cgi?id=774726
2017-01-09 19:04:23 +01:00
Carlos Garnacho
c4f1545c5e wayland: Add fake mimetype for local DnD cases
If there are no targets, DnD is probably intended to be local,
add a mimetype for matching then. The wayland protocol requires
at least one wl_data_offer.target call with the mimetype selected
for transfer.
2017-01-09 19:04:23 +01:00
Руслан Ижбулатов
125ef3539c GDK W32: Special handling for VK_PAUSE
Similar to VK_DIVIDE, this key can't be mapped to a scancode by
MapVirtualKeyEx(). Googling suggests that this is a known bug.

https://bugzilla.gnome.org/show_bug.cgi?id=769214
2017-01-09 15:15:52 +00:00
Руслан Ижбулатов
3326fba524 GDK W32: Change WM_SYSMENU style switch logic
Instead of checking for window state and giving it extra styles that
fit, just give it all styles that it is missing. It turned out that
otherwise it is impossible to, for example, restore a maximized window
via sysmenu. Also, be more flexible towards GDK/WM window state mismatches
and consider the window minimized/maximized if *either* GDK or WM thinks so.

https://bugzilla.gnome.org/show_bug.cgi?id=776485
2017-01-09 14:17:32 +00:00
Руслан Ижбулатов
51645b5851 GDK W32: Remove unneeded assertion
Just set check_for_dpi_awareness = TRUE and eventually it will be handled
correctly, even if setDpiAwareFunc() returns E_ACCESSDENIED or shcore functions
are NULL.

https://bugzilla.gnome.org/show_bug.cgi?id=777031
2017-01-09 10:00:22 +00:00
Matthias Clasen
074f391f10 Make GTK_DEBUG=interactive work better
We currently have various ways to initialize GTK+, and not
all of them were supporting this way of bringing up the
inspector. Fix this.

https://bugzilla.gnome.org/show_bug.cgi?id=776807
2017-01-07 19:18:09 -05:00
Aurimas Černius
ea4af401d7 Updated Lithuanian translation 2017-01-07 14:53:31 +02:00
Benjamin Otte
8b118eb8b5 gtk-demo: Make icon counter work from ui file
Gets rid of update always being 1 frame late.
2017-01-07 03:44:25 +01:00
Benjamin Otte
dd406c8062 gtk-demo: Add GtkFishbowl
Avoids usage of GtkFixed where child properties eat up all the CPU time.
And that's kinda not what I want to benchmark.
2017-01-07 03:41:33 +01:00
Benjamin Otte
a7b0af5d8d gtk-demo: Allow locking of icon count in fishbowl demo
I'm not sure I'm proud of the hack to get the changing icon into the UI
file without having to write code. But it works.
2017-01-07 03:41:33 +01:00
Jonas Ådahl
5bae71f896 wayland: Handle subsurface as popup parent
When a subsurface is used as a parent of a popup, GDK needs to traverse
up to the transient-for as the next parent, to properly find the parent
used by the popup positioner. This is because the parent of a popup
must always either be an xdg_popup or an xdg_surface, but traversing
the "parent" (in GDK terms) upwards from a subsurface will end up on
the fake root window before we hit the actual parent (in Wayland terms).

https://bugzilla.gnome.org/show_bug.cgi?id=776225
2017-01-06 10:44:54 +08:00
Matthias Clasen
bea4c0898d Revert "Make it possible to set style classes for label links"
This reverts commit 9a2527b361.

This needs more work to have a chance of working properly.
2017-01-05 19:40:40 -05:00
Matthias Clasen
41b14fd148 Revert "Use CSS for styling links in labels"
This reverts commit 34264667ed.
2017-01-05 19:40:12 -05:00
Matthias Clasen
34264667ed Use CSS for styling links in labels
This was implemented only halfway, and was hardcoding the
underline. We don't need to do that anymore.
2017-01-05 18:12:20 -05:00
Matthias Clasen
790d5960c4 Bump version to 3.22.7 2017-01-05 17:33:51 -05:00
Matthias Clasen
9a2527b361 Make it possible to set style classes for label links
This makes it possible to style links in labels differently
in certain situations.
2017-01-05 17:33:04 -05:00
Matthias Clasen
92f6bcdca6 3.22.6 2017-01-04 15:48:17 -05:00
Matthias Clasen
c7096c4586 Update expected output for a11y tests
This is a followup to the GtkAboutDialog template change.
2017-01-04 15:48:17 -05:00
Daniel Boles
eceb9add1f demos/icon-browser: increase default window size
...to get more than 1 row of icons to browse!

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

I've bumped the size a bit further, to 1024x768
2017-01-04 15:48:17 -05:00
Sébastien Wilmet
e75601c058 docs: improve the documentation of GtkEntry:attributes
See the implementation of gtk_entry_create_layout():
pango_attr_list_splice() is used to add the PangoAttrList of the preedit
string. And that is done *after* applying the PangoAttrList of the
"attributes" property.

https://bugzilla.gnome.org/show_bug.cgi?id=776868
2017-01-04 20:01:28 +01:00
Daniel Boles
7960e94112 scrolledwindow: Fix func summary being cut off in bindings using doxygen
...which treats the first '.' in doc comments as the end of the summary.
So, e.g., in gtkmm, get_kinetic_scrolling() is currently summarised as
"Changes the behaviour of @scrolled_window wrt." Not very informative!

No need for a period there & anyway, the phrase "wrt to" is superfluous,
and we have space to actually say "with regard to", so just do that now.
2016-12-31 13:28:51 +00:00
Chris Mayo
d9748563c8 GtkAboutDialog: Fix formatting of example email address in html
Signed-off-by: Chris Mayo <aklhfex@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=776524
2016-12-30 10:37:38 -05:00
Matthias Clasen
1fc3fe4a0a about dialog: Simplify the template a bit
Remove some unnecessary complications, like an extraneous
box, and some child property settings that are not needed.
2016-12-30 10:20:16 -05:00
Stas Solovey
c7dce1018b Update Russian translation 2016-12-29 16:23:12 +00:00
Matthias Clasen
f19ecbb850 Avoid a possible crash in ::activate-url handlers
If the signal handler ends up changing the label text,
the link is no longer around to update the css node.
Check for this possibility to avoid a crash here.
2016-12-29 11:08:29 -05:00
Руслан Ижбулатов
a1aee4602c GDK W32: Handle maximizing correctly for small primary monitors
When primary monitor is smaller than the actual monitor on which the
window is being maximized, the WM will do widnow size adjustments
that will completely screw the window size if we try to make it
smaller than 100% fullscreen (to account for taskbar size, for example).

Fix this by overriding maximized window size during WM_WINDOWPOSCHANGING.

https://bugzilla.gnome.org/show_bug.cgi?id=775808
2016-12-24 17:29:50 +00:00
Christian Kirbach
e0856226c5 Update German translation 2016-12-20 19:11:29 +00:00
Debarshi Ray
8155c33d80 flowbox: Don't emit child-activated while dragging the pointer
https://bugzilla.gnome.org/show_bug.cgi?id=776306
2016-12-20 12:55:41 +01:00
Debarshi Ray
9679ef6b00 flowbox: Export gtk_flow_box_get_child_at_pos as public API
Bump the gtk+ version so that others can depend on this new API.

https://bugzilla.gnome.org/show_bug.cgi?id=776187
2016-12-20 00:35:48 +01:00
Philip Chimento
30b5187e60 GtkApplication: Lack of optional components shouldn't warn
When running uninstalled tests with GtkApplication on an autobuilder with
a fake session bus, warnings will cause the tests to abort. The GNOME
session manager, the Xfce session manager, and the Inhibit portal are all
not needed for normal operation of GTK, so we should not log warnings if
they are not found.

As well as not being present on a fake session bus, it's also not
expected that they'll be present on all platforms.

https://bugzilla.gnome.org/show_bug.cgi?id=774784
2016-12-19 15:25:58 -08:00
Debarshi Ray
3073419ff1 flowbox: Don't emit selected-children-changed during destruction
https://bugzilla.gnome.org/show_bug.cgi?id=776012
2016-12-19 18:06:41 +01:00
Debarshi Ray
e779ec4b1f listbox: Don't emit selected-rows-changed, etc. during destruction
https://bugzilla.gnome.org/show_bug.cgi?id=776012
2016-12-19 18:06:41 +01:00
Debarshi Ray
bebcb5e094 flowbox: Rename gtk_flow_box_find_child_at_pos for consistency
... with gtk_list_box_get_row_at_y. It would be nice to avoid the
'find' versus 'get' discrepancy since we are planning to expose it as
public API.

https://bugzilla.gnome.org/show_bug.cgi?id=776187
2016-12-19 15:10:07 +01:00
Debarshi Ray
2b32008eeb Mention that gdk_window_create_similar_image_surface inherits the scale
https://bugzilla.gnome.org/show_bug.cgi?id=776132
2016-12-17 22:50:48 +01:00
Olivier Fourdan
78f8f236e9 wayland: apply empty input shape on parent commit
For subsurfaces, the new state which includes the input shape is not
applied by the compositor if the subsurface is in effective synchronous
mode.

So we need to apply the input shape once parent surface is in effective
desynchronized mode, which is when it's committed, otherwise the input
shape may never be applied if the widget is not using being_paint() /
end_paint() to draw on its subsurface, like clutter does.

We do that only for empty input shape as those won't need update when
the subsurface is resized, for all other non-empty input shape, the
client still has to use begin_paint()/end_paint() for the input shape to
be applied.

https://bugzilla.gnome.org/show_bug.cgi?id=774534
2016-12-15 13:30:05 +01:00
Emmanuele Bassi
da43bfd272 demo: Fix the GLES fragment shader for GLArea
We have a couple of syntax errors, like 'f' modifier for floating point
values.
2016-12-14 20:56:01 +00:00
Emmanuele Bassi
33e4826efd gl: Check for GL_EXT_framebuffer_blit before using glBlitFramebuffer
We check when we realize the GdkGLContext, but we never use the check
before using the API, and it breaks on drivers that do not implement the
extension, or on drivers that only support OpenGL ES 2.0.
2016-12-14 20:55:21 +00:00
Benjamin Otte
e04654f865 css: An opaque background does not allow omitting push_group
When the background-clip of the background is smaller than the
background-clip of blended images, not pushing a group is wrong.

Test testing exactly that included.
2016-12-13 23:01:54 +01:00
Matthias Clasen
a8991a6bea 3.22.5 2016-12-09 11:54:24 -05:00
Matthias Clasen
5b12c21d20 css nodes tests: Update expected output for progressbar
This changed since we add some more style classes now.
2016-12-09 11:54:24 -05:00
Gianvito Cavasoli
44fb5c9c70 Update Italian translation 2016-12-09 10:34:45 +00:00
Olivier Fourdan
7f39c7cbf7 wayland: destroy subsurfaces along with parents
Wayland subsurfaces can have other native window parents, but those need
to be destroyed along with the rest of the window hierarchy otherwise
an assert() is reached.

https://bugzilla.gnome.org/show_bug.cgi?id=774915
2016-12-05 10:57:04 +01:00
Lapo Calamandrei
155dbaaa14 HC: progressbar style fix
Reset styling on the progress node when trough node has the `empty'
styleclass.

See https://bugzilla.gnome.org/show_bug.cgi?id=774695
2016-12-03 16:30:23 +00:00
Lapo Calamandrei
d55aa2a859 Adwaita: progressbar style fix
Reset styling on the progress node when trough node has the `empty'
styleclass.

See https://bugzilla.gnome.org/show_bug.cgi?id=774695
2016-12-03 16:30:23 +00:00
Daniel Boles
42d7f81649 GtkProgressBar: trivial conditional optimisation
I'd hope the compiler would realise this for us, but let's be explicit.
2016-12-03 16:30:23 +00:00
Simon Steinbeiss
a793f8f243 progressbar: add empty and full classes on trough based on fill-level
Pointed out in https://bugzilla.gnome.org/show_bug.cgi?id=774695
2016-12-03 16:26:15 +00:00
Debarshi Ray
8952975304 flowbox: Fix get_child_at_index crash with an invalid index
https://bugzilla.gnome.org/show_bug.cgi?id=775525
2016-12-02 16:38:05 +01:00
Lapo Calamandrei
e6d7df7233 Adwaita: render updated assets. 2016-12-01 13:17:02 +00:00
Lapo Calamandrei
35e6a8eb0d Adwaita: update assets svg
correct colors for pointy sliders assets.
2016-12-01 13:17:02 +00:00
Daniel Boles
7fca502115 ComboBox: Do not select item before menu realised
For a menu mode CB with wrap_width == 0 and an active item, that item is
selected in gtk_combo_box_menu_popup. Selection causes the MenuShell to
activate and hence take a grab. This was done before the menu was popped
up. A patch distributed in Debian sid - after being proposed on our BZ -
revealed that on the 1st popup of any such ComboBox, within grab_add,
the MenuShell's toplevel's GdkWindow is NULL. This causes a Gdk-CRITICAL
assertion fail on the 1st time opening any such CB, on Debian and if
that patch were merged to GTK+. By selecting after popup, we ensure the
MenuShell is realised before its grab_add and so avoid the critical.

https://bugzilla.gnome.org/show_bug.cgi?id=771242
2016-12-01 12:58:59 +00:00
William Hua
f50ed5b358 gtkcombobox: pass trigger event when popping up menu
https://bugzilla.gnome.org/show_bug.cgi?id=771242
2016-12-01 12:58:59 +00:00
Daniel Boles
3971439a17 ComboBox: Fix whitespace
* Replace tabs for indentation with spaces
 * Remove whitespace at ends of lines
2016-12-01 12:58:59 +00:00
Matthias Clasen
43b2b107f1 wayland: Don't warn if we loose the compositor connection
And instead, exit cleanly. This avoids filling the logs with
these warnings from every single application that has a
connection to the compositor.
2016-11-30 13:46:34 -05:00
Matthias Clasen
c70ba3a4f0 x11: Don't warn if the display is closed
This causes a storm of warnings from all applications in the logs
whenever the display goes away, and is not useful.
2016-11-30 13:46:29 -05:00
Olivier Fourdan
57a14565c6 wayland: Check for subsurface looking up the toplevel
gdk_window_get_toplevel() walks up the windows tree looking for the
corresponding toplevel window, but needs to account for subsurfaces as
well on Wayland.

https://bugzilla.gnome.org/show_bug.cgi?id=775319
2016-11-30 10:06:40 +01:00
Matthias Clasen
197eaaacb7 gtk-demo: Add a demo for tabs
One of the least-appreciated features in pango.
It deserves a demo.
2016-11-29 16:39:21 -05:00
Matthias Clasen
f7fb610278 Don't leak a pixbuf reference in dnd
https://bugzilla.gnome.org/show_bug.cgi?id=775316
2016-11-29 14:45:41 -05:00
Matthias Clasen
17ec4f10e4 Fix reference handling in GtkScaleButton
We were leaking the adjustment, since we confuse ourselves
with a property whose initial value comes out of a template.
Stop doing that.

https://bugzilla.gnome.org/show_bug.cgi?id=775212
2016-11-28 15:04:49 -05:00
Matthias Clasen
cf4fd0d3e3 Reduce a warning to a message
The warning interferes with having a testcase to check this behavior,
so reduce this to a message.
2016-11-28 14:43:07 -05:00
Andrew Chadwick
0b129f3534 win32 event: check for NULL display or dev mgr
The recent Wintab testing revealed an interesting edge case: we cannot
for certain say that windowing system messages will not be received
while the default display and its device manager are still being set up.
We've ruled out the Wintab case now, but cannot rule out some future bit
of runtime DLL code doing stuff at this critical time.

This commit detects and avoids a potential null pointer dereference in
the message handling code while detecting grabs. Grabs don't really
exist yet, if the default display and/or its device manager are not yet
globally known.

https://bugzilla.gnome.org/show_bug.cgi?id=774379
2016-11-28 15:05:13 +00:00
Anders Jonsson
f8d90378a4 Update Swedish translation 2016-11-28 14:05:07 +00:00
Sébastien Wilmet
2f940d91a0 docs: fix a parameter name of GtkEntry::populate-popup
Trivial commit.

The documentation block refers to @widget, not @popup. @widget is a
better name since the type is GtkWidget.
2016-11-26 12:35:14 +01:00
Sébastien Wilmet
ca75748223 docs: fix docs of functions to convert layout_index <-> text_index
Trivial commit.

The documentation was swapped. The documentation for the parameters and
the return values is good.
2016-11-26 12:34:48 +01:00
Cosimo Cecchi
5282991ab9 Adwaita: make rubberband selection work again for libgd apps
libgd views still use the old style class.
2016-11-25 18:53:21 +01:00
Matthias Clasen
6c0cd1a16d Make gtk-encode-symbolic-svg work for icons with dotted names
We were producing org.symbolic.png from org.gnome.Recipes-symbolic.svg,
which is not useful. Look for the last dot in the original name, to
produce the expected org.gnome.Recipes-symbolic.symbolic.png instead.
2016-11-25 08:57:50 -05:00
Olivier Fourdan
605303681b wayland: Place subsurfaces relative to their parent
Now that subsurfaces can be created as child of another GdkWindow (and
not just the root window), they must be placed according to the location
of their parent, i.e. the abs_x/abs_y must be updated and taken into
account when placing and moving subsurfaces under Wayland.

https://bugzilla.gnome.org/show_bug.cgi?id=774917
2016-11-24 09:33:35 +01:00
Matthias Clasen
4cd8796c0e inspector: Respect text-scaling-factor value initially
This was pointed out in
https://bugzilla.gnome.org/show_bug.cgi?id=774893
2016-11-23 19:37:28 -05:00
Florian Müllner
cc6335d94d GtkLabelAccessible: Initialize link before setting parent
Since at-spi-atk commit 96621a5e95 fixed PropertyChange notifications
for AccessibleParent, setting the parent will result in a call to
ref_state_set() which assumes that the object is fully initialized.

https://bugzilla.gnome.org/show_bug.cgi?id=774939
2016-11-23 19:02:40 -05:00
Christian Hergert
ecb38bc824 inspector: ensure controller is a GtkGesture
While GtkEventController implementations today are all GtkGesture, it is
possible to create a GtkEventController manually. This is an extrac check
to ensure we only add gestures to the list.

https://bugzilla.gnome.org/show_bug.cgi?id=774760
2016-11-23 14:02:15 -08:00
Stas Solovey
dd3cf38c53 Update Russian translation 2016-11-23 20:42:59 +00:00
Matthias Clasen
43b9b7f4e6 menu: Don't leak check menu items
Pointed out in
https://bugzilla.gnome.org/show_bug.cgi?id=774686
2016-11-23 14:50:16 -05:00
Matthias Clasen
7d695068e2 notebook: Don't leak arrow gadgets
This was pointed out in
https://bugzilla.gnome.org/show_bug.cgi?id=774743
2016-11-23 14:49:15 -05:00
Matthias Clasen
da9bd46aed text handle: Don't leak adjustments
This can happen if the weak pointer is triggered before the
adjustments are unset. Pointed out in

https://bugzilla.gnome.org/show_bug.cgi?id=774790
2016-11-23 13:58:00 -05:00
Balázs Meskó
6e856f6226 Update Hungarian translation 2016-11-22 13:41:01 +00:00
Andrew Chadwick
66a08bf3a6 wintab: init only after the display is assigned
Only attempt to initialize Wintab after the display manager announces
that the first default display has been set. Fixes a segfault during
initialization of specific tablet drivers' wintab32.dlls. Add assertions
and verbose comments explaining this nonsense because this stuff is a
pain to have to keep fixing.

https://bugzilla.gnome.org/show_bug.cgi?id=774379
2016-11-22 12:52:00 +01:00
Andrew Chadwick
dd6a00bb31 wintab tilt: Check return location for validity
https://bugzilla.gnome.org/show_bug.cgi?id=774265
2016-11-22 12:17:32 +01:00
Andrew Chadwick
61a57465ea win32: Fix tilt from Wintab devices
Move the orientation sanity-checks into the packet decode func.
Rationale: the packet handling func may otherwise read beyond the end of
device->last_axis_data.

Also expand them to cope with my test Huion's weird reporting.

Also correct the azimuth angle to align with GDK's presentation.

Most importantly, fix annoying comment typo.

https://bugzilla.gnome.org/show_bug.cgi?id=774265
2016-11-22 11:22:16 +01:00
Andrew Chadwick
f40191ff19 wintab: fix skipping of odd-numbered devices
Fix a regression introduced in 4ce6d10601
which causes devices with an odd-numbered zero-based index in the list
to be passed over incorrectly. This might present as yet another "device
does not send pressure" bug for ~50% of devices out there.

This commit also closes off another potential segfault for wintab_devices
lists which have an odd length.

https://bugzilla.gnome.org/show_bug.cgi?id=774699
2016-11-21 19:12:41 +01:00
Gustavo Noronha Silva
aa1307a787 Fix off by one in check for GtkRoundedBox containing a rectangle
When checking if a rectangle is contained by the rounded box, the code
will refuse a rectangle which is the exact size as the one backing the
rounded box, since it checks for greater or equal width and height.
Check for greater only instead.

https://bugzilla.gnome.org/show_bug.cgi?id=774114
2016-11-21 11:03:36 -02:00
Matthias Clasen
5301644a3f Document gtk_menu_place_on_monitor 2016-11-19 13:53:05 -05:00
Matthias Clasen
157b630d72 Add a since tag 2016-11-19 13:29:17 -05:00
Matthias Clasen
462a5df644 docs: Add gtk_menu_place_on_monitor 2016-11-19 12:52:26 -05:00
Baurzhan Muftakhidinov
4bc2904dae Update Kazakh translation 2016-11-19 12:15:59 +00:00
Matthias Clasen
4569bb372f 3.22.4 2016-11-18 13:55:21 -05:00
Timm Bäder
dc184902d7 filechooserwidget: Forward file filter to entry
And in the entry, apply the currently used filter as a second step to
the completion items.

https://bugzilla.gnome.org/show_bug.cgi?id=773007
2016-11-18 13:29:58 -05:00
Olivier Fourdan
0b46c5b176 gdkwindow: Allow native subsurface for all parents
Under Wayland, a subsurface can have another surface as parent, but
gdk would not allow native windows if the parent is not the root window.

Allow native subsurface for all parent under Wayland, not just for the
root window.

https://bugzilla.gnome.org/show_bug.cgi?id=774475
2016-11-18 13:26:29 -05:00
Carlos Garnacho
4805780016 wayland: Keep last scale factor on surfaces after it left all outputs
This can be triggered on workspace switches, and on hidpi results in
the scale factor being reset to 1 while the window is not in the
current workspace.

https://bugzilla.gnome.org/show_bug.cgi?id=774476
2016-11-18 13:26:10 -05:00
Мирослав Николић
042e37e6cc Updated Serbian translation 2016-11-18 09:15:04 +01:00
Matthias Clasen
748a1450a8 placeview: Don't leak the file enumerator
Pointed out in https://bugzilla.gnome.org/show_bug.cgi?id=774634
2016-11-17 13:55:44 -05:00
Charles Monzat
8b334fef63 Update French translation 2016-11-17 18:47:41 +00:00
Matthias Clasen
595ef21feb docs: Fix print-related includes
Pointed out in https://bugzilla.gnome.org/show_bug.cgi?id=774614.
2016-11-17 09:35:04 -05:00
Matthias Clasen
71b859a9ce gtk-demo: Set local-only to FALSE for the file chooser
No good reason for that.
2016-11-17 08:52:28 -05:00
Michael Koloberdin
504beaddb1 gdk: Fix screen geometry detection for non-randr setups
https://bugzilla.gnome.org/show_bug.cgi?id=773601
2016-11-17 07:55:50 -05:00
Matthias Clasen
c5f6d61783 docs: Update an example
Pointed out in https://bugzilla.gnome.org/show_bug.cgi?id=774490
2016-11-17 06:24:32 -05:00
Caolán McNamara
dbcbaac982 spin entry should be a child of spin context
https://bugzilla.gnome.org/show_bug.cgi?id=774609
2016-11-17 06:10:27 -05:00
Rafael Fontenelle
0103bbf5eb Update Brazilian Portuguese translation 2016-11-17 04:21:21 +00:00
Piotr Drąg
24f5d99be9 Update Polish translation 2016-11-16 13:08:19 +01:00
Piotr Drąg
528b80a165 Update Polish translation 2016-11-16 11:43:23 +01:00
Chun-wei Fan
25fd5710f7 Visual Studio builds: Fix Broadway builds
After building GDK with broadway, we need to copy the GDK DLL from
[Release|Debug]_Broadway\bin to [Release|Debug]\bin, so that the
introspection builds can be done normally with CFG=[Release|Debug].  As we
renamed the projects, we needed to update the property sheets that does
the copying, which was accidently missed.  Fix that.
2016-11-16 11:50:32 +08:00
Marek Cernocky
13ccbd0111 Updated Czech translation 2016-11-15 14:39:14 +01:00
Matthias Clasen
7f7501b1e7 Allow replacing input file in gtk-builder-tool simplify 2016-11-15 06:14:59 -05:00
Matthias Clasen
9a257e1f6a entry: Avoid recursion in gtk_entry_ensure_layout
This was unintentional, and lead to a memory leak.
2016-11-14 15:18:25 -05:00
Lauri Kasanen
a28022e916 recent-manager: Fix a memory leak caused by "recent-manager: Add a limit to the list's size"
Signed-off-by: Lauri Kasanen <curaga@operamail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=773587
2016-11-14 14:27:03 -05:00
Matthias Clasen
14545342d5 appchooser: Plug a memory leak
We were not dropping the reference that the model gives us.

https://bugzilla.gnome.org/show_bug.cgi?id=774352
2016-11-14 14:21:17 -05:00
Matthias Clasen
cc0c286869 widget-factory: Better progressbar testing
Hook the two top progressbars up to the scale with marks.
Your turn, Lapo.
2016-11-14 08:48:24 -05:00
Olivier Fourdan
57f551a114 gtkstack: reorder size_allocate and move_window
Unlike other container widgets, GtkStack would allocate its children
prior to moving its windows, which might prevent further valid size
allocation signals to be emitted.

Re-order the size allocation of child widgets to be performed after
moving the GtkStack windows.

Thanks to Owen for spotting the real issue here.

https://bugzilla.gnome.org/show_bug.cgi?id=767713
2016-11-14 12:02:43 +01:00
Olivier Fourdan
f70039cb96 Revert "gdkwindow: configure native windows in move_native_children()"
This reverts commit 12579fe71b.
2016-11-14 12:02:40 +01:00
Olivier Fourdan
c1507cf680 Revert "gdk: Get rid of unused variables"
This reverts commit 6f7a6f769f.
2016-11-14 12:02:37 +01:00
Chun-wei Fan
a820acee00 Visual Studio builds: Fix .pc generation
We want to look for the gdk-pixbuf-2.0 package, and we should leave a space
between -ldwmapi and -lzlib1 when we enable Broadway.

Also copy the generated gdk-3.0.pc and gtk+-3.0.pc as gdk-win32-3.0.pc and
gtk+-win32-3.0.pc respectively, to be in-line with the autotools builds.
2016-11-14 16:27:21 +08:00
Chun-wei Fan
d3bdd384a1 gdkscreen-win32.c: Also define _WIN32_WINNT
As in the last commit on gdkdisplay-win32.c, we need to define that to be
0x0600 (Vista) or later so that the items needed in the Windows headers be
activated.

See: https://bugzilla.gnome.org/show_bug.cgi?id=768081#c62
2016-11-11 21:03:46 +08:00
Chun-wei Fan
27b68ff193 gdkdisplay-win32.c: Define _WIN32_WINNT
... to be for Vista (0x0600) or later.  This is so that the necessary
items in the Windows headers be activated so that the code will build
properly on mingw-w64, and we already require Vista or later for GTK+.

Thanks Ting-Wei Lan for pointing this out.

See: https://bugzilla.gnome.org/show_bug.cgi?id=768081#c62
2016-11-11 20:53:41 +08:00
Lauri Kasanen
bf560369f2 recent-manager: Add a limit to the list's size
This fixes a DOS where any app can cause all running gtk apps
to use arbitrary amounts of memory.

Originally reported against mate-panel, where running a big slideshow
in eye-of-mate caused increasing RAM usage in mate-panel.

v2: Hardcode the value
Signed-off-by: Lauri Kasanen <curaga@operamail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=773587
2016-11-10 17:10:34 -05:00
Jan Alexander Steffens (heftig)
cb53562659 gdkscreen-x11: Fix screen and monitor size calculation
The monitors are already in scaled pixels, so scaling again when retrieving
the screen size is wrong.

With GDK_SCALE unset, the initial monitor sizes are unscaled, and when the
xsettings client sets a scale > 1, the monitor sizes should be updated.

The end result is that the monitor sizes start out wrong, and get
corrected on the first xrandr event, while the screen size starts out
right and becomes wrong after the event.

This patch fixes Firefox misplacing menus and popovers when the xrandr
configuration changes while it is running.

Fix for the X11 side of

https://bugzilla.gnome.org/show_bug.cgi?id=772202
2016-11-10 15:34:39 -05:00
Matthias Clasen
275bbbf88d places sidebar: Don't leak a reference
Pointed out in https://bugzilla.gnome.org/show_bug.cgi?id=774185
2016-11-10 15:17:28 -05:00
Matthias Clasen
9e5510420c Fix a copy-paste error
Pointed out in https://bugzilla.gnome.org/show_bug.cgi?id=774185#c3
2016-11-10 15:07:45 -05:00
Matthias Clasen
53474fa404 headerbar: Don't leak widgets
We were not properly freeing separators that we end up
not using.

https://bugzilla.gnome.org/show_bug.cgi?id=774066
2016-11-10 15:04:35 -05:00
Matthias Clasen
f8900e5ac4 spinbutton: Fix some gadget handling issues
We were not adding the down_button gadget to the parent,
and we were not unreffing the button gadgets.

https://bugzilla.gnome.org/show_bug.cgi?id=774046
2016-11-10 14:47:58 -05:00
Massimo Valentini
4657e21be8 GdkGLContext: chain finalize handler
https://bugzilla.gnome.org/show_bug.cgi?id=773979
2016-11-10 14:35:06 -05:00
Thibaut Girka
f9796b01ff Fix loading cached compose tables
https://bugzilla.gnome.org/show_bug.cgi?id=773916
2016-11-10 14:33:43 -05:00
Gustavo Noronha Silva
04f3940488 cssshadowvalue: scale the blur surface by the same factor as the target
Making sure the surfaces are using the same scale factor makes it more
likely a fast path will be used when pixman gets involved, as pointed
out by Benjamin Otte.

https://bugzilla.gnome.org/show_bug.cgi?id=772075
2016-11-10 16:30:36 -02:00
Carlos Garcia Campos
255225584e printing: Do not truncate job names in GtkPrintOperation
We are currently truncating job names to 255 bytes, because that's the
maximum allowed length of job-name attribute in CUPS. This is a CUPS
limitation that GtkPrintOperation shouldn't need to know, and it
shouldn't affect other backends, that might have other limitations or
even no limitation at all. This has another side effect, that what you
set as GtkPrintOperation:job-name could be different to what you get if
the property is truncated, this is not documented in
gtk_print_operation_set_job_name(). So, I think the job name should be
truncated by the CUPS backend, right before setting the job-name
attribute.

https://bugzilla.gnome.org/show_bug.cgi?id=774097
2016-11-10 16:56:43 +01:00
Florian Müllner
0bccddb2ff wayland: Set startup ID from GApplication platform data
The GApplication platform data may contain a startup ID that on X11
is used to set the startup notification ID when activated. Do the
same on the wayland backend to make startup notifications work for
DBus-activated applications where the DESKTOP_STARTUP_ID environment
variable is not set.

https://bugzilla.gnome.org/show_bug.cgi?id=768531
2016-11-08 13:29:55 -05:00
Florian Müllner
75ee402c6a gdkdisplay-wayland: Add API to set startup notification ID
For wayland clients, the startup notification ID is currently only set
from the DESKTOP_STARTUP_ID environment variable. As that variable is
only set for clients launched via exec(), startup completion is not
indicated correctly for DBus-activated applications unless an explicit
ID is specified - usually that is not the case, as the default handling
uses gdk_notify_startup_complete().
To address this, we need API to set the startup notification ID from GTK
as we have on X11.

https://bugzilla.gnome.org/show_bug.cgi?id=768531
2016-11-08 13:29:55 -05:00
hanniedu
305f473f73 Updated Dutch translation 3.22 2016-11-08 11:05:48 +01:00
Piotr Drąg
2bdfed2da2 Update POTFILES.skip 2016-11-08 10:08:31 +01:00
Benjamin Otte
dbc0337498 range: Don't leak pointers to discarded gadgets 2016-11-08 02:25:45 +01:00
Benjamin Otte
96e7fbde2e reftests: Add reftest for the last 2 fixes
Makes sure that the clipping we do when pushing a group is at the
correct place and in particular doesn't influence shadows.
2016-11-08 02:25:45 +01:00
Benjamin Otte
a68460847e render: Draw shadows outside of potential push_group() call
Before, the shadows were clipped.
2016-11-08 02:25:45 +01:00
Benjamin Otte
34d45def37 render: Clip the correct rectangle
We translated before.
2016-11-08 02:25:45 +01:00
Matthias Clasen
11a4dcba77 Forgotten NEWS edit 2016-11-07 11:51:26 -05:00
Matthias Clasen
99fed96b44 3.22.3 2016-11-07 11:24:43 -05:00
Matthias Clasen
a61d7f7acf Avoid deprecation warnings
The recent round of deprecation additions has caused some
warnings that we should avoid.
2016-11-07 11:24:43 -05:00
Chun-wei Fan
4add92a431 GDK-Win32: Enable HiDPI support for Windows
This enables HiDPI support for GTK+ on Windows, so that the
fonts and window look better on HiDPI displays.  Notes for the current
work:

-The DPI awareness enabling can be disabled if and only if an application
 manifest is not embedded in the app to enable DPI awareness AND a user
 compatibility setting is not set to limit DPI awareness for the app, via
 the envvar GDK_WIN32_DISABLE_HIDPI.  The app manifest/user setting for
 DPI awareness will always win against the envvar, and so the HiDPI items
 will be always setup in such scenarios, unless DPI awareness is disabled.

-Both automatic detection for the scaling factor and setting the scale
 factor using the GDK_SCALE envvar are supported, where the envvar takes
 precedence, which will therefore disable automatic scaling when
 resolution changes.

-I am unable to test the wintab items because I don't have such devices
 around.

https://bugzilla.gnome.org/show_bug.cgi?id=768081
2016-11-07 15:38:02 +08:00
Hannie Dumoleyn
a64a0bc617 Updated Dutch translation 3-22 2016-11-05 17:45:58 +01:00
Piotr Drąg
bd2d1ccc13 Update POTFILES.skip 2016-11-05 08:52:07 +01:00
Benjamin Otte
04db216026 gtk-demo: Add fishbowl demo 2016-11-05 03:38:46 +01:00
Benjamin Otte
03de0c3444 widget: Deprecate gtk_widget_is_composited()
Also GtkWidget::composited-changed is gone.
2016-11-05 03:38:13 +01:00
Georges Basile Stavracas Neto
b3e3946b2f levelbar: update css nodes even when no offset value is found
GtkLevelBar supports adding custom offsets as style classes, and they
are applied whenever the :value property matches. The current code,
however, only updates any CSS nodes when an offset is found, causing
it to not update when a discrete value changes but no custom offset
is added.

Fix that by always updating the CSS nodes.

https://bugzilla.gnome.org/show_bug.cgi?id=773799
2016-11-04 12:45:03 -04:00
Rui Matos
c5a9c0db80 gdkwindow-x11: Add support for gdk_window_fullscreen_on_monitor
This way we can recommend that applications use the
fullscreen_on_monitor() API on both X and Wayland otherwise they'd
have to keep a path for each backend to achieve this functionality.

https://bugzilla.gnome.org/show_bug.cgi?id=773857
2016-11-04 12:12:06 -04:00
Lapo Calamandrei
a47a3fbd3b Adwaita: correctly style headerbars in a stack
corners are correctly rounded now. Stacked splitted headerbars are
not supported yet though.
2016-11-03 18:54:44 +01:00
Ernestas Kulik
39a8a6ef72 popover: pop down when pressing escape
Simply hiding the popover may introduce inconsistencies in application
behavior, since popping up/down is the usual use case.

https://bugzilla.gnome.org/show_bug.cgi?id=773885
2016-11-03 15:47:54 +02:00
Matthias Clasen
dbd5fb43ab Add a testcase for stacked headerbars
This currently has some theming issues.
This example is for Lapo to work those out.
2016-11-03 08:33:38 -04:00
Olivier Fourdan
209e01fd91 wayland: check valid pending cairo surface
gdk_wayland_window_attach_image() is normally called from
gdk_window_end_paint() to notify the compositor of newly staged drawing.

If any of the drawing code inadvertently dispatches the wayland event
loop (for instance with a gdk_flush() call), then it's possible that by
the time gdk_window_end_paint() is called, the staged drawing is already
destroyed.

This commit bypasses the attach_image call in scenarios where the staged
drawing is prematurely dropped.

https://bugzilla.gnome.org/show_bug.cgi?id=773274
2016-11-03 08:49:39 +01:00
Chun-wei Fan
29b2828c9d Visual Studio projects: Fix RootNamespace
This is more of a cosmetic fix, but make things more consistent across the
board.
2016-11-02 10:37:07 +08:00
Juan Pablo Ugarte
5fa8def9df Use GLSL version 110 for OpenGL 2 shaders.
According to docs and Intel legacy drivers,
GLSL version 130 is for GL 3.0 not GL 2.0/2.1

Validated files with reference compiler from
https://www.khronos.org/opengles/sdk/tools/Reference-Compiler/
2016-11-01 11:58:16 -03:00
Juan Pablo Ugarte
28ce953caa gdk/Makefile.am: fixed glsl resources extra dist files.
Use the same wildcard partern used to generate gdk.gresource.xml to include files in EXTRA_DIST var.
2016-10-31 10:14:42 -03:00
Lapo Calamandrei
0ad5d51d8a Adwaita: no rounded corners for solid-csd. 2016-10-29 17:21:23 +02:00
Chun-wei Fan
b67a1c7f39 GDK-Win32: Improve GL on Windows
Update the GDKGL implementation:

-Allow legacy contexts to be created.
-Use finer-grained attributes to ask for a pixel format when possible,
 which also adds support for anti-aliasing

In fact the changes here are required for GTKGL to work properly on
Windows for 4.x.

Note that creation of gles contexts are not done here, as the system does
not support such contexts directly on Windows, but only through means such
as ANGLE, which is a totally different issue here.

https://bugzilla.gnome.org/show_bug.cgi?id=773528
2016-10-28 16:07:02 +08:00
Chun-wei Fan
45cf4c7d57 gtk/gtkmenu.c: Avoid compound literals
We only start requiring compound literals from GTK+-3.90, so fix this so
that pre-C99 compilers can build GTK+-3.22 properly.
2016-10-28 15:49:29 +08:00
Benjamin Otte
be1af1e01b visual: Deprecate querying APIs
They are going away in 4.0 and nobody should be using them anyway.
2016-10-28 06:04:58 +02:00
Мирослав Николић
eb43c3e6b6 Updated Serbian translation 2016-10-27 19:56:03 +02:00
Sébastien Wilmet
dd91ac7086 docs: consistent get/set function order for GtkScrolledWindow
Trivial commit.

For all the other GtkScrolledWindow functions, the order was get -> set.
Except for 3 functions, so fix that.
2016-10-27 12:33:12 +02:00
Chun-wei Fan
038766a82f MSVC builds: Simplify install process for MSVC 2010+
Use a for loop to copy the logo files.  Unfortunately the MSVC 2008
projects don't like this approach, seemingly.
2016-10-27 14:44:12 +08:00
Chun-wei Fan
271211da8c build/win32/vs10/gtk3-install.vcxproj: Fix project references
There is a typo for gtk-update-icon-cache, which may cause problems
when running the install project.  Fix this.
2016-10-27 12:30:04 +08:00
Matthias Clasen
c54f348edf color chooser: Fix a problem with show-editor=TRUE
For some reason we end up allocating the colorplane widget
before it is realized, and then never initialize the surface.

Fix this by explicitly doing it on realize.

https://bugzilla.gnome.org/show_bug.cgi?id=773474
2016-10-26 14:32:28 -04:00
Sébastien Wilmet
94c6d19415 docs: fix copy/paste errors in the docs of GtkScrolledWindow
Trivial commit.
2016-10-26 15:23:16 +02:00
Sébastien Wilmet
21d0de30ac docs: update section file for GtkScrolledWindow
Trivial commit.

- More logical ordering (re-group related things).
- Add missing functions: max_content_width/height.
2016-10-26 14:39:45 +02:00
Felix Riemann
27029a79fa GtkShortcutType: Fix typos in developer documentation
https://bugzilla.gnome.org/show_bug.cgi?id=773479
2016-10-25 20:10:24 +02:00
Matthias Clasen
f2bdf6e372 3.22.2 2016-10-23 23:09:16 -04:00
Emmanuele Bassi
a1115c05be gl: Set legacy bit depending on OpenGL version
GDK defaults to asking for an OpenGL 3.2 Core Profile, but if we get a
legacy profile from the underlying windowing system, the OpenGL version
will be fixed to 3.0. If that happens, we need to set the legacy bit on
the GdkGLContext, since that bit will be used to determine the version
and type of GLSL shaders that will be used by application and toolkit
code alike.

(cherry picked from commit 31c05771e9)
Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
2016-10-23 21:28:54 +01:00
Emmanuele Bassi
4cdd4d03cc gl: Check whether use_es is positive
Now that the use_es field is an int with a possible negative value, we
cannot use it its truth value directly; we need to check if it's a
positive value, instead.

(cherry picked from commit 8e85f55240)
Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
2016-10-23 21:28:45 +01:00
Mario Blättermann
ffb1ac56a8 Update German translation 2016-10-21 23:44:55 +00:00
Matthias Clasen
e51d73afa3 Emit ::style-set after setting priv->style
This was inadvertedly changed with an optimization a while ago,
and can lead to application crashes.

https://bugzilla.gnome.org/show_bug.cgi?id=773029
2016-10-21 14:39:10 -04:00
Jonas Ådahl
3ad1677a3a GtkMenu: Try using gdk_window_move_to_rect() more often
With best-effort, try to use gdk_window_move_to_rect() more often, when
all pieces fit together. For the non-legacy paths to be triggered for
when gtk_menu_popup_for_device() or gtk_menu_popup() were used, the
following conditions must be met:

 1) There is no custom positioning function specified
 2) The menu is attached to a widget (using gtk_menu_attach_to_widget())
 3) There is a associated grab device

https://bugzilla.gnome.org/show_bug.cgi?id=772922
2016-10-21 11:55:39 -04:00
Pavel Grunt
2b527d6e97 overlay: Document availability of properties
Add missing "Since"

https://bugzilla.gnome.org/show_bug.cgi?id=773082
2016-10-21 11:53:36 -04:00
Robert Roth
6ee17810d1 Fix css documentation typo for color definition
'ligher' should be 'lighter', of course.

https://bugzilla.gnome.org/show_bug.cgi?id=773246
2016-10-21 11:44:21 -04:00
Emmanuele Bassi
803362bb5d gdk/gl: Allow autodetection for GL/GLES
If the GdkGLContext was not explicitly instructed to use or not GLES, we
can detect whether the underlying API is going to be desktop GL or GLES.

https://bugzilla.gnome.org/show_bug.cgi?id=773180
2016-10-21 11:41:43 -04:00
Adam Jackson
d40c6f180f gdk: Don't second-guess whether a context is GLES
We've already set ->use_es correctly at context creation time, all this
can possibly do is change our mind about what kind of GL we're using.

Signed-off-by: Adam Jackson <ajax@redhat.com>

https://bugzilla.gnome.org/show_bug.cgi?id=773180
2016-10-21 11:41:29 -04:00
Victor Toso
440ff48bba tests: fix clipboard test by loading correct icon
The icon name changed from "terminal" to "utilities-terminal" in
Adwaita-icon-theme.

Signed-off-by: Victor Toso <victortoso@redhat.com>

https://bugzilla.gnome.org/show_bug.cgi?id=773113
2016-10-21 11:38:19 -04:00
Matthias Clasen
eaff061b48 docs: Expand icon-palette example
Add a warning color, and show that hex colors work here.
2016-10-21 11:08:51 -04:00
Matthias Clasen
cd495a26b7 Deprecate gdk_window_set_debug_updates
This is gone in GTK+ 4, so lets deprecate it.
2016-10-21 10:55:16 -04:00
Matthias Clasen
a372f554eb Deprecate GtkContainer::child
It is gone in GTK+ 4, so let it deprecate here.
2016-10-21 10:21:44 -04:00
Matthias Clasen
72baa37452 Deprecate the gdk_window_set_background* functions
These functions are gone in GTK+ 4, so deprecate them here.
2016-10-20 14:51:31 -04:00
Matthias Clasen
796107c833 Deprecate gtk_window_set_wmclass
This function was already documented as "don't use", and it is
removed in GTK+ 4, so deprecate it properly.
2016-10-20 14:26:43 -04:00
Matthias Clasen
b109d25e8b Some forgotten deprecation cleanup 2016-10-20 13:58:49 -04:00
Matthias Clasen
0ca9b468b8 Deprecate gtk_drag_dest_set_proxy 2016-10-20 13:48:05 -04:00
Matthias Clasen
d3ad642519 Deprecate more to-be-removed screen apis
These will be removed in GTK+ 4, therefore, we're deprecating
them now.
2016-10-20 13:44:23 -04:00
Matthias Clasen
61fc7ddd87 Deprecate to-be-removed screen API
GTK+ 4 is removing the monitor-related screen APIs. We should
deprecate them in 3.22 so people know to port away from them.
2016-10-20 12:06:42 -04:00
Jaime Velasco Juan
0d104b041a win32 theme: Fix tooltip borders
https://bugzilla.gnome.org/show_bug.cgi?id=773221
2016-10-20 16:57:24 +02:00
Jaime Velasco Juan
ebd2487df2 win32 theme: Fix combobox
https://bugzilla.gnome.org/show_bug.cgi?id=773221
2016-10-20 16:57:24 +02:00
Jaime Velasco Juan
ad258bc81c win32 theme: Fix column headers
https://bugzilla.gnome.org/show_bug.cgi?id=773221
2016-10-20 16:57:24 +02:00
Jaime Velasco Juan
d47d342012 win32 theme: Fix popup window decorations
Windows such as combobox's popup were using toplevel window's borders

https://bugzilla.gnome.org/show_bug.cgi?id=773221
2016-10-20 16:57:24 +02:00
Jaime Velasco Juan
c46c744529 gtkwin32theme: delete #if 0 code
https://bugzilla.gnome.org/show_bug.cgi?id=773221
2016-10-20 16:57:24 +02:00
Jaime Velasco Juan
49f2ed37cd win32 theme: Fix scale widget
It was invisible before.

https://bugzilla.gnome.org/show_bug.cgi?id=773221
2016-10-20 16:57:24 +02:00
Jaime Velasco Juan
424b59aec6 win32 theme: No need to create a DC for GetThemePartSize
https://bugzilla.gnome.org/show_bug.cgi?id=773221
2016-10-20 16:57:24 +02:00
Jaime Velasco Juan
db41f815c7 win32 theme: use TS_TRUE in GetThemePartSize
Several styles return a size of 0x0px when using TS_DRAW, as
we don't pass a RECT to draw into.

https://bugzilla.gnome.org/show_bug.cgi?id=773221
2016-10-20 16:57:24 +02:00
Jaime Velasco Juan
bece404043 win32 theme: Fix scrollbars
The fix is only partial, when both scrollbars are visible their ends
overlap.

https://bugzilla.gnome.org/show_bug.cgi?id=773221
2016-10-20 16:57:24 +02:00
Jaime Velasco Juan
91d4879f82 Fix CSS warnings in win32 theme
https://bugzilla.gnome.org/show_bug.cgi?id=773221
2016-10-20 16:57:24 +02:00
Jaime Velasco Juan
eda51b4ef5 Fix tiny fonts in win32 theme
broken since df08fc91... (css: always get default font size in pixels)

https://bugzilla.gnome.org/show_bug.cgi?id=773221
2016-10-20 16:57:24 +02:00
Carlos Garnacho
2dfaae6737 wayland: Allow grabless xdg_popups
xdg_shell v6 allows grabless popups, whose behavior is not that
different from override redirect windows with no grab to take
keyboard input (and pointer events outside).

This means we can relax the requirement to have a grab before
creating an xdg_popup. The warning is still useful to have so
people stop relying on gdk_window_show();gdk_device_grab() being
an ok pattern to popup a window, it's been moved to wayland
implementation of gdk_device_grab() instead, so we warn if trying
to grab a GDK_WINDOW_TEMP window that's already visible.

https://bugzilla.gnome.org/show_bug.cgi?id=771694
2016-10-20 11:35:31 +02:00
Lapo Calamandrei
e75314ec17 Adwaita: make circular button border looking nice
the darker bottom border used on buttons looks bad on circular ones
so now a gradient clipped on the border-box and a transparent
border is used in that partcular case.
See https://bugzilla.gnome.org/show_bug.cgi?id=771205 for details.
2016-10-19 15:59:33 +02:00
Lapo Calamandrei
f3d78aff12 Adwaita: sass, make button mixin export a global $button_fill var
$button_fill contains the background-image property value of
buttons, having it readable outside the drawing mixin allows, for
example, stacking background images in an easier way.
2016-10-19 15:59:33 +02:00
Chun-wei Fan
d93f8b00ad Remove gtk3-install.props's during re-generation
This is to ensure the changes in the generated
build/win32/vs10/gtk3-install.props are applied in
build/win32/vs[11|12|14] as well.
2016-10-19 18:50:10 +08:00
Chun-wei Fan
b1bb8c2e85 build/: Force MSVC project file generation on Makefile.am changes
Make the Makefile.am targets for generating the Visual Studio projects re-generate the
project files and the header listings whenever the Makefile.am's that include
build/Makefile.msvcproj changes, so that whenever a source/header is added, they will
be reflected in the projects and in the property sheets that are used to copy the
headers.

Also ensure that these are applied to the vs11, vs12 and vs14 projects when this
happens, as they are copied and processed from the Visual Studio 2010 projects.
2016-10-19 18:49:14 +08:00
Lapo Calamandrei
38056d0f6e Adwaita: sass cleanup
aggregate circular button style to the main button structure.
2016-10-18 13:19:02 +02:00
Lapo Calamandrei
6660dc5186 widget-factory: use circular style class on the circular button...
...in place of the circular-button one, killing the custom style
shipped, realying on the theme style.
2016-10-18 13:19:02 +02:00
Kjartan Maraas
29e586fe2e Updated Norwegian bokmål translation from Kjartan Maraas. 2016-10-18 07:50:37 +02:00
Benjamin Otte
6f7a6f769f gdk: Get rid of unused variables 2016-10-17 15:43:03 +02:00
Aurimas Černius
bc99feffe2 Updated Lithuanian translation 2016-10-15 22:07:11 +03:00
Kjartan Maraas
00cf0587a9 Updated Norwegian bokmål translation. 2016-10-15 16:29:33 +02:00
Matthias Clasen
149351048e Avoid 0/FALSE confusion
Since this is supposedly exemplary code, lets get it right.

https://bugzilla.gnome.org/show_bug.cgi?id=772683
2016-10-14 11:17:42 -04:00
Alan Jenkins
1e2e736d0d shortcutswindow: working version of set_section_name()
(testing before+after, it actually works now)

https://bugzilla.gnome.org/show_bug.cgi?id=772926
2016-10-14 10:58:17 -04:00
Christian Hergert
17bcd0d127 menusectionbox: add support for "text-direction" attribute
This allows the use of a "text-direction" hint set to one of "none", "rtl",
or "ltr" to enforce the text direction of a "horizontal-buttons"
display-hint.

This is useful when a menu has buttons that map to physical space in the
UI and therefore must match the application widgetry.

https://bugzilla.gnome.org/show_bug.cgi?id=772775
2016-10-14 10:44:57 -04:00
Alan Jenkins
45528cf5b5 scrolledwindow: fix leak of pan_gesture
https://bugzilla.gnome.org/show_bug.cgi?id=772859
2016-10-13 09:52:00 -04:00
Alan Jenkins
29fbeea84d headerbar: fix leak of label_sizing_box
Since the widget is not added to a container, we have the responsibility
to sink the initial floating reference, and ultimately to unref it.

https://bugzilla.gnome.org/show_bug.cgi?id=772859
2016-10-13 09:51:55 -04:00
Alan Jenkins
3eb53e9e7c headerbar: fix leak of separator
https://bugzilla.gnome.org/show_bug.cgi?id=772859
2016-10-13 09:51:48 -04:00
Alan Jenkins
b3af460860 headerbar: fix leak of start_box/end_box
gtk_widget_destroy() removes widgets from their container.  However
_internal_ widgets must be unref'ed using gtk_widget_unparent() instead.
This is symmetric with the fact that these widgets were ref'ed by direct
call to gtk_widget_set_parent().  It's also the method that was used in
gtk_headerbar_destroy().

https://bugzilla.gnome.org/show_bug.cgi?id=772859
2016-10-13 09:51:42 -04:00
Alan Jenkins
4100a848a7 shortcutsgroup: fix leak of title
like previous commit, albeit simpler this time

https://bugzilla.gnome.org/show_bug.cgi?id=772859
2016-10-13 09:51:35 -04:00
Alan Jenkins
e2f5425a1d applicationwindow: fix leak of help_overlay
> Due to Gtk+ keeping a reference to the window internally,
> gtk_window_new() does not return a reference to the caller.
> To delete a GtkWindow, call gtk_widget_destroy().

Caller(s) aren't expecting a need to delete help_overlay themselves
once they've installed it.  (E.g. see gtk_application_window_added()).

I didn't notice any direct precedents, but there's a parallel in the
current implementation of gtk_container_destroy() which uses
gtk_widget_destroy() on any added widget.

This avoids leaking 100s of kB per window, when I tested nautilus.

https://bugzilla.gnome.org/show_bug.cgi?id=772859
2016-10-13 09:51:13 -04:00
Olivier Fourdan
12579fe71b gdkwindow: configure native windows in move_native_children()
ClutterEmbed on Wayland uses a subsurface and relocates it on configure
events, but when placed within a scrolled window, no configure event is
emitted and the ClutterEmbed subsurface remains static.

Emit a configure event for native windows in GdkWindow's internal
move_native_children() so that custom widgets relying on configure
events such as ClutterEmbed can relocate their stuff.

Similarly, when switching to/from normal/maximized/fullscreen states
which change the shadows' size and possibly shows/hides a header bar,
we need to emit a configure event even if the abs_x/abs_y haven't
changed to make sure the subsurface is size appropriately.

https://bugzilla.gnome.org/show_bug.cgi?id=771320
https://bugzilla.gnome.org/show_bug.cgi?id=767713
2016-10-13 08:46:03 +02:00
Matthias Clasen
dd9a9d9dcc Deprecate gtk_menu_popup and gtk_menu_popup_for_device
These functions don't work well on backends without global
coordinates (such as Wayland or Mir), and the gtk_menu_popup_at_
variants are better alternatives.

https://bugzilla.gnome.org/show_bug.cgi?id=772552
2016-10-12 13:50:55 -04:00
Piotr Drąg
0ecc4ac7de Update Polish translation 2016-10-12 19:49:23 +02:00
Lapo Calamandrei
c41294e2be Adwaita: dodge drop active style for window and decoration nodes
to hilight drop target there is a wildcard selector which turns
the border and shadow to green, this clearly shouldn't happen when
the whole window is a drop target.
2016-10-12 19:33:40 +02:00
Hannie Dumoleyn
9af1353e6d Updated Dutch translation gtk+-properties3.22 2016-10-12 17:00:55 +02:00
Hannie Dumoleyn
f60605e758 Updated Dutch translation 3.22 2016-10-12 16:36:51 +02:00
Tom Tryfonidis
e74dc54567 Update Greek translation 2016-10-11 11:05:21 +00:00
Christian Hergert
90ac584437 shortcuts: the accelerator should always be LTR
Even on RTL languages, we want the shortcut to be LTR so that we always
have <control> to the left of the accel keyval.

https://bugzilla.gnome.org/show_bug.cgi?id=772695
2016-10-10 15:13:48 -07:00
djb
bfc6287910 gtkplacesviewrow: stop busy_spinner from offsetting the other widgets when visible
...by putting it in a stack. The busy_spinner and eject_button are
mutually exclusive, but only the latter was coded to ensure that its
visibility did not cause the rest of the row to reflow. By putting both
widgets in a stack and setting child_visible on that, the row allocates
enough space to show one - or none - at once, avoiding any misalignment.

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

https://bugzilla.gnome.org/show_bug.cgi?id=772348
2016-10-10 15:14:49 -04:00
Adam Jackson
19aa3a4fca Use eglGetPlatformDisplay{,EXT} if available
Calling eglGetDisplay forces libEGL to guess what kind of pointer you
passed it. Different EGL libraries will do different things here, and in
particular glvnd will do something different than Mesa. Since we do have
an API that allows us to explicitly type the display, use it.

The explicit call to eglGetProcAddress is working around a bug in
libepoxy 1.3, which does not understand the EGL concept of client
extensions. Since it does not, the normal epoxy resolver for
eglGetPlatformDisplayEXT would not find any provider for that entry
point, and crash when you attempted to call it.

Signed-off-by: Adam Jackson <ajax@redhat.com>

https://bugzilla.gnome.org/show_bug.cgi?id=772415
2016-10-10 14:38:28 -04:00
Adam Jackson
0757914aba Fix some EGLDisplay * abuse
EGLDisplays are already opaque pointers, and eglGetDisplay returns an
EGLDisplay not a pointer to one.

Signed-off-by: Adam Jackson <ajax@redhat.com>

https://bugzilla.gnome.org/show_bug.cgi?id=772415
2016-10-10 14:37:39 -04:00
Ask Hjorth Larsen
e11df6cca0 Updated Danish translation 2016-10-09 22:05:52 +02:00
Rūdolfs Mazurs
8c0738113e Update Latvian translation 2016-10-09 19:33:18 +03:00
gogo
0a08a199d8 Update Croatian translation 2016-10-06 16:16:32 +00:00
gogo
051fddaa61 Update Croatian translation 2016-10-06 16:08:43 +00:00
Kalev Lember
154b2a124b Revert "Add GDK_AVAILABLE_IN_3_90"
Revert 3.90 macros on the 3.22 branch.

This reverts commit 13e00b70c0.
2016-10-06 16:42:22 +02:00
Milo Casagrande
1eed051c41 Updated Italian translation 2016-10-06 11:57:05 +00:00
Milo Casagrande
8d14c5c7cd Updated Italian translation 2016-10-06 11:53:32 +00:00
Matthias Clasen
17c08d062f entry: Fix a corner case of overwrite mode
We currently beep when a character is appended at the end in
overwrite mode. That is obviously not right. Patch based on
a patch by Ian MacDonald.

https://bugzilla.gnome.org/show_bug.cgi?id=772389
2016-10-05 12:23:18 -04:00
429 changed files with 42062 additions and 31928 deletions

230
NEWS
View File

@@ -1,3 +1,233 @@
Overview of Changes in GTK+ 3.22.9
==================================
* Bugs fixed:
136059 Ctrl-navigation works in opposite direction in right-to-left text
776821 Scale factor not properly propagated upon reparent
778203 icon shown at top left corner when dnd begins
778328 Pressure sensitivity lost after removing pen from screen (Surface Book/MyPaint)
778534 Widget: Document signal mnemonic-activate
778678 gtkshow: Prefer gtk_show_uri_on_window() which works for sandboxed apps
778726 Use gtk_show_uri_on_window()
778746 Rename popover is sometimes misplaced
778835 Wrong screen size returned when in HiDPI mode
778905 Frame: documented flat style class is not usable
779005 GtkFrame: Fix shadow after theme changes
136059 Ctrl-navigation works in opposite direction in right-to-left text
772505 Wayland: menu does not resize after disabling an action
774148 Gtk.Popover misplacement in Wayland
778019 Key repeat under wayland behaves differently, making keyboard navigation e.g. in
vim annoyingly unreliable
* Translation updates:
Brazilian Portuguese
Chinese
Chinese (Taiwan)
Galician
German
Hungarian
Italian
Lithuanian
Polish
Serbian
Spanish
Swedish
Overview of Changes in GTK+ 3.22.8
==================================
* Wayland:
- Avoid overlap between Alt and Meta
* Mir:
- Implement window properties
- Track window focus
- Connect to content-hub and use it for copy/paste
- Use modal hint
* Bugs fixed:
358970 gtk_scale_set_digits does not cause value to be rounded if draw-value...
765161 on win32 maximized window position wrong when windows toolbar is on l...
765410 Scrollbar does not update since 3.20
770112 The documented <alt>left shortcut doesnt work on Wayland
773686 Software when launched shows in dash with wrong icon, name and menu
775732 mir: clipboard support missing
775864 getting-started: typo tie->the
777527 GDK W32: Invisible drop-down menus in GTK apps when working via RDP
777547 Notebook arrow icon wrong color after closing final tab
* Translation updates:
Simplified Chinese
Overview of Changes in GTK+ 3.22.7
==================================
* Bugs fixed:
165385 Win32 keyboard handling still incomplete
769214 keyval field not filled correctly for Pause key
769835 On Wayland, application containing GtkGLArea stops responding if it's not...
774726 GtkTreeView dnd: gtk_drag_finish remove row when reorder sinse 3.20
775846 gdk/wayland: Add support for the gtk-enable-primary-paste gsetting
776031 W32: Winkey+down minimizes maximized window instead of restoring it
776225 [wayland] dropdown placed somewhere in the screen
776485 GDK W32: Impossible to restore maximized window via system menu
776807 GtkInspector doesn't show up when Gtk is initialized through option group
777031 win32 HiDPI assert
777176 [wayland] gedit killed by protocol error "Invalid anchor rectangle size"
* Translation updates:
Lithuanian
Overview of Changes in GTK+ 3.22.6
==================================
* Bugs fixed:
774534 776132 776187 776012 774784 776187 776306 775808 776524 776560
774534 input shape and opaque region not applied without begin_paint()/end_paint()
774784 Failed to get desktop session proxy is not an error!
775808 win32 maximized window is larger than the extended screen in dual monitor
776012 GtkFlowBox, GtkListBox: Don't emit signals etc. during destruction
776132 Mention the difference between gdk_window_create_similar_image_surface and...
776187 flowbox: Add gtk_flow_box_get_child_at_pos to gtk3
776306 flowbox: Sometimes emits child-activated during rubberband selection
776524 GtkAboutDialog: Fix formatting of example email address in html documentation
776560 icon-browser: window opens at very narrow size, only showing 1 column of icons
Fix GL checks to work better on OpenGL ES 2.0
Avoid a possible crash in ::activate-url handlers
scrolledwindow: Fix func summary being cut off in bindings using doxygen
* Translation updates:
German
Russian
Overview of Changes in GTK+ 3.22.5
==================================
* gtk3-demo now has an example for using PangoTabArray to create a multi-column layout
* Bug fixes:
771242 opening menu for certain types of GtkComboBox causes Gdk-CRITICAL assertion...
774114 Window shadows are repainted even if only the contents of the window change
774265 No tilt for wintab devices
774379 gdk: mingw64 builds segfault during initialization of Huion H610PRO wintab
774686 GtkMenu does not unref all GtkCheckMenuItem it creates
774695 GtkProgressbar needs full and empty classes
774699 list iteration regression causes odd-indexed devices to be ignored during l...
774743 GtkNotebook does not unref all GtkBuiltinIcon it creates
774760 inspector: ensure controller is a GtkGesture
774790 GtkTextHandle does not unref all GtkAdjustment it references
774893 Application font sizes scaling gets clamped to 1.00 when starting GtkInspector
774915 Destroying the parent of a subsurface causes _gdk_window_destroy_hierarchy:...
774917 [wayland] child subsurfaces need to be placed relative to their parent
774939 GtkLabelAccessible: Initialize link before setting parent
775212 GtkScaleButton does not unref all GtkAdjustment it references
775316 gtk_drag_source_set_icon_pixbuf references the pixbuf received once too much
775319 gdk_window_get_toplevel() fails to return the toplevel of a child subsurface
775525 gtk_flow_box_get_child_at_index shouldn't crash with an invalid index
* Translation updates:
Hungarian
Italian
Kazakh
Russian
Swedish
Overview of Changes in GTK+ 3.22.4
==================================
* Bug fixes:
767713 Fullscreen in wayland is buggy
768081 Enable HiDPI support for GDK-Win32
768531 wayland: Startup notification doesn't work on some apps (eg. gnome-terminal)...
772075 GTK+ uses a lot more CPU under Wayland than under X11
772202 Handling of scaled monitors is broken
773587 recent-manager: Add a limit to the list's size
773916 GtkComposeTable caches broken: using a same ~/.XCompose does not work twice...
773979 GdkGLContext does not chain finalize handler
774046 GtkSpinButton does not always unref priv->{up,down}_button
774066 GtkHeaderBar does not unref all GtkBox and GtkSeparator it creates
774097 GtkPrintOperation should not truncate job names
774185 GtkPlacesSidebar does not unref itsel as many times as it references
774352 GtkAppChooserWidget does not unref all GAppInfo it references
* Translation updates:
Czech
Dutch
Overview of Changes in GTK+ 3.22.3
==================================
* Deprecations have been added for APIs that will be removed
in GTK+ 4
* gtk-demo has gained a new demo for showing (and testing)
rendering preformance
* Windows:
- The GL support has been improved. Legacy contexts can now
be created, and anti-aliasing is possible
- Hi-DPI is now supported
* Bugs fixed:
768081 Enable HiDPI support for GDK-Win32
773274 [Wayland] Crash under gdk_wayland_window_attach_image()
773474 Color chooser dialog opened with show-editor=TRUE has black header bar
773479 Typo in GtkShortcutType developer docs
773528 Improve GL support on Windows
773799 GtkLevelBar doesn't update blocks on discrete mode
773857 gdkwindow-x11: Add support for gdk_window_fullscreen_on_monitor
773885 pop down GtkPopover on pressing escape
* Translation updates:
Serbian
Overview of Changes in GTK+ 3.22.2
==================================
* Several improvements to the win32 theme
* Deprecations have been added for APIs that will be removed
in GTK+ 4
* Bug fixes:
767713 Fullscreen in wayland is buggy
771320 Maps widget is displayed at wrong position inside gnome-contacts
772345 placesviewrow: busy_spinner when visible offsets the rest of the...
772389 Appending a character to a GtkEntry control in overwrite mode ri...
772415 Avoid calling eglGetDisplay
772552 Deprecate gtk_menu_popup
772683 Usage of FALSE instead of gint in glarea demo
772695 Show the keyboard shortcuts from left to right even in RTL
772775 menu bindings needs attribute to force LTR for horizontal-button...
772859 Fix memory leaks in implementations of common widgets
772922 GtkMenu: Try using gdk_window_move_to_rect() more often
772926 shortcutswindow: working version of set_section_name()
773029 style-set signal problem
773082 overlay: Document availability of properties
773113 tests: fix clipboard test by loading correct icon
773180 Don't second-guess whether our GDK GL context is GLES
773246 Typo in css color definitions documentation
* Translation updates:
Croatian
Danish
Dutch
German
Greek
Italian
Latvian
Lithuanian
Norwegian bokmal
Polish
Overview of Changes in GTK+ 3.22.1
==================================

View File

@@ -9,9 +9,17 @@
# Author: Fan, Chun-wei
# November 05, 2012
# MSVC_VER_LONG: Long Version of Visual Studio (2012, 2013, 14 and so on)
# MSVC_VER: Short Version of Visual Studio (11 for 2012, 12 for 2013, 14 for 2015 and so on)
# MSVC_FORMAT_VER: Use 12 for MSVC 2012 through 2015
# MSVC_VER_LONG: Long Version of target Visual Studio (2012, 2013, 14 and so on)
# MSVC_VER: Short Version of target Visual Studio (110 for 2012, 120 for 2013, 140 for 2015, 141 for 2017)
# MSVC_TOOLSET: Use if target MSVC toolsett is not in the form v $(MSVC_VER)0, meaning v$(MSVC_TOOLSET)
if MSVC_BASE_NO_TOOLSET_SET
MSVC_BASE_TOOLSET = $(MSVC_BASE_VER)0
endif
if MSVC_NO_TOOLSET_SET
MSVC_TOOLSET = $(MSVC_VER)0
endif
%.sln:
sed 's/11\.00/$(MSVC_FORMAT_VER)\.00/g' < $(top_srcdir)/build/win32/vs10/$@ > $(top_builddir)/build/win32/vs$(MSVC_VER)/$@.tmp
@@ -25,12 +33,12 @@
%.vcxproj:
if test -e $(top_srcdir)/build/win32/vs10/$@; then \
sed 's/v100/v$(MSVC_VER)0/g' < $(top_srcdir)/build/win32/vs10/$@ > $(top_builddir)/build/win32/vs$(MSVC_VER)/$@; \
sed 's/v100/v$(MSVC_TOOLSET)/g' < $(top_srcdir)/build/win32/vs10/$@ > $(top_builddir)/build/win32/vs$(MSVC_VER)/$@; \
else \
sed 's/v100/v$(MSVC_VER)0/g' < $(top_builddir)/build/win32/vs10/$@ > $(top_builddir)/build/win32/vs$(MSVC_VER)/$@; \
sed 's/v100/v$(MSVC_TOOLSET)/g' < $(top_builddir)/build/win32/vs10/$@ > $(top_builddir)/build/win32/vs$(MSVC_VER)/$@; \
fi
%.props:
%.props: $(top_builddir)/build/win32/vs10/Makefile
if test -e $(top_srcdir)/build/win32/vs10/$@; then \
sed 's/<VSVer>10<\/VSVer>/<VSVer>$(MSVC_VER)<\/VSVer>/g' < $(top_srcdir)/build/win32/vs10/$@ > $(top_builddir)/build/win32/vs$(MSVC_VER)/$@; \
else \

View File

@@ -60,10 +60,19 @@ $(1).sourcefiles: $(top_builddir)/build/win32/vs9/$(1).vcproj
$(1).vs10.sourcefiles: $(top_builddir)/build/win32/vs9/$(1).vcproj
$(1).vs10.sourcefiles.filters: $(top_builddir)/build/win32/vs9/$(1).vcproj
$(top_builddir)/build/win32/vs9/$(1).vcproj:
$(top_builddir)/build/win32/vs9/$(1).vcproj: Makefile
-$(RM) $(top_builddir)/build/win32/vs9/$(1).vcproj
-$(RM) $(top_builddir)/build/win32/vs10/$(1).vcxproj
-$(RM) $(top_builddir)/build/win32/vs10/$(1).vcxproj.filters
-$(RM) $(top_builddir)/build/win32/vs11/$(1).vcxproj
-$(RM) $(top_builddir)/build/win32/vs11/$(1).vcxproj.filters
-$(RM) $(top_builddir)/build/win32/vs12/$(1).vcxproj
-$(RM) $(top_builddir)/build/win32/vs12/$(1).vcxproj.filters
-$(RM) $(top_builddir)/build/win32/vs14/$(1).vcxproj
-$(RM) $(top_builddir)/build/win32/vs14/$(1).vcxproj.filters
-$(RM) $(top_builddir)/build/win32/vs15/$(1).vcxproj
-$(RM) $(top_builddir)/build/win32/vs15/$(1).vcxproj.filters
for F in $(_proj_files); do \
case $$$$F in \
@@ -87,7 +96,7 @@ $(top_builddir)/build/win32/vs9/$(1).vcproj:
$(top_builddir)/build/win32/vs10/$(1).vs10.headers: $(top_builddir)/build/win32/vs9/$(1).headers
$(top_builddir)/build/win32/vs9/$(1).headers:
$(top_builddir)/build/win32/vs9/$(1).headers: Makefile
-$(RM) $(top_builddir)/build/win32/vs9/$(1).headers
-$(RM) $(top_builddir)/build/win32/vs10/$(1).vs10.headers

View File

@@ -31,7 +31,8 @@ SUBDIRS = \
vs10 \
vs11 \
vs12 \
vs14
vs14 \
vs15
EXTRA_DIST += \
detectenv-msvc.mak \

View File

@@ -30,7 +30,7 @@ def main(argv):
atk_min_ver = '2.15.1'
cairo_min_ver = '1.14.0'
gdk_pixbuf_min_ver = '2.30.0'
gdk_win32_sys_libs = '-lgdi32 -limm32 -lshell32 -lole32 -Wl,-luuid -lwinmm -ldwmapi'
gdk_win32_sys_libs = '-lgdi32 -limm32 -lshell32 -lole32 -lwinmm -ldwmapi'
glib_min_ver = '2.45.8'
cairo_backends = 'cairo-win32'
@@ -41,14 +41,14 @@ def main(argv):
gdk_args = gdk_parser.parse_args()
if getattr(gdk_args, 'broadway', None) is 1:
# On Visual Studio, we link to zlib1.lib
broadway_extra_libs = '-lzlib1'
broadway_extra_libs = ' -lzlib1'
gdk_backends += ' broadway'
cairo_backends += ' cairo'
pkg_replace_items = {'@GTK_API_VERSION@': '3.0',
'@GDK_BACKENDS@': gdk_backends}
pkg_required_packages = 'gdk-pixbuf >= ' + gdk_pixbuf_min_ver + ' ' + \
pkg_required_packages = 'gdk-pixbuf-2.0 >= ' + gdk_pixbuf_min_ver + ' ' + \
'cairo >= ' + cairo_min_ver + ' ' + \
'cairo-gobject >= ' + cairo_min_ver

View File

@@ -74,6 +74,10 @@ DISTCLEANFILES = \
$(GENERATED_ITEMS)
gtk3-install.props: $(top_srcdir)/build/win32/vs10/gtk3-install.propsin $(MSVC10_HEADERS_LISTS)
-$(RM) $(top_builddir)/build/win32/vs11/gtk3-install.props
-$(RM) $(top_builddir)/build/win32/vs12/gtk3-install.props
-$(RM) $(top_builddir)/build/win32/vs14/gtk3-install.props
-$(RM) $(top_builddir)/build/win32/vs15/gtk3-install.props
$(CPP) -P - <$(top_srcdir)/build/win32/vs10/gtk3-install.propsin >$@
rm $(MSVC10_HEADERS_LISTS)

View File

@@ -20,7 +20,7 @@
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{7D2397CF-4C25-45BC-A1BB-CB4B6E154BBD}</ProjectGuid>
<RootNamespace>gtkencodesymbolicsvg</RootNamespace>
<RootNamespace>gtkbuildertool</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />

View File

@@ -20,7 +20,7 @@
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{9F22107A-3EF7-4B52-B269-747B65307F36}</ProjectGuid>
<RootNamespace>gtkencodesymbolicsvg</RootNamespace>
<RootNamespace>gtkquerysettings</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />

View File

@@ -20,7 +20,7 @@
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{FC98AF16-4C68-42DF-906B-93A6804C198A}</ProjectGuid>
<RootNamespace>gtkencodesymbolicsvg</RootNamespace>
<RootNamespace>gtkupdateiconcache</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />

View File

@@ -25,7 +25,7 @@ if "$(Configuration)" == "Debug_Broadway" goto DoDebug
mkdir .\Release\$(Platform)\bin
copy /b $(Configuration)\$(Platform)\bin\$(GtkDllPrefix)gdk$(GtkDllSuffix).dll .\Release\$(Platform)\bin\
copy /b $(Configuration)\$(Platform)\bin\$(GtkDllPrefix)gdk-3$(GtkDllSuffix).dll .\Release\$(Platform)\bin\
copy /b $(Configuration)\$(Platform)\bin\gdk-$(ApiVersion).lib .\Release\$(Platform)\bin\

View File

@@ -92,7 +92,9 @@ copy .\Debug\$(Platform)\bin\gtk-builder-tool.pdb $(CopyDir)\bin
:DONE_BIN
copy ..\gdk-3.0.pc $(CopyDir)\lib\pkgconfig
copy ..\gdk-3.0.pc $(CopyDir)\lib\pkgconfig\gdk-win32-3.0.pc
copy "..\gtk+-3.0.pc" $(CopyDir)\lib\pkgconfig
copy "..\gtk+-3.0.pc" "$(CopyDir)\lib\pkgconfig\gtk+-3.0.pc"
copy ..\gail-3.0.pc $(CopyDir)\lib\pkgconfig
</GtkDoInstallBin>
<GtkDoInstall>
@@ -110,18 +112,9 @@ mkdir $(CopyDir)\include\gtk-$(ApiVersion)\gtk\deprecated
mkdir $(CopyDir)\include\gail-$(ApiVersion)\libgail-util
#include "gailutil-3.vs10.headers"
mkdir $(CopyDir)\share\icons\hicolor\16x16\apps
copy ..\..\..\demos\gtk-demo\data\16x16\gtk3-demo.png $(CopyDir)\share\icons\hicolor\16x16\apps
mkdir $(CopyDir)\share\icons\hicolor\22x22\apps
copy ..\..\..\demos\gtk-demo\data\22x22\gtk3-demo.png $(CopyDir)\share\icons\hicolor\22x22\apps
mkdir $(CopyDir)\share\icons\hicolor\24x24\apps
copy ..\..\..\demos\gtk-demo\data\24x24\gtk3-demo.png $(CopyDir)\share\icons\hicolor\24x24\apps
mkdir $(CopyDir)\share\icons\hicolor\32x32\apps
copy ..\..\..\demos\gtk-demo\data\32x32\gtk3-demo.png $(CopyDir)\share\icons\hicolor\32x32\apps
mkdir $(CopyDir)\share\icons\hicolor\48x48\apps
copy ..\..\..\demos\gtk-demo\data\48x48\gtk3-demo.png $(CopyDir)\share\icons\hicolor\48x48\apps
mkdir $(CopyDir)\share\icons\hicolor\256x256\apps
copy ..\..\..\demos\gtk-demo\data\256x256\gtk3-demo.png $(CopyDir)\share\icons\hicolor\256x256\apps
for &#37;&#37;s in (16 22 24 32 48 256) do ((mkdir $(CopyDir)\share\icons\hicolor\&#37;&#37;sx&#37;&#37;s\apps) &amp; (copy /b ..\..\..\demos\gtk-demo\data\&#37;&#37;sx&#37;&#37;s\gtk3-demo.png $(CopyDir)\share\icons\hicolor\&#37;&#37;sx&#37;&#37;s\apps))
mkdir $(CopyDir)\share\glib-2.0\schemas
copy ..\..\..\gtk\org.gtk.Settings.FileChooser.gschema.xml $(CopyDir)\share\glib-2.0\schemas
copy ..\..\..\gtk\org.gtk.Settings.ColorChooser.gschema.xml $(CopyDir)\share\glib-2.0\schemas

View File

@@ -249,7 +249,7 @@
<Project>{f280bf1a-777a-4fb5-8005-dfbe04621edb}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="gtk-udpate-icon-cache.vcxproj">
<ProjectReference Include="gtk-update-icon-cache.vcxproj">
<Project>{fc98af16-4c68-42df-906b-93a6804c198a}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>

View File

@@ -0,0 +1,52 @@
include $(top_srcdir)/Makefile.decl
EXTRA_DIST += \
README.txt \
gtk+.sln \
gtk3-prebuild.vcxproj \
gtk3-prebuild.vcxproj.filters \
gdk3-win32.vcxproj \
gdk3-win32.vcxproj.filters \
gdk-3.vcxproj \
gdk-3.vcxproj.filters \
gtk-3.vcxproj \
gtk-3.vcxproj.filters \
gtk-builder-tool.vcxproj \
gtk-builder-tool.vcxproj.filters \
gtk-encode-symbolic-svg.vcxproj \
gtk-encode-symbolic-svg.vcxproj.filters \
gtk-query-settings.vcxproj \
gtk-query-settings.vcxproj.filters \
gtk-update-icon-cache.vcxproj \
gtk-update-icon-cache.vcxproj.filters \
gtk3-demo.vcxproj \
gtk3-demo.vcxproj.filters \
gtk3-demo-application.vcxproj \
gtk3-demo-application.vcxproj.filters \
gtk3-icon-browser.vcxproj \
gtk3-icon-browser.vcxproj.filters \
gailutil-3.vcxproj \
gailutil-3.vcxproj.filters \
gtk3-install.vcxproj \
gtk3-install.vcxproj.filters \
broadwayd.vcxproj \
broadwayd.vcxproj.filters \
gdk3-broadway.vcxproj \
gdk3-broadway.vcxproj.filters \
gtk3-build-defines.props \
gtk3-copy-gdk-broadway.props \
gtk3-gen-srcs.props \
gtk3-ignore-broadway.props \
gtk3-install.props \
gtk3-version-paths.props
DISTCLEANFILES = $(EXTRA_DIST)
MSVC_VER = 15
MSVC_VER_LONG = 15
MSVC_TOOLSET = 141
MSVC_FORMAT_VER = 12
include $(top_srcdir)/build/Makefile-newvs.am
-include $(top_srcdir)/git.mk

View File

@@ -17,7 +17,7 @@ if &quot;$(ConfigurationName)&quot; == &quot;Debug_Broadway&quot; goto DoDebug&#
:DoRelease&#x0D;&#x0A;
mkdir .\Release\$(PlatformName)\bin&#x0D;&#x0A;
copy /b $(ConfigurationName)\$(PlatformName)\bin\$(GtkDllPrefix)gdk$(GtkDllSuffix).dll .\Release\$(PlatformName)\bin\&#x0D;&#x0A;
copy /b $(ConfigurationName)\$(PlatformName)\bin\$(GtkDllPrefix)gdk-3$(GtkDllSuffix).dll .\Release\$(PlatformName)\bin\&#x0D;&#x0A;
copy /b $(ConfigurationName)\$(PlatformName)\bin\gdk-$(ApiVersion).lib .\Release\$(PlatformName)\bin\&#x0D;&#x0A;
goto END&#x0D;&#x0A;

View File

@@ -92,7 +92,9 @@ copy .\Debug\$(PlatformName)\bin\gtk-builder-tool.pdb $(CopyDir)\bin&#x0D;&#x0A;
:DONE_BIN&#x0D;&#x0A;
copy ..\gdk-3.0.pc $(CopyDir)\lib\pkgconfig&#x0D;&#x0A;
copy ..\gdk-3.0.pc $(CopyDir)\lib\pkgconfig\gdk-win32-3.0.pc&#x0D;&#x0A;
copy &quot;..\gtk+-3.0.pc&quot; $(CopyDir)\lib\pkgconfig&#x0D;&#x0A;
copy &quot;..\gtk+-3.0.pc&quot; &quot;$(CopyDir)\lib\pkgconfig\gtk+-win32-3.0.pc&quot;&#x0D;&#x0A;
copy ..\gail-3.0.pc $(CopyDir)\lib\pkgconfig&#x0D;&#x0A;
"
/>

View File

@@ -10,8 +10,8 @@
m4_define([gtk_major_version], [3])
m4_define([gtk_minor_version], [22])
m4_define([gtk_micro_version], [1])
m4_define([gtk_interface_age], [1])
m4_define([gtk_micro_version], [9])
m4_define([gtk_interface_age], [9])
m4_define([gtk_binary_age],
[m4_eval(100 * gtk_minor_version + gtk_micro_version)])
m4_define([gtk_version],
@@ -464,7 +464,7 @@ else
AM_CONDITIONAL(USE_WAYLAND, false)
fi
MIR_DEPENDENCIES="mirclient >= mirclient_required_version mircookie >= mircookie_required_version"
MIR_DEPENDENCIES="mirclient >= mirclient_required_version mircookie >= mircookie_required_version libcontent-hub-glib"
if test "$enable_mir_backend" = "maybe" ; then
PKG_CHECK_EXISTS($MIR_DEPENDENCIES, [have_mir_deps=yes], [have_mir_deps=no])
AC_MSG_CHECKING([for MIR_DEPENDENCIES])
@@ -1885,6 +1885,13 @@ if test "x${enable_Bsymbolic}" = "xyes" ; then
fi
AC_SUBST(GTK_LINK_FLAGS)
dnl
dnl Check whether MSVC toolset is explicitly set
dnl
AM_CONDITIONAL(MSVC_BASE_NO_TOOLSET_SET, [test x$MSVC_BASE_TOOLSET = x])
AM_CONDITIONAL(MSVC_NO_TOOLSET_SET, [test x$MSVC_TOOLSET = x])
AC_CONFIG_FILES([
README
INSTALL
@@ -1947,6 +1954,7 @@ build/win32/vs10/gtk3-version-paths.props
build/win32/vs11/Makefile
build/win32/vs12/Makefile
build/win32/vs14/Makefile
build/win32/vs15/Makefile
gdk/Makefile
gdk/broadway/Makefile
gdk/x11/Makefile

View File

@@ -27,6 +27,7 @@ demos_base = \
event_axes.c \
expander.c \
filtermodel.c \
fishbowl.c \
foreigndrawing.c \
gestures.c \
glarea.c \
@@ -63,6 +64,7 @@ demos_base = \
spinbutton.c \
spinner.c \
stack.c \
tabs.c \
textmask.c \
textview.c \
textscroll.c \
@@ -136,6 +138,8 @@ nodist_gtk3_demo_SOURCES = demos.h
gtk3_demo_SOURCES = \
$(demos) \
gtkfishbowl.c \
gtkfishbowl.h \
demo_resources.c \
main.c

View File

@@ -94,6 +94,11 @@
<file>zoom_in_cursor.png</file>
<file>zoom_out_cursor.png</file>
</gresource>
<gresource prefix="/fishbowl">
<file>fishbowl.ui</file>
<file>gtkfishbowl.c</file>
<file>gtkfishbowl.h</file>
</gresource>
<gresource prefix="/iconview">
<file preprocess="to-pixdata">gnome-fs-directory.png</file>
<file preprocess="to-pixdata">gnome-fs-regular.png</file>
@@ -150,6 +155,7 @@
<file>event_axes.c</file>
<file>expander.c</file>
<file>filtermodel.c</file>
<file>fishbowl.c</file>
<file>flowbox.c</file>
<file>foreigndrawing.c</file>
<file>font_features.c</file>
@@ -188,6 +194,7 @@
<file>stack.c</file>
<file>spinbutton.c</file>
<file>spinner.c</file>
<file>tabs.c</file>
<file>textview.c</file>
<file>textscroll.c</file>
<file>theming_style_classes.c</file>

178
demos/gtk-demo/fishbowl.c Normal file
View File

@@ -0,0 +1,178 @@
/* Benchmark/Fishbowl
*
* This demo models the fishbowl demos seen on the web in a GTK way.
* It's also a neat little tool to see how fast your computer (or
* your GTK version) is.
*/
#include <gtk/gtk.h>
#include "gtkfishbowl.h"
GtkWidget *allow_changes;
#define N_STATS 5
#define STATS_UPDATE_TIME G_USEC_PER_SEC
typedef struct _Stats Stats;
struct _Stats {
gint64 last_stats;
gint64 last_frame;
gint last_suggestion;
guint frame_counter_max;
guint stats_index;
guint frame_counter[N_STATS];
guint item_counter[N_STATS];
};
static Stats *
get_stats (GtkWidget *widget)
{
static GQuark stats_quark = 0;
Stats *stats;
if (G_UNLIKELY (stats_quark == 0))
stats_quark = g_quark_from_static_string ("stats");
stats = g_object_get_qdata (G_OBJECT (widget), stats_quark);
if (stats == NULL)
{
stats = g_new0 (Stats, 1);
g_object_set_qdata_full (G_OBJECT (widget), stats_quark, stats, g_free);
stats->last_frame = gdk_frame_clock_get_frame_time (gtk_widget_get_frame_clock (widget));
stats->last_stats = stats->last_frame;
}
return stats;
}
static void
do_stats (GtkWidget *widget,
GtkWidget *info_label,
gint *suggested_change)
{
Stats *stats;
gint64 frame_time;
stats = get_stats (widget);
frame_time = gdk_frame_clock_get_frame_time (gtk_widget_get_frame_clock (widget));
if (stats->last_stats + STATS_UPDATE_TIME < frame_time)
{
char *new_label;
guint i, n_frames;
n_frames = 0;
for (i = 0; i < N_STATS; i++)
{
n_frames += stats->frame_counter[i];
}
new_label = g_strdup_printf ("icons - %.1f fps",
(double) G_USEC_PER_SEC * n_frames
/ (N_STATS * STATS_UPDATE_TIME));
gtk_label_set_label (GTK_LABEL (info_label), new_label);
g_free (new_label);
if (stats->frame_counter[stats->stats_index] >= 19 * stats->frame_counter_max / 20)
{
if (stats->last_suggestion > 0)
stats->last_suggestion *= 2;
else
stats->last_suggestion = 1;
}
else
{
if (stats->last_suggestion < 0)
stats->last_suggestion--;
else
stats->last_suggestion = -1;
stats->last_suggestion = MAX (stats->last_suggestion, 1 - (int) stats->item_counter[stats->stats_index]);
}
stats->stats_index = (stats->stats_index + 1) % N_STATS;
stats->frame_counter[stats->stats_index] = 0;
stats->item_counter[stats->stats_index] = stats->item_counter[(stats->stats_index + N_STATS - 1) % N_STATS];
stats->last_stats = frame_time;
if (suggested_change)
*suggested_change = stats->last_suggestion;
else
stats->last_suggestion = 0;
}
else
{
if (suggested_change)
*suggested_change = 0;
}
stats->last_frame = frame_time;
stats->frame_counter[stats->stats_index]++;
stats->frame_counter_max = MAX (stats->frame_counter_max, stats->frame_counter[stats->stats_index]);
}
static void
stats_update (GtkWidget *widget)
{
Stats *stats;
stats = get_stats (widget);
stats->item_counter[stats->stats_index] = gtk_fishbowl_get_count (GTK_FISHBOWL (widget));
}
static gboolean
move_fish (GtkWidget *bowl,
GdkFrameClock *frame_clock,
gpointer info_label)
{
gint suggested_change = 0;
do_stats (bowl,
info_label,
!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (allow_changes)) ? &suggested_change : NULL);
gtk_fishbowl_set_count (GTK_FISHBOWL (bowl),
gtk_fishbowl_get_count (GTK_FISHBOWL (bowl)) + suggested_change);
stats_update (bowl);
return G_SOURCE_CONTINUE;
}
GtkWidget *
do_fishbowl (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
if (!window)
{
GtkBuilder *builder;
GtkWidget *bowl, *info_label;
g_type_ensure (GTK_TYPE_FISHBOWL);
builder = gtk_builder_new_from_resource ("/fishbowl/fishbowl.ui");
gtk_builder_connect_signals (builder, NULL);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
bowl = GTK_WIDGET (gtk_builder_get_object (builder, "bowl"));
info_label = GTK_WIDGET (gtk_builder_get_object (builder, "info_label"));
allow_changes = GTK_WIDGET (gtk_builder_get_object (builder, "changes_allow"));
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
gtk_widget_realize (window);
gtk_widget_add_tick_callback (bowl, move_fish, info_label, NULL);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
return window;
}

View File

@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.6 -->
<object class="GtkWindow" id="window">
<property name="title" translatable="yes">Fishbowl</property>
<child type="titlebar">
<object class="GtkHeaderBar" id="">
<property name="visible">True</property>
<property name="show-close-button">True</property>
<child>
<object class="GtkLabel" id="info_label">
<property name="visible">True</property>
<property name="label">icons - 0 fps</property>
</object>
<packing>
<property name="pack_type">end</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="label" bind-source="bowl" bind-property="count">0</property>
</object>
<packing>
<property name="pack_type">end</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="changes_allow">
<property name="active">False</property>
<property name="visible" bind-source="changes_allow" bind-property="active" bind-flags="invert-boolean">True</property>
<property name="relief">none</property>
<child>
<object class="GtkImage">
<property name="icon-name">changes-allow</property>
<property name="visible">True</property>
</object>
</child>
</object>
<packing>
<property name="pack_type">end</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="changes_prevent">
<property name="active" bind-source="changes_allow" bind-property="active" bind-flags="bidirectional|invert-boolean">True</property>
<property name="visible" bind-source="changes_prevent" bind-property="active" bind-flags="invert-boolean">False</property>
<property name="relief">none</property>
<child>
<object class="GtkImage">
<property name="icon-name">changes-prevent</property>
<property name="visible">True</property>
</object>
</child>
</object>
<packing>
<property name="pack_type">end</property>
</packing>
</child>
</object>
</child>
<child>
<object class="GtkFishbowl" id="bowl">
<property name="visible">True</property>
<property name="animating">True</property>
</object>
</child>
</object>
</interface>

View File

@@ -836,7 +836,7 @@ draw_spinbutton (GtkWidget *widget,
/* This information is taken from the GtkSpinButton docs, see "CSS nodes" */
spin_context = get_style (NULL, "spinbutton.horizontal:focus");
entry_context = get_style (NULL, "entry:focus");
entry_context = get_style (spin_context, "entry:focus");
up_context = get_style (spin_context, "button.up:focus:active");
down_context = get_style (spin_context, "button.down:focus");

View File

@@ -13,6 +13,17 @@ static gdouble swipe_x = 0;
static gdouble swipe_y = 0;
static gboolean long_pressed = FALSE;
static gboolean
touchpad_swipe_gesture_begin (GtkGesture *gesture,
GdkEventSequence *sequence,
GtkWidget *widget)
{
/* Disallow touchscreen events here */
if (sequence != NULL)
gtk_gesture_set_state (gesture, GTK_EVENT_SEQUENCE_DENIED);
return sequence == NULL;
}
static void
swipe_gesture_swept (GtkGestureSwipe *gesture,
gdouble velocity_x,
@@ -161,6 +172,19 @@ do_gestures (GtkWidget *do_widget)
GTK_PHASE_BUBBLE);
g_object_weak_ref (G_OBJECT (drawing_area), (GWeakNotify) g_object_unref, gesture);
/* 3fg swipe for touchpads */
gesture = g_object_new (GTK_TYPE_GESTURE_SWIPE,
"widget", drawing_area,
"n-points", 3,
NULL);
g_signal_connect (gesture, "begin",
G_CALLBACK (touchpad_swipe_gesture_begin), drawing_area);
g_signal_connect (gesture, "swipe",
G_CALLBACK (swipe_gesture_swept), drawing_area);
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture),
GTK_PHASE_BUBBLE);
g_object_weak_ref (G_OBJECT (drawing_area), (GWeakNotify) g_object_unref, gesture);
/* Long press */
gesture = gtk_gesture_long_press_new (drawing_area);
g_signal_connect (gesture, "pressed",

View File

@@ -1,7 +1,7 @@
precision highp float;
precision mediump float;
void main() {
float lerpVal = gl_FragCoord.y / 500.0f;
float lerpVal = gl_FragCoord.y / 500.0;
gl_FragColor = mix(vec4(1.0f, 0.85f, 0.35f, 1.0f), vec4(0.2f, 0.2f, 0.2f, 1.0f), lerpVal);
gl_FragColor = mix(vec4(1.0, 0.85, 0.35, 1.0), vec4(0.2, 0.2, 0.2, 1.0), lerpVal);
}

View File

@@ -333,7 +333,7 @@ create_axis_slider (int axis)
GtkAdjustment *adj;
const char *text;
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
switch (axis)
{

View File

@@ -0,0 +1,581 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 2017 Benjamin Otte <otte@gnome.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "gtkfishbowl.h"
#include "gtk/fallback-c89.c"
typedef struct _GtkFishbowlPrivate GtkFishbowlPrivate;
typedef struct _GtkFishbowlChild GtkFishbowlChild;
struct _GtkFishbowlPrivate
{
GList *children;
guint count;
gint64 last_frame_time;
guint tick_id;
};
struct _GtkFishbowlChild
{
GtkWidget *widget;
double x;
double y;
double dx;
double dy;
};
enum {
PROP_0,
PROP_ANIMATING,
PROP_COUNT,
NUM_PROPERTIES
};
static GParamSpec *props[NUM_PROPERTIES] = { NULL, };
G_DEFINE_TYPE_WITH_PRIVATE (GtkFishbowl, gtk_fishbowl, GTK_TYPE_CONTAINER)
static void
gtk_fishbowl_init (GtkFishbowl *fishbowl)
{
gtk_widget_set_has_window (GTK_WIDGET (fishbowl), FALSE);
}
/**
* gtk_fishbowl_new:
*
* Creates a new #GtkFishbowl.
*
* Returns: a new #GtkFishbowl.
*/
GtkWidget*
gtk_fishbowl_new (void)
{
return g_object_new (GTK_TYPE_FISHBOWL, NULL);
}
static void
gtk_widget_measure (GtkWidget *widget,
GtkOrientation orientation,
gint size,
gint *minimum,
gint *natural,
gint *minimum_baseline,
gint *natural_baseline)
{
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (size >= -1);
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
if (size < 0)
gtk_widget_get_preferred_width (widget, minimum, natural);
else
gtk_widget_get_preferred_width_for_height (widget, size, minimum, natural);
if (minimum_baseline)
*minimum_baseline = -1;
if (natural_baseline)
*natural_baseline = -1;
}
else
{
gtk_widget_get_preferred_height_and_baseline_for_width (widget,
size,
minimum,
natural,
minimum_baseline,
natural_baseline);
}
}
static void
gtk_fishbowl_measure (GtkWidget *widget,
GtkOrientation orientation,
int for_size,
int *minimum,
int *natural,
int *minimum_baseline,
int *natural_baseline)
{
GtkFishbowl *fishbowl = GTK_FISHBOWL (widget);
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
GtkFishbowlChild *child;
GList *children;
gint child_min, child_nat;
*minimum = 0;
*natural = 0;
for (children = priv->children; children; children = children->next)
{
child = children->data;
if (!gtk_widget_get_visible (child->widget))
continue;
gtk_widget_measure (child->widget, orientation, -1, &child_min, &child_nat, NULL, NULL);
*minimum = MAX (*minimum, child_min);
*natural = MAX (*natural, child_nat);
}
}
static void
gtk_fishbowl_get_preferred_width (GtkWidget *widget,
int *minimum,
int *natural)
{
gtk_fishbowl_measure (widget, GTK_ORIENTATION_HORIZONTAL, -1, minimum, natural, NULL, NULL);
}
static void
gtk_fishbowl_get_preferred_height (GtkWidget *widget,
int *minimum,
int *natural)
{
gtk_fishbowl_measure (widget, GTK_ORIENTATION_VERTICAL, -1, minimum, natural, NULL, NULL);
}
static void
gtk_fishbowl_get_preferred_width_for_height (GtkWidget *widget,
int for_size,
int *minimum,
int *natural)
{
gtk_fishbowl_measure (widget, GTK_ORIENTATION_HORIZONTAL, for_size, minimum, natural, NULL, NULL);
}
static void
gtk_fishbowl_get_preferred_height_and_baseline_for_width (GtkWidget *widget,
int for_size,
int *minimum,
int *natural,
int *minimum_baseline,
int *natural_baseline)
{
gtk_fishbowl_measure (widget, GTK_ORIENTATION_VERTICAL, for_size, minimum, natural, minimum_baseline, natural_baseline);
}
static void
gtk_fishbowl_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
GtkFishbowl *fishbowl = GTK_FISHBOWL (widget);
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
GtkFishbowlChild *child;
GtkAllocation child_allocation;
GtkRequisition child_requisition;
GList *children;
gtk_widget_set_allocation (widget, allocation);
for (children = priv->children; children; children = children->next)
{
child = children->data;
if (!gtk_widget_get_visible (child->widget))
continue;
gtk_widget_get_preferred_size (child->widget, &child_requisition, NULL);
child_allocation.x = allocation->x + round (child->x * (allocation->width - child_requisition.width));
child_allocation.y = allocation->y + round (child->y * (allocation->height - child_requisition.height));
child_allocation.width = child_requisition.width;
child_allocation.height = child_requisition.height;
gtk_widget_size_allocate (child->widget, &child_allocation);
}
}
static double
new_speed (void)
{
/* 5s to 50s to cross screen seems fair */
return g_random_double_range (0.02, 0.2);
}
static void
gtk_fishbowl_add (GtkContainer *container,
GtkWidget *widget)
{
GtkFishbowl *fishbowl = GTK_FISHBOWL (container);
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
GtkFishbowlChild *child_info;
g_return_if_fail (GTK_IS_FISHBOWL (fishbowl));
g_return_if_fail (GTK_IS_WIDGET (widget));
child_info = g_new0 (GtkFishbowlChild, 1);
child_info->widget = widget;
child_info->x = 0;
child_info->y = 0;
child_info->dx = new_speed ();
child_info->dy = new_speed ();
gtk_widget_set_parent (widget, GTK_WIDGET (fishbowl));
priv->children = g_list_prepend (priv->children, child_info);
priv->count++;
g_object_notify_by_pspec (G_OBJECT (fishbowl), props[PROP_COUNT]);
}
static void
gtk_fishbowl_remove (GtkContainer *container,
GtkWidget *widget)
{
GtkFishbowl *fishbowl = GTK_FISHBOWL (container);
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
GtkFishbowlChild *child;
GtkWidget *widget_container = GTK_WIDGET (container);
GList *children;
for (children = priv->children; children; children = children->next)
{
child = children->data;
if (child->widget == widget)
{
gboolean was_visible = gtk_widget_get_visible (widget);
gtk_widget_unparent (widget);
priv->children = g_list_remove_link (priv->children, children);
g_list_free (children);
g_free (child);
if (was_visible && gtk_widget_get_visible (widget_container))
gtk_widget_queue_resize (widget_container);
priv->count--;
g_object_notify_by_pspec (G_OBJECT (fishbowl), props[PROP_COUNT]);
break;
}
}
}
static void
gtk_fishbowl_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_data)
{
GtkFishbowl *fishbowl = GTK_FISHBOWL (container);
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
GtkFishbowlChild *child;
GList *children;
if (!include_internals)
return;
children = priv->children;
while (children)
{
child = children->data;
children = children->next;
(* callback) (child->widget, callback_data);
}
}
static gboolean
gtk_fishbowl_draw (GtkWidget *widget,
cairo_t *cr)
{
GtkFishbowl *fishbowl = GTK_FISHBOWL (widget);
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
GtkFishbowlChild *child;
GList *list;
for (list = priv->children;
list;
list = list->next)
{
child = list->data;
gtk_container_propagate_draw (GTK_CONTAINER (fishbowl),
child->widget,
cr);
}
return FALSE;
}
static void
gtk_fishbowl_dispose (GObject *object)
{
GtkFishbowl *fishbowl = GTK_FISHBOWL (object);
gtk_fishbowl_set_animating (fishbowl, FALSE);
gtk_fishbowl_set_count (fishbowl, 0);
G_OBJECT_CLASS (gtk_fishbowl_parent_class)->dispose (object);
}
static void
gtk_fishbowl_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GtkFishbowl *fishbowl = GTK_FISHBOWL (object);
switch (prop_id)
{
case PROP_ANIMATING:
gtk_fishbowl_set_animating (fishbowl, g_value_get_boolean (value));
break;
case PROP_COUNT:
gtk_fishbowl_set_count (fishbowl, g_value_get_uint (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gtk_fishbowl_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GtkFishbowl *fishbowl = GTK_FISHBOWL (object);
switch (prop_id)
{
case PROP_ANIMATING:
g_value_set_boolean (value, gtk_fishbowl_get_animating (fishbowl));
break;
case PROP_COUNT:
g_value_set_uint (value, gtk_fishbowl_get_count (fishbowl));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gtk_fishbowl_class_init (GtkFishbowlClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
object_class->dispose = gtk_fishbowl_dispose;
object_class->set_property = gtk_fishbowl_set_property;
object_class->get_property = gtk_fishbowl_get_property;
widget_class->get_preferred_width = gtk_fishbowl_get_preferred_width;
widget_class->get_preferred_height = gtk_fishbowl_get_preferred_height;
widget_class->get_preferred_width_for_height = gtk_fishbowl_get_preferred_width_for_height;
widget_class->get_preferred_height_and_baseline_for_width = gtk_fishbowl_get_preferred_height_and_baseline_for_width;
widget_class->size_allocate = gtk_fishbowl_size_allocate;
widget_class->draw = gtk_fishbowl_draw;
container_class->add = gtk_fishbowl_add;
container_class->remove = gtk_fishbowl_remove;
container_class->forall = gtk_fishbowl_forall;
props[PROP_ANIMATING] =
g_param_spec_boolean ("animating",
"animating",
"Whether children are moving around",
FALSE,
G_PARAM_READWRITE);
props[PROP_COUNT] =
g_param_spec_uint ("count",
"Count",
"Number of widgets",
0, G_MAXUINT,
0,
G_PARAM_READABLE);
g_object_class_install_properties (object_class, NUM_PROPERTIES, props);
}
guint
gtk_fishbowl_get_count (GtkFishbowl *fishbowl)
{
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
return priv->count;
}
char **icon_names = NULL;
gsize n_icon_names = 0;
static void
init_icon_names (GtkIconTheme *theme)
{
GPtrArray *icons;
GList *l, *icon_list;
if (icon_names)
return;
icon_list = gtk_icon_theme_list_icons (theme, NULL);
icons = g_ptr_array_new ();
for (l = icon_list; l; l = l->next)
{
if (g_str_has_suffix (l->data, "symbolic"))
continue;
g_ptr_array_add (icons, g_strdup (l->data));
}
n_icon_names = icons->len;
g_ptr_array_add (icons, NULL); /* NULL-terminate the array */
icon_names = (char **) g_ptr_array_free (icons, FALSE);
/* don't free strings, we assigned them to the array */
g_list_free_full (icon_list, g_free);
}
static const char *
get_random_icon_name (GtkIconTheme *theme)
{
init_icon_names (theme);
return icon_names[g_random_int_range(0, n_icon_names)];
}
void
gtk_fishbowl_set_count (GtkFishbowl *fishbowl,
guint count)
{
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
g_object_freeze_notify (G_OBJECT (fishbowl));
while (priv->count > count)
{
gtk_container_remove (GTK_CONTAINER (fishbowl),
((GtkFishbowlChild *) priv->children->data)->widget);
}
while (priv->count < count)
{
GtkWidget *new_widget;
new_widget = gtk_image_new_from_icon_name (get_random_icon_name (gtk_icon_theme_get_default ()),
GTK_ICON_SIZE_DIALOG);
gtk_widget_show (new_widget);
gtk_container_add (GTK_CONTAINER (fishbowl), new_widget);
}
g_object_thaw_notify (G_OBJECT (fishbowl));
}
gboolean
gtk_fishbowl_get_animating (GtkFishbowl *fishbowl)
{
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
return priv->tick_id != 0;
}
static gboolean
gtk_fishbowl_tick (GtkWidget *widget,
GdkFrameClock *frame_clock,
gpointer unused)
{
GtkFishbowl *fishbowl = GTK_FISHBOWL (widget);
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
GtkFishbowlChild *child;
GList *l;
gint64 frame_time, elapsed;
frame_time = gdk_frame_clock_get_frame_time (gtk_widget_get_frame_clock (widget));
elapsed = frame_time - priv->last_frame_time;
priv->last_frame_time = frame_time;
/* last frame was 0, so we're just starting to animate */
if (elapsed == frame_time)
return G_SOURCE_CONTINUE;
for (l = priv->children; l; l = l->next)
{
child = l->data;
child->x += child->dx * ((double) elapsed / G_USEC_PER_SEC);
child->y += child->dy * ((double) elapsed / G_USEC_PER_SEC);
if (child->x <= 0)
{
child->x = 0;
child->dx = new_speed ();
}
else if (child->x >= 1)
{
child->x = 1;
child->dx = - new_speed ();
}
if (child->y <= 0)
{
child->y = 0;
child->dy = new_speed ();
}
else if (child->y >= 1)
{
child->y = 1;
child->dy = - new_speed ();
}
}
gtk_widget_queue_allocate (widget);
return G_SOURCE_CONTINUE;
}
void
gtk_fishbowl_set_animating (GtkFishbowl *fishbowl,
gboolean animating)
{
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
if (gtk_fishbowl_get_animating (fishbowl) == animating)
return;
if (animating)
{
priv->tick_id = gtk_widget_add_tick_callback (GTK_WIDGET (fishbowl),
gtk_fishbowl_tick,
NULL,
NULL);
}
else
{
priv->last_frame_time = 0;
gtk_widget_remove_tick_callback (GTK_WIDGET (fishbowl), priv->tick_id);
priv->tick_id = 0;
}
g_object_notify_by_pspec (G_OBJECT (fishbowl), props[PROP_ANIMATING]);
}

View File

@@ -0,0 +1,58 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 2017 Benjamin Otte <otte@gnome.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GTK_FISHBOWL_H__
#define __GTK_FISHBOWL_H__
#include <gtk/gtk.h>
G_BEGIN_DECLS
#define GTK_TYPE_FISHBOWL (gtk_fishbowl_get_type ())
#define GTK_FISHBOWL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_FISHBOWL, GtkFishbowl))
#define GTK_FISHBOWL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_FISHBOWL, GtkFishbowlClass))
#define GTK_IS_FISHBOWL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_FISHBOWL))
#define GTK_IS_FISHBOWL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_FISHBOWL))
#define GTK_FISHBOWL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_FISHBOWL, GtkFishbowlClass))
typedef struct _GtkFishbowl GtkFishbowl;
typedef struct _GtkFishbowlClass GtkFishbowlClass;
struct _GtkFishbowl
{
GtkContainer container;
};
struct _GtkFishbowlClass
{
GtkContainerClass parent_class;
};
GType gtk_fishbowl_get_type (void) G_GNUC_CONST;
GtkWidget* gtk_fishbowl_new (void);
guint gtk_fishbowl_get_count (GtkFishbowl *fishbowl);
void gtk_fishbowl_set_count (GtkFishbowl *fishbowl,
guint count);
gboolean gtk_fishbowl_get_animating (GtkFishbowl *fishbowl);
void gtk_fishbowl_set_animating (GtkFishbowl *fishbowl,
gboolean animating);
G_END_DECLS
#endif /* __GTK_FISHBOWL_H__ */

View File

@@ -1,7 +1,7 @@
/* Links
*
* GtkLabel can show hyperlinks. The default action is to call
* gtk_show_uri() on their URI, but it is possible to override
* gtk_show_uri_on_window() on their URI, but it is possible to override
* this with a custom handler.
*/

View File

@@ -53,6 +53,7 @@ do_pickers (GtkWidget *do_widget)
gtk_widget_set_hexpand (label, TRUE);
picker = gtk_file_chooser_button_new ("Pick a File",
GTK_FILE_CHOOSER_ACTION_OPEN);
gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (picker), FALSE);
gtk_grid_attach (GTK_GRID (table), label, 0, 2, 1, 1);
gtk_grid_attach (GTK_GRID (table), picker, 1, 2, 1, 1);

63
demos/gtk-demo/tabs.c Normal file
View File

@@ -0,0 +1,63 @@
/* Text View/Tabs
*
* GtkTextView can position text at fixed positions, using tabs.
*/
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
GtkWidget *
do_tabs (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
if (!window)
{
GtkWidget *view;
GtkWidget *sw;
GtkTextBuffer *buffer;
PangoTabArray *tabs;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Tabs");
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
gtk_window_set_default_size (GTK_WINDOW (window), 450, 450);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
view = gtk_text_view_new ();
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (view), GTK_WRAP_WORD);
gtk_text_view_set_left_margin (GTK_TEXT_VIEW (view), 20);
gtk_text_view_set_right_margin (GTK_TEXT_VIEW (view), 20);
tabs = pango_tab_array_new (3, TRUE);
pango_tab_array_set_tab (tabs, 0, PANGO_TAB_LEFT, 0);
pango_tab_array_set_tab (tabs, 1, PANGO_TAB_LEFT, 150);
pango_tab_array_set_tab (tabs, 2, PANGO_TAB_LEFT, 300);
gtk_text_view_set_tabs (GTK_TEXT_VIEW (view), tabs);
pango_tab_array_free (tabs);
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
gtk_text_buffer_set_text (buffer, "one\ttwo\tthree\nfour\tfive\tsix\nseven\teight\tnine", -1);
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (window), sw);
gtk_container_add (GTK_CONTAINER (sw), view);
gtk_widget_show_all (sw);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
return window;
}

View File

@@ -8,8 +8,8 @@
</object>
<template class="IconBrowserWindow" parent="GtkApplicationWindow">
<property name="title" translatable="yes">Icon Browser</property>
<property name="default-width">600</property>
<property name="default-height">800</property>
<property name="default-width">1024</property>
<property name="default-height">768</property>
<signal name="key-press-event" handler="key_press_event_cb"/>
<child type="titlebar">
<object class="GtkHeaderBar" id="header">

View File

@@ -1637,6 +1637,16 @@ scale_format_value (GtkScale *scale, gdouble value)
return g_strdup_printf ("%0.*f", 1, value);
}
static void
adjustment3_value_changed (GtkAdjustment *adj, GtkProgressBar *pbar)
{
double fraction;
fraction = gtk_adjustment_get_value (adj) / (gtk_adjustment_get_upper (adj) - gtk_adjustment_get_lower (adj));
gtk_progress_bar_set_fraction (pbar, fraction);
}
static void
activate (GApplication *app)
{
@@ -1910,6 +1920,12 @@ activate (GApplication *app)
widget2 = (GtkWidget *)gtk_builder_get_object (builder, "decrease_button");
g_object_set_data (G_OBJECT (widget), "decrease_button", widget2);
adj = (GtkAdjustment *)gtk_builder_get_object (builder, "adjustment3");
widget = (GtkWidget *)gtk_builder_get_object (builder, "progressbar1");
widget2 = (GtkWidget *)gtk_builder_get_object (builder, "progressbar2");
g_signal_connect (adj, "value-changed", G_CALLBACK (adjustment3_value_changed), widget);
g_signal_connect (adj, "value-changed", G_CALLBACK (adjustment3_value_changed), widget2);
gtk_widget_show_all (GTK_WIDGET (window));
g_object_unref (builder);

View File

@@ -1,8 +1,3 @@
.circular-button {
border-radius: 20px;
-gtk-outline-radius: 20px;
}
.small-button {
padding: 0;
outline-width: 0;

View File

@@ -103,8 +103,9 @@
<property name="page_increment">10</property>
</object>
<object class="GtkAdjustment" id="adjustment3">
<property name="lower">0</property>
<property name="upper">4</property>
<property name="value">1</property>
<property name="value">2</property>
<property name="step_increment">1</property>
<property name="page_increment">1</property>
</object>
@@ -3107,7 +3108,7 @@ microphone-sensitivity-medium-symbolic</property>
<property name="visible">1</property>
<style>
<class name="image-button"/>
<class name="circular-button"/>
<class name="circular"/>
</style>
<child>
<object class="GtkImage">

View File

@@ -587,7 +587,7 @@ background-color: @bg_color;
set of base colors.
</para>
<literallayout><code>〈color expression〉 = ligher(〈color〉) | darker(〈color〉) | shade(〈number〉,〈color〉) | alpha(〈number〉,〈color〉) | mix(〈number〉,〈color〉,〈color〉)</code>
<literallayout><code>〈color expression〉 = lighter(〈color〉) | darker(〈color〉) | shade(〈number〉,〈color〉) | alpha(〈number〉,〈color〉) | mix(〈number〉,〈color〉,〈color〉)</code>
</literallayout>
<para>
@@ -824,7 +824,7 @@ label {
<programlisting><![CDATA[
spinner {
-gtk-icon-source: -gtk-icontheme('process-working-symbolic');
-gtk-icon-palette: success blue, error magenta;
-gtk-icon-palette: success blue, warning #fc3, error magenta;
}
arrow.fancy {
-gtk-icon-source: -gtk-icontheme('pan-down');

View File

@@ -108,7 +108,7 @@ We use <literallayout> for syntax productions, and each line is put in a <code>
<term>4 values: </term><listitem>top right bottom left</listitem>
</varlistentry>
<varlistentry>
<term>3 values: </term><listitem>top horizontal left</listitem>
<term>3 values: </term><listitem>top horizontal bottom</listitem>
</varlistentry>
<varlistentry>
<term>2 values: </term><listitem>vertical horizontal</listitem>

View File

@@ -1051,7 +1051,7 @@ example_app_window_init (ExampleAppWindow *win)
<para>The contents of a widget often need to be partially or fully redrawn,
e.g. when another window is moved and uncovers part of the widget, or
when tie window containing it is resized. It is also possible to explicitly
when the window containing it is resized. It is also possible to explicitly
cause part or all of the widget to be redrawn, by calling
gtk_widget_queue_draw() or its variants. GTK+ takes care of most of the
details by providing a ready-to-use cairo context to the ::draw signal

View File

@@ -57,7 +57,8 @@
<varlistentry>
<term><option>simplify</option></term>
<listitem><para>Simplifies the .ui file by removing properties that
are set to their default values and write the resulting XML to stdout.</para></listitem>
are set to their default values and write the resulting XML to stdout,
or back to the input file.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>enumerate</option></term>
@@ -71,6 +72,16 @@
</variablelist>
</refsect1>
<refsect1><title>Simplify Options</title>
<para>The <option>simplify</option> command accepts the following options:</para>
<variablelist>
<varlistentry>
<term><option>--replace</option></term>
<listitem><para>Write the content back to the .ui file instead of stdout.</para></listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1><title>Preview Options</title>
<para>The <option>preview</option> command accepts the following options:</para>
<variablelist>

View File

@@ -2259,6 +2259,7 @@ gtk_menu_set_title
gtk_menu_get_title
gtk_menu_set_monitor
gtk_menu_get_monitor
gtk_menu_place_on_monitor
gtk_menu_get_tearoff_state
gtk_menu_set_reserve_toggle_size
gtk_menu_get_reserve_toggle_size
@@ -3214,35 +3215,39 @@ GtkScrolledWindow
GtkScrolledWindowClass
gtk_scrolled_window_new
gtk_scrolled_window_get_hadjustment
gtk_scrolled_window_set_hadjustment
gtk_scrolled_window_get_vadjustment
gtk_scrolled_window_set_vadjustment
gtk_scrolled_window_get_hscrollbar
gtk_scrolled_window_get_vscrollbar
GtkPolicyType
gtk_scrolled_window_get_policy
gtk_scrolled_window_set_policy
gtk_scrolled_window_add_with_viewport
GtkCornerType
gtk_scrolled_window_get_placement
gtk_scrolled_window_set_placement
gtk_scrolled_window_unset_placement
gtk_scrolled_window_set_shadow_type
gtk_scrolled_window_set_hadjustment
gtk_scrolled_window_set_vadjustment
gtk_scrolled_window_get_placement
gtk_scrolled_window_get_policy
gtk_scrolled_window_get_shadow_type
gtk_scrolled_window_set_shadow_type
gtk_scrolled_window_get_kinetic_scrolling
gtk_scrolled_window_set_kinetic_scrolling
gtk_scrolled_window_get_capture_button_press
gtk_scrolled_window_set_capture_button_press
gtk_scrolled_window_get_overlay_scrolling
gtk_scrolled_window_set_overlay_scrolling
gtk_scrolled_window_get_min_content_width
gtk_scrolled_window_set_min_content_width
gtk_scrolled_window_get_min_content_height
gtk_scrolled_window_set_min_content_height
gtk_scrolled_window_set_kinetic_scrolling
gtk_scrolled_window_get_kinetic_scrolling
gtk_scrolled_window_set_capture_button_press
gtk_scrolled_window_get_capture_button_press
gtk_scrolled_window_set_overlay_scrolling
gtk_scrolled_window_get_overlay_scrolling
gtk_scrolled_window_set_propagate_natural_width
gtk_scrolled_window_get_max_content_width
gtk_scrolled_window_set_max_content_width
gtk_scrolled_window_get_max_content_height
gtk_scrolled_window_set_max_content_height
gtk_scrolled_window_get_propagate_natural_width
gtk_scrolled_window_set_propagate_natural_height
gtk_scrolled_window_set_propagate_natural_width
gtk_scrolled_window_get_propagate_natural_height
gtk_scrolled_window_set_propagate_natural_height
<SUBSECTION Standard>
GTK_SCROLLED_WINDOW
@@ -7077,7 +7082,7 @@ GtkPrintOperationPrivate
<SECTION>
<INCLUDE>gtk/gtkprintunixdialog.h</INCLUDE>
<INCLUDE>gtk/gtkunixprint.h</INCLUDE>
<FILE>gtkprintunixdialog</FILE>
<TITLE>GtkPrintUnixDialog</TITLE>
GtkPrintUnixDialog
@@ -7424,7 +7429,7 @@ gtk_print_context_get_type
<SECTION>
<INCLUDE>gtk/gtkprintjob.h</INCLUDE>
<INCLUDE>gtk/gtkunixprint.h</INCLUDE>
<FILE>gtkprintjob</FILE>
<TITLE>GtkPrintJob</TITLE>
GtkPrintJob
@@ -7434,6 +7439,7 @@ gtk_print_job_get_settings
gtk_print_job_get_printer
gtk_print_job_get_title
gtk_print_job_get_status
gtk_print_job_set_source_fd
gtk_print_job_set_source_file
gtk_print_job_get_surface
gtk_print_job_send
@@ -7475,7 +7481,7 @@ gtk_print_job_get_type
<SECTION>
<INCLUDE>gtk/gtkpagesetupunixdialog.h</INCLUDE>
<INCLUDE>gtk/gtkunixprint.h</INCLUDE>
<FILE>gtkpagesetupunixdialog</FILE>
<TITLE>GtkPageSetupUnixDialog</TITLE>
GtkPageSetupUnixDialog
@@ -7533,7 +7539,7 @@ gtk_mount_operation_get_parent
gtk_mount_operation_set_screen
gtk_mount_operation_get_screen
gtk_show_uri
gtk_show_uri_on_parent
gtk_show_uri_on_window
<SUBSECTION Standard>
GTK_IS_MOUNT_OPERATION
GTK_IS_MOUNT_OPERATION_CLASS
@@ -8093,6 +8099,7 @@ GtkFlowBox
gtk_flow_box_new
gtk_flow_box_insert
gtk_flow_box_get_child_at_index
gtk_flow_box_get_child_at_pos
gtk_flow_box_set_hadjustment
gtk_flow_box_set_vadjustment

View File

@@ -184,8 +184,9 @@
<listitem>If you are opening a document or URI by launching a command
like <literal>firefox http://my-favourite-website.com</literal> or
<literal>gnome-open ghelp:epiphany</literal>, it is best to just use
gtk_show_uri(); as an added benefit, your application will henceforth
respect the users preference for what application to use.</listitem>
gtk_show_uri_on_window(); as an added benefit, your application will
henceforth respect the users preference for what application to use and
correctly open links in sandboxed applications.</listitem>
<listitem>If you are launching a regular, installed application that
has a desktop file, it is best to use GIOs #GAppInfo with a suitable
launch context.

View File

@@ -148,13 +148,10 @@ displays after the widget is created with gtk_text_view_set_buffer().
<para>
There are two ways to affect text attributes in #GtkTextView.
You can change the default attributes for a given #GtkTextView, and you can
apply tags that change the attributes for a region of text. For text features
that come from the theme &mdash; such as font and foreground color &mdash; use
standard #GtkWidget functions such as gtk_widget_modify_font() or
gtk_widget_override_color(). For other attributes there are dedicated methods on
#GtkTextView such as gtk_text_view_set_tabs().
The way to affect text attributes in #GtkTextView is to
apply tags that change the attributes for a region of text.
For text features that come from the theme &mdash; such as font and
foreground color &mdash; use CSS to override their default values.
<informalexample><programlisting>
GtkWidget *view;
@@ -163,6 +160,8 @@ gtk_widget_override_color(). For other attributes there are dedicated methods on
PangoFontDescription *font_desc;
GdkRGBA rgba;
GtkTextTag *tag;
GtkCssProvider *provider;
GtkStyleContext *context;
view = gtk_text_view_new (<!-- -->);
@@ -170,14 +169,19 @@ gtk_widget_override_color(). For other attributes there are dedicated methods on
gtk_text_buffer_set_text (buffer, "Hello, this is some text", -1);
/* Change default font throughout the widget */
font_desc = pango_font_description_from_string ("Serif 15");
gtk_widget_modify_font (view, font_desc);
pango_font_description_free (font_desc);
/* Change default color throughout the widget */
gdk_rgba_parse ("green", &amp;rgba);
gtk_widget_override_color (view, GTK_STATE_FLAG_NORMAL, &amp;rgba);
/* Change default font and color throughout the widget */
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider,
"textview {"
" font: 15 serif;"
" color: green;"
"}",
-1,
NULL);
context = gtk_widget_get_style_context (view);
gtk_style_context_add_provider (context,
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
/* Change left margin throughout the widget */
gtk_text_view_set_left_margin (GTK_TEXT_VIEW (view), 30);

View File

@@ -459,29 +459,20 @@ stamp-gc-h: $(top_builddir)/config.status
#
# Resources
#
glsl_sources := $(wildcard $(srcdir)/resources/glsl/*.glsl)
gdk.gresource.xml: Makefile.am
$(AM_V_GEN) echo "<?xml version='1.0' encoding='UTF-8'?>" > $@; \
echo "<gresources>" >> $@; \
echo " <gresource prefix='/org/gtk/libgdk'>" >> $@; \
for f in $(srcdir)/resources/glsl/*.glsl; do \
for f in $(glsl_sources); do \
n=`basename $$f`; \
echo " <file alias='glsl/$$n'>resources/glsl/$$n</file>" >> $@; \
done; \
echo " </gresource>" >> $@; \
echo "</gresources>" >> $@;
glsl_sources = \
resources/glsl/gl3-texture-2d.fs.glsl \
resources/glsl/gl3-texture-2d.vs.glsl \
resources/glsl/gl3-texture-rect.fs.glsl \
resources/glsl/gl3-texture-rect.vs.glsl \
resources/glsl/gl2-texture-2d.fs.glsl \
resources/glsl/gl2-texture-2d.fs.glsl \
resources/glsl/gl2-texture-rect.vs.glsl \
resources/glsl/gl2-texture-rect.vs.glsl \
resources/glsl/gles2-texture.fs.glsl \
resources/glsl/gles2-texture.vs.glsl
EXTRA_DIST += $(glsl_sources)
CLEANFILES += gdk.gresource.xml

View File

@@ -162,8 +162,10 @@ gdk_app_launch_context_get_display (GAppLaunchContext *context,
GdkAppLaunchContext *ctx = GDK_APP_LAUNCH_CONTEXT (context);
GdkDisplay *display;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if (ctx->screen)
return gdk_screen_make_display_name (ctx->screen);
G_GNUC_END_IGNORE_DEPRECATIONS
if (ctx->display)
display = ctx->display;

View File

@@ -1708,6 +1708,7 @@ _gdk_device_translate_window_coord (GdkDevice *device,
device_width = axis_info_x->max_value - axis_info_x->min_value;
device_height = axis_info_y->max_value - axis_info_y->min_value;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if (device_width > 0)
x_min = axis_info_x->min_value;
else
@@ -1723,6 +1724,7 @@ _gdk_device_translate_window_coord (GdkDevice *device,
device_height = gdk_screen_get_height (gdk_window_get_screen (window));
y_min = 0;
}
G_GNUC_END_IGNORE_DEPRECATIONS
window_width = gdk_window_get_width (window);
window_height = gdk_window_get_height (window);
@@ -1805,6 +1807,7 @@ _gdk_device_translate_screen_coord (GdkDevice *device,
axis_width = axis_info.max_value - axis_info.min_value;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if (axis_info.use == GDK_AXIS_X)
{
if (axis_width > 0)
@@ -1823,6 +1826,7 @@ _gdk_device_translate_screen_coord (GdkDevice *device,
offset = - window_root_y - window->abs_y;
}
G_GNUC_END_IGNORE_DEPRECATIONS
if (axis_value)
*axis_value = offset + scale * (value - axis_info.min_value);

View File

@@ -2553,12 +2553,14 @@ get_fallback_monitor (GdkDisplay *display)
}
screen = gdk_display_get_default_screen (display);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gdk_monitor_set_size (monitor,
gdk_screen_get_width (screen),
gdk_screen_get_height (screen));
gdk_monitor_set_physical_size (monitor,
gdk_screen_get_width_mm (screen),
gdk_screen_get_height_mm (screen));
G_GNUC_END_IGNORE_DEPRECATIONS
return monitor;
}

View File

@@ -409,6 +409,7 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
alpha_size == 0 &&
direct_window != NULL &&
direct_window->current_paint.use_gl &&
gdk_gl_context_has_framebuffer_blit (paint_context) &&
trivial_transform &&
clip_region != NULL)
{

View File

@@ -105,7 +105,8 @@ typedef struct {
guint debug_enabled : 1;
guint forward_compatible : 1;
guint is_legacy : 1;
guint use_es : 1;
int use_es;
GdkGLContextPaintData *paint_data;
} GdkGLContextPrivate;
@@ -153,6 +154,7 @@ gdk_gl_context_finalize (GObject *gobject)
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
g_clear_pointer (&priv->paint_data, g_free);
G_OBJECT_CLASS (gdk_gl_context_parent_class)->finalize (gobject);
}
static void
@@ -362,6 +364,9 @@ gdk_gl_context_class_init (GdkGLContextClass *klass)
static void
gdk_gl_context_init (GdkGLContext *self)
{
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (self);
priv->use_es = -1;
}
/*< private >
@@ -572,7 +577,7 @@ gdk_gl_context_set_required_version (GdkGLContext *context,
/* Enforce a minimum context version number of 3.2 */
version = (major * 100) + minor;
if (priv->use_es || (_gdk_gl_flags & GDK_GL_GLES) != 0)
if (priv->use_es > 0 || (_gdk_gl_flags & GDK_GL_GLES) != 0)
min_ver = 200;
else
min_ver = 302;
@@ -608,7 +613,7 @@ gdk_gl_context_get_required_version (GdkGLContext *context,
g_return_if_fail (GDK_IS_GL_CONTEXT (context));
if (priv->use_es || (_gdk_gl_flags & GDK_GL_GLES) != 0)
if (priv->use_es > 0 || (_gdk_gl_flags & GDK_GL_GLES) != 0)
{
default_major = 2;
default_minor = 0;
@@ -683,13 +688,18 @@ gdk_gl_context_set_is_legacy (GdkGLContext *context,
/**
* gdk_gl_context_set_use_es:
* @context: a #GdkGLContext:
* @use_es: whether the context should use OpenGL ES instead of OpenGL
* @use_es: whether the context should use OpenGL ES instead of OpenGL,
* or -1 to allow auto-detection
*
* Requests that GDK create a OpenGL ES context instead of an OpenGL one,
* if the platform and windowing system allows it.
*
* The @context must not have been realized.
*
* By default, GDK will attempt to automatically detect whether the
* underlying GL implementation is OpenGL or OpenGL ES once the @context
* is realized.
*
* You should check the return value of gdk_gl_context_get_use_es() after
* calling gdk_gl_context_realize() to decide whether to use the OpenGL or
* OpenGL ES API, extensions, or shaders.
@@ -698,14 +708,15 @@ gdk_gl_context_set_is_legacy (GdkGLContext *context,
*/
void
gdk_gl_context_set_use_es (GdkGLContext *context,
gboolean use_es)
int use_es)
{
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
g_return_if_fail (GDK_IS_GL_CONTEXT (context));
g_return_if_fail (!priv->realized);
priv->use_es = !!use_es;
if (priv->use_es != use_es)
priv->use_es = use_es;
}
/**
@@ -725,7 +736,10 @@ gdk_gl_context_get_use_es (GdkGLContext *context)
g_return_val_if_fail (GDK_IS_GL_CONTEXT (context), FALSE);
return priv->use_es;
if (!priv->realized)
return FALSE;
return priv->use_es > 0;
}
/**
@@ -769,9 +783,11 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
if (priv->extensions_checked)
return;
priv->use_es = !epoxy_is_desktop_gl ();
priv->gl_version = epoxy_gl_version ();
if (priv->use_es < 0)
priv->use_es = !epoxy_is_desktop_gl ();
if (priv->use_es)
{
has_npot = priv->gl_version >= 20;
@@ -796,6 +812,10 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
priv->has_gl_framebuffer_blit = epoxy_has_gl_extension ("GL_EXT_framebuffer_blit");
priv->has_frame_terminator = epoxy_has_gl_extension ("GL_GREMEDY_frame_terminator");
priv->has_unpack_subimage = TRUE;
/* We asked for a core profile, but we didn't get one, so we're in legacy mode */
if (priv->gl_version < 32)
priv->is_legacy = TRUE;
}
if (!priv->use_es && G_UNLIKELY (_gdk_gl_flags & GDK_GL_TEXTURE_RECTANGLE))
@@ -808,7 +828,8 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
g_warning ("GL implementation doesn't support any form of non-power-of-two textures");
GDK_NOTE (OPENGL,
g_message ("%s version: %d.%d\n"
g_message ("%s version: %d.%d (%s)\n"
"* GLSL version: %s\n"
"* Extensions checked:\n"
" - GL_ARB_texture_non_power_of_two: %s\n"
" - GL_ARB_texture_rectangle: %s\n"
@@ -817,6 +838,8 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
"* Using texture rectangle: %s",
priv->use_es ? "OpenGL ES" : "OpenGL",
priv->gl_version / 10, priv->gl_version % 10,
priv->is_legacy ? "legacy" : "core",
glGetString (GL_SHADING_LANGUAGE_VERSION),
has_npot ? "yes" : "no",
has_texture_rectangle ? "yes" : "no",
priv->has_gl_framebuffer_blit ? "yes" : "no",

View File

@@ -75,7 +75,7 @@ GDK_AVAILABLE_IN_3_16
gboolean gdk_gl_context_get_forward_compatible (GdkGLContext *context);
GDK_AVAILABLE_IN_3_22
void gdk_gl_context_set_use_es (GdkGLContext *context,
gboolean use_es);
int use_es);
GDK_AVAILABLE_IN_3_22
gboolean gdk_gl_context_get_use_es (GdkGLContext *context);

View File

@@ -104,14 +104,14 @@ GDK_DEPRECATED_IN_3_0_FOR(gdk_display_device_is_grabbed)
gboolean gdk_pointer_is_grabbed (void);
#endif /* GDK_MULTIDEVICE_SAFE */
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_22
gint gdk_screen_width (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_22
gint gdk_screen_height (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_22
gint gdk_screen_width_mm (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_22
gint gdk_screen_height_mm (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL

View File

@@ -222,6 +222,8 @@ get_monitor_num (GdkMonitor *monitor)
* a monitor close to (@x,@y) if the point is not in any monitor.
*
* Since: 2.2
*
* Deprecated: 3.22: Use gdk_display_get_monitor_at_point() instead
**/
gint
gdk_screen_get_monitor_at_point (GdkScreen *screen,
@@ -251,6 +253,8 @@ gdk_screen_get_monitor_at_point (GdkScreen *screen,
* close to @window.
*
* Since: 2.2
*
* Deprecated: 3.22: Use gdk_display_get_monitor_at_window() instead
**/
gint
gdk_screen_get_monitor_at_window (GdkScreen *screen,
@@ -275,11 +279,15 @@ gdk_screen_get_monitor_at_window (GdkScreen *screen,
* gdk_screen_get_monitor_scale_factor()).
*
* Returns: the width of the default screen in pixels.
*
* Deprecated: 3.22: Use per-monitor information
**/
gint
gdk_screen_width (void)
{
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
return gdk_screen_get_width (gdk_screen_get_default ());
G_GNUC_END_IGNORE_DEPRECATIONS
}
/**
@@ -290,11 +298,15 @@ gdk_screen_width (void)
* gdk_screen_get_monitor_scale_factor()).
*
* Returns: the height of the default screen in pixels.
*
* Deprecated: 3.22: Use per-monitor information
**/
gint
gdk_screen_height (void)
{
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
return gdk_screen_get_height (gdk_screen_get_default ());
G_GNUC_END_IGNORE_DEPRECATIONS
}
/**
@@ -305,11 +317,15 @@ gdk_screen_height (void)
*
* Returns: the width of the default screen in millimeters,
* though it is not always correct.
*
* Deprecated: 3.22: Use per-monitor information
**/
gint
gdk_screen_width_mm (void)
{
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
return gdk_screen_get_width_mm (gdk_screen_get_default ());
G_GNUC_END_IGNORE_DEPRECATIONS
}
/**
@@ -320,11 +336,15 @@ gdk_screen_width_mm (void)
*
* Returns: the height of the default screen in millimeters,
* though it is not always correct.
*
* Deprecated: 3.22: Use per-monitor information
**/
gint
gdk_screen_height_mm (void)
{
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
return gdk_screen_get_height_mm (gdk_screen_get_default ());
G_GNUC_END_IGNORE_DEPRECATIONS
}
/**
@@ -529,6 +549,8 @@ gdk_screen_get_display (GdkScreen *screen)
* Returns: the width of @screen in pixels.
*
* Since: 2.2
*
* Deprecated: 3.22: Use per-monitor information instead
**/
gint
gdk_screen_get_width (GdkScreen *screen)
@@ -549,6 +571,8 @@ gdk_screen_get_width (GdkScreen *screen)
* Returns: the height of @screen in pixels.
*
* Since: 2.2
*
* Deprecated: 3.22: Use per-monitor information instead
**/
gint
gdk_screen_get_height (GdkScreen *screen)
@@ -571,6 +595,8 @@ gdk_screen_get_height (GdkScreen *screen)
* Returns: the width of @screen in millimeters.
*
* Since: 2.2
*
* Deprecated: 3.22: Use per-monitor information instead
**/
gint
gdk_screen_get_width_mm (GdkScreen *screen)
@@ -592,6 +618,8 @@ gdk_screen_get_width_mm (GdkScreen *screen)
*
* Returns: the heigth of @screen in millimeters.
*
* Deprecated: 3.22: Use per-monitor information instead
*
* Since: 2.2
**/
gint
@@ -612,6 +640,8 @@ gdk_screen_get_height_mm (GdkScreen *screen)
* Returns: the index
*
* Since: 2.2
*
* Deprecated: 3.22
**/
gint
gdk_screen_get_number (GdkScreen *screen)
@@ -658,6 +688,8 @@ get_monitor (GdkScreen *screen,
* Returns: number of monitors which @screen consists of
*
* Since: 2.2
*
* Deprecated: 3.22: Use gdk_display_get_n_monitors() instead
*/
gint
gdk_screen_get_n_monitors (GdkScreen *screen)
@@ -686,6 +718,8 @@ gdk_screen_get_n_monitors (GdkScreen *screen)
* Returns: An integer index for the primary monitor, or 0 if none is configured.
*
* Since: 2.20
*
* Deprecated: 3.22: Use gdk_display_get_primary_monitor() instead
*/
gint
gdk_screen_get_primary_monitor (GdkScreen *screen)
@@ -713,6 +747,8 @@ gdk_screen_get_primary_monitor (GdkScreen *screen)
* Returns: the width of the monitor, or -1 if not available
*
* Since: 2.14
*
* Deprecated: 3.22: Use gdk_monitor_get_width_mm() instead
*/
gint
gdk_screen_get_monitor_width_mm (GdkScreen *screen,
@@ -739,6 +775,8 @@ gdk_screen_get_monitor_width_mm (GdkScreen *screen,
* Returns: the height of the monitor, or -1 if not available
*
* Since: 2.14
*
* Deprecated: 3.22: Use gdk_monitor_get_height_mm() instead
*/
gint
gdk_screen_get_monitor_height_mm (GdkScreen *screen,
@@ -768,6 +806,8 @@ gdk_screen_get_monitor_height_mm (GdkScreen *screen,
* of the monitor, or %NULL if the name cannot be determined
*
* Since: 2.14
*
* Deprecated: 3.22: Use gdk_monitor_get_model() instead
*/
gchar *
gdk_screen_get_monitor_plug_name (GdkScreen *screen,
@@ -803,6 +843,8 @@ gdk_screen_get_monitor_plug_name (GdkScreen *screen,
* gdk_screen_get_width() and gdk_screen_get_height().
*
* Since: 2.2
*
* Deprecated: 3.22: Use gdk_monitor_get_geometry() instead
*/
void
gdk_screen_get_monitor_geometry (GdkScreen *screen,
@@ -844,6 +886,8 @@ gdk_screen_get_monitor_geometry (GdkScreen *screen,
* @screen, use gdk_screen_get_n_monitors().
*
* Since: 3.4
*
* Deprecated: 3.22: Use gdk_monitor_get_workarea() instead
*/
void
gdk_screen_get_monitor_workarea (GdkScreen *screen,
@@ -972,6 +1016,8 @@ gdk_screen_is_composited (GdkScreen *screen)
* Returns: a newly allocated string, free with g_free()
*
* Since: 2.2
*
* Deprecated: 3.22
**/
gchar *
gdk_screen_make_display_name (GdkScreen *screen)
@@ -1004,6 +1050,8 @@ gdk_screen_make_display_name (GdkScreen *screen)
* or %NULL.
*
* Since: 2.10
*
* Deprecated: 3.22
**/
GdkWindow *
gdk_screen_get_active_window (GdkScreen *screen)
@@ -1088,8 +1136,11 @@ gdk_screen_get_setting (GdkScreen *screen,
* particular monitor, but most of the time youre drawing to a window
* where it is better to use gdk_window_get_scale_factor() instead.
*
* Since: 3.10
* Returns: the scale factor
*
* Since: 3.10
*
* Deprecated: 3.22: Use gdk_monitor_get_scale_factor() instead
*/
gint
gdk_screen_get_monitor_scale_factor (GdkScreen *screen,
@@ -1099,7 +1150,9 @@ gdk_screen_get_monitor_scale_factor (GdkScreen *screen,
g_return_val_if_fail (GDK_IS_SCREEN (screen), 1);
g_return_val_if_fail (monitor_num >= 0, 1);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
g_return_val_if_fail (monitor_num < gdk_screen_get_n_monitors (screen), 1);
G_GNUC_END_IGNORE_DEPRECATIONS
monitor = get_monitor (screen, monitor_num);

View File

@@ -52,54 +52,54 @@ GDK_AVAILABLE_IN_ALL
GdkWindow * gdk_screen_get_root_window (GdkScreen *screen);
GDK_AVAILABLE_IN_ALL
GdkDisplay * gdk_screen_get_display (GdkScreen *screen);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_22
gint gdk_screen_get_number (GdkScreen *screen);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_22
gint gdk_screen_get_width (GdkScreen *screen);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_22
gint gdk_screen_get_height (GdkScreen *screen);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_22
gint gdk_screen_get_width_mm (GdkScreen *screen);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_22
gint gdk_screen_get_height_mm (GdkScreen *screen);
GDK_AVAILABLE_IN_ALL
GList * gdk_screen_list_visuals (GdkScreen *screen);
GDK_AVAILABLE_IN_ALL
GList * gdk_screen_get_toplevel_windows (GdkScreen *screen);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_22
gchar * gdk_screen_make_display_name (GdkScreen *screen);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_22_FOR(gdk_display_get_n_monitors)
gint gdk_screen_get_n_monitors (GdkScreen *screen);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_22_FOR(gdk_display_get_primary_monitor)
gint gdk_screen_get_primary_monitor (GdkScreen *screen);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_22_FOR(gdk_monitor_get_geometry)
void gdk_screen_get_monitor_geometry (GdkScreen *screen,
gint monitor_num,
GdkRectangle *dest);
GDK_AVAILABLE_IN_3_4
GDK_DEPRECATED_IN_3_22_FOR(gdk_monitor_get_workarea)
void gdk_screen_get_monitor_workarea (GdkScreen *screen,
gint monitor_num,
GdkRectangle *dest);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_22_FOR(gdk_display_get_monitor_at_point)
gint gdk_screen_get_monitor_at_point (GdkScreen *screen,
gint x,
gint y);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_22_FOR(gdk_display_get_monitor_at_window)
gint gdk_screen_get_monitor_at_window (GdkScreen *screen,
GdkWindow *window);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_22_FOR(gdk_monitor_get_width_mm)
gint gdk_screen_get_monitor_width_mm (GdkScreen *screen,
gint monitor_num);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_22_FOR(gdk_monitor_get_height_mm)
gint gdk_screen_get_monitor_height_mm (GdkScreen *screen,
gint monitor_num);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_22_FOR(gdk_monitor_get_model)
gchar * gdk_screen_get_monitor_plug_name (GdkScreen *screen,
gint monitor_num);
GDK_AVAILABLE_IN_3_10
GDK_DEPRECATED_IN_3_22_FOR(gdk_monitor_get_scale_factor)
gint gdk_screen_get_monitor_scale_factor (GdkScreen *screen,
gint monitor_num);
@@ -123,7 +123,7 @@ void gdk_screen_set_resolution (GdkScreen *screen,
GDK_AVAILABLE_IN_ALL
gdouble gdk_screen_get_resolution (GdkScreen *screen);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_22
GdkWindow *gdk_screen_get_active_window (GdkScreen *screen);
GDK_AVAILABLE_IN_ALL
GList *gdk_screen_get_window_stack (GdkScreen *screen);

View File

@@ -172,16 +172,6 @@
*/
#define GDK_VERSION_3_22 (G_ENCODE_VERSION (3, 22))
/**
* GDK_VERSION_3_90:
*
* A macro that evaluates to the 3.90 version of GDK, in a format
* that can be used by the C pre-processor.
*
* Since: 3.90
*/
#define GDK_VERSION_3_90 (G_ENCODE_VERSION (3, 90))
/* evaluates to the current stable version; for development cycles,
* this means the next stable target
*/
@@ -422,11 +412,5 @@
# define GDK_AVAILABLE_IN_3_22 _GDK_EXTERN
#endif
#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_3_90
# define GDK_AVAILABLE_IN_3_90 GDK_UNAVAILABLE(3, 90)
#else
# define GDK_AVAILABLE_IN_3_90 _GDK_EXTERN
#endif
#endif /* __GDK_VERSION_MACROS_H__ */

View File

@@ -88,6 +88,8 @@ gdk_visual_class_init (GdkVisualClass *visual_class)
*
* Returns: (transfer container) (element-type GdkVisual):
* a list of visuals; the list must be freed, but not its contents
*
* Deprecated: 3.22: Use gdk_screen_list_visuals (gdk_screen_get_default ()).
*/
GList*
gdk_list_visuals (void)
@@ -103,6 +105,8 @@ gdk_list_visuals (void)
* The return value should not be freed.
*
* Returns: (transfer none): system visual
*
* Deprecated: 3.22: Use gdk_screen_get_system_visual (gdk_screen_get_default ()).
*/
GdkVisual*
gdk_visual_get_system (void)
@@ -118,6 +122,9 @@ gdk_visual_get_system (void)
* per pixel.
*
* Returns: best available depth
*
* Deprecated: 3.22: Visual selection should be done using
* gdk_screen_get_system_visual() and gdk_screen_get_rgba_visual()
*/
gint
gdk_visual_get_best_depth (void)
@@ -133,6 +140,9 @@ gdk_visual_get_best_depth (void)
* Return the best available visual type for the default GDK screen.
*
* Returns: best visual type
*
* Deprecated: 3.22: Visual selection should be done using
* gdk_screen_get_system_visual() and gdk_screen_get_rgba_visual()
*/
GdkVisualType
gdk_visual_get_best_type (void)
@@ -149,6 +159,9 @@ gdk_visual_get_best_type (void)
* GDK screen. The return value should not be freed.
*
* Returns: (transfer none): best visual
*
* Deprecated: 3.22: Visual selection should be done using
* gdk_screen_get_system_visual() and gdk_screen_get_rgba_visual()
*/
GdkVisual*
gdk_visual_get_best (void)
@@ -168,6 +181,9 @@ gdk_visual_get_best (void)
* not be freed. %NULL may be returned if no visual supports @depth.
*
* Returns: (transfer none): best visual for the given depth
*
* Deprecated: 3.22: Visual selection should be done using
* gdk_screen_get_system_visual() and gdk_screen_get_rgba_visual()
*/
GdkVisual*
gdk_visual_get_best_with_depth (gint depth)
@@ -187,6 +203,9 @@ gdk_visual_get_best_with_depth (gint depth)
* @visual_type.
*
* Returns: (transfer none): best visual of the given type
*
* Deprecated: 3.22: Visual selection should be done using
* gdk_screen_get_system_visual() and gdk_screen_get_rgba_visual()
*/
GdkVisual*
gdk_visual_get_best_with_type (GdkVisualType visual_type)
@@ -207,6 +226,9 @@ gdk_visual_get_best_with_type (GdkVisualType visual_type)
*
* Returns: (nullable) (transfer none): best visual with both @depth
* and @visual_type, or %NULL if none
*
* Deprecated: 3.22: Visual selection should be done using
* gdk_screen_get_system_visual() and gdk_screen_get_rgba_visual()
*/
GdkVisual*
gdk_visual_get_best_with_both (gint depth,
@@ -229,6 +251,9 @@ gdk_visual_get_best_with_both (gint depth,
* visual, removing duplicates.
*
* The array returned by this function should not be freed.
*
* Deprecated: 3.22: Visual selection should be done using
* gdk_screen_get_system_visual() and gdk_screen_get_rgba_visual()
*/
void
gdk_query_depths (gint **depths,
@@ -251,6 +276,9 @@ gdk_query_depths (gint **depths,
* visual, removing duplicates.
*
* The array returned by this function should not be freed.
*
* Deprecated: 3.22: Visual selection should be done using
* gdk_screen_get_system_visual() and gdk_screen_get_rgba_visual()
*/
void
gdk_query_visual_types (GdkVisualType **visual_types,

View File

@@ -82,30 +82,30 @@ typedef enum
GDK_AVAILABLE_IN_ALL
GType gdk_visual_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_22
gint gdk_visual_get_best_depth (void);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_22
GdkVisualType gdk_visual_get_best_type (void);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_22_FOR(gdk_screen_get_system_visual)
GdkVisual* gdk_visual_get_system (void);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_22
GdkVisual* gdk_visual_get_best (void);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_22
GdkVisual* gdk_visual_get_best_with_depth (gint depth);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_22
GdkVisual* gdk_visual_get_best_with_type (GdkVisualType visual_type);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_22
GdkVisual* gdk_visual_get_best_with_both (gint depth,
GdkVisualType visual_type);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_22
void gdk_query_depths (gint **depths,
gint *count);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_22
void gdk_query_visual_types (GdkVisualType **visual_types,
gint *count);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_22_FOR(gdk_screen_list_visuals)
GList* gdk_list_visuals (void);
GDK_AVAILABLE_IN_ALL

View File

@@ -637,6 +637,12 @@ gdk_window_is_offscreen (GdkWindow *window)
return window->window_type == GDK_WINDOW_OFFSCREEN;
}
static gboolean
gdk_window_is_subsurface (GdkWindow *window)
{
return window->window_type == GDK_WINDOW_SUBSURFACE;
}
static GdkWindow *
gdk_window_get_impl_window (GdkWindow *window)
{
@@ -973,9 +979,12 @@ recompute_visible_regions_internal (GdkWindow *private,
old_abs_y = private->abs_y;
/* Update absolute position */
if (gdk_window_has_impl (private))
if ((gdk_window_has_impl (private) &&
private->window_type != GDK_WINDOW_SUBSURFACE) ||
(gdk_window_is_toplevel (private) &&
private->window_type == GDK_WINDOW_SUBSURFACE))
{
/* Native window starts here */
/* Native windows and toplevel subsurfaces start here */
private->abs_x = 0;
private->abs_y = 0;
}
@@ -1461,6 +1470,11 @@ gdk_window_new (GdkWindow *parent,
if (window->parent->window_type == GDK_WINDOW_ROOT)
native = TRUE; /* Always use native windows for toplevels */
#ifdef GDK_WINDOWING_WAYLAND
if (window->window_type == GDK_WINDOW_SUBSURFACE)
native = TRUE; /* Always use native windows for subsurfaces as well */
#endif
if (gdk_window_is_offscreen (window))
{
_gdk_offscreen_window_new (window, attributes, attributes_mask);
@@ -2022,6 +2036,7 @@ _gdk_window_destroy_hierarchy (GdkWindow *window,
case GDK_WINDOW_TEMP:
case GDK_WINDOW_FOREIGN:
case GDK_WINDOW_OFFSCREEN:
case GDK_WINDOW_SUBSURFACE:
if (window->window_type == GDK_WINDOW_FOREIGN && !foreign_destroy)
{
/* Logically, it probably makes more sense to send
@@ -2420,6 +2435,8 @@ gdk_window_get_effective_parent (GdkWindow *window)
if (gdk_window_is_offscreen (window))
return gdk_offscreen_window_get_embedder (window);
else if (gdk_window_is_subsurface (window))
return window->transient_for;
else
return window->parent;
}
@@ -2446,7 +2463,8 @@ gdk_window_get_toplevel (GdkWindow *window)
{
g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
while (window->window_type == GDK_WINDOW_CHILD)
while (window->window_type == GDK_WINDOW_CHILD ||
window->window_type == GDK_WINDOW_SUBSURFACE)
{
if (gdk_window_is_toplevel (window))
break;
@@ -3491,7 +3509,9 @@ gdk_window_clear_backing_region (GdkWindow *window)
for (bg_window = window; bg_window; bg_window = bg_window->parent)
{
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
pattern = gdk_window_get_background_pattern (bg_window);
G_GNUC_END_IGNORE_DEPRECATIONS
if (pattern)
break;
@@ -4044,6 +4064,7 @@ after_process_all_updates (void)
* Calls gdk_window_process_updates() for all windows (see #GdkWindow)
* in the application.
*
* Deprecated: 3.22
**/
void
gdk_window_process_all_updates (void)
@@ -4191,6 +4212,7 @@ gdk_window_process_updates_with_mode (GdkWindow *window,
* case, where GDK delivers them in an idle handler). Occasionally
* this is useful to produce nicer scrolling behavior, for example.
*
* Deprecated: 3.22
**/
void
gdk_window_process_updates (GdkWindow *window,
@@ -4792,7 +4814,8 @@ gdk_window_thaw_toplevel_updates (GdkWindow *window)
* yourself, though you might want to use this function to enable
* updates sometime after application startup time.
*
**/
* Deprecated: 3.22
*/
void
gdk_window_set_debug_updates (gboolean setting)
{
@@ -6341,9 +6364,7 @@ gdk_window_move_region (GdkWindow *window,
* gtk_style_context_set_background() — if you're implementing a
* custom widget.
*
* See also gdk_window_set_background_pattern().
*
* Deprecated: 3.4: Use gdk_window_set_background_rgba() instead.
* Deprecated: 3.4: Don't use this function
*/
void
gdk_window_set_background (GdkWindow *window,
@@ -6357,7 +6378,9 @@ gdk_window_set_background (GdkWindow *window,
color->green / 65535.,
color->blue / 65535.);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gdk_window_set_background_pattern (window, pattern);
G_GNUC_END_IGNORE_DEPRECATIONS
cairo_pattern_destroy (pattern);
}
@@ -6370,6 +6393,8 @@ gdk_window_set_background (GdkWindow *window,
* Sets the background color of @window.
*
* See also gdk_window_set_background_pattern().
*
* Deprecated: 3.22: Don't use this function
**/
void
gdk_window_set_background_rgba (GdkWindow *window,
@@ -6398,7 +6423,9 @@ gdk_window_set_background_rgba (GdkWindow *window,
pattern = cairo_pattern_create_rgba (rgba->red, rgba->green,
rgba->blue, rgba->alpha);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gdk_window_set_background_pattern (window, pattern);
G_GNUC_END_IGNORE_DEPRECATIONS
cairo_pattern_destroy (pattern);
}
@@ -6416,6 +6443,8 @@ gdk_window_set_background_rgba (GdkWindow *window,
*
* The windowing system will normally fill a window with its background
* when the window is obscured then exposed.
*
* Deprecated: 3.22: Don't use this function
*/
void
gdk_window_set_background_pattern (GdkWindow *window,
@@ -6453,6 +6482,8 @@ gdk_window_set_background_pattern (GdkWindow *window,
* background or %NULL to use the parents background.
*
* Since: 2.22
*
* Deprecated: 3.22: Don't use this function
**/
cairo_pattern_t *
gdk_window_get_background_pattern (GdkWindow *window)
@@ -10166,6 +10197,10 @@ gdk_window_create_similar_surface (GdkWindow * window,
* scale);
* ]|
*
* Note that unlike cairo_surface_create_similar_image(), the new
* surface's device scale is set to @scale, or to the scale factor of
* @window if @scale is 0.
*
* Returns: a pointer to the newly allocated surface. The caller
* owns the surface and should call cairo_surface_destroy() when done
* with it.
@@ -10832,10 +10867,10 @@ void
gdk_window_fullscreen_on_monitor (GdkWindow *window,
gint monitor)
{
GdkScreen *screen = gdk_window_get_screen (window);
GdkDisplay *display = gdk_window_get_display (window);
g_return_if_fail (monitor >= 0);
g_return_if_fail (monitor < gdk_screen_get_n_monitors (screen));
g_return_if_fail (monitor < gdk_display_get_n_monitors (display));
if (GDK_WINDOW_IMPL_GET_CLASS (window->impl)->fullscreen_on_monitor != NULL)
GDK_WINDOW_IMPL_GET_CLASS (window->impl)->fullscreen_on_monitor (window, monitor);

View File

@@ -771,16 +771,16 @@ void gdk_window_set_startup_id (GdkWindow *window,
GDK_AVAILABLE_IN_ALL
void gdk_window_set_transient_for (GdkWindow *window,
GdkWindow *parent);
GDK_DEPRECATED_IN_3_4_FOR(gdk_window_set_background_rgba)
GDK_DEPRECATED_IN_3_4
void gdk_window_set_background (GdkWindow *window,
const GdkColor *color);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_22
void gdk_window_set_background_rgba (GdkWindow *window,
const GdkRGBA *rgba);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_22
void gdk_window_set_background_pattern (GdkWindow *window,
cairo_pattern_t *pattern);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_22
cairo_pattern_t *gdk_window_get_background_pattern (GdkWindow *window);
GDK_AVAILABLE_IN_ALL
@@ -1054,14 +1054,14 @@ void gdk_window_freeze_toplevel_updates_libgtk_only (GdkWindow *window);
GDK_DEPRECATED_IN_3_16
void gdk_window_thaw_toplevel_updates_libgtk_only (GdkWindow *window);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_22
void gdk_window_process_all_updates (void);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_22
void gdk_window_process_updates (GdkWindow *window,
gboolean update_children);
/* Enable/disable flicker, so you can tell if your code is inefficient. */
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_22
void gdk_window_set_debug_updates (gboolean setting);
GDK_AVAILABLE_IN_ALL

View File

@@ -17,6 +17,8 @@
#include "gdkmir-private.h"
#include <mir_toolkit/events/window_placement.h>
static void
_gdk_mir_print_modifiers (unsigned int modifiers)
{
@@ -127,6 +129,7 @@ _gdk_mir_print_touch_event (const MirInputEvent *event)
}
switch (mir_touch_event_tooltype (touch_event, i))
{
default:
case mir_touch_tooltype_unknown:
g_printerr (" ? ");
break;
@@ -200,30 +203,45 @@ _gdk_mir_print_motion_event (const MirInputEvent *event)
}
static void
_gdk_mir_print_surface_event (const MirSurfaceEvent *event)
_gdk_mir_print_input_event (const MirInputEvent *event)
{
g_printerr ("SURFACE\n");
g_printerr ("INPUT\n");
}
static void
_gdk_mir_print_window_event (const MirWindowEvent *event)
{
g_printerr ("WINDOW\n");
g_printerr (" Attribute ");
switch (mir_surface_event_get_attribute (event))
switch (mir_window_event_get_attribute (event))
{
case mir_surface_attrib_type:
case mir_window_attrib_type:
g_printerr ("type");
break;
case mir_surface_attrib_state:
case mir_window_attrib_state:
g_printerr ("state");
break;
case mir_surface_attrib_swapinterval:
case mir_window_attrib_swapinterval:
g_printerr ("swapinterval");
break;
case mir_surface_attrib_focus:
case mir_window_attrib_focus:
g_printerr ("focus");
break;
case mir_window_attrib_dpi:
g_printerr ("dpi");
break;
case mir_window_attrib_visibility:
g_printerr ("visibility");
break;
case mir_window_attrib_preferred_orientation:
g_printerr ("preferred_orientation");
break;
default:
g_printerr ("%u", mir_surface_event_get_attribute (event));
g_printerr ("%u", mir_window_event_get_attribute (event));
break;
}
g_printerr ("\n");
g_printerr (" Value %i\n", mir_surface_event_get_attribute_value (event));
g_printerr (" Value %i\n", mir_window_event_get_attribute_value (event));
}
static void
@@ -233,12 +251,237 @@ _gdk_mir_print_resize_event (const MirResizeEvent *event)
g_printerr (" Size (%i, %i)\n", mir_resize_event_get_width (event), mir_resize_event_get_height (event));
}
static void
_gdk_mir_print_prompt_session_state_change_event (const MirPromptSessionEvent *event)
{
g_printerr ("PROMPT_SESSION_STATE_CHANGE\n");
g_printerr (" State ");
switch (mir_prompt_session_event_get_state (event))
{
case mir_prompt_session_state_stopped:
g_printerr ("stopped");
break;
case mir_prompt_session_state_started:
g_printerr ("started");
break;
case mir_prompt_session_state_suspended:
g_printerr ("suspended");
break;
default:
g_printerr ("%u", mir_prompt_session_event_get_state (event));
break;
}
g_printerr ("\n");
}
static void
_gdk_mir_print_orientation_event (const MirOrientationEvent *event)
{
g_printerr ("ORIENTATION\n");
g_printerr (" Direction ");
switch (mir_orientation_event_get_direction (event))
{
case mir_orientation_normal:
g_printerr ("normal");
break;
case mir_orientation_left:
g_printerr ("left");
break;
case mir_orientation_inverted:
g_printerr ("inverted");
break;
case mir_orientation_right:
g_printerr ("right");
break;
default:
g_printerr ("%u", mir_orientation_event_get_direction (event));
break;
}
g_printerr ("\n");
}
static void
_gdk_mir_print_close_event (void)
{
g_printerr ("CLOSED\n");
}
static void
_gdk_mir_print_keymap_event (const MirKeymapEvent *event)
{
g_printerr ("KEYMAP\n");
}
static void
_gdk_mir_print_window_output_event (const MirWindowOutputEvent *event)
{
g_printerr ("WINDOW_OUTPUT\n");
g_printerr (" DPI %d\n", mir_window_output_event_get_dpi (event));
g_printerr (" Form Factor ");
switch (mir_window_output_event_get_form_factor (event))
{
case mir_form_factor_unknown:
g_printerr ("unknown");
break;
case mir_form_factor_phone:
g_printerr ("phone");
break;
case mir_form_factor_tablet:
g_printerr ("tablet");
break;
case mir_form_factor_monitor:
g_printerr ("monitor");
break;
case mir_form_factor_tv:
g_printerr ("tv");
break;
case mir_form_factor_projector:
g_printerr ("projector");
break;
default:
g_printerr ("%u", mir_window_output_event_get_form_factor (event));
break;
}
g_printerr ("\n");
g_printerr (" Scale %f\n", mir_window_output_event_get_scale (event));
g_printerr (" Refresh Rate %lf\n", mir_window_output_event_get_refresh_rate (event));
g_printerr (" Output ID %u\n", mir_window_output_event_get_output_id (event));
}
static void
_gdk_mir_print_input_device_state_event (const MirInputDeviceStateEvent *event)
{
MirPointerButtons buttons;
MirInputEventModifiers modifiers;
gint i;
gint j;
g_printerr ("INPUT_DEVICE_STATE\n");
g_printerr (" Pointer Buttons\n");
buttons = mir_input_device_state_event_pointer_buttons (event);
if (buttons == 0)
g_printerr (" none\n");
else
{
if (buttons & mir_pointer_button_primary)
g_printerr (" primary\n");
if (buttons & mir_pointer_button_secondary)
g_printerr (" secondary\n");
if (buttons & mir_pointer_button_tertiary)
g_printerr (" tertiary\n");
if (buttons & mir_pointer_button_back)
g_printerr (" back\n");
if (buttons & mir_pointer_button_forward)
g_printerr (" forward\n");
if (buttons & mir_pointer_button_side)
g_printerr (" side\n");
if (buttons & mir_pointer_button_extra)
g_printerr (" extra\n");
if (buttons & mir_pointer_button_task)
g_printerr (" task\n");
}
g_printerr (" Pointer Axis\n");
g_printerr (" X %f\n", mir_input_device_state_event_pointer_axis (event, mir_pointer_axis_x));
g_printerr (" Y %f\n", mir_input_device_state_event_pointer_axis (event, mir_pointer_axis_y));
g_printerr (" V Scroll %f\n", mir_input_device_state_event_pointer_axis (event, mir_pointer_axis_vscroll));
g_printerr (" H Scroll %f\n", mir_input_device_state_event_pointer_axis (event, mir_pointer_axis_hscroll));
g_printerr (" Relative X %f\n", mir_input_device_state_event_pointer_axis (event, mir_pointer_axis_relative_x));
g_printerr (" Relative Y %f\n", mir_input_device_state_event_pointer_axis (event, mir_pointer_axis_relative_y));
g_printerr (" Time %ld\n", mir_input_device_state_event_time (event));
g_printerr (" Event Modifiers\n");
modifiers = mir_input_device_state_event_modifiers (event);
if (modifiers & mir_input_event_modifier_none)
g_printerr (" none\n");
if (modifiers & mir_input_event_modifier_alt)
g_printerr (" alt\n");
if (modifiers & mir_input_event_modifier_alt_left)
g_printerr (" alt_left\n");
if (modifiers & mir_input_event_modifier_alt_right)
g_printerr (" alt_right\n");
if (modifiers & mir_input_event_modifier_shift)
g_printerr (" shift\n");
if (modifiers & mir_input_event_modifier_shift_left)
g_printerr (" shift_left\n");
if (modifiers & mir_input_event_modifier_shift_right)
g_printerr (" shift_right\n");
if (modifiers & mir_input_event_modifier_sym)
g_printerr (" sym\n");
if (modifiers & mir_input_event_modifier_function)
g_printerr (" function\n");
if (modifiers & mir_input_event_modifier_ctrl)
g_printerr (" ctrl\n");
if (modifiers & mir_input_event_modifier_ctrl_left)
g_printerr (" ctrl_left\n");
if (modifiers & mir_input_event_modifier_ctrl_right)
g_printerr (" ctrl_right\n");
if (modifiers & mir_input_event_modifier_meta)
g_printerr (" meta\n");
if (modifiers & mir_input_event_modifier_meta_left)
g_printerr (" meta_left\n");
if (modifiers & mir_input_event_modifier_meta_right)
g_printerr (" meta_right\n");
if (modifiers & mir_input_event_modifier_caps_lock)
g_printerr (" caps_lock\n");
if (modifiers & mir_input_event_modifier_num_lock)
g_printerr (" num_lock\n");
if (modifiers & mir_input_event_modifier_scroll_lock)
g_printerr (" scroll_lock\n");
for (i = 0; i < mir_input_device_state_event_device_count (event); i++)
{
g_printerr (" Device %ld\n", mir_input_device_state_event_device_id (event, i));
for (j = 0; j < mir_input_device_state_event_device_pressed_keys_count (event, i); j++)
g_printerr (" Pressed %u\n", mir_input_device_state_event_device_pressed_keys_for_index (event, i, j));
g_printerr (" Pointer Buttons\n");
buttons = mir_input_device_state_event_device_pointer_buttons (event, i);
if (buttons == 0)
g_printerr (" none\n");
else
{
if (buttons & mir_pointer_button_primary)
g_printerr (" primary\n");
if (buttons & mir_pointer_button_secondary)
g_printerr (" secondary\n");
if (buttons & mir_pointer_button_tertiary)
g_printerr (" tertiary\n");
if (buttons & mir_pointer_button_back)
g_printerr (" back\n");
if (buttons & mir_pointer_button_forward)
g_printerr (" forward\n");
if (buttons & mir_pointer_button_side)
g_printerr (" side\n");
if (buttons & mir_pointer_button_extra)
g_printerr (" extra\n");
if (buttons & mir_pointer_button_task)
g_printerr (" task\n");
}
}
}
static void
_gdk_mir_print_window_placement_event (const MirWindowPlacementEvent *event)
{
MirRectangle rect = mir_window_placement_get_relative_position (event);
g_printerr ("WINDOW_PLACEMENT\n");
g_printerr (" X %d\n", rect.left);
g_printerr (" Y %d\n", rect.top);
g_printerr (" Width %u\n", rect.width);
g_printerr (" Height %u\n", rect.height);
}
void
_gdk_mir_print_event (const MirEvent *event)
{
@@ -260,6 +503,9 @@ _gdk_mir_print_event (const MirEvent *event)
case mir_input_event_type_pointer:
_gdk_mir_print_motion_event (mir_event_get_input_event (event));
break;
default:
_gdk_mir_print_input_event (mir_event_get_input_event (event));
break;
}
break;
case mir_event_type_key:
@@ -268,15 +514,33 @@ _gdk_mir_print_event (const MirEvent *event)
case mir_event_type_motion:
_gdk_mir_print_motion_event (mir_event_get_input_event (event));
break;
case mir_event_type_surface:
_gdk_mir_print_surface_event (mir_event_get_surface_event (event));
case mir_event_type_window:
_gdk_mir_print_window_event (mir_event_get_window_event (event));
break;
case mir_event_type_resize:
_gdk_mir_print_resize_event (mir_event_get_resize_event (event));
break;
case mir_event_type_close_surface:
case mir_event_type_prompt_session_state_change:
_gdk_mir_print_prompt_session_state_change_event (mir_event_get_prompt_session_event (event));
break;
case mir_event_type_orientation:
_gdk_mir_print_orientation_event (mir_event_get_orientation_event (event));
break;
case mir_event_type_close_window:
_gdk_mir_print_close_event ();
break;
case mir_event_type_keymap:
_gdk_mir_print_keymap_event (mir_event_get_keymap_event (event));
break;
case mir_event_type_window_output:
_gdk_mir_print_window_output_event (mir_event_get_window_output_event (event));
break;
case mir_event_type_input_device_state:
_gdk_mir_print_input_device_state_event (mir_event_get_input_device_state_event (event));
break;
case mir_event_type_window_placement:
_gdk_mir_print_window_placement_event (mir_event_get_window_placement_event (event));
break;
default:
g_printerr ("EVENT %u\n", mir_event_get_type (event));
break;

View File

@@ -83,13 +83,17 @@ GdkCursor *_gdk_mir_cursor_new_for_name (GdkDisplay *display, const gchar *name)
const gchar *_gdk_mir_cursor_get_name (GdkCursor *cursor);
MirWindow *_gdk_mir_window_get_mir_window (GdkWindow *window);
GdkWindowImpl *_gdk_mir_window_impl_new (GdkDisplay *display, GdkWindow *window, GdkWindowAttr *attributes, gint attributes_mask);
void _gdk_mir_window_impl_set_surface_state (GdkMirWindowImpl *impl, MirSurfaceState state);
void _gdk_mir_window_impl_set_window_state (GdkMirWindowImpl *impl, MirWindowState state);
void _gdk_mir_window_impl_set_surface_type (GdkMirWindowImpl *impl, MirSurfaceType type);
void _gdk_mir_window_impl_set_window_type (GdkMirWindowImpl *impl, MirWindowType type);
void _gdk_mir_window_set_surface_output (GdkWindow *window, gdouble scale);
void _gdk_mir_window_set_scale (GdkWindow *window, gdouble scale);
void _gdk_mir_window_set_final_rect (GdkWindow *window, MirRectangle rect);
void _gdk_mir_window_impl_set_cursor_state (GdkMirWindowImpl *impl, gdouble x, gdouble y, gboolean cursor_inside, guint button_state);
@@ -107,6 +111,15 @@ void _gdk_mir_event_source_queue (GdkMirWindowReference *window_ref, const MirEv
MirPixelFormat _gdk_mir_display_get_pixel_format (GdkDisplay *display, MirBufferUsage usage);
void _gdk_mir_display_focus_window (GdkDisplay *display, GdkWindow *window);
void _gdk_mir_display_unfocus_window (GdkDisplay *display, GdkWindow *window);
void _gdk_mir_display_create_paste (GdkDisplay *display,
const gchar * const *paste_formats,
gconstpointer paste_data,
gsize paste_size);
gboolean _gdk_mir_display_init_egl_display (GdkDisplay *display);
EGLDisplay _gdk_mir_display_get_egl_display (GdkDisplay *display);

View File

@@ -41,7 +41,7 @@ MirConnection *gdk_mir_display_get_mir_connection (GdkDisplay *display);
GDK_AVAILABLE_IN_3_16
GType gdk_mir_window_get_type (void);
GDK_AVAILABLE_IN_3_16
GDK_DEPRECATED_IN_3_22
MirSurface *gdk_mir_window_get_mir_surface (GdkWindow *window);
GDK_AVAILABLE_IN_3_16

View File

@@ -147,7 +147,6 @@ gdk_mir_cursor_get_surface (GdkCursor *cursor,
gdouble *x_hot,
gdouble *y_hot)
{
g_printerr ("gdk_mir_cursor_get_surface\n");
return NULL;
}

View File

@@ -60,7 +60,6 @@ static GList *
gdk_mir_device_manager_list_devices (GdkDeviceManager *device_manager,
GdkDeviceType type)
{
//g_printerr ("gdk_mir_device_manager_list_devices (%u)\n", type);
GdkMirDeviceManager *dm = GDK_MIR_DEVICE_MANAGER (device_manager);
if (type == GDK_DEVICE_TYPE_MASTER)
@@ -79,7 +78,6 @@ gdk_mir_device_manager_list_devices (GdkDeviceManager *device_manager,
static GdkDevice *
gdk_mir_device_manager_get_client_pointer (GdkDeviceManager *device_manager)
{
//g_printerr ("gdk_mir_device_manager_get_client_pointer\n");
return GDK_MIR_DEVICE_MANAGER (device_manager)->pointer;
}

View File

@@ -23,6 +23,10 @@
#include "gdkmir.h"
#include "gdkmir-private.h"
#include <string.h>
#include <com/ubuntu/content/glib/content-hub-glib.h>
#define GDK_TYPE_DISPLAY_MIR (gdk_mir_display_get_type ())
#define GDK_MIR_DISPLAY(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DISPLAY_MIR, GdkMirDisplay))
#define GDK_MIR_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DISPLAY_MIR, GdkMirDisplayClass))
@@ -47,6 +51,8 @@ typedef struct GdkMirDisplay
GdkKeymap *keymap;
GdkWindow *focused_window;
MirPixelFormat sw_pixel_format;
MirPixelFormat hw_pixel_format;
@@ -55,6 +61,10 @@ typedef struct GdkMirDisplay
guint have_egl_buffer_age : 1;
guint have_egl_swap_buffers_with_damage : 1;
guint have_egl_surfaceless_context : 1;
ContentHubService *content_service;
ContentHubHandler *content_handler;
GVariant *paste_data;
} GdkMirDisplay;
typedef struct GdkMirDisplayClass
@@ -100,14 +110,20 @@ static void get_pixel_formats (MirConnection *, MirPixelFormat *sw, MirPixelForm
G_DEFINE_TYPE (GdkMirDisplay, gdk_mir_display, GDK_TYPE_DISPLAY)
static void
pasteboard_changed_cb (GdkMirDisplay *display,
gpointer user_data)
{
g_clear_pointer (&display->paste_data, g_variant_unref);
}
GdkDisplay *
_gdk_mir_display_open (const gchar *display_name)
{
MirConnection *connection;
MirPixelFormat sw_pixel_format, hw_pixel_format;
GdkMirDisplay *display;
//g_printerr ("gdk_mir_display_open\n");
GDBusConnection *session;
connection = mir_connect_sync (NULL, "GDK-Mir");
if (!connection)
@@ -138,6 +154,45 @@ _gdk_mir_display_open (const gchar *display_name)
display->sw_pixel_format = sw_pixel_format;
display->hw_pixel_format = hw_pixel_format;
session = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
display->content_service = content_hub_service_proxy_new_sync (
session,
G_DBUS_PROXY_FLAGS_GET_INVALIDATED_PROPERTIES,
"com.ubuntu.content.dbus.Service",
"/",
NULL,
NULL);
g_signal_connect_swapped (
display->content_service,
"pasteboard-changed",
G_CALLBACK (pasteboard_changed_cb),
display);
display->content_handler = content_hub_handler_skeleton_new ();
g_dbus_interface_skeleton_export (
G_DBUS_INTERFACE_SKELETON (display->content_handler),
session,
"/org/gnome/gtk/content/handler",
NULL);
g_object_unref (session);
content_hub_service_call_register_import_export_handler_sync (
display->content_service,
g_application_get_application_id (g_application_get_default ()),
"/org/gnome/gtk/content/handler",
NULL,
NULL);
content_hub_service_call_handler_active_sync (
display->content_service,
g_application_get_application_id (g_application_get_default ()),
NULL,
NULL);
g_signal_emit_by_name (display, "opened");
return GDK_DISPLAY (display);
@@ -173,6 +228,10 @@ gdk_mir_display_dispose (GObject *object)
{
GdkMirDisplay *display = GDK_MIR_DISPLAY (object);
g_clear_pointer (&display->paste_data, g_variant_unref);
g_dbus_interface_skeleton_unexport (G_DBUS_INTERFACE_SKELETON (display->content_handler));
g_clear_object (&display->content_handler);
g_clear_object (&display->content_service);
g_clear_object (&display->screen);
g_clear_object (&display->keymap);
g_clear_pointer (&display->event_source, g_source_unref);
@@ -193,40 +252,34 @@ gdk_mir_display_finalize (GObject *object)
static const gchar *
gdk_mir_display_get_name (GdkDisplay *display)
{
//g_printerr ("gdk_mir_display_get_name\n");
return "Mir";
}
static GdkScreen *
gdk_mir_display_get_default_screen (GdkDisplay *display)
{
//g_printerr ("gdk_mir_display_get_default_screen\n");
return GDK_MIR_DISPLAY (display)->screen;
}
static void
gdk_mir_display_beep (GdkDisplay *display)
{
//g_printerr ("gdk_mir_display_beep\n");
/* No system level beep... */
}
static void
gdk_mir_display_sync (GdkDisplay *display)
{
//g_printerr ("gdk_mir_display_sync\n");
}
static void
gdk_mir_display_flush (GdkDisplay *display)
{
//g_printerr ("gdk_mir_display_flush\n");
}
static gboolean
gdk_mir_display_has_pending (GdkDisplay *display)
{
//g_printerr ("gdk_mir_display_has_pending\n");
/* We don't need to poll for events - so nothing pending */
return FALSE;
}
@@ -234,27 +287,23 @@ gdk_mir_display_has_pending (GdkDisplay *display)
static void
gdk_mir_display_queue_events (GdkDisplay *display)
{
//g_printerr ("gdk_mir_display_queue_events\n");
/* We don't need to poll for events - so don't do anything*/
}
static void
gdk_mir_display_make_default (GdkDisplay *display)
{
//g_printerr ("gdk_mir_display_make_default\n");
}
static GdkWindow *
gdk_mir_display_get_default_group (GdkDisplay *display)
{
//g_printerr ("gdk_mir_display_get_default_group\n");
return NULL;
}
static gboolean
gdk_mir_display_supports_shapes (GdkDisplay *display)
{
//g_printerr ("gdk_mir_display_supports_shapes\n");
/* Mir doesn't support shaped windows */
return FALSE;
}
@@ -262,42 +311,36 @@ gdk_mir_display_supports_shapes (GdkDisplay *display)
static gboolean
gdk_mir_display_supports_input_shapes (GdkDisplay *display)
{
//g_printerr ("gdk_mir_display_supports_input_shapes\n");
return FALSE;
}
static gboolean
gdk_mir_display_supports_composite (GdkDisplay *display)
{
//g_printerr ("gdk_mir_display_supports_composite\n");
return FALSE;
}
static gboolean
gdk_mir_display_supports_clipboard_persistence (GdkDisplay *display)
{
//g_printerr ("gdk_mir_display_supports_clipboard_persistence\n");
return FALSE;
}
static gboolean
gdk_mir_display_supports_cursor_alpha (GdkDisplay *display)
{
//g_printerr ("gdk_mir_display_supports_cursor_alpha\n");
return FALSE;
}
static gboolean
gdk_mir_display_supports_cursor_color (GdkDisplay *display)
{
//g_printerr ("gdk_mir_display_supports_cursor_color\n");
return FALSE;
}
static gboolean
gdk_mir_display_supports_selection_notification (GdkDisplay *display)
{
//g_printerr ("gdk_mir_display_supports_selection_notification\n");
return FALSE;
}
@@ -305,7 +348,6 @@ static gboolean
gdk_mir_display_request_selection_notification (GdkDisplay *display,
GdkAtom selection)
{
//g_printerr ("gdk_mir_display_request_selection_notification\n");
return FALSE;
}
@@ -316,7 +358,6 @@ gdk_mir_display_store_clipboard (GdkDisplay *display,
const GdkAtom *targets,
gint n_targets)
{
//g_printerr ("gdk_mir_display_store_clipboard\n");
}
static void
@@ -324,7 +365,6 @@ gdk_mir_display_get_default_cursor_size (GdkDisplay *display,
guint *width,
guint *height)
{
//g_printerr ("gdk_mir_display_get_default_cursor_size\n");
*width = *height = 32; // FIXME: Random value
}
@@ -333,7 +373,6 @@ gdk_mir_display_get_maximal_cursor_size (GdkDisplay *display,
guint *width,
guint *height)
{
//g_printerr ("gdk_mir_display_get_maximal_cursor_size\n");
*width = *height = 32; // FIXME: Random value
}
@@ -357,33 +396,28 @@ gdk_mir_display_get_cursor_for_surface (GdkDisplay *display,
gdouble x,
gdouble y)
{
//g_printerr ("gdk_mir_display_get_cursor_for_surface (%f, %f)\n", x, y);
return NULL;
}
static GdkAppLaunchContext *
gdk_mir_display_get_app_launch_context (GdkDisplay *display)
{
//g_printerr ("gdk_mir_display_get_app_launch_context\n");
return NULL;
}
static void
gdk_mir_display_before_process_all_updates (GdkDisplay *display)
{
//g_printerr ("gdk_mir_display_before_process_all_updates\n");
}
static void
gdk_mir_display_after_process_all_updates (GdkDisplay *display)
{
//g_printerr ("gdk_mir_display_after_process_all_updates\n");
}
static gulong
gdk_mir_display_get_next_serial (GdkDisplay *display)
{
//g_printerr ("gdk_mir_display_get_next_serial\n");
return GDK_MIR_DISPLAY (display)->serial++;
}
@@ -391,7 +425,6 @@ static void
gdk_mir_display_notify_startup_complete (GdkDisplay *display,
const gchar *startup_id)
{
//g_printerr ("gdk_mir_display_notify_startup_complete\n");
}
static void
@@ -403,12 +436,6 @@ gdk_mir_display_create_window_impl (GdkDisplay *display,
GdkWindowAttr *attributes,
gint attributes_mask)
{
//g_printerr ("gdk_mir_display_create_window_impl");
//g_printerr (" window=%p", window);
//g_printerr (" location=(%d, %d)", window->x, window->y);
//g_printerr (" size=(%d, %d)", window->width, window->height);
//g_printerr ("\n");
if (attributes->wclass == GDK_INPUT_OUTPUT)
{
window->impl = _gdk_mir_window_impl_new (display, window, attributes, attributes_mask);
@@ -427,21 +454,18 @@ gdk_mir_display_create_window_impl (GdkDisplay *display,
static GdkKeymap *
gdk_mir_display_get_keymap (GdkDisplay *display)
{
//g_printerr ("gdk_mir_display_get_keymap\n");
return GDK_MIR_DISPLAY (display)->keymap;
}
static void
gdk_mir_display_push_error_trap (GdkDisplay *display)
{
//g_printerr ("gdk_mir_display_push_error_trap\n");
}
static gint
gdk_mir_display_pop_error_trap (GdkDisplay *display,
gboolean ignored)
{
//g_printerr ("gdk_mir_display_pop_error_trap\n");
return 0;
}
@@ -449,7 +473,6 @@ static GdkWindow *
gdk_mir_display_get_selection_owner (GdkDisplay *display,
GdkAtom selection)
{
//g_printerr ("gdk_mir_display_get_selection_owner\n");
return NULL;
}
@@ -460,7 +483,28 @@ gdk_mir_display_set_selection_owner (GdkDisplay *display,
guint32 time,
gboolean send_event)
{
//g_printerr ("gdk_mir_display_set_selection_owner\n");
GdkEvent *event;
if (selection == GDK_SELECTION_CLIPBOARD)
{
if (owner)
{
event = gdk_event_new (GDK_SELECTION_REQUEST);
event->selection.window = g_object_ref (owner);
event->selection.send_event = FALSE;
event->selection.selection = selection;
event->selection.target = gdk_atom_intern_static_string ("TARGETS");
event->selection.property = gdk_atom_intern_static_string ("AVAILABLE_TARGETS");
event->selection.time = GDK_CURRENT_TIME;
event->selection.requestor = g_object_ref (owner);
gdk_event_put (event);
gdk_event_free (event);
return TRUE;
}
}
return FALSE;
}
@@ -472,7 +516,6 @@ gdk_mir_display_send_selection_notify (GdkDisplay *display,
GdkAtom property,
guint32 time)
{
//g_printerr ("gdk_mir_display_send_selection_notify\n");
}
static gint
@@ -482,10 +525,261 @@ gdk_mir_display_get_selection_property (GdkDisplay *display,
GdkAtom *ret_type,
gint *ret_format)
{
//g_printerr ("gdk_mir_display_get_selection_property\n");
gint length;
gdk_property_get (requestor,
gdk_atom_intern_static_string ("GDK_SELECTION"),
GDK_NONE,
0,
G_MAXULONG,
FALSE,
ret_type,
ret_format,
&length,
data);
return length;
}
static gint
get_format_score (const gchar *format,
GdkAtom target,
GdkAtom *out_type,
gint *out_size)
{
const gchar *target_string;
GdkAtom dummy_type;
gint dummy_size;
target_string = _gdk_atom_name_const (target);
if (!out_type)
out_type = &dummy_type;
if (!out_size)
out_size = &dummy_size;
if (!g_ascii_strcasecmp (format, target_string))
{
*out_type = GDK_SELECTION_TYPE_STRING;
*out_size = sizeof (guchar);
return G_MAXINT;
}
if (target == gdk_atom_intern_static_string ("UTF8_STRING"))
return get_format_score (format, gdk_atom_intern_static_string ("text/plain;charset=utf-8"), out_type, out_size);
/* TODO: use best media type for COMPOUND_TEXT target */
if (target == gdk_atom_intern_static_string ("COMPOUND_TEXT"))
return get_format_score (format, gdk_atom_intern_static_string ("text/plain;charset=utf-8"), out_type, out_size);
if (target == GDK_TARGET_STRING)
return get_format_score (format, gdk_atom_intern_static_string ("text/plain;charset=iso-8859-1"), out_type, out_size);
if (target == gdk_atom_intern_static_string ("GTK_TEXT_BUFFER_CONTENTS"))
return get_format_score (format, gdk_atom_intern_static_string ("text/plain;charset=utf-8"), out_type, out_size);
if (g_content_type_is_a (format, target_string))
{
*out_type = GDK_SELECTION_TYPE_STRING;
*out_size = sizeof (guchar);
return 2;
}
if (g_content_type_is_a (target_string, format))
{
*out_type = GDK_SELECTION_TYPE_STRING;
*out_size = sizeof (guchar);
return 1;
}
return 0;
}
static gint
get_best_format_index (const gchar * const *formats,
guint n_formats,
GdkAtom target,
GdkAtom *out_type,
gint *out_size)
{
gint best_i = -1;
gint best_score = 0;
GdkAtom best_type;
gint best_size;
gint score;
GdkAtom type;
gint size;
gint i;
if (!out_type)
out_type = &best_type;
if (!out_size)
out_size = &best_size;
*out_type = GDK_NONE;
*out_size = 0;
for (i = 0; i < n_formats; i++)
{
score = get_format_score (formats[i], target, &type, &size);
if (score > best_score)
{
best_i = i;
best_score = score;
*out_type = type;
*out_size = size;
}
}
return best_i;
}
static void
gdk_mir_display_real_convert_selection (GdkDisplay *display,
GdkWindow *requestor,
GdkAtom selection,
GdkAtom target,
guint32 time)
{
GdkMirDisplay *mir_display = GDK_MIR_DISPLAY (display);
const gchar *paste_data;
gsize paste_size;
const gint *paste_header;
GPtrArray *paste_formats;
GArray *paste_targets;
GdkAtom paste_target;
GdkEvent *event;
gint best_i;
GdkAtom best_type;
gint best_size;
gint i;
g_return_if_fail (mir_display->paste_data);
paste_data = g_variant_get_fixed_array (mir_display->paste_data, &paste_size, sizeof (guchar));
paste_header = (const gint *) paste_data;
if (paste_data)
{
paste_formats = g_ptr_array_new_full (paste_header[0], g_free);
for (i = 0; i < paste_header[0]; i++)
g_ptr_array_add (paste_formats, g_strndup (paste_data + paste_header[1 + 4 * i], paste_header[2 + 4 * i]));
}
else
paste_formats = g_ptr_array_new_with_free_func (g_free);
if (target == gdk_atom_intern_static_string ("TARGETS"))
{
paste_targets = g_array_sized_new (TRUE, FALSE, sizeof (GdkAtom), paste_formats->len);
for (i = 0; i < paste_formats->len; i++)
{
paste_target = gdk_atom_intern (g_ptr_array_index (paste_formats, i), FALSE);
g_array_append_val (paste_targets, paste_target);
}
gdk_property_change (requestor,
gdk_atom_intern_static_string ("GDK_SELECTION"),
GDK_SELECTION_TYPE_ATOM,
8 * sizeof (GdkAtom),
GDK_PROP_MODE_REPLACE,
(const guchar *) paste_targets->data,
paste_targets->len);
g_array_unref (paste_targets);
event = gdk_event_new (GDK_SELECTION_NOTIFY);
event->selection.window = g_object_ref (requestor);
event->selection.send_event = FALSE;
event->selection.selection = selection;
event->selection.target = target;
event->selection.property = gdk_atom_intern_static_string ("GDK_SELECTION");
event->selection.time = time;
event->selection.requestor = g_object_ref (requestor);
gdk_event_put (event);
gdk_event_free (event);
}
else
{
best_i = get_best_format_index ((const gchar * const *) paste_formats->pdata,
paste_formats->len,
target,
&best_type,
&best_size);
if (best_i >= 0)
{
gdk_property_change (requestor,
gdk_atom_intern_static_string ("GDK_SELECTION"),
best_type,
8 * best_size,
GDK_PROP_MODE_REPLACE,
(const guchar *) paste_data + paste_header[3 + 4 * best_i],
paste_header[4 + 4 * best_i] / best_size);
event = gdk_event_new (GDK_SELECTION_NOTIFY);
event->selection.window = g_object_ref (requestor);
event->selection.send_event = FALSE;
event->selection.selection = selection;
event->selection.target = target;
event->selection.property = gdk_atom_intern_static_string ("GDK_SELECTION");
event->selection.time = time;
event->selection.requestor = g_object_ref (requestor);
gdk_event_put (event);
gdk_event_free (event);
}
}
g_ptr_array_unref (paste_formats);
}
typedef struct
{
GdkDisplay *display;
GdkWindow *requestor;
GdkAtom selection;
GdkAtom target;
guint32 time;
} ConvertInfo;
static void
paste_data_ready_cb (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
ContentHubService *content_service = CONTENT_HUB_SERVICE (source_object);
ConvertInfo *info = user_data;
GdkMirDisplay *mir_display = GDK_MIR_DISPLAY (info->display);
gboolean result;
g_clear_pointer (&mir_display->paste_data, g_variant_unref);
result = content_hub_service_call_get_latest_paste_data_finish (content_service,
&mir_display->paste_data,
res,
NULL);
if (result)
gdk_mir_display_real_convert_selection (info->display,
info->requestor,
info->selection,
info->target,
info->time);
g_object_unref (info->requestor);
g_object_unref (info->display);
g_free (info);
}
static void
gdk_mir_display_convert_selection (GdkDisplay *display,
GdkWindow *requestor,
@@ -493,7 +787,46 @@ gdk_mir_display_convert_selection (GdkDisplay *display,
GdkAtom target,
guint32 time)
{
//g_printerr ("gdk_mir_display_convert_selection\n");
GdkMirDisplay *mir_display = GDK_MIR_DISPLAY (display);
MirWindow *mir_window;
MirWindowId *mir_window_id;
ConvertInfo *info;
if (selection != GDK_SELECTION_CLIPBOARD)
return;
else if (mir_display->paste_data)
gdk_mir_display_real_convert_selection (display, requestor, selection, target, time);
else if (mir_display->focused_window)
{
mir_window = _gdk_mir_window_get_mir_window (mir_display->focused_window);
if (!mir_window)
return;
mir_window_id = mir_window_request_window_id_sync (mir_window);
if (!mir_window_id)
return;
if (mir_window_id_is_valid (mir_window_id))
{
info = g_new (ConvertInfo, 1);
info->display = g_object_ref (display);
info->requestor = g_object_ref (requestor);
info->selection = selection;
info->target = target;
info->time = time;
content_hub_service_call_get_latest_paste_data (
mir_display->content_service,
mir_window_id_as_string (mir_window_id),
NULL,
paste_data_ready_cb,
info);
}
mir_window_id_release (mir_window_id);
}
}
static gint
@@ -504,15 +837,44 @@ gdk_mir_display_text_property_to_utf8_list (GdkDisplay *display,
gint length,
gchar ***list)
{
//g_printerr ("gdk_mir_display_text_property_to_utf8_list\n");
return 0;
GPtrArray *array;
const gchar *ptr;
gsize chunk_len;
gchar *copy;
guint nitems;
ptr = (const gchar *) text;
array = g_ptr_array_new ();
/* split text into utf-8 strings */
while (ptr < (const gchar *) &text[length])
{
chunk_len = strlen (ptr);
if (g_utf8_validate (ptr, chunk_len, NULL))
{
copy = g_strndup (ptr, chunk_len);
g_ptr_array_add (array, copy);
}
ptr = &ptr[chunk_len + 1];
}
nitems = array->len;
g_ptr_array_add (array, NULL);
if (list)
*list = (gchar **) g_ptr_array_free (array, FALSE);
else
g_ptr_array_free (array, TRUE);
return nitems;
}
static gchar *
gdk_mir_display_utf8_to_string_target (GdkDisplay *display,
const gchar *str)
{
//g_printerr ("gdk_mir_display_utf8_to_string_target\n");
return NULL;
}
@@ -582,6 +944,62 @@ _gdk_mir_display_get_pixel_format (GdkDisplay *display,
return mir_dpy->sw_pixel_format;
}
void
_gdk_mir_display_focus_window (GdkDisplay *display,
GdkWindow *window)
{
GdkMirDisplay *mir_display = GDK_MIR_DISPLAY (display);
g_set_object (&mir_display->focused_window, window);
}
void
_gdk_mir_display_unfocus_window (GdkDisplay *display,
GdkWindow *window)
{
GdkMirDisplay *mir_display = GDK_MIR_DISPLAY (display);
if (window == mir_display->focused_window)
g_clear_object (&mir_display->focused_window);
}
void
_gdk_mir_display_create_paste (GdkDisplay *display,
const gchar * const *paste_formats,
gconstpointer paste_data,
gsize paste_size)
{
GdkMirDisplay *mir_display = GDK_MIR_DISPLAY (display);
MirWindow *mir_window;
MirWindowId *mir_window_id;
if (!mir_display->focused_window)
return;
mir_window = _gdk_mir_window_get_mir_window (mir_display->focused_window);
if (!mir_window)
return;
mir_window_id = mir_window_request_window_id_sync (mir_window);
if (!mir_window_id)
return;
if (mir_window_id_is_valid (mir_window_id))
content_hub_service_call_create_paste_sync (
mir_display->content_service,
g_application_get_application_id (g_application_get_default ()),
mir_window_id_as_string (mir_window_id),
g_variant_new_fixed_array (G_VARIANT_TYPE_BYTE, paste_data, paste_size, sizeof (guchar)),
paste_formats,
NULL,
NULL,
NULL);
mir_window_id_release (mir_window_id);
}
gboolean
_gdk_mir_display_init_egl_display (GdkDisplay *display)
{

View File

@@ -22,6 +22,8 @@
#include "gdkmir.h"
#include "gdkmir-private.h"
#include <mir_toolkit/events/window_placement.h>
#define NANO_TO_MILLI(x) ((x) / 1000000)
struct _GdkMirWindowReference {
@@ -240,9 +242,15 @@ generate_focus_event (GdkWindow *window, gboolean focused)
GdkEvent *event;
if (focused)
gdk_synthesize_window_state (window, 0, GDK_WINDOW_STATE_FOCUSED);
{
gdk_synthesize_window_state (window, 0, GDK_WINDOW_STATE_FOCUSED);
_gdk_mir_display_focus_window (gdk_window_get_display (window), window);
}
else
gdk_synthesize_window_state (window, GDK_WINDOW_STATE_FOCUSED, 0);
{
gdk_synthesize_window_state (window, GDK_WINDOW_STATE_FOCUSED, 0);
_gdk_mir_display_unfocus_window (gdk_window_get_display (window), window);
}
event = gdk_event_new (GDK_FOCUS_CHANGE);
event->focus_change.send_event = FALSE;
@@ -436,45 +444,46 @@ handle_motion_event (GdkWindow *window, const MirInputEvent *event)
}
static void
handle_surface_event (GdkWindow *window, const MirSurfaceEvent *event)
handle_window_event (GdkWindow *window,
const MirWindowEvent *event)
{
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
MirSurfaceState state;
MirWindowState state;
switch (mir_surface_event_get_attribute (event))
switch (mir_window_event_get_attribute (event))
{
case mir_surface_attrib_type:
_gdk_mir_window_impl_set_surface_type (impl, mir_surface_event_get_attribute_value (event));
case mir_window_attrib_type:
_gdk_mir_window_impl_set_window_type (impl, mir_window_event_get_attribute_value (event));
break;
case mir_surface_attrib_state:
state = mir_surface_event_get_attribute_value (event);
_gdk_mir_window_impl_set_surface_state (impl, state);
case mir_window_attrib_state:
state = mir_window_event_get_attribute_value (event);
_gdk_mir_window_impl_set_window_state (impl, state);
switch (state)
{
case mir_surface_state_restored:
case mir_surface_state_hidden:
case mir_window_state_restored:
case mir_window_state_hidden:
gdk_synthesize_window_state (window,
GDK_WINDOW_STATE_ICONIFIED |
GDK_WINDOW_STATE_MAXIMIZED |
GDK_WINDOW_STATE_FULLSCREEN,
0);
break;
case mir_surface_state_minimized:
case mir_window_state_minimized:
gdk_synthesize_window_state (window,
GDK_WINDOW_STATE_MAXIMIZED |
GDK_WINDOW_STATE_FULLSCREEN,
GDK_WINDOW_STATE_ICONIFIED);
break;
case mir_surface_state_maximized:
case mir_surface_state_vertmaximized:
case mir_surface_state_horizmaximized:
case mir_window_state_maximized:
case mir_window_state_vertmaximized:
case mir_window_state_horizmaximized:
gdk_synthesize_window_state (window,
GDK_WINDOW_STATE_ICONIFIED |
GDK_WINDOW_STATE_FULLSCREEN,
GDK_WINDOW_STATE_MAXIMIZED);
break;
case mir_surface_state_fullscreen:
case mir_window_state_fullscreen:
gdk_synthesize_window_state (window,
GDK_WINDOW_STATE_ICONIFIED |
GDK_WINDOW_STATE_MAXIMIZED,
@@ -485,10 +494,10 @@ handle_surface_event (GdkWindow *window, const MirSurfaceEvent *event)
}
break;
case mir_surface_attrib_swapinterval:
case mir_window_attrib_swapinterval:
break;
case mir_surface_attrib_focus:
generate_focus_event (window, mir_surface_event_get_attribute_value (event) != 0);
case mir_window_attrib_focus:
generate_focus_event (window, mir_window_event_get_attribute_value (event) != 0);
break;
default:
break;
@@ -529,10 +538,17 @@ handle_close_event (GdkWindow *window)
}
static void
handle_surface_output_event (GdkWindow *window,
const MirSurfaceOutputEvent *event)
handle_window_output_event (GdkWindow *window,
const MirWindowOutputEvent *event)
{
_gdk_mir_window_set_surface_output (window, mir_surface_output_event_get_scale (event));
_gdk_mir_window_set_scale (window, mir_window_output_event_get_scale (event));
}
static void
handle_window_placement_event (GdkWindow *window,
const MirWindowPlacementEvent *event)
{
_gdk_mir_window_set_final_rect (window, mir_window_placement_get_relative_position (event));
}
typedef struct
@@ -565,6 +581,8 @@ gdk_mir_event_source_queue_event (GdkDisplay *display,
case mir_input_event_type_pointer:
handle_motion_event (window, input_event);
break;
default:
break;
}
break;
@@ -574,8 +592,8 @@ gdk_mir_event_source_queue_event (GdkDisplay *display,
case mir_event_type_motion:
handle_motion_event (window, mir_event_get_input_event (event));
break;
case mir_event_type_surface:
handle_surface_event (window, mir_event_get_surface_event (event));
case mir_event_type_window:
handle_window_event (window, mir_event_get_window_event (event));
break;
case mir_event_type_resize:
handle_resize_event (window, mir_event_get_resize_event (event));
@@ -586,11 +604,14 @@ gdk_mir_event_source_queue_event (GdkDisplay *display,
case mir_event_type_orientation:
// FIXME?
break;
case mir_event_type_close_surface:
case mir_event_type_close_window:
handle_close_event (window);
break;
case mir_event_type_surface_output:
handle_surface_output_event (window, mir_event_get_surface_output_event (event));
case mir_event_type_window_output:
handle_window_output_event (window, mir_event_get_window_output_event (event));
break;
case mir_event_type_window_placement:
handle_window_placement_event (window, mir_event_get_window_placement_event (event));
break;
default:
g_warning ("Ignoring unknown Mir event %d", mir_event_get_type (event));

View File

@@ -63,7 +63,6 @@ gdk_mir_keyboard_get_history (GdkDevice *device,
GdkTimeCoord ***events,
gint *n_events)
{
g_printerr ("gdk_mir_keyboard_get_history\n");
return FALSE;
}
@@ -73,7 +72,6 @@ gdk_mir_keyboard_get_state (GdkDevice *device,
gdouble *axes,
GdkModifierType *mask)
{
g_printerr ("gdk_mir_keyboard_get_state\n");
}
static void
@@ -81,7 +79,6 @@ gdk_mir_keyboard_set_window_cursor (GdkDevice *device,
GdkWindow *window,
GdkCursor *cursor)
{
//g_printerr ("gdk_mir_keyboard_set_window_cursor\n");
/* Keyboards don't have cursors... */
}
@@ -91,7 +88,6 @@ gdk_mir_keyboard_warp (GdkDevice *device,
gdouble x,
gdouble y)
{
//g_printerr ("gdk_mir_keyboard_warp\n");
/* Can't warp a keyboard... */
}
@@ -106,7 +102,6 @@ gdk_mir_keyboard_query_state (GdkDevice *device,
gdouble *win_y,
GdkModifierType *mask)
{
g_printerr ("gdk_mir_keyboard_query_state\n");
}
static GdkGrabStatus
@@ -118,7 +113,6 @@ gdk_mir_keyboard_grab (GdkDevice *device,
GdkCursor *cursor,
guint32 time_)
{
//g_printerr ("gdk_mir_keyboard_grab\n");
/* Mir doesn't do grabs, so sure, you have the grab */
return GDK_GRAB_SUCCESS;
}
@@ -127,7 +121,6 @@ static void
gdk_mir_keyboard_ungrab (GdkDevice *device,
guint32 time_)
{
//g_printerr ("gdk_mir_keyboard_ungrab\n");
/* Mir doesn't do grabs */
}
@@ -138,7 +131,6 @@ gdk_mir_keyboard_window_at_position (GdkDevice *device,
GdkModifierType *mask,
gboolean get_toplevel)
{
//g_printerr ("gdk_mir_keyboard_window_at_position (%f, %f)\n", *win_x, *win_y);
/* Keyboard don't have locations... */
return NULL; // FIXME: Or the window with the keyboard focus?
}
@@ -148,7 +140,6 @@ gdk_mir_keyboard_select_window_events (GdkDevice *device,
GdkWindow *window,
GdkEventMask event_mask)
{
g_printerr ("gdk_mir_keyboard_select_window_events\n");
}
static void

View File

@@ -64,7 +64,6 @@ _gdk_mir_keymap_new (void)
static PangoDirection
gdk_mir_keymap_get_direction (GdkKeymap *keymap)
{
//g_printerr ("gdk_mir_keymap_get_direction\n");
GdkMirKeymap *mir_keymap = GDK_MIR_KEYMAP (keymap);
gint i;
@@ -80,28 +79,24 @@ gdk_mir_keymap_get_direction (GdkKeymap *keymap)
static gboolean
gdk_mir_keymap_have_bidi_layouts (GdkKeymap *keymap)
{
//g_printerr ("gdk_mir_keymap_have_bidi_layouts\n");
return FALSE;
}
static gboolean
gdk_mir_keymap_get_caps_lock_state (GdkKeymap *keymap)
{
//g_printerr ("gdk_mir_keymap_get_caps_lock_state\n");
return xkb_state_led_name_is_active (GDK_MIR_KEYMAP (keymap)->xkb_state, XKB_LED_NAME_CAPS);
}
static gboolean
gdk_mir_keymap_get_num_lock_state (GdkKeymap *keymap)
{
//g_printerr ("gdk_mir_keymap_get_num_lock_state\n");
return xkb_state_led_name_is_active (GDK_MIR_KEYMAP (keymap)->xkb_state, XKB_LED_NAME_NUM);
}
static gboolean
gdk_mir_keymap_get_scroll_lock_state (GdkKeymap *keymap)
{
//g_printerr ("gdk_mir_keymap_get_scroll_lock_state\n");
return xkb_state_led_name_is_active (GDK_MIR_KEYMAP (keymap)->xkb_state, XKB_LED_NAME_SCROLL);
}
@@ -111,7 +106,6 @@ gdk_mir_keymap_get_entries_for_keyval (GdkKeymap *keymap,
GdkKeymapKey **keys,
gint *n_keys)
{
//g_printerr ("gdk_mir_keymap_get_entries_for_keyval\n");
GdkMirKeymap *mir_keymap = GDK_MIR_KEYMAP (keymap);
GArray *key_array;
guint keycode;
@@ -164,7 +158,6 @@ gdk_mir_keymap_get_entries_for_keycode (GdkKeymap *keymap,
guint **keyvals,
gint *n_entries)
{
//g_printerr ("gdk_mir_keymap_get_entries_for_keycode\n");
GdkMirKeymap *mir_keymap = GDK_MIR_KEYMAP (keymap);
gint num_layouts, layout;
gint num_entries;
@@ -214,7 +207,6 @@ static guint
gdk_mir_keymap_lookup_key (GdkKeymap *keymap,
const GdkKeymapKey *key)
{
//g_printerr ("gdk_mir_keymap_lookup_key\n");
GdkMirKeymap *mir_keymap = GDK_MIR_KEYMAP (keymap);
const xkb_keysym_t *syms;
int num_syms;
@@ -292,7 +284,6 @@ gdk_mir_keymap_translate_keyboard_state (GdkKeymap *keymap,
gint *effective_level,
GdkModifierType *consumed_modifiers)
{
//g_printerr ("gdk_mir_keymap_translate_keyboard_state\n");
GdkMirKeymap *mir_keymap = GDK_MIR_KEYMAP (keymap);
struct xkb_state *xkb_state;
guint32 modifiers;
@@ -330,7 +321,6 @@ static void
gdk_mir_keymap_add_virtual_modifiers (GdkKeymap *keymap,
GdkModifierType *state)
{
//g_printerr ("gdk_mir_keymap_add_virtual_modifiers\n");
// FIXME: What is this?
}
@@ -338,7 +328,6 @@ static gboolean
gdk_mir_keymap_map_virtual_modifiers (GdkKeymap *keymap,
GdkModifierType *state)
{
//g_printerr ("gdk_mir_keymap_map_virtual_modifiers\n");
// FIXME: What is this?
return TRUE;
}
@@ -346,7 +335,6 @@ gdk_mir_keymap_map_virtual_modifiers (GdkKeymap *keymap,
static guint
gdk_mir_keymap_get_modifier_state (GdkKeymap *keymap)
{
//g_printerr ("gdk_mir_keymap_get_modifier_state\n");
GdkMirKeymap *mir_keymap = GDK_MIR_KEYMAP (keymap);
xkb_mod_mask_t mods;

View File

@@ -93,7 +93,6 @@ gdk_mir_pointer_get_history (GdkDevice *device,
GdkTimeCoord ***events,
gint *n_events)
{
g_printerr ("gdk_mir_pointer_get_history\n");
return FALSE;
}
@@ -103,7 +102,6 @@ gdk_mir_pointer_get_state (GdkDevice *device,
gdouble *axes,
GdkModifierType *mask)
{
//g_printerr ("gdk_mir_pointer_get_state\n");
GdkMirPointer *p = GDK_MIR_POINTER (device);
gdouble x, y;
@@ -120,7 +118,6 @@ gdk_mir_pointer_set_window_cursor (GdkDevice *device,
GdkWindow *window,
GdkCursor *cursor)
{
//g_printerr ("gdk_mir_pointer_set_window_cursor\n");
/* Mir doesn't support cursors */
}
@@ -130,7 +127,6 @@ gdk_mir_pointer_warp (GdkDevice *device,
gdouble x,
gdouble y)
{
//g_printerr ("gdk_mir_pointer_warp\n");
/* Mir doesn't support warping */
}
@@ -145,7 +141,6 @@ gdk_mir_pointer_query_state (GdkDevice *device,
gdouble *win_y,
GdkModifierType *mask)
{
//g_printerr ("gdk_mir_pointer_query_state\n");
GdkMirPointer *p = GDK_MIR_POINTER (device);
if (root_window)
@@ -173,7 +168,6 @@ gdk_mir_pointer_grab (GdkDevice *device,
GdkCursor *cursor,
guint32 time_)
{
//g_printerr ("gdk_mir_pointer_grab\n");
/* Mir doesn't do grabs, so sure, you have the grab */
return GDK_GRAB_SUCCESS;
}
@@ -182,7 +176,6 @@ static void
gdk_mir_pointer_ungrab (GdkDevice *device,
guint32 time_)
{
//g_printerr ("gdk_mir_pointer_ungrab\n");
/* Mir doesn't do grabs */
GdkDeviceGrabInfo *grab = _gdk_display_get_last_device_grab (gdk_device_get_display (device), device);
@@ -198,7 +191,6 @@ gdk_mir_pointer_window_at_position (GdkDevice *device,
GdkModifierType *mask,
gboolean get_toplevel)
{
//g_printerr ("gdk_mir_pointer_window_at_position\n");
GdkMirPointer *p = GDK_MIR_POINTER (device);
if (win_x)
@@ -216,7 +208,6 @@ gdk_mir_pointer_select_window_events (GdkDevice *device,
GdkWindow *window,
GdkEventMask event_mask)
{
g_printerr ("gdk_mir_pointer_select_window_events\n");
// FIXME?
}

View File

@@ -46,7 +46,7 @@ struct GdkMirScreen
GdkDisplay *display;
/* Current monitor configuration */
MirDisplayConfiguration *display_config;
MirDisplayConfig *display_config;
GdkVisual *visual;
@@ -67,9 +67,15 @@ get_connection (GdkMirScreen *screen)
}
static void
get_screen_size (MirDisplayConfiguration *config, gint *width, gint *height)
get_screen_size (MirDisplayConfig *config,
gint *width,
gint *height)
{
uint32_t i;
const MirOutput *output;
const MirOutputMode *mode;
gint right;
gint bottom;
gint i;
*width = 0;
*height = 0;
@@ -77,27 +83,33 @@ get_screen_size (MirDisplayConfiguration *config, gint *width, gint *height)
if (!config)
return;
for (i = 0; i < config->num_outputs; i++)
for (i = 0; i < mir_display_config_get_num_outputs (config); i++)
{
MirDisplayOutput *o = &config->outputs[i];
gint w, h;
output = mir_display_config_get_output (config, i);
if (!o->used)
if (!mir_output_is_enabled (output))
continue;
w = o->position_x + o->modes[o->current_mode].horizontal_resolution;
if (w > *width)
*width = w;
h = o->position_y + o->modes[o->current_mode].vertical_resolution;
if (h > *height)
*height = h;
mode = mir_output_get_current_mode (output);
right = mir_output_get_position_x (output) + mir_output_mode_get_width (mode);
bottom = mir_output_get_position_y (output) + mir_output_mode_get_height (mode);
if (right > *width)
*width = right;
if (bottom > *height)
*height = bottom;
}
}
static void
get_screen_size_mm (MirDisplayConfiguration *config, gint *width, gint *height)
get_screen_size_mm (MirDisplayConfig *config,
gint *width,
gint *height)
{
uint32_t i;
const MirOutput *output;
gint i;
*width = 0;
*height = 0;
@@ -105,15 +117,15 @@ get_screen_size_mm (MirDisplayConfiguration *config, gint *width, gint *height)
if (!config)
return;
for (i = 0; i < config->num_outputs; i++)
for (i = 0; i < mir_display_config_get_num_outputs (config); i++)
{
MirDisplayOutput *o = &config->outputs[i];
output = mir_display_config_get_output (config, i);
if (!o->used)
if (!mir_output_is_enabled (output))
continue;
*width += o->physical_width_mm;
*height += o->physical_height_mm;
*width += mir_output_get_physical_width_mm (output);
*height += mir_output_get_physical_height_mm (output);
}
}
@@ -121,8 +133,8 @@ static void
update_display_config (GdkMirScreen *screen)
{
gdk_mir_display_get_mir_connection (GDK_DISPLAY (screen->display));
mir_display_config_destroy (screen->display_config);
screen->display_config = mir_connection_create_display_config (get_connection (screen));
mir_display_config_release (screen->display_config);
screen->display_config = mir_connection_create_display_configuration (get_connection (screen));
}
static void
@@ -165,7 +177,7 @@ gdk_mir_screen_finalize (GObject *object)
GdkMirScreen *screen = GDK_MIR_SCREEN (object);
mir_connection_set_display_config_change_callback (get_connection (screen), NULL, NULL);
mir_display_config_destroy (screen->display_config);
mir_display_config_release (screen->display_config);
g_clear_object (&screen->visual);
g_clear_object (&screen->root_window);
@@ -175,25 +187,30 @@ gdk_mir_screen_finalize (GObject *object)
static GdkDisplay *
gdk_mir_screen_get_display (GdkScreen *screen)
{
//g_printerr ("gdk_mir_screen_get_display\n");
return GDK_DISPLAY (GDK_MIR_SCREEN (screen)->display);
}
static MirDisplayOutput *
get_output (GdkScreen *screen, gint monitor_num)
static const MirOutput *
get_output (GdkScreen *screen,
gint monitor_num)
{
MirDisplayConfiguration *config;
uint32_t i, j;
MirDisplayConfig *config;
const MirOutput *output;
gint i;
gint j;
config = GDK_MIR_SCREEN (screen)->display_config;
for (i = 0, j = 0; i < config->num_outputs; i++)
for (i = 0, j = 0; i < mir_display_config_get_num_outputs (config); i++)
{
if (!config->outputs[i].used)
output = mir_display_config_get_output (config, i);
if (!mir_output_is_enabled (output))
continue;
if (j == monitor_num)
return &config->outputs[i];
return output;
j++;
}
@@ -203,7 +220,6 @@ get_output (GdkScreen *screen, gint monitor_num)
static gint
gdk_mir_screen_get_width (GdkScreen *screen)
{
//g_printerr ("gdk_mir_screen_get_width\n");
gint width, height;
get_screen_size (GDK_MIR_SCREEN (screen)->display_config, &width, &height);
return width;
@@ -212,7 +228,6 @@ gdk_mir_screen_get_width (GdkScreen *screen)
static gint
gdk_mir_screen_get_height (GdkScreen *screen)
{
//g_printerr ("gdk_mir_screen_get_height\n");
gint width, height;
get_screen_size (GDK_MIR_SCREEN (screen)->display_config, &width, &height);
return height;
@@ -221,7 +236,6 @@ gdk_mir_screen_get_height (GdkScreen *screen)
static gint
gdk_mir_screen_get_width_mm (GdkScreen *screen)
{
//g_printerr ("gdk_mir_screen_get_width_mm\n");
gint width, height;
get_screen_size_mm (GDK_MIR_SCREEN (screen)->display_config, &width, &height);
return width;
@@ -230,7 +244,6 @@ gdk_mir_screen_get_width_mm (GdkScreen *screen)
static gint
gdk_mir_screen_get_height_mm (GdkScreen *screen)
{
//g_printerr ("gdk_mir_screen_get_height_mm\n");
gint width, height;
get_screen_size_mm (GDK_MIR_SCREEN (screen)->display_config, &width, &height);
return height;
@@ -239,7 +252,6 @@ gdk_mir_screen_get_height_mm (GdkScreen *screen)
static gint
gdk_mir_screen_get_number (GdkScreen *screen)
{
//g_printerr ("gdk_mir_screen_get_number\n");
/* There is only one screen... */
return 0;
}
@@ -247,7 +259,6 @@ gdk_mir_screen_get_number (GdkScreen *screen)
static GdkWindow *
gdk_mir_screen_get_root_window (GdkScreen *screen)
{
//g_printerr ("gdk_mir_screen_get_root_window\n");
GdkMirScreen *s = GDK_MIR_SCREEN (screen);
gint width, height;
@@ -276,16 +287,15 @@ gdk_mir_screen_get_root_window (GdkScreen *screen)
static gint
gdk_mir_screen_get_n_monitors (GdkScreen *screen)
{
//g_printerr ("gdk_mir_screen_get_n_monitors\n");
MirDisplayConfiguration *config;
uint32_t i;
MirDisplayConfig *config;
gint count = 0;
gint i;
config = GDK_MIR_SCREEN (screen)->display_config;
for (i = 0; i < config->num_outputs; i++)
if (config->outputs[i].used)
++count;
for (i = 0; i < mir_display_config_get_num_outputs (config); i++)
if (mir_output_is_enabled (mir_display_config_get_output (config, i)))
count++;
return count;
}
@@ -293,7 +303,6 @@ gdk_mir_screen_get_n_monitors (GdkScreen *screen)
static gint
gdk_mir_screen_get_primary_monitor (GdkScreen *screen)
{
//g_printerr ("gdk_mir_screen_get_primary_monitor\n");
return 0; //?
}
@@ -301,59 +310,62 @@ static gint
gdk_mir_screen_get_monitor_width_mm (GdkScreen *screen,
gint monitor_num)
{
//g_printerr ("gdk_mir_screen_get_monitor_width_mm (%d)\n", monitor_num);
MirDisplayOutput *output = get_output (screen, monitor_num);
return output ? output->physical_width_mm : 0;
const MirOutput *output = get_output (screen, monitor_num);
return output ? mir_output_get_physical_width_mm (output) : 0;
}
static gint
gdk_mir_screen_get_monitor_height_mm (GdkScreen *screen,
gint monitor_num)
{
//g_printerr ("gdk_mir_screen_get_monitor_height_mm (%d)\n", monitor_num);
MirDisplayOutput *output = get_output (screen, monitor_num);
return output ? output->physical_height_mm : 0;
const MirOutput *output = get_output (screen, monitor_num);
return output ? mir_output_get_physical_height_mm (output) : 0;
}
static gchar *
gdk_mir_screen_get_monitor_plug_name (GdkScreen *screen,
gint monitor_num)
{
//g_printerr ("gdk_mir_screen_get_monitor_plug_name (%d)\n", monitor_num);
MirDisplayOutput *output = get_output (screen, monitor_num);
const MirOutput *output = get_output (screen, monitor_num);
if (output)
{
switch (output->type)
switch (mir_output_get_type (output))
{
case mir_display_output_type_unknown:
return g_strdup_printf ("None-%u", output->output_id);
case mir_display_output_type_vga:
return g_strdup_printf ("VGA-%u", output->output_id);
case mir_display_output_type_dvii:
case mir_display_output_type_dvid:
case mir_display_output_type_dvia:
return g_strdup_printf ("DVI-%u", output->output_id);
case mir_display_output_type_composite:
return g_strdup_printf ("Composite-%u", output->output_id);
case mir_display_output_type_lvds:
return g_strdup_printf ("LVDS-%u", output->output_id);
case mir_display_output_type_component:
return g_strdup_printf ("CTV-%u", output->output_id);
case mir_display_output_type_ninepindin:
return g_strdup_printf ("DIN-%u", output->output_id);
case mir_display_output_type_displayport:
return g_strdup_printf ("DP-%u", output->output_id);
case mir_display_output_type_hdmia:
case mir_display_output_type_hdmib:
return g_strdup_printf ("HDMI-%u", output->output_id);
case mir_display_output_type_svideo:
case mir_display_output_type_tv:
return g_strdup_printf ("TV-%u", output->output_id);
case mir_display_output_type_edp:
return g_strdup_printf ("eDP-%u", output->output_id);
case mir_display_output_type_virtual:
return g_strdup_printf ("Virtual-%u", output->output_id);
case mir_output_type_unknown:
return g_strdup_printf ("None-%u", mir_output_get_id (output));
case mir_output_type_vga:
return g_strdup_printf ("VGA-%u", mir_output_get_id (output));
case mir_output_type_dvii:
case mir_output_type_dvid:
case mir_output_type_dvia:
return g_strdup_printf ("DVI-%u", mir_output_get_id (output));
case mir_output_type_composite:
return g_strdup_printf ("Composite-%u", mir_output_get_id (output));
case mir_output_type_lvds:
return g_strdup_printf ("LVDS-%u", mir_output_get_id (output));
case mir_output_type_component:
return g_strdup_printf ("CTV-%u", mir_output_get_id (output));
case mir_output_type_ninepindin:
return g_strdup_printf ("DIN-%u", mir_output_get_id (output));
case mir_output_type_displayport:
return g_strdup_printf ("DP-%u", mir_output_get_id (output));
case mir_output_type_hdmia:
case mir_output_type_hdmib:
return g_strdup_printf ("HDMI-%u", mir_output_get_id (output));
case mir_output_type_svideo:
case mir_output_type_tv:
return g_strdup_printf ("TV-%u", mir_output_get_id (output));
case mir_output_type_edp:
return g_strdup_printf ("eDP-%u", mir_output_get_id (output));
case mir_output_type_virtual:
return g_strdup_printf ("Virtual-%u", mir_output_get_id (output));
case mir_output_type_dsi:
return g_strdup_printf ("DSI-%u", mir_output_get_id (output));
case mir_output_type_dpi:
return g_strdup_printf ("DPI-%u", mir_output_get_id (output));
}
}
@@ -365,19 +377,19 @@ gdk_mir_screen_get_monitor_geometry (GdkScreen *screen,
gint monitor_num,
GdkRectangle *dest)
{
//g_printerr ("gdk_mir_screen_get_monitor_geometry (%d)\n", monitor_num);
MirDisplayOutput *output;
MirDisplayMode *mode;
const MirOutput *output;
const MirOutputMode *mode;
output = get_output (screen, monitor_num);
if (output)
{
mode = &output->modes[output->current_mode];
dest->x = output->position_x;
dest->y = output->position_y;
dest->width = mode->horizontal_resolution;
dest->height = mode->vertical_resolution;
mode = mir_output_get_current_mode (output);
dest->x = mir_output_get_position_x (output);
dest->y = mir_output_get_position_y (output);
dest->width = mir_output_mode_get_width (mode);
dest->height = mir_output_mode_get_height (mode);
}
else
{
@@ -393,7 +405,6 @@ gdk_mir_screen_get_monitor_workarea (GdkScreen *screen,
gint monitor_num,
GdkRectangle *dest)
{
//g_printerr ("gdk_mir_screen_get_monitor_workarea (%d)\n", monitor_num);
// FIXME: Don't know what this is
gdk_mir_screen_get_monitor_geometry (screen, monitor_num, dest);
}
@@ -401,28 +412,24 @@ gdk_mir_screen_get_monitor_workarea (GdkScreen *screen,
static GList *
gdk_mir_screen_list_visuals (GdkScreen *screen)
{
//g_printerr ("gdk_mir_screen_list_visuals\n");
return g_list_append (NULL, GDK_MIR_SCREEN (screen)->visual);
}
static GdkVisual *
gdk_mir_screen_get_system_visual (GdkScreen *screen)
{
//g_printerr ("gdk_mir_screen_get_system_visual\n");
return GDK_MIR_SCREEN (screen)->visual;
}
static GdkVisual *
gdk_mir_screen_get_rgba_visual (GdkScreen *screen)
{
//g_printerr ("gdk_mir_screen_get_rgba_visual\n");
return GDK_MIR_SCREEN (screen)->visual;
}
static gboolean
gdk_mir_screen_is_composited (GdkScreen *screen)
{
//g_printerr ("gdk_mir_screen_is_composited\n");
/* We're always composited */
return TRUE;
}
@@ -430,21 +437,18 @@ gdk_mir_screen_is_composited (GdkScreen *screen)
static gchar *
gdk_mir_screen_make_display_name (GdkScreen *screen)
{
//g_printerr ("gdk_mir_screen_make_display_name\n");
return NULL; // FIXME
}
static GdkWindow *
gdk_mir_screen_get_active_window (GdkScreen *screen)
{
//g_printerr ("gdk_mir_screen_get_active_window\n");
return NULL; // FIXME
}
static GList *
gdk_mir_screen_get_window_stack (GdkScreen *screen)
{
//g_printerr ("gdk_mir_screen_get_window_stack\n");
return NULL; // FIXME
}
@@ -452,7 +456,6 @@ static void
gdk_mir_screen_broadcast_client_message (GdkScreen *screen,
GdkEvent *event)
{
//g_printerr ("gdk_mir_screen_broadcast_client_message\n");
// FIXME
}
@@ -461,8 +464,6 @@ gdk_mir_screen_get_setting (GdkScreen *screen,
const gchar *name,
GValue *value)
{
//g_printerr ("gdk_mir_screen_get_setting (\"%s\")\n", name);
if (strcmp (name, "gtk-theme-name") == 0)
{
g_value_set_string (value, "Ambiance");
@@ -717,21 +718,18 @@ gdk_mir_screen_get_setting (GdkScreen *screen,
static gint
gdk_mir_screen_visual_get_best_depth (GdkScreen *screen)
{
//g_printerr ("gdk_mir_screen_visual_get_best_depth\n");
return VISUAL_DEPTH;
}
static GdkVisualType
gdk_mir_screen_visual_get_best_type (GdkScreen *screen)
{
//g_printerr ("gdk_mir_screen_visual_get_best_type\n");
return VISUAL_TYPE;
}
static GdkVisual*
gdk_mir_screen_visual_get_best (GdkScreen *screen)
{
//g_printerr ("gdk_mir_screen_visual_get_best\n");
return GDK_MIR_SCREEN (screen)->visual;
}
@@ -739,7 +737,6 @@ static GdkVisual*
gdk_mir_screen_visual_get_best_with_depth (GdkScreen *screen,
gint depth)
{
//g_printerr ("gdk_mir_screen_visual_get_best_with_depth (%d)\n", depth);
return GDK_MIR_SCREEN (screen)->visual;
}
@@ -747,7 +744,6 @@ static GdkVisual*
gdk_mir_screen_visual_get_best_with_type (GdkScreen *screen,
GdkVisualType visual_type)
{
//g_printerr ("gdk_mir_screen_visual_get_best_with_type (%d)\n", visual_type);
return GDK_MIR_SCREEN (screen)->visual;
}
@@ -756,7 +752,6 @@ gdk_mir_screen_visual_get_best_with_both (GdkScreen *screen,
gint depth,
GdkVisualType visual_type)
{
//g_printerr ("gdk_mir_screen_visual_get_best_with_both\n");
return GDK_MIR_SCREEN (screen)->visual;
}
@@ -765,7 +760,6 @@ gdk_mir_screen_query_depths (GdkScreen *screen,
gint **depths,
gint *count)
{
//g_printerr ("gdk_mir_screen_query_depths\n");
static gint supported_depths[] = { VISUAL_DEPTH };
*depths = supported_depths;
*count = 1;
@@ -776,7 +770,6 @@ gdk_mir_screen_query_visual_types (GdkScreen *screen,
GdkVisualType **visual_types,
gint *count)
{
//g_printerr ("gdk_mir_screen_query_visual_types\n");
static GdkVisualType supported_visual_types[] = { VISUAL_TYPE };
*visual_types = supported_visual_types;
*count = 1;
@@ -786,7 +779,6 @@ static gint
gdk_mir_screen_get_monitor_scale_factor (GdkScreen *screen,
gint monitor_num)
{
//g_printerr ("gdk_mir_screen_get_monitor_scale_factor (%d)\n", monitor_num);
/* Don't support monitor scaling */
return 1;
}

File diff suppressed because it is too large Load Diff

View File

@@ -74,6 +74,7 @@
{
GdkWindow *window = [[self contentView] gdkWindow];
gdk_synthesize_window_state (window, 0, GDK_WINDOW_STATE_FOCUSED);
_gdk_quartz_events_update_focus_window (window, TRUE);
}
@@ -82,6 +83,7 @@
GdkWindow *window = [[self contentView] gdkWindow];
_gdk_quartz_events_update_focus_window (window, FALSE);
gdk_synthesize_window_state (window, GDK_WINDOW_STATE_FOCUSED, 0);
}
-(void)windowDidBecomeMain:(NSNotification *)aNotification
@@ -838,4 +840,19 @@ update_context_from_dragging_info (id <NSDraggingInfo> sender)
inMaximizeTransition = NO;
}
-(NSSize)window:(NSWindow *)window willUseFullScreenContentSize:(NSSize)proposedSize
{
return [[window screen] frame].size;
}
-(void)windowWillEnterFullScreen:(NSNotification *)aNotification
{
lastUnfullscreenFrame = [self frame];
}
-(void)windowWillExitFullScreen:(NSNotification *)aNotification
{
[self setFrame:lastUnfullscreenFrame display:YES];
}
@end

View File

@@ -37,6 +37,7 @@
NSRect lastUnmaximizedFrame;
NSRect lastMaximizedFrame;
NSRect lastUnfullscreenFrame;
BOOL inMaximizeTransition;
}

View File

@@ -29,6 +29,7 @@ libgdk_quartz_la_SOURCES = \
gdkdevicemanager-core-quartz.c \
gdkdevicemanager-core-quartz.h \
gdkdisplay-quartz.c \
gdkdisplay-quartz.h \
gdkdisplaymanager-quartz.c \
gdkdnd-quartz.c \
gdkdnd-quartz.h \
@@ -38,6 +39,8 @@ libgdk_quartz_la_SOURCES = \
gdkglcontext-quartz.h \
gdkglobals-quartz.c \
gdkkeys-quartz.c \
gdkmonitor-quartz.c \
gdkmonitor-quartz.h \
gdkprivate-quartz.h \
gdkproperty-quartz.c \
gdkquartz.h \
@@ -62,6 +65,7 @@ libgdkquartzinclude_HEADERS = \
gdkquartzdisplaymanager.h \
gdkquartzdnd.h \
gdkquartzkeys.h \
gdkquartzmonitor.h \
gdkquartzscreen.h \
gdkquartzutils.h \
gdkquartzvisual.h \

View File

@@ -26,18 +26,11 @@
#include "gdkquartzwindow.h"
#include "gdkquartzdisplay.h"
#include "gdkquartzdevicemanager-core.h"
#include "gdkscreen.h"
#include "gdkmonitorprivate.h"
#include "gdkdisplay-quartz.h"
struct _GdkQuartzDisplay
{
GdkDisplay display;
};
struct _GdkQuartzDisplayClass
{
GdkDisplayClass display_class;
};
static GdkWindow *
gdk_quartz_display_get_default_group (GdkDisplay *display)
{
@@ -196,12 +189,45 @@ gdk_quartz_display_notify_startup_complete (GdkDisplay *display,
/* FIXME: Implement? */
}
static int
gdk_quartz_display_get_n_monitors (GdkDisplay *display)
{
GdkQuartzDisplay *quartz_display = GDK_QUARTZ_DISPLAY (display);
return quartz_display->monitors->len;
}
static GdkMonitor *
gdk_quartz_display_get_monitor (GdkDisplay *display,
int monitor_num)
{
GdkQuartzDisplay *quartz_display = GDK_QUARTZ_DISPLAY (display);
if (0 <= monitor_num || monitor_num < quartz_display->monitors->len)
return (GdkMonitor *)quartz_display->monitors->pdata[monitor_num];
return NULL;
}
static GdkMonitor *
gdk_quartz_display_get_primary_monitor (GdkDisplay *display)
{
GdkQuartzDisplay *quartz_display = GDK_QUARTZ_DISPLAY (display);
return quartz_display->monitors->pdata[0];
}
G_DEFINE_TYPE (GdkQuartzDisplay, gdk_quartz_display, GDK_TYPE_DISPLAY)
static void
gdk_quartz_display_init (GdkQuartzDisplay *display)
{
GDK_QUARTZ_ALLOC_POOL;
display->monitors = g_ptr_array_new_with_free_func (g_object_unref);
GDK_QUARTZ_RELEASE_POOL;
}
static void
@@ -209,6 +235,8 @@ gdk_quartz_display_dispose (GObject *object)
{
GdkQuartzDisplay *display_quartz = GDK_QUARTZ_DISPLAY (object);
g_ptr_array_free (display_quartz->monitors, TRUE);
G_OBJECT_CLASS (gdk_quartz_display_parent_class)->dispose (object);
}
@@ -268,6 +296,9 @@ gdk_quartz_display_class_init (GdkQuartzDisplayClass *class)
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_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;
ProcessSerialNumber psn = { 0, kCurrentProcess };

View File

@@ -0,0 +1,58 @@
/*
* Copyright © 2017 Tom Schoonjans
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <glib.h>
#include <gio/gio.h>
#include "gdkmonitor-quartz.h"
#include "gdkscreen-quartz.h"
G_DEFINE_TYPE (GdkQuartzMonitor, gdk_quartz_monitor, GDK_TYPE_MONITOR)
static void
gdk_quartz_monitor_get_workarea (GdkMonitor *monitor,
GdkRectangle *dest)
{
GdkQuartzScreen *quartz_screen = GDK_QUARTZ_SCREEN(gdk_display_get_default_screen (monitor->display));
GdkQuartzMonitor *quartz_monitor = GDK_QUARTZ_MONITOR(monitor);
GDK_QUARTZ_ALLOC_POOL;
NSRect rect = [quartz_monitor->nsscreen 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;
GDK_QUARTZ_RELEASE_POOL;
}
static void
gdk_quartz_monitor_init (GdkQuartzMonitor *monitor)
{
}
static void
gdk_quartz_monitor_class_init (GdkQuartzMonitorClass *class)
{
GDK_MONITOR_CLASS (class)->get_workarea = gdk_quartz_monitor_get_workarea;
}

View File

@@ -0,0 +1,41 @@
/*
* Copyright © 2017 Tom Schoonjans
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GDK_QUARTZ_MONITOR_PRIVATE_H__
#define __GDK_QUARTZ_MONITOR_PRIVATE_H__
#include <glib.h>
#include <gio/gio.h>
#include "gdkmonitorprivate.h"
#include "gdkquartzmonitor.h"
#include "gdkprivate-quartz.h"
struct _GdkQuartzMonitor
{
GdkMonitor parent;
NSScreen *nsscreen;
};
struct _GdkQuartzMonitorClass {
GdkMonitorClass parent_class;
};
#endif

View File

@@ -116,17 +116,6 @@ void _gdk_quartz_display_get_maximal_cursor_size (GdkDisplay *display,
guint *width,
guint *height);
/* Display methods - window */
void _gdk_quartz_display_before_process_all_updates (GdkDisplay *display);
void _gdk_quartz_display_after_process_all_updates (GdkDisplay *display);
void _gdk_quartz_display_create_window_impl (GdkDisplay *display,
GdkWindow *window,
GdkWindow *real_parent,
GdkScreen *screen,
GdkEventMask event_mask,
GdkWindowAttr *attributes,
gint attributes_mask);
/* Display methods - keymap */
GdkKeymap * _gdk_quartz_display_get_keymap (GdkDisplay *display);

View File

@@ -71,6 +71,7 @@ G_END_DECLS
#include <gdk/quartz/gdkquartzdisplaymanager.h>
#include <gdk/quartz/gdkquartzdnd.h>
#include <gdk/quartz/gdkquartzkeys.h>
#include <gdk/quartz/gdkquartzmonitor.h>
#include <gdk/quartz/gdkquartzscreen.h>
#include <gdk/quartz/gdkquartzutils.h>
#include <gdk/quartz/gdkquartzvisual.h>

View File

@@ -22,6 +22,8 @@
#include <gdk/gdk.h>
#include "gdkprivate-quartz.h"
#include "gdkdisplay-quartz.h"
#include "gdkmonitor-quartz.h"
/* A couple of notes about this file are in order. In GDK, a
@@ -66,6 +68,8 @@ static void display_reconfiguration_callback (CGDirectDisplayID displ
CGDisplayChangeSummaryFlags flags,
void *userInfo);
static gint get_mm_from_pixels (NSScreen *screen, int pixels);
G_DEFINE_TYPE (GdkQuartzScreen, gdk_quartz_screen, GDK_TYPE_SCREEN);
static void
@@ -103,21 +107,18 @@ gdk_quartz_screen_dispose (GObject *object)
G_OBJECT_CLASS (gdk_quartz_screen_parent_class)->dispose (object);
}
static void
gdk_quartz_screen_screen_rects_free (GdkQuartzScreen *screen)
{
screen->n_screens = 0;
g_clear_pointer (&screen->screen_rects, g_free);
}
static void
gdk_quartz_screen_finalize (GObject *object)
{
GdkQuartzScreen *screen = GDK_QUARTZ_SCREEN (object);
gdk_quartz_screen_screen_rects_free (screen);
G_OBJECT_CLASS (gdk_quartz_screen_parent_class)->finalize (object);
}
/* Protocol to build cleanly for OSX < 10.7 */
@protocol ScaleFactor
- (CGFloat) backingScaleFactor;
@end
static void
gdk_quartz_screen_calculate_layout (GdkQuartzScreen *screen)
@@ -125,11 +126,14 @@ gdk_quartz_screen_calculate_layout (GdkQuartzScreen *screen)
NSArray *array;
int i;
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;
gdk_quartz_screen_screen_rects_free (screen);
array = [NSScreen screens];
screen->width = 0;
@@ -144,6 +148,12 @@ gdk_quartz_screen_calculate_layout (GdkQuartzScreen *screen)
*/
for (i = 0; i < [array count]; 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];
NSRect rect = [[array objectAtIndex:i] frame];
screen->min_x = MIN (screen->min_x, rect.origin.x);
@@ -156,22 +166,31 @@ gdk_quartz_screen_calculate_layout (GdkQuartzScreen *screen)
screen->width = max_x - screen->min_x;
screen->height = max_y - screen->min_y;
screen->n_screens = [array count];
screen->screen_rects = g_new0 (GdkRectangle, screen->n_screens);
for (i = 0; i < screen->n_screens; i++)
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];
screen->screen_rects[i].x = rect.origin.x - screen->min_x;
screen->screen_rects[i].y
monitor->geometry.x = rect.origin.x - screen->min_x;
monitor->geometry.y
= screen->height - (rect.origin.y + rect.size.height) + screen->min_y;
screen->screen_rects[i].width = rect.size.width;
screen->screen_rects[i].height = rect.size.height;
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;
@@ -331,133 +350,6 @@ get_mm_from_pixels (NSScreen *screen, int pixels)
return (pixels / dpi) * 25.4;
}
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);
}
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);
}
static gint
gdk_quartz_screen_get_n_monitors (GdkScreen *screen)
{
return GDK_QUARTZ_SCREEN (screen)->n_screens;
}
static gint
gdk_quartz_screen_get_primary_monitor (GdkScreen *screen)
{
return 0;
}
static gint
gdk_quartz_screen_get_monitor_width_mm (GdkScreen *screen,
gint monitor_num)
{
return get_mm_from_pixels (get_nsscreen_for_monitor (monitor_num),
GDK_QUARTZ_SCREEN (screen)->screen_rects[monitor_num].width);
}
static gint
gdk_quartz_screen_get_monitor_height_mm (GdkScreen *screen,
gint monitor_num)
{
return get_mm_from_pixels (get_nsscreen_for_monitor (monitor_num),
GDK_QUARTZ_SCREEN (screen)->screen_rects[monitor_num].height);
}
static gchar *
gdk_quartz_screen_get_monitor_plug_name (GdkScreen *screen,
gint monitor_num)
{
/* FIXME: Is there some useful name we could use here? */
return NULL;
}
static void
gdk_quartz_screen_get_monitor_geometry (GdkScreen *screen,
gint monitor_num,
GdkRectangle *dest)
{
*dest = GDK_QUARTZ_SCREEN (screen)->screen_rects[monitor_num];
}
static void
gdk_quartz_screen_get_monitor_workarea (GdkScreen *screen,
gint monitor_num,
GdkRectangle *dest)
{
GdkQuartzScreen *quartz_screen = GDK_QUARTZ_SCREEN (screen);
NSArray *array;
NSScreen *nsscreen;
NSRect rect;
GDK_QUARTZ_ALLOC_POOL;
array = [NSScreen screens];
nsscreen = [array objectAtIndex:monitor_num];
rect = [nsscreen 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;
GDK_QUARTZ_RELEASE_POOL;
}
/* Protocol to build cleanly for OSX < 10.7 */
@protocol ScaleFactor
- (CGFloat) backingScaleFactor;
@end
gint
_gdk_quartz_screen_get_monitor_scale_factor (GdkScreen *screen,
gint monitor_num)
{
GdkQuartzScreen *quartz_screen;
NSArray *array;
NSScreen *nsscreen;
gint scale_factor = 1;
quartz_screen = GDK_QUARTZ_SCREEN (screen);
GDK_QUARTZ_ALLOC_POOL;
array = [NSScreen screens];
nsscreen = [array objectAtIndex:monitor_num];
if (gdk_quartz_osx_version() >= GDK_OSX_LION)
scale_factor = [(id <ScaleFactor>) nsscreen backingScaleFactor];
GDK_QUARTZ_RELEASE_POOL;
return scale_factor;
}
static gchar *
gdk_quartz_screen_make_display_name (GdkScreen *screen)
{
@@ -482,6 +374,20 @@ gdk_quartz_screen_is_composited (GdkScreen *screen)
return TRUE;
}
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);
}
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);
}
static void
gdk_quartz_screen_class_init (GdkQuartzScreenClass *klass)
{
@@ -498,13 +404,6 @@ gdk_quartz_screen_class_init (GdkQuartzScreenClass *klass)
screen_class->get_height_mm = gdk_quartz_screen_get_height_mm;
screen_class->get_number = gdk_quartz_screen_get_number;
screen_class->get_root_window = gdk_quartz_screen_get_root_window;
screen_class->get_n_monitors = gdk_quartz_screen_get_n_monitors;
screen_class->get_primary_monitor = gdk_quartz_screen_get_primary_monitor;
screen_class->get_monitor_width_mm = gdk_quartz_screen_get_monitor_width_mm;
screen_class->get_monitor_height_mm = gdk_quartz_screen_get_monitor_height_mm;
screen_class->get_monitor_plug_name = gdk_quartz_screen_get_monitor_plug_name;
screen_class->get_monitor_geometry = gdk_quartz_screen_get_monitor_geometry;
screen_class->get_monitor_workarea = gdk_quartz_screen_get_monitor_workarea;
screen_class->is_composited = gdk_quartz_screen_is_composited;
screen_class->make_display_name = gdk_quartz_screen_make_display_name;
screen_class->get_active_window = gdk_quartz_screen_get_active_window;
@@ -522,5 +421,4 @@ gdk_quartz_screen_class_init (GdkQuartzScreenClass *klass)
screen_class->query_depths = _gdk_quartz_screen_query_depths;
screen_class->query_visual_types = _gdk_quartz_screen_query_visual_types;
screen_class->list_visuals = _gdk_quartz_screen_list_visuals;
screen_class->get_monitor_scale_factor = _gdk_quartz_screen_get_monitor_scale_factor;
}

View File

@@ -36,9 +36,6 @@ struct _GdkQuartzScreen
gint width;
gint height;
int n_screens;
GdkRectangle *screen_rects;
guint screen_changed_id;
guint emit_monitors_changed : 1;

View File

@@ -2422,7 +2422,10 @@ gdk_quartz_window_set_decorations (GdkWindow *window,
}
if (new_mask == NSBorderlessWindowMask)
[impl->toplevel setContentSize:rect.size];
{
[impl->toplevel setContentSize:rect.size];
[impl->toplevel setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
}
else
[impl->toplevel setFrame:rect display:YES];
@@ -2471,9 +2474,47 @@ static void
gdk_quartz_window_set_functions (GdkWindow *window,
GdkWMFunction functions)
{
GdkWindowImplQuartz *impl;
gboolean min, max, close;
g_return_if_fail (GDK_IS_WINDOW (window));
/* FIXME: Implement */
impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
if (functions & GDK_FUNC_ALL)
{
min = !(functions & GDK_FUNC_MINIMIZE);
max = !(functions & GDK_FUNC_MAXIMIZE);
close = !(functions & GDK_FUNC_CLOSE);
}
else
{
min = (functions & GDK_FUNC_MINIMIZE);
max = (functions & GDK_FUNC_MAXIMIZE);
close = (functions & GDK_FUNC_CLOSE);
}
if (impl->toplevel)
{
NSWindowStyleMask mask = [impl->toplevel styleMask];
if (min)
mask = mask | NSMiniaturizableWindowMask;
else
mask = mask & ~NSMiniaturizableWindowMask;
if (max)
mask = mask | NSResizableWindowMask;
else
mask = mask & ~NSResizableWindowMask;
if (close)
mask = mask | NSClosableWindowMask;
else
mask = mask & ~NSClosableWindowMask;
[impl->toplevel setStyleMask:mask];
}
}
static void

View File

@@ -1,4 +1,4 @@
#version 130
#version 110
varying vec2 vUv;

View File

@@ -1,6 +1,4 @@
#version 130
uniform sampler2D map;
#version 110
attribute vec2 position;
attribute vec2 uv;

View File

@@ -1,4 +1,4 @@
#version 130
#version 110
varying vec2 vUv;

View File

@@ -1,6 +1,4 @@
#version 130
uniform sampler2DRect map;
#version 110
attribute vec2 position;
attribute vec2 uv;

View File

@@ -1,7 +1,5 @@
#version 150
uniform sampler2D map;
in vec2 position;
in vec2 uv;

View File

@@ -1,7 +1,5 @@
#version 150
uniform sampler2DRect map;
attribute vec2 position;
attribute vec2 uv;

View File

@@ -167,7 +167,7 @@ _gdk_wayland_cursor_update (GdkWaylandDisplay *display_wayland,
if (!c)
{
g_warning (G_STRLOC ": Unable to load %s from the cursor theme", cursor->name);
g_message ("Unable to load %s from the cursor theme", cursor->name);
return FALSE;
}
@@ -353,7 +353,10 @@ _gdk_wayland_display_get_cursor_for_name_with_scale (GdkDisplay *display,
return GDK_CURSOR (private);
if (!_gdk_wayland_cursor_update (display_wayland, private))
return GDK_CURSOR (private);
{
g_object_unref (private);
return NULL;
}
/* Insert into cache. */
g_hash_table_insert (display_wayland->cursor_cache,

View File

@@ -227,6 +227,7 @@ struct _GdkWaylandSeat
guint32 repeat_key;
guint32 repeat_count;
gint64 repeat_deadline;
gint32 nkeys;
GSettings *keyboard_settings;
uint32_t keyboard_time;
uint32_t keyboard_key_serial;
@@ -307,7 +308,8 @@ struct _GdkWaylandDeviceManagerClass
static void deliver_key_event (GdkWaylandSeat *seat,
uint32_t time_,
uint32_t key,
uint32_t state);
uint32_t state,
gboolean from_key_repeat);
GType gdk_wayland_device_manager_get_type (void);
G_DEFINE_TYPE (GdkWaylandDeviceManager,
@@ -740,6 +742,15 @@ gdk_wayland_device_grab (GdkDevice *device,
GdkWindow *prev_focus = gdk_wayland_device_get_focus (device);
GdkWaylandPointerData *pointer = GDK_WAYLAND_DEVICE (device)->pointer;
if (gdk_window_get_window_type (window) == GDK_WINDOW_TEMP &&
gdk_window_is_visible (window))
{
g_warning ("Window %p is already mapped at the time of grabbing. "
"gdk_seat_grab() should be used to simultanously grab input "
"and show this popup. You may find oddities ahead.",
window);
}
if (prev_focus != window)
device_emit_grab_crossing (device, prev_focus, window, GDK_CROSSING_GRAB, time_);
@@ -1858,6 +1869,7 @@ keyboard_handle_enter (void *data,
seat->keyboard_focus = wl_surface_get_user_data (surface);
g_object_ref (seat->keyboard_focus);
seat->nkeys = 0;
event = gdk_event_new (GDK_FOCUS_CHANGE);
event->focus_change.window = g_object_ref (seat->keyboard_focus);
@@ -1914,6 +1926,7 @@ keyboard_handle_leave (void *data,
g_object_unref (seat->keyboard_focus);
seat->keyboard_focus = NULL;
seat->nkeys = 0;
GDK_NOTE (EVENTS,
g_message ("focus out, seat %p surface %p",
@@ -2068,7 +2081,8 @@ static void
deliver_key_event (GdkWaylandSeat *seat,
uint32_t time_,
uint32_t key,
uint32_t state)
uint32_t state,
gboolean from_key_repeat)
{
GdkEvent *event;
struct xkb_state *xkb_state;
@@ -2116,17 +2130,30 @@ deliver_key_event (GdkWaylandSeat *seat,
event->key.hardware_keycode, event->key.keyval,
event->key.string, event->key.state));
if (state == 0)
return;
if (!xkb_keymap_key_repeats (xkb_keymap, key))
return;
if (!get_key_repeat (seat, &delay, &interval))
return;
if (!from_key_repeat)
{
if (state) /* Another key is pressed */
{
seat->repeat_key = key;
seat->nkeys++;
}
else /* a key is released */
{
/* The compositor may send us more key releases than key presses */
seat->nkeys = MAX (0, seat->nkeys - 1);
}
}
if (seat->nkeys == 0)
return;
seat->repeat_count++;
seat->repeat_key = key;
interval *= 1000L;
delay *= 1000L;
@@ -2156,8 +2183,7 @@ sync_after_repeat_callback (void *data,
GdkWaylandSeat *seat = data;
g_clear_pointer (&seat->repeat_callback, wl_callback_destroy);
deliver_key_event (seat, seat->keyboard_time, seat->repeat_key, 1);
deliver_key_event (seat, seat->keyboard_time, seat->repeat_key, 1, TRUE);
}
static const struct wl_callback_listener sync_after_repeat_callback_listener = {
@@ -2204,7 +2230,8 @@ keyboard_handle_key (void *data,
seat->keyboard_key_serial = serial;
seat->repeat_count = 0;
_gdk_wayland_display_update_serial (display, serial);
deliver_key_event (data, time, key + 8, state_w);
deliver_key_event (data, time, key + 8, state_w, FALSE);
}
static void
@@ -2224,10 +2251,11 @@ keyboard_handle_modifiers (void *data,
keymap = seat->keymap;
direction = gdk_keymap_get_direction (keymap);
xkb_state = _gdk_wayland_keymap_get_xkb_state (keymap);
seat->key_modifiers = mods_depressed | mods_latched | mods_locked;
xkb_state_update_mask (xkb_state, mods_depressed, mods_latched, mods_locked, group, 0, 0);
seat->key_modifiers = gdk_keymap_get_modifier_state (keymap);
g_signal_emit_by_name (keymap, "state-changed");
if (direction != gdk_keymap_get_direction (keymap))
g_signal_emit_by_name (keymap, "direction-changed");

View File

@@ -796,6 +796,33 @@ gdk_wayland_display_get_next_serial (GdkDisplay *display)
return ++serial;
}
/**
* gdk_wayland_display_set_startup_notification_id:
* @display: (type GdkWaylandDisplay): a #GdkDisplay
* @startup_id: the startup notification ID (must be valid utf8)
*
* Sets the startup notification ID for a display.
*
* This is usually taken from the value of the DESKTOP_STARTUP_ID
* environment variable, but in some cases (such as the application not
* being launched using exec()) it can come from other sources.
*
* The startup ID is also what is used to signal that the startup is
* complete (for example, when opening a window or when calling
* gdk_notify_startup_complete()).
*
* Since: 3.22
**/
void
gdk_wayland_display_set_startup_notification_id (GdkDisplay *display,
const char *startup_id)
{
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
g_free (display_wayland->startup_notification_id);
display_wayland->startup_notification_id = g_strdup (startup_id);
}
static void
gdk_wayland_display_notify_startup_complete (GdkDisplay *display,
const gchar *startup_id)

View File

@@ -120,6 +120,7 @@ struct _GdkWaylandDisplay
guint have_egl_buffer_age : 1;
guint have_egl_swap_buffers_with_damage : 1;
guint have_egl_surfaceless_context : 1;
EGLint egl_min_swap_interval;
};
struct _GdkWaylandDisplayClass

View File

@@ -549,6 +549,15 @@ _gdk_wayland_window_drag_begin (GdkWindow *window,
g_free (mimetype);
}
/* If there's no targets this is local DnD, ensure we create a target for it */
if (!context->targets)
{
gchar *local_dnd_mime;
local_dnd_mime = g_strdup_printf ("application/gtk+-local-dnd-%x", getpid());
wl_data_source_offer (context_wayland->data_source, local_dnd_mime);
g_free (local_dnd_mime);
}
return context;
}

View File

@@ -89,7 +89,10 @@ gdk_event_source_check (GSource *base)
if (source->pfd.revents & G_IO_IN)
{
if (wl_display_read_events (display_wayland->wl_display) < 0)
g_error ("Error reading events from display: %s", g_strerror (errno));
{
g_message ("Error reading events from display: %s", g_strerror (errno));
_exit (1);
}
}
else
wl_display_cancel_read (display_wayland->wl_display);

View File

@@ -274,17 +274,52 @@ gdk_wayland_gl_context_init (GdkWaylandGLContext *self)
{
}
static EGLDisplay
gdk_wayland_get_display (GdkWaylandDisplay *display_wayland)
{
EGLDisplay dpy = NULL;
if (epoxy_has_egl_extension (NULL, "EGL_KHR_platform_base"))
{
PFNEGLGETPLATFORMDISPLAYPROC getPlatformDisplay =
(void *) eglGetProcAddress ("eglGetPlatformDisplay");
if (getPlatformDisplay)
dpy = getPlatformDisplay (EGL_PLATFORM_WAYLAND_EXT,
display_wayland->wl_display,
NULL);
if (dpy)
return dpy;
}
if (epoxy_has_egl_extension (NULL, "EGL_EXT_platform_base"))
{
PFNEGLGETPLATFORMDISPLAYEXTPROC getPlatformDisplay =
(void *) eglGetProcAddress ("eglGetPlatformDisplayEXT");
if (getPlatformDisplay)
dpy = getPlatformDisplay (EGL_PLATFORM_WAYLAND_EXT,
display_wayland->wl_display,
NULL);
if (dpy)
return dpy;
}
return eglGetDisplay ((EGLNativeDisplayType) display_wayland->wl_display);
}
gboolean
gdk_wayland_display_init_gl (GdkDisplay *display)
{
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
EGLint major, minor;
EGLDisplay *dpy;
EGLDisplay dpy;
if (display_wayland->have_egl)
return TRUE;
dpy = eglGetDisplay ((EGLNativeDisplayType)display_wayland->wl_display);
dpy = gdk_wayland_get_display (display_wayland);
if (dpy == NULL)
return FALSE;
@@ -334,6 +369,7 @@ gdk_wayland_display_init_gl (GdkDisplay *display)
static gboolean
find_eglconfig_for_window (GdkWindow *window,
EGLConfig *egl_config_out,
EGLint *min_swap_interval_out,
GError **error)
{
GdkDisplay *display = gdk_window_get_display (window);
@@ -341,7 +377,7 @@ find_eglconfig_for_window (GdkWindow *window,
GdkVisual *visual = gdk_window_get_visual (window);
EGLint attrs[MAX_EGL_ATTRS];
EGLint count;
EGLConfig *configs;
EGLConfig *configs, chosen_config;
gboolean use_rgba;
int i = 0;
@@ -394,9 +430,20 @@ find_eglconfig_for_window (GdkWindow *window,
}
/* Pick first valid configuration i guess? */
chosen_config = configs[0];
if (!eglGetConfigAttrib (display_wayland->egl_display, 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 = configs[0];
*egl_config_out = chosen_config;
g_free (configs);
@@ -430,7 +477,9 @@ gdk_wayland_window_create_gl_context (GdkWindow *window,
return NULL;
}
if (!find_eglconfig_for_window (window, &config, error))
if (!find_eglconfig_for_window (window, &config,
&display_wayland->egl_min_swap_interval,
error))
return NULL;
context = g_object_new (GDK_TYPE_WAYLAND_GL_CONTEXT,
@@ -508,5 +557,10 @@ gdk_wayland_display_make_gl_context_current (GdkDisplay *display,
return FALSE;
}
if (display_wayland->egl_min_swap_interval == 0)
eglSwapInterval (display_wayland->egl_display, 0);
else
g_debug ("Can't disable GL swap interval");
return TRUE;
}

View File

@@ -303,7 +303,13 @@ get_gdk_modifiers (struct xkb_keymap *xkb_keymap,
state |= GDK_SUPER_MASK;
if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, "Hyper")))
state |= GDK_HYPER_MASK;
if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, "Meta")))
/* Gtk+ treats MOD1 as a synonym for Alt, and does not expect it to
* be mapped around, so we should avoid adding GDK_META_MASK if MOD1
* is already included to avoid confusing gtk+ and applications that
* rely on that behavior.
*/
if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, "Meta")) &&
(state & GDK_MOD1_MASK) == 0)
state |= GDK_META_MASK;
return state;

View File

@@ -380,6 +380,7 @@ update_xft_settings (GdkScreen *screen)
typedef struct _TranslationEntry TranslationEntry;
struct _TranslationEntry {
gboolean valid;
const gchar *schema;
const gchar *key;
const gchar *setting;
@@ -392,34 +393,35 @@ struct _TranslationEntry {
};
static TranslationEntry translations[] = {
{ "org.gnome.desktop.interface", "gtk-theme", "gtk-theme-name" , G_TYPE_STRING, { .s = "Adwaita" } },
{ "org.gnome.desktop.interface", "icon-theme", "gtk-icon-theme-name", G_TYPE_STRING, { .s = "gnome" } },
{ "org.gnome.desktop.interface", "cursor-theme", "gtk-cursor-theme-name", G_TYPE_STRING, { .s = "Adwaita" } },
{ "org.gnome.desktop.interface", "cursor-size", "gtk-cursor-theme-size", G_TYPE_INT, { .i = 32 } },
{ "org.gnome.desktop.interface", "font-name", "gtk-font-name", G_TYPE_STRING, { .s = "Cantarell 11" } },
{ "org.gnome.desktop.interface", "cursor-blink", "gtk-cursor-blink", G_TYPE_BOOLEAN, { .b = TRUE } },
{ "org.gnome.desktop.interface", "cursor-blink-time", "gtk-cursor-blink-time", G_TYPE_INT, { .i = 1200 } },
{ "org.gnome.desktop.interface", "cursor-blink-timeout", "gtk-cursor-blink-timeout", G_TYPE_INT, { .i = 3600 } },
{ "org.gnome.desktop.interface", "gtk-im-module", "gtk-im-module", G_TYPE_STRING, { .s = "simple" } },
{ "org.gnome.desktop.interface", "enable-animations", "gtk-enable-animations", G_TYPE_BOOLEAN, { .b = TRUE } },
{ "org.gnome.settings-daemon.peripherals.mouse", "double-click", "gtk-double-click-time", G_TYPE_INT, { .i = 400 } },
{ "org.gnome.settings-daemon.peripherals.mouse", "drag-threshold", "gtk-dnd-drag-threshold", G_TYPE_INT, {.i = 8 } },
{ "org.gnome.desktop.sound", "theme-name", "gtk-sound-theme-name", G_TYPE_STRING, { .s = "freedesktop" } },
{ "org.gnome.desktop.sound", "event-sounds", "gtk-enable-event-sounds", G_TYPE_BOOLEAN, { .b = TRUE } },
{ "org.gnome.desktop.sound", "input-feedback-sounds", "gtk-enable-input-feedback-sounds", G_TYPE_BOOLEAN, { . b = FALSE } },
{ "org.gnome.desktop.privacy", "recent-files-max-age", "gtk-recent-files-max-age", G_TYPE_INT, { .i = 30 } },
{ "org.gnome.desktop.privacy", "remember-recent-files", "gtk-recent-files-enabled", G_TYPE_BOOLEAN, { .b = TRUE } },
{ WM_SETTINGS_SCHEMA, "button-layout", "gtk-decoration-layout", G_TYPE_STRING, { .s = "menu:close" } },
{ CLASSIC_WM_SETTINGS_SCHEMA, "button-layout", "gtk-decoration-layout", G_TYPE_STRING, { .s = "menu:close" } },
{ "org.gnome.settings-daemon.plugins.xsettings", "antialiasing", "gtk-xft-antialias", G_TYPE_NONE, { .i = 0 } },
{ "org.gnome.settings-daemon.plugins.xsettings", "hinting", "gtk-xft-hinting", G_TYPE_NONE, { .i = 0 } },
{ "org.gnome.settings-daemon.plugins.xsettings", "hinting", "gtk-xft-hintstyle", G_TYPE_NONE, { .i = 0 } },
{ "org.gnome.settings-daemon.plugins.xsettings", "rgba-order", "gtk-xft-rgba", G_TYPE_NONE, { .i = 0 } },
{ "org.gnome.desktop.interface", "text-scaling-factor", "gtk-xft-dpi" , G_TYPE_NONE, { .i = 0 } },
{ "org.gnome.desktop.wm.preferences", "action-double-click-titlebar", "gtk-titlebar-double-click", G_TYPE_STRING, { .s = "toggle-maximize" } },
{ "org.gnome.desktop.wm.preferences", "action-middle-click-titlebar", "gtk-titlebar-middle-click", G_TYPE_STRING, { .s = "none" } },
{ "org.gnome.desktop.wm.preferences", "action-right-click-titlebar", "gtk-titlebar-right-click", G_TYPE_STRING, { .s = "menu" } },
{ "org.gnome.desktop.a11y", "always-show-text-caret", "gtk-keynav-use-caret", G_TYPE_BOOLEAN, { .b = FALSE } }
{ FALSE, "org.gnome.desktop.interface", "gtk-theme", "gtk-theme-name" , G_TYPE_STRING, { .s = "Adwaita" } },
{ 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 } },
{ FALSE, "org.gnome.desktop.interface", "font-name", "gtk-font-name", G_TYPE_STRING, { .s = "Cantarell 11" } },
{ FALSE, "org.gnome.desktop.interface", "cursor-blink", "gtk-cursor-blink", G_TYPE_BOOLEAN, { .b = TRUE } },
{ FALSE, "org.gnome.desktop.interface", "cursor-blink-time", "gtk-cursor-blink-time", G_TYPE_INT, { .i = 1200 } },
{ FALSE, "org.gnome.desktop.interface", "cursor-blink-timeout", "gtk-cursor-blink-timeout", G_TYPE_INT, { .i = 3600 } },
{ FALSE, "org.gnome.desktop.interface", "gtk-im-module", "gtk-im-module", G_TYPE_STRING, { .s = "simple" } },
{ FALSE, "org.gnome.desktop.interface", "enable-animations", "gtk-enable-animations", G_TYPE_BOOLEAN, { .b = TRUE } },
{ FALSE, "org.gnome.desktop.interface", "gtk-enable-primary-paste", "gtk-enable-primary-paste", G_TYPE_BOOLEAN, { .b = TRUE } },
{ FALSE, "org.gnome.settings-daemon.peripherals.mouse", "double-click", "gtk-double-click-time", G_TYPE_INT, { .i = 400 } },
{ FALSE, "org.gnome.settings-daemon.peripherals.mouse", "drag-threshold", "gtk-dnd-drag-threshold", G_TYPE_INT, {.i = 8 } },
{ FALSE, "org.gnome.desktop.sound", "theme-name", "gtk-sound-theme-name", G_TYPE_STRING, { .s = "freedesktop" } },
{ FALSE, "org.gnome.desktop.sound", "event-sounds", "gtk-enable-event-sounds", G_TYPE_BOOLEAN, { .b = TRUE } },
{ FALSE, "org.gnome.desktop.sound", "input-feedback-sounds", "gtk-enable-input-feedback-sounds", G_TYPE_BOOLEAN, { . b = FALSE } },
{ FALSE, "org.gnome.desktop.privacy", "recent-files-max-age", "gtk-recent-files-max-age", G_TYPE_INT, { .i = 30 } },
{ FALSE, "org.gnome.desktop.privacy", "remember-recent-files", "gtk-recent-files-enabled", G_TYPE_BOOLEAN, { .b = TRUE } },
{ FALSE, WM_SETTINGS_SCHEMA, "button-layout", "gtk-decoration-layout", G_TYPE_STRING, { .s = "menu:close" } },
{ FALSE, CLASSIC_WM_SETTINGS_SCHEMA, "button-layout", "gtk-decoration-layout", G_TYPE_STRING, { .s = "menu:close" } },
{ FALSE, "org.gnome.settings-daemon.plugins.xsettings", "antialiasing", "gtk-xft-antialias", G_TYPE_NONE, { .i = 0 } },
{ FALSE, "org.gnome.settings-daemon.plugins.xsettings", "hinting", "gtk-xft-hinting", G_TYPE_NONE, { .i = 0 } },
{ FALSE, "org.gnome.settings-daemon.plugins.xsettings", "hinting", "gtk-xft-hintstyle", G_TYPE_NONE, { .i = 0 } },
{ FALSE, "org.gnome.settings-daemon.plugins.xsettings", "rgba-order", "gtk-xft-rgba", G_TYPE_NONE, { .i = 0 } },
{ FALSE, "org.gnome.desktop.interface", "text-scaling-factor", "gtk-xft-dpi" , G_TYPE_NONE, { .i = 0 } },
{ 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 } }
};
static TranslationEntry *
@@ -495,18 +497,22 @@ init_settings (GdkScreen *screen)
for (i = 0; i < G_N_ELEMENTS (translations); i++)
{
if (g_hash_table_lookup (screen_wayland->settings, (gpointer)translations[i].schema) != NULL)
schema = g_settings_schema_source_lookup (source, translations[i].schema, TRUE);
if (!schema)
continue;
schema = g_settings_schema_source_lookup (source, translations[i].schema, TRUE);
if (schema != NULL)
if (g_hash_table_lookup (screen_wayland->settings, (gpointer)translations[i].schema) == NULL)
{
settings = g_settings_new_full (schema, NULL, NULL);
g_signal_connect (settings, "changed",
G_CALLBACK (settings_changed), screen);
g_hash_table_insert (screen_wayland->settings, (gpointer)translations[i].schema, settings);
g_settings_schema_unref (schema);
}
if (g_settings_schema_has_key (schema, translations[i].key))
translations[i].valid = TRUE;
g_settings_schema_unref (schema);
}
update_xft_settings (screen);
@@ -554,7 +560,7 @@ set_value_from_entry (GdkScreen *screen,
switch (entry->type)
{
case G_TYPE_STRING:
if (settings)
if (settings && entry->valid)
{
gchar *s;
s = g_settings_get_string (settings, entry->key);
@@ -567,12 +573,12 @@ set_value_from_entry (GdkScreen *screen,
}
break;
case G_TYPE_INT:
g_value_set_int (value, settings != NULL
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 != NULL
g_value_set_boolean (value, settings && entry->valid
? g_settings_get_boolean (settings, entry->key)
: entry->fallback.b);
break;

View File

@@ -53,6 +53,9 @@ GDK_AVAILABLE_IN_3_10
void gdk_wayland_display_set_cursor_theme (GdkDisplay *display,
const gchar *theme,
gint size);
GDK_AVAILABLE_IN_3_22
void gdk_wayland_display_set_startup_notification_id (GdkDisplay *display,
const char *startup_id);
G_END_DECLS

View File

@@ -366,9 +366,11 @@ _gdk_wayland_screen_create_root_window (GdkScreen *screen,
impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
impl->wrapper = GDK_WINDOW (window);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if (display_wayland->compositor_version >= WL_SURFACE_HAS_BUFFER_SCALE &&
gdk_screen_get_n_monitors (screen) > 0)
impl->scale = gdk_screen_get_monitor_scale_factor (screen, 0);
G_GNUC_END_IGNORE_DEPRECATIONS
/* logical 1x1 fake buffer */
impl->staging_cairo_surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
@@ -687,9 +689,11 @@ _gdk_wayland_display_create_window_impl (GdkDisplay *display,
g_object_ref (window);
/* More likely to be right than just assuming 1 */
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if (display_wayland->compositor_version >= WL_SURFACE_HAS_BUFFER_SCALE &&
gdk_screen_get_n_monitors (screen) > 0)
impl->scale = gdk_screen_get_monitor_scale_factor (screen, 0);
G_GNUC_END_IGNORE_DEPRECATIONS
impl->title = NULL;
@@ -900,7 +904,9 @@ gdk_window_impl_wayland_end_paint (GdkWindow *window)
cairo_rectangle_int_t rect;
int i, n;
if (!window->current_paint.use_gl &&
if (impl->staging_cairo_surface &&
_gdk_wayland_is_shm_surface (impl->staging_cairo_surface) &&
!window->current_paint.use_gl &&
!cairo_region_is_empty (window->current_paint.region))
{
gdk_wayland_window_attach_image (window);
@@ -1008,13 +1014,30 @@ gdk_wayland_window_maybe_configure (GdkWindow *window,
int scale)
{
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
gboolean is_xdg_popup;
gboolean is_visible;
if (window->width == width &&
window->height == height &&
impl->scale == scale)
return;
/* For xdg_popup using an xdg_positioner, there is a race condition if
* the application tries to change the size after it's mapped, but before
* the initial configure is received, so hide and show the surface again
* force the new size onto the compositor. See bug #772505.
*/
is_xdg_popup = (impl->display_server.xdg_popup != NULL);
is_visible = gdk_window_is_visible (window);
if (is_xdg_popup && is_visible && !impl->initial_configure_received)
gdk_window_hide (window);
gdk_wayland_window_configure (window, width, height, scale);
if (is_xdg_popup && is_visible && !impl->initial_configure_received)
gdk_window_show (window);
}
static void
@@ -1200,6 +1223,31 @@ gdk_wayland_window_sync_input_region (GdkWindow *window)
impl->input_region_dirty = FALSE;
}
static void
gdk_wayland_set_input_region_if_empty (GdkWindow *window)
{
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
GdkWaylandDisplay *display;
struct wl_region *empty;
if (!impl->input_region_dirty)
return;
if (impl->input_region == NULL)
return;
if (!cairo_region_is_empty (impl->input_region))
return;
display = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
empty = wl_compositor_create_region (display->compositor);
wl_surface_set_input_region (impl->display_server.wl_surface, empty);
wl_region_destroy (empty);
impl->input_region_dirty = FALSE;
}
static void
surface_enter (void *data,
struct wl_surface *wl_surface,
@@ -1229,7 +1277,8 @@ surface_leave (void *data,
impl->display_server.outputs = g_slist_remove (impl->display_server.outputs, output);
window_update_scale (window);
if (impl->display_server.outputs)
window_update_scale (window);
}
static const struct wl_surface_listener surface_listener = {
@@ -1248,6 +1297,9 @@ on_parent_surface_committed (GdkWindowImplWayland *parent_impl,
impl->parent_surface_committed_handler = 0;
wl_subsurface_set_desync (impl->display_server.wl_subsurface);
/* Special case if the input region is empty, it won't change on resize */
gdk_wayland_set_input_region_if_empty (window);
}
static void
@@ -1273,7 +1325,9 @@ 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->y);
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,9 +1504,11 @@ gdk_wayland_window_create_xdg_toplevel (GdkWindow *window)
const gchar *app_id;
GdkScreen *screen = gdk_window_get_screen (window);
struct wl_output *fullscreen_output = NULL;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if (impl->initial_fullscreen_monitor >= 0 &&
impl->initial_fullscreen_monitor < gdk_screen_get_n_monitors (screen))
fullscreen_output = _gdk_wayland_screen_get_wl_output (screen, impl->initial_fullscreen_monitor);
G_GNUC_END_IGNORE_DEPRECATIONS
impl->display_server.xdg_surface =
zxdg_shell_v6_get_xdg_surface (display_wayland->xdg_shell,
@@ -1617,13 +1673,25 @@ get_real_parent_and_translate (GdkWindow *window,
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
GdkWindow *parent = impl->transient_for;
while (parent &&
!gdk_window_has_native (parent) &&
gdk_window_get_effective_parent (parent))
while (parent)
{
GdkWindowImplWayland *parent_impl =
GDK_WINDOW_IMPL_WAYLAND (parent->impl);
GdkWindow *effective_parent = gdk_window_get_effective_parent (parent);
if ((gdk_window_has_native (parent) &&
!parent_impl->display_server.wl_subsurface) ||
!effective_parent)
break;
*x += parent->x;
*y += parent->y;
parent = gdk_window_get_effective_parent (parent);
if (gdk_window_has_native (parent) &&
parent_impl->display_server.wl_subsurface)
parent = parent->transient_for;
else
parent = effective_parent;
}
return parent;
@@ -2072,9 +2140,12 @@ gdk_wayland_window_create_xdg_popup (GdkWindow *window,
zxdg_positioner_v6_destroy (positioner);
gdk_seat = gdk_display_get_default_seat (GDK_DISPLAY (display));
serial = _gdk_wayland_seat_get_last_implicit_grab_serial (gdk_seat, NULL);
zxdg_popup_v6_grab (impl->display_server.xdg_popup, seat, serial);
if (seat)
{
gdk_seat = gdk_display_get_default_seat (GDK_DISPLAY (display));
serial = _gdk_wayland_seat_get_last_implicit_grab_serial (gdk_seat, NULL);
zxdg_popup_v6_grab (impl->display_server.xdg_popup, seat, serial);
}
wl_surface_commit (impl->display_server.wl_surface);
@@ -2123,18 +2194,6 @@ find_grab_input_seat (GdkWindow *window, GdkWindow *transient_for)
return NULL;
}
static struct wl_seat *
find_default_input_seat (GdkWindow *window)
{
GdkDisplay *display;
GdkSeat *seat;
display = gdk_window_get_display (window);
seat = gdk_display_get_default_seat (display);
return gdk_wayland_seat_get_wl_seat (seat);
}
static gboolean
should_be_mapped (GdkWindow *window)
{
@@ -2330,16 +2389,6 @@ gdk_wayland_window_map (GdkWindow *window)
else
{
grab_input_seat = find_grab_input_seat (window, transient_for);
if (!grab_input_seat)
{
g_warning ("No grabbed seat found, using the default one in "
"order to map popup window %p. You may find oddities "
"ahead, gdk_seat_grab() should be used to "
"simultaneously grab input and show this popup",
window);
grab_input_seat = find_default_input_seat (window);
}
}
if (!create_fallback)
@@ -2496,6 +2545,7 @@ gdk_wayland_window_hide_surface (GdkWindow *window)
{
gtk_surface1_destroy (impl->display_server.gtk_surface);
impl->display_server.gtk_surface = NULL;
impl->application.was_set = FALSE;
}
wl_surface_destroy (impl->display_server.wl_surface);
@@ -2621,7 +2671,9 @@ gdk_window_wayland_move_resize (GdkWindow *window,
if (impl->display_server.wl_subsurface)
{
wl_subsurface_set_position (impl->display_server.wl_subsurface, x, 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);
}
}
@@ -2634,6 +2686,20 @@ gdk_window_wayland_move_resize (GdkWindow *window,
gdk_wayland_window_maybe_configure (window, width, height, impl->scale);
}
/* Avoid zero width/height as this is a protocol error */
static void
sanitize_anchor_rect (GdkWindow *window,
GdkRectangle *rect)
{
gint original_width = rect->width;
gint original_height = rect->height;
rect->width = MAX (1, rect->width);
rect->height = MAX (1, rect->height);
rect->x = MAX (rect->x + original_width - rect->width, 0);
rect->y = MAX (rect->y + original_height - rect->height, 0);
}
static void
gdk_window_wayland_move_to_rect (GdkWindow *window,
const GdkRectangle *rect,
@@ -2646,6 +2712,8 @@ gdk_window_wayland_move_to_rect (GdkWindow *window,
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
impl->pending_move_to_rect.rect = *rect;
sanitize_anchor_rect (window, &impl->pending_move_to_rect.rect);
impl->pending_move_to_rect.rect_anchor = rect_anchor;
impl->pending_move_to_rect.window_anchor = window_anchor;
impl->pending_move_to_rect.anchor_hints = anchor_hints;

View File

@@ -111,25 +111,27 @@ gdk_device_win32_query_state (GdkDevice *device,
GdkScreen *screen;
POINT point;
HWND hwnd, hwndc;
GdkWindowImplWin32 *impl;
screen = gdk_window_get_screen (window);
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
hwnd = GDK_WINDOW_HWND (window);
GetCursorPos (&point);
if (root_x)
*root_x = point.x;
*root_x = point.x / impl->window_scale;
if (root_y)
*root_y = point.y;
*root_y = point.y / impl->window_scale;
ScreenToClient (hwnd, &point);
if (win_x)
*win_x = point.x;
*win_x = point.x / impl->window_scale;
if (win_y)
*win_y = point.y;
*win_y = point.y / impl->window_scale;
if (window == gdk_screen_get_root_window (screen))
{
@@ -197,6 +199,7 @@ _gdk_device_win32_window_at_position (GdkDevice *device,
gboolean get_toplevel)
{
GdkWindow *window = NULL;
GdkWindowImplWin32 *impl = NULL;
POINT screen_pt, client_pt;
HWND hwnd, hwndc;
RECT rect;
@@ -249,12 +252,15 @@ _gdk_device_win32_window_at_position (GdkDevice *device,
/* If we didn't hit any window at that point, return the desktop */
if (hwnd == NULL)
{
if (win_x)
*win_x = screen_pt.x + _gdk_offset_x;
if (win_y)
*win_y = screen_pt.y + _gdk_offset_y;
window = gdk_get_default_root_window ();
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
return gdk_get_default_root_window ();
if (win_x)
*win_x = (screen_pt.x + _gdk_offset_x) / impl->window_scale;
if (win_y)
*win_y = (screen_pt.y + _gdk_offset_y) / impl->window_scale;
return window;
}
window = gdk_win32_handle_table_lookup (hwnd);
@@ -262,10 +268,12 @@ _gdk_device_win32_window_at_position (GdkDevice *device,
if (window && (win_x || win_y))
{
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
if (win_x)
*win_x = client_pt.x;
*win_x = client_pt.x / impl->window_scale;
if (win_y)
*win_y = client_pt.y;
*win_y = client_pt.y / impl->window_scale;
}
return window;

View File

@@ -121,26 +121,28 @@ gdk_device_wintab_query_state (GdkDevice *device,
GdkScreen *screen;
POINT point;
HWND hwnd, hwndc;
GdkWindowImplWin32 *impl;
device_wintab = GDK_DEVICE_WINTAB (device);
screen = gdk_window_get_screen (window);
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
hwnd = GDK_WINDOW_HWND (window);
GetCursorPos (&point);
if (root_x)
*root_x = point.x;
*root_x = point.x / impl->window_scale;
if (root_y)
*root_y = point.y;
*root_y = point.y / impl->window_scale;
ScreenToClient (hwnd, &point);
if (win_x)
*win_x = point.x;
*win_x = point.x / impl->window_scale;
if (win_y)
*win_y = point.y;
*win_y = point.y / impl->window_scale;
if (window == gdk_get_default_root_window ())
{

View File

@@ -66,6 +66,8 @@ static t_WTOverlap p_WTOverlap;
static t_WTPacket p_WTPacket;
static t_WTQueueSizeSet p_WTQueueSizeSet;
static gboolean default_display_opened = FALSE;
G_DEFINE_TYPE (GdkDeviceManagerWin32, gdk_device_manager_win32, GDK_TYPE_DEVICE_MANAGER)
static GdkDevice *
@@ -625,17 +627,12 @@ wintab_init_check (GdkDeviceManagerWin32 *device_manager)
num_axes++;
}
/* The wintab driver for the Wacom ArtPad II reports
* PK_ORIENTATION in CSR_PKTDATA, but the tablet doesn't
* actually sense tilt. Catch this by noticing that the
* orientation axis's azimuth resolution is zero.
*/
if ((device->pktdata & PK_ORIENTATION) && axis_or[0].axResolution == 0)
if (device->pktdata & PK_ORIENTATION)
{
device->orientation_axes[0] = axis_or[0];
device->orientation_axes[1] = axis_or[1];
/* Wintab gives us aximuth and altitude, which
/* Wintab gives us azimuth and altitude, which
* we convert to x and y tilt in the -1000..1000 range
*/
_gdk_device_add_axis (GDK_DEVICE (device),
@@ -680,11 +677,42 @@ wintab_init_check (GdkDeviceManagerWin32 *device_manager)
}
}
/* Only initialize Wintab after the default display is set for
* the first time. WTOpenA() executes code beyond our control,
* and it can cause messages to be sent to the application even
* before a window is opened. GDK has to be in a fit state to
* handle them when they come.
*
* https://bugzilla.gnome.org/show_bug.cgi?id=774379
*/
static void
wintab_default_display_notify_cb (GdkDisplayManager *display_manager)
{
GdkDeviceManagerWin32 *device_manager = NULL;
GdkDisplay *display = gdk_display_get_default();
if (default_display_opened)
return;
g_assert (display != NULL);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
device_manager = GDK_DEVICE_MANAGER_WIN32 (gdk_display_get_device_manager (display));
G_GNUC_END_IGNORE_DEPRECATIONS;
g_assert (display_manager != NULL);
default_display_opened = TRUE;
GDK_NOTE (INPUT, g_print ("wintab init: doing delayed initialization\n"));
wintab_init_check (device_manager);
}
static void
gdk_device_manager_win32_constructed (GObject *object)
{
GdkDeviceManagerWin32 *device_manager;
GdkSeat *seat;
GdkDisplayManager *display_manager = NULL;
GdkDisplay *default_display = NULL;
device_manager = GDK_DEVICE_MANAGER_WIN32 (object);
device_manager->core_pointer =
@@ -727,7 +755,18 @@ gdk_device_manager_win32_constructed (GObject *object)
gdk_seat_default_add_slave (GDK_SEAT_DEFAULT (seat), device_manager->system_keyboard);
g_object_unref (seat);
wintab_init_check (device_manager);
/* Only call Wintab init stuff after the default display
* is globally known and accessible through the display manager
* singleton. Approach lifted from gtkmodules.c.
*/
display_manager = gdk_display_manager_get();
g_assert (display_manager != NULL);
default_display = gdk_display_manager_get_default_display (display_manager);
g_assert (default_display == NULL);
g_signal_connect (display_manager, "notify::default-display",
G_CALLBACK (wintab_default_display_notify_cb),
NULL);
}
static GList *
@@ -817,11 +856,34 @@ decode_tilt (gint *axis_data,
{
double az, el;
/* As I don't have a tilt-sensing tablet,
* I cannot test this code.
g_return_if_fail (axis_data != NULL);
/* The wintab driver for the Wacom ArtPad II reports
* PK_ORIENTATION in CSR_PKTDATA, but the tablet doesn't
* actually sense tilt. Catch this by noticing that the
* orientation axis's azimuth resolution is zero.
*
* The same is true of the Huion H610PRO, but in this case
* it's the altitude resolution that's zero. GdkEvents with
* sensible tilts will need both, so only add the GDK tilt axes
* if both wintab axes are going to be well-behaved in use.
*/
if ((axes == NULL) ||
(axes[0].axResolution == 0) ||
(axes[1].axResolution == 0))
{
axis_data[0] = 0;
axis_data[1] = 0;
return;
}
/*
* Tested with a Wacom Intuos 5 touch M (PTH-650) + Wacom drivers 6.3.18-5.
* Wintab's reference angle leads gdk's by 90 degrees.
*/
az = TWOPI * packet->pkOrientation.orAzimuth /
(axes[0].axResolution / 65536.);
az -= G_PI / 2;
el = TWOPI * packet->pkOrientation.orAltitude /
(axes[1].axResolution / 65536.);
@@ -864,10 +926,9 @@ gdk_device_manager_find_wintab_device (GdkDeviceManagerWin32 *device_manager,
GdkDeviceWintab *device;
GList *tmp_list;
for (tmp_list = device_manager->wintab_devices; tmp_list; tmp_list = tmp_list->next)
for (tmp_list = device_manager->wintab_devices; tmp_list != NULL; tmp_list = tmp_list->next)
{
device = tmp_list->data;
tmp_list = tmp_list->next;
if (device->hctx == hctx &&
device->cursor == cursor)
@@ -889,6 +950,7 @@ gdk_input_other_event (GdkDisplay *display,
GdkEventMask masktest;
guint key_state;
POINT pt;
GdkWindowImplWin32 *impl;
PACKET packet;
gint root_x, root_y;
@@ -928,6 +990,54 @@ G_GNUC_END_IGNORE_DEPRECATIONS;
switch (msg->message)
{
case WT_PACKET:
source_device = gdk_device_manager_find_wintab_device (device_manager,
(HCTX) msg->lParam,
packet.pkCursor);
/* Check this first, as we get WT_PROXIMITY for disabled devices too */
if (device_manager->dev_entered_proximity > 0)
{
/* This is the same code as in WT_CSRCHANGE. Some drivers send
* WT_CSRCHANGE after each WT_PROXIMITY with LOWORD(lParam) != 0,
* this code is for those that don't.
*/
device_manager->dev_entered_proximity -= 1;
if (source_device != NULL &&
source_device->sends_core &&
gdk_device_get_mode (GDK_DEVICE (source_device)) != GDK_MODE_DISABLED)
{
_gdk_device_virtual_set_active (device_manager->core_pointer,
GDK_DEVICE (source_device));
_gdk_input_ignore_core += 1;
}
}
else if (source_device != NULL &&
source_device->sends_core &&
gdk_device_get_mode (GDK_DEVICE (source_device)) != GDK_MODE_DISABLED &&
_gdk_input_ignore_core == 0)
{
/* A fallback for cases when two devices (disabled and enabled)
* were in proximity simultaneously.
* In this case the removal of a disabled device would also
* make the system pointer active, as we don't know which
* device was removed and assume it was the enabled one.
* If we are still getting packets for the enabled device,
* it means that the device that was removed was the disabled
* device, so we must make the enabled device active again and
* start ignoring the core pointer events. In practice this means that
* removing a disabled device while an enabled device is still
* in proximity might briefly make the core pointer active/visible.
*/
_gdk_device_virtual_set_active (device_manager->core_pointer,
GDK_DEVICE (source_device));
_gdk_input_ignore_core += 1;
}
if (source_device == NULL ||
gdk_device_get_mode (GDK_DEVICE (source_device)) == GDK_MODE_DISABLED)
return FALSE;
/* Don't produce any button or motion events while a window is being
* moved or resized, see bug #151090.
*/
@@ -937,14 +1047,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS;
return FALSE;
}
if ((source_device = gdk_device_manager_find_wintab_device (device_manager,
(HCTX) msg->lParam,
packet.pkCursor)) == NULL)
return FALSE;
if (gdk_device_get_mode (GDK_DEVICE (source_device)) == GDK_MODE_DISABLED)
return FALSE;
last_grab = _gdk_display_get_last_device_grab (display, GDK_DEVICE (source_device));
if (last_grab && last_grab->window)
@@ -1034,15 +1136,17 @@ G_GNUC_END_IGNORE_DEPRECATIONS;
if (window->parent == gdk_get_default_root_window () || window->parent == NULL)
return FALSE;
pt.x = x;
pt.y = y;
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
pt.x = x * impl->window_scale;
pt.y = y * impl->window_scale;
ClientToScreen (GDK_WINDOW_HWND (window), &pt);
g_object_unref (window);
window = window->parent;
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
g_object_ref (window);
ScreenToClient (GDK_WINDOW_HWND (window), &pt);
x = pt.x;
y = pt.y;
x = pt.x / impl->window_scale;
y = pt.y / impl->window_scale;
GDK_NOTE (EVENTS_OR_INPUT, g_print ("... propagating to %p %+d%+d\n",
GDK_WINDOW_HWND (window), x, y));
}
@@ -1116,18 +1220,20 @@ G_GNUC_END_IGNORE_DEPRECATIONS;
return TRUE;
case WT_CSRCHANGE:
if (device_manager->dev_entered_proximity > 0)
device_manager->dev_entered_proximity -= 1;
if ((source_device = gdk_device_manager_find_wintab_device (device_manager,
(HCTX) msg->lParam,
packet.pkCursor)) == NULL)
return FALSE;
(HCTX) msg->lParam,
packet.pkCursor)) == NULL)
return FALSE;
if (gdk_device_get_mode (GDK_DEVICE (source_device)) == GDK_MODE_DISABLED)
return FALSE;
if (source_device->sends_core)
if (source_device->sends_core &&
gdk_device_get_mode (GDK_DEVICE (source_device)) != GDK_MODE_DISABLED)
{
_gdk_device_virtual_set_active (device_manager->core_pointer, GDK_DEVICE (source_device));
_gdk_input_ignore_core = TRUE;
_gdk_device_virtual_set_active (device_manager->core_pointer,
GDK_DEVICE (source_device));
_gdk_input_ignore_core += 1;
}
return FALSE;
@@ -1135,10 +1241,19 @@ G_GNUC_END_IGNORE_DEPRECATIONS;
case WT_PROXIMITY:
if (LOWORD (msg->lParam) == 0)
{
_gdk_input_ignore_core = FALSE;
_gdk_device_virtual_set_active (device_manager->core_pointer,
device_manager->system_pointer);
}
if (_gdk_input_ignore_core > 0)
{
_gdk_input_ignore_core -= 1;
if (_gdk_input_ignore_core == 0)
_gdk_device_virtual_set_active (device_manager->core_pointer,
device_manager->system_pointer);
}
}
else
{
device_manager->dev_entered_proximity += 1;
}
return FALSE;
}

View File

@@ -42,6 +42,12 @@ struct _GdkDeviceManagerWin32
GdkDevice *system_pointer;
GdkDevice *system_keyboard;
GList *wintab_devices;
/* Bumped up every time a wintab device enters the proximity
* of our context (WT_PROXIMITY). Bumped down when we either
* receive a WT_PACKET, or a WT_CSRCHANGE.
*/
gint dev_entered_proximity;
};
struct _GdkDeviceManagerWin32Class

View File

@@ -17,6 +17,9 @@
*/
#include "config.h"
#define _WIN32_WINNT 0x0600
#include "gdk.h"
#include "gdkprivate-win32.h"
#include "gdkdisplay-win32.h"
@@ -192,7 +195,6 @@ _gdk_win32_display_init_monitors (GdkWin32Display *win32_display)
g_ptr_array_insert (win32_display->monitors, 0, primary_to_move);
changed = TRUE;
}
return changed;
}
@@ -402,7 +404,7 @@ _gdk_win32_display_open (const gchar *display_name)
_gdk_events_init (_gdk_display);
_gdk_input_ignore_core = FALSE;
_gdk_input_ignore_core = 0;
_gdk_display->device_manager = g_object_new (GDK_TYPE_DEVICE_MANAGER_WIN32,
"display", _gdk_display,
@@ -793,6 +795,15 @@ gdk_win32_display_dispose (GObject *object)
_hwnd_next_viewer = NULL;
}
if (display_win32->have_at_least_win81)
{
if (display_win32->shcore_funcs.hshcore != NULL)
{
FreeLibrary (display_win32->shcore_funcs.hshcore);
display_win32->shcore_funcs.hshcore = NULL;
}
}
G_OBJECT_CLASS (gdk_win32_display_parent_class)->dispose (object);
}
@@ -809,10 +820,209 @@ gdk_win32_display_finalize (GObject *object)
G_OBJECT_CLASS (gdk_win32_display_parent_class)->finalize (object);
}
static void
_gdk_win32_enable_hidpi (GdkWin32Display *display)
{
gboolean check_for_dpi_awareness = FALSE;
gboolean have_hpi_disable_envvar = FALSE;
enum dpi_aware_status {
DPI_STATUS_PENDING,
DPI_STATUS_SUCCESS,
DPI_STATUS_DISABLED,
DPI_STATUS_FAILED
} status = DPI_STATUS_PENDING;
if (g_win32_check_windows_version (6, 3, 0, G_WIN32_OS_ANY))
{
/* If we are on Windows 8.1 or later, cache up functions from shcore.dll, by all means */
display->have_at_least_win81 = TRUE;
display->shcore_funcs.hshcore = LoadLibraryW (L"shcore.dll");
if (display->shcore_funcs.hshcore != NULL)
{
display->shcore_funcs.setDpiAwareFunc =
(funcSetProcessDpiAwareness) GetProcAddress (display->shcore_funcs.hshcore,
"SetProcessDpiAwareness");
display->shcore_funcs.getDpiAwareFunc =
(funcGetProcessDpiAwareness) GetProcAddress (display->shcore_funcs.hshcore,
"GetProcessDpiAwareness");
display->shcore_funcs.getDpiForMonitorFunc =
(funcGetDpiForMonitor) GetProcAddress (display->shcore_funcs.hshcore,
"GetDpiForMonitor");
}
}
else
{
/* Windows Vista through 8: use functions from user32.dll directly */
HMODULE user32;
display->have_at_least_win81 = FALSE;
user32 = GetModuleHandleW (L"user32.dll");
if (user32 != NULL)
{
display->user32_dpi_funcs.setDpiAwareFunc =
(funcSetProcessDPIAware) GetProcAddress (user32, "SetProcessDPIAware");
display->user32_dpi_funcs.isDpiAwareFunc =
(funcIsProcessDPIAware) GetProcAddress (user32, "IsProcessDPIAware");
}
}
if (g_getenv ("GDK_WIN32_DISABLE_HIDPI") == NULL)
{
/* For Windows 8.1 and later, use SetProcessDPIAwareness() */
if (display->have_at_least_win81)
{
/* then make the GDK-using app DPI-aware */
if (display->shcore_funcs.setDpiAwareFunc != NULL)
{
switch (display->shcore_funcs.setDpiAwareFunc (PROCESS_SYSTEM_DPI_AWARE))
{
case S_OK:
display->dpi_aware_type = PROCESS_SYSTEM_DPI_AWARE;
status = DPI_STATUS_SUCCESS;
break;
case E_ACCESSDENIED:
/* This means the app used a manifest to set DPI awareness, or a
DPI compatibility setting is used.
The manifest is the trump card in this game of bridge here. The
same applies if one uses the control panel or program properties to
force system DPI awareness */
check_for_dpi_awareness = TRUE;
break;
default:
display->dpi_aware_type = PROCESS_DPI_UNAWARE;
status = DPI_STATUS_FAILED;
break;
}
}
else
{
check_for_dpi_awareness = TRUE;
}
}
else
{
/* For Windows Vista through 8, use SetProcessDPIAware() */
display->have_at_least_win81 = FALSE;
if (display->user32_dpi_funcs.setDpiAwareFunc != NULL)
{
if (display->user32_dpi_funcs.setDpiAwareFunc () != 0)
{
display->dpi_aware_type = PROCESS_SYSTEM_DPI_AWARE;
status = DPI_STATUS_SUCCESS;
}
else
{
check_for_dpi_awareness = TRUE;
}
}
else
{
display->dpi_aware_type = PROCESS_DPI_UNAWARE;
status = DPI_STATUS_FAILED;
}
}
}
else
{
/* if GDK_WIN32_DISABLE_HIDPI is set, check for any DPI
* awareness settings done via manifests or user settings
*/
check_for_dpi_awareness = TRUE;
have_hpi_disable_envvar = TRUE;
}
if (check_for_dpi_awareness)
{
if (display->have_at_least_win81)
{
if (display->shcore_funcs.getDpiAwareFunc != NULL)
{
display->shcore_funcs.getDpiAwareFunc (NULL, &display->dpi_aware_type);
if (display->dpi_aware_type != PROCESS_DPI_UNAWARE)
status = DPI_STATUS_SUCCESS;
else
/* This means the DPI awareness setting was forcefully disabled */
status = DPI_STATUS_DISABLED;
}
else
{
display->dpi_aware_type = PROCESS_DPI_UNAWARE;
status = DPI_STATUS_FAILED;
}
}
else
{
if (display->user32_dpi_funcs.isDpiAwareFunc != NULL)
{
/* This most probably means DPI awareness is set through
the manifest, or a DPI compatibility setting is used. */
display->dpi_aware_type = display->user32_dpi_funcs.isDpiAwareFunc () ?
PROCESS_SYSTEM_DPI_AWARE :
PROCESS_DPI_UNAWARE;
if (display->dpi_aware_type == PROCESS_SYSTEM_DPI_AWARE)
status = DPI_STATUS_SUCCESS;
else
status = DPI_STATUS_DISABLED;
}
else
{
display->dpi_aware_type = PROCESS_DPI_UNAWARE;
status = DPI_STATUS_FAILED;
}
}
if (have_hpi_disable_envvar &&
status == DPI_STATUS_SUCCESS)
{
/* The user setting or application manifest trumps over GDK_WIN32_DISABLE_HIDPI */
g_print ("Note: GDK_WIN32_DISABLE_HIDPI is ignored due to preset\n"
" DPI awareness settings in user settings or application\n"
" manifest, DPI awareness is still enabled.");
}
}
switch (status)
{
case DPI_STATUS_SUCCESS:
GDK_NOTE (MISC, g_message ("HiDPI support enabled, type: %s",
display->dpi_aware_type == PROCESS_PER_MONITOR_DPI_AWARE ? "per-monitor" : "system"));
break;
case DPI_STATUS_DISABLED:
GDK_NOTE (MISC, g_message ("HiDPI support disabled via manifest"));
break;
case DPI_STATUS_FAILED:
g_warning ("Failed to enable HiDPI support.");
}
}
static void
gdk_win32_display_init (GdkWin32Display *display)
{
const gchar *scale_str = g_getenv ("GDK_SCALE");
display->monitors = g_ptr_array_new_with_free_func (g_object_unref);
_gdk_win32_enable_hidpi (display);
/* if we have DPI awareness, set up fixed scale if set */
if (display->dpi_aware_type != PROCESS_DPI_UNAWARE &&
scale_str != NULL)
{
display->window_scale = atol (scale_str);
if (display->window_scale == 0)
display->window_scale = 1;
display->has_fixed_scale = TRUE;
}
else
display->window_scale = 1;
_gdk_win32_display_init_cursors (display);
}
@@ -862,10 +1072,10 @@ gdk_win32_display_get_monitor (GdkDisplay *display,
{
GdkWin32Display *win32_display = GDK_WIN32_DISPLAY (display);
if (0 <= monitor_num || monitor_num < win32_display->monitors->len)
return (GdkMonitor *) g_ptr_array_index (win32_display->monitors, monitor_num);
if (monitor_num < 0 || monitor_num >= win32_display->monitors->len)
return NULL;
return NULL;
return (GdkMonitor *) g_ptr_array_index (win32_display->monitors, monitor_num);
}
static GdkMonitor *
@@ -880,6 +1090,89 @@ gdk_win32_display_get_primary_monitor (GdkDisplay *display)
return NULL;
}
guint
_gdk_win32_display_get_monitor_scale_factor (GdkWin32Display *win32_display,
HMONITOR hmonitor,
HWND hwnd,
gint *dpi)
{
gboolean is_scale_acquired = FALSE;
gboolean use_dpi_for_monitor = FALSE;
guint dpix, dpiy;
if (win32_display->have_at_least_win81)
{
if (hmonitor != NULL)
use_dpi_for_monitor = TRUE;
else
{
if (hwnd != NULL)
{
hmonitor = MonitorFromWindow (hwnd, MONITOR_DEFAULTTONEAREST);
use_dpi_for_monitor = TRUE;
}
}
}
if (use_dpi_for_monitor)
{
/* Use GetDpiForMonitor() for Windows 8.1+, when we have a HMONITOR */
if (win32_display->shcore_funcs.hshcore != NULL &&
win32_display->shcore_funcs.getDpiForMonitorFunc != NULL)
{
if (win32_display->shcore_funcs.getDpiForMonitorFunc (hmonitor,
MDT_EFFECTIVE_DPI,
&dpix,
&dpiy) == S_OK)
{
is_scale_acquired = TRUE;
}
}
}
else
{
/* Go back to GetDeviceCaps() for Windows 8 and earler, or when we don't
* have a HMONITOR nor a HWND
*/
HDC hdc = GetDC (hwnd);
/* in case we can't get the DC for the window, return 1 for the scale */
if (hdc == NULL)
{
if (dpi != NULL)
*dpi = USER_DEFAULT_SCREEN_DPI;
return 1;
}
dpix = GetDeviceCaps (hdc, LOGPIXELSX);
dpiy = GetDeviceCaps (hdc, LOGPIXELSY);
ReleaseDC (hwnd, hdc);
is_scale_acquired = TRUE;
}
if (is_scale_acquired)
/* USER_DEFAULT_SCREEN_DPI = 96, in winuser.h */
{
if (dpi != NULL)
*dpi = dpix;
if (win32_display->has_fixed_scale)
return win32_display->window_scale;
else
return dpix / USER_DEFAULT_SCREEN_DPI > 1 ? dpix / USER_DEFAULT_SCREEN_DPI : 1;
}
else
{
if (dpi != NULL)
*dpi = USER_DEFAULT_SCREEN_DPI;
return 1;
}
}
static void
gdk_win32_display_class_init (GdkWin32DisplayClass *klass)
{

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