Compare commits
412 Commits
matthiasc/
...
osx-monito
Author | SHA1 | Date | |
---|---|---|---|
|
9159e70473 | ||
|
6a02bd4fa9 | ||
|
9caa50ca0d | ||
|
b4df881542 | ||
|
e387f807e4 | ||
|
504321019e | ||
|
4a8ad03e10 | ||
|
112437f5ad | ||
|
2fdcdfa403 | ||
|
c00448f7c6 | ||
|
5bdc85d34e | ||
|
5f24d87a5b | ||
|
ec30a03153 | ||
|
685493075f | ||
|
39d5f22774 | ||
|
9f1916f29e | ||
|
5059348d9f | ||
|
4bec5432ce | ||
|
0349574b47 | ||
|
77f01c374b | ||
|
e63d4111a4 | ||
|
41d3f99e44 | ||
|
629c931f1f | ||
|
7160e3a12f | ||
|
31832f8648 | ||
|
06cf2c84a4 | ||
|
e4bbb5bb0b | ||
|
d65851f7db | ||
|
7dcb94579a | ||
|
de9a399eaa | ||
|
a6432cc6d0 | ||
|
ff779af97f | ||
|
76d7c0bbed | ||
|
02b5886975 | ||
|
0bada2506e | ||
|
17da1e9f35 | ||
|
d6166921a8 | ||
|
f7479bf369 | ||
|
1880cf48ad | ||
|
e44e7ba0df | ||
|
ec8192420e | ||
|
4b38a39c9d | ||
|
76af1904db | ||
|
cf1e2b9042 | ||
|
36e1761c84 | ||
|
313ae3ad01 | ||
|
ecdd353266 | ||
|
fb53855fc8 | ||
|
fc81dc17d4 | ||
|
8817c1ad6d | ||
|
6f3d1e1046 | ||
|
45d33b063f | ||
|
7949069b9d | ||
|
a497938358 | ||
|
953abc19da | ||
|
60e7e15f54 | ||
|
aebe3a74ec | ||
|
75e98fd252 | ||
|
c391417838 | ||
|
ce1b2bef2b | ||
|
20ee36f9e0 | ||
|
bd4f861727 | ||
|
a9c70c4fe6 | ||
|
4146d7f3cc | ||
|
7c09153d20 | ||
|
e2666ba96d | ||
|
c676d4268e | ||
|
6259794709 | ||
|
a6c925e836 | ||
|
8d3102e1a9 | ||
|
375a68fc6b | ||
|
29f2da5587 | ||
|
68188fc948 | ||
|
c3a2e0035c | ||
|
85f2c5f830 | ||
|
06f7728631 | ||
|
e5b6375914 | ||
|
03429df872 | ||
|
00b8b18795 | ||
|
188929e2ea | ||
|
555847d44f | ||
|
4e61aaa0a4 | ||
|
13f781d99d | ||
|
42108a82c7 | ||
|
2e4fb45435 | ||
|
f3b3acfe53 | ||
|
4f7e9bf25f | ||
|
22ca110a60 | ||
|
cc0e6eb374 | ||
|
fbd876fe93 | ||
|
367e021652 | ||
|
3e5d5f8899 | ||
|
393e7aacc6 | ||
|
a3d70b4ab2 | ||
|
0c20604932 | ||
|
563063d66b | ||
|
0478bfd37b | ||
|
b3b2f6b5d4 | ||
|
ee6c514406 | ||
|
f9df0fc94c | ||
|
1d0fad3d70 | ||
|
11f81e77f9 | ||
|
a6ba8df4b7 | ||
|
c4874aeaa5 | ||
|
6cdeac1c6a | ||
|
a729eeab0a | ||
|
42d8b70b0e | ||
|
8aa9fb38a3 | ||
|
98c04230c3 | ||
|
26cab782cd | ||
|
d825c34ca3 | ||
|
fdc79c804a | ||
|
c6f0df26f6 | ||
|
eca35180f9 | ||
|
d93dd81e65 | ||
|
72ac208052 | ||
|
e4fbfde07b | ||
|
da0291950d | ||
|
f2febf7c71 | ||
|
c495ffb1ba | ||
|
977b26dcf5 | ||
|
f8af23553b | ||
|
104c9ac845 | ||
|
9589505e19 | ||
|
dad4aecfc0 | ||
|
dca4f1e715 | ||
|
8f01d6c5f4 | ||
|
efde7d15aa | ||
|
7ec16c5c53 | ||
|
e338b4589d | ||
|
eaf9fc60bf | ||
|
644c2d9617 | ||
|
494d8f36aa | ||
|
09b2c54d41 | ||
|
43de771574 | ||
|
d9947b671a | ||
|
14c8e25cb2 | ||
|
3708e5cc7c | ||
|
baa83e9753 | ||
|
8caaba82cc | ||
|
5d7db3246e | ||
|
a95feb4984 | ||
|
aff42686ce | ||
|
167ef42c5c | ||
|
f705d0a5fa | ||
|
7401794de6 | ||
|
4a5cd127ff | ||
|
e831bb6ce7 | ||
|
1063460db2 | ||
|
a7ff95ce73 | ||
|
bbcc3ee456 | ||
|
bd3d7b8a9a | ||
|
0f2e19c010 | ||
|
eb26b57cba | ||
|
b7cfe3c778 | ||
|
a58dd993b2 | ||
|
8377850127 | ||
|
4a6bd134bd | ||
|
ccba2eaace | ||
|
e98e6f73be | ||
|
dfe89a381f | ||
|
ac4e1625f5 | ||
|
31fee675e4 | ||
|
f4a0f2e5ca | ||
|
4f80d234bf | ||
|
33c10204e4 | ||
|
248ef2d6a0 | ||
|
41732391d8 | ||
|
5c4c3f1afd | ||
|
210d1279e5 | ||
|
0acb58b40f | ||
|
b6baa088dc | ||
|
a22e80122e | ||
|
9a5ffcd1b5 | ||
|
afd19e9433 | ||
|
21a71e94c6 | ||
|
2e7d5c08cb | ||
|
6da8cbc87e | ||
|
99abc6363a | ||
|
22b1e0b678 | ||
|
eece8a7dd2 | ||
|
ca79296061 | ||
|
cc4ea94d8b | ||
|
ab66c3d7bf | ||
|
eb57651ff7 | ||
|
c4f1545c5e | ||
|
125ef3539c | ||
|
3326fba524 | ||
|
51645b5851 | ||
|
074f391f10 | ||
|
ea4af401d7 | ||
|
8b118eb8b5 | ||
|
dd406c8062 | ||
|
a7b0af5d8d | ||
|
5bae71f896 | ||
|
bea4c0898d | ||
|
41b14fd148 | ||
|
34264667ed | ||
|
790d5960c4 | ||
|
9a2527b361 | ||
|
92f6bcdca6 | ||
|
c7096c4586 | ||
|
eceb9add1f | ||
|
e75601c058 | ||
|
7960e94112 | ||
|
d9748563c8 | ||
|
1fc3fe4a0a | ||
|
c7dce1018b | ||
|
f19ecbb850 | ||
|
a1aee4602c | ||
|
e0856226c5 | ||
|
8155c33d80 | ||
|
9679ef6b00 | ||
|
30b5187e60 | ||
|
3073419ff1 | ||
|
e779ec4b1f | ||
|
bebcb5e094 | ||
|
2b32008eeb | ||
|
78f8f236e9 | ||
|
da43bfd272 | ||
|
33e4826efd | ||
|
e04654f865 | ||
|
a8991a6bea | ||
|
5b12c21d20 | ||
|
44fb5c9c70 | ||
|
7f39c7cbf7 | ||
|
155dbaaa14 | ||
|
d55aa2a859 | ||
|
42d7f81649 | ||
|
a793f8f243 | ||
|
8952975304 | ||
|
e6d7df7233 | ||
|
35e6a8eb0d | ||
|
7fca502115 | ||
|
f50ed5b358 | ||
|
3971439a17 | ||
|
43b2b107f1 | ||
|
c70ba3a4f0 | ||
|
57a14565c6 | ||
|
197eaaacb7 | ||
|
f7fb610278 | ||
|
17ec4f10e4 | ||
|
cf4fd0d3e3 | ||
|
0b129f3534 | ||
|
f8d90378a4 | ||
|
2f940d91a0 | ||
|
ca75748223 | ||
|
5282991ab9 | ||
|
6c0cd1a16d | ||
|
605303681b | ||
|
4cd8796c0e | ||
|
cc6335d94d | ||
|
ecb38bc824 | ||
|
dd3cf38c53 | ||
|
43b9b7f4e6 | ||
|
7d695068e2 | ||
|
da9bd46aed | ||
|
6e856f6226 | ||
|
66a08bf3a6 | ||
|
dd6a00bb31 | ||
|
61a57465ea | ||
|
f40191ff19 | ||
|
aa1307a787 | ||
|
5301644a3f | ||
|
157b630d72 | ||
|
462a5df644 | ||
|
4bc2904dae | ||
|
4569bb372f | ||
|
dc184902d7 | ||
|
0b46c5b176 | ||
|
4805780016 | ||
|
042e37e6cc | ||
|
748a1450a8 | ||
|
8b334fef63 | ||
|
595ef21feb | ||
|
71b859a9ce | ||
|
504beaddb1 | ||
|
c5f6d61783 | ||
|
dbcbaac982 | ||
|
0103bbf5eb | ||
|
24f5d99be9 | ||
|
528b80a165 | ||
|
25fd5710f7 | ||
|
13ccbd0111 | ||
|
7f7501b1e7 | ||
|
9a257e1f6a | ||
|
a28022e916 | ||
|
14545342d5 | ||
|
cc0c286869 | ||
|
57f551a114 | ||
|
f70039cb96 | ||
|
c1507cf680 | ||
|
a820acee00 | ||
|
d3bdd384a1 | ||
|
27b68ff193 | ||
|
bf560369f2 | ||
|
cb53562659 | ||
|
275bbbf88d | ||
|
9e5510420c | ||
|
53474fa404 | ||
|
f8900e5ac4 | ||
|
4657e21be8 | ||
|
f9796b01ff | ||
|
04f3940488 | ||
|
255225584e | ||
|
0bccddb2ff | ||
|
75ee402c6a | ||
|
305f473f73 | ||
|
2bdfed2da2 | ||
|
dbc0337498 | ||
|
96e7fbde2e | ||
|
a68460847e | ||
|
34d45def37 | ||
|
11a4dcba77 | ||
|
99fed96b44 | ||
|
a61d7f7acf | ||
|
4add92a431 | ||
|
a64a0bc617 | ||
|
bd2d1ccc13 | ||
|
04db216026 | ||
|
03de0c3444 | ||
|
b3e3946b2f | ||
|
c5a9c0db80 | ||
|
a47a3fbd3b | ||
|
39a8a6ef72 | ||
|
dbd5fb43ab | ||
|
209e01fd91 | ||
|
29b2828c9d | ||
|
5fa8def9df | ||
|
28ce953caa | ||
|
0ad5d51d8a | ||
|
b67a1c7f39 | ||
|
45cf4c7d57 | ||
|
be1af1e01b | ||
|
eb43c3e6b6 | ||
|
dd91ac7086 | ||
|
038766a82f | ||
|
271211da8c | ||
|
c54f348edf | ||
|
94c6d19415 | ||
|
21d0de30ac | ||
|
27029a79fa | ||
|
f2bdf6e372 | ||
|
a1115c05be | ||
|
4cdd4d03cc | ||
|
ffb1ac56a8 | ||
|
e51d73afa3 | ||
|
3ad1677a3a | ||
|
2b527d6e97 | ||
|
6ee17810d1 | ||
|
803362bb5d | ||
|
d40c6f180f | ||
|
440ff48bba | ||
|
eaff061b48 | ||
|
cd495a26b7 | ||
|
a372f554eb | ||
|
72baa37452 | ||
|
796107c833 | ||
|
b109d25e8b | ||
|
0ca9b468b8 | ||
|
d3ad642519 | ||
|
61fc7ddd87 | ||
|
0d104b041a | ||
|
ebd2487df2 | ||
|
ad258bc81c | ||
|
d47d342012 | ||
|
c46c744529 | ||
|
49f2ed37cd | ||
|
424b59aec6 | ||
|
db41f815c7 | ||
|
bece404043 | ||
|
91d4879f82 | ||
|
eda51b4ef5 | ||
|
2dfaae6737 | ||
|
e75314ec17 | ||
|
f3d78aff12 | ||
|
d93f8b00ad | ||
|
b1bb8c2e85 | ||
|
38056d0f6e | ||
|
6660dc5186 | ||
|
29e586fe2e | ||
|
6f7a6f769f | ||
|
bc99feffe2 | ||
|
00cf0587a9 | ||
|
149351048e | ||
|
1e2e736d0d | ||
|
17bcd0d127 | ||
|
45528cf5b5 | ||
|
29fbeea84d | ||
|
3eb53e9e7c | ||
|
b3af460860 | ||
|
4100a848a7 | ||
|
e2f5425a1d | ||
|
12579fe71b | ||
|
dd9a9d9dcc | ||
|
0ecc4ac7de | ||
|
c41294e2be | ||
|
9af1353e6d | ||
|
f60605e758 | ||
|
e74dc54567 | ||
|
90ac584437 | ||
|
bfc6287910 | ||
|
19aa3a4fca | ||
|
0757914aba | ||
|
e11df6cca0 | ||
|
8c0738113e | ||
|
0a08a199d8 | ||
|
051fddaa61 | ||
|
154b2a124b | ||
|
1eed051c41 | ||
|
8d14c5c7cd | ||
|
17c08d062f |
230
NEWS
230
NEWS
@@ -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 doesn’t 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
|
||||
==================================
|
||||
|
||||
|
@@ -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 \
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -31,7 +31,8 @@ SUBDIRS = \
|
||||
vs10 \
|
||||
vs11 \
|
||||
vs12 \
|
||||
vs14
|
||||
vs14 \
|
||||
vs15
|
||||
|
||||
EXTRA_DIST += \
|
||||
detectenv-msvc.mak \
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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)
|
||||
|
||||
|
@@ -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" />
|
||||
|
@@ -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" />
|
||||
|
@@ -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" />
|
||||
|
@@ -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\
|
||||
|
||||
|
@@ -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 %%s in (16 22 24 32 48 256) do ((mkdir $(CopyDir)\share\icons\hicolor\%%sx%%s\apps) & (copy /b ..\..\..\demos\gtk-demo\data\%%sx%%s\gtk3-demo.png $(CopyDir)\share\icons\hicolor\%%sx%%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
|
||||
|
@@ -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>
|
||||
|
52
build/win32/vs15/Makefile.am
Normal file
52
build/win32/vs15/Makefile.am
Normal 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
|
@@ -17,7 +17,7 @@ if "$(ConfigurationName)" == "Debug_Broadway" goto DoDebug&#
|
||||
|
||||
:DoRelease

|
||||
mkdir .\Release\$(PlatformName)\bin

|
||||
copy /b $(ConfigurationName)\$(PlatformName)\bin\$(GtkDllPrefix)gdk$(GtkDllSuffix).dll .\Release\$(PlatformName)\bin\

|
||||
copy /b $(ConfigurationName)\$(PlatformName)\bin\$(GtkDllPrefix)gdk-3$(GtkDllSuffix).dll .\Release\$(PlatformName)\bin\

|
||||
copy /b $(ConfigurationName)\$(PlatformName)\bin\gdk-$(ApiVersion).lib .\Release\$(PlatformName)\bin\

|
||||
goto END

|
||||
|
||||
|
@@ -92,7 +92,9 @@ copy .\Debug\$(PlatformName)\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+-win32-3.0.pc"

|
||||
copy ..\gail-3.0.pc $(CopyDir)\lib\pkgconfig

|
||||
"
|
||||
/>
|
||||
|
14
configure.ac
14
configure.ac
@@ -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
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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
178
demos/gtk-demo/fishbowl.c
Normal 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;
|
||||
}
|
69
demos/gtk-demo/fishbowl.ui
Normal file
69
demos/gtk-demo/fishbowl.ui
Normal 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>
|
@@ -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");
|
||||
|
||||
|
@@ -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",
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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)
|
||||
{
|
||||
|
581
demos/gtk-demo/gtkfishbowl.c
Normal file
581
demos/gtk-demo/gtkfishbowl.c
Normal 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]);
|
||||
}
|
||||
|
58
demos/gtk-demo/gtkfishbowl.h
Normal file
58
demos/gtk-demo/gtkfishbowl.h
Normal 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__ */
|
@@ -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.
|
||||
*/
|
||||
|
||||
|
@@ -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
63
demos/gtk-demo/tabs.c
Normal 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;
|
||||
}
|
@@ -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">
|
||||
|
@@ -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);
|
||||
|
@@ -1,8 +1,3 @@
|
||||
.circular-button {
|
||||
border-radius: 20px;
|
||||
-gtk-outline-radius: 20px;
|
||||
}
|
||||
|
||||
.small-button {
|
||||
padding: 0;
|
||||
outline-width: 0;
|
||||
|
@@ -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">
|
||||
|
@@ -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');
|
||||
|
@@ -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>
|
||||
|
@@ -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
|
||||
|
@@ -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>
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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.
|
||||
|
@@ -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 — such as font and foreground color — 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 — such as font and
|
||||
foreground color — 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", &rgba);
|
||||
gtk_widget_override_color (view, GTK_STATE_FLAG_NORMAL, &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);
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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);
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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)
|
||||
{
|
||||
|
@@ -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",
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -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 you’re 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);
|
||||
|
||||
|
@@ -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);
|
||||
|
@@ -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__ */
|
||||
|
||||
|
@@ -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,
|
||||
|
@@ -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
|
||||
|
@@ -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 parent’s 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);
|
||||
|
@@ -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
|
||||
|
@@ -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;
|
||||
|
@@ -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);
|
||||
|
@@ -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
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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)
|
||||
{
|
||||
|
@@ -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));
|
||||
|
@@ -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
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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?
|
||||
}
|
||||
|
||||
|
@@ -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
@@ -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
|
||||
|
@@ -37,6 +37,7 @@
|
||||
|
||||
NSRect lastUnmaximizedFrame;
|
||||
NSRect lastMaximizedFrame;
|
||||
NSRect lastUnfullscreenFrame;
|
||||
BOOL inMaximizeTransition;
|
||||
}
|
||||
|
||||
|
@@ -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 \
|
||||
|
@@ -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 };
|
||||
|
||||
|
58
gdk/quartz/gdkmonitor-quartz.c
Normal file
58
gdk/quartz/gdkmonitor-quartz.c
Normal 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;
|
||||
}
|
||||
|
41
gdk/quartz/gdkmonitor-quartz.h
Normal file
41
gdk/quartz/gdkmonitor-quartz.h
Normal 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
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -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>
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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;
|
||||
|
@@ -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
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#version 130
|
||||
#version 110
|
||||
|
||||
varying vec2 vUv;
|
||||
|
||||
|
@@ -1,6 +1,4 @@
|
||||
#version 130
|
||||
|
||||
uniform sampler2D map;
|
||||
#version 110
|
||||
|
||||
attribute vec2 position;
|
||||
attribute vec2 uv;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#version 130
|
||||
#version 110
|
||||
|
||||
varying vec2 vUv;
|
||||
|
||||
|
@@ -1,6 +1,4 @@
|
||||
#version 130
|
||||
|
||||
uniform sampler2DRect map;
|
||||
#version 110
|
||||
|
||||
attribute vec2 position;
|
||||
attribute vec2 uv;
|
||||
|
@@ -1,7 +1,5 @@
|
||||
#version 150
|
||||
|
||||
uniform sampler2D map;
|
||||
|
||||
in vec2 position;
|
||||
in vec2 uv;
|
||||
|
||||
|
@@ -1,7 +1,5 @@
|
||||
#version 150
|
||||
|
||||
uniform sampler2DRect map;
|
||||
|
||||
attribute vec2 position;
|
||||
attribute vec2 uv;
|
||||
|
||||
|
@@ -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,
|
||||
|
@@ -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");
|
||||
|
@@ -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)
|
||||
|
@@ -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
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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 ())
|
||||
{
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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
|
||||
|
@@ -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
Reference in New Issue
Block a user