Compare commits
470 Commits
revert
...
lapo-overlay
| Author | SHA1 | Date | |
|---|---|---|---|
| 4c82fd5c4c | |||
| 0d63fdadfe | |||
| 3086970654 | |||
| a680631345 | |||
| f7b1ba0943 | |||
| 08d44648ea | |||
| 72a6459d73 | |||
| 5f40f58c36 | |||
| ac9ac55555 | |||
| 3013997e23 | |||
| f1fe70e4ad | |||
| 17f9eed14e | |||
| fc6f22c3ce | |||
| 96a3b23736 | |||
| 631e2f4c9b | |||
| 0555ef20a4 | |||
| 3a2bf9d878 | |||
| a703437796 | |||
| 506d59f526 | |||
| 77487fef2f | |||
| e75310a445 | |||
| f7813deb26 | |||
| e41a8cf6fc | |||
| b86356bc1c | |||
| 4d075cf202 | |||
| 8b6457732f | |||
| 1376c6b1b7 | |||
| eec161ab3f | |||
| 041ccd7f87 | |||
| e35d91d18f | |||
| 9ca9fccace | |||
| f88a5dc8c7 | |||
| f733fa88f5 | |||
| 23641e3103 | |||
| bd031b89c1 | |||
| 182dd3c1ea | |||
| a46d4e51f7 | |||
| 70c3241bd3 | |||
| 32326f826f | |||
| 4590501854 | |||
| 385e6beafe | |||
| c16fa45bfe | |||
| fea13fcfc1 | |||
| 2002613012 | |||
| a51378dda8 | |||
| 433c20e59d | |||
| e2a0780543 | |||
| a1f7c459b7 | |||
| ec8a29b0c2 | |||
| 40c129f906 | |||
| f32ec2e4be | |||
| 1aa3000ae6 | |||
| a55000613a | |||
| 21536775d7 | |||
| 1c3475d58a | |||
| 6ae1dc73c7 | |||
| 579c56ffd7 | |||
| 8b1648fe5b | |||
| aa47269273 | |||
| a8c79c2da1 | |||
| 1c099ec784 | |||
| 183257f9e1 | |||
| 0144861dca | |||
| 86ff51b842 | |||
| 98452efea2 | |||
| 1bad7865d3 | |||
| 2893a71a3e | |||
| 318c97c959 | |||
| 35486e7990 | |||
| 7b6a6c9421 | |||
| 9464415121 | |||
| 0f26b26f1d | |||
| 4e66cca58d | |||
| 911f3fb6d2 | |||
| 15845b53cd | |||
| 5ee7445048 | |||
| 247f2c9192 | |||
| fc13ff501d | |||
| e14c0bb394 | |||
| 33851dbe24 | |||
| 10f3d330be | |||
| f73db86a63 | |||
| 9fb44a3c67 | |||
| 3b3a623520 | |||
| cc31235d2e | |||
| 0f309c9dcf | |||
| 6440263ef3 | |||
| 7d96770453 | |||
| cf5f6759f0 | |||
| c2864a81a4 | |||
| 727bdd1929 | |||
| 298974b9da | |||
| 01e6811776 | |||
| 51bfa10eed | |||
| d58317728e | |||
| 6d7f5d4431 | |||
| 45288ec40c | |||
| 82753bc72b | |||
| 01b4720ec8 | |||
| 4af0379aae | |||
| d0f4e73999 | |||
| 8abc6e06b2 | |||
| 7eb3b6c71f | |||
| 57d24f173a | |||
| 4ed98878c6 | |||
| 5ec56d2e6e | |||
| 47ce01116b | |||
| 4455266c5b | |||
| 05ab0f2227 | |||
| 1fad6b049b | |||
| a3995d8c86 | |||
| caf709bb81 | |||
| cc2f2dd9b8 | |||
| 4cc4e18d56 | |||
| 57cafc277b | |||
| 5c2c659122 | |||
| 4cbc0191cb | |||
| 7b28b1c9ba | |||
| aebb38fad8 | |||
| ca9d15df92 | |||
| c84f544fc3 | |||
| 84776a95f7 | |||
| 173a3a9eb8 | |||
| cf0c9eb158 | |||
| 23f6ff3cec | |||
| d7b64c63e0 | |||
| a8f4269157 | |||
| e3ef5d6fd2 | |||
| 3f5d462305 | |||
| ce915dc6f0 | |||
| 8889565735 | |||
| f5d9644591 | |||
| 4f5db65a06 | |||
| c8a6b8786a | |||
| 0b0c6a6477 | |||
| d3aa9df876 | |||
| f678e48a08 | |||
| 38b315d0be | |||
| 74ba42a026 | |||
| a6ae8f6d96 | |||
| 55dddbc54a | |||
| 2e68e4fc09 | |||
| 0f4bf3d8a0 | |||
| f7ede4edca | |||
| c5c21bb1cf | |||
| 57751fa391 | |||
| 50e73dc6c7 | |||
| 213274c128 | |||
| 062f450709 | |||
| 9ea894a56d | |||
| e9a0e243f5 | |||
| cfaec2d2f5 | |||
| e46d23d819 | |||
| 9dab00310d | |||
| c044220f62 | |||
| 8821d488c5 | |||
| 1a1c30adfa | |||
| ed25153f2d | |||
| 998feeb2bc | |||
| a4a38dff0d | |||
| d644b2260f | |||
| 111f72e891 | |||
| 52e91f1f74 | |||
| 142368f095 | |||
| 1e961001af | |||
| f3f0fc6bb2 | |||
| 2e093eafbf | |||
| 44c8df62f2 | |||
| 672a67d0af | |||
| 8a7bd5cc00 | |||
| 4f2feb97c2 | |||
| 15af0e789b | |||
| bcbec384da | |||
| 2c04c5f08b | |||
| 3a337156d1 | |||
| 9843837593 | |||
| c38095faed | |||
| 0d380f43d6 | |||
| 103e11c937 | |||
| 582adcab1a | |||
| c26b2c9209 | |||
| 2eacaf2dd2 | |||
| ef62a872f5 | |||
| f99cbdf49f | |||
| ccf6507f6a | |||
| c184bd4675 | |||
| 1ae5c2a138 | |||
| e0040acefc | |||
| f5da87dde8 | |||
| eaa872f6c3 | |||
| 43ad7c9714 | |||
| 0a6755b57c | |||
| 14e0283413 | |||
| e36bfb45cd | |||
| 8d06b84670 | |||
| d123ea579f | |||
| 525676435d | |||
| db8cdd6392 | |||
| 44539d98e9 | |||
| b4a288a592 | |||
| 0939857e70 | |||
| 7de9995f7d | |||
| e7c16a5e82 | |||
| 98904b8910 | |||
| e5e9d87171 | |||
| 417e0894e7 | |||
| 706a7064a0 | |||
| a74c5a1f39 | |||
| 7a80c3b004 | |||
| fdeb4f8c16 | |||
| 017775f288 | |||
| 3d43a9b084 | |||
| 236d08c3c5 | |||
| 62a26eb3c8 | |||
| 5d7e268aac | |||
| 8f3e9d1b05 | |||
| 3b3726ae57 | |||
| 535723ce86 | |||
| 7eae4985e8 | |||
| 6717242d26 | |||
| 87970ea2d0 | |||
| 038aac6275 | |||
| d0147a6f2c | |||
| a8f11835c5 | |||
| ceeed1c48d | |||
| 892c6bd6f9 | |||
| 493aa4e9b3 | |||
| ea21c4563b | |||
| abfc9cd4eb | |||
| d1118071dd | |||
| 3534225c76 | |||
| b09fbadddf | |||
| 291e4e107d | |||
| 8fcf3a8e88 | |||
| e1ff15549b | |||
| 9f3dfa2031 | |||
| 5f5fc1d530 | |||
| 3a19c76017 | |||
| 5018c7f7cb | |||
| 75ed941ef1 | |||
| c96945b390 | |||
| 3d45d53714 | |||
| 81fe943472 | |||
| 0a6443ebaf | |||
| 508d31fe70 | |||
| 975d9d4314 | |||
| e991e4333d | |||
| 0a31609201 | |||
| f4e44e9e6e | |||
| 7b58ca4623 | |||
| 2f2edbd620 | |||
| 5624da20e3 | |||
| 9f1d651e0b | |||
| ff9532db27 | |||
| 74531123ae | |||
| 5f11eaa168 | |||
| 30738fbfdd | |||
| 9a6aa8db68 | |||
| 735cf98af1 | |||
| 3715fec02d | |||
| 615e4332ef | |||
| 7b20bb917f | |||
| a5846645d1 | |||
| d2c0f37a69 | |||
| 326f0aad5d | |||
| dffceb1a17 | |||
| a8dc098699 | |||
| 6194c90f74 | |||
| e8f9e7d472 | |||
| bee90aa8c8 | |||
| ee99ca6610 | |||
| 0c77879bd0 | |||
| 6bbedfe5f3 | |||
| 6128082f20 | |||
| 4222e8d713 | |||
| 2f833d4f44 | |||
| 69d9746708 | |||
| f6870e5b79 | |||
| 3c29212ce3 | |||
| 025b801663 | |||
| 940415b2eb | |||
| d5a21e47e3 | |||
| dcf80f3df5 | |||
| e78c3e2c8c | |||
| a73c858f4b | |||
| 6bdaa95164 | |||
| ccbb51dff1 | |||
| 42280f6c4e | |||
| 4e974edde8 | |||
| 9dcb33ad34 | |||
| 94b680c2cd | |||
| 3f4bd447f8 | |||
| 39097ea2da | |||
| f46c31f2fb | |||
| 6291899681 | |||
| 41b53ca603 | |||
| 1331740dd6 | |||
| c9420aa1a3 | |||
| cc16a6ca6c | |||
| 0a200e29ca | |||
| e34bb3d483 | |||
| 140a64eea4 | |||
| e82093fc14 | |||
| 6b0d389bfd | |||
| 395db3afb6 | |||
| a3d68af950 | |||
| 14d166145a | |||
| 5cdb9752a7 | |||
| 6e68237191 | |||
| 8abf82fcf4 | |||
| 05460f4982 | |||
| 3c50c0988a | |||
| c39bd623f6 | |||
| 7295c8f12b | |||
| 100623e455 | |||
| be19ee29c2 | |||
| 3897041f4a | |||
| 15dbadf389 | |||
| 0bf474e324 | |||
| f93795d272 | |||
| 93e61c1f24 | |||
| d120346992 | |||
| 5a0dc74ded | |||
| 0c02bc4239 | |||
| a3dfffa8b8 | |||
| 0004e667ab | |||
| 2dfc03bdb5 | |||
| c53f4bb342 | |||
| ba63f95a4a | |||
| 62da080bd0 | |||
| ba6522d3f2 | |||
| 1914e65591 | |||
| f3bd78a3cf | |||
| 916d9e4a52 | |||
| 112e74ed64 | |||
| 5e4672092a | |||
| dadc37e64d | |||
| 919bdff7ac | |||
| d1fd8267ef | |||
| b858d45e3c | |||
| fbad4f6c03 | |||
| e3fa5592be | |||
| cff37ce26e | |||
| 66be6a018c | |||
| 3526f2081b | |||
| dd8db0f5cb | |||
| bcfa41cec6 | |||
| 9a2327a35e | |||
| 75bcecb363 | |||
| f2cd7f151e | |||
| cfdbd59963 | |||
| 978afce04a | |||
| a00842fa99 | |||
| 40049581bc | |||
| c79ccfd6f1 | |||
| 79afd7c8d7 | |||
| 1f8b0852a4 | |||
| a03583d14f | |||
| c0573272f3 | |||
| f634684eeb | |||
| 72a809be0a | |||
| 051eedcea1 | |||
| 9752ab1711 | |||
| 82b7d21f6e | |||
| f7d7d345da | |||
| 4bc09a6a17 | |||
| 10d0dad2cf | |||
| 99c65b1587 | |||
| 7866d4ba21 | |||
| fee46bda00 | |||
| af7e73f9df | |||
| 3b83e4ee5c | |||
| c750cea4e5 | |||
| 2e83e7d335 | |||
| 80226ca926 | |||
| b22919220b | |||
| 3b18ea71c3 | |||
| c9d9c9158f | |||
| 2b6a4ba890 | |||
| 23a4affb6f | |||
| 40e0973709 | |||
| 2fbc77fce1 | |||
| a2f550d91b | |||
| 0e34c87211 | |||
| 54c6c7ae87 | |||
| 91467a45fc | |||
| 39453478ab | |||
| c543ddab3a | |||
| dd7c65a95a | |||
| a6f935bb77 | |||
| d941e5f0c0 | |||
| 8d1227a97c | |||
| 9744e86e04 | |||
| b547c0319a | |||
| 93aeb63f0c | |||
| a0bf0a0f70 | |||
| 4d9d655b4e | |||
| 23948d6a3a | |||
| d3c147a62d | |||
| 763aa4db94 | |||
| 6556e7e08d | |||
| e683e915b8 | |||
| f7ee61c833 | |||
| 7afac9670b | |||
| 7d1e79ef4b | |||
| 202116c60c | |||
| 5c46db1d77 | |||
| cc529c2423 | |||
| d5531da7f8 | |||
| 8495c0c7ad | |||
| db5cbce4d5 | |||
| 5b36bd704b | |||
| 59637c95a6 | |||
| b3d90fe51b | |||
| 6a214c9bcd | |||
| eb88ce429c | |||
| 2a615e2e45 | |||
| 7eac2bc4c3 | |||
| 64fea1be04 | |||
| d2838a2408 | |||
| 8b5d30d439 | |||
| 07722ae2dd | |||
| af4031d9fe | |||
| 11015a49ae | |||
| d26c8e0536 | |||
| d6a467d48e | |||
| a2da26de04 | |||
| 7b2e526c3a | |||
| b46cef1809 | |||
| 09551bf37a | |||
| 52c913156f | |||
| 7e9372bafa | |||
| d0fb80d31b | |||
| 95d76d0132 | |||
| 619aeb643f | |||
| cdd2651db0 | |||
| 3b08ba24b3 | |||
| 91d9ae1cc4 | |||
| 3829554f3a | |||
| c1ae4a2baf | |||
| da3cb153bc | |||
| 563230b89d | |||
| 4bbcc4a397 | |||
| 64fb9a6eb2 | |||
| 558c6ea6b5 | |||
| 63efdca223 | |||
| 61b636b8a4 | |||
| aa3020a39e | |||
| 6d3c61856b | |||
| 811c4c699f | |||
| 059e33ecea | |||
| a43e0177cf | |||
| d39424fc1c | |||
| c2330e7fd1 | |||
| 7182ae4f45 | |||
| 0192f3fe2d | |||
| 05a9006715 | |||
| 0403d94d43 | |||
| 4866f0cec4 | |||
| faa1909474 | |||
| 3fc0c2a8ea | |||
| 67b4f8ea75 | |||
| b3e1bb1654 | |||
| e356841957 | |||
| c7930417b4 | |||
| 9b5e70c9c2 | |||
| 60f0445233 | |||
| 972136803a | |||
| 60c7f22310 | |||
| 5cd7a5282e |
+5
-1
@@ -9,9 +9,13 @@ GTK+ requires the following packages:
|
||||
GdkPixbuf @GDK_PIXBUF_REQUIRED_VERSION@, ATK @ATK_REQUIRED_VERSION@
|
||||
and cairo @CAIRO_REQUIRED_VERSION@.
|
||||
|
||||
- libepoxy, for cross-platform OpenGL support.
|
||||
It can be found here: https://github.com/anholt/libepoxy
|
||||
|
||||
- Each GDK backend has its own backend-specific requirements. For
|
||||
the X11 backend, X11 R6 and XInput version 2 (as well as a number
|
||||
of other extensions) are required.
|
||||
of other extensions) are required. The Wayland backend requires
|
||||
(obviously) the Wayland libraries.
|
||||
|
||||
- gobject-introspection @INTROSPECTION_REQUIRED_VERSION@ or newer.
|
||||
|
||||
|
||||
+4
-2
@@ -33,11 +33,11 @@ MAINTAINERCLEANFILES = \
|
||||
|
||||
|
||||
## Copy .pc files to target-specific names
|
||||
gtk+-x11-3.0.pc gtk+-win32-3.0.pc gtk+-quartz-3.0.pc gtk+-broadway-3.0.pc gtk+-wayland-3.0.pc: gtk+-3.0.pc
|
||||
gtk+-x11-3.0.pc gtk+-win32-3.0.pc gtk+-quartz-3.0.pc gtk+-broadway-3.0.pc gtk+-wayland-3.0.pc gtk+-mir-3.0.pc: gtk+-3.0.pc
|
||||
rm -f $@ && \
|
||||
cp gtk+-3.0.pc $@
|
||||
|
||||
gdk-x11-3.0.pc gdk-win32-3.0.pc gdk-quartz-3.0.pc gdk-broadway-3.0.pc gdk-wayland-3.0.pc: gdk-3.0.pc
|
||||
gdk-x11-3.0.pc gdk-win32-3.0.pc gdk-quartz-3.0.pc gdk-broadway-3.0.pc gdk-wayland-3.0.pc gdk-mir-3.0.pc: gdk-3.0.pc
|
||||
rm -f $@ && \
|
||||
cp gdk-3.0.pc $@
|
||||
|
||||
@@ -59,12 +59,14 @@ DISTCLEANFILES = \
|
||||
gtk+-quartz-3.0.pc \
|
||||
gtk+-broadway-3.0.pc \
|
||||
gtk+-wayland-3.0.pc \
|
||||
gtk+-mir-3.0.pc \
|
||||
gdk-3.0.pc \
|
||||
gdk-x11-3.0.pc \
|
||||
gdk-win32-3.0.pc \
|
||||
gdk-quartz-3.0.pc \
|
||||
gdk-broadway-3.0.pc \
|
||||
gdk-wayland-3.0.pc \
|
||||
gdk-mir-3.0.pc \
|
||||
gail-3.0.pc \
|
||||
config.lt
|
||||
|
||||
|
||||
@@ -1,3 +1,141 @@
|
||||
Overview of Changes in GTK+ 3.15.1
|
||||
==================================
|
||||
|
||||
* An experimental mir backend has been added.
|
||||
Use --enable-mir-backend to build it.
|
||||
|
||||
* Inspector:
|
||||
- Show more information
|
||||
- Use a separate display connection
|
||||
|
||||
* Deprecations:
|
||||
- GtkStyleProperties
|
||||
|
||||
* Bugs fixed:
|
||||
707695 GtkLevelBar Colour CSS
|
||||
737561 quartz: gtk+ 3.14.0 fails to build on 10.6.8, 'NSFullScreen...
|
||||
738650 fix separator with iconic section and more
|
||||
738886 Out of bounds access in MyEnhancedXkbTranslateKeyCode
|
||||
738955 Client-side decoration window menus appear at wrong positio...
|
||||
738982 Add support for ATK_STATE_HAS_TOOLTIP
|
||||
739001 Fix Build of broadwayd on Visual Studio
|
||||
739005 gtkstatusicon.c won't build with both X11 and Quartz backen...
|
||||
739111 GtkFontChooserDialog fixes
|
||||
739150 Dragging bookmark crashes nautilus
|
||||
|
||||
Translation updates:
|
||||
Czech
|
||||
Hungarian
|
||||
Serbian
|
||||
Spanish
|
||||
|
||||
|
||||
Overview of Changes in GTK+ 3.15.0
|
||||
==================================
|
||||
|
||||
* GDK supports rendering windows using OpenGL; currently
|
||||
this is implemented for X11 and Wayland using libepoxy
|
||||
|
||||
* GtkGLArea: A new widget for rendering with OpenGL
|
||||
|
||||
* GtkSidebar: A new switcher for GtkStack that looks like
|
||||
a sidebar
|
||||
|
||||
* Better typography: In many places, we now use proper Unicode
|
||||
characters for dashes, quotes, multiplication signs and the
|
||||
like, instead of ASCII approximations
|
||||
|
||||
* Theming:
|
||||
- Context menus use the default font instead of inheriting from
|
||||
the widget they are attached to
|
||||
- Theming engines are no longer used
|
||||
- Backdrop style has been fine-tuned to make the difference to
|
||||
the active window more evident without affecting readability
|
||||
|
||||
* Inspector:
|
||||
- Show nested tree models
|
||||
- Add a checkbox to disable the warning dialog
|
||||
- Rearrange the UI to gain space
|
||||
- Show object counts
|
||||
|
||||
* GtkTextView has a monospace property
|
||||
|
||||
* GtkPaned has a wide-handle property
|
||||
|
||||
* GtkPrintUnixDialog
|
||||
- Has improved appearance without headerbars
|
||||
- Better rendering of sheet icons
|
||||
- No more missing icons
|
||||
|
||||
* GtkScrolledWindow
|
||||
- A new policy, GTK_POLICY_EXTERNAL, which allows scrolling
|
||||
without showing a scrollbar
|
||||
- Scroll events can now overshoot as well
|
||||
- The new signal ::edge-overshot is emitted when the scrolled
|
||||
window is fully overshot
|
||||
- Scrollbars will be overlayed as narrow indicators when
|
||||
there is no mouse
|
||||
|
||||
* Deprecations:
|
||||
- gdk_window_set_static_gravities
|
||||
- gdk_window_set_composited
|
||||
- gtk_style_context_get_background_color
|
||||
- gtk_style_context_get_border_color
|
||||
- gtk_settings_set_string/long/double_property
|
||||
- gtk_settings_install_property
|
||||
|
||||
* Bugs fixed:
|
||||
119189 Add OpenGL support to GTK+
|
||||
154709 don't use the cursor for preview
|
||||
582799 GtkContainer should parse a list of widgets for a focus chain
|
||||
671138 About dialog contains scary warranty disclaimer in copyright...
|
||||
672946 Add gtk_css_provider_load_resource_from_file
|
||||
681185 Document precedence between tooltip-markup and tooltip-text
|
||||
724096 search-bar: don't show the widget until we're ready to reveal
|
||||
725441 Print Dialog: Add support for PPD-less printing on IPP print...
|
||||
730730 scrolling is broken when sharing adjustments
|
||||
730893 Dialogs use headerbars even when DialogsUseHeader is unset
|
||||
733157 Remove redundant checks for NULL
|
||||
735192 Use better typography for paper names
|
||||
735293 No vertical stack switcher component available (Sidebar)
|
||||
735841 EmptyBoxes: instructions_label's alignment is off
|
||||
737670 GtkCalendar days cannot be selected if vertical size is grea...
|
||||
737679 Bookmarks are visually duplicated in sidebar
|
||||
737777 Applications crash randomly while printing with a password-s...
|
||||
737929 Long tooltips extend too far horizontally without wrapping
|
||||
737952 Documentation missing for GtkTextView's new draw-layer funct...
|
||||
737981 Strange frame in GtkScrolledWindow
|
||||
737983 gtkplacessidebar: Open $HOME after unmounting or ejecting
|
||||
737985 Unnecessary "GtkScrolledWindow .frame"
|
||||
737986 Transparent icon background rendered black on XFCE
|
||||
738083 GtkMenuButton is not disabled even if corresponding GAction is
|
||||
738111 GtkListBox should allow for setting "placeholder" via GtkBui...
|
||||
738158 Flat context menu button
|
||||
738272 inspector: Add a tab for object counts
|
||||
738533 Show overshoot on scroll events
|
||||
738534 Add ::edge-hit signal
|
||||
738591 Can't select file after showing header context menu
|
||||
738636 GtkStackSwitcher focus overlap border
|
||||
738670 GL Context on NVIDIA
|
||||
738860 GtkPaned: Add a "wide-handle" property
|
||||
738873 wayland backend aborts entire program if XDG_RUNTIME_DIR unset
|
||||
738912 wayland: Don't try to create a subsurface again
|
||||
|
||||
* Translation updates
|
||||
Czech
|
||||
French
|
||||
German
|
||||
Hebrew
|
||||
Indonesian
|
||||
Italian
|
||||
Kazakh
|
||||
Korean
|
||||
Persian
|
||||
Polish
|
||||
Scottish Gaelic
|
||||
Spanish
|
||||
|
||||
|
||||
Overview of Changes in GTK+ 3.14.0 to 3.14.1
|
||||
============================================
|
||||
|
||||
|
||||
@@ -73,6 +73,12 @@ Patches should be in unified diff form. (The -up option to GNU diff)
|
||||
Even better are git-formatted patches. (Use git format-patch)
|
||||
|
||||
|
||||
Release notes for 3.16
|
||||
======================
|
||||
|
||||
* GTK+ now includes an OpenGL rendering widget. To support GL on various
|
||||
platforms, GTK+ uses libepoxy.
|
||||
|
||||
Release notes for 3.14
|
||||
======================
|
||||
|
||||
@@ -99,6 +105,14 @@ Release notes for 3.14
|
||||
to be problematic. This combination is using code paths in cairo and
|
||||
graphics drivers which are rarely tested and likely buggy.
|
||||
|
||||
* GtkTextView is now using a pixel-cache internally, and is drawing
|
||||
a background underneath the text. This can cause problems for applications
|
||||
which assumed that they could draw things below and above the text
|
||||
by chaining up in the ::draw implementation of their GtkTextView subclass.
|
||||
As a short-term workaround, you can make the application apply a
|
||||
custom theme to the text view with a transparent background. For
|
||||
a proper fix, use the new ::draw_layer vfunc.
|
||||
|
||||
Release notes for 3.12
|
||||
======================
|
||||
|
||||
|
||||
@@ -59,9 +59,9 @@ The recommended build order for these dependencies:
|
||||
as described in the README.txt file in the build/win32/vs10 folder)
|
||||
-zlib
|
||||
-libpng
|
||||
-(for GDK-Pixbuf, if not using GDI+) IJG JPEG
|
||||
-(for GDK-Pixbuf, if not using GDI+) IJG JPEG or libjpeg-turbo
|
||||
-(for GDK-Pixbuf, if not using GDI+) libtiff
|
||||
[libtiff requires zlib and IJG JPEG]
|
||||
[libtiff requires zlib and IJG JPEG or libjpeg-turbo]
|
||||
-(for GDK-Pixbuf, if not using GDI+) jasper [jpeg-2000 library]
|
||||
-(optional for GLib) PCRE (version 8.12 or later, use of CMake to
|
||||
build PCRE is recommended-see build/win32/vs10/README.txt of GLib)
|
||||
@@ -81,6 +81,11 @@ built DLLs go into <root>\vs10\<PlatformName>\bin, built LIBs into
|
||||
project files higher in the stack are supposed to look for them, not
|
||||
from a specific GLib source tree.
|
||||
|
||||
Please note, as GTK+ uses the Adwaita theme for all platforms by default,
|
||||
most icons used are not included with GTK+ (which *are* needed), so please see
|
||||
https://live.gnome.org/GTK%2B/Win32/MSVCCompilationOfGTKStack (under the
|
||||
GTK+ section) on how to get those icons set up for use with GTK+.
|
||||
|
||||
*About the dependencies marked with *: These dependencies are optional
|
||||
as those are not compulsory components for building and running GTK+
|
||||
itself, but note that they are needed for people running and building
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug_Broadway|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\..\gdk;..\..\..\gdk\broadway;..\crypt;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\..\..\gdk;..\..\..\gdk\broadway;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_DEBUG;$(GdkDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
@@ -95,7 +95,7 @@
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_Broadway|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\..\gdk;..\..\..\gdk\broadway;..\crypt;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\..\..\gdk;..\..\..\gdk\broadway;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>$(GdkDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
@@ -120,7 +120,7 @@
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\..\gdk;..\..\..\gdk\broadway;..\crypt;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\..\..\gdk;..\..\..\gdk\broadway;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_DEBUG;$(GdkDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
@@ -143,7 +143,7 @@
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\..\gdk;..\..\..\gdk\broadway;..\crypt;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\..\..\gdk;..\..\..\gdk\broadway;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>$(GdkDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
@@ -163,8 +163,8 @@
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\crypt\crypt3.c" />
|
||||
<ClCompile Include="..\..\..\gdk\broadway\broadwayd.c" />
|
||||
<ClCompile Include="..\..\..\gdk\broadway\broadway-buffer.c" />
|
||||
<ClCompile Include="..\..\..\gdk\broadway\broadway-output.c" />
|
||||
<ClCompile Include="..\..\..\gdk\broadway\broadway-server.c" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\crypt\crypt3.c"><Filter>Sources</Filter></ClCompile>
|
||||
<ClCompile Include="..\..\..\gdk\broadway\broadwayd.c"><Filter>Sources</Filter></ClCompile>
|
||||
<ClCompile Include="..\..\..\gdk\broadway\broadway-buffer.c"><Filter>Sources</Filter></ClCompile>
|
||||
<ClCompile Include="..\..\..\gdk\broadway\broadway-output.c"><Filter>Sources</Filter></ClCompile>
|
||||
<ClCompile Include="..\..\..\gdk\broadway\broadway-server.c"><Filter>Sources</Filter></ClCompile>
|
||||
</ItemGroup>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<ForcedIncludeFiles>msvc_recommended_pragmas.h;%(ForcedIncludeFiles)</ForcedIncludeFiles>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>pangocairo-1.0.lib;cairo.lib;cairo-gobject.lib;pango-1.0.lib;gdk_pixbuf-2.0.lib;gio-2.0.lib;gmodule-2.0.lib;gobject-2.0.lib;glib-2.0.lib;intl.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>pangocairo-1.0.lib;cairo.lib;cairo-gobject.lib;pango-1.0.lib;gdk_pixbuf-2.0.lib;gio-2.0.lib;gmodule-2.0.lib;gobject-2.0.lib;glib-2.0.lib;intl.lib;epoxy.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(GlibEtcInstallRoot)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<ItemDefinitionGroup>
|
||||
<Link>
|
||||
<AdditionalOptions>/EXPORT:gdk_win32_display_manager_get_type</AdditionalOptions>
|
||||
</Link
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>
|
||||
if "$(Configuration)" == "Release" goto END
|
||||
|
||||
@@ -53,6 +53,7 @@ copy ..\..\..\gdk\gdkdisplaymanager.h $(CopyDir)\include\gtk-3.0\gdk\gdkdisplaym
|
||||
copy ..\..\..\gdk\gdkdnd.h $(CopyDir)\include\gtk-3.0\gdk\gdkdnd.h
|
||||
copy ..\..\..\gdk\gdkevents.h $(CopyDir)\include\gtk-3.0\gdk\gdkevents.h
|
||||
copy ..\..\..\gdk\gdkframetimings.h $(CopyDir)\include\gtk-3.0\gdk\gdkframetimings.h
|
||||
copy ..\..\..\gdk\gdkglcontext.h $(CopyDir)\include\gtk-3.0\gdk\gdkglcontext.h
|
||||
copy ..\..\..\gdk\gdkkeys.h $(CopyDir)\include\gtk-3.0\gdk\gdkkeys.h
|
||||
copy ..\..\..\gdk\gdkkeysyms.h $(CopyDir)\include\gtk-3.0\gdk\gdkkeysyms.h
|
||||
copy ..\..\..\gdk\gdkkeysyms-compat.h $(CopyDir)\include\gtk-3.0\gdk\gdkkeysyms-compat.h
|
||||
@@ -172,6 +173,7 @@ copy ..\..\..\gtk\gtkgesturerotate.h $(CopyDir)\include\gtk-3.0\gtk\gtkgesturero
|
||||
copy ..\..\..\gtk\gtkgesturesingle.h $(CopyDir)\include\gtk-3.0\gtk\gtkgesturesingle.h
|
||||
copy ..\..\..\gtk\gtkgestureswipe.h $(CopyDir)\include\gtk-3.0\gtk\gtkgestureswipe.h
|
||||
copy ..\..\..\gtk\gtkgesturezoom.h $(CopyDir)\include\gtk-3.0\gtk\gtkgesturezoom.h
|
||||
copy ..\..\..\gtk\gtkglarea.h $(CopyDir)\include\gtk-3.0\gtk\gtkglarea.h
|
||||
copy ..\..\..\gtk\gtkgrid.h $(CopyDir)\include\gtk-3.0\gtk\gtkgrid.h
|
||||
copy ..\..\..\gtk\gtkheaderbar.h $(CopyDir)\include\gtk-3.0\gtk\gtkheaderbar.h
|
||||
copy ..\..\..\gtk\gtkicontheme.h $(CopyDir)\include\gtk-3.0\gtk\gtkicontheme.h
|
||||
@@ -226,6 +228,7 @@ copy ..\..\..\gtk\gtkrecentchoosermenu.h $(CopyDir)\include\gtk-3.0\gtk\gtkrecen
|
||||
copy ..\..\..\gtk\gtkrecentchooserwidget.h $(CopyDir)\include\gtk-3.0\gtk\gtkrecentchooserwidget.h
|
||||
copy ..\..\..\gtk\gtkrecentfilter.h $(CopyDir)\include\gtk-3.0\gtk\gtkrecentfilter.h
|
||||
copy ..\..\..\gtk\gtkrecentmanager.h $(CopyDir)\include\gtk-3.0\gtk\gtkrecentmanager.h
|
||||
copy ..\..\..\gtk\gtkrender.h $(CopyDir)\include\gtk-3.0\gtk\gtkrender.h
|
||||
copy ..\..\..\gtk\gtkrevealer.h $(CopyDir)\include\gtk-3.0\gtk\gtkrevealer.h
|
||||
copy ..\..\..\gtk\gtkscale.h $(CopyDir)\include\gtk-3.0\gtk\gtkscale.h
|
||||
copy ..\..\..\gtk\gtkscalebutton.h $(CopyDir)\include\gtk-3.0\gtk\gtkscalebutton.h
|
||||
@@ -240,6 +243,7 @@ copy ..\..\..\gtk\gtkseparatormenuitem.h $(CopyDir)\include\gtk-3.0\gtk\gtksepar
|
||||
copy ..\..\..\gtk\gtkseparatortoolitem.h $(CopyDir)\include\gtk-3.0\gtk\gtkseparatortoolitem.h
|
||||
copy ..\..\..\gtk\gtksettings.h $(CopyDir)\include\gtk-3.0\gtk\gtksettings.h
|
||||
copy ..\..\..\gtk\gtkshow.h $(CopyDir)\include\gtk-3.0\gtk\gtkshow.h
|
||||
copy ..\..\..\gtk\gtksidebar.h $(CopyDir)\include\gtk-3.0\gtk\gtksidebar.h
|
||||
copy ..\..\..\gtk\gtksizegroup.h $(CopyDir)\include\gtk-3.0\gtk\gtksizegroup.h
|
||||
copy ..\..\..\gtk\gtksizerequest.h $(CopyDir)\include\gtk-3.0\gtk\gtksizerequest.h
|
||||
copy ..\..\..\gtk\gtksocket.h $(CopyDir)\include\gtk-3.0\gtk\gtksocket.h
|
||||
@@ -407,9 +411,10 @@ $(CopyDir)\bin\glib-compile-schemas.exe $(CopyDir)\share\glib-2.0\schemas
|
||||
<GtkDoInstallBroadwayHeaders>
|
||||
copy ..\..\..\gdk\broadway\gdkbroadway.h $(CopyDir)\include\gtk-$(ApiVersion)\gdk
|
||||
mkdir $(CopyDir)\include\gtk-$(ApiVersion)\gdk\broadway
|
||||
copy ..\..\..\gdk\broadway\gdkbroadwaywindow.h $(CopyDir)\include\gtk-$(ApiVersion)\gdk\broadway
|
||||
copy ..\..\..\gdk\broadway\gdkbroadwaycursor.h $(CopyDir)\include\gtk-$(ApiVersion)\gdk\broadway
|
||||
copy ..\..\..\gdk\broadway\gdkbroadwaydisplay.h $(CopyDir)\include\gtk-$(ApiVersion)\gdk\broadway
|
||||
copy ..\..\..\gdk\broadway\gdkbroadwayvisual.h $(CopyDir)\include\gtk-$(ApiVersion)\gdk\broadway
|
||||
copy ..\..\..\gdk\broadway\gdkbroadwaywindow.h $(CopyDir)\include\gtk-$(ApiVersion)\gdk\broadway
|
||||
</GtkDoInstallBroadwayHeaders>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
|
||||
@@ -190,6 +190,7 @@
|
||||
<ClCompile Include="..\..\..\demos\gtk-demo\event_axes.c" />
|
||||
<ClCompile Include="..\..\..\demos\gtk-demo\expander.c" />
|
||||
<ClCompile Include="..\..\..\demos\gtk-demo\gestures.c" />
|
||||
<ClCompile Include="..\..\..\demos\gtk-demo\glarea.c" />
|
||||
<ClCompile Include="..\..\..\demos\gtk-demo\headerbar.c" />
|
||||
<ClCompile Include="..\..\..\demos\gtk-demo\hypertext.c" />
|
||||
<ClCompile Include="..\..\..\demos\gtk-demo\iconview.c" />
|
||||
@@ -213,6 +214,7 @@
|
||||
<ClCompile Include="..\..\..\demos\gtk-demo\rotated_text.c" />
|
||||
<ClCompile Include="..\..\..\demos\gtk-demo\search_entry.c" />
|
||||
<ClCompile Include="..\..\..\demos\gtk-demo\search_entry2.c" />
|
||||
<ClCompile Include="..\..\..\demos\gtk-demo\sidebar.c" />
|
||||
<ClCompile Include="..\..\..\demos\gtk-demo\sizegroup.c" />
|
||||
<ClCompile Include="..\..\..\demos\gtk-demo\spinner.c" />
|
||||
<ClCompile Include="..\..\..\demos\gtk-demo\stack.c" />
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
<ClCompile Include="..\..\..\demos\gtk-demo\event_axes.c"><Filter>Source Files</Filter></ClCompile>
|
||||
<ClCompile Include="..\..\..\demos\gtk-demo\expander.c"><Filter>Source Files</Filter></ClCompile>
|
||||
<ClCompile Include="..\..\..\demos\gtk-demo\gestures.c"><Filter>Source Files</Filter></ClCompile>
|
||||
<ClCompile Include="..\..\..\demos\gtk-demo\glarea.c"><Filter>Source Files</Filter></ClCompile>
|
||||
<ClCompile Include="..\..\..\demos\gtk-demo\headerbar.c"><Filter>Source Files</Filter></ClCompile>
|
||||
<ClCompile Include="..\..\..\demos\gtk-demo\hypertext.c"><Filter>Source Files</Filter></ClCompile>
|
||||
<ClCompile Include="..\..\..\demos\gtk-demo\iconview.c"><Filter>Source Files</Filter></ClCompile>
|
||||
@@ -55,6 +56,7 @@
|
||||
<ClCompile Include="..\..\..\demos\gtk-demo\rotated_text.c"><Filter>Source Files</Filter></ClCompile>
|
||||
<ClCompile Include="..\..\..\demos\gtk-demo\search_entry.c"><Filter>Source Files</Filter></ClCompile>
|
||||
<ClCompile Include="..\..\..\demos\gtk-demo\search_entry2.c"><Filter>Source Files</Filter></ClCompile>
|
||||
<ClCompile Include="..\..\..\demos\gtk-demo\sidebar.c"><Filter>Source Files</Filter></ClCompile>
|
||||
<ClCompile Include="..\..\..\demos\gtk-demo\sizegroup.c"><Filter>Source Files</Filter></ClCompile>
|
||||
<ClCompile Include="..\..\..\demos\gtk-demo\spinner.c"><Filter>Source Files</Filter></ClCompile>
|
||||
<ClCompile Include="..\..\..\demos\gtk-demo\stack.c"><Filter>Source Files</Filter></ClCompile>
|
||||
|
||||
@@ -58,9 +58,9 @@ The recommended build order for these dependencies:
|
||||
as described in the README.txt file in the build/win32/vs9 folder)
|
||||
-zlib
|
||||
-libpng
|
||||
-(for GDK-Pixbuf, if not using GDI+) IJG JPEG
|
||||
-(for GDK-Pixbuf, if not using GDI+) IJG JPEG or libjpeg-turbo
|
||||
-(for GDK-Pixbuf, if not using GDI+) libtiff
|
||||
[libtiff requires zlib and IJG JPEG]
|
||||
[libtiff requires zlib and IJG JPEG or libjpeg-turbo]
|
||||
-(for GDK-Pixbuf, if not using GDI+) jasper [jpeg-2000 library])
|
||||
-(optional for GLib) PCRE (version 8.12 or later, use of CMake to
|
||||
build PCRE is recommended-see build/win32/vs9/README.txt of GLib)
|
||||
@@ -80,6 +80,11 @@ built DLLs go into <root>\vs9\<PlatformName>\bin, built LIBs into
|
||||
project files higher in the stack are supposed to look for them, not
|
||||
from a specific GLib source tree.
|
||||
|
||||
Please note, as GTK+ uses the Adwaita theme for all platforms by default,
|
||||
most icons used are not included with GTK+ (which *are* needed), so please see
|
||||
https://live.gnome.org/GTK%2B/Win32/MSVCCompilationOfGTKStack (under the
|
||||
GTK+ section) on how to get those icons set up for use with GTK+.
|
||||
|
||||
*About the dependencies marked with *: These dependencies are optional
|
||||
as those are not compulsory components for building and running GTK+
|
||||
itself, but note that they are needed for people running and building
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\..\gdk;..\..\..\gdk\broadway;..\crypt"
|
||||
AdditionalIncludeDirectories="..\..\..\gdk;..\..\..\gdk\broadway"
|
||||
PreprocessorDefinitions="_DEBUG;$(GdkDefines)"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
@@ -62,7 +62,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
AdditionalIncludeDirectories="..\..\..\gdk;..\..\..\gdk\broadway;..\crypt"
|
||||
AdditionalIncludeDirectories="..\..\..\gdk;..\..\..\gdk\broadway"
|
||||
EnableIntrinsicFunctions="true"
|
||||
PreprocessorDefinitions="$(GdkDefines)"
|
||||
RuntimeLibrary="2"
|
||||
@@ -95,7 +95,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\..\gdk;..\..\..\gdk\broadway;..\crypt"
|
||||
AdditionalIncludeDirectories="..\..\..\gdk;..\..\..\gdk\broadway"
|
||||
PreprocessorDefinitions="_DEBUG;$(GdkDefines)"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
@@ -127,7 +127,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
AdditionalIncludeDirectories="..\..\..\gdk;..\..\..\gdk\broadway;..\crypt"
|
||||
AdditionalIncludeDirectories="..\..\..\gdk;..\..\..\gdk\broadway"
|
||||
EnableIntrinsicFunctions="true"
|
||||
PreprocessorDefinitions="$(GdkDefines)"
|
||||
RuntimeLibrary="2"
|
||||
@@ -157,8 +157,8 @@
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
</Filter>
|
||||
<File RelativePath="..\crypt\crypt3.c" />
|
||||
<File RelativePath="..\..\..\gdk\broadway\broadwayd.c" />
|
||||
<File RelativePath="..\..\..\gdk\broadway\broadway-buffer.c" />
|
||||
<File RelativePath="..\..\..\gdk\broadway\broadway-output.c" />
|
||||
<File RelativePath="..\..\..\gdk\broadway\broadway-server.c" />
|
||||
<Filter
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="gdk_pixbuf-2.0.lib pangocairo-1.0.lib pango-1.0.lib cairo-gobject.lib cairo.lib gio-2.0.lib gmodule-2.0.lib gobject-2.0.lib glib-2.0.lib intl.lib"
|
||||
AdditionalDependencies="gdk_pixbuf-2.0.lib pangocairo-1.0.lib pango-1.0.lib cairo-gobject.lib cairo.lib gio-2.0.lib gmodule-2.0.lib gobject-2.0.lib glib-2.0.lib intl.lib epoxy.lib"
|
||||
AdditionalLibraryDirectories="$(GlibEtcInstallRoot)\lib"
|
||||
/>
|
||||
<UserMacro
|
||||
|
||||
@@ -55,6 +55,7 @@ copy ..\..\..\gdk\gdkdisplaymanager.h $(CopyDir)\include\gtk-3.0\gdk\gdkdisplaym
|
||||
copy ..\..\..\gdk\gdkdnd.h $(CopyDir)\include\gtk-3.0\gdk\gdkdnd.h

|
||||
copy ..\..\..\gdk\gdkevents.h $(CopyDir)\include\gtk-3.0\gdk\gdkevents.h

|
||||
copy ..\..\..\gdk\gdkframetimings.h $(CopyDir)\include\gtk-3.0\gdk\gdkframetimings.h

|
||||
copy ..\..\..\gdk\gdkglcontext.h $(CopyDir)\include\gtk-3.0\gdk\gdkglcontext.h

|
||||
copy ..\..\..\gdk\gdkkeys.h $(CopyDir)\include\gtk-3.0\gdk\gdkkeys.h

|
||||
copy ..\..\..\gdk\gdkkeysyms.h $(CopyDir)\include\gtk-3.0\gdk\gdkkeysyms.h

|
||||
copy ..\..\..\gdk\gdkkeysyms-compat.h $(CopyDir)\include\gtk-3.0\gdk\gdkkeysyms-compat.h

|
||||
@@ -174,6 +175,7 @@ copy ..\..\..\gtk\gtkgesturerotate.h $(CopyDir)\include\gtk-3.0\gtk\gtkgesturero
|
||||
copy ..\..\..\gtk\gtkgesturesingle.h $(CopyDir)\include\gtk-3.0\gtk\gtkgesturesingle.h

|
||||
copy ..\..\..\gtk\gtkgestureswipe.h $(CopyDir)\include\gtk-3.0\gtk\gtkgestureswipe.h

|
||||
copy ..\..\..\gtk\gtkgesturezoom.h $(CopyDir)\include\gtk-3.0\gtk\gtkgesturezoom.h

|
||||
copy ..\..\..\gtk\gtkglarea.h $(CopyDir)\include\gtk-3.0\gtk\gtkglarea.h

|
||||
copy ..\..\..\gtk\gtkgrid.h $(CopyDir)\include\gtk-3.0\gtk\gtkgrid.h

|
||||
copy ..\..\..\gtk\gtkheaderbar.h $(CopyDir)\include\gtk-3.0\gtk\gtkheaderbar.h

|
||||
copy ..\..\..\gtk\gtkicontheme.h $(CopyDir)\include\gtk-3.0\gtk\gtkicontheme.h

|
||||
@@ -228,6 +230,7 @@ copy ..\..\..\gtk\gtkrecentchoosermenu.h $(CopyDir)\include\gtk-3.0\gtk\gtkrecen
|
||||
copy ..\..\..\gtk\gtkrecentchooserwidget.h $(CopyDir)\include\gtk-3.0\gtk\gtkrecentchooserwidget.h

|
||||
copy ..\..\..\gtk\gtkrecentfilter.h $(CopyDir)\include\gtk-3.0\gtk\gtkrecentfilter.h

|
||||
copy ..\..\..\gtk\gtkrecentmanager.h $(CopyDir)\include\gtk-3.0\gtk\gtkrecentmanager.h

|
||||
copy ..\..\..\gtk\gtkrender.h $(CopyDir)\include\gtk-3.0\gtk\gtkrender.h

|
||||
copy ..\..\..\gtk\gtkrevealer.h $(CopyDir)\include\gtk-3.0\gtk\gtkrevealer.h

|
||||
copy ..\..\..\gtk\gtkscale.h $(CopyDir)\include\gtk-3.0\gtk\gtkscale.h

|
||||
copy ..\..\..\gtk\gtkscalebutton.h $(CopyDir)\include\gtk-3.0\gtk\gtkscalebutton.h

|
||||
@@ -242,6 +245,7 @@ copy ..\..\..\gtk\gtkseparatormenuitem.h $(CopyDir)\include\gtk-3.0\gtk\gtksepar
|
||||
copy ..\..\..\gtk\gtkseparatortoolitem.h $(CopyDir)\include\gtk-3.0\gtk\gtkseparatortoolitem.h

|
||||
copy ..\..\..\gtk\gtksettings.h $(CopyDir)\include\gtk-3.0\gtk\gtksettings.h

|
||||
copy ..\..\..\gtk\gtkshow.h $(CopyDir)\include\gtk-3.0\gtk\gtkshow.h

|
||||
copy ..\..\..\gtk\gtksidebar.h $(CopyDir)\include\gtk-3.0\gtk\gtksidebar.h

|
||||
copy ..\..\..\gtk\gtksizegroup.h $(CopyDir)\include\gtk-3.0\gtk\gtksizegroup.h

|
||||
copy ..\..\..\gtk\gtksizerequest.h $(CopyDir)\include\gtk-3.0\gtk\gtksizerequest.h

|
||||
copy ..\..\..\gtk\gtksocket.h $(CopyDir)\include\gtk-3.0\gtk\gtksocket.h

|
||||
@@ -412,9 +416,10 @@ $(CopyDir)\bin\glib-compile-schemas.exe $(CopyDir)\share\glib-2.0\schemas
&
|
||||
Value="
|
||||
copy ..\..\..\gdk\broadway\gdkbroadway.h $(CopyDir)\include\gtk-$(ApiVersion)\gdk

|
||||
mkdir $(CopyDir)\include\gtk-$(ApiVersion)\gdk\broadway

|
||||
copy ..\..\..\gdk\broadway\gdkbroadwaywindow.h $(CopyDir)\include\gtk-$(ApiVersion)\gdk\broadway

|
||||
copy ..\..\..\gdk\broadway\gdkbroadwaycursor.h $(CopyDir)\include\gtk-$(ApiVersion)\gdk\broadway

|
||||
copy ..\..\..\gdk\broadway\gdkbroadwaydisplay.h $(CopyDir)\include\gtk-$(ApiVersion)\gdk\broadway

|
||||
copy ..\..\..\gdk\broadway\gdkbroadwayvisual.h $(CopyDir)\include\gtk-$(ApiVersion)\gdk\broadway

|
||||
copy ..\..\..\gdk\broadway\gdkbroadwaywindow.h $(CopyDir)\include\gtk-$(ApiVersion)\gdk\broadway

|
||||
"
|
||||
/>
|
||||
</VisualStudioPropertySheet>
|
||||
|
||||
@@ -181,6 +181,7 @@
|
||||
<File RelativePath="..\..\..\demos\gtk-demo\event_axes.c" />
|
||||
<File RelativePath="..\..\..\demos\gtk-demo\expander.c" />
|
||||
<File RelativePath="..\..\..\demos\gtk-demo\gestures.c" />
|
||||
<File RelativePath="..\..\..\demos\gtk-demo\glarea.c" />
|
||||
<File RelativePath="..\..\..\demos\gtk-demo\headerbar.c" />
|
||||
<File RelativePath="..\..\..\demos\gtk-demo\hypertext.c" />
|
||||
<File RelativePath="..\..\..\demos\gtk-demo\iconview.c" />
|
||||
@@ -204,6 +205,7 @@
|
||||
<File RelativePath="..\..\..\demos\gtk-demo\rotated_text.c" />
|
||||
<File RelativePath="..\..\..\demos\gtk-demo\search_entry.c" />
|
||||
<File RelativePath="..\..\..\demos\gtk-demo\search_entry2.c" />
|
||||
<File RelativePath="..\..\..\demos\gtk-demo\sidebar.c" />
|
||||
<File RelativePath="..\..\..\demos\gtk-demo\sizegroup.c" />
|
||||
<File RelativePath="..\..\..\demos\gtk-demo\spinner.c" />
|
||||
<File RelativePath="..\..\..\demos\gtk-demo\stack.c" />
|
||||
|
||||
+49
-7
@@ -9,9 +9,9 @@
|
||||
# set GTK_BINARY_AGE and GTK_INTERFACE_AGE to 0.
|
||||
|
||||
m4_define([gtk_major_version], [3])
|
||||
m4_define([gtk_minor_version], [14])
|
||||
m4_define([gtk_minor_version], [15])
|
||||
m4_define([gtk_micro_version], [1])
|
||||
m4_define([gtk_interface_age], [1])
|
||||
m4_define([gtk_interface_age], [0])
|
||||
m4_define([gtk_binary_age],
|
||||
[m4_eval(100 * gtk_minor_version + gtk_micro_version)])
|
||||
m4_define([gtk_version],
|
||||
@@ -41,13 +41,14 @@ AC_CANONICAL_HOST
|
||||
m4_define([gtk_binary_version], [3.0.0])
|
||||
|
||||
# required versions of other packages
|
||||
m4_define([glib_required_version], [2.41.2])
|
||||
m4_define([glib_required_version], [2.43.0])
|
||||
m4_define([pango_required_version], [1.36.7])
|
||||
m4_define([atk_required_version], [2.12.0])
|
||||
m4_define([cairo_required_version], [1.12.0])
|
||||
m4_define([gdk_pixbuf_required_version], [2.30.0])
|
||||
m4_define([introspection_required_version], [1.39.0])
|
||||
m4_define([wayland_required_version], [1.5.91])
|
||||
m4_define([epoxy_required_version], [1.0])
|
||||
GLIB_REQUIRED_VERSION=glib_required_version
|
||||
PANGO_REQUIRED_VERSION=pango_required_version
|
||||
ATK_REQUIRED_VERSION=atk_required_version
|
||||
@@ -329,6 +330,10 @@ AC_ARG_ENABLE(wayland-backend,
|
||||
[AS_HELP_STRING([--enable-wayland-backend],
|
||||
[enable the wayland gdk backend])],
|
||||
[backend_set=yes])
|
||||
AC_ARG_ENABLE(mir-backend,
|
||||
[AS_HELP_STRING([--enable-mir-backend],
|
||||
[enable the Mir gdk backend])],
|
||||
[backend_set=yes])
|
||||
|
||||
if test -z "$backend_set"; then
|
||||
if test "$platform_win32" = yes; then
|
||||
@@ -336,6 +341,7 @@ if test -z "$backend_set"; then
|
||||
else
|
||||
enable_x11_backend=yes
|
||||
enable_wayland_backend=maybe
|
||||
enable_mir_backend=no
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -349,7 +355,8 @@ backend_immodules=
|
||||
have_gio_unix=no
|
||||
GDK_BACKENDS=
|
||||
GDK_EXTRA_LIBS=
|
||||
GDK_EXTRA_CFLAGS=
|
||||
# expoxy.pc has Cflags: -I${includedir}, but pkg-config swallows that :-(
|
||||
GDK_EXTRA_CFLAGS="-I${prefix}/include"
|
||||
GDK_WINDOWING=
|
||||
PANGO_PACKAGES="pango pangocairo"
|
||||
|
||||
@@ -426,7 +433,7 @@ fi
|
||||
|
||||
PKG_PROG_PKG_CONFIG
|
||||
|
||||
WAYLAND_DEPENDENCIES="wayland-client >= wayland_required_version xkbcommon >= 0.2.0 wayland-cursor >= wayland_required_version"
|
||||
WAYLAND_DEPENDENCIES="wayland-client >= wayland_required_version xkbcommon >= 0.2.0 wayland-cursor >= wayland_required_version wayland-egl"
|
||||
if test "$enable_wayland_backend" = "maybe" ; then
|
||||
AC_PATH_PROG([WAYLAND_SCANNER],[wayland-scanner],[no])
|
||||
PKG_CHECK_EXISTS($WAYLAND_DEPENDENCIES, [have_wayland_deps=yes], [have_wayland_deps=no])
|
||||
@@ -457,6 +464,30 @@ else
|
||||
AM_CONDITIONAL(USE_WAYLAND, false)
|
||||
fi
|
||||
|
||||
MIR_DEPENDENCIES="mirclient"
|
||||
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])
|
||||
if test "$have_mir_deps" = "no" ; then
|
||||
enable_mir_backend=no
|
||||
else
|
||||
enable_mir_backend=yes
|
||||
fi
|
||||
AC_MSG_RESULT($enable_mir_backend)
|
||||
fi
|
||||
|
||||
if test "$enable_mir_backend" = "yes"; then
|
||||
cairo_backends="$cairo_backends cairo"
|
||||
GDK_BACKENDS="$GDK_BACKENDS mir"
|
||||
GDK_WINDOWING="$GDK_WINDOWING
|
||||
#define GDK_WINDOWING_MIR"
|
||||
MIR_PACKAGES="$MIR_DEPENDENCIES"
|
||||
|
||||
AM_CONDITIONAL(USE_MIR, true)
|
||||
else
|
||||
AM_CONDITIONAL(USE_MIR, false)
|
||||
fi
|
||||
|
||||
# strip leading space
|
||||
GDK_BACKENDS=${GDK_BACKENDS#* }
|
||||
|
||||
@@ -1326,7 +1357,7 @@ CFLAGS="$saved_cflags"
|
||||
LDFLAGS="$saved_ldflags"
|
||||
|
||||
GDK_PACKAGES="$PANGO_PACKAGES gdk-pixbuf-2.0 >= gdk_pixbuf_required_version cairo >= cairo_required_version cairo-gobject >= cairo_required_version"
|
||||
GDK_PRIVATE_PACKAGES="$GDK_GIO_PACKAGE $X_PACKAGES $WAYLAND_PACKAGES $cairo_backends"
|
||||
GDK_PRIVATE_PACKAGES="$GDK_GIO_PACKAGE $X_PACKAGES $WAYLAND_PACKAGES $MIR_PACKAGES $cairo_backends epoxy >= epoxy_required_version"
|
||||
if test "x$enable_x11_backend" = xyes; then
|
||||
GDK_PRIVATE_PACKAGES="$GDK_PRIVATE_PACKAGES pangoft2"
|
||||
fi
|
||||
@@ -1363,7 +1394,7 @@ fi
|
||||
PKG_CHECK_MODULES(ATK, $ATK_PACKAGES)
|
||||
|
||||
GTK_PACKAGES="atk >= atk_required_version cairo >= cairo_required_version cairo-gobject >= cairo_required_version gdk-pixbuf-2.0 >= gdk_pixbuf_required_version gio-2.0 >= glib_required_version"
|
||||
GTK_PRIVATE_PACKAGES="$ATK_PACKAGES"
|
||||
GTK_PRIVATE_PACKAGES="$ATK_PACKAGES $WAYLAND_PACKAGES $MIR_PACKAGES"
|
||||
if test "x$enable_x11_backend" = xyes; then
|
||||
GTK_PRIVATE_PACKAGES="$GTK_PRIVATE_PACKAGES pangoft2"
|
||||
fi
|
||||
@@ -1670,6 +1701,16 @@ if test "$have_colord" = "yes"; then
|
||||
fi
|
||||
AM_CONDITIONAL(HAVE_COLORD, test "x$have_colord" = "xyes")
|
||||
|
||||
##################################################
|
||||
# Check for libcanberra (only used in examples)
|
||||
##################################################
|
||||
|
||||
PKG_CHECK_MODULES(LIBCANBERRA, libcanberra-gtk3,
|
||||
have_libcanberra=yes, have_libcanberra=no)
|
||||
if test "$have_libcanberra" = "yes"; then
|
||||
AC_DEFINE(HAVE_LIBCANBERRA, 1, [define if we have libcanberra])
|
||||
fi
|
||||
|
||||
##################################################
|
||||
# Checks for gtk-doc and docbook-tools
|
||||
##################################################
|
||||
@@ -1903,6 +1944,7 @@ gdk/win32/rc/Makefile
|
||||
gdk/win32/rc/gdk.rc
|
||||
gdk/quartz/Makefile
|
||||
gdk/wayland/Makefile
|
||||
gdk/mir/Makefile
|
||||
gdk/gdkversionmacros.h
|
||||
gtk/Makefile
|
||||
gtk/makefile.msc
|
||||
|
||||
@@ -25,6 +25,7 @@ demos = \
|
||||
event_axes.c \
|
||||
expander.c \
|
||||
gestures.c \
|
||||
glarea.c \
|
||||
headerbar.c \
|
||||
hypertext.c \
|
||||
iconview.c \
|
||||
@@ -48,6 +49,7 @@ demos = \
|
||||
rotated_text.c \
|
||||
search_entry.c \
|
||||
search_entry2.c \
|
||||
sidebar.c \
|
||||
sizegroup.c \
|
||||
spinner.c \
|
||||
stack.c \
|
||||
@@ -73,6 +75,7 @@ LDADDS = \
|
||||
$(top_builddir)/gtk/libgtk-3.la \
|
||||
$(top_builddir)/gdk/libgdk-3.la \
|
||||
$(GTK_DEP_LIBS) \
|
||||
$(GDK_DEP_LIBS) \
|
||||
-lm
|
||||
|
||||
bin_PROGRAMS = gtk3-demo gtk3-demo-application
|
||||
|
||||
@@ -20,12 +20,7 @@ draw_callback (GtkWidget *widget,
|
||||
cairo_t *cr,
|
||||
gpointer data)
|
||||
{
|
||||
GtkStyleContext *context;
|
||||
GdkRGBA rgba;
|
||||
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
gtk_style_context_get_background_color (context, GTK_STATE_FLAG_NORMAL, &rgba);
|
||||
gdk_cairo_set_source_rgba (cr, &rgba);
|
||||
gdk_cairo_set_source_rgba (cr, &color);
|
||||
cairo_paint (cr);
|
||||
|
||||
return TRUE;
|
||||
@@ -39,7 +34,6 @@ response_cb (GtkDialog *dialog,
|
||||
if (response_id == GTK_RESPONSE_OK)
|
||||
{
|
||||
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (dialog), &color);
|
||||
gtk_widget_override_background_color (da, 0, &color);
|
||||
}
|
||||
|
||||
gtk_widget_destroy (GTK_WIDGET (dialog));
|
||||
@@ -105,8 +99,6 @@ do_colorsel (GtkWidget *do_widget)
|
||||
|
||||
/* set a minimum size */
|
||||
gtk_widget_set_size_request (da, 200, 200);
|
||||
/* set the color */
|
||||
gtk_widget_override_background_color (da, 0, &color);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (frame), da);
|
||||
|
||||
|
||||
@@ -259,18 +259,21 @@ G_DEFINE_TYPE_WITH_CODE (MaskEntry, mask_entry, GTK_TYPE_ENTRY,
|
||||
static void
|
||||
mask_entry_set_background (MaskEntry *entry)
|
||||
{
|
||||
static const GdkRGBA error_color = { 1.0, 0.9, 0.9, 1.0 };
|
||||
|
||||
if (entry->mask)
|
||||
{
|
||||
if (!g_regex_match_simple (entry->mask, gtk_entry_get_text (GTK_ENTRY (entry)), 0, 0))
|
||||
{
|
||||
gtk_widget_override_color (GTK_WIDGET (entry), 0, &error_color);
|
||||
PangoAttrList *attrs;
|
||||
|
||||
attrs = pango_attr_list_new ();
|
||||
pango_attr_list_insert (attrs, pango_attr_foreground_new (65535, 32767, 32767));
|
||||
gtk_entry_set_attributes (GTK_ENTRY (entry), attrs);
|
||||
pango_attr_list_unref (attrs);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
gtk_widget_override_color (GTK_WIDGET (entry), 0, NULL);
|
||||
gtk_entry_set_attributes (GTK_ENTRY (entry), NULL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -95,6 +95,7 @@
|
||||
<file>expander.c</file>
|
||||
<file>flowbox.c</file>
|
||||
<file>gestures.c</file>
|
||||
<file>glarea.c</file>
|
||||
<file>headerbar.c</file>
|
||||
<file>hypertext.c</file>
|
||||
<file>iconview.c</file>
|
||||
@@ -118,6 +119,7 @@
|
||||
<file>search_entry.c</file>
|
||||
<file>search_entry2.c</file>
|
||||
<file>sizegroup.c</file>
|
||||
<file>sidebar.c</file>
|
||||
<file>stack.c</file>
|
||||
<file>spinner.c</file>
|
||||
<file>textview.c</file>
|
||||
|
||||
@@ -12,18 +12,31 @@
|
||||
|
||||
static GtkWidget *window = NULL;
|
||||
|
||||
static gboolean
|
||||
draw_color (GtkWidget *drawingarea,
|
||||
cairo_t *cr,
|
||||
const char *color_name)
|
||||
{
|
||||
GdkRGBA rgba;
|
||||
|
||||
if (gdk_rgba_parse (&rgba, color_name))
|
||||
{
|
||||
gdk_cairo_set_source_rgba (cr, &rgba);
|
||||
cairo_paint (cr);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
color_swatch_new (const gchar *color)
|
||||
{
|
||||
GtkWidget *button, *area;
|
||||
GdkRGBA rgba;
|
||||
|
||||
gdk_rgba_parse (&rgba, color);
|
||||
|
||||
button = gtk_button_new ();
|
||||
area = gtk_drawing_area_new ();
|
||||
g_signal_connect (area, "draw", G_CALLBACK (draw_color), (gpointer) color);
|
||||
gtk_widget_set_size_request (area, 24, 24);
|
||||
gtk_widget_override_background_color (area, 0, &rgba);
|
||||
gtk_container_add (GTK_CONTAINER (button), area);
|
||||
gtk_widget_show_all (button);
|
||||
|
||||
|
||||
@@ -0,0 +1,184 @@
|
||||
/* OpenGL Area
|
||||
*
|
||||
* GtkGLArea is a widget that allows custom drawing using OpenGL calls.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <epoxy/gl.h>
|
||||
|
||||
static GtkWidget *demo_window = NULL;
|
||||
|
||||
/* the GtkGLArea widget */
|
||||
static GtkWidget *gl_area = NULL;
|
||||
|
||||
enum {
|
||||
X_AXIS,
|
||||
Y_AXIS,
|
||||
Z_AXIS,
|
||||
|
||||
N_AXIS
|
||||
};
|
||||
|
||||
/* Rotation angles on each axis */
|
||||
static float rotation_angles[N_AXIS] = { 0.0 };
|
||||
|
||||
/* The object we are drawing */
|
||||
static void
|
||||
draw_triangle (void)
|
||||
{
|
||||
glColor3f (1.0f, 0.85f, 0.35f);
|
||||
glBegin (GL_TRIANGLES);
|
||||
{
|
||||
glVertex3f ( 0.0, 0.6, 0.0);
|
||||
glVertex3f (-0.2, -0.3, 0.0);
|
||||
glVertex3f ( 0.2, -0.3, 0.0);
|
||||
}
|
||||
glEnd ();
|
||||
}
|
||||
|
||||
/* The main rendering callback */
|
||||
static gboolean
|
||||
render (GtkGLArea *area,
|
||||
GdkGLContext *context)
|
||||
{
|
||||
glClearColor (0.5, 0.5, 0.5, 1.0);
|
||||
glClear (GL_COLOR_BUFFER_BIT);
|
||||
|
||||
glMatrixMode (GL_MODELVIEW);
|
||||
glLoadIdentity ();
|
||||
glRotatef (rotation_angles[X_AXIS], 1, 0, 0);
|
||||
glRotatef (rotation_angles[Y_AXIS], 0, 1, 0);
|
||||
glRotatef (rotation_angles[Z_AXIS], 0, 0, 1);
|
||||
|
||||
draw_triangle ();
|
||||
|
||||
glFlush ();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
on_axis_value_change (GtkAdjustment *adjustment,
|
||||
gpointer data)
|
||||
{
|
||||
int axis = GPOINTER_TO_INT (data);
|
||||
|
||||
g_assert (axis >= 0 && axis < N_AXIS);
|
||||
|
||||
/* Update the rotation angle */
|
||||
rotation_angles[axis] = gtk_adjustment_get_value (adjustment);
|
||||
|
||||
/* Update the contents of the GL drawing area */
|
||||
gtk_widget_queue_draw (gl_area);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_axis_slider (int axis)
|
||||
{
|
||||
GtkWidget *box, *label, *slider;
|
||||
GtkAdjustment *adj;
|
||||
const char *text;
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE);
|
||||
|
||||
switch (axis)
|
||||
{
|
||||
case X_AXIS:
|
||||
text = "X axis";
|
||||
break;
|
||||
|
||||
case Y_AXIS:
|
||||
text = "Y axis";
|
||||
break;
|
||||
|
||||
case Z_AXIS:
|
||||
text = "Z axis";
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
label = gtk_label_new (text);
|
||||
gtk_container_add (GTK_CONTAINER (box), label);
|
||||
gtk_widget_show (label);
|
||||
|
||||
adj = gtk_adjustment_new (0.0, 0.0, 360.0, 1.0, 12.0, 0.0);
|
||||
g_signal_connect (adj, "value-changed",
|
||||
G_CALLBACK (on_axis_value_change),
|
||||
GINT_TO_POINTER (axis));
|
||||
slider = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, adj);
|
||||
gtk_container_add (GTK_CONTAINER (box), slider);
|
||||
gtk_widget_set_hexpand (slider, TRUE);
|
||||
gtk_widget_show (slider);
|
||||
|
||||
gtk_widget_show (box);
|
||||
|
||||
return box;
|
||||
}
|
||||
|
||||
static void
|
||||
close_window (GtkWidget *widget)
|
||||
{
|
||||
/* Reset the state */
|
||||
demo_window = NULL;
|
||||
gl_area = NULL;
|
||||
|
||||
rotation_angles[X_AXIS] = 0.0;
|
||||
rotation_angles[Y_AXIS] = 0.0;
|
||||
rotation_angles[Z_AXIS] = 0.0;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
create_glarea_window (GtkWidget *do_widget)
|
||||
{
|
||||
GtkWidget *window, *box, *button, *controls;
|
||||
int i;
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_screen (GTK_WINDOW (window), gtk_widget_get_screen (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "GtkGLArea - Golden Triangle");
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 400, 400);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 12);
|
||||
g_signal_connect (window, "destroy", G_CALLBACK (close_window), NULL);
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, FALSE);
|
||||
gtk_box_set_spacing (GTK_BOX (box), 6);
|
||||
gtk_container_add (GTK_CONTAINER (window), box);
|
||||
|
||||
gl_area = gtk_gl_area_new ();
|
||||
gtk_widget_set_hexpand (gl_area, TRUE);
|
||||
gtk_widget_set_vexpand (gl_area, TRUE);
|
||||
gtk_container_add (GTK_CONTAINER (box), gl_area);
|
||||
|
||||
/* the main "draw" call for GtkGLArea */
|
||||
g_signal_connect (gl_area, "render", G_CALLBACK (render), NULL);
|
||||
|
||||
controls = gtk_box_new (GTK_ORIENTATION_VERTICAL, FALSE);
|
||||
gtk_container_add (GTK_CONTAINER (box), controls);
|
||||
gtk_widget_set_hexpand (controls, TRUE);
|
||||
|
||||
for (i = 0; i < N_AXIS; i++)
|
||||
gtk_container_add (GTK_CONTAINER (controls), create_axis_slider (i));
|
||||
|
||||
button = gtk_button_new_with_label ("Quit");
|
||||
gtk_widget_set_hexpand (button, TRUE);
|
||||
gtk_container_add (GTK_CONTAINER (box), button);
|
||||
g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_widget_destroy), window);
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
GtkWidget*
|
||||
do_glarea (GtkWidget *do_widget)
|
||||
{
|
||||
if (demo_window == NULL)
|
||||
demo_window = create_glarea_window (do_widget);
|
||||
|
||||
if (!gtk_widget_get_visible (demo_window))
|
||||
gtk_widget_show_all (demo_window);
|
||||
else
|
||||
gtk_widget_destroy (demo_window);
|
||||
|
||||
return demo_window;
|
||||
}
|
||||
+5
-13
@@ -821,7 +821,6 @@ create_text (GtkWidget **view,
|
||||
{
|
||||
GtkWidget *scrolled_window;
|
||||
GtkWidget *text_view;
|
||||
PangoFontDescription *font_desc;
|
||||
|
||||
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
|
||||
@@ -840,22 +839,15 @@ create_text (GtkWidget **view,
|
||||
|
||||
if (is_source)
|
||||
{
|
||||
font_desc = pango_font_description_from_string ("monospace");
|
||||
gtk_widget_override_font (text_view, font_desc);
|
||||
pango_font_description_free (font_desc);
|
||||
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_view),
|
||||
GTK_WRAP_NONE);
|
||||
gtk_text_view_set_monospace (GTK_TEXT_VIEW (text_view), TRUE);
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_view), GTK_WRAP_NONE);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Make it a bit nicer for text. */
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_view),
|
||||
GTK_WRAP_WORD);
|
||||
gtk_text_view_set_pixels_above_lines (GTK_TEXT_VIEW (text_view),
|
||||
2);
|
||||
gtk_text_view_set_pixels_below_lines (GTK_TEXT_VIEW (text_view),
|
||||
2);
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_view), GTK_WRAP_WORD);
|
||||
gtk_text_view_set_pixels_above_lines (GTK_TEXT_VIEW (text_view), 2);
|
||||
gtk_text_view_set_pixels_below_lines (GTK_TEXT_VIEW (text_view), 2);
|
||||
}
|
||||
|
||||
return scrolled_window;
|
||||
|
||||
+29
-24
@@ -70,36 +70,41 @@
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">0</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="scrolledwindow">
|
||||
<property name="width_request">120</property>
|
||||
<object class="GtkFrame">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hscrollbar_policy">never</property>
|
||||
<property name="shadow_type">none</property>
|
||||
<property name="min_content_width">150</property>
|
||||
<style>
|
||||
<class name="sidebar"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkTreeView" id="treeview">
|
||||
<object class="GtkScrolledWindow" id="scrolledwindow">
|
||||
<property name="width_request">120</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="model">treestore</property>
|
||||
<property name="headers_visible">False</property>
|
||||
<child internal-child="selection">
|
||||
<object class="GtkTreeSelection" id="treeview-selection">
|
||||
<property name="mode">browse</property>
|
||||
</object>
|
||||
</child>
|
||||
<property name="hscrollbar_policy">never</property>
|
||||
<property name="shadow_type">none</property>
|
||||
<property name="min_content_width">150</property>
|
||||
<style>
|
||||
<class name="sidebar"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn" id="treeviewcolumn1">
|
||||
<property name="title" translatable="yes">column</property>
|
||||
<object class="GtkTreeView" id="treeview">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="model">treestore</property>
|
||||
<property name="headers_visible">False</property>
|
||||
<child internal-child="selection">
|
||||
<object class="GtkTreeSelection" id="treeview-selection">
|
||||
<property name="mode">browse</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="cellrenderertext1"/>
|
||||
<attributes>
|
||||
<attribute name="style">4</attribute>
|
||||
<attribute name="text">1</attribute>
|
||||
</attributes>
|
||||
<object class="GtkTreeViewColumn" id="treeviewcolumn1">
|
||||
<property name="title" translatable="yes">column</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="cellrenderertext1"/>
|
||||
<attributes>
|
||||
<attribute name="style">4</attribute>
|
||||
<attribute name="text">1</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
@@ -573,7 +573,6 @@ do_offscreen_window (GtkWidget *do_widget)
|
||||
if (!window)
|
||||
{
|
||||
GtkWidget *bin, *vbox, *scale, *button;
|
||||
GdkRGBA black;
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
@@ -583,8 +582,6 @@ do_offscreen_window (GtkWidget *do_widget)
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
gdk_rgba_parse (&black, "black");
|
||||
gtk_widget_override_background_color (window, 0, &black);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
|
||||
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
|
||||
@@ -181,8 +181,6 @@ do_rotated_text (GtkWidget *do_widget)
|
||||
PangoLayout *layout;
|
||||
PangoAttrList *attrs;
|
||||
|
||||
const GdkRGBA white = { 1.0, 1.0, 1.0, 1.0 };
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
gtk_widget_get_screen (do_widget));
|
||||
@@ -195,18 +193,15 @@ do_rotated_text (GtkWidget *do_widget)
|
||||
gtk_container_add (GTK_CONTAINER (window), box);
|
||||
|
||||
/* Add a drawing area */
|
||||
|
||||
drawing_area = gtk_drawing_area_new ();
|
||||
gtk_container_add (GTK_CONTAINER (box), drawing_area);
|
||||
|
||||
/* This overrides the background color from the theme */
|
||||
gtk_widget_override_background_color (drawing_area, 0, &white);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (drawing_area),
|
||||
GTK_STYLE_CLASS_VIEW);
|
||||
|
||||
g_signal_connect (drawing_area, "draw",
|
||||
G_CALLBACK (rotated_text_draw), NULL);
|
||||
|
||||
/* And a label */
|
||||
|
||||
label = gtk_label_new (text);
|
||||
gtk_container_add (GTK_CONTAINER (box), label);
|
||||
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
/* Sidebar
|
||||
*
|
||||
* GtkSidebar provides an automatic sidebar widget to control navigation
|
||||
* of a GtkStack object. This widget automatically updates it content
|
||||
* based on what is presently available in the GtkStack object, and
|
||||
* using the "title" child property to set the display labels.
|
||||
*/
|
||||
|
||||
#include <glib/gi18n.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static GtkWidget *window = NULL;
|
||||
|
||||
GtkWidget *
|
||||
do_sidebar (GtkWidget *do_widget)
|
||||
{
|
||||
GtkWidget *sidebar;
|
||||
GtkWidget *stack;
|
||||
GtkWidget *box;
|
||||
GtkWidget *widget;
|
||||
GtkWidget *header;
|
||||
const gchar* pages[] = {
|
||||
"Welcome to GTK+",
|
||||
"GtkSidebar Widget",
|
||||
"Automatic navigation",
|
||||
"Consistent appearance",
|
||||
"Scrolling",
|
||||
"Page 6",
|
||||
"Page 7",
|
||||
"Page 8",
|
||||
"Page 9",
|
||||
NULL
|
||||
};
|
||||
const gchar *c = NULL;
|
||||
guint i;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
|
||||
gtk_widget_set_size_request (window, 500, 350);
|
||||
|
||||
header = gtk_header_bar_new ();
|
||||
gtk_header_bar_set_show_close_button (GTK_HEADER_BAR(header), TRUE);
|
||||
gtk_window_set_titlebar (GTK_WINDOW(window), header);
|
||||
gtk_window_set_title (GTK_WINDOW(window), "Sidebar demo");
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
sidebar = gtk_sidebar_new ();
|
||||
gtk_box_pack_start (GTK_BOX (box), sidebar, FALSE, FALSE, 0);
|
||||
|
||||
stack = gtk_stack_new ();
|
||||
gtk_stack_set_transition_type (GTK_STACK (stack), GTK_STACK_TRANSITION_TYPE_SLIDE_UP_DOWN);
|
||||
gtk_sidebar_set_stack (GTK_SIDEBAR (sidebar), GTK_STACK (stack));
|
||||
|
||||
/* Separator between sidebar and stack */
|
||||
widget = gtk_separator_new (GTK_ORIENTATION_VERTICAL);
|
||||
gtk_box_pack_start (GTK_BOX(box), widget, FALSE, FALSE, 0);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (box), stack, TRUE, TRUE, 0);
|
||||
|
||||
for (i=0; (c = *(pages+i)) != NULL; i++ )
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
widget = gtk_image_new_from_icon_name ("help-about", GTK_ICON_SIZE_MENU);
|
||||
gtk_image_set_pixel_size (GTK_IMAGE (widget), 256);
|
||||
}
|
||||
else
|
||||
{
|
||||
widget = gtk_label_new (c);
|
||||
}
|
||||
gtk_stack_add_named (GTK_STACK (stack), widget, c);
|
||||
gtk_container_child_set (GTK_CONTAINER (stack), widget, "title", c, NULL);
|
||||
}
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (window), box);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
gtk_widget_show_all (window);
|
||||
else
|
||||
gtk_widget_destroy (window);
|
||||
|
||||
return window;
|
||||
}
|
||||
@@ -539,26 +539,18 @@ recursive_attach_view (int depth,
|
||||
GtkTextView *view,
|
||||
GtkTextChildAnchor *anchor)
|
||||
{
|
||||
GtkWidget *child_view;
|
||||
GtkWidget *event_box;
|
||||
GdkRGBA color;
|
||||
GtkWidget *child_view, *frame;
|
||||
|
||||
if (depth > 4)
|
||||
return;
|
||||
|
||||
child_view = gtk_text_view_new_with_buffer (gtk_text_view_get_buffer (view));
|
||||
|
||||
/* Event box is to add a black border around each child view */
|
||||
event_box = gtk_event_box_new ();
|
||||
gdk_rgba_parse (&color, "black");
|
||||
gtk_widget_override_background_color (event_box, 0, &color);
|
||||
/* Frame is to add a black border around each child view */
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_container_add (GTK_CONTAINER (frame), child_view);
|
||||
|
||||
gtk_widget_set_halign (child_view, GTK_ALIGN_FILL);
|
||||
gtk_widget_set_valign (child_view, GTK_ALIGN_FILL);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (event_box), child_view);
|
||||
|
||||
gtk_text_view_add_child_at_anchor (view, event_box, anchor);
|
||||
gtk_text_view_add_child_at_anchor (view, frame, anchor);
|
||||
|
||||
recursive_attach_view (depth + 1, GTK_TEXT_VIEW (child_view), anchor);
|
||||
}
|
||||
|
||||
@@ -190,7 +190,6 @@ do_transparent (GtkWidget *do_widget)
|
||||
GtkWidget *sw;
|
||||
GtkWidget *overlay;
|
||||
GtkWidget *entry;
|
||||
GdkRGBA transparent = {0, 0, 0, 0};
|
||||
GtkCssProvider *provider;
|
||||
gchar *css;
|
||||
|
||||
@@ -218,8 +217,6 @@ do_transparent (GtkWidget *do_widget)
|
||||
gtk_container_add (GTK_CONTAINER (overlay), sw);
|
||||
gtk_container_add (GTK_CONTAINER (window), overlay);
|
||||
|
||||
gtk_widget_override_background_color (overlay, 0, &transparent);
|
||||
|
||||
entry = gtk_entry_new ();
|
||||
provider = gtk_css_provider_new ();
|
||||
css = g_strdup_printf ("* { border-width: 0px %dpx %dpx 0px; }",
|
||||
|
||||
@@ -18,12 +18,14 @@ gtk3_widget_factory_DEPENDENCIES = \
|
||||
gtk3_widget_factory_CPPFLAGS = \
|
||||
-I$(top_srcdir) \
|
||||
$(GTK_DEBUG_FLAGS) \
|
||||
$(GTK_DEP_CFLAGS)
|
||||
$(GTK_DEP_CFLAGS) \
|
||||
$(LIBCANBERRA_CFLAGS)
|
||||
|
||||
gtk3_widget_factory_LDADD = \
|
||||
$(top_builddir)/gdk/libgdk-3.la \
|
||||
$(top_builddir)/gtk/libgtk-3.la \
|
||||
$(GTK_DEP_LIBS)
|
||||
$(GTK_DEP_LIBS) \
|
||||
$(LIBCANBERRA_LIBS)
|
||||
|
||||
widget_factory_resources.c: widget-factory.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/widget-factory.gresource.xml)
|
||||
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate-source $<
|
||||
|
||||
@@ -19,7 +19,12 @@
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib/gi18n.h>
|
||||
#include <gtk/gtk.h>
|
||||
#ifdef HAVE_LIBCANBERRA
|
||||
#include <canberra-gtk.h>
|
||||
#endif
|
||||
|
||||
static void
|
||||
change_theme_state (GSimpleAction *action,
|
||||
@@ -234,7 +239,134 @@ on_entry_icon_release (GtkEntry *entry,
|
||||
pulse_it (GTK_WIDGET (entry));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define EPSILON (1e-10)
|
||||
|
||||
static gboolean
|
||||
on_scale_button_query_tooltip (GtkWidget *button,
|
||||
gint x,
|
||||
gint y,
|
||||
gboolean keyboard_mode,
|
||||
GtkTooltip *tooltip,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkScaleButton *scale_button = GTK_SCALE_BUTTON (button);
|
||||
GtkAdjustment *adjustment;
|
||||
gdouble val;
|
||||
gchar *str;
|
||||
AtkImage *image;
|
||||
|
||||
image = ATK_IMAGE (gtk_widget_get_accessible (button));
|
||||
|
||||
adjustment = gtk_scale_button_get_adjustment (scale_button);
|
||||
val = gtk_scale_button_get_value (scale_button);
|
||||
|
||||
if (val < (gtk_adjustment_get_lower (adjustment) + EPSILON))
|
||||
{
|
||||
str = g_strdup (_("Muted"));
|
||||
}
|
||||
else if (val >= (gtk_adjustment_get_upper (adjustment) - EPSILON))
|
||||
{
|
||||
str = g_strdup (_("Full Volume"));
|
||||
}
|
||||
else
|
||||
{
|
||||
gint percent;
|
||||
|
||||
percent = (gint) (100. * val / (gtk_adjustment_get_upper (adjustment) - gtk_adjustment_get_lower (adjustment)) + .5);
|
||||
|
||||
str = g_strdup_printf (C_("volume percentage", "%d %%"), percent);
|
||||
}
|
||||
|
||||
gtk_tooltip_set_text (tooltip, str);
|
||||
atk_image_set_image_description (image, str);
|
||||
g_free (str);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
on_scale_button_value_changed (GtkScaleButton *button,
|
||||
gdouble value,
|
||||
gpointer user_data)
|
||||
{
|
||||
gtk_widget_trigger_tooltip_query (GTK_WIDGET (button));
|
||||
}
|
||||
|
||||
static void
|
||||
on_record_button_toggled (GtkToggleButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkStyleContext *context;
|
||||
|
||||
context = gtk_widget_get_style_context (GTK_WIDGET (button));
|
||||
if (gtk_toggle_button_get_active (button))
|
||||
gtk_style_context_remove_class (context, "destructive-action");
|
||||
else
|
||||
gtk_style_context_add_class (context, "destructive-action");
|
||||
}
|
||||
|
||||
static void
|
||||
on_page_combo_changed (GtkComboBox *combo,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkWidget *from;
|
||||
GtkWidget *to;
|
||||
|
||||
from = GTK_WIDGET (g_object_get_data (G_OBJECT (combo), "range_from_spin"));
|
||||
to = GTK_WIDGET (g_object_get_data (G_OBJECT (combo), "range_to_spin"));
|
||||
|
||||
switch (gtk_combo_box_get_active (combo))
|
||||
{
|
||||
case 0: /* Range */
|
||||
gtk_widget_set_sensitive (from, TRUE);
|
||||
gtk_widget_set_sensitive (to, TRUE);
|
||||
break;
|
||||
case 1: /* All */
|
||||
gtk_widget_set_sensitive (from, FALSE);
|
||||
gtk_widget_set_sensitive (to, FALSE);
|
||||
gtk_spin_button_set_value (GTK_SPIN_BUTTON (from), 1);
|
||||
gtk_spin_button_set_value (GTK_SPIN_BUTTON (to), 99);
|
||||
break;
|
||||
case 2: /* Current */
|
||||
gtk_widget_set_sensitive (from, FALSE);
|
||||
gtk_widget_set_sensitive (to, FALSE);
|
||||
gtk_spin_button_set_value (GTK_SPIN_BUTTON (from), 7);
|
||||
gtk_spin_button_set_value (GTK_SPIN_BUTTON (to), 7);
|
||||
break;
|
||||
default:;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
on_range_from_changed (GtkSpinButton *from)
|
||||
{
|
||||
GtkSpinButton *to;
|
||||
gint v1, v2;
|
||||
|
||||
to = GTK_SPIN_BUTTON (g_object_get_data (G_OBJECT (from), "range_to_spin"));
|
||||
|
||||
v1 = gtk_spin_button_get_value_as_int (from);
|
||||
v2 = gtk_spin_button_get_value_as_int (to);
|
||||
|
||||
if (v1 > v2)
|
||||
gtk_spin_button_set_value (to, v1);
|
||||
}
|
||||
|
||||
static void
|
||||
on_range_to_changed (GtkSpinButton *to)
|
||||
{
|
||||
GtkSpinButton *from;
|
||||
gint v1, v2;
|
||||
|
||||
from = GTK_SPIN_BUTTON (g_object_get_data (G_OBJECT (to), "range_from_spin"));
|
||||
|
||||
v1 = gtk_spin_button_get_value_as_int (from);
|
||||
v2 = gtk_spin_button_get_value_as_int (to);
|
||||
|
||||
if (v1 > v2)
|
||||
gtk_spin_button_set_value (from, v2);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -446,6 +578,82 @@ update_title_header (GtkListBoxRow *row,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
overshot (GtkScrolledWindow *sw, GtkPositionType pos, GtkWidget *widget)
|
||||
{
|
||||
GtkWidget *box, *row, *label, *swatch;
|
||||
GdkRGBA rgba;
|
||||
const gchar *color;
|
||||
gchar *text;
|
||||
GtkWidget *silver;
|
||||
GtkWidget *gold;
|
||||
|
||||
silver = GTK_WIDGET (g_object_get_data (G_OBJECT (widget), "Silver"));
|
||||
gold = GTK_WIDGET (g_object_get_data (G_OBJECT (widget), "Gold"));
|
||||
|
||||
if (pos == GTK_POS_TOP)
|
||||
{
|
||||
if (silver)
|
||||
{
|
||||
gtk_container_remove (GTK_CONTAINER (widget), silver);
|
||||
g_object_set_data (G_OBJECT (widget), "Silver", NULL);
|
||||
}
|
||||
if (gold)
|
||||
{
|
||||
gtk_container_remove (GTK_CONTAINER (widget), gold);
|
||||
g_object_set_data (G_OBJECT (widget), "Gold", NULL);
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBCANBERRA
|
||||
if (silver || gold)
|
||||
ca_gtk_play_for_widget (widget, 0, "event.id", "message", NULL);
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (gold)
|
||||
return;
|
||||
else if (silver)
|
||||
color = "Gold";
|
||||
else
|
||||
color = "Silver";
|
||||
|
||||
row = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 20);
|
||||
text = g_strconcat ("<b>", color, "</b>", NULL);
|
||||
label = gtk_label_new (text);
|
||||
g_free (text);
|
||||
g_object_set (label,
|
||||
"use-markup", TRUE,
|
||||
"halign", GTK_ALIGN_START,
|
||||
"valign", GTK_ALIGN_CENTER,
|
||||
"margin", 6,
|
||||
"xalign", 0.0,
|
||||
NULL);
|
||||
gtk_box_pack_start (GTK_BOX (row), label, TRUE, TRUE, 0);
|
||||
gdk_rgba_parse (&rgba, color);
|
||||
swatch = g_object_new (g_type_from_name ("GtkColorSwatch"),
|
||||
"rgba", &rgba,
|
||||
"selectable", FALSE,
|
||||
"halign", GTK_ALIGN_END,
|
||||
"valign", GTK_ALIGN_CENTER,
|
||||
"margin", 6,
|
||||
"height-request", 24,
|
||||
NULL);
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
gtk_container_add (GTK_CONTAINER (box), swatch);
|
||||
gtk_box_pack_start (GTK_BOX (row), box, FALSE, FALSE, 0);
|
||||
gtk_widget_show_all (row);
|
||||
gtk_list_box_insert (GTK_LIST_BOX (widget), row, -1);
|
||||
row = gtk_widget_get_parent (row);
|
||||
gtk_list_box_row_set_activatable (GTK_LIST_BOX_ROW (row), FALSE);
|
||||
g_object_set_data (G_OBJECT (widget), color, row);
|
||||
#ifdef HAVE_LIBCANBERRA
|
||||
ca_gtk_play_for_widget (widget, 0, "event.id", "complete", NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
populate_colors (GtkWidget *widget)
|
||||
{
|
||||
@@ -493,6 +701,7 @@ populate_colors (GtkWidget *widget)
|
||||
};
|
||||
gint i;
|
||||
GtkWidget *row, *box, *label, *swatch;
|
||||
GtkWidget *sw;
|
||||
GdkRGBA rgba;
|
||||
|
||||
gtk_list_box_set_header_func (GTK_LIST_BOX (widget), update_title_header, NULL, NULL);
|
||||
@@ -529,6 +738,9 @@ populate_colors (GtkWidget *widget)
|
||||
}
|
||||
|
||||
gtk_list_box_invalidate_headers (GTK_LIST_BOX (widget));
|
||||
|
||||
sw = gtk_widget_get_ancestor (widget, GTK_TYPE_SCROLLED_WINDOW);
|
||||
g_signal_connect (sw, "edge-overshot", G_CALLBACK (overshot), widget);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
@@ -788,6 +1000,79 @@ toggle_selection_mode (GtkSwitch *sw,
|
||||
gtk_list_box_set_activate_on_single_click (listbox, !gtk_switch_get_active (sw));
|
||||
}
|
||||
|
||||
static void
|
||||
handle_insert (GtkWidget *button, GtkWidget *textview)
|
||||
{
|
||||
GtkTextBuffer *buffer;
|
||||
const gchar *id;
|
||||
const gchar *text;
|
||||
|
||||
id = gtk_buildable_get_name (GTK_BUILDABLE (button));
|
||||
|
||||
if (strcmp (id, "toolbutton1") == 0)
|
||||
text = "⌘";
|
||||
else if (strcmp (id, "toolbutton2") == 0)
|
||||
text = "⚽";
|
||||
else if (strcmp (id, "toolbutton3") == 0)
|
||||
text = "⤢";
|
||||
else if (strcmp (id, "toolbutton4") == 0)
|
||||
text = "☆";
|
||||
else
|
||||
text = "";
|
||||
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (textview));
|
||||
gtk_text_buffer_insert_at_cursor (buffer, text, -1);
|
||||
}
|
||||
|
||||
static void
|
||||
handle_cutcopypaste (GtkWidget *button, GtkWidget *textview)
|
||||
{
|
||||
GtkTextBuffer *buffer;
|
||||
GtkClipboard *clipboard;
|
||||
const gchar *id;
|
||||
|
||||
clipboard = gtk_widget_get_clipboard (textview, GDK_SELECTION_CLIPBOARD);
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (textview));
|
||||
id = gtk_buildable_get_name (GTK_BUILDABLE (button));
|
||||
|
||||
if (strcmp (id, "cutbutton") == 0)
|
||||
gtk_text_buffer_cut_clipboard (buffer, clipboard, TRUE);
|
||||
else if (strcmp (id, "copybutton") == 0)
|
||||
gtk_text_buffer_copy_clipboard (buffer, clipboard);
|
||||
else if (strcmp (id, "pastebutton") == 0)
|
||||
gtk_text_buffer_paste_clipboard (buffer, clipboard, NULL, TRUE);
|
||||
else if (strcmp (id, "deletebutton") == 0)
|
||||
gtk_text_buffer_delete_selection (buffer, TRUE, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
clipboard_owner_change (GtkClipboard *clipboard, GdkEvent *event, GtkWidget *button)
|
||||
{
|
||||
const gchar *id;
|
||||
gboolean has_text;
|
||||
|
||||
id = gtk_buildable_get_name (GTK_BUILDABLE (button));
|
||||
has_text = gtk_clipboard_wait_is_text_available (clipboard);
|
||||
|
||||
if (strcmp (id, "pastebutton") == 0)
|
||||
gtk_widget_set_sensitive (button, has_text);
|
||||
}
|
||||
|
||||
static void
|
||||
textbuffer_notify_selection (GObject *object, GParamSpec *pspec, GtkWidget *button)
|
||||
{
|
||||
const gchar *id;
|
||||
gboolean has_selection;
|
||||
|
||||
id = gtk_buildable_get_name (GTK_BUILDABLE (button));
|
||||
has_selection = gtk_text_buffer_get_has_selection (GTK_TEXT_BUFFER (object));
|
||||
|
||||
if (strcmp (id, "cutbutton") == 0 ||
|
||||
strcmp (id, "copybutton") == 0 ||
|
||||
strcmp (id, "deletebutton") == 0)
|
||||
gtk_widget_set_sensitive (button, has_selection);
|
||||
}
|
||||
|
||||
static void
|
||||
activate (GApplication *app)
|
||||
{
|
||||
@@ -795,9 +1080,11 @@ activate (GApplication *app)
|
||||
GtkWindow *window;
|
||||
GtkWidget *widget;
|
||||
GtkWidget *widget2;
|
||||
GtkWidget *widget3;
|
||||
GtkWidget *stack;
|
||||
GtkWidget *dialog;
|
||||
GtkAdjustment *adj;
|
||||
GtkCssProvider *provider;
|
||||
static GActionEntry win_entries[] = {
|
||||
{ "dark", NULL, NULL, "false", change_theme_state },
|
||||
{ "search", activate_search, NULL, NULL, NULL },
|
||||
@@ -817,8 +1104,22 @@ activate (GApplication *app)
|
||||
|
||||
g_type_ensure (my_text_view_get_type ());
|
||||
|
||||
provider = gtk_css_provider_new ();
|
||||
gtk_css_provider_load_from_data (provider, ".circular-button { border-radius: 20px; outline-radius: 20px; }", -1, NULL);
|
||||
gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
|
||||
GTK_STYLE_PROVIDER (provider),
|
||||
GTK_STYLE_PROVIDER_PRIORITY_USER);
|
||||
g_object_unref (provider);
|
||||
|
||||
builder = gtk_builder_new_from_resource ("/org/gtk/WidgetFactory/widget-factory.ui");
|
||||
gtk_builder_add_callback_symbol (builder, "on_entry_icon_release", (GCallback)on_entry_icon_release);
|
||||
gtk_builder_add_callback_symbol (builder, "on_scale_button_value_changed", (GCallback)on_scale_button_value_changed);
|
||||
gtk_builder_add_callback_symbol (builder, "on_scale_button_query_tooltip", (GCallback)on_scale_button_query_tooltip);
|
||||
gtk_builder_add_callback_symbol (builder, "on_record_button_toggled", (GCallback)on_record_button_toggled);
|
||||
gtk_builder_add_callback_symbol (builder, "on_page_combo_changed", (GCallback)on_page_combo_changed);
|
||||
gtk_builder_add_callback_symbol (builder, "on_range_from_changed", (GCallback)on_range_from_changed);
|
||||
gtk_builder_add_callback_symbol (builder, "on_range_to_changed", (GCallback)on_range_to_changed);
|
||||
|
||||
gtk_builder_connect_signals (builder, NULL);
|
||||
|
||||
window = (GtkWindow *)gtk_builder_get_object (builder, "window");
|
||||
@@ -924,12 +1225,47 @@ activate (GApplication *app)
|
||||
|
||||
populate_colors ((GtkWidget *)gtk_builder_get_object (builder, "munsell"));
|
||||
|
||||
widget = (GtkWidget *)gtk_builder_get_object (builder, "page_combo");
|
||||
widget2 = (GtkWidget *)gtk_builder_get_object (builder, "range_from_spin");
|
||||
widget3 = (GtkWidget *)gtk_builder_get_object (builder, "range_to_spin");
|
||||
g_object_set_data (G_OBJECT (widget), "range_from_spin", widget2);
|
||||
g_object_set_data (G_OBJECT (widget3), "range_from_spin", widget2);
|
||||
g_object_set_data (G_OBJECT (widget), "range_to_spin", widget3);
|
||||
g_object_set_data (G_OBJECT (widget2), "range_to_spin", widget3);
|
||||
|
||||
set_accel (GTK_APPLICATION (app), GTK_WIDGET (gtk_builder_get_object (builder, "quitmenuitem")));
|
||||
set_accel (GTK_APPLICATION (app), GTK_WIDGET (gtk_builder_get_object (builder, "deletemenuitem")));
|
||||
set_accel (GTK_APPLICATION (app), GTK_WIDGET (gtk_builder_get_object (builder, "searchmenuitem")));
|
||||
set_accel (GTK_APPLICATION (app), GTK_WIDGET (gtk_builder_get_object (builder, "darkmenuitem")));
|
||||
set_accel (GTK_APPLICATION (app), GTK_WIDGET (gtk_builder_get_object (builder, "aboutmenuitem")));
|
||||
|
||||
widget2 = (GtkWidget *)gtk_builder_get_object (builder, "tooltextview");
|
||||
|
||||
widget = (GtkWidget *)gtk_builder_get_object (builder, "toolbutton1");
|
||||
g_signal_connect (widget, "clicked", G_CALLBACK (handle_insert), widget2);
|
||||
widget = (GtkWidget *)gtk_builder_get_object (builder, "toolbutton2");
|
||||
g_signal_connect (widget, "clicked", G_CALLBACK (handle_insert), widget2);
|
||||
widget = (GtkWidget *)gtk_builder_get_object (builder, "toolbutton3");
|
||||
g_signal_connect (widget, "clicked", G_CALLBACK (handle_insert), widget2);
|
||||
widget = (GtkWidget *)gtk_builder_get_object (builder, "toolbutton4");
|
||||
g_signal_connect (widget, "clicked", G_CALLBACK (handle_insert), widget2);
|
||||
widget = (GtkWidget *)gtk_builder_get_object (builder, "cutbutton");
|
||||
g_signal_connect (widget, "clicked", G_CALLBACK (handle_cutcopypaste), widget2);
|
||||
g_signal_connect (gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget2)), "notify::has-selection",
|
||||
G_CALLBACK (textbuffer_notify_selection), widget);
|
||||
widget = (GtkWidget *)gtk_builder_get_object (builder, "copybutton");
|
||||
g_signal_connect (widget, "clicked", G_CALLBACK (handle_cutcopypaste), widget2);
|
||||
g_signal_connect (gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget2)), "notify::has-selection",
|
||||
G_CALLBACK (textbuffer_notify_selection), widget);
|
||||
widget = (GtkWidget *)gtk_builder_get_object (builder, "deletebutton");
|
||||
g_signal_connect (widget, "clicked", G_CALLBACK (handle_cutcopypaste), widget2);
|
||||
g_signal_connect (gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget2)), "notify::has-selection",
|
||||
G_CALLBACK (textbuffer_notify_selection), widget);
|
||||
widget = (GtkWidget *)gtk_builder_get_object (builder, "pastebutton");
|
||||
g_signal_connect (widget, "clicked", G_CALLBACK (handle_cutcopypaste), widget2);
|
||||
g_signal_connect (gtk_widget_get_clipboard (widget2, GDK_SELECTION_CLIPBOARD), "owner-change",
|
||||
G_CALLBACK (clipboard_owner_change), widget);
|
||||
|
||||
gtk_widget_show_all (GTK_WIDGET (window));
|
||||
|
||||
g_object_unref (builder);
|
||||
|
||||
@@ -93,6 +93,20 @@
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">10</property>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="pg_adjustment">
|
||||
<property name="upper">99</property>
|
||||
<property name="lower">1</property>
|
||||
<property name="value">2</property>
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">10</property>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="pg_adjustment2">
|
||||
<property name="upper">99</property>
|
||||
<property name="lower">1</property>
|
||||
<property name="value">4</property>
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">10</property>
|
||||
</object>
|
||||
<object class="GtkListStore" id="liststore1">
|
||||
<columns>
|
||||
<!-- column-name Cool -->
|
||||
@@ -2053,6 +2067,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus. </property>
|
||||
<property name="visible">True</property>
|
||||
<property name="row-spacing">6</property>
|
||||
<property name="column-spacing">6</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<child>
|
||||
<object class="GtkVolumeButton">
|
||||
@@ -2069,13 +2084,19 @@ Suspendisse feugiat quam quis dolor accumsan cursus. </property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkVolumeButton">
|
||||
<object class="GtkScaleButton" id="mic-button">
|
||||
<property name="visible">True</property>
|
||||
<property name="has-tooltip">True</property>
|
||||
<property name="orientation">horizontal</property>
|
||||
<property name="icons">microphone-sensitivity-muted-symbolic
|
||||
microphone-sensitivity-high-symbolic
|
||||
microphone-sensitivity-low-symbolic
|
||||
microphone-sensitivity-medium-symbolic</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="use-symbolic">True</property>
|
||||
<property name="value">.5</property>
|
||||
<property name="halign">center</property>
|
||||
<signal name="query-tooltip" handler="on_scale_button_query_tooltip" swapped="no"/>
|
||||
<signal name="value-changed" handler="on_scale_button_value_changed" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
@@ -2083,9 +2104,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus. </property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
@@ -3192,6 +3210,568 @@ Suspendisse feugiat quam quis dolor accumsan cursus. </property>
|
||||
<property name="orientation">vertical</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">horizontal</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="visible">True</property>
|
||||
<property name="halign">center</property>
|
||||
<style>
|
||||
<class name="text-button"/>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">horizontal</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="label">Open</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="icon_name">pan-down-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="record_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="halign">center</property>
|
||||
<signal name="toggled" handler="on_record_button_toggled"/>
|
||||
<style>
|
||||
<class name="text-button"/>
|
||||
<class name="image-button"/>
|
||||
<class name="destructive-action"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">horizontal</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="icon_name">media-record-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="label">Record</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">horizontal</property>
|
||||
<style>
|
||||
<class name="linked"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="grid_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="draw-indicator">False</property>
|
||||
<property name="active">True</property>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="icon-size">1</property>
|
||||
<property name="icon-name">view-grid-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="list_button">
|
||||
<property name="active">True</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="draw-indicator">False</property>
|
||||
<property name="group">grid_button</property>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="icon-size">1</property>
|
||||
<property name="icon-name">view-list-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="visible">True</property>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
<class name="circular-button"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="icon-size">1</property>
|
||||
<property name="icon-name">emblem-system-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparator">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">horizontal</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFrame">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">horizontal</property>
|
||||
<child>
|
||||
<object class="GtkSidebar">
|
||||
<property name="visible">True</property>
|
||||
<property name="stack">sidebar_stack</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStack" id="sidebar_stack">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="margin">20</property>
|
||||
<property name="spacing">10</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<child>
|
||||
<object class="GtkEntry">
|
||||
<property name="visible">True</property>
|
||||
<property name="placeholder-text">First Name</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry">
|
||||
<property name="visible">True</property>
|
||||
<property name="placeholder-text">Last Name</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="name">id</property>
|
||||
<property name="title">Identity</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="margin">20</property>
|
||||
<property name="spacing">10</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">horizontal</property>
|
||||
<property name="spacing">2</property>
|
||||
<child>
|
||||
<object class="GtkComboBoxText">
|
||||
<property name="visible">True</property>
|
||||
<property name="active">9</property>
|
||||
<items>
|
||||
<item>1</item>
|
||||
<item>2</item>
|
||||
<item>3</item>
|
||||
<item>4</item>
|
||||
<item>5</item>
|
||||
<item>6</item>
|
||||
<item>7</item>
|
||||
<item>8</item>
|
||||
<item>9</item>
|
||||
<item>10</item>
|
||||
<item>11</item>
|
||||
<item>12</item>
|
||||
<item>13</item>
|
||||
<item>14</item>
|
||||
<item>15</item>
|
||||
<item>16</item>
|
||||
<item>17</item>
|
||||
<item>18</item>
|
||||
<item>19</item>
|
||||
<item>20</item>
|
||||
<item>21</item>
|
||||
<item>22</item>
|
||||
<item>23</item>
|
||||
<item>24</item>
|
||||
<item>25</item>
|
||||
<item>26</item>
|
||||
<item>27</item>
|
||||
<item>28</item>
|
||||
<item>29</item>
|
||||
<item>30</item>
|
||||
<item>31</item>
|
||||
</items>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText">
|
||||
<property name="visible">True</property>
|
||||
<property name="active">9</property>
|
||||
<items>
|
||||
<item>January</item>
|
||||
<item>February</item>
|
||||
<item>March</item>
|
||||
<item>April</item>
|
||||
<item>May</item>
|
||||
<item>June</item>
|
||||
<item>July</item>
|
||||
<item>August</item>
|
||||
<item>September</item>
|
||||
<item>October</item>
|
||||
<item>November</item>
|
||||
<item>December</item>
|
||||
</items>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry">
|
||||
<property name="visible">True</property>
|
||||
<property name="placeholder-text">Year</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="name">bd</property>
|
||||
<property name="title">Birthdate</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="margin">20</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<style>
|
||||
<class name="linked"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkEntry">
|
||||
<property name="visible">True</property>
|
||||
<property name="placeholder-text">Street</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry">
|
||||
<property name="visible">True</property>
|
||||
<property name="placeholder-text">City</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry">
|
||||
<property name="visible">True</property>
|
||||
<property name="placeholder-text">Province</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="name">ad</property>
|
||||
<property name="title">Address</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="margin">20</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<style>
|
||||
<class name="linked"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="page_combo">
|
||||
<property name="visible">True</property>
|
||||
<property name="active">0</property>
|
||||
<signal name="changed" handler="on_page_combo_changed"/>
|
||||
<items>
|
||||
<item>Range</item>
|
||||
<item>All</item>
|
||||
<item>Current</item>
|
||||
</items>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSpinButton" id="range_from_spin">
|
||||
<property name="visible">True</property>
|
||||
<property name="adjustment">pg_adjustment</property>
|
||||
<signal name="value-changed" handler="on_range_from_changed"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSpinButton" id="range_to_spin">
|
||||
<property name="visible">True</property>
|
||||
<property name="adjustment">pg_adjustment2</property>
|
||||
<signal name="value-changed" handler="on_range_to_changed"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="visible">True</property>
|
||||
<property name="label">Print</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="name">pg</property>
|
||||
<property name="title">Pages</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFrame">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">horizontal</property>
|
||||
<child>
|
||||
<object class="GtkToolbar">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="icon-size">1</property>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="toolbutton1">
|
||||
<property name="visible">True</property>
|
||||
<property name="icon-name">document-open-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="toolbutton2">
|
||||
<property name="visible">True</property>
|
||||
<property name="icon-name">send-to-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="toolbutton3">
|
||||
<property name="visible">True</property>
|
||||
<property name="icon-name">view-fullscreen-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="toolbutton4">
|
||||
<property name="visible">True</property>
|
||||
<property name="icon-name">star-new-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="visible">True</property>
|
||||
<property name="hscrollbar-policy">automatic</property>
|
||||
<property name="vscrollbar-policy">automatic</property>
|
||||
<child>
|
||||
<object class="GtkTextView" id="tooltextview">
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="margin">6</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<style>
|
||||
<class name="linked"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkButton" id="cutbutton">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="icon-size">1</property>
|
||||
<property name="icon-name">edit-cut-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="copybutton">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="icon-size">1</property>
|
||||
<property name="icon-name">edit-copy-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="pastebutton">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="icon-size">1</property>
|
||||
<property name="icon-name">edit-paste-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="deletebutton">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="valign">end</property>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="icon-size">1</property>
|
||||
<property name="icon-name">edit-delete-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFrame">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<object class="GtkPaned">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">horizontal</property>
|
||||
<property name="wide-handle">True</property>
|
||||
<child>
|
||||
<object class="GtkNotebook">
|
||||
<property name="visible">True</property>
|
||||
<property name="show-border">False</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="height-request">120</property>
|
||||
</object>
|
||||
</child>
|
||||
<child type="tab">
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Page 1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="height-request">120</property>
|
||||
</object>
|
||||
</child>
|
||||
<child type="tab">
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Page 2</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkNotebook">
|
||||
<property name="visible">True</property>
|
||||
<property name="show-border">False</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="height-request">120</property>
|
||||
</object>
|
||||
</child>
|
||||
<child type="tab">
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Page 3</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSpinner">
|
||||
<property name="visible">True</property>
|
||||
@@ -3296,7 +3876,9 @@ bad things might happen.</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="label">Details</property>
|
||||
<property name="label">_Details</property>
|
||||
<property name="use-underline">True</property>
|
||||
<property name="mnemonic-widget">details_entry</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
@@ -3309,7 +3891,7 @@ bad things might happen.</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry">
|
||||
<object class="GtkEntry" id="details_entry">
|
||||
<property name="visible">True</property>
|
||||
<property name="halign">fill</property>
|
||||
<property name="valign">baseline</property>
|
||||
@@ -3326,7 +3908,9 @@ bad things might happen.</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="label">More Details</property>
|
||||
<property name="label">More D_etails</property>
|
||||
<property name="use-underline">True</property>
|
||||
<property name="mnemonic-widget">more_details_entry</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
@@ -3339,7 +3923,7 @@ bad things might happen.</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry">
|
||||
<object class="GtkEntry" id="more_details_entry">
|
||||
<property name="visible">True</property>
|
||||
<property name="halign">fill</property>
|
||||
<property name="valign">baseline</property>
|
||||
@@ -3356,7 +3940,9 @@ bad things might happen.</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="label">Level</property>
|
||||
<property name="label">_Level</property>
|
||||
<property name="use-underline">True</property>
|
||||
<property name="mnemonic-widget">level_scale</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
@@ -3369,7 +3955,7 @@ bad things might happen.</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScale">
|
||||
<object class="GtkScale" id="level_scale">
|
||||
<property name="visible">True</property>
|
||||
<property name="halign">fill</property>
|
||||
<property name="valign">baseline</property>
|
||||
@@ -3388,7 +3974,9 @@ bad things might happen.</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="label">Mode</property>
|
||||
<property name="label">_Mode</property>
|
||||
<property name="use-underline">True</property>
|
||||
<property name="mnemonic-widget">mode_switch</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
@@ -3401,7 +3989,7 @@ bad things might happen.</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSwitch">
|
||||
<object class="GtkSwitch" id="mode_switch">
|
||||
<property name="visible">True</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">baseline</property>
|
||||
@@ -3459,7 +4047,7 @@ bad things might happen.</property>
|
||||
<action-widget response="cancel">cancel_selection_dialog</action-widget>
|
||||
<action-widget response="ok" default="true">select_selection_dialog</action-widget>
|
||||
</action-widgets>
|
||||
</object>
|
||||
</object>
|
||||
<object class="GtkSizeGroup">
|
||||
<property name="mode">vertical</property>
|
||||
<widgets>
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
<xi:include href="xml/windows.xml" />
|
||||
<xi:include href="xml/gdkframeclock.xml" />
|
||||
<xi:include href="xml/gdkframetimings.xml" />
|
||||
<xi:include href="xml/gdkglcontext.xml" />
|
||||
<xi:include href="xml/events.xml" />
|
||||
<xi:include href="xml/event_structs.xml" />
|
||||
<xi:include href="xml/keys.xml" />
|
||||
@@ -92,6 +93,10 @@
|
||||
<title>Index of new symbols in 3.14</title>
|
||||
<xi:include href="xml/api-index-3.14.xml"><xi:fallback /></xi:include>
|
||||
</index>
|
||||
<index id="api-index-3-16" role="3.16">
|
||||
<title>Index of new symbols in 3.16</title>
|
||||
<xi:include href="xml/api-index-3.16.xml"><xi:fallback /></xi:include>
|
||||
</index>
|
||||
|
||||
<xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
|
||||
|
||||
|
||||
@@ -394,6 +394,8 @@ gdk_window_constrain_size
|
||||
gdk_window_beep
|
||||
gdk_window_get_scale_factor
|
||||
gdk_window_set_opaque_region
|
||||
gdk_window_create_gl_context
|
||||
gdk_window_mark_paint_from_clip
|
||||
|
||||
<SUBSECTION>
|
||||
gdk_window_get_clip_region
|
||||
@@ -617,6 +619,7 @@ gdk_cairo_rectangle
|
||||
gdk_cairo_region
|
||||
gdk_cairo_region_create_from_surface
|
||||
gdk_cairo_surface_create_from_pixbuf
|
||||
gdk_cairo_draw_from_gl
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
@@ -1004,6 +1007,7 @@ gdk_x11_display_error_trap_pop
|
||||
gdk_x11_display_error_trap_pop_ignored
|
||||
gdk_x11_display_set_cursor_theme
|
||||
gdk_x11_display_set_window_scale
|
||||
gdk_x11_display_get_glx_version
|
||||
gdk_x11_register_standard_event_type
|
||||
gdk_x11_screen_get_screen_number
|
||||
gdk_x11_screen_get_xscreen
|
||||
@@ -1123,6 +1127,11 @@ GDK_X11_KEYMAP_CLASS
|
||||
GDK_IS_X11_KEYMAP
|
||||
GDK_IS_X11_KEYMAP_CLASS
|
||||
GDK_X11_KEYMAP_GET_CLASS
|
||||
GDK_TYPE_X11_GL_CONTEXT
|
||||
GDK_X11_GL_CONTEXT
|
||||
GDK_X11_GL_CONTEXT_CLASS
|
||||
GDK_IS_X11_GL_CONTEXT
|
||||
GDK_IS_X11_GL_CONTEXT_CLASS
|
||||
GDK_TYPE_X11_SCREEN
|
||||
GDK_X11_SCREEN
|
||||
GDK_X11_SCREEN_CLASS
|
||||
@@ -1273,3 +1282,28 @@ gdk_frame_timings_get_predicted_presentation_time
|
||||
<SUBSECTION Private>
|
||||
gdk_frame_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gdkglcontext</FILE>
|
||||
GdkGLContext
|
||||
gdk_gl_context_get_visual
|
||||
gdk_gl_context_get_window
|
||||
gdk_gl_context_make_current
|
||||
gdk_gl_context_clear_current
|
||||
gdk_gl_context_get_current
|
||||
GDK_GL_ERROR
|
||||
GDK_TYPE_GL_ERROR
|
||||
GDK_TYPE_GL_PROFILE
|
||||
GdkGLProfile
|
||||
GdkGLError
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GDK_GL_CONTEXT
|
||||
GDK_IS_GL_CONTEXT
|
||||
GDK_TYPE_GL_CONTEXT
|
||||
GDK_GL_CONTEXT_CLASS
|
||||
GDK_GL_CONTEXT_GET_CLASS
|
||||
GDK_IS_GL_CONTEXT_CLASS
|
||||
gdk_gl_context_get_type
|
||||
gdk_gl_error_quark
|
||||
</SECTION>
|
||||
|
||||
@@ -8,6 +8,7 @@ gdk_display_get_type
|
||||
gdk_display_manager_get_type
|
||||
gdk_drag_context_get_type
|
||||
gdk_frame_clock_get_type
|
||||
gdk_gl_context_get_type
|
||||
gdk_keymap_get_type
|
||||
gdk_screen_get_type
|
||||
gdk_visual_get_type
|
||||
|
||||
@@ -84,6 +84,7 @@ IGNORE_HFILES= \
|
||||
gtktextbufferserializ.h \
|
||||
gtktextchildprivate.h \
|
||||
gtktextdisplay.h \
|
||||
gtktexthandleprivate.h \
|
||||
gtktextiterprivate.h \
|
||||
gtktextlayout.h \
|
||||
gtktextmarkprivate.h \
|
||||
@@ -145,6 +146,7 @@ content_files = \
|
||||
osx.sgml \
|
||||
broadway.xml \
|
||||
wayland.xml \
|
||||
mir.xml \
|
||||
question_index.sgml \
|
||||
resources.sgml \
|
||||
text_widget.sgml \
|
||||
@@ -152,6 +154,7 @@ content_files = \
|
||||
windows.sgml \
|
||||
x11.sgml \
|
||||
gtk3-demo.xml \
|
||||
gtk3-demo-application.xml \
|
||||
gtk3-widget-factory.xml \
|
||||
gtk3-icon-browser.xml \
|
||||
gtk-query-immodules-3.0.xml \
|
||||
@@ -204,6 +207,7 @@ HTML_IMAGES = \
|
||||
$(srcdir)/images/font-button.png \
|
||||
$(srcdir)/images/fontchooser.png \
|
||||
$(srcdir)/images/frame.png \
|
||||
$(srcdir)/images/glarea.png \
|
||||
$(srcdir)/images/headerbar.png \
|
||||
$(srcdir)/images/icon-view.png \
|
||||
$(srcdir)/images/image.png \
|
||||
@@ -235,6 +239,7 @@ HTML_IMAGES = \
|
||||
$(srcdir)/images/search-bar.png \
|
||||
$(srcdir)/images/search-entry.png \
|
||||
$(srcdir)/images/separator.png \
|
||||
$(srcdir)/images/sidebar.png \
|
||||
$(srcdir)/images/spinbutton.png \
|
||||
$(srcdir)/images/spinner.png \
|
||||
$(srcdir)/images/stack.png \
|
||||
@@ -339,6 +344,7 @@ man_MANS = \
|
||||
gtk-encode-symbolic-svg.1 \
|
||||
gtk-launch.1 \
|
||||
gtk3-demo.1 \
|
||||
gtk3-demo-application.1 \
|
||||
gtk3-widget-factory.1 \
|
||||
gtk3-icon-browser.1 \
|
||||
broadwayd.1
|
||||
|
||||
@@ -254,6 +254,19 @@ How to compile GTK+ itself
|
||||
drawing.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<ulink url="https://github.com/anholt/libepoxy">libepoxy</ulink>
|
||||
is a library that abstracts the differences between different
|
||||
OpenGL libraries. GTK+ uses it for cross-platform GL support.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
The <ulink url="http://wayland.freedesktop.org">Wayland</ulink> libraries
|
||||
are needed to build GTK+ with the Wayland backend.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
The <ulink url="http://www.freedesktop.org/wiki/Software/shared-mime-info">shared-mime-info</ulink>
|
||||
@@ -394,6 +407,11 @@ How to compile GTK+ itself
|
||||
<arg choice="plain">--disable-wayland-backend</arg>
|
||||
</group>
|
||||
<sbr/>
|
||||
<group>
|
||||
<arg choice="plain">--enable-mir-backend</arg>
|
||||
<arg choice="plain">--disable-mir-backend</arg>
|
||||
</group>
|
||||
<sbr/>
|
||||
<group>
|
||||
<arg choice="plain">--enable-introspection=[no/auto/yes]</arg>
|
||||
</group>
|
||||
@@ -595,8 +613,10 @@ How to compile GTK+ itself
|
||||
<systemitem>--disable-quartz-backend</systemitem>,
|
||||
<systemitem>--enable-broadway-backend</systemitem>,
|
||||
<systemitem>--disable-broadway-backend</systemitem>,
|
||||
<systemitem>--enable-wayland-backend</systemitem>, and
|
||||
<systemitem>--disable-wayland-backend</systemitem></title>
|
||||
<systemitem>--enable-wayland-backend</systemitem>,
|
||||
<systemitem>--disable-wayland-backend</systemitem>
|
||||
<systemitem>--enable-mir-backend</systemitem>, and
|
||||
<systemitem>--disable-mir-backend</systemitem></title>
|
||||
|
||||
<para>
|
||||
Enables specific backends for GDK. If none of these options
|
||||
|
||||
@@ -76,6 +76,7 @@
|
||||
<xi:include href="xml/gtkflowbox.xml" />
|
||||
<xi:include href="xml/gtkstack.xml" />
|
||||
<xi:include href="xml/gtkstackswitcher.xml" />
|
||||
<xi:include href="xml/gtksidebar.xml" />
|
||||
<xi:include href="xml/gtkactionbar.xml" />
|
||||
<xi:include href="xml/gtkheaderbar.xml" />
|
||||
<xi:include href="xml/gtkoverlay.xml" />
|
||||
@@ -241,6 +242,7 @@
|
||||
<xi:include href="xml/gtkadjustment.xml" />
|
||||
<xi:include href="xml/gtkcalendar.xml" />
|
||||
<xi:include href="xml/gtkdrawingarea.xml" />
|
||||
<xi:include href="xml/gtkglarea.xml" />
|
||||
<xi:include href="xml/gtkeventbox.xml" />
|
||||
<xi:include href="xml/gtkhandlebox.xml" />
|
||||
<xi:include href="xml/gtkimcontextsimple.xml" />
|
||||
@@ -394,6 +396,7 @@
|
||||
<part>
|
||||
<title>GTK+ Tools</title>
|
||||
<xi:include href="gtk3-demo.xml" />
|
||||
<xi:include href="gtk3-demo-application.xml" />
|
||||
<xi:include href="gtk3-widget-factory.xml" />
|
||||
<xi:include href="gtk3-icon-browser.xml" />
|
||||
<xi:include href="gtk-query-immodules-3.0.xml" />
|
||||
@@ -413,6 +416,7 @@
|
||||
<xi:include href="osx.sgml" />
|
||||
<xi:include href="broadway.xml" />
|
||||
<xi:include href="wayland.xml" />
|
||||
<xi:include href="mir.xml" />
|
||||
</part>
|
||||
|
||||
<xi:include href="glossary.xml" />
|
||||
@@ -457,6 +461,10 @@
|
||||
<title>Index of new symbols in 3.14</title>
|
||||
<xi:include href="xml/api-index-3.14.xml"><xi:fallback /></xi:include>
|
||||
</index>
|
||||
<index id="api-index-3-16" role="3.16">
|
||||
<title>Index of new symbols in 3.16</title>
|
||||
<xi:include href="xml/api-index-3.16.xml"><xi:fallback /></xi:include>
|
||||
</index>
|
||||
|
||||
<xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
|
||||
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
||||
]>
|
||||
<refentry id="gtk3-demo-application">
|
||||
|
||||
<refentryinfo>
|
||||
<title>gtk3-demo-application</title>
|
||||
<productname>GTK+</productname>
|
||||
<authorgroup>
|
||||
<author>
|
||||
<contrib>Developer</contrib>
|
||||
<firstname>Matthias</firstname>
|
||||
<surname>Clasen</surname>
|
||||
</author>
|
||||
</authorgroup>
|
||||
</refentryinfo>
|
||||
|
||||
<refmeta>
|
||||
<refentrytitle>gtk3-demo-application</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
<refmiscinfo class="manual">User Commands</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>gtk3-demo-application</refname>
|
||||
<refpurpose>Demonstrate GtkApplication</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>gtk3-demo-application</command>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1><title>Description</title>
|
||||
<para>
|
||||
<command>gtk3-demo-application</command> is an example application
|
||||
used by <command>gtk3-demo</command>. There is no need to call it
|
||||
manually.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
@@ -2085,6 +2085,8 @@ gtk_label_set_markup
|
||||
gtk_label_set_markup_with_mnemonic
|
||||
gtk_label_set_pattern
|
||||
gtk_label_set_justify
|
||||
gtk_label_set_xalign
|
||||
gtk_label_set_yalign
|
||||
gtk_label_set_ellipsize
|
||||
gtk_label_set_width_chars
|
||||
gtk_label_set_max_width_chars
|
||||
@@ -2102,6 +2104,8 @@ gtk_label_set_selectable
|
||||
gtk_label_set_text_with_mnemonic
|
||||
gtk_label_get_attributes
|
||||
gtk_label_get_justify
|
||||
gtk_label_get_xalign
|
||||
gtk_label_get_yalign
|
||||
gtk_label_get_ellipsize
|
||||
gtk_label_get_width_chars
|
||||
gtk_label_get_max_width_chars
|
||||
@@ -2589,6 +2593,8 @@ gtk_paned_get_child2
|
||||
gtk_paned_set_position
|
||||
gtk_paned_get_position
|
||||
gtk_paned_get_handle_window
|
||||
gtk_paned_set_wide_handle
|
||||
gtk_paned_get_wide_handle
|
||||
<SUBSECTION Standard>
|
||||
GTK_PANED
|
||||
GTK_IS_PANED
|
||||
@@ -3148,6 +3154,8 @@ 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
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_SCROLLED_WINDOW
|
||||
@@ -3539,6 +3547,7 @@ gtk_tearoff_menu_item_get_type
|
||||
<FILE>gtktextbuffer</FILE>
|
||||
<TITLE>GtkTextBuffer</TITLE>
|
||||
GtkTextBuffer
|
||||
GtkTextBufferClass
|
||||
gtk_text_buffer_new
|
||||
gtk_text_buffer_get_line_count
|
||||
gtk_text_buffer_get_char_count
|
||||
@@ -3625,9 +3634,9 @@ GTK_TYPE_TEXT_BUFFER
|
||||
GTK_TEXT_BUFFER_CLASS
|
||||
GTK_IS_TEXT_BUFFER_CLASS
|
||||
GTK_TEXT_BUFFER_GET_CLASS
|
||||
gtk_text_buffer_get_type
|
||||
<SUBSECTION Private>
|
||||
GtkTextBufferPrivate
|
||||
gtk_text_buffer_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
@@ -3779,6 +3788,7 @@ GTK_IS_TEXT_TAG_CLASS
|
||||
GTK_TEXT_TAG_GET_CLASS
|
||||
GTK_TYPE_TEXT_ATTRIBUTES
|
||||
<SUBSECTION Private>
|
||||
GtkTextTagPrivate
|
||||
gtk_text_tag_get_type
|
||||
gtk_text_attributes_get_type
|
||||
</SECTION>
|
||||
@@ -3810,6 +3820,8 @@ gtk_text_tag_table_get_type
|
||||
<FILE>gtktextview</FILE>
|
||||
<TITLE>GtkTextView</TITLE>
|
||||
GtkTextView
|
||||
GtkTextViewClass
|
||||
GtkTextViewLayer
|
||||
GtkTextWindowType
|
||||
GtkWrapMode
|
||||
gtk_text_view_new
|
||||
@@ -3882,6 +3894,8 @@ gtk_text_view_set_input_purpose
|
||||
gtk_text_view_get_input_purpose
|
||||
gtk_text_view_set_input_hints
|
||||
gtk_text_view_get_input_hints
|
||||
gtk_text_view_set_monospace
|
||||
gtk_text_view_get_monospace
|
||||
GTK_TEXT_VIEW_PRIORITY_VALIDATE
|
||||
<SUBSECTION Standard>
|
||||
GTK_TEXT_VIEW
|
||||
@@ -5733,6 +5747,7 @@ gtk_window_get_application
|
||||
gtk_window_set_application
|
||||
gtk_window_set_has_user_ref_count
|
||||
gtk_window_set_titlebar
|
||||
gtk_window_get_titlebar
|
||||
gtk_window_set_interactive_debugging
|
||||
|
||||
<SUBSECTION Standard>
|
||||
@@ -5994,6 +6009,7 @@ GTK_STYLE_CLASS_IMAGE
|
||||
GTK_STYLE_CLASS_INFO
|
||||
GTK_STYLE_CLASS_INLINE_TOOLBAR
|
||||
GTK_STYLE_CLASS_INSERTION_CURSOR
|
||||
GTK_STYLE_CLASS_LABEL
|
||||
GTK_STYLE_CLASS_LEFT
|
||||
GTK_STYLE_CLASS_LEVEL_BAR
|
||||
GTK_STYLE_CLASS_LINKED
|
||||
@@ -6004,11 +6020,13 @@ GTK_STYLE_CLASS_MENU
|
||||
GTK_STYLE_CLASS_MENUBAR
|
||||
GTK_STYLE_CLASS_MENUITEM
|
||||
GTK_STYLE_CLASS_MESSAGE_DIALOG
|
||||
GTK_STYLE_CLASS_MONOSPACE
|
||||
GTK_STYLE_CLASS_NEEDS_ATTENTION
|
||||
GTK_STYLE_CLASS_NOTEBOOK
|
||||
GTK_STYLE_CLASS_OSD
|
||||
GTK_STYLE_CLASS_OVERSHOOT
|
||||
GTK_STYLE_CLASS_PANE_SEPARATOR
|
||||
GTK_STYLE_CLASS_PAPER
|
||||
GTK_STYLE_CLASS_POPUP
|
||||
GTK_STYLE_CLASS_PRIMARY_TOOLBAR
|
||||
GTK_STYLE_CLASS_PROGRESSBAR
|
||||
@@ -6039,6 +6057,7 @@ GTK_STYLE_CLASS_TROUGH
|
||||
GTK_STYLE_CLASS_VERTICAL
|
||||
GTK_STYLE_CLASS_VIEW
|
||||
GTK_STYLE_CLASS_WARNING
|
||||
GTK_STYLE_CLASS_WIDE
|
||||
GTK_STYLE_REGION_COLUMN
|
||||
GTK_STYLE_REGION_COLUMN_HEADER
|
||||
GTK_STYLE_REGION_ROW
|
||||
@@ -6153,6 +6172,7 @@ gtk_css_provider_get_named
|
||||
gtk_css_provider_load_from_data
|
||||
gtk_css_provider_load_from_file
|
||||
gtk_css_provider_load_from_path
|
||||
gtk_css_provider_load_from_resource
|
||||
gtk_css_provider_new
|
||||
gtk_css_provider_to_string
|
||||
GTK_CSS_PROVIDER_ERROR
|
||||
@@ -7131,6 +7151,7 @@ GTK_PAPER_NAME_EXECUTIVE
|
||||
GTK_PAPER_NAME_LEGAL
|
||||
gtk_paper_size_new
|
||||
gtk_paper_size_new_from_ppd
|
||||
gtk_paper_size_new_from_ipp
|
||||
gtk_paper_size_new_custom
|
||||
gtk_paper_size_copy
|
||||
gtk_paper_size_free
|
||||
@@ -7141,6 +7162,7 @@ gtk_paper_size_get_display_name
|
||||
gtk_paper_size_get_ppd_name
|
||||
gtk_paper_size_get_width
|
||||
gtk_paper_size_get_height
|
||||
gtk_paper_size_is_ipp
|
||||
gtk_paper_size_is_custom
|
||||
gtk_paper_size_set_size
|
||||
gtk_paper_size_get_default_top_margin
|
||||
@@ -7824,6 +7846,10 @@ gtk_stack_get_visible_child_name
|
||||
gtk_stack_set_visible_child_full
|
||||
gtk_stack_set_homogeneous
|
||||
gtk_stack_get_homogeneous
|
||||
gtk_stack_set_hhomogeneous
|
||||
gtk_stack_get_hhomogeneous
|
||||
gtk_stack_set_vhomogeneous
|
||||
gtk_stack_get_vhomogeneous
|
||||
gtk_stack_set_transition_duration
|
||||
gtk_stack_get_transition_duration
|
||||
GtkStackTransitionType
|
||||
@@ -8153,3 +8179,46 @@ GTK_GESTURE_ZOOM_GET_CLASS
|
||||
<SUBSECTION Private>
|
||||
gtk_gesture_zoom_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtksidebar</FILE>
|
||||
GtkSidebar
|
||||
GtkSidebarClass
|
||||
gtk_sidebar_new
|
||||
gtk_sidebar_set_stack
|
||||
gtk_sidebar_get_stack
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_SIDEBAR
|
||||
GTK_SIDEBAR
|
||||
GTK_SIDEBAR_CLASS
|
||||
GTK_IS_SIDEBAR
|
||||
GTK_IS_SIDEBAR_CLASS
|
||||
GTK_SIDEBAR_GET_CLASS
|
||||
|
||||
<SUBSECTION Private>
|
||||
GtkSidebarPrivate
|
||||
gtk_sidebar_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkglarea</FILE>
|
||||
GtkGLArea
|
||||
GtkGLAreaClass
|
||||
gtk_gl_area_new
|
||||
gtk_gl_area_get_context
|
||||
<SUBSECTION>
|
||||
gtk_gl_area_set_has_alpha
|
||||
gtk_gl_area_get_has_alpha
|
||||
gtk_gl_area_set_has_depth_buffer
|
||||
gtk_gl_area_get_has_depth_buffer
|
||||
gtk_gl_area_make_current
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_GL_AREA
|
||||
GTK_GL_AREA
|
||||
GTK_GL_AREA_CLASS
|
||||
GTK_IS_GL_AREA
|
||||
GTK_IS_GL_AREA_CLASS
|
||||
<SUBSECTION Private>
|
||||
gtk_gl_area_get_type
|
||||
</SECTION>
|
||||
|
||||
@@ -90,6 +90,7 @@ gtk_gesture_rotate_get_type
|
||||
gtk_gesture_single_get_type
|
||||
gtk_gesture_swipe_get_type
|
||||
gtk_gesture_zoom_get_type
|
||||
gtk_gl_area_get_type
|
||||
gtk_grid_get_type
|
||||
gtk_handle_box_get_type
|
||||
gtk_hbox_get_type
|
||||
@@ -170,6 +171,7 @@ gtk_separator_get_type
|
||||
gtk_separator_menu_item_get_type
|
||||
gtk_separator_tool_item_get_type
|
||||
gtk_settings_get_type
|
||||
gtk_sidebar_get_type
|
||||
gtk_size_group_get_type
|
||||
@ENABLE_ON_X11@gtk_socket_get_type
|
||||
gtk_spin_button_get_type
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 5.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.0 KiB |
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
||||
]>
|
||||
<refentry id="gtk-mir">
|
||||
<refmeta>
|
||||
<refentrytitle>Using GTK+ with Mir</refentrytitle>
|
||||
<manvolnum>3</manvolnum>
|
||||
<refmiscinfo>GTK Library</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>Using GTK+ with Mir</refname>
|
||||
<refpurpose>
|
||||
Mir-specific aspects of using GTK+
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1>
|
||||
<title>Using GTK+ with Mir</title>
|
||||
|
||||
<para>
|
||||
The GDK Mir backend provides support for running GTK+ applications
|
||||
under Mir based display servers. To run your application in this way,
|
||||
select the Mir backend by setting <literal>GDK_BACKEND=mir</literal>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Currently, the Mir backend does not use any additional commandline
|
||||
options or environment variables.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
@@ -399,6 +399,10 @@ nevertheless.
|
||||
<term>misc</term>
|
||||
<listitem><para>Miscellaneous information</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>nogl</term>
|
||||
<listitem><para>Turn off OpenGL. GDK will behave as if OpenGL support was not available.</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>nograbs</term>
|
||||
<listitem><para>Turn off all pointer and keyboard grabs</para></listitem>
|
||||
@@ -487,6 +491,11 @@ nevertheless.
|
||||
<listitem><para>Selects the Wayland backend for connecting to Wayland display servers</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>mir</term>
|
||||
<listitem><para>Selects the Mir backend for connecting to Mir display servers</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
Since 3.10, this environment variable can contain a comma-separated list
|
||||
of backend names, which are tried in order. The list may also contain
|
||||
|
||||
@@ -42,6 +42,9 @@
|
||||
<link linkend="GtkScale">
|
||||
<inlinegraphic fileref="scales.png" format="PNG"></inlinegraphic>
|
||||
</link>
|
||||
<link linkend="GtkGLArea">
|
||||
<inlinegraphic fileref="glarea.png" format="PNG"></inlinegraphic>
|
||||
</link>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
@@ -141,6 +144,9 @@
|
||||
<link linkend="GtkStackSwitcher">
|
||||
<inlinegraphic fileref="stackswitcher.png" format="PNG"></inlinegraphic>
|
||||
</link>
|
||||
<link linkend="GtkSidebar">
|
||||
<inlinegraphic fileref="sidebar.png" format="PNG"></inlinegraphic>
|
||||
</link>
|
||||
<link linkend="GtkTreeView">
|
||||
<inlinegraphic fileref="list-and-tree.png" format="PNG"></inlinegraphic>
|
||||
</link>
|
||||
|
||||
@@ -5,6 +5,7 @@ AM_CPPFLAGS = \
|
||||
-I$(top_builddir)/gdk \
|
||||
-I$(top_srcdir)/gdk \
|
||||
-I$(top_srcdir)/gdk/x11 \
|
||||
-I$(top_srcdir)/tests \
|
||||
$(GTK_DEBUG_FLAGS) \
|
||||
$(GTK_DEP_CFLAGS)
|
||||
|
||||
@@ -30,7 +31,9 @@ doc_shooter_SOURCES= \
|
||||
shadow.h \
|
||||
shooter.c \
|
||||
widgets.c \
|
||||
widgets.h
|
||||
widgets.h \
|
||||
$(top_srcdir)/tests/gtkgears.c \
|
||||
$(top_srcdir)/tests/gtkgears.h
|
||||
|
||||
clean-local:
|
||||
for file in *.png; do \
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <X11/Xatom.h>
|
||||
#include <gdkx.h>
|
||||
#include "widgets.h"
|
||||
#include "gtkgears.h"
|
||||
|
||||
#define SMALL_WIDTH 240
|
||||
#define SMALL_HEIGHT 75
|
||||
@@ -1385,6 +1386,41 @@ create_stack_switcher (void)
|
||||
return new_widget_info ("stackswitcher", vbox, ASIS);
|
||||
}
|
||||
|
||||
static WidgetInfo *
|
||||
create_sidebar (void)
|
||||
{
|
||||
GtkWidget *stack;
|
||||
GtkWidget *sidebar;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *view;
|
||||
GtkWidget *frame;
|
||||
|
||||
stack = gtk_stack_new ();
|
||||
gtk_widget_set_size_request (stack, 120, 120);
|
||||
view = gtk_label_new ("Sidebar");
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (view), "view");
|
||||
gtk_widget_set_halign (view, GTK_ALIGN_FILL);
|
||||
gtk_widget_set_valign (view, GTK_ALIGN_FILL);
|
||||
gtk_widget_show (view);
|
||||
gtk_stack_add_titled (GTK_STACK (stack), view, "page1", "Page 1");
|
||||
view = gtk_text_view_new ();
|
||||
gtk_widget_show (view);
|
||||
gtk_stack_add_titled (GTK_STACK (stack), view, "page2", "Page 2");
|
||||
|
||||
sidebar = gtk_sidebar_new ();
|
||||
gtk_sidebar_set_stack (GTK_SIDEBAR (sidebar), GTK_STACK (stack));
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox), sidebar, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), gtk_separator_new (GTK_ORIENTATION_VERTICAL), FALSE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), stack, TRUE, TRUE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (frame), hbox);
|
||||
|
||||
return new_widget_info ("sidebar", frame, ASIS);
|
||||
}
|
||||
|
||||
static WidgetInfo *
|
||||
create_list_box (void)
|
||||
{
|
||||
@@ -1480,6 +1516,24 @@ create_flow_box (void)
|
||||
return info;
|
||||
}
|
||||
|
||||
static WidgetInfo *
|
||||
create_gl_area (void)
|
||||
{
|
||||
WidgetInfo *info;
|
||||
GtkWidget *widget;
|
||||
GtkWidget *gears;
|
||||
|
||||
widget = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (widget), GTK_SHADOW_IN);
|
||||
|
||||
gears = gtk_gears_new ();
|
||||
gtk_container_add (GTK_CONTAINER (widget), gears);
|
||||
|
||||
info = new_widget_info ("glarea", widget, MEDIUM);
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
GList *
|
||||
get_all_widgets (void)
|
||||
{
|
||||
@@ -1544,6 +1598,8 @@ get_all_widgets (void)
|
||||
retval = g_list_prepend (retval, create_search_entry ());
|
||||
retval = g_list_prepend (retval, create_level_bar ());
|
||||
retval = g_list_prepend (retval, create_info_bar ());
|
||||
retval = g_list_prepend (retval, create_gl_area ());
|
||||
retval = g_list_prepend (retval, create_sidebar ());
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -208,7 +208,9 @@ plugin_action (GAction *action,
|
||||
|
||||
gdk_rgba_parse (&color, g_action_get_name (action));
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
gtk_widget_override_color (text, 0, &color);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
+9
-1
@@ -13,7 +13,7 @@ INTROSPECTION_COMPILER_ARGS = \
|
||||
|
||||
SUBDIRS = $(GDK_BACKENDS) .
|
||||
|
||||
DIST_SUBDIRS = win32 x11 quartz broadway wayland
|
||||
DIST_SUBDIRS = win32 x11 quartz broadway wayland mir
|
||||
|
||||
CLEANFILES =
|
||||
|
||||
@@ -71,6 +71,7 @@ gdk_public_h_sources = \
|
||||
gdkdnd.h \
|
||||
gdkevents.h \
|
||||
gdkframetimings.h \
|
||||
gdkglcontext.h \
|
||||
gdkkeys.h \
|
||||
gdkkeysyms.h \
|
||||
gdkkeysyms-compat.h \
|
||||
@@ -107,6 +108,7 @@ gdk_private_headers = \
|
||||
gdkdndprivate.h \
|
||||
gdkframeclockidle.h \
|
||||
gdkframeclockprivate.h \
|
||||
gdkglcontextprivate.h \
|
||||
gdkscreenprivate.h \
|
||||
gdkinternals.h \
|
||||
gdkintl.h \
|
||||
@@ -131,6 +133,8 @@ gdk_c_sources = \
|
||||
gdkdnd.c \
|
||||
gdkevents.c \
|
||||
gdkframetimings.c \
|
||||
gdkgl.c \
|
||||
gdkglcontext.c \
|
||||
gdkglobals.c \
|
||||
gdkkeys.c \
|
||||
gdkkeyuni.c \
|
||||
@@ -201,6 +205,10 @@ if USE_WAYLAND
|
||||
libgdk_3_la_LIBADD += wayland/libgdk-wayland.la
|
||||
endif
|
||||
|
||||
if USE_MIR
|
||||
libgdk_3_la_LIBADD += mir/libgdk-mir.la
|
||||
endif
|
||||
|
||||
if HAVE_INTROSPECTION
|
||||
|
||||
introspection_files = \
|
||||
|
||||
@@ -1387,8 +1387,7 @@ broadway_server_destroy_window (BroadwayServer *server,
|
||||
g_hash_table_remove (server->id_ht,
|
||||
GINT_TO_POINTER (id));
|
||||
|
||||
if (window->cached_surface_name != NULL)
|
||||
g_free (window->cached_surface_name);
|
||||
g_free (window->cached_surface_name);
|
||||
if (window->cached_surface != NULL)
|
||||
cairo_surface_destroy (window->cached_surface);
|
||||
|
||||
@@ -1748,8 +1747,7 @@ broadway_server_open_surface (BroadwayServer *server,
|
||||
cairo_surface_set_user_data (surface, &shm_cairo_key,
|
||||
data, shm_data_unmap);
|
||||
|
||||
if (window->cached_surface_name != NULL)
|
||||
g_free (window->cached_surface_name);
|
||||
g_free (window->cached_surface_name);
|
||||
window->cached_surface_name = g_strdup (name);
|
||||
|
||||
if (window->cached_surface != NULL)
|
||||
|
||||
@@ -140,7 +140,7 @@ _gdk_broadway_server_new (const char *display, GError **error)
|
||||
else
|
||||
{
|
||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
|
||||
_("broadway display type not supported '%s'"), display);
|
||||
_("Broadway display type not supported: %s"), display);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -344,7 +344,7 @@ gdk_broadway_device_window_at_position (GdkDevice *device,
|
||||
GdkWindow *root_window;
|
||||
GdkWindow *window;
|
||||
|
||||
screen = gdk_screen_get_default ();
|
||||
screen = gdk_display_get_default_screen (gdk_device_get_display (device));
|
||||
root_window = gdk_screen_get_root_window (screen);
|
||||
|
||||
gdk_broadway_device_query_state (device, root_window, NULL, &window, NULL, NULL, win_x, win_y, mask);
|
||||
|
||||
@@ -92,14 +92,31 @@ gdk_event_source_check (GSource *source)
|
||||
void
|
||||
_gdk_broadway_events_got_input (BroadwayInputMsg *message)
|
||||
{
|
||||
GdkDisplay *display = gdk_display_get_default ();
|
||||
GdkBroadwayDisplay *display_broadway = GDK_BROADWAY_DISPLAY (display);
|
||||
GdkDisplay *display;
|
||||
GdkBroadwayDisplay *display_broadway;
|
||||
GdkBroadwayDeviceManager *device_manager;
|
||||
GdkScreen *screen;
|
||||
GdkWindow *window;
|
||||
GdkEvent *event = NULL;
|
||||
GList *node;
|
||||
GSList *list, *d;
|
||||
|
||||
display = NULL;
|
||||
|
||||
list = gdk_display_manager_list_displays (gdk_display_manager_get ());
|
||||
for (d = list; d; d = d->next)
|
||||
{
|
||||
if (GDK_IS_BROADWAY_DISPLAY (d->data))
|
||||
{
|
||||
display = d->data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
g_slist_free (list);
|
||||
|
||||
g_assert (display != NULL);
|
||||
|
||||
display_broadway = GDK_BROADWAY_DISPLAY (display);
|
||||
device_manager = GDK_BROADWAY_DEVICE_MANAGER (gdk_display_get_device_manager (display));
|
||||
|
||||
switch (message->base.type) {
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
#include "gdkwindow-broadway.h"
|
||||
#include "gdkscreen-broadway.h"
|
||||
|
||||
#include "gdkbroadwaydisplay.h"
|
||||
#include "gdkdisplay.h"
|
||||
#include "gdkwindow.h"
|
||||
#include "gdkwindowimpl.h"
|
||||
#include "gdkdisplay-broadway.h"
|
||||
@@ -81,6 +83,28 @@ G_DEFINE_TYPE (GdkWindowImplBroadway,
|
||||
gdk_window_impl_broadway,
|
||||
GDK_TYPE_WINDOW_IMPL)
|
||||
|
||||
static GdkDisplay *
|
||||
find_broadway_display (void)
|
||||
{
|
||||
GdkDisplay *display;
|
||||
GSList *list, *l;
|
||||
|
||||
display = NULL;
|
||||
|
||||
list = gdk_display_manager_list_displays (gdk_display_manager_get ());
|
||||
for (l = list; l; l = l->next)
|
||||
{
|
||||
if (GDK_IS_BROADWAY_DISPLAY (l->data))
|
||||
{
|
||||
display = l->data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
g_slist_free (list);
|
||||
|
||||
return display;
|
||||
}
|
||||
|
||||
static void
|
||||
update_dirty_windows_and_sync (void)
|
||||
{
|
||||
@@ -88,7 +112,8 @@ update_dirty_windows_and_sync (void)
|
||||
GdkBroadwayDisplay *display;
|
||||
gboolean updated_surface;
|
||||
|
||||
display = GDK_BROADWAY_DISPLAY (gdk_display_get_default ());
|
||||
display = GDK_BROADWAY_DISPLAY (find_broadway_display ());
|
||||
g_assert (display != NULL);
|
||||
|
||||
updated_surface = FALSE;
|
||||
for (l = display->toplevels; l != NULL; l = l->next)
|
||||
@@ -120,7 +145,7 @@ flush_idle (gpointer data)
|
||||
{
|
||||
flush_id = 0;
|
||||
|
||||
gdk_display_flush (gdk_display_get_default ());
|
||||
gdk_display_flush (find_broadway_display ());
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@@ -987,13 +1012,6 @@ gdk_broadway_window_end_paint (GdkWindow *window)
|
||||
impl->dirty = TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_window_broadway_set_static_gravities (GdkWindow *window,
|
||||
gboolean use_static)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
typedef struct _MoveResizeData MoveResizeData;
|
||||
|
||||
struct _MoveResizeData
|
||||
@@ -1129,12 +1147,7 @@ finish_drag (MoveResizeData *mv_resize)
|
||||
mv_resize->moveresize_emulation_window = NULL;
|
||||
g_object_unref (mv_resize->moveresize_window);
|
||||
mv_resize->moveresize_window = NULL;
|
||||
|
||||
if (mv_resize->moveresize_pending_event)
|
||||
{
|
||||
g_free (mv_resize->moveresize_pending_event);
|
||||
mv_resize->moveresize_pending_event = NULL;
|
||||
}
|
||||
g_clear_pointer (&mv_resize->moveresize_pending_event, g_free);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -1514,7 +1527,6 @@ gdk_window_impl_broadway_class_init (GdkWindowImplBroadwayClass *klass)
|
||||
impl_class->get_device_state = gdk_window_broadway_get_device_state;
|
||||
impl_class->shape_combine_region = gdk_window_broadway_shape_combine_region;
|
||||
impl_class->input_shape_combine_region = gdk_window_broadway_input_shape_combine_region;
|
||||
impl_class->set_static_gravities = gdk_window_broadway_set_static_gravities;
|
||||
impl_class->destroy = _gdk_broadway_window_destroy;
|
||||
impl_class->destroy_foreign = gdk_broadway_window_destroy_foreign;
|
||||
impl_class->get_shape = gdk_broadway_window_get_shape;
|
||||
|
||||
@@ -1,17 +1,22 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
my $ARRAYNAME = $ARGV[0];
|
||||
print "static const char $ARRAYNAME\[\] = \"";
|
||||
my $first = 0;
|
||||
print "static const char $ARRAYNAME\[\] = {";
|
||||
|
||||
for ($i = 1; $i <= $#ARGV; $i = $i + 1) {
|
||||
my $FILENAME = $ARGV[$i];
|
||||
open FILE, $FILENAME or die "Cannot open $FILENAME";
|
||||
while (my $line = <FILE>) {
|
||||
foreach my $c (split //, $line) {
|
||||
printf ("\\x%02x", ord ($c));
|
||||
if ($first == 1) {
|
||||
printf (",\n");
|
||||
}
|
||||
printf ("0x%02x", ord ($c));
|
||||
$first = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print "\";\n";
|
||||
print "};\n";
|
||||
|
||||
|
||||
@@ -148,7 +148,9 @@ static const GDebugKey gdk_debug_keys[] = {
|
||||
{"draw", GDK_DEBUG_DRAW},
|
||||
{"eventloop", GDK_DEBUG_EVENTLOOP},
|
||||
{"frames", GDK_DEBUG_FRAMES},
|
||||
{"settings", GDK_DEBUG_SETTINGS}
|
||||
{"settings", GDK_DEBUG_SETTINGS},
|
||||
{"nogl", GDK_DEBUG_NOGL},
|
||||
{"opengl", GDK_DEBUG_OPENGL},
|
||||
};
|
||||
|
||||
static gboolean
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#include <gdk/gdkevents.h>
|
||||
#include <gdk/gdkframeclock.h>
|
||||
#include <gdk/gdkframetimings.h>
|
||||
#include <gdk/gdkglcontext.h>
|
||||
#include <gdk/gdkkeys.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
#include <gdk/gdkmain.h>
|
||||
|
||||
+36
-1
@@ -285,7 +285,7 @@ gdk_cairo_surface_create_from_pixbuf (const GdkPixbuf *pixbuf,
|
||||
cairo_surface_t *surface;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
|
||||
g_return_val_if_fail (scale > 0, NULL);
|
||||
g_return_val_if_fail (scale >= 0, NULL);
|
||||
g_return_val_if_fail (for_window == NULL || GDK_IS_WINDOW (for_window), NULL);
|
||||
|
||||
if (gdk_pixbuf_get_n_channels (pixbuf) == 3)
|
||||
@@ -525,3 +525,38 @@ gdk_cairo_region_create_from_surface (cairo_surface_t *surface)
|
||||
|
||||
return region;
|
||||
}
|
||||
|
||||
cairo_region_t *
|
||||
gdk_cairo_region_from_clip (cairo_t *cr)
|
||||
{
|
||||
cairo_rectangle_list_t *rectangles;
|
||||
cairo_region_t *region;
|
||||
int i;
|
||||
|
||||
rectangles = cairo_copy_clip_rectangle_list (cr);
|
||||
|
||||
if (rectangles->status != CAIRO_STATUS_SUCCESS)
|
||||
return NULL;
|
||||
|
||||
region = cairo_region_create ();
|
||||
for (i = 0; i < rectangles->num_rectangles; i++)
|
||||
{
|
||||
cairo_rectangle_int_t clip_rect;
|
||||
cairo_rectangle_t *rect;
|
||||
|
||||
rect = &rectangles->rectangles[i];
|
||||
|
||||
/* Here we assume clip rects are ints for direct targets, which
|
||||
is true for cairo */
|
||||
clip_rect.x = (int)rect->x;
|
||||
clip_rect.y = (int)rect->y;
|
||||
clip_rect.width = (int)rect->width;
|
||||
clip_rect.height = (int)rect->height;
|
||||
|
||||
cairo_region_union_rectangle (region, &clip_rect);
|
||||
}
|
||||
|
||||
cairo_rectangle_list_destroy (rectangles);
|
||||
|
||||
return region;
|
||||
}
|
||||
|
||||
@@ -70,6 +70,17 @@ GDK_AVAILABLE_IN_3_10
|
||||
cairo_surface_t * gdk_cairo_surface_create_from_pixbuf (const GdkPixbuf *pixbuf,
|
||||
int scale,
|
||||
GdkWindow *for_window);
|
||||
GDK_AVAILABLE_IN_3_16
|
||||
void gdk_cairo_draw_from_gl (cairo_t *cr,
|
||||
GdkWindow *window,
|
||||
int source,
|
||||
int source_type,
|
||||
int buffer_scale,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
+3
-5
@@ -313,8 +313,7 @@ gdk_device_set_property (GObject *object,
|
||||
device->manager = g_value_get_object (value);
|
||||
break;
|
||||
case PROP_NAME:
|
||||
if (device->name)
|
||||
g_free (device->name);
|
||||
g_free (device->name);
|
||||
|
||||
device->name = g_value_dup_string (value);
|
||||
break;
|
||||
@@ -689,6 +688,7 @@ gdk_device_get_name (GdkDevice *device)
|
||||
* @device: a #GdkDevice
|
||||
*
|
||||
* Determines whether the pointer follows device motion.
|
||||
* This is not meaningful for keyboard devices, which don't have a pointer.
|
||||
*
|
||||
* Returns: %TRUE if the pointer follows device motion
|
||||
*
|
||||
@@ -698,7 +698,6 @@ gboolean
|
||||
gdk_device_get_has_cursor (GdkDevice *device)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_DEVICE (device), FALSE);
|
||||
g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, FALSE);
|
||||
|
||||
return device->has_cursor;
|
||||
}
|
||||
@@ -1477,8 +1476,7 @@ void
|
||||
_gdk_device_set_keys (GdkDevice *device,
|
||||
guint num_keys)
|
||||
{
|
||||
if (device->keys)
|
||||
g_free (device->keys);
|
||||
g_free (device->keys);
|
||||
|
||||
device->num_keys = num_keys;
|
||||
device->keys = g_new0 (GdkDeviceKey, num_keys);
|
||||
|
||||
@@ -1714,6 +1714,9 @@ gdk_display_supports_input_shapes (GdkDisplay *display)
|
||||
* Returns: %TRUE if windows may be composited.
|
||||
*
|
||||
* Since: 2.12
|
||||
*
|
||||
* Deprecated: 3.16: Compositing is an outdated technology that
|
||||
* only ever worked on X11.
|
||||
*/
|
||||
gboolean
|
||||
gdk_display_supports_composite (GdkDisplay *display)
|
||||
@@ -2225,3 +2228,66 @@ gdk_error_trap_pop (void)
|
||||
{
|
||||
return gdk_error_trap_pop_internal (TRUE);
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gdk_display_destroy_gl_context:
|
||||
* @display: a #GdkDisplay
|
||||
* @context: a #GdkGLContext
|
||||
*
|
||||
* Destroys the platform-specific parts of the @context.
|
||||
*
|
||||
* The @context instance is still valid, though inert, after
|
||||
* this functionr returns.
|
||||
*/
|
||||
void
|
||||
gdk_display_destroy_gl_context (GdkDisplay *display,
|
||||
GdkGLContext *context)
|
||||
{
|
||||
GdkGLContext *current = gdk_display_get_current_gl_context (display);
|
||||
|
||||
if (current == context)
|
||||
g_object_set_data (G_OBJECT (display), "-gdk-gl-current-context", NULL);
|
||||
|
||||
GDK_DISPLAY_GET_CLASS (display)->destroy_gl_context (display, context);
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gdk_display_make_gl_context_current:
|
||||
* @display: a #GdkDisplay
|
||||
* @context: (optional): a #GdkGLContext, or %NULL
|
||||
*
|
||||
* Makes the given @context the current GL context, or unsets
|
||||
* the current GL context if @context is %NULL.
|
||||
*/
|
||||
void
|
||||
gdk_display_make_gl_context_current (GdkDisplay *display,
|
||||
GdkGLContext *context)
|
||||
{
|
||||
GdkGLContext *current = gdk_display_get_current_gl_context (display);
|
||||
|
||||
if (current == context)
|
||||
return;
|
||||
|
||||
if (context == NULL)
|
||||
g_object_set_data (G_OBJECT (display), "-gdk-gl-current-context", NULL);
|
||||
else
|
||||
g_object_set_data_full (G_OBJECT (display), "-gdk-gl-current-context",
|
||||
g_object_ref (context),
|
||||
(GDestroyNotify) g_object_unref);
|
||||
|
||||
GDK_DISPLAY_GET_CLASS (display)->make_gl_context_current (display, context);
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gdk_display_get_current_gl_context:
|
||||
* @display: a #GdkDisplay
|
||||
*
|
||||
* Retrieves the current #GdkGLContext associated with @display.
|
||||
*
|
||||
* Returns: (transfer none): the current #GdkGLContext or %NULL
|
||||
*/
|
||||
GdkGLContext *
|
||||
gdk_display_get_current_gl_context (GdkDisplay *display)
|
||||
{
|
||||
return g_object_get_data (G_OBJECT (display), "-gdk-gl-current-context");
|
||||
}
|
||||
|
||||
+1
-1
@@ -159,7 +159,7 @@ GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_display_supports_shapes (GdkDisplay *display);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_display_supports_input_shapes (GdkDisplay *display);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_3_16
|
||||
gboolean gdk_display_supports_composite (GdkDisplay *display);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_display_notify_startup_complete (GdkDisplay *display,
|
||||
|
||||
@@ -60,6 +60,10 @@
|
||||
#include "wayland/gdkprivate-wayland.h"
|
||||
#endif
|
||||
|
||||
#ifdef GDK_WINDOWING_MIR
|
||||
#include "mir/gdkmir-private.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* SECTION:gdkdisplaymanager
|
||||
* @Short_description: Maintains a list of all open GdkDisplays
|
||||
@@ -272,6 +276,9 @@ static GdkBackend gdk_backends[] = {
|
||||
#ifdef GDK_WINDOWING_WAYLAND
|
||||
{ "wayland", _gdk_wayland_display_open },
|
||||
#endif
|
||||
#ifdef GDK_WINDOWING_MIR
|
||||
{ "mir", _gdk_mir_display_open },
|
||||
#endif
|
||||
#ifdef GDK_WINDOWING_BROADWAY
|
||||
{ "broadway", _gdk_broadway_display_open },
|
||||
#endif
|
||||
|
||||
@@ -116,6 +116,9 @@ struct _GdkDisplay
|
||||
|
||||
guint double_click_time; /* Maximum time between clicks in msecs */
|
||||
guint double_click_distance; /* Maximum distance between clicks in pixels */
|
||||
|
||||
guint has_gl_extension_texture_non_power_of_two : 1;
|
||||
guint has_gl_extension_texture_rectangle : 1;
|
||||
};
|
||||
|
||||
struct _GdkDisplayClass
|
||||
@@ -225,6 +228,11 @@ struct _GdkDisplayClass
|
||||
gchar * (*utf8_to_string_target) (GdkDisplay *display,
|
||||
const gchar *text);
|
||||
|
||||
void (*make_gl_context_current) (GdkDisplay *display,
|
||||
GdkGLContext *context);
|
||||
void (*destroy_gl_context) (GdkDisplay *display,
|
||||
GdkGLContext *context);
|
||||
|
||||
/* Signals */
|
||||
void (*opened) (GdkDisplay *display);
|
||||
void (*closed) (GdkDisplay *display,
|
||||
@@ -303,6 +311,12 @@ void _gdk_display_create_window_impl (GdkDisplay *display
|
||||
gint attributes_mask);
|
||||
GdkWindow * _gdk_display_create_window (GdkDisplay *display);
|
||||
|
||||
void gdk_display_destroy_gl_context (GdkDisplay *display,
|
||||
GdkGLContext *context);
|
||||
void gdk_display_make_gl_context_current (GdkDisplay *display,
|
||||
GdkGLContext *context);
|
||||
GdkGLContext * gdk_display_get_current_gl_context (GdkDisplay *display);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_DISPLAY_PRIVATE_H__ */
|
||||
|
||||
+492
@@ -0,0 +1,492 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
* Copyright (C) 2014 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* 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 "gdkcairo.h"
|
||||
#include "gdkglcontextprivate.h"
|
||||
|
||||
#include "gdkinternals.h"
|
||||
|
||||
#include <epoxy/gl.h>
|
||||
#include <math.h>
|
||||
|
||||
static cairo_user_data_key_t direct_key;
|
||||
|
||||
void
|
||||
gdk_cairo_surface_mark_as_direct (cairo_surface_t *surface,
|
||||
GdkWindow *window)
|
||||
{
|
||||
cairo_surface_set_user_data (surface, &direct_key,
|
||||
g_object_ref (window), g_object_unref);
|
||||
}
|
||||
|
||||
/* x,y,width,height describes a rectangle in the gl render buffer
|
||||
coordinate space, and its top left corner is drawn at the current
|
||||
position according to the cairo translation. */
|
||||
|
||||
/**
|
||||
* gdk_cairo_draw_from_gl:
|
||||
* @cr: a cairo context
|
||||
* @window: The window we're rendering for (not necessarily into)
|
||||
* @source: The GL ID of the source buffer
|
||||
* @source_type: The type of the @source
|
||||
* @buffer_scale: The scale-factor that the @source buffer is allocated for
|
||||
* @x: The source x position in @source to start copying from in GL coordinates
|
||||
* @y: The source y position in @source to start copying from in GL coordinates
|
||||
* @width: The width of the region to draw
|
||||
* @height: The height of the region to draw
|
||||
*
|
||||
* This is the main way to draw GL content in GTK+. It takes a render buffer ID
|
||||
* (@source_type == #GL_RENDERBUFFER) or a texture id (@source_type == #GL_TEXTURE)
|
||||
* and draws it onto @cr with an OVER operation, respecting the current clip.
|
||||
*
|
||||
* This will work for *all* cairo_t, as long as @window is realized, but the
|
||||
* fallback implementation that reads back the pixels from the buffer may be
|
||||
* used in the general case. In the case of direct drawing to a window with
|
||||
* no special effects applied to @cr it will however use a more efficient
|
||||
* approach.
|
||||
*
|
||||
* For #GL_RENDERBUFFER the code will always fall back to software for buffers
|
||||
* with alpha components, so make sure you use #GL_TEXTURE if using alpha.
|
||||
*
|
||||
* Since: 3.16
|
||||
*/
|
||||
void
|
||||
gdk_cairo_draw_from_gl (cairo_t *cr,
|
||||
GdkWindow *window,
|
||||
int source,
|
||||
int source_type,
|
||||
int buffer_scale,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
GdkGLContext *context;
|
||||
cairo_surface_t *image;
|
||||
cairo_matrix_t matrix;
|
||||
int dx, dy, window_scale;
|
||||
gboolean trivial_transform;
|
||||
cairo_surface_t *group_target;
|
||||
GdkWindow *direct_window, *impl_window;
|
||||
GLuint framebuffer;
|
||||
GLint alpha_size = 0;
|
||||
cairo_region_t *clip_region;
|
||||
|
||||
impl_window = window->impl_window;
|
||||
|
||||
window_scale = gdk_window_get_scale_factor (impl_window);
|
||||
|
||||
context = gdk_window_get_paint_gl_context (window, NULL);
|
||||
if (context == NULL)
|
||||
{
|
||||
g_warning ("gdk_cairo_draw_gl_render_buffer failed - no paint context");
|
||||
return;
|
||||
}
|
||||
|
||||
clip_region = gdk_cairo_region_from_clip (cr);
|
||||
|
||||
gdk_gl_context_make_current (context);
|
||||
|
||||
glGenFramebuffersEXT (1, &framebuffer);
|
||||
glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, framebuffer);
|
||||
|
||||
if (source_type == GL_RENDERBUFFER)
|
||||
{
|
||||
glGetRenderbufferParameteriv (GL_RENDERBUFFER, GL_RENDERBUFFER_ALPHA_SIZE, &alpha_size);
|
||||
|
||||
glBindRenderbufferEXT (GL_RENDERBUFFER_EXT, source);
|
||||
glFramebufferRenderbufferEXT (GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
|
||||
GL_RENDERBUFFER_EXT, source);
|
||||
glBindFramebufferEXT (GL_DRAW_FRAMEBUFFER_EXT, 0);
|
||||
}
|
||||
else if (source_type == GL_TEXTURE)
|
||||
{
|
||||
glBindTexture (GL_TEXTURE_2D, source);
|
||||
|
||||
glGetTexLevelParameteriv (GL_TEXTURE_2D, 0, GL_TEXTURE_ALPHA_SIZE, &alpha_size);
|
||||
|
||||
glBindFramebufferEXT (GL_DRAW_FRAMEBUFFER_EXT, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_warning ("Unsupported gl source type %d\n", source_type);
|
||||
return;
|
||||
}
|
||||
|
||||
group_target = cairo_get_group_target (cr);
|
||||
direct_window = cairo_surface_get_user_data (group_target, &direct_key);
|
||||
|
||||
cairo_get_matrix (cr, &matrix);
|
||||
|
||||
dx = matrix.x0;
|
||||
dy = matrix.y0;
|
||||
|
||||
/* Trivial == integer-only translation */
|
||||
trivial_transform =
|
||||
(double)dx == matrix.x0 && (double)dy == matrix.y0 &&
|
||||
matrix.xx == 1.0 && matrix.xy == 0.0 &&
|
||||
matrix.yx == 0.0 && matrix.yy == 1.0;
|
||||
|
||||
/* For direct paint of non-alpha renderbuffer, we can
|
||||
just do a bitblit */
|
||||
if (source_type == GL_RENDERBUFFER &&
|
||||
alpha_size == 0 &&
|
||||
direct_window != NULL &&
|
||||
direct_window->current_paint.use_gl &&
|
||||
trivial_transform &&
|
||||
clip_region != NULL)
|
||||
{
|
||||
int window_height;
|
||||
int i;
|
||||
|
||||
/* Translate to impl coords */
|
||||
cairo_region_translate (clip_region, dx, dy);
|
||||
|
||||
glEnable (GL_SCISSOR_TEST);
|
||||
|
||||
window_height = gdk_window_get_height (impl_window);
|
||||
glDrawBuffer (GL_BACK);
|
||||
|
||||
#define FLIP_Y(_y) (window_height*window_scale - (_y))
|
||||
|
||||
for (i = 0; i < cairo_region_num_rectangles (clip_region); i++)
|
||||
{
|
||||
cairo_rectangle_int_t clip_rect, dest;
|
||||
|
||||
cairo_region_get_rectangle (clip_region, i, &clip_rect);
|
||||
clip_rect.x *= window_scale;
|
||||
clip_rect.y *= window_scale;
|
||||
clip_rect.width *= window_scale;
|
||||
clip_rect.height *= window_scale;
|
||||
|
||||
glScissor (clip_rect.x, FLIP_Y (clip_rect.y + clip_rect.height),
|
||||
clip_rect.width, clip_rect.height);
|
||||
|
||||
dest.x = dx * window_scale;
|
||||
dest.y = dy * window_scale;
|
||||
dest.width = width * window_scale / buffer_scale;
|
||||
dest.height = height * window_scale / buffer_scale;
|
||||
|
||||
if (gdk_rectangle_intersect (&clip_rect, &dest, &dest))
|
||||
{
|
||||
int clipped_src_x = x + (dest.x - dx * window_scale);
|
||||
int clipped_src_y = y + (height - dest.height - (dest.y - dy * window_scale));
|
||||
glBlitFramebufferEXT(clipped_src_x, clipped_src_y,
|
||||
(clipped_src_x + dest.width), (clipped_src_y + dest.height),
|
||||
dest.x, FLIP_Y(dest.y + dest.height),
|
||||
dest.x + dest.width, FLIP_Y(dest.y),
|
||||
GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
||||
if (impl_window->current_paint.flushed_region)
|
||||
{
|
||||
cairo_rectangle_int_t flushed_rect;
|
||||
|
||||
flushed_rect.x = dest.x / window_scale;
|
||||
flushed_rect.y = dest.y / window_scale;
|
||||
flushed_rect.width = (dest.x + dest.width + window_scale - 1) / window_scale - flushed_rect.x;
|
||||
flushed_rect.height = (dest.y + dest.height + window_scale - 1) / window_scale - flushed_rect.y;
|
||||
|
||||
cairo_region_union_rectangle (impl_window->current_paint.flushed_region,
|
||||
&flushed_rect);
|
||||
cairo_region_subtract_rectangle (impl_window->current_paint.need_blend_region,
|
||||
&flushed_rect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
glDisable (GL_SCISSOR_TEST);
|
||||
|
||||
#undef FLIP_Y
|
||||
|
||||
}
|
||||
/* For direct paint of alpha or non-alpha textures we can use texturing */
|
||||
else if (source_type == GL_TEXTURE &&
|
||||
direct_window != NULL &&
|
||||
direct_window->current_paint.use_gl &&
|
||||
trivial_transform &&
|
||||
clip_region != NULL)
|
||||
{
|
||||
int window_height;
|
||||
GLint texture_width;
|
||||
GLint texture_height;
|
||||
int i;
|
||||
|
||||
/* Translate to impl coords */
|
||||
cairo_region_translate (clip_region, dx, dy);
|
||||
|
||||
if (alpha_size != 0)
|
||||
{
|
||||
cairo_region_t *opaque_region, *blend_region;
|
||||
|
||||
opaque_region = cairo_region_copy (clip_region);
|
||||
cairo_region_subtract (opaque_region, impl_window->current_paint.flushed_region);
|
||||
cairo_region_subtract (opaque_region, impl_window->current_paint.need_blend_region);
|
||||
|
||||
if (!cairo_region_is_empty (opaque_region))
|
||||
gdk_gl_texture_from_surface (impl_window->current_paint.surface,
|
||||
opaque_region);
|
||||
|
||||
blend_region = cairo_region_copy (clip_region);
|
||||
cairo_region_intersect (blend_region, impl_window->current_paint.need_blend_region);
|
||||
|
||||
glEnable (GL_BLEND);
|
||||
if (!cairo_region_is_empty (blend_region))
|
||||
gdk_gl_texture_from_surface (impl_window->current_paint.surface,
|
||||
blend_region);
|
||||
|
||||
cairo_region_destroy (opaque_region);
|
||||
cairo_region_destroy (blend_region);
|
||||
}
|
||||
|
||||
glBindTexture (GL_TEXTURE_2D, source);
|
||||
|
||||
glGetTexLevelParameteriv (GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &texture_width);
|
||||
glGetTexLevelParameteriv (GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &texture_height);
|
||||
|
||||
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glFramebufferTexture2DEXT (GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
|
||||
GL_TEXTURE_2D, source, 0);
|
||||
|
||||
glEnable (GL_SCISSOR_TEST);
|
||||
glEnable (GL_TEXTURE_2D);
|
||||
|
||||
window_height = gdk_window_get_height (impl_window);
|
||||
|
||||
#define FLIP_Y(_y) (window_height*window_scale - (_y))
|
||||
|
||||
for (i = 0; i < cairo_region_num_rectangles (clip_region); i++)
|
||||
{
|
||||
cairo_rectangle_int_t clip_rect, dest;
|
||||
|
||||
cairo_region_get_rectangle (clip_region, i, &clip_rect);
|
||||
|
||||
clip_rect.x *= window_scale;
|
||||
clip_rect.y *= window_scale;
|
||||
clip_rect.width *= window_scale;
|
||||
clip_rect.height *= window_scale;
|
||||
|
||||
glScissor (clip_rect.x, FLIP_Y (clip_rect.y + clip_rect.height),
|
||||
clip_rect.width, clip_rect.height);
|
||||
|
||||
dest.x = dx * window_scale;
|
||||
dest.y = dy * window_scale;
|
||||
dest.width = width * window_scale / buffer_scale;
|
||||
dest.height = height * window_scale / buffer_scale;
|
||||
|
||||
if (gdk_rectangle_intersect (&clip_rect, &dest, &dest))
|
||||
{
|
||||
int clipped_src_x = x + (dest.x - dx * window_scale);
|
||||
int clipped_src_y = y + (height - dest.height - (dest.y - dy * window_scale));
|
||||
|
||||
glBegin (GL_QUADS);
|
||||
glTexCoord2f (clipped_src_x / (float)texture_width, clipped_src_y / (float)texture_height);
|
||||
glVertex2f (dest.x, FLIP_Y(dest.y + dest.height));
|
||||
|
||||
glTexCoord2f ((clipped_src_x + dest.width) / (float)texture_width, clipped_src_y / (float)texture_height);
|
||||
glVertex2f (dest.x + dest.width, FLIP_Y(dest.y + dest.height));
|
||||
|
||||
glTexCoord2f ((clipped_src_x + dest.width) / (float)texture_width, (clipped_src_y + dest.height) / (float)texture_height);
|
||||
glVertex2f (dest.x + dest.width, FLIP_Y(dest.y));
|
||||
|
||||
glTexCoord2f (clipped_src_x / (float)texture_width, (clipped_src_y + dest.height) / (float)texture_height);
|
||||
glVertex2f (dest.x, FLIP_Y(dest.y));
|
||||
glEnd();
|
||||
|
||||
if (impl_window->current_paint.flushed_region)
|
||||
{
|
||||
cairo_rectangle_int_t flushed_rect;
|
||||
|
||||
flushed_rect.x = dest.x / window_scale;
|
||||
flushed_rect.y = dest.y / window_scale;
|
||||
flushed_rect.width = (dest.x + dest.width + window_scale - 1) / window_scale - flushed_rect.x;
|
||||
flushed_rect.height = (dest.y + dest.height + window_scale - 1) / window_scale - flushed_rect.y;
|
||||
|
||||
cairo_region_union_rectangle (impl_window->current_paint.flushed_region,
|
||||
&flushed_rect);
|
||||
cairo_region_subtract_rectangle (impl_window->current_paint.need_blend_region,
|
||||
&flushed_rect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (alpha_size != 0)
|
||||
glDisable (GL_BLEND);
|
||||
|
||||
glDisable (GL_TEXTURE_2D);
|
||||
glDisable (GL_SCISSOR_TEST);
|
||||
|
||||
#undef FLIP_Y
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Software fallback */
|
||||
|
||||
/* TODO: avoid reading back non-required data due to dest clip */
|
||||
image = cairo_surface_create_similar_image (cairo_get_target (cr),
|
||||
(alpha_size == 0) ? CAIRO_FORMAT_RGB24 : CAIRO_FORMAT_ARGB32,
|
||||
width, height);
|
||||
|
||||
#ifdef HAVE_CAIRO_SURFACE_SET_DEVICE_SCALE
|
||||
cairo_surface_set_device_scale (image, buffer_scale, buffer_scale);
|
||||
#endif
|
||||
|
||||
glPixelStorei (GL_PACK_ALIGNMENT, 4);
|
||||
glPixelStorei (GL_PACK_ROW_LENGTH, cairo_image_surface_get_stride (image) / 4);
|
||||
|
||||
glReadPixels (x, y, width, height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
|
||||
cairo_image_surface_get_data (image));
|
||||
|
||||
glPixelStorei (GL_PACK_ROW_LENGTH, 0);
|
||||
|
||||
cairo_surface_mark_dirty (image);
|
||||
|
||||
/* Invert due to opengl having different origin */
|
||||
cairo_scale (cr, 1, -1);
|
||||
cairo_translate (cr, 0, -height / buffer_scale);
|
||||
|
||||
cairo_set_source_surface (cr, image, 0, 0);
|
||||
cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
|
||||
cairo_paint (cr);
|
||||
|
||||
cairo_surface_destroy (image);
|
||||
}
|
||||
|
||||
glDrawBuffer (GL_BACK);
|
||||
glReadBuffer(GL_BACK);
|
||||
|
||||
glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0);
|
||||
glDeleteFramebuffersEXT (1, &framebuffer);
|
||||
|
||||
if (clip_region)
|
||||
cairo_region_destroy (clip_region);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_gl_texture_from_surface (cairo_surface_t *surface,
|
||||
cairo_region_t *region)
|
||||
{
|
||||
GdkGLContext *current;
|
||||
cairo_surface_t *image;
|
||||
double device_x_offset, device_y_offset;
|
||||
cairo_rectangle_int_t rect, e;
|
||||
int n_rects, i;
|
||||
GdkWindow *window;
|
||||
int window_height;
|
||||
unsigned int texture_id;
|
||||
int window_scale;
|
||||
double sx, sy;
|
||||
float umax, vmax;
|
||||
gboolean use_texture_rectangle;
|
||||
guint target;
|
||||
|
||||
current = gdk_gl_context_get_current ();
|
||||
if (current &&
|
||||
GDK_GL_CONTEXT_GET_CLASS (current)->texture_from_surface &&
|
||||
GDK_GL_CONTEXT_GET_CLASS (current)->texture_from_surface (current, surface, region))
|
||||
return;
|
||||
|
||||
/* Software fallback */
|
||||
|
||||
use_texture_rectangle = gdk_gl_context_use_texture_rectangle (current);
|
||||
|
||||
window = gdk_gl_context_get_window (current);
|
||||
window_scale = gdk_window_get_scale_factor (window);
|
||||
window_height = gdk_window_get_height (window);
|
||||
|
||||
sx = sy = 1;
|
||||
#ifdef HAVE_CAIRO_SURFACE_SET_DEVICE_SCALE
|
||||
cairo_surface_get_device_scale (window->current_paint.surface, &sx, &sy);
|
||||
#endif
|
||||
|
||||
cairo_surface_get_device_offset (surface,
|
||||
&device_x_offset, &device_y_offset);
|
||||
|
||||
glGenTextures (1, &texture_id);
|
||||
if (use_texture_rectangle)
|
||||
target = GL_TEXTURE_RECTANGLE_ARB;
|
||||
else
|
||||
target = GL_TEXTURE_2D;
|
||||
|
||||
glBindTexture (target, texture_id);
|
||||
glEnable (target);
|
||||
|
||||
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
|
||||
n_rects = cairo_region_num_rectangles (region);
|
||||
for (i = 0; i < n_rects; i++)
|
||||
{
|
||||
cairo_region_get_rectangle (region, i, &rect);
|
||||
|
||||
glScissor (rect.x * window_scale, (window_height - rect.y - rect.height) * window_scale,
|
||||
rect.width * window_scale, rect.height * window_scale);
|
||||
|
||||
e = rect;
|
||||
e.x *= sx;
|
||||
e.y *= sy;
|
||||
e.x += (int)device_x_offset;
|
||||
e.y += (int)device_y_offset;
|
||||
e.width *= sx;
|
||||
e.height *= sy;
|
||||
image = cairo_surface_map_to_image (surface, &e);
|
||||
|
||||
glPixelStorei (GL_UNPACK_ALIGNMENT, 4);
|
||||
glPixelStorei (GL_UNPACK_ROW_LENGTH, cairo_image_surface_get_stride (image)/4);
|
||||
glTexImage2D (target, 0, 4, e.width, e.height, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
|
||||
cairo_image_surface_get_data (image));
|
||||
glPixelStorei (GL_UNPACK_ROW_LENGTH, 0);
|
||||
|
||||
cairo_surface_unmap_image (surface, image);
|
||||
|
||||
#define FLIP_Y(_y) (window_height - (_y))
|
||||
|
||||
if (use_texture_rectangle)
|
||||
{
|
||||
umax = rect.width * sx;
|
||||
vmax = rect.height * sy;
|
||||
}
|
||||
else
|
||||
{
|
||||
umax = 1.0;
|
||||
vmax = 1.0;
|
||||
}
|
||||
|
||||
glBegin (GL_QUADS);
|
||||
glTexCoord2f (0, vmax);
|
||||
glVertex2f (rect.x * window_scale, FLIP_Y(rect.y + rect.height) * window_scale);
|
||||
|
||||
glTexCoord2f (umax, vmax);
|
||||
glVertex2f ((rect.x + rect.width) * window_scale, FLIP_Y(rect.y + rect.height) * window_scale);
|
||||
|
||||
glTexCoord2f (umax, 0);
|
||||
glVertex2f ((rect.x + rect.width) * window_scale, FLIP_Y(rect.y) * window_scale);
|
||||
|
||||
glTexCoord2f (0, 0);
|
||||
glVertex2f (rect.x * window_scale, FLIP_Y(rect.y) * window_scale);
|
||||
glEnd();
|
||||
}
|
||||
|
||||
glDisable (target);
|
||||
glDeleteTextures (1, &texture_id);
|
||||
}
|
||||
@@ -0,0 +1,375 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
*
|
||||
* gdkglcontext.c: GL context abstraction
|
||||
*
|
||||
* Copyright © 2014 Emmanuele Bassi
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:gdkglcontext
|
||||
* @Title: GdkGLContext
|
||||
* @Short_description: OpenGL context
|
||||
*
|
||||
* #GdkGLContext is an object representing the platform-specific
|
||||
* OpenGL drawing context.
|
||||
*
|
||||
* #GdkGLContexts are created for a #GdkWindow using
|
||||
* gdk_window_create_gl_context(), and the context will match
|
||||
* the #GdkVisual of the window.
|
||||
*
|
||||
* A #GdkGLContext is not tied to any particular normal framebuffer.
|
||||
* For instance, it cannot draw to the #GdkWindow back buffer. The GDK
|
||||
* repaint system is in full control of the painting to that. Instead,
|
||||
* you can create render buffers or textures and use gdk_cairo_draw_from_gl()
|
||||
* in the draw function of your widget to draw them. Then GDK will handle
|
||||
* the integration of your rendering with that of other widgets.
|
||||
*
|
||||
* Support for #GdkGLContext is platform-specific, context creation
|
||||
* can fail, returning %NULL context.
|
||||
*
|
||||
* A #GdkGLContext has to be made "current" in order to start using
|
||||
* it, otherwise any OpenGL call will be ignored.
|
||||
*
|
||||
* ## Creating a new OpenGL context ##
|
||||
*
|
||||
* In order to create a new #GdkGLContext instance you need a
|
||||
* #GdkWindow, which you typically get during the realize call
|
||||
* of a widget.
|
||||
*
|
||||
* ## Using a GdkGLContext ##
|
||||
*
|
||||
* You will need to make the #GdkGLContext the current context
|
||||
* before issuing OpenGL calls; the system sends OpenGL commands to
|
||||
* whichever context is current. It is possible to have multiple
|
||||
* contexts, so you always need to ensure that the one which you
|
||||
* want to draw with is the current one before issuing commands:
|
||||
*
|
||||
* |[<!-- language="C" -->
|
||||
* gdk_gl_context_make_current (context);
|
||||
* ]|
|
||||
*
|
||||
* You can now perform your drawing using OpenGL commands.
|
||||
*
|
||||
* You can check which #GdkGLContext is the current one by using
|
||||
* gdk_gl_context_get_current(); you can also unset any #GdkGLContext
|
||||
* that is currently set by calling gdk_gl_context_clear_current().
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gdkglcontextprivate.h"
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include "gdkvisual.h"
|
||||
#include "gdkinternals.h"
|
||||
|
||||
#include "gdkintl.h"
|
||||
|
||||
#include <epoxy/gl.h>
|
||||
|
||||
typedef struct {
|
||||
GdkWindow *window;
|
||||
GdkVisual *visual;
|
||||
|
||||
guint realized : 1;
|
||||
guint use_texture_rectangle : 1;
|
||||
|
||||
} GdkGLContextPrivate;
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
|
||||
PROP_WINDOW,
|
||||
PROP_VISUAL,
|
||||
|
||||
LAST_PROP
|
||||
};
|
||||
|
||||
static GParamSpec *obj_pspecs[LAST_PROP] = { NULL, };
|
||||
|
||||
G_DEFINE_QUARK (gdk-gl-error-quark, gdk_gl_error)
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GdkGLContext, gdk_gl_context, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
gdk_gl_context_dispose (GObject *gobject)
|
||||
{
|
||||
GdkGLContext *context = GDK_GL_CONTEXT (gobject);
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
|
||||
|
||||
gdk_display_destroy_gl_context (gdk_window_get_display (priv->window), context);
|
||||
|
||||
g_clear_object (&priv->window);
|
||||
g_clear_object (&priv->visual);
|
||||
|
||||
G_OBJECT_CLASS (gdk_gl_context_parent_class)->dispose (gobject);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_gl_context_set_property (GObject *gobject,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private ((GdkGLContext *) gobject);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_WINDOW:
|
||||
{
|
||||
GdkWindow *window = g_value_get_object (value);
|
||||
|
||||
if (window)
|
||||
g_object_ref (window);
|
||||
|
||||
if (priv->window)
|
||||
g_object_unref (priv->window);
|
||||
|
||||
priv->window = window;
|
||||
}
|
||||
break;
|
||||
|
||||
case PROP_VISUAL:
|
||||
{
|
||||
GdkVisual *visual = g_value_get_object (value);
|
||||
|
||||
if (visual != NULL)
|
||||
priv->visual = g_object_ref (visual);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_gl_context_get_property (GObject *gobject,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private ((GdkGLContext *) gobject);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_WINDOW:
|
||||
g_value_set_object (value, priv->window);
|
||||
break;
|
||||
|
||||
case PROP_VISUAL:
|
||||
g_value_set_object (value, priv->visual);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_gl_context_class_init (GdkGLContextClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
/**
|
||||
* GdkGLContext:window:
|
||||
*
|
||||
* The #GdkWindow the gl context is bound to.
|
||||
*
|
||||
* Since: 3.16
|
||||
*/
|
||||
obj_pspecs[PROP_WINDOW] =
|
||||
g_param_spec_object ("window",
|
||||
P_("Window"),
|
||||
P_("The GDK window bound to the GL context"),
|
||||
GDK_TYPE_WINDOW,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkGLContext:visual:
|
||||
*
|
||||
* The #GdkVisual matching the pixel format used by the context.
|
||||
*
|
||||
* Since: 3.16
|
||||
*/
|
||||
obj_pspecs[PROP_VISUAL] =
|
||||
g_param_spec_object ("visual",
|
||||
P_("Visual"),
|
||||
P_("The GDK visual used by the GL context"),
|
||||
GDK_TYPE_VISUAL,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
gobject_class->set_property = gdk_gl_context_set_property;
|
||||
gobject_class->get_property = gdk_gl_context_get_property;
|
||||
gobject_class->dispose = gdk_gl_context_dispose;
|
||||
|
||||
g_object_class_install_properties (gobject_class, LAST_PROP, obj_pspecs);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_gl_context_init (GdkGLContext *self)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_context_get_visual:
|
||||
* @context: a #GdkGLContext
|
||||
*
|
||||
* Retrieves the #GdkVisual associated with the @context.
|
||||
*
|
||||
* Returns: (transfer none): the #GdkVisual
|
||||
*
|
||||
* Since: 3.16
|
||||
*/
|
||||
GdkVisual *
|
||||
gdk_gl_context_get_visual (GdkGLContext *context)
|
||||
{
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
|
||||
|
||||
g_return_val_if_fail (GDK_IS_GL_CONTEXT (context), NULL);
|
||||
|
||||
return priv->visual;
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gdk_gl_context_end_frame:
|
||||
* @context: a #GdkGLContext
|
||||
* @painted: The area that has been redrawn this frame
|
||||
* @damage: The area that we know is actually different from the last frame
|
||||
*
|
||||
* Copies the back buffer to the front buffer.
|
||||
*
|
||||
* This function may call `glFlush()` implicitly before returning; it
|
||||
* is not recommended to call `glFlush()` explicitly before calling
|
||||
* this function.
|
||||
*
|
||||
* Since: 3.16
|
||||
*/
|
||||
void
|
||||
gdk_gl_context_end_frame (GdkGLContext *context,
|
||||
cairo_region_t *painted,
|
||||
cairo_region_t *damage)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_GL_CONTEXT (context));
|
||||
|
||||
GDK_GL_CONTEXT_GET_CLASS (context)->end_frame (context, painted, damage);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_gl_context_use_texture_rectangle (GdkGLContext *context)
|
||||
{
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
|
||||
|
||||
return priv->use_texture_rectangle;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_gl_context_realize (GdkGLContext *context)
|
||||
{
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
|
||||
gboolean has_npot, has_texture_rectangle;
|
||||
|
||||
has_npot = epoxy_has_gl_extension ("GL_ARB_texture_non_power_of_two");
|
||||
has_texture_rectangle = epoxy_has_gl_extension ("GL_ARB_texture_rectangle");
|
||||
|
||||
if (has_npot)
|
||||
priv->use_texture_rectangle = FALSE;
|
||||
else if (has_texture_rectangle)
|
||||
priv->use_texture_rectangle = TRUE;
|
||||
else
|
||||
g_warning ("Gl implementation doesn't support any form of non-power-of-two textures");
|
||||
|
||||
priv->realized = TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_context_make_current:
|
||||
* @context: a #GdkGLContext
|
||||
*
|
||||
* Makes the @context the current one.
|
||||
*
|
||||
* Since: 3.16
|
||||
*/
|
||||
void
|
||||
gdk_gl_context_make_current (GdkGLContext *context)
|
||||
{
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
|
||||
|
||||
g_return_if_fail (GDK_IS_GL_CONTEXT (context));
|
||||
|
||||
gdk_display_make_gl_context_current (gdk_window_get_display (priv->window), context);
|
||||
|
||||
if (!priv->realized)
|
||||
gdk_gl_context_realize (context);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_context_get_window:
|
||||
* @context: a #GdkGLContext
|
||||
*
|
||||
* Retrieves the #GdkWindow used by the @context.
|
||||
*
|
||||
* Returns: (transfer none): a #GdkWindow or %NULL
|
||||
*
|
||||
* Since: 3.16
|
||||
*/
|
||||
GdkWindow *
|
||||
gdk_gl_context_get_window (GdkGLContext *context)
|
||||
{
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
|
||||
|
||||
g_return_val_if_fail (GDK_IS_GL_CONTEXT (context), NULL);
|
||||
|
||||
return priv->window;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_context_clear_current:
|
||||
*
|
||||
* Clears the current #GdkGLContext.
|
||||
*
|
||||
* Any OpenGL call after this function returns will be ignored
|
||||
* until gdk_gl_context_make_current() is called.
|
||||
*
|
||||
* Since: 3.16
|
||||
*/
|
||||
void
|
||||
gdk_gl_context_clear_current (void)
|
||||
{
|
||||
GdkDisplay *display = gdk_display_get_default ();
|
||||
|
||||
gdk_display_make_gl_context_current (display, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_context_get_current:
|
||||
*
|
||||
* Retrieves the current #GdkGLContext.
|
||||
*
|
||||
* Returns: (transfer none): the current #GdkGLContext, or %NULL
|
||||
*
|
||||
* Since: 3.16
|
||||
*/
|
||||
GdkGLContext *
|
||||
gdk_gl_context_get_current (void)
|
||||
{
|
||||
GdkDisplay *display = gdk_display_get_default ();
|
||||
|
||||
return gdk_display_get_current_gl_context (display);
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
*
|
||||
* gdkglcontext.h: GL context abstraction
|
||||
*
|
||||
* Copyright © 2014 Emmanuele Bassi
|
||||
*
|
||||
* 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_GL_CONTEXT_H__
|
||||
#define __GDK_GL_CONTEXT_H__
|
||||
|
||||
#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
|
||||
#error "Only <gdk/gdk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gdk/gdkversionmacros.h>
|
||||
#include <gdk/gdktypes.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GDK_TYPE_GL_CONTEXT (gdk_gl_context_get_type ())
|
||||
#define GDK_GL_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_GL_CONTEXT, GdkGLContext))
|
||||
#define GDK_IS_GL_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_GL_CONTEXT))
|
||||
|
||||
#define GDK_GL_ERROR (gdk_gl_error_quark ())
|
||||
|
||||
GDK_AVAILABLE_IN_3_16
|
||||
GQuark gdk_gl_error_quark (void);
|
||||
|
||||
GDK_AVAILABLE_IN_3_16
|
||||
GType gdk_gl_context_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GDK_AVAILABLE_IN_3_16
|
||||
GdkVisual * gdk_gl_context_get_visual (GdkGLContext *context);
|
||||
GDK_AVAILABLE_IN_3_16
|
||||
GdkWindow * gdk_gl_context_get_window (GdkGLContext *context);
|
||||
|
||||
GDK_AVAILABLE_IN_3_16
|
||||
void gdk_gl_context_make_current (GdkGLContext *context);
|
||||
GDK_AVAILABLE_IN_3_16
|
||||
GdkGLContext * gdk_gl_context_get_current (void);
|
||||
GDK_AVAILABLE_IN_3_16
|
||||
void gdk_gl_context_clear_current (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_GL_CONTEXT_H__ */
|
||||
@@ -0,0 +1,59 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
*
|
||||
* gdkglcontextprivate.h: GL context abstraction
|
||||
*
|
||||
* Copyright © 2014 Emmanuele Bassi
|
||||
*
|
||||
* 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_GL_CONTEXT_PRIVATE_H__
|
||||
#define __GDK_GL_CONTEXT_PRIVATE_H__
|
||||
|
||||
#include "gdkglcontext.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GDK_GL_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_GL_CONTEXT, GdkGLContextClass))
|
||||
#define GDK_IS_GL_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_GL_CONTEXT))
|
||||
#define GDK_GL_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_GL_CONTEXT, GdkGLContextClass))
|
||||
|
||||
typedef struct _GdkGLContextClass GdkGLContextClass;
|
||||
|
||||
struct _GdkGLContext
|
||||
{
|
||||
GObject parent_instance;
|
||||
};
|
||||
|
||||
struct _GdkGLContextClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
|
||||
void (* update) (GdkGLContext *context);
|
||||
void (* end_frame) (GdkGLContext *context,
|
||||
cairo_region_t *painted,
|
||||
cairo_region_t *damage);
|
||||
gboolean (* texture_from_surface) (GdkGLContext *context,
|
||||
cairo_surface_t *surface,
|
||||
cairo_region_t *region);
|
||||
};
|
||||
|
||||
gboolean gdk_gl_context_use_texture_rectangle (GdkGLContext *context);
|
||||
void gdk_gl_context_end_frame (GdkGLContext *context,
|
||||
cairo_region_t *painted,
|
||||
cairo_region_t *damage);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_GL_CONTEXT_PRIVATE_H__ */
|
||||
+30
-4
@@ -84,7 +84,9 @@ typedef enum {
|
||||
GDK_DEBUG_DRAW = 1 << 9,
|
||||
GDK_DEBUG_EVENTLOOP = 1 << 10,
|
||||
GDK_DEBUG_FRAMES = 1 << 11,
|
||||
GDK_DEBUG_SETTINGS = 1 << 12
|
||||
GDK_DEBUG_SETTINGS = 1 << 12,
|
||||
GDK_DEBUG_NOGL = 1 << 13,
|
||||
GDK_DEBUG_OPENGL = 1 << 14
|
||||
} GdkDebugFlag;
|
||||
|
||||
typedef enum {
|
||||
@@ -208,18 +210,33 @@ struct _GdkWindow
|
||||
struct {
|
||||
cairo_region_t *region;
|
||||
cairo_surface_t *surface;
|
||||
|
||||
/* Areas of region that have been copied to the back buffer already */
|
||||
cairo_region_t *flushed_region;
|
||||
/* Areas of region that have been copied to the back buffer but
|
||||
needs furter blending of surface data. These two regions are
|
||||
always non-intersecting. */
|
||||
cairo_region_t *need_blend_region;
|
||||
|
||||
gboolean surface_needs_composite;
|
||||
gboolean use_gl;
|
||||
} current_paint;
|
||||
GdkGLContext *gl_paint_context;
|
||||
|
||||
cairo_region_t *update_area;
|
||||
guint update_freeze_count;
|
||||
/* This is the update_area that was in effect when the current expose
|
||||
started. It may be smaller than the expose area if we'e painting
|
||||
more than we have to, but it represents the "true" damage. */
|
||||
cairo_region_t *active_update_area;
|
||||
/* We store the old expose areas to support buffer-age optimizations */
|
||||
cairo_region_t *old_updated_area[2];
|
||||
|
||||
GdkWindowState state;
|
||||
|
||||
guint8 alpha;
|
||||
guint8 fullscreen_mode;
|
||||
|
||||
guint guffaw_gravity : 1;
|
||||
guint input_only : 1;
|
||||
guint modal_hint : 1;
|
||||
guint composited : 1;
|
||||
@@ -320,8 +337,14 @@ void _gdk_windowing_event_data_free (GdkEvent *event);
|
||||
void _gdk_set_window_state (GdkWindow *window,
|
||||
GdkWindowState new_state);
|
||||
|
||||
gboolean _gdk_cairo_surface_extents (cairo_surface_t *surface,
|
||||
GdkRectangle *extents);
|
||||
gboolean _gdk_cairo_surface_extents (cairo_surface_t *surface,
|
||||
GdkRectangle *extents);
|
||||
void gdk_gl_texture_from_surface (cairo_surface_t *surface,
|
||||
cairo_region_t *region);
|
||||
void gdk_cairo_surface_mark_as_direct (cairo_surface_t *surface,
|
||||
GdkWindow *window);
|
||||
cairo_region_t *gdk_cairo_region_from_clip (cairo_t *cr);
|
||||
|
||||
|
||||
/*************************************
|
||||
* Interfaces used by windowing code *
|
||||
@@ -335,6 +358,9 @@ void _gdk_window_destroy (GdkWindow *window,
|
||||
void _gdk_window_clear_update_area (GdkWindow *window);
|
||||
void _gdk_window_update_size (GdkWindow *window);
|
||||
gboolean _gdk_window_update_viewable (GdkWindow *window);
|
||||
GdkGLContext * gdk_window_get_paint_gl_context (GdkWindow *window,
|
||||
GError **error);
|
||||
|
||||
|
||||
void _gdk_window_process_updates_recurse (GdkWindow *window,
|
||||
cairo_region_t *expose_region);
|
||||
|
||||
@@ -515,13 +515,6 @@ gdk_offscreen_window_input_shape_combine_region (GdkWindow *window,
|
||||
{
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_offscreen_window_set_static_gravities (GdkWindow *window,
|
||||
gboolean use_static)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_offscreen_window_get_geometry (GdkWindow *window,
|
||||
gint *x,
|
||||
@@ -703,7 +696,6 @@ gdk_offscreen_window_class_init (GdkOffscreenWindowClass *klass)
|
||||
impl_class->get_device_state = gdk_offscreen_window_get_device_state;
|
||||
impl_class->shape_combine_region = gdk_offscreen_window_shape_combine_region;
|
||||
impl_class->input_shape_combine_region = gdk_offscreen_window_input_shape_combine_region;
|
||||
impl_class->set_static_gravities = gdk_offscreen_window_set_static_gravities;
|
||||
impl_class->queue_antiexpose = gdk_offscreen_window_queue_antiexpose;
|
||||
impl_class->destroy = gdk_offscreen_window_destroy;
|
||||
impl_class->destroy_foreign = NULL;
|
||||
|
||||
+21
-1
@@ -128,6 +128,8 @@ typedef struct _GdkWindow GdkWindow;
|
||||
typedef struct _GdkKeymap GdkKeymap;
|
||||
typedef struct _GdkAppLaunchContext GdkAppLaunchContext;
|
||||
|
||||
typedef struct _GdkGLContext GdkGLContext;
|
||||
|
||||
/**
|
||||
* GdkByteOrder:
|
||||
* @GDK_LSB_FIRST: The values are stored with the least-significant byte
|
||||
@@ -429,8 +431,26 @@ struct _GdkPoint
|
||||
gint y;
|
||||
};
|
||||
|
||||
/**
|
||||
* GdkGLProfile:
|
||||
* @GDK_GL_PROFILE_DEFAULT: ...
|
||||
* @GDK_GL_PROFILE_LEGACY: ...
|
||||
* @GDK_GL_PROFILE_3_2_CORE: ...
|
||||
*
|
||||
* ...
|
||||
*/
|
||||
typedef enum {
|
||||
GDK_GL_PROFILE_DEFAULT,
|
||||
GDK_GL_PROFILE_LEGACY,
|
||||
GDK_GL_PROFILE_3_2_CORE
|
||||
} GdkGLProfile;
|
||||
|
||||
typedef enum {
|
||||
GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
GDK_GL_ERROR_UNSUPPORTED_FORMAT,
|
||||
GDK_GL_ERROR_UNSUPPORTED_PROFILE
|
||||
} GdkGLError;
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
#endif /* __GDK_TYPES_H__ */
|
||||
|
||||
@@ -132,6 +132,16 @@
|
||||
*/
|
||||
#define GDK_VERSION_3_14 (G_ENCODE_VERSION (3, 14))
|
||||
|
||||
/**
|
||||
* GDK_VERSION_3_16:
|
||||
*
|
||||
* A macro that evaluates to the 3.16 version of GDK, in a format
|
||||
* that can be used by the C pre-processor.
|
||||
*
|
||||
* Since: 3.16
|
||||
*/
|
||||
#define GDK_VERSION_3_16 (G_ENCODE_VERSION (3, 16))
|
||||
|
||||
/* evaluates to the current stable version; for development cycles,
|
||||
* this means the next stable target
|
||||
*/
|
||||
@@ -316,5 +326,19 @@
|
||||
# define GDK_AVAILABLE_IN_3_14 _GDK_EXTERN
|
||||
#endif
|
||||
|
||||
#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_16
|
||||
# define GDK_DEPRECATED_IN_3_16 GDK_DEPRECATED
|
||||
# define GDK_DEPRECATED_IN_3_16_FOR(f) GDK_DEPRECATED_FOR(f)
|
||||
#else
|
||||
# define GDK_DEPRECATED_IN_3_16 _GDK_EXTERN
|
||||
# define GDK_DEPRECATED_IN_3_16_FOR(f) _GDK_EXTERN
|
||||
#endif
|
||||
|
||||
#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_3_16
|
||||
# define GDK_AVAILABLE_IN_3_16 GDK_UNAVAILABLE(3, 16)
|
||||
#else
|
||||
# define GDK_AVAILABLE_IN_3_16 _GDK_EXTERN
|
||||
#endif
|
||||
|
||||
#endif /* __GDK_VERSION_MACROS_H__ */
|
||||
|
||||
|
||||
+342
-65
@@ -39,9 +39,12 @@
|
||||
#include "gdkmarshalers.h"
|
||||
#include "gdkframeclockidle.h"
|
||||
#include "gdkwindowimpl.h"
|
||||
#include "gdkglcontextprivate.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include <epoxy/gl.h>
|
||||
|
||||
/* for the use of round() */
|
||||
#include "fallback-c89.c"
|
||||
|
||||
@@ -185,6 +188,11 @@ static cairo_surface_t *gdk_window_ref_impl_surface (GdkWindow *window);
|
||||
static void gdk_window_set_frame_clock (GdkWindow *window,
|
||||
GdkFrameClock *clock);
|
||||
|
||||
static void draw_ugly_color (GdkWindow *window,
|
||||
const cairo_region_t *region,
|
||||
int color);
|
||||
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
static gpointer parent_class = NULL;
|
||||
@@ -279,11 +287,16 @@ create_surface_accumulator (GSignalInvocationHint *ihint,
|
||||
|
||||
static GQuark quark_pointer_window = 0;
|
||||
|
||||
static gboolean always_use_gl = FALSE;
|
||||
|
||||
static void
|
||||
gdk_window_class_init (GdkWindowClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
if (g_getenv ("GDK_ALWAYS_USE_GL"))
|
||||
always_use_gl = TRUE;
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
object_class->finalize = gdk_window_finalize;
|
||||
@@ -1024,9 +1037,35 @@ recompute_visible_regions (GdkWindow *private,
|
||||
recalculate_children);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_window_clear_old_updated_area (GdkWindow *window)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
if (window->old_updated_area[i])
|
||||
{
|
||||
cairo_region_destroy (window->old_updated_area[i]);
|
||||
window->old_updated_area[i] = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_window_append_old_updated_area (GdkWindow *window,
|
||||
cairo_region_t *region)
|
||||
{
|
||||
if (window->old_updated_area[1])
|
||||
cairo_region_destroy (window->old_updated_area[1]);
|
||||
window->old_updated_area[1] = window->old_updated_area[0];
|
||||
window->old_updated_area[0] = cairo_region_reference (region);
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_window_update_size (GdkWindow *window)
|
||||
{
|
||||
gdk_window_clear_old_updated_area (window);
|
||||
recompute_visible_regions (window, FALSE);
|
||||
}
|
||||
|
||||
@@ -1335,8 +1374,7 @@ gdk_window_new (GdkWindow *parent,
|
||||
window->input_only = TRUE;
|
||||
}
|
||||
|
||||
if (window->parent)
|
||||
window->parent->children = g_list_prepend (window->parent->children, window);
|
||||
window->parent->children = g_list_prepend (window->parent->children, window);
|
||||
|
||||
if (window->parent->window_type == GDK_WINDOW_ROOT)
|
||||
{
|
||||
@@ -1362,8 +1400,7 @@ gdk_window_new (GdkWindow *parent,
|
||||
_gdk_display_create_window_impl (display, window, real_parent, screen, event_mask, attributes, attributes_mask);
|
||||
window->impl_window = window;
|
||||
|
||||
if (parent)
|
||||
parent->impl_window->native_children = g_list_prepend (parent->impl_window->native_children, window);
|
||||
parent->impl_window->native_children = g_list_prepend (parent->impl_window->native_children, window);
|
||||
|
||||
/* This will put the native window topmost in the native parent, which may
|
||||
* be wrong wrt other native windows in the non-native hierarchy, so restack */
|
||||
@@ -1386,6 +1423,18 @@ gdk_window_new (GdkWindow *parent,
|
||||
g_signal_connect (device_manager, "device-removed",
|
||||
G_CALLBACK (device_removed_cb), window);
|
||||
|
||||
|
||||
if (always_use_gl)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
if (gdk_window_get_paint_gl_context (window, &error) == NULL)
|
||||
{
|
||||
g_warning ("Unable to force GL enabled: %s\n", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
}
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
@@ -1712,9 +1761,8 @@ gdk_window_ensure_native (GdkWindow *window)
|
||||
NULL, 0);
|
||||
new_impl = window->impl;
|
||||
|
||||
if (parent)
|
||||
parent->impl_window->native_children =
|
||||
g_list_prepend (parent->impl_window->native_children, window);
|
||||
parent->impl_window->native_children =
|
||||
g_list_prepend (parent->impl_window->native_children, window);
|
||||
|
||||
window->impl = old_impl;
|
||||
change_impl (window, window, new_impl);
|
||||
@@ -1838,6 +1886,12 @@ gdk_window_free_current_paint (GdkWindow *window)
|
||||
cairo_region_destroy (window->current_paint.region);
|
||||
window->current_paint.region = NULL;
|
||||
|
||||
cairo_region_destroy (window->current_paint.flushed_region);
|
||||
window->current_paint.flushed_region = NULL;
|
||||
|
||||
cairo_region_destroy (window->current_paint.need_blend_region);
|
||||
window->current_paint.need_blend_region = NULL;
|
||||
|
||||
window->current_paint.surface_needs_composite = FALSE;
|
||||
}
|
||||
|
||||
@@ -2665,6 +2719,66 @@ gdk_window_ref_impl_surface (GdkWindow *window)
|
||||
return GDK_WINDOW_IMPL_GET_CLASS (window->impl)->ref_cairo_surface (gdk_window_get_impl_window (window));
|
||||
}
|
||||
|
||||
GdkGLContext *
|
||||
gdk_window_get_paint_gl_context (GdkWindow *window, GError **error)
|
||||
{
|
||||
if (_gdk_debug_flags & GDK_DEBUG_NOGL)
|
||||
{
|
||||
g_set_error_literal (error, GDK_GL_ERROR,
|
||||
GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
_("GL support disabled via GDK_DEBUG"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (window->impl_window->gl_paint_context == NULL)
|
||||
window->impl_window->gl_paint_context =
|
||||
GDK_WINDOW_IMPL_GET_CLASS (window->impl)->create_gl_context (window,
|
||||
TRUE,
|
||||
GDK_GL_PROFILE_DEFAULT,
|
||||
NULL,
|
||||
error);
|
||||
|
||||
return window->impl_window->gl_paint_context;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_window_create_gl_context:
|
||||
* @window: a #GdkWindow
|
||||
* @profile: the GL profile the context should target
|
||||
* @error: return location for an error
|
||||
*
|
||||
* Creates a new #GdkGLContext matching the
|
||||
* framebuffer format to the visual of the #GdkWindow. The context
|
||||
* is disconnected from any particular window or surface.
|
||||
*
|
||||
* If the creation of the #GdkGLContext failed, @error will be set.
|
||||
*
|
||||
* Returns: (transfer full): the newly created #GdkGLContext, or
|
||||
* %NULL on error
|
||||
*
|
||||
* Since: 3.16
|
||||
**/
|
||||
GdkGLContext *
|
||||
gdk_window_create_gl_context (GdkWindow *window,
|
||||
GdkGLProfile profile,
|
||||
GError **error)
|
||||
{
|
||||
GdkGLContext *paint_context;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
||||
|
||||
paint_context = gdk_window_get_paint_gl_context (window, error);
|
||||
if (paint_context == NULL)
|
||||
return NULL;
|
||||
|
||||
return GDK_WINDOW_IMPL_GET_CLASS (window->impl)->create_gl_context (window,
|
||||
FALSE,
|
||||
profile,
|
||||
paint_context,
|
||||
error);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_window_begin_paint_rect:
|
||||
* @window: a #GdkWindow
|
||||
@@ -2741,6 +2855,7 @@ gdk_window_begin_paint_region (GdkWindow *window,
|
||||
GdkWindowImplClass *impl_class;
|
||||
double sx, sy;
|
||||
gboolean needs_surface;
|
||||
cairo_content_t surface_content;
|
||||
|
||||
g_return_if_fail (GDK_IS_WINDOW (window));
|
||||
|
||||
@@ -2762,14 +2877,60 @@ gdk_window_begin_paint_region (GdkWindow *window,
|
||||
needs_surface = impl_class->begin_paint_region (window, region);
|
||||
|
||||
window->current_paint.region = cairo_region_copy (region);
|
||||
|
||||
cairo_region_intersect (window->current_paint.region, window->clip_region);
|
||||
cairo_region_get_extents (window->current_paint.region, &clip_box);
|
||||
|
||||
window->current_paint.flushed_region = cairo_region_create ();
|
||||
window->current_paint.need_blend_region = cairo_region_create ();
|
||||
|
||||
surface_content = gdk_window_get_content (window);
|
||||
|
||||
window->current_paint.use_gl = window->impl_window->gl_paint_context != NULL;
|
||||
|
||||
if (window->current_paint.use_gl)
|
||||
{
|
||||
GdkGLContext *context;
|
||||
|
||||
int ww = gdk_window_get_width (window) * gdk_window_get_scale_factor (window);
|
||||
int wh = gdk_window_get_height (window) * gdk_window_get_scale_factor (window);
|
||||
|
||||
context = gdk_window_get_paint_gl_context (window, NULL);
|
||||
if (context == NULL)
|
||||
{
|
||||
g_warning ("gl rendering failed, context: %p", context);
|
||||
window->current_paint.use_gl = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
gdk_gl_context_make_current (context);
|
||||
/* With gl we always need a surface to combine the gl
|
||||
drawing with the native drawing. */
|
||||
needs_surface = TRUE;
|
||||
/* Also, we need the surface to include alpha */
|
||||
surface_content = CAIRO_CONTENT_COLOR_ALPHA;
|
||||
|
||||
/* Initial setup */
|
||||
glClearColor (0.0f, 0.0f, 0.0f, 0.0f);
|
||||
glDisable (GL_DEPTH_TEST);
|
||||
glDisable(GL_BLEND);
|
||||
glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||
|
||||
glViewport (0, 0, ww, wh);
|
||||
|
||||
glMatrixMode (GL_PROJECTION);
|
||||
glLoadIdentity ();
|
||||
glOrtho (0.0f, ww, 0.0f, wh, -1.0f, 1.0f);
|
||||
|
||||
glMatrixMode (GL_MODELVIEW);
|
||||
glLoadIdentity ();
|
||||
}
|
||||
}
|
||||
|
||||
if (needs_surface)
|
||||
{
|
||||
window->current_paint.surface = gdk_window_create_similar_surface (window,
|
||||
gdk_window_get_content (window),
|
||||
surface_content,
|
||||
MAX (clip_box.width, 1),
|
||||
MAX (clip_box.height, 1));
|
||||
sx = sy = 1;
|
||||
@@ -2777,6 +2938,7 @@ gdk_window_begin_paint_region (GdkWindow *window,
|
||||
cairo_surface_get_device_scale (window->current_paint.surface, &sx, &sy);
|
||||
#endif
|
||||
cairo_surface_set_device_offset (window->current_paint.surface, -clip_box.x*sx, -clip_box.y*sy);
|
||||
gdk_cairo_surface_mark_as_direct (window->current_paint.surface, window);
|
||||
|
||||
window->current_paint.surface_needs_composite = TRUE;
|
||||
}
|
||||
@@ -2790,18 +2952,87 @@ gdk_window_begin_paint_region (GdkWindow *window,
|
||||
gdk_window_clear_backing_region (window);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_window_mark_paint_from_clip:
|
||||
* @window: a #GdkWindow
|
||||
* @cr: a #cairo_t
|
||||
*
|
||||
* If you call this during a paint (e.g. between gdk_window_begin_paint_region()
|
||||
* and gdk_window_end_paint() then GDK will mark the current clip region of the
|
||||
* window as being drawn. This is required when mixing GL rendering via
|
||||
* gdk_cairo_draw_from_gl() and cairo rendering, as otherwise GDK has no way
|
||||
* of knowing when something paints over the GL-drawn regions.
|
||||
*
|
||||
* This is typically called automatically by GTK+ and you don't need
|
||||
* to care about this.
|
||||
*
|
||||
* Since: 3.16
|
||||
**/
|
||||
void
|
||||
gdk_window_mark_paint_from_clip (GdkWindow *window,
|
||||
cairo_t *cr)
|
||||
{
|
||||
cairo_region_t *clip_region;
|
||||
GdkWindow *impl_window = window->impl_window;
|
||||
|
||||
if (impl_window->current_paint.surface == NULL ||
|
||||
cairo_get_target (cr) != impl_window->current_paint.surface)
|
||||
return;
|
||||
|
||||
if (cairo_region_is_empty (impl_window->current_paint.flushed_region))
|
||||
return;
|
||||
|
||||
/* This here seems a bit weird, but basically, we're taking the current
|
||||
clip and applying also the flushed region, and the result is that the
|
||||
new clip is the intersection of these. This is the area where the newly
|
||||
drawn region overlaps a previosly flushed area, which is an area of the
|
||||
double buffer surface that need to be blended OVER the back buffer rather
|
||||
than SRCed. */
|
||||
cairo_save (cr);
|
||||
/* We set the identity matrix here so we get and apply regions in native
|
||||
window coordinates. */
|
||||
cairo_identity_matrix (cr);
|
||||
gdk_cairo_region (cr, impl_window->current_paint.flushed_region);
|
||||
cairo_clip (cr);
|
||||
|
||||
clip_region = gdk_cairo_region_from_clip (cr);
|
||||
if (clip_region == NULL)
|
||||
{
|
||||
/* Failed to represent clip as region, mark all as requiring
|
||||
blend */
|
||||
cairo_region_union (impl_window->current_paint.need_blend_region,
|
||||
impl_window->current_paint.flushed_region);
|
||||
cairo_region_destroy (impl_window->current_paint.flushed_region);
|
||||
impl_window->current_paint.flushed_region = cairo_region_create ();
|
||||
}
|
||||
else
|
||||
{
|
||||
cairo_region_subtract (impl_window->current_paint.flushed_region, clip_region);
|
||||
cairo_region_union (impl_window->current_paint.need_blend_region, clip_region);
|
||||
}
|
||||
|
||||
/* Clear the area on the double buffer surface to transparent so we
|
||||
can start drawing from scratch the area "above" the flushed
|
||||
region */
|
||||
cairo_set_source_rgba (cr, 0, 0, 0, 0);
|
||||
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
|
||||
cairo_paint (cr);
|
||||
|
||||
cairo_restore (cr);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_window_end_paint:
|
||||
* @window: a #GdkWindow
|
||||
*
|
||||
* Indicates that the backing store created by the most recent call to
|
||||
* gdk_window_begin_paint_region() should be copied onscreen and
|
||||
* Indicates that the backing store created by the most recent call
|
||||
* to gdk_window_begin_paint_region() should be copied onscreen and
|
||||
* deleted, leaving the next-most-recent backing store or no backing
|
||||
* store at all as the active paint region. See
|
||||
* gdk_window_begin_paint_region() for full details. It is an error to
|
||||
* call this function without a matching
|
||||
* gdk_window_begin_paint_region() first.
|
||||
* gdk_window_begin_paint_region() for full details.
|
||||
*
|
||||
* It is an error to call this function without a matching
|
||||
* gdk_window_begin_paint_region() first.
|
||||
**/
|
||||
void
|
||||
gdk_window_end_paint (GdkWindow *window)
|
||||
@@ -2809,7 +3040,6 @@ gdk_window_end_paint (GdkWindow *window)
|
||||
GdkWindow *composited;
|
||||
GdkWindowImplClass *impl_class;
|
||||
GdkRectangle clip_box = { 0, };
|
||||
cairo_region_t *full_clip;
|
||||
cairo_t *cr;
|
||||
|
||||
g_return_if_fail (GDK_IS_WINDOW (window));
|
||||
@@ -2829,41 +3059,56 @@ gdk_window_end_paint (GdkWindow *window)
|
||||
if (impl_class->end_paint)
|
||||
impl_class->end_paint (window);
|
||||
|
||||
|
||||
if (window->current_paint.surface_needs_composite)
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
gboolean skip_alpha_blending;
|
||||
|
||||
cairo_region_get_extents (window->current_paint.region, &clip_box);
|
||||
full_clip = cairo_region_copy (window->clip_region);
|
||||
cairo_region_intersect (full_clip, window->current_paint.region);
|
||||
|
||||
surface = gdk_window_ref_impl_surface (window);
|
||||
cr = cairo_create (surface);
|
||||
cairo_surface_destroy (surface);
|
||||
|
||||
cairo_set_source_surface (cr, window->current_paint.surface, 0, 0);
|
||||
gdk_cairo_region (cr, full_clip);
|
||||
cairo_clip (cr);
|
||||
|
||||
/* We can skip alpha blending for a fast composite case
|
||||
* if we have an impl window or we're a fully opaque window. */
|
||||
skip_alpha_blending = (gdk_window_has_impl (window) ||
|
||||
window->alpha == 255);
|
||||
|
||||
if (skip_alpha_blending)
|
||||
if (window->current_paint.use_gl)
|
||||
{
|
||||
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
|
||||
cairo_paint (cr);
|
||||
cairo_region_t *opaque_region = cairo_region_copy (window->current_paint.region);
|
||||
cairo_region_subtract (opaque_region, window->current_paint.flushed_region);
|
||||
cairo_region_subtract (opaque_region, window->current_paint.need_blend_region);
|
||||
|
||||
gdk_gl_context_make_current (window->gl_paint_context);
|
||||
|
||||
if (!cairo_region_is_empty (opaque_region))
|
||||
gdk_gl_texture_from_surface (window->current_paint.surface,
|
||||
opaque_region);
|
||||
if (!cairo_region_is_empty (window->current_paint.need_blend_region))
|
||||
{
|
||||
glEnable(GL_BLEND);
|
||||
gdk_gl_texture_from_surface (window->current_paint.surface,
|
||||
window->current_paint.need_blend_region);
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
|
||||
cairo_region_destroy (opaque_region);
|
||||
|
||||
gdk_gl_context_end_frame (window->gl_paint_context,
|
||||
window->current_paint.region,
|
||||
window->active_update_area);
|
||||
|
||||
if (epoxy_has_gl_extension ("GL_GREMEDY_frame_terminator"))
|
||||
glFrameTerminatorGREMEDY();
|
||||
}
|
||||
else
|
||||
{
|
||||
cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
|
||||
cairo_paint_with_alpha (cr, window->alpha / 255.0);
|
||||
}
|
||||
surface = gdk_window_ref_impl_surface (window);
|
||||
cr = cairo_create (surface);
|
||||
cairo_surface_destroy (surface);
|
||||
|
||||
cairo_destroy (cr);
|
||||
cairo_region_destroy (full_clip);
|
||||
cairo_set_source_surface (cr, window->current_paint.surface, 0, 0);
|
||||
gdk_cairo_region (cr, window->current_paint.region);
|
||||
cairo_clip (cr);
|
||||
|
||||
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
|
||||
cairo_paint (cr);
|
||||
|
||||
cairo_destroy (cr);
|
||||
}
|
||||
}
|
||||
|
||||
gdk_window_free_current_paint (window);
|
||||
@@ -3063,11 +3308,15 @@ gdk_cairo_create (GdkWindow *window)
|
||||
cr = cairo_create (surface);
|
||||
|
||||
if (window->impl_window->current_paint.region != NULL)
|
||||
region = cairo_region_copy (window->impl_window->current_paint.region);
|
||||
{
|
||||
region = cairo_region_copy (window->impl_window->current_paint.region);
|
||||
cairo_region_translate (region, -window->abs_x, -window->abs_y);
|
||||
}
|
||||
else
|
||||
region = cairo_region_copy (window->clip_region);
|
||||
{
|
||||
region = cairo_region_copy (window->clip_region);
|
||||
}
|
||||
|
||||
cairo_region_translate (region, -window->abs_x, -window->abs_y);
|
||||
gdk_cairo_region (cr, region);
|
||||
cairo_region_destroy (region);
|
||||
cairo_clip (cr);
|
||||
@@ -3374,18 +3623,34 @@ gdk_window_process_updates_internal (GdkWindow *window)
|
||||
*/
|
||||
if (window->update_area)
|
||||
{
|
||||
cairo_region_t *update_area = window->update_area;
|
||||
g_assert (window->active_update_area == NULL); /* No reentrancy */
|
||||
|
||||
window->active_update_area = window->update_area;
|
||||
window->update_area = NULL;
|
||||
|
||||
if (gdk_window_is_viewable (window))
|
||||
{
|
||||
cairo_region_t *expose_region;
|
||||
|
||||
expose_region = cairo_region_copy (window->active_update_area);
|
||||
|
||||
/* Sometimes we can't just paint only the new area, as the windowing system
|
||||
requires more to be repainted. For instance, with opengl you typically
|
||||
repaint all of each frame each time and then swap the buffer, although
|
||||
there are extensions that allow us to reuse part of an old frame */
|
||||
if (GDK_WINDOW_IMPL_GET_CLASS (window->impl)->invalidate_for_new_frame)
|
||||
GDK_WINDOW_IMPL_GET_CLASS (window->impl)->invalidate_for_new_frame (window, expose_region);
|
||||
|
||||
/* Clip to part visible in impl window */
|
||||
cairo_region_intersect (update_area, window->clip_region);
|
||||
cairo_region_intersect (expose_region, window->clip_region);
|
||||
|
||||
if (debug_updates)
|
||||
{
|
||||
cairo_region_t *swap_region = cairo_region_copy (expose_region);
|
||||
cairo_region_subtract (swap_region, window->active_update_area);
|
||||
draw_ugly_color (window, swap_region, 1);
|
||||
cairo_region_destroy (swap_region);
|
||||
|
||||
/* Make sure we see the red invalid area before redrawing. */
|
||||
gdk_display_sync (gdk_window_get_display (window));
|
||||
g_usleep (70000);
|
||||
@@ -3394,14 +3659,17 @@ gdk_window_process_updates_internal (GdkWindow *window)
|
||||
impl_class = GDK_WINDOW_IMPL_GET_CLASS (window->impl);
|
||||
|
||||
if (impl_class->queue_antiexpose)
|
||||
impl_class->queue_antiexpose (window, update_area);
|
||||
impl_class->queue_antiexpose (window, expose_region);
|
||||
|
||||
expose_region = cairo_region_copy (update_area);
|
||||
impl_class->process_updates_recurse (window, expose_region);
|
||||
cairo_region_destroy (expose_region);
|
||||
}
|
||||
|
||||
cairo_region_destroy (update_area);
|
||||
gdk_window_append_old_updated_area (window, window->active_update_area);
|
||||
|
||||
cairo_region_destroy (expose_region);
|
||||
}
|
||||
|
||||
cairo_region_destroy (window->active_update_area);
|
||||
window->active_update_area = NULL;
|
||||
}
|
||||
|
||||
window->in_update = FALSE;
|
||||
@@ -3704,13 +3972,17 @@ gdk_window_set_invalidate_handler (GdkWindow *window,
|
||||
|
||||
static void
|
||||
draw_ugly_color (GdkWindow *window,
|
||||
const cairo_region_t *region)
|
||||
const cairo_region_t *region,
|
||||
int color)
|
||||
{
|
||||
cairo_t *cr;
|
||||
|
||||
cr = gdk_cairo_create (window);
|
||||
/* Draw ugly color all over the newly-invalid region */
|
||||
cairo_set_source_rgb (cr, 50000/65535., 10000/65535., 10000/65535.);
|
||||
if (color == 0)
|
||||
cairo_set_source_rgb (cr, 50000/65535., 10000/65535., 10000/65535.);
|
||||
else
|
||||
cairo_set_source_rgb (cr, 10000/65535., 50000/65535., 10000/65535.);
|
||||
gdk_cairo_region (cr, region);
|
||||
cairo_fill (cr);
|
||||
|
||||
@@ -3806,7 +4078,7 @@ gdk_window_invalidate_maybe_recurse_full (GdkWindow *window,
|
||||
invalidate_impl_subwindows (window, region, child_func, user_data, 0, 0);
|
||||
|
||||
if (debug_updates)
|
||||
draw_ugly_color (window, visible_region);
|
||||
draw_ugly_color (window, visible_region, 0);
|
||||
|
||||
while (window != NULL &&
|
||||
!cairo_region_is_empty (visible_region))
|
||||
@@ -5045,6 +5317,7 @@ gdk_window_hide (GdkWindow *window)
|
||||
impl_class->hide (window);
|
||||
}
|
||||
|
||||
gdk_window_clear_old_updated_area (window);
|
||||
recompute_visible_regions (window, FALSE);
|
||||
|
||||
/* all decendants became non-visible, we need to send visibility notify */
|
||||
@@ -5104,6 +5377,7 @@ gdk_window_withdraw (GdkWindow *window)
|
||||
}
|
||||
|
||||
recompute_visible_regions (window, FALSE);
|
||||
gdk_window_clear_old_updated_area (window);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6491,27 +6765,22 @@ gdk_window_merge_child_input_shapes (GdkWindow *window)
|
||||
* @window: a #GdkWindow
|
||||
* @use_static: %TRUE to turn on static gravity
|
||||
*
|
||||
* Set the bit gravity of the given window to static, and flag it so
|
||||
* all children get static subwindow gravity. This is used if you are
|
||||
* implementing scary features that involve deep knowledge of the
|
||||
* windowing system. Don’t worry about it unless you have to.
|
||||
* Used to set the bit gravity of the given window to static, and flag
|
||||
* it so all children get static subwindow gravity. This is used if you
|
||||
* are implementing scary features that involve deep knowledge of the
|
||||
* windowing system. Don’t worry about it.
|
||||
*
|
||||
* Returns: %TRUE if the server supports static gravity
|
||||
* Returns: %FALSE
|
||||
*
|
||||
* Deprecated: 3.16: static gravities haven't worked on anything but X11
|
||||
* for a long time.
|
||||
*/
|
||||
gboolean
|
||||
gdk_window_set_static_gravities (GdkWindow *window,
|
||||
gboolean use_static)
|
||||
{
|
||||
GdkWindowImplClass *impl_class;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
|
||||
|
||||
if (gdk_window_has_impl (window))
|
||||
{
|
||||
impl_class = GDK_WINDOW_IMPL_GET_CLASS (window->impl);
|
||||
return impl_class->set_static_gravities (window, use_static);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -6526,6 +6795,9 @@ gdk_window_set_static_gravities (GdkWindow *window,
|
||||
* Returns: %TRUE if the window is composited.
|
||||
*
|
||||
* Since: 2.22
|
||||
*
|
||||
* Deprecated: 3.16: Compositing is an outdated technology that
|
||||
* only ever worked on X11.
|
||||
**/
|
||||
gboolean
|
||||
gdk_window_get_composited (GdkWindow *window)
|
||||
@@ -6564,6 +6836,9 @@ gdk_window_get_composited (GdkWindow *window)
|
||||
* attempting to do so.
|
||||
*
|
||||
* Since: 2.12
|
||||
*
|
||||
* Deprecated: 3.16: Compositing is an outdated technology that
|
||||
* only ever worked on X11.
|
||||
*/
|
||||
void
|
||||
gdk_window_set_composited (GdkWindow *window,
|
||||
@@ -6586,12 +6861,14 @@ gdk_window_set_composited (GdkWindow *window,
|
||||
|
||||
impl_class = GDK_WINDOW_IMPL_GET_CLASS (window->impl);
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
if (composited && (!gdk_display_supports_composite (display) || !impl_class->set_composited))
|
||||
{
|
||||
g_warning ("gdk_window_set_composited called but "
|
||||
"compositing is not supported");
|
||||
return;
|
||||
}
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
impl_class->set_composited (window, composited);
|
||||
|
||||
|
||||
+12
-3
@@ -627,9 +627,9 @@ void gdk_window_shape_combine_region (GdkWindow *window,
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_window_set_child_shapes (GdkWindow *window);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_3_16
|
||||
gboolean gdk_window_get_composited (GdkWindow *window);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_3_16
|
||||
void gdk_window_set_composited (GdkWindow *window,
|
||||
gboolean composited);
|
||||
|
||||
@@ -675,7 +675,7 @@ GdkWindowState gdk_window_get_state (GdkWindow *window);
|
||||
/* Set static bit gravity on the parent, and static
|
||||
* window gravity on all children.
|
||||
*/
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_3_16
|
||||
gboolean gdk_window_set_static_gravities (GdkWindow *window,
|
||||
gboolean use_static);
|
||||
|
||||
@@ -739,6 +739,9 @@ cairo_region_t *gdk_window_get_visible_region(GdkWindow *window);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_window_begin_paint_rect (GdkWindow *window,
|
||||
const GdkRectangle *rectangle);
|
||||
GDK_AVAILABLE_IN_3_16
|
||||
void gdk_window_mark_paint_from_clip (GdkWindow *window,
|
||||
cairo_t *cr);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_window_begin_paint_region (GdkWindow *window,
|
||||
const cairo_region_t *region);
|
||||
@@ -1108,6 +1111,12 @@ GDK_AVAILABLE_IN_3_14
|
||||
gboolean gdk_window_show_window_menu (GdkWindow *window,
|
||||
GdkEvent *event);
|
||||
|
||||
GDK_AVAILABLE_IN_3_16
|
||||
GdkGLContext * gdk_window_create_gl_context (GdkWindow *window,
|
||||
GdkGLProfile profile,
|
||||
GError **error);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_WINDOW_H__ */
|
||||
|
||||
+7
-3
@@ -121,9 +121,6 @@ struct _GdkWindowImplClass
|
||||
gint offset_x,
|
||||
gint offset_y);
|
||||
|
||||
gboolean (* set_static_gravities) (GdkWindow *window,
|
||||
gboolean use_static);
|
||||
|
||||
/* Called before processing updates for a window. This gives the windowing
|
||||
* layer a chance to save the region for later use in avoiding duplicate
|
||||
* exposes.
|
||||
@@ -292,6 +289,13 @@ struct _GdkWindowImplClass
|
||||
gint bottom);
|
||||
gboolean (* show_window_menu) (GdkWindow *window,
|
||||
GdkEvent *event);
|
||||
GdkGLContext *(*create_gl_context) (GdkWindow *window,
|
||||
gboolean attached,
|
||||
GdkGLProfile profile,
|
||||
GdkGLContext *share,
|
||||
GError **error);
|
||||
void (*invalidate_for_new_frame)(GdkWindow *window,
|
||||
cairo_region_t *update_area);
|
||||
};
|
||||
|
||||
/* Interface Functions */
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
include $(top_srcdir)/Makefile.decl
|
||||
|
||||
libgdkincludedir = $(includedir)/gtk-3.0/gdk
|
||||
libgdkmirincludedir = $(includedir)/gtk-3.0/gdk/mir
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-DG_LOG_DOMAIN=\"Gdk\" \
|
||||
-DGDK_COMPILATION \
|
||||
-I$(top_srcdir) \
|
||||
-I$(top_srcdir)/gdk \
|
||||
-I$(top_builddir)/gdk \
|
||||
$(GDK_HIDDEN_VISIBILITY_CFLAGS) \
|
||||
$(GTK_DEBUG_FLAGS) \
|
||||
$(GDK_DEP_CFLAGS)
|
||||
|
||||
LDADDS = $(GDK_DEP_LIBS)
|
||||
|
||||
noinst_LTLIBRARIES = \
|
||||
libgdk-mir.la
|
||||
|
||||
libgdk_mir_la_SOURCES = \
|
||||
gdkmircursor.c \
|
||||
gdkmirdevicemanager.c \
|
||||
gdkmirdisplay.c \
|
||||
gdkmireventsource.c \
|
||||
gdkmirkeyboard.c \
|
||||
gdkmirkeymap.c \
|
||||
gdkmirpointer.c \
|
||||
gdkmirscreen.c \
|
||||
gdkmirwindow.c \
|
||||
gdkmirwindowimpl.c \
|
||||
gdkmir-debug.c \
|
||||
gdkmir.h
|
||||
|
||||
libgdkinclude_HEADERS = \
|
||||
gdkmir.h
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
||||
@@ -0,0 +1,293 @@
|
||||
/*
|
||||
* Copyright © 2014 Canonical Ltd
|
||||
*
|
||||
* 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 "gdkmir-private.h"
|
||||
|
||||
void
|
||||
_gdk_mir_print_modifiers (unsigned int modifiers)
|
||||
{
|
||||
g_printerr (" Modifiers");
|
||||
if ((modifiers & mir_key_modifier_alt) != 0)
|
||||
g_printerr (" alt");
|
||||
if ((modifiers & mir_key_modifier_alt_left) != 0)
|
||||
g_printerr (" alt-left");
|
||||
if ((modifiers & mir_key_modifier_alt_right) != 0)
|
||||
g_printerr (" alt-right");
|
||||
if ((modifiers & mir_key_modifier_shift) != 0)
|
||||
g_printerr (" shift");
|
||||
if ((modifiers & mir_key_modifier_shift_left) != 0)
|
||||
g_printerr (" shift-left");
|
||||
if ((modifiers & mir_key_modifier_shift_right) != 0)
|
||||
g_printerr (" shift-right");
|
||||
if ((modifiers & mir_key_modifier_sym) != 0)
|
||||
g_printerr (" sym");
|
||||
if ((modifiers & mir_key_modifier_function) != 0)
|
||||
g_printerr (" function");
|
||||
if ((modifiers & mir_key_modifier_ctrl) != 0)
|
||||
g_printerr (" ctrl");
|
||||
if ((modifiers & mir_key_modifier_ctrl_left) != 0)
|
||||
g_printerr (" ctrl-left");
|
||||
if ((modifiers & mir_key_modifier_ctrl_right) != 0)
|
||||
g_printerr (" ctrl-right");
|
||||
if ((modifiers & mir_key_modifier_meta) != 0)
|
||||
g_printerr (" meta");
|
||||
if ((modifiers & mir_key_modifier_meta_left) != 0)
|
||||
g_printerr (" meta-left");
|
||||
if ((modifiers & mir_key_modifier_meta_right) != 0)
|
||||
g_printerr (" meta-right");
|
||||
if ((modifiers & mir_key_modifier_caps_lock) != 0)
|
||||
g_printerr (" caps-lock");
|
||||
if ((modifiers & mir_key_modifier_num_lock) != 0)
|
||||
g_printerr (" num-lock");
|
||||
if ((modifiers & mir_key_modifier_scroll_lock) != 0)
|
||||
g_printerr (" scroll-lock");
|
||||
g_printerr ("\n");
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_mir_print_key_event (const MirKeyEvent *event)
|
||||
{
|
||||
g_printerr ("KEY\n");
|
||||
g_printerr (" Device %i\n", event->device_id);
|
||||
g_printerr (" Source %i\n", event->source_id);
|
||||
g_printerr (" Action ");
|
||||
switch (event->action)
|
||||
{
|
||||
case mir_key_action_down:
|
||||
g_printerr ("down");
|
||||
break;
|
||||
case mir_key_action_up:
|
||||
g_printerr ("up");
|
||||
break;
|
||||
case mir_key_action_multiple:
|
||||
g_printerr ("multiple");
|
||||
break;
|
||||
default:
|
||||
g_printerr ("%u", event->action);
|
||||
break;
|
||||
}
|
||||
g_printerr ("\n");
|
||||
g_printerr (" Flags");
|
||||
if ((event->flags & mir_key_flag_woke_here) != 0)
|
||||
g_printerr (" woke-here");
|
||||
if ((event->flags & mir_key_flag_soft_keyboard) != 0)
|
||||
g_printerr (" soft-keyboard");
|
||||
if ((event->flags & mir_key_flag_keep_touch_mode) != 0)
|
||||
g_printerr (" keep-touch-mode");
|
||||
if ((event->flags & mir_key_flag_from_system) != 0)
|
||||
g_printerr (" from-system");
|
||||
if ((event->flags & mir_key_flag_editor_action) != 0)
|
||||
g_printerr (" editor-action");
|
||||
if ((event->flags & mir_key_flag_canceled) != 0)
|
||||
g_printerr (" canceled");
|
||||
if ((event->flags & mir_key_flag_virtual_hard_key) != 0)
|
||||
g_printerr (" virtual-hard-key");
|
||||
if ((event->flags & mir_key_flag_long_press) != 0)
|
||||
g_printerr (" long-press");
|
||||
if ((event->flags & mir_key_flag_canceled_long_press) != 0)
|
||||
g_printerr (" canceled-long-press");
|
||||
if ((event->flags & mir_key_flag_tracking) != 0)
|
||||
g_printerr (" tracking");
|
||||
if ((event->flags & mir_key_flag_fallback) != 0)
|
||||
g_printerr (" fallback");
|
||||
g_printerr ("\n");
|
||||
_gdk_mir_print_modifiers (event->modifiers);
|
||||
g_printerr (" Key Code %i\n", event->key_code);
|
||||
g_printerr (" Scan Code %i\n", event->scan_code);
|
||||
g_printerr (" Repeat Count %i\n", event->repeat_count);
|
||||
g_printerr (" Down Time %lli\n", (long long int) event->down_time);
|
||||
g_printerr (" Event Time %lli\n", (long long int) event->event_time);
|
||||
g_printerr (" Is System Key %s\n", event->is_system_key ? "true" : "false");
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_mir_print_motion_event (const MirMotionEvent *event)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
g_printerr ("MOTION\n");
|
||||
g_printerr (" Device %i\n", event->device_id);
|
||||
g_printerr (" Source %i\n", event->source_id);
|
||||
g_printerr (" Action ");
|
||||
switch (event->action)
|
||||
{
|
||||
case mir_motion_action_down:
|
||||
g_printerr ("down");
|
||||
break;
|
||||
case mir_motion_action_up:
|
||||
g_printerr ("up");
|
||||
break;
|
||||
case mir_motion_action_move:
|
||||
g_printerr ("move");
|
||||
break;
|
||||
case mir_motion_action_cancel:
|
||||
g_printerr ("cancel");
|
||||
break;
|
||||
case mir_motion_action_outside:
|
||||
g_printerr ("outside");
|
||||
break;
|
||||
case mir_motion_action_pointer_down:
|
||||
g_printerr ("pointer-down");
|
||||
break;
|
||||
case mir_motion_action_pointer_up:
|
||||
g_printerr ("pointer-up");
|
||||
break;
|
||||
case mir_motion_action_hover_move:
|
||||
g_printerr ("hover-move");
|
||||
break;
|
||||
case mir_motion_action_scroll:
|
||||
g_printerr ("scroll");
|
||||
break;
|
||||
case mir_motion_action_hover_enter:
|
||||
g_printerr ("hover-enter");
|
||||
break;
|
||||
case mir_motion_action_hover_exit:
|
||||
g_printerr ("hover-exit");
|
||||
break;
|
||||
default:
|
||||
g_printerr ("%u", event->action);
|
||||
}
|
||||
g_printerr ("\n");
|
||||
g_printerr (" Flags");
|
||||
switch (event->flags)
|
||||
{
|
||||
case mir_motion_flag_window_is_obscured:
|
||||
g_printerr (" window-is-obscured");
|
||||
break;
|
||||
}
|
||||
g_printerr ("\n");
|
||||
_gdk_mir_print_modifiers (event->modifiers);
|
||||
g_printerr (" Edge Flags %i\n", event->edge_flags);
|
||||
g_printerr (" Button State");
|
||||
switch (event->button_state)
|
||||
{
|
||||
case mir_motion_button_primary:
|
||||
g_printerr (" primary");
|
||||
break;
|
||||
case mir_motion_button_secondary:
|
||||
g_printerr (" secondary");
|
||||
break;
|
||||
case mir_motion_button_tertiary:
|
||||
g_printerr (" tertiary");
|
||||
break;
|
||||
case mir_motion_button_back:
|
||||
g_printerr (" back");
|
||||
break;
|
||||
case mir_motion_button_forward:
|
||||
g_printerr (" forward");
|
||||
break;
|
||||
}
|
||||
g_printerr ("\n");
|
||||
g_printerr (" Offset (%f, %f)\n", event->x_offset, event->y_offset);
|
||||
g_printerr (" Precision (%f, %f)\n", event->x_precision, event->y_precision);
|
||||
g_printerr (" Down Time %lli\n", (long long int) event->down_time);
|
||||
g_printerr (" Event Time %lli\n", (long long int) event->event_time);
|
||||
g_printerr (" Pointer Coordinates\n");
|
||||
for (i = 0; i < event->pointer_count; i++)
|
||||
{
|
||||
g_printerr (" ID=%i location=(%f, %f) raw=(%f, %f) touch=(%f, %f) size=%f pressure=%f orientation=%f scroll=(%f, %f) tool=",
|
||||
event->pointer_coordinates[i].id,
|
||||
event->pointer_coordinates[i].x, event->pointer_coordinates[i].y,
|
||||
event->pointer_coordinates[i].raw_x, event->pointer_coordinates[i].raw_y,
|
||||
event->pointer_coordinates[i].touch_major, event->pointer_coordinates[i].touch_minor,
|
||||
event->pointer_coordinates[i].size,
|
||||
event->pointer_coordinates[i].pressure,
|
||||
event->pointer_coordinates[i].orientation,
|
||||
event->pointer_coordinates[i].hscroll, event->pointer_coordinates[i].vscroll);
|
||||
switch (event->pointer_coordinates[i].tool_type)
|
||||
{
|
||||
case mir_motion_tool_type_unknown:
|
||||
g_printerr ("unknown");
|
||||
break;
|
||||
case mir_motion_tool_type_finger:
|
||||
g_printerr ("finger");
|
||||
break;
|
||||
case mir_motion_tool_type_stylus:
|
||||
g_printerr ("stylus");
|
||||
break;
|
||||
case mir_motion_tool_type_mouse:
|
||||
g_printerr ("mouse");
|
||||
break;
|
||||
case mir_motion_tool_type_eraser:
|
||||
g_printerr ("eraser");
|
||||
break;
|
||||
default:
|
||||
g_printerr ("%u", event->pointer_coordinates[i].tool_type);
|
||||
break;
|
||||
}
|
||||
g_printerr ("\n");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_mir_print_surface_event (const MirSurfaceEvent *event)
|
||||
{
|
||||
g_printerr ("SURFACE\n");
|
||||
g_printerr (" Surface %i\n", event->id);
|
||||
g_printerr (" Attribute ");
|
||||
switch (event->attrib)
|
||||
{
|
||||
case mir_surface_attrib_type:
|
||||
g_printerr ("type");
|
||||
break;
|
||||
case mir_surface_attrib_state:
|
||||
g_printerr ("state");
|
||||
break;
|
||||
case mir_surface_attrib_swapinterval:
|
||||
g_printerr ("swapinterval");
|
||||
break;
|
||||
case mir_surface_attrib_focus:
|
||||
g_printerr ("focus");
|
||||
break;
|
||||
default:
|
||||
g_printerr ("%u", event->attrib);
|
||||
break;
|
||||
}
|
||||
g_printerr ("\n");
|
||||
g_printerr (" Value %i\n", event->value);
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_mir_print_resize_event (const MirResizeEvent *event)
|
||||
{
|
||||
g_printerr ("RESIZE\n");
|
||||
g_printerr (" Surface %i\n", event->surface_id);
|
||||
g_printerr (" Size (%i, %i)\n", event->width, event->height);
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_mir_print_event (const MirEvent *event)
|
||||
{
|
||||
switch (event->type)
|
||||
{
|
||||
case mir_event_type_key:
|
||||
_gdk_mir_print_key_event (&event->key);
|
||||
break;
|
||||
case mir_event_type_motion:
|
||||
_gdk_mir_print_motion_event (&event->motion);
|
||||
break;
|
||||
case mir_event_type_surface:
|
||||
_gdk_mir_print_surface_event (&event->surface);
|
||||
break;
|
||||
case mir_event_type_resize:
|
||||
_gdk_mir_print_resize_event (&event->resize);
|
||||
break;
|
||||
default:
|
||||
g_printerr ("EVENT %u\n", event->type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright © 2014 Canonical Ltd
|
||||
*
|
||||
* 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 __GDK_PRIVATE_MIR_H__
|
||||
#define __GDK_PRIVATE_MIR_H__
|
||||
|
||||
#include "gdkmir.h"
|
||||
#include "gdkdisplay.h"
|
||||
#include "gdkscreen.h"
|
||||
#include "gdkdevicemanager.h"
|
||||
#include "gdkkeys.h"
|
||||
#include "gdkwindowimpl.h"
|
||||
|
||||
typedef struct _GdkMirWindowImpl GdkMirWindowImpl;
|
||||
typedef struct _GdkMirWindowReference GdkMirWindowReference;
|
||||
typedef struct _GdkMirEventSource GdkMirEventSource;
|
||||
|
||||
#define GDK_TYPE_MIR_WINDOW_IMPL (gdk_mir_window_impl_get_type ())
|
||||
#define GDK_MIR_WINDOW_IMPL(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_MIR_WINDOW_IMPL, GdkMirWindowImpl))
|
||||
#define GDK_IS_WINDOW_IMPL_MIR(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_MIR_WINDOW_IMPL))
|
||||
|
||||
GType gdk_mir_window_impl_get_type (void);
|
||||
|
||||
GdkDisplay *_gdk_mir_display_open (const gchar *display_name);
|
||||
|
||||
GdkScreen *_gdk_mir_screen_new (GdkDisplay *display);
|
||||
|
||||
GdkDeviceManager *_gdk_mir_device_manager_new (GdkDisplay *display);
|
||||
|
||||
GdkDevice *_gdk_mir_device_manager_get_keyboard (GdkDeviceManager *device_manager);
|
||||
|
||||
GdkKeymap *_gdk_mir_keymap_new (void);
|
||||
|
||||
GdkDevice *_gdk_mir_keyboard_new (GdkDeviceManager *device_manager, const gchar *name);
|
||||
|
||||
GdkDevice *_gdk_mir_pointer_new (GdkDeviceManager *device_manager, const gchar *name);
|
||||
|
||||
void _gdk_mir_pointer_set_location (GdkDevice *pointer, gdouble x, gdouble y, GdkWindow *window, GdkModifierType mask);
|
||||
|
||||
GdkCursor *_gdk_mir_cursor_new (GdkDisplay *display, GdkCursorType type);
|
||||
|
||||
GdkWindowImpl *_gdk_mir_window_impl_new (void);
|
||||
|
||||
void _gdk_mir_window_impl_set_surface_state (GdkMirWindowImpl *impl, MirSurfaceState state);
|
||||
|
||||
void _gdk_mir_window_impl_set_cursor_state (GdkMirWindowImpl *impl, gdouble x, gdouble y, gboolean cursor_inside, MirMotionButton button_state);
|
||||
|
||||
void _gdk_mir_window_impl_get_cursor_state (GdkMirWindowImpl *impl, gdouble *x, gdouble *y, gboolean *cursor_inside, MirMotionButton *button_state);
|
||||
|
||||
GdkMirEventSource *_gdk_mir_display_get_event_source (GdkDisplay *display);
|
||||
|
||||
GdkMirEventSource *_gdk_mir_event_source_new (GdkDisplay *display);
|
||||
|
||||
GdkMirWindowReference *_gdk_mir_event_source_get_window_reference (GdkWindow *window);
|
||||
|
||||
void _gdk_mir_window_reference_unref (GdkMirWindowReference *ref);
|
||||
|
||||
void _gdk_mir_event_source_queue (GdkMirWindowReference *window_ref, const MirEvent *event);
|
||||
|
||||
void _gdk_mir_print_modifiers (unsigned int modifiers);
|
||||
|
||||
void _gdk_mir_print_key_event (const MirKeyEvent *event);
|
||||
|
||||
void _gdk_mir_print_motion_event (const MirMotionEvent *event);
|
||||
|
||||
void _gdk_mir_print_surface_event (const MirSurfaceEvent *event);
|
||||
|
||||
void _gdk_mir_print_resize_event (const MirResizeEvent *event);
|
||||
|
||||
void _gdk_mir_print_event (const MirEvent *event);
|
||||
|
||||
#endif /* __GDK_PRIVATE_MIR_H__ */
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright © 2014 Canonical Ltd
|
||||
*
|
||||
* 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 __GDK_MIR_H__
|
||||
#define __GDK_MIR_H__
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
#include <mir_toolkit/mir_client_library.h>
|
||||
|
||||
#define GDK_TYPE_MIR_DISPLAY (gdk_mir_display_get_type ())
|
||||
#define GDK_IS_MIR_DISPLAY(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_MIR_DISPLAY))
|
||||
|
||||
#define GDK_TYPE_MIR_WINDOW (gdk_mir_window_get_type ())
|
||||
#define GDK_IS_WINDOW_MIR(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WINDOW_MIR))
|
||||
|
||||
GDK_AVAILABLE_IN_3_10
|
||||
GType gdk_mir_display_get_type (void);
|
||||
|
||||
GDK_AVAILABLE_IN_3_10
|
||||
struct MirConnection *gdk_mir_display_get_mir_connection (GdkDisplay *display);
|
||||
|
||||
GDK_AVAILABLE_IN_3_10
|
||||
GType gdk_mir_window_get_type (void);
|
||||
|
||||
#endif /* __GDK_MIR_H__ */
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright © 2014 Canonical Ltd
|
||||
*
|
||||
* 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 "gdkcursorprivate.h"
|
||||
|
||||
#include "gdkmir.h"
|
||||
#include "gdkmir-private.h"
|
||||
|
||||
typedef struct GdkMirCursor GdkMirCursor;
|
||||
typedef struct GdkMirCursorClass GdkMirCursorClass;
|
||||
|
||||
#define GDK_TYPE_MIR_CURSOR (gdk_mir_cursor_get_type ())
|
||||
#define GDK_MIR_CURSOR(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_MIR_CURSOR, GdkMirCursor))
|
||||
#define GDK_MIR_CURSOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_MIR_CURSOR, GdkMirCursorClass))
|
||||
#define GDK_IS_MIR_CURSOR(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_MIR_CURSOR))
|
||||
#define GDK_IS_MIR_CURSOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_MIR_CURSOR))
|
||||
#define GDK_MIR_CURSOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_MIR_CURSOR, GdkMirCursorClass))
|
||||
|
||||
struct GdkMirCursor
|
||||
{
|
||||
GdkCursor parent_instance;
|
||||
};
|
||||
|
||||
struct GdkMirCursorClass
|
||||
{
|
||||
GdkCursorClass parent_class;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GdkMirCursor, gdk_mir_cursor, GDK_TYPE_CURSOR)
|
||||
|
||||
GdkCursor *
|
||||
_gdk_mir_cursor_new (GdkDisplay *display, GdkCursorType type)
|
||||
{
|
||||
return g_object_new (GDK_TYPE_MIR_CURSOR, "display", display, "cursor-type", type, NULL);
|
||||
}
|
||||
|
||||
cairo_surface_t *
|
||||
gdk_mir_cursor_get_surface (GdkCursor *cursor,
|
||||
gdouble *x_hot,
|
||||
gdouble *y_hot)
|
||||
{
|
||||
g_printerr ("gdk_mir_cursor_get_surface\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_cursor_init (GdkMirCursor *cursor)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_cursor_class_init (GdkMirCursorClass *klass)
|
||||
{
|
||||
GdkCursorClass *cursor_class = GDK_CURSOR_CLASS (klass);
|
||||
|
||||
cursor_class->get_surface = gdk_mir_cursor_get_surface;
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
/*
|
||||
* Copyright © 2014 Canonical Ltd
|
||||
*
|
||||
* 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 "gdkdevicemanagerprivate.h"
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include "gdkdeviceprivate.h"
|
||||
|
||||
#include "gdkmir.h"
|
||||
#include "gdkmir-private.h"
|
||||
|
||||
typedef struct GdkMirDeviceManager GdkMirDeviceManager;
|
||||
typedef struct GdkMirDeviceManagerClass GdkMirDeviceManagerClass;
|
||||
|
||||
#define GDK_TYPE_MIR_DEVICE_MANAGER (gdk_mir_device_manager_get_type ())
|
||||
#define GDK_MIR_DEVICE_MANAGER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_MIR_DEVICE_MANAGER, GdkMirDeviceManager))
|
||||
#define GDK_MIR_DEVICE_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_MIR_DEVICE_MANAGER, GdkMirDeviceManagerClass))
|
||||
#define GDK_IS_MIR_DEVICE_MANAGER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_MIR_DEVICE_MANAGER))
|
||||
#define GDK_IS_MIR_DEVICE_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_MIR_DEVICE_MANAGER))
|
||||
#define GDK_MIR_DEVICE_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_MIR_DEVICE_MANAGER, GdkMirDeviceManagerClass))
|
||||
|
||||
struct GdkMirDeviceManager
|
||||
{
|
||||
GdkDeviceManager parent_instance;
|
||||
|
||||
GdkDevice *pointer;
|
||||
GdkDevice *keyboard;
|
||||
};
|
||||
|
||||
struct GdkMirDeviceManagerClass
|
||||
{
|
||||
GdkDeviceManagerClass parent_class;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GdkMirDeviceManager, gdk_mir_device_manager, GDK_TYPE_DEVICE_MANAGER)
|
||||
|
||||
GdkDeviceManager *
|
||||
_gdk_mir_device_manager_new (GdkDisplay *display)
|
||||
{
|
||||
return g_object_new (GDK_TYPE_MIR_DEVICE_MANAGER, "display", display, NULL);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
GList *devices;
|
||||
|
||||
devices = g_list_append (NULL, dm->keyboard);
|
||||
devices = g_list_append (devices, dm->pointer);
|
||||
|
||||
return devices;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
GdkDevice *
|
||||
_gdk_mir_device_manager_get_keyboard (GdkDeviceManager *device_manager)
|
||||
{
|
||||
return GDK_MIR_DEVICE_MANAGER (device_manager)->keyboard;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_device_manager_init (GdkMirDeviceManager *device_manager)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_device_manager_constructed (GObject *object)
|
||||
{
|
||||
GdkMirDeviceManager *device_manager = GDK_MIR_DEVICE_MANAGER (object);
|
||||
|
||||
device_manager->keyboard = _gdk_mir_keyboard_new (GDK_DEVICE_MANAGER (device_manager), "Mir Keyboard");
|
||||
device_manager->pointer = _gdk_mir_pointer_new (GDK_DEVICE_MANAGER (device_manager), "Mir Pointer");
|
||||
_gdk_device_set_associated_device (device_manager->keyboard, device_manager->pointer);
|
||||
_gdk_device_set_associated_device (device_manager->pointer, device_manager->keyboard);
|
||||
|
||||
gdk_device_manager_get_display (GDK_DEVICE_MANAGER (device_manager))->core_pointer = device_manager->pointer;
|
||||
|
||||
G_OBJECT_CLASS (gdk_mir_device_manager_parent_class)->constructed (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_device_manager_class_init (GdkMirDeviceManagerClass *klass)
|
||||
{
|
||||
GdkDeviceManagerClass *device_manager_class = GDK_DEVICE_MANAGER_CLASS (klass);
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
device_manager_class->list_devices = gdk_mir_device_manager_list_devices;
|
||||
device_manager_class->get_client_pointer = gdk_mir_device_manager_get_client_pointer;
|
||||
object_class->constructed = gdk_mir_device_manager_constructed;
|
||||
}
|
||||
@@ -0,0 +1,572 @@
|
||||
/*
|
||||
* Copyright © 2014 Canonical Ltd
|
||||
*
|
||||
* 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 "gdkdisplayprivate.h"
|
||||
#include "gdkinternals.h"
|
||||
|
||||
#include "gdkmir.h"
|
||||
#include "gdkmir-private.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))
|
||||
#define GDK_IS_MIR_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_MIR_DISPLAY))
|
||||
#define GDK_MIR_DISPLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_MIR_DISPLAY, GdkMirDisplayImplClass))
|
||||
|
||||
typedef struct GdkMirDisplay
|
||||
{
|
||||
GdkDisplay parent_instance;
|
||||
|
||||
/* Connection to Mir server */
|
||||
MirConnection *connection;
|
||||
|
||||
/* Event source */
|
||||
GdkMirEventSource *event_source;
|
||||
|
||||
/* Serial number? */
|
||||
gulong serial;
|
||||
|
||||
/* Screen information */
|
||||
GdkScreen *screen;
|
||||
|
||||
GdkCursor *cursor;
|
||||
|
||||
GdkKeymap *keymap;
|
||||
} GdkMirDisplay;
|
||||
|
||||
typedef struct GdkMirDisplayClass
|
||||
{
|
||||
GdkDisplayClass parent_class;
|
||||
} GdkMirDisplayClass;
|
||||
|
||||
/**
|
||||
* SECTION:mir_interaction
|
||||
* @Short_description: Mir backend-specific functions
|
||||
* @Title: Mir Interaction
|
||||
*
|
||||
* The functions in this section are specific to the GDK Mir backend.
|
||||
* To use them, you need to include the <literal><gdk/gdkmir.h></literal>
|
||||
* header and use the Mir-specific pkg-config files to build your
|
||||
* application (either <literal>gdk-mir-3.0</literal> or
|
||||
* <literal>gtk+-mir-3.0</literal>).
|
||||
*
|
||||
* To make your code compile with other GDK backends, guard backend-specific
|
||||
* calls by an ifdef as follows. Since GDK may be built with multiple
|
||||
* backends, you should also check for the backend that is in use (e.g. by
|
||||
* using the GDK_IS_MIR_DISPLAY() macro).
|
||||
* |[
|
||||
* #ifdef GDK_WINDOWING_MIR
|
||||
* if (GDK_IS_MIR_DISPLAY (display))
|
||||
* {
|
||||
* /* make Mir-specific calls here */
|
||||
* }
|
||||
* else
|
||||
* #endif
|
||||
* #ifdef GDK_WINDOWING_X11
|
||||
* if (GDK_IS_X11_DISPLAY (display))
|
||||
* {
|
||||
* /* make X11-specific calls here */
|
||||
* }
|
||||
* else
|
||||
* #endif
|
||||
* g_error ("Unsupported GDK backend");
|
||||
* ]|
|
||||
*/
|
||||
|
||||
G_DEFINE_TYPE (GdkMirDisplay, gdk_mir_display, GDK_TYPE_DISPLAY)
|
||||
|
||||
GdkDisplay *
|
||||
_gdk_mir_display_open (const gchar *display_name)
|
||||
{
|
||||
MirConnection *connection;
|
||||
GdkMirDisplay *display;
|
||||
|
||||
g_printerr ("gdk_mir_display_open\n");
|
||||
|
||||
connection = mir_connect_sync (NULL, "GDK-Mir");
|
||||
if (!connection)
|
||||
return NULL;
|
||||
if (!mir_connection_is_valid (connection))
|
||||
{
|
||||
g_printerr ("Failed to connect to Mir: %s\n", mir_connection_get_error_message (connection));
|
||||
mir_connection_release (connection);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
display = g_object_new (GDK_TYPE_MIR_DISPLAY, NULL);
|
||||
|
||||
display->connection = connection;
|
||||
GDK_DISPLAY (display)->device_manager = _gdk_mir_device_manager_new (GDK_DISPLAY (display));
|
||||
display->screen = _gdk_mir_screen_new (GDK_DISPLAY (display));
|
||||
|
||||
g_signal_emit_by_name (display, "opened");
|
||||
|
||||
return GDK_DISPLAY (display);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_mir_display_get_mir_connection
|
||||
* @display: (type GdkMirDisplay): a #GdkDisplay
|
||||
*
|
||||
* Returns the #MirConnection for a #GdkDisplay
|
||||
*
|
||||
* Returns: (transfer none): a #MirConnection
|
||||
*
|
||||
* Since: 3.14
|
||||
*/
|
||||
struct MirConnection *
|
||||
gdk_mir_display_get_mir_connection (GdkDisplay *display)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_MIR_DISPLAY (display), NULL);
|
||||
return GDK_MIR_DISPLAY (display)->connection;
|
||||
}
|
||||
|
||||
GdkMirEventSource *
|
||||
_gdk_mir_display_get_event_source (GdkDisplay *display)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_MIR_DISPLAY (display), NULL);
|
||||
|
||||
return GDK_MIR_DISPLAY (display)->event_source;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_display_dispose (GObject *object)
|
||||
{
|
||||
GdkMirDisplay *display = GDK_MIR_DISPLAY (object);
|
||||
|
||||
g_object_unref (display->screen);
|
||||
display->screen = NULL;
|
||||
|
||||
G_OBJECT_CLASS (gdk_mir_display_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_display_finalize (GObject *object)
|
||||
{
|
||||
GdkMirDisplay *display = GDK_MIR_DISPLAY (object);
|
||||
|
||||
mir_connection_release (display->connection);
|
||||
|
||||
G_OBJECT_CLASS (gdk_mir_display_parent_class)->finalize (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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_mir_display_request_selection_notification (GdkDisplay *display,
|
||||
GdkAtom selection)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_request_selection_notification\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_display_store_clipboard (GdkDisplay *display,
|
||||
GdkWindow *clipboard_window,
|
||||
guint32 time_,
|
||||
const GdkAtom *targets,
|
||||
gint n_targets)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_store_clipboard\n");
|
||||
}
|
||||
|
||||
static void
|
||||
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
|
||||
}
|
||||
|
||||
static void
|
||||
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
|
||||
}
|
||||
|
||||
static GdkCursor *
|
||||
gdk_mir_display_get_cursor_for_type (GdkDisplay *display,
|
||||
GdkCursorType cursor_type)
|
||||
{
|
||||
//g_printerr ("gdk_mir_display_get_cursor_for_type (%u)\n", cursor_type);
|
||||
/* We don't support configurable cursors */
|
||||
return g_object_ref (GDK_MIR_DISPLAY (display)->cursor);
|
||||
}
|
||||
|
||||
static GdkCursor *
|
||||
gdk_mir_display_get_cursor_for_name (GdkDisplay *display,
|
||||
const gchar *name)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_get_cursor_for_name (\"%s\")\n", name);
|
||||
/* We don't support configurable cursors */
|
||||
return g_object_ref (GDK_MIR_DISPLAY (display)->cursor);
|
||||
}
|
||||
|
||||
static GdkCursor *
|
||||
gdk_mir_display_get_cursor_for_surface (GdkDisplay *display,
|
||||
cairo_surface_t *surface,
|
||||
gdouble x,
|
||||
gdouble y)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_get_cursor_for_surface (%f, %f)\n", x, y);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static GList *
|
||||
gdk_mir_display_list_devices (GdkDisplay *display)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_list_devices\n");
|
||||
// FIXME: Should this access the device manager?
|
||||
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++;
|
||||
}
|
||||
|
||||
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
|
||||
gdk_mir_display_event_data_copy (GdkDisplay *display,
|
||||
const GdkEvent *src,
|
||||
GdkEvent *dst)
|
||||
{
|
||||
//g_printerr ("gdk_mir_display_event_data_copy\n");
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_display_event_data_free (GdkDisplay *display,
|
||||
GdkEvent *event)
|
||||
{
|
||||
//g_printerr ("gdk_mir_display_event_data_free\n");
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_display_create_window_impl (GdkDisplay *display,
|
||||
GdkWindow *window,
|
||||
GdkWindow *real_parent,
|
||||
GdkScreen *screen,
|
||||
GdkEventMask event_mask,
|
||||
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)
|
||||
return;
|
||||
window->impl = _gdk_mir_window_impl_new ();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
static GdkWindow *
|
||||
gdk_mir_display_get_selection_owner (GdkDisplay *display,
|
||||
GdkAtom selection)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_get_selection_owner\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_mir_display_set_selection_owner (GdkDisplay *display,
|
||||
GdkWindow *owner,
|
||||
GdkAtom selection,
|
||||
guint32 time,
|
||||
gboolean send_event)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_set_selection_owner\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_display_send_selection_notify (GdkDisplay *display,
|
||||
GdkWindow *requestor,
|
||||
GdkAtom selection,
|
||||
GdkAtom target,
|
||||
GdkAtom property,
|
||||
guint32 time)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_send_selection_notify\n");
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_mir_display_get_selection_property (GdkDisplay *display,
|
||||
GdkWindow *requestor,
|
||||
guchar **data,
|
||||
GdkAtom *ret_type,
|
||||
gint *ret_format)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_get_selection_property\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_display_convert_selection (GdkDisplay *display,
|
||||
GdkWindow *requestor,
|
||||
GdkAtom selection,
|
||||
GdkAtom target,
|
||||
guint32 time)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_convert_selection\n");
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_mir_display_text_property_to_utf8_list (GdkDisplay *display,
|
||||
GdkAtom encoding,
|
||||
gint format,
|
||||
const guchar *text,
|
||||
gint length,
|
||||
gchar ***list)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_text_property_to_utf8_list\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_display_init (GdkMirDisplay *display)
|
||||
{
|
||||
display->event_source = _gdk_mir_event_source_new (GDK_DISPLAY (display));
|
||||
display->cursor = _gdk_mir_cursor_new (GDK_DISPLAY (display), GDK_ARROW);
|
||||
display->keymap = _gdk_mir_keymap_new ();
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_display_class_init (GdkMirDisplayClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GdkDisplayClass *display_class = GDK_DISPLAY_CLASS (klass);
|
||||
|
||||
object_class->dispose = gdk_mir_display_dispose;
|
||||
object_class->finalize = gdk_mir_display_finalize;
|
||||
|
||||
display_class->window_type = gdk_mir_window_get_type ();
|
||||
|
||||
display_class->get_name = gdk_mir_display_get_name;
|
||||
display_class->get_default_screen = gdk_mir_display_get_default_screen;
|
||||
display_class->beep = gdk_mir_display_beep;
|
||||
display_class->sync = gdk_mir_display_sync;
|
||||
display_class->flush = gdk_mir_display_flush;
|
||||
display_class->has_pending = gdk_mir_display_has_pending;
|
||||
display_class->queue_events = gdk_mir_display_queue_events;
|
||||
display_class->make_default = gdk_mir_display_make_default;
|
||||
display_class->get_default_group = gdk_mir_display_get_default_group;
|
||||
display_class->supports_shapes = gdk_mir_display_supports_shapes;
|
||||
display_class->supports_input_shapes = gdk_mir_display_supports_input_shapes;
|
||||
display_class->supports_composite = gdk_mir_display_supports_composite;
|
||||
display_class->supports_clipboard_persistence = gdk_mir_display_supports_clipboard_persistence;
|
||||
display_class->supports_cursor_alpha = gdk_mir_display_supports_cursor_alpha;
|
||||
display_class->supports_cursor_color = gdk_mir_display_supports_cursor_color;
|
||||
display_class->supports_selection_notification = gdk_mir_display_supports_selection_notification;
|
||||
display_class->request_selection_notification = gdk_mir_display_request_selection_notification;
|
||||
display_class->store_clipboard = gdk_mir_display_store_clipboard;
|
||||
display_class->get_default_cursor_size = gdk_mir_display_get_default_cursor_size;
|
||||
display_class->get_maximal_cursor_size = gdk_mir_display_get_maximal_cursor_size;
|
||||
display_class->get_cursor_for_type = gdk_mir_display_get_cursor_for_type;
|
||||
display_class->get_cursor_for_name = gdk_mir_display_get_cursor_for_name;
|
||||
display_class->get_cursor_for_surface = gdk_mir_display_get_cursor_for_surface;
|
||||
display_class->list_devices = gdk_mir_display_list_devices;
|
||||
display_class->get_app_launch_context = gdk_mir_display_get_app_launch_context;
|
||||
display_class->before_process_all_updates = gdk_mir_display_before_process_all_updates;
|
||||
display_class->after_process_all_updates = gdk_mir_display_after_process_all_updates;
|
||||
display_class->get_next_serial = gdk_mir_display_get_next_serial;
|
||||
display_class->notify_startup_complete = gdk_mir_display_notify_startup_complete;
|
||||
display_class->event_data_copy = gdk_mir_display_event_data_copy;
|
||||
display_class->event_data_free = gdk_mir_display_event_data_free;
|
||||
display_class->create_window_impl = gdk_mir_display_create_window_impl;
|
||||
display_class->get_keymap = gdk_mir_display_get_keymap;
|
||||
display_class->push_error_trap = gdk_mir_display_push_error_trap;
|
||||
display_class->pop_error_trap = gdk_mir_display_pop_error_trap;
|
||||
display_class->get_selection_owner = gdk_mir_display_get_selection_owner;
|
||||
display_class->set_selection_owner = gdk_mir_display_set_selection_owner;
|
||||
display_class->send_selection_notify = gdk_mir_display_send_selection_notify;
|
||||
display_class->get_selection_property = gdk_mir_display_get_selection_property;
|
||||
display_class->convert_selection = gdk_mir_display_convert_selection;
|
||||
display_class->text_property_to_utf8_list = gdk_mir_display_text_property_to_utf8_list;
|
||||
display_class->utf8_to_string_target = gdk_mir_display_utf8_to_string_target;
|
||||
}
|
||||
@@ -0,0 +1,624 @@
|
||||
/*
|
||||
* Copyright © 2014 Canonical Ltd
|
||||
*
|
||||
* 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 "gdkinternals.h"
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include "gdkmir.h"
|
||||
#include "gdkmir-private.h"
|
||||
|
||||
struct _GdkMirWindowReference {
|
||||
GdkMirEventSource *source;
|
||||
GdkWindow *window;
|
||||
gint ref_count;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
GdkMirWindowReference *window_ref;
|
||||
MirEvent event;
|
||||
} GdkMirQueuedEvent;
|
||||
|
||||
struct _GdkMirEventSource
|
||||
{
|
||||
GSource parent_instance;
|
||||
|
||||
GMutex mir_event_lock;
|
||||
GQueue mir_events;
|
||||
|
||||
GdkDisplay *display;
|
||||
};
|
||||
|
||||
static void
|
||||
send_event (GdkWindow *window, GdkDevice *device, GdkEvent *event)
|
||||
{
|
||||
GdkDisplay *display;
|
||||
GList *node;
|
||||
|
||||
gdk_event_set_device (event, device);
|
||||
gdk_event_set_screen (event, gdk_display_get_screen (gdk_window_get_display (window), 0));
|
||||
event->any.window = g_object_ref (window);
|
||||
|
||||
display = gdk_window_get_display (window);
|
||||
node = _gdk_event_queue_append (display, event);
|
||||
_gdk_windowing_got_event (display, node, event, _gdk_display_get_next_serial (display));
|
||||
}
|
||||
|
||||
static void
|
||||
set_key_event_string (GdkEventKey *event)
|
||||
{
|
||||
gunichar c = 0;
|
||||
|
||||
if (event->keyval != GDK_KEY_VoidSymbol)
|
||||
c = gdk_keyval_to_unicode (event->keyval);
|
||||
|
||||
if (c)
|
||||
{
|
||||
gchar buf[7];
|
||||
gint len;
|
||||
gsize bytes_written;
|
||||
|
||||
/* Apply the control key - Taken from Xlib
|
||||
*/
|
||||
if (event->state & GDK_CONTROL_MASK)
|
||||
{
|
||||
if ((c >= '@' && c < '\177') || c == ' ') c &= 0x1F;
|
||||
else if (c == '2')
|
||||
{
|
||||
event->string = g_memdup ("\0\0", 2);
|
||||
event->length = 1;
|
||||
buf[0] = '\0';
|
||||
return;
|
||||
}
|
||||
else if (c >= '3' && c <= '7') c -= ('3' - '\033');
|
||||
else if (c == '8') c = '\177';
|
||||
else if (c == '/') c = '_' & 0x1F;
|
||||
}
|
||||
|
||||
len = g_unichar_to_utf8 (c, buf);
|
||||
buf[len] = '\0';
|
||||
|
||||
event->string = g_locale_from_utf8 (buf, len,
|
||||
NULL, &bytes_written,
|
||||
NULL);
|
||||
if (event->string)
|
||||
event->length = bytes_written;
|
||||
}
|
||||
else if (event->keyval == GDK_KEY_Escape)
|
||||
{
|
||||
event->length = 1;
|
||||
event->string = g_strdup ("\033");
|
||||
}
|
||||
else if (event->keyval == GDK_KEY_Return ||
|
||||
event->keyval == GDK_KEY_KP_Enter)
|
||||
{
|
||||
event->length = 1;
|
||||
event->string = g_strdup ("\r");
|
||||
}
|
||||
|
||||
if (!event->string)
|
||||
{
|
||||
event->length = 0;
|
||||
event->string = g_strdup ("");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
generate_key_event (GdkWindow *window, GdkEventType type, guint state, guint keyval, guint16 keycode, gboolean is_modifier)
|
||||
{
|
||||
GdkEvent *event;
|
||||
|
||||
event = gdk_event_new (type);
|
||||
event->key.state = state;
|
||||
event->key.keyval = keyval;
|
||||
event->key.hardware_keycode = keycode + 8;
|
||||
event->key.is_modifier = is_modifier;
|
||||
set_key_event_string (&event->key);
|
||||
|
||||
send_event (window, _gdk_mir_device_manager_get_keyboard (gdk_display_get_device_manager (gdk_window_get_display (window))), event);
|
||||
}
|
||||
|
||||
static GdkDevice *
|
||||
get_pointer (GdkWindow *window)
|
||||
{
|
||||
return gdk_device_manager_get_client_pointer (gdk_display_get_device_manager (gdk_window_get_display (window)));
|
||||
}
|
||||
|
||||
static void
|
||||
generate_button_event (GdkWindow *window, GdkEventType type, gdouble x, gdouble y, guint button, guint state)
|
||||
{
|
||||
GdkEvent *event;
|
||||
|
||||
event = gdk_event_new (type);
|
||||
event->button.x = x;
|
||||
event->button.y = y;
|
||||
event->button.state = state;
|
||||
event->button.button = button;
|
||||
|
||||
send_event (window, get_pointer (window), event);
|
||||
}
|
||||
|
||||
static void
|
||||
generate_scroll_event (GdkWindow *window, gdouble x, gdouble y, gdouble delta_x, gdouble delta_y, guint state)
|
||||
{
|
||||
GdkEvent *event;
|
||||
|
||||
event = gdk_event_new (GDK_SCROLL);
|
||||
event->scroll.x = x;
|
||||
event->scroll.y = y;
|
||||
event->scroll.state = state;
|
||||
event->scroll.direction = GDK_SCROLL_SMOOTH;
|
||||
event->scroll.delta_x = delta_x;
|
||||
event->scroll.delta_y = delta_y;
|
||||
|
||||
send_event (window, get_pointer (window), event);
|
||||
}
|
||||
|
||||
static void
|
||||
generate_motion_event (GdkWindow *window, gdouble x, gdouble y, guint state)
|
||||
{
|
||||
GdkEvent *event;
|
||||
|
||||
event = gdk_event_new (GDK_MOTION_NOTIFY);
|
||||
event->motion.x = x;
|
||||
event->motion.y = y;
|
||||
event->motion.state = state;
|
||||
event->motion.is_hint = FALSE;
|
||||
|
||||
send_event (window, get_pointer (window), event);
|
||||
}
|
||||
|
||||
static void
|
||||
generate_crossing_event (GdkWindow *window, GdkEventType type, gdouble x, gdouble y)
|
||||
{
|
||||
GdkEvent *event;
|
||||
|
||||
event = gdk_event_new (type);
|
||||
event->crossing.x = x;
|
||||
event->crossing.y = y;
|
||||
event->crossing.mode = GDK_CROSSING_NORMAL;
|
||||
event->crossing.detail = GDK_NOTIFY_ANCESTOR;
|
||||
event->crossing.focus = TRUE;
|
||||
|
||||
send_event (window, get_pointer (window), event);
|
||||
}
|
||||
|
||||
static void
|
||||
generate_focus_event (GdkWindow *window, gboolean focused)
|
||||
{
|
||||
GdkEvent *event;
|
||||
|
||||
if (focused)
|
||||
gdk_synthesize_window_state (window, 0, GDK_WINDOW_STATE_FOCUSED);
|
||||
else
|
||||
gdk_synthesize_window_state (window, GDK_WINDOW_STATE_FOCUSED, 0);
|
||||
|
||||
event = gdk_event_new (GDK_FOCUS_CHANGE);
|
||||
event->focus_change.send_event = FALSE;
|
||||
event->focus_change.in = focused;
|
||||
|
||||
send_event (window, get_pointer (window), event);
|
||||
}
|
||||
|
||||
static guint
|
||||
get_modifier_state (unsigned int modifiers, unsigned int button_state)
|
||||
{
|
||||
guint modifier_state = 0;
|
||||
|
||||
if ((modifiers & mir_key_modifier_alt) != 0)
|
||||
modifier_state |= GDK_MOD1_MASK;
|
||||
if ((modifiers & mir_key_modifier_shift) != 0)
|
||||
modifier_state |= GDK_SHIFT_MASK;
|
||||
if ((modifiers & mir_key_modifier_ctrl) != 0)
|
||||
modifier_state |= GDK_CONTROL_MASK;
|
||||
if ((modifiers & mir_key_modifier_meta) != 0)
|
||||
modifier_state |= GDK_SUPER_MASK;
|
||||
if ((modifiers & mir_key_modifier_caps_lock) != 0)
|
||||
modifier_state |= GDK_LOCK_MASK;
|
||||
if ((button_state & mir_motion_button_primary) != 0)
|
||||
modifier_state |= GDK_BUTTON1_MASK;
|
||||
if ((button_state & mir_motion_button_secondary) != 0)
|
||||
modifier_state |= GDK_BUTTON3_MASK;
|
||||
if ((button_state & mir_motion_button_tertiary) != 0)
|
||||
modifier_state |= GDK_BUTTON2_MASK;
|
||||
|
||||
return modifier_state;
|
||||
}
|
||||
|
||||
/*
|
||||
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (event_data->window->impl);
|
||||
MirMotionButton changed_button_state;
|
||||
GdkEventType event_type;
|
||||
gdouble x, y;
|
||||
guint modifier_state;
|
||||
gboolean is_modifier = FALSE;
|
||||
*/
|
||||
|
||||
static void
|
||||
handle_key_event (GdkWindow *window, const MirKeyEvent *event)
|
||||
{
|
||||
guint modifier_state;
|
||||
gboolean is_modifier = FALSE;
|
||||
|
||||
modifier_state = get_modifier_state (event->modifiers, 0); // FIXME: Need to track button state
|
||||
|
||||
switch (event->action)
|
||||
{
|
||||
case mir_key_action_down:
|
||||
case mir_key_action_up:
|
||||
// FIXME: Convert keycode
|
||||
// FIXME: is_modifier
|
||||
generate_key_event (window,
|
||||
event->action == mir_key_action_down ? GDK_KEY_PRESS : GDK_KEY_RELEASE,
|
||||
modifier_state,
|
||||
event->key_code,
|
||||
event->scan_code,
|
||||
is_modifier);
|
||||
break;
|
||||
default:
|
||||
//case mir_key_action_multiple:
|
||||
// FIXME
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
handle_motion_event (GdkWindow *window, const MirMotionEvent *event)
|
||||
{
|
||||
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
|
||||
gdouble x, y;
|
||||
gboolean cursor_inside;
|
||||
MirMotionButton button_state;
|
||||
guint modifier_state;
|
||||
GdkEventType event_type;
|
||||
MirMotionButton changed_button_state;
|
||||
|
||||
_gdk_mir_window_impl_get_cursor_state (impl, &x, &y, &cursor_inside, &button_state);
|
||||
if (event->pointer_count > 0)
|
||||
{
|
||||
x = event->pointer_coordinates[0].x;
|
||||
y = event->pointer_coordinates[0].y;
|
||||
}
|
||||
modifier_state = get_modifier_state (event->modifiers, event->button_state);
|
||||
|
||||
/* The Mir events generate hover-exits even while inside the window so
|
||||
counteract this by always generating an enter notify on all other events */
|
||||
if (!cursor_inside && event->action != mir_motion_action_hover_exit)
|
||||
{
|
||||
cursor_inside = TRUE;
|
||||
generate_crossing_event (window, GDK_ENTER_NOTIFY, x, y);
|
||||
}
|
||||
|
||||
/* Update which window has focus */
|
||||
_gdk_mir_pointer_set_location (get_pointer (window), x, y, window, modifier_state);
|
||||
switch (event->action)
|
||||
{
|
||||
case mir_motion_action_down:
|
||||
case mir_motion_action_up:
|
||||
event_type = event->action == mir_motion_action_down ? GDK_BUTTON_PRESS : GDK_BUTTON_RELEASE;
|
||||
changed_button_state = button_state ^ event->button_state;
|
||||
if ((changed_button_state & mir_motion_button_primary) != 0)
|
||||
generate_button_event (window, event_type, x, y, GDK_BUTTON_PRIMARY, modifier_state);
|
||||
if ((changed_button_state & mir_motion_button_secondary) != 0)
|
||||
generate_button_event (window, event_type, x, y, GDK_BUTTON_SECONDARY, modifier_state);
|
||||
if ((changed_button_state & mir_motion_button_tertiary) != 0)
|
||||
generate_button_event (window, event_type, x, y, GDK_BUTTON_MIDDLE, modifier_state);
|
||||
button_state = event->button_state;
|
||||
break;
|
||||
case mir_motion_action_scroll:
|
||||
generate_scroll_event (window, x, y, event->pointer_coordinates[0].hscroll, event->pointer_coordinates[0].vscroll, modifier_state);
|
||||
break;
|
||||
case mir_motion_action_move: // move with button
|
||||
case mir_motion_action_hover_move: // move without button
|
||||
generate_motion_event (window, x, y, modifier_state);
|
||||
break;
|
||||
case mir_motion_action_hover_exit:
|
||||
cursor_inside = FALSE;
|
||||
generate_crossing_event (window, GDK_LEAVE_NOTIFY, x, y);
|
||||
break;
|
||||
}
|
||||
|
||||
_gdk_mir_window_impl_set_cursor_state (impl, x, y, cursor_inside, button_state);
|
||||
}
|
||||
|
||||
static void
|
||||
handle_surface_event (GdkWindow *window, const MirSurfaceEvent *event)
|
||||
{
|
||||
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
|
||||
|
||||
switch (event->attrib)
|
||||
{
|
||||
case mir_surface_attrib_type:
|
||||
break;
|
||||
case mir_surface_attrib_state:
|
||||
_gdk_mir_window_impl_set_surface_state (impl, event->value);
|
||||
// FIXME: notify
|
||||
break;
|
||||
case mir_surface_attrib_swapinterval:
|
||||
break;
|
||||
case mir_surface_attrib_focus:
|
||||
generate_focus_event (window, event->value != 0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
generate_configure_event (GdkWindow *window,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
GdkEvent *event;
|
||||
|
||||
event = gdk_event_new (GDK_CONFIGURE);
|
||||
event->configure.send_event = FALSE;
|
||||
event->configure.width = width;
|
||||
event->configure.height = height;
|
||||
|
||||
send_event (window, get_pointer (window), event);
|
||||
}
|
||||
|
||||
static void
|
||||
handle_resize_event (GdkWindow *window,
|
||||
const MirResizeEvent *event)
|
||||
{
|
||||
window->width = event->width;
|
||||
window->height = event->height;
|
||||
_gdk_window_update_size (window);
|
||||
|
||||
generate_configure_event (window, event->width, event->height);
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GdkWindow *window;
|
||||
MirEvent event;
|
||||
} EventData;
|
||||
|
||||
static void
|
||||
gdk_mir_event_source_queue_event (GdkDisplay *display,
|
||||
GdkWindow *window,
|
||||
const MirEvent *event)
|
||||
{
|
||||
if (g_getenv ("GDK_MIR_LOG_EVENTS"))
|
||||
_gdk_mir_print_event (event);
|
||||
|
||||
// FIXME: Only generate events if the window wanted them?
|
||||
switch (event->type)
|
||||
{
|
||||
case mir_event_type_key:
|
||||
handle_key_event (window, &event->key);
|
||||
break;
|
||||
case mir_event_type_motion:
|
||||
handle_motion_event (window, &event->motion);
|
||||
break;
|
||||
case mir_event_type_surface:
|
||||
handle_surface_event (window, &event->surface);
|
||||
break;
|
||||
case mir_event_type_resize:
|
||||
handle_resize_event (window, &event->resize);
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
// FIXME?
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static GdkMirQueuedEvent *
|
||||
gdk_mir_event_source_take_queued_event (GdkMirEventSource *source)
|
||||
{
|
||||
GdkMirQueuedEvent *queued_event;
|
||||
|
||||
g_mutex_lock (&source->mir_event_lock);
|
||||
queued_event = g_queue_pop_head (&source->mir_events);
|
||||
g_mutex_unlock (&source->mir_event_lock);
|
||||
|
||||
return queued_event;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_queued_event_free (GdkMirQueuedEvent *event)
|
||||
{
|
||||
_gdk_mir_window_reference_unref (event->window_ref);
|
||||
g_slice_free (GdkMirQueuedEvent, event);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_event_source_convert_events (GdkMirEventSource *source)
|
||||
{
|
||||
GdkMirQueuedEvent *event;
|
||||
|
||||
while ((event = gdk_mir_event_source_take_queued_event (source)))
|
||||
{
|
||||
GdkWindow *window = event->window_ref->window;
|
||||
|
||||
/* The window may have been destroyed in the main thread while the
|
||||
* event was being dispatched...
|
||||
*/
|
||||
if (window != NULL)
|
||||
gdk_mir_event_source_queue_event (source->display, window, &event->event);
|
||||
else
|
||||
g_warning ("window was destroyed before event arrived...");
|
||||
|
||||
gdk_mir_queued_event_free (event);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_mir_event_source_prepare (GSource *g_source,
|
||||
gint *timeout)
|
||||
{
|
||||
GdkMirEventSource *source = (GdkMirEventSource *) g_source;
|
||||
gboolean mir_events_in_queue;
|
||||
|
||||
if (_gdk_event_queue_find_first (source->display))
|
||||
return TRUE;
|
||||
|
||||
g_mutex_lock (&source->mir_event_lock);
|
||||
mir_events_in_queue = g_queue_get_length (&source->mir_events) > 0;
|
||||
g_mutex_unlock (&source->mir_event_lock);
|
||||
|
||||
return mir_events_in_queue;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_mir_event_source_check (GSource *g_source)
|
||||
{
|
||||
return gdk_mir_event_source_prepare (g_source, NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_mir_event_source_dispatch (GSource *g_source,
|
||||
GSourceFunc callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
GdkMirEventSource *source = (GdkMirEventSource *) g_source;
|
||||
GdkEvent *event;
|
||||
|
||||
/* First, run the queue of events from the thread */
|
||||
gdk_mir_event_source_convert_events (source);
|
||||
|
||||
/* Next, dispatch one single event from the display's queue.
|
||||
*
|
||||
* If there is more than one event then we will soon find ourselves
|
||||
* back here again.
|
||||
*/
|
||||
|
||||
gdk_threads_enter ();
|
||||
|
||||
event = gdk_display_get_event (source->display);
|
||||
|
||||
if (event)
|
||||
{
|
||||
_gdk_event_emit (event);
|
||||
|
||||
gdk_event_free (event);
|
||||
}
|
||||
|
||||
gdk_threads_leave ();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_event_source_finalize (GSource *g_source)
|
||||
{
|
||||
GdkMirEventSource *source = (GdkMirEventSource *) g_source;
|
||||
GdkMirQueuedEvent *event;
|
||||
|
||||
while ((event = gdk_mir_event_source_take_queued_event (source)))
|
||||
gdk_mir_queued_event_free (event);
|
||||
|
||||
g_mutex_clear (&source->mir_event_lock);
|
||||
}
|
||||
|
||||
static GSourceFuncs gdk_mir_event_source_funcs = {
|
||||
gdk_mir_event_source_prepare,
|
||||
gdk_mir_event_source_check,
|
||||
gdk_mir_event_source_dispatch,
|
||||
gdk_mir_event_source_finalize
|
||||
};
|
||||
|
||||
GdkMirEventSource *
|
||||
_gdk_mir_event_source_new (GdkDisplay *display)
|
||||
{
|
||||
GdkMirEventSource *source;
|
||||
GSource *g_source;
|
||||
|
||||
g_source = g_source_new (&gdk_mir_event_source_funcs, sizeof (GdkMirEventSource));
|
||||
g_source_attach (g_source, NULL);
|
||||
|
||||
source = (GdkMirEventSource *) g_source;
|
||||
g_mutex_init (&source->mir_event_lock);
|
||||
source->display = display;
|
||||
|
||||
return source;
|
||||
}
|
||||
|
||||
GdkMirWindowReference *
|
||||
_gdk_mir_event_source_get_window_reference (GdkWindow *window)
|
||||
{
|
||||
static GQuark win_ref_quark;
|
||||
GdkMirWindowReference *ref;
|
||||
|
||||
if G_UNLIKELY (!win_ref_quark)
|
||||
win_ref_quark = g_quark_from_string ("GdkMirEventSource window reference");
|
||||
|
||||
ref = g_object_get_qdata (G_OBJECT (window), win_ref_quark);
|
||||
|
||||
if (!ref)
|
||||
{
|
||||
GdkMirEventSource *source;
|
||||
|
||||
source = _gdk_mir_display_get_event_source (gdk_window_get_display (window));
|
||||
g_source_ref ((GSource *) source);
|
||||
|
||||
ref = g_slice_new (GdkMirWindowReference);
|
||||
ref->window = window;
|
||||
ref->source = source;
|
||||
ref->ref_count = 0;
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *) &ref->window);
|
||||
|
||||
g_object_set_qdata_full (G_OBJECT (window), win_ref_quark,
|
||||
ref, (GDestroyNotify) _gdk_mir_window_reference_unref);
|
||||
}
|
||||
|
||||
g_atomic_int_inc (&ref->ref_count);
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_mir_window_reference_unref (GdkMirWindowReference *ref)
|
||||
{
|
||||
if (g_atomic_int_dec_and_test (&ref->ref_count))
|
||||
{
|
||||
if (ref->window)
|
||||
g_object_remove_weak_pointer (G_OBJECT (ref->window), (gpointer *) &ref->window);
|
||||
|
||||
g_source_unref ((GSource *) ref->source);
|
||||
|
||||
g_slice_free (GdkMirWindowReference, ref);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_mir_event_source_queue (GdkMirWindowReference *window_ref,
|
||||
const MirEvent *event)
|
||||
{
|
||||
GdkMirEventSource *source = window_ref->source;
|
||||
GdkMirQueuedEvent *queued_event;
|
||||
|
||||
/* We are in the wrong thread right now. We absolutely cannot touch
|
||||
* the window.
|
||||
*
|
||||
* We can do pretty much anything we want with the source, though...
|
||||
*/
|
||||
|
||||
queued_event = g_slice_new (GdkMirQueuedEvent);
|
||||
g_atomic_int_inc (&window_ref->ref_count);
|
||||
queued_event->window_ref = window_ref;
|
||||
queued_event->event = *event;
|
||||
|
||||
g_mutex_lock (&source->mir_event_lock);
|
||||
g_queue_push_tail (&source->mir_events, queued_event);
|
||||
g_mutex_unlock (&source->mir_event_lock);
|
||||
|
||||
g_main_context_wakeup (NULL);
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
/*
|
||||
* Copyright © 2014 Canonical Ltd
|
||||
*
|
||||
* 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 "gdkdeviceprivate.h"
|
||||
|
||||
typedef struct GdkMirKeyboard GdkMirKeyboard;
|
||||
typedef struct GdkMirKeyboardClass GdkMirKeyboardClass;
|
||||
|
||||
#define GDK_TYPE_MIR_KEYBOARD (gdk_mir_keyboard_get_type ())
|
||||
#define GDK_MIR_KEYBOARD(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_MIR_KEYBOARD, GdkMirKeyboard))
|
||||
#define GDK_MIR_KEYBOARD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_MIR_KEYBOARD, GdkMirKeyboardClass))
|
||||
#define GDK_IS_MIR_KEYBOARD(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_MIR_KEYBOARD))
|
||||
#define GDK_IS_MIR_KEYBOARD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_MIR_KEYBOARD))
|
||||
#define GDK_MIR_KEYBOARD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_MIR_KEYBOARD, GdkMirKeyboardClass))
|
||||
|
||||
struct GdkMirKeyboard
|
||||
{
|
||||
GdkDevice parent_instance;
|
||||
};
|
||||
|
||||
struct GdkMirKeyboardClass
|
||||
{
|
||||
GdkDeviceClass parent_class;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GdkMirKeyboard, gdk_mir_keyboard, GDK_TYPE_DEVICE)
|
||||
|
||||
GdkDevice *
|
||||
_gdk_mir_keyboard_new (GdkDeviceManager *device_manager, const gchar *name)
|
||||
{
|
||||
return g_object_new (GDK_TYPE_MIR_KEYBOARD,
|
||||
"display", gdk_device_manager_get_display (device_manager),
|
||||
"device-manager", device_manager,
|
||||
"name", name,
|
||||
"type", GDK_DEVICE_TYPE_MASTER,
|
||||
"input-source", GDK_SOURCE_KEYBOARD,
|
||||
"input-mode", GDK_MODE_SCREEN,
|
||||
"has-cursor", FALSE,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_mir_keyboard_get_history (GdkDevice *device,
|
||||
GdkWindow *window,
|
||||
guint32 start,
|
||||
guint32 stop,
|
||||
GdkTimeCoord ***events,
|
||||
gint *n_events)
|
||||
{
|
||||
g_printerr ("gdk_mir_keyboard_get_history\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_keyboard_get_state (GdkDevice *device,
|
||||
GdkWindow *window,
|
||||
gdouble *axes,
|
||||
GdkModifierType *mask)
|
||||
{
|
||||
g_printerr ("gdk_mir_keyboard_get_state\n");
|
||||
}
|
||||
|
||||
static void
|
||||
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... */
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_keyboard_warp (GdkDevice *device,
|
||||
GdkScreen *screen,
|
||||
gdouble x,
|
||||
gdouble y)
|
||||
{
|
||||
//g_printerr ("gdk_mir_keyboard_warp\n");
|
||||
/* Can't warp a keyboard... */
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_keyboard_query_state (GdkDevice *device,
|
||||
GdkWindow *window,
|
||||
GdkWindow **root_window,
|
||||
GdkWindow **child_window,
|
||||
gdouble *root_x,
|
||||
gdouble *root_y,
|
||||
gdouble *win_x,
|
||||
gdouble *win_y,
|
||||
GdkModifierType *mask)
|
||||
{
|
||||
g_printerr ("gdk_mir_keyboard_query_state\n");
|
||||
}
|
||||
|
||||
static GdkGrabStatus
|
||||
gdk_mir_keyboard_grab (GdkDevice *device,
|
||||
GdkWindow *window,
|
||||
gboolean owner_events,
|
||||
GdkEventMask event_mask,
|
||||
GdkWindow *confine_to,
|
||||
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;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_keyboard_ungrab (GdkDevice *device,
|
||||
guint32 time_)
|
||||
{
|
||||
//g_printerr ("gdk_mir_keyboard_ungrab\n");
|
||||
/* Mir doesn't do grabs */
|
||||
}
|
||||
|
||||
static GdkWindow *
|
||||
gdk_mir_keyboard_window_at_position (GdkDevice *device,
|
||||
gdouble *win_x,
|
||||
gdouble *win_y,
|
||||
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?
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_keyboard_select_window_events (GdkDevice *device,
|
||||
GdkWindow *window,
|
||||
GdkEventMask event_mask)
|
||||
{
|
||||
g_printerr ("gdk_mir_keyboard_select_window_events\n");
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_keyboard_init (GdkMirKeyboard *device)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_keyboard_class_init (GdkMirKeyboardClass *klass)
|
||||
{
|
||||
GdkDeviceClass *device_class = GDK_DEVICE_CLASS (klass);
|
||||
|
||||
device_class->get_history = gdk_mir_keyboard_get_history;
|
||||
device_class->get_state = gdk_mir_keyboard_get_state;
|
||||
device_class->set_window_cursor = gdk_mir_keyboard_set_window_cursor;
|
||||
device_class->warp = gdk_mir_keyboard_warp;
|
||||
device_class->query_state = gdk_mir_keyboard_query_state;
|
||||
device_class->grab = gdk_mir_keyboard_grab;
|
||||
device_class->ungrab = gdk_mir_keyboard_ungrab;
|
||||
device_class->window_at_position = gdk_mir_keyboard_window_at_position;
|
||||
device_class->select_window_events = gdk_mir_keyboard_select_window_events;
|
||||
}
|
||||
@@ -0,0 +1,466 @@
|
||||
/*
|
||||
* Copyright © 2014 Canonical Ltd
|
||||
*
|
||||
* 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 <xkbcommon/xkbcommon.h>
|
||||
|
||||
#include "gdkkeysprivate.h"
|
||||
|
||||
typedef struct GdkMirKeymap GdkMirKeymap;
|
||||
typedef struct GdkMirKeymapClass GdkMirKeymapClass;
|
||||
|
||||
#define GDK_TYPE_MIR_KEYMAP (gdk_mir_keymap_get_type ())
|
||||
#define GDK_MIR_KEYMAP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_MIR_KEYMAP, GdkMirKeymap))
|
||||
#define GDK_MIR_KEYMAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_MIR_KEYMAP, GdkMirKeymapClass))
|
||||
#define GDK_IS_MIR_KEYMAP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_MIR_KEYMAP))
|
||||
#define GDK_IS_MIR_KEYMAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_MIR_KEYMAP))
|
||||
#define GDK_MIR_KEYMAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_MIR_KEYMAP, GdkMirKeymapClass))
|
||||
|
||||
struct GdkMirKeymap
|
||||
{
|
||||
GdkKeymap parent_instance;
|
||||
|
||||
struct xkb_keymap *xkb_keymap;
|
||||
struct xkb_state *xkb_state;
|
||||
|
||||
PangoDirection *direction;
|
||||
gboolean bidi;
|
||||
};
|
||||
|
||||
struct GdkMirKeymapClass
|
||||
{
|
||||
GdkKeymapClass parent_class;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GdkMirKeymap, gdk_mir_keymap, GDK_TYPE_KEYMAP)
|
||||
|
||||
GdkKeymap *
|
||||
_gdk_mir_keymap_new (void)
|
||||
{
|
||||
return g_object_new (GDK_TYPE_MIR_KEYMAP, NULL);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
for (i = 0; i < xkb_keymap_num_layouts (mir_keymap->xkb_keymap); i++)
|
||||
{
|
||||
if (xkb_state_layout_index_is_active (mir_keymap->xkb_state, i, XKB_STATE_LAYOUT_EFFECTIVE))
|
||||
return mir_keymap->direction[i];
|
||||
}
|
||||
|
||||
return PANGO_DIRECTION_NEUTRAL;
|
||||
}
|
||||
|
||||
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_entries_for_keyval (GdkKeymap *keymap,
|
||||
guint keyval,
|
||||
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;
|
||||
|
||||
key_array = g_array_new (FALSE, FALSE, sizeof (GdkKeymapKey));
|
||||
|
||||
for (keycode = 8; keycode < 255; keycode++) /* FIXME: min/max keycode */
|
||||
{
|
||||
gint num_layouts, layout;
|
||||
|
||||
num_layouts = xkb_keymap_num_layouts_for_key (mir_keymap->xkb_keymap, keycode);
|
||||
for (layout = 0; layout < num_layouts; layout++)
|
||||
{
|
||||
gint num_levels, level;
|
||||
|
||||
num_levels = xkb_keymap_num_levels_for_key (mir_keymap->xkb_keymap, keycode, layout);
|
||||
for (level = 0; level < num_levels; level++)
|
||||
{
|
||||
const xkb_keysym_t *syms;
|
||||
gint num_syms, sym;
|
||||
|
||||
num_syms = xkb_keymap_key_get_syms_by_level (mir_keymap->xkb_keymap, keycode, layout, level, &syms);
|
||||
for (sym = 0; sym < num_syms; sym++)
|
||||
{
|
||||
if (syms[sym] == keyval)
|
||||
{
|
||||
GdkKeymapKey key;
|
||||
|
||||
key.keycode = keycode;
|
||||
key.group = layout;
|
||||
key.level = level;
|
||||
|
||||
g_array_append_val (key_array, key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*n_keys = key_array->len;
|
||||
*keys = (GdkKeymapKey*) g_array_free (key_array, FALSE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_mir_keymap_get_entries_for_keycode (GdkKeymap *keymap,
|
||||
guint hardware_keycode,
|
||||
GdkKeymapKey **keys,
|
||||
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;
|
||||
gint i;
|
||||
|
||||
num_layouts = xkb_keymap_num_layouts_for_key (mir_keymap->xkb_keymap, hardware_keycode);
|
||||
|
||||
num_entries = 0;
|
||||
for (layout = 0; layout < num_layouts; layout++)
|
||||
num_entries += xkb_keymap_num_levels_for_key (mir_keymap->xkb_keymap, hardware_keycode, layout);
|
||||
|
||||
if (n_entries)
|
||||
*n_entries = num_entries;
|
||||
if (keys)
|
||||
*keys = g_new0 (GdkKeymapKey, num_entries);
|
||||
if (keyvals)
|
||||
*keyvals = g_new0 (guint, num_entries);
|
||||
|
||||
i = 0;
|
||||
for (layout = 0; layout < num_layouts; layout++)
|
||||
{
|
||||
gint num_levels, level;
|
||||
num_levels = xkb_keymap_num_levels_for_key (mir_keymap->xkb_keymap, hardware_keycode, layout);
|
||||
for (level = 0; level < num_levels; level++)
|
||||
{
|
||||
const xkb_keysym_t *syms;
|
||||
int num_syms;
|
||||
|
||||
num_syms = xkb_keymap_key_get_syms_by_level (mir_keymap->xkb_keymap, hardware_keycode, layout, 0, &syms);
|
||||
if (keys)
|
||||
{
|
||||
(*keys)[i].keycode = hardware_keycode;
|
||||
(*keys)[i].group = layout;
|
||||
(*keys)[i].level = level;
|
||||
}
|
||||
if (keyvals && num_syms > 0)
|
||||
(*keyvals)[i] = syms[0];
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
return num_entries > 0;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
num_syms = xkb_keymap_key_get_syms_by_level (mir_keymap->xkb_keymap,
|
||||
key->keycode,
|
||||
key->group,
|
||||
key->level,
|
||||
&syms);
|
||||
if (num_syms > 0)
|
||||
return syms[0];
|
||||
else
|
||||
return XKB_KEY_NoSymbol;
|
||||
}
|
||||
|
||||
static guint32
|
||||
get_xkb_modifiers (struct xkb_keymap *xkb_keymap,
|
||||
GdkModifierType state)
|
||||
{
|
||||
guint32 mods = 0;
|
||||
|
||||
if (state & GDK_SHIFT_MASK)
|
||||
mods |= 1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_SHIFT);
|
||||
if (state & GDK_LOCK_MASK)
|
||||
mods |= 1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_CAPS);
|
||||
if (state & GDK_CONTROL_MASK)
|
||||
mods |= 1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_CTRL);
|
||||
if (state & GDK_MOD1_MASK)
|
||||
mods |= 1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_ALT);
|
||||
if (state & GDK_MOD2_MASK)
|
||||
mods |= 1 << xkb_keymap_mod_get_index (xkb_keymap, "Mod2");
|
||||
if (state & GDK_MOD3_MASK)
|
||||
mods |= 1 << xkb_keymap_mod_get_index (xkb_keymap, "Mod3");
|
||||
if (state & GDK_MOD4_MASK)
|
||||
mods |= 1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_LOGO);
|
||||
if (state & GDK_MOD5_MASK)
|
||||
mods |= 1 << xkb_keymap_mod_get_index (xkb_keymap, "Mod5");
|
||||
|
||||
return mods;
|
||||
}
|
||||
|
||||
static GdkModifierType
|
||||
get_gdk_modifiers (struct xkb_keymap *xkb_keymap,
|
||||
guint32 mods)
|
||||
{
|
||||
GdkModifierType state = 0;
|
||||
|
||||
if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_SHIFT)))
|
||||
state |= GDK_SHIFT_MASK;
|
||||
if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_CAPS)))
|
||||
state |= GDK_LOCK_MASK;
|
||||
if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_CTRL)))
|
||||
state |= GDK_CONTROL_MASK;
|
||||
if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_ALT)))
|
||||
state |= GDK_MOD1_MASK;
|
||||
if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, "Mod2")))
|
||||
state |= GDK_MOD2_MASK;
|
||||
if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, "Mod3")))
|
||||
state |= GDK_MOD3_MASK;
|
||||
if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_LOGO)))
|
||||
state |= GDK_MOD4_MASK;
|
||||
if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, "Mod5")))
|
||||
state |= GDK_MOD5_MASK;
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_mir_keymap_translate_keyboard_state (GdkKeymap *keymap,
|
||||
guint hardware_keycode,
|
||||
GdkModifierType state,
|
||||
gint group,
|
||||
guint *keyval,
|
||||
gint *effective_group,
|
||||
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;
|
||||
guint32 consumed;
|
||||
xkb_layout_index_t layout;
|
||||
xkb_level_index_t level;
|
||||
xkb_keysym_t sym;
|
||||
|
||||
modifiers = get_xkb_modifiers (mir_keymap->xkb_keymap, state);
|
||||
|
||||
xkb_state = xkb_state_new (mir_keymap->xkb_keymap);
|
||||
|
||||
xkb_state_update_mask (xkb_state, modifiers, 0, 0, group, 0, 0);
|
||||
|
||||
layout = xkb_state_key_get_layout (xkb_state, hardware_keycode);
|
||||
level = xkb_state_key_get_level (xkb_state, hardware_keycode, layout);
|
||||
sym = xkb_state_key_get_one_sym (xkb_state, hardware_keycode);
|
||||
consumed = modifiers & ~xkb_state_mod_mask_remove_consumed (xkb_state, hardware_keycode, modifiers);
|
||||
|
||||
xkb_state_unref (xkb_state);
|
||||
|
||||
if (keyval)
|
||||
*keyval = sym;
|
||||
if (effective_group)
|
||||
*effective_group = layout;
|
||||
if (effective_level)
|
||||
*effective_level = level;
|
||||
if (consumed_modifiers)
|
||||
*consumed_modifiers = get_gdk_modifiers (mir_keymap->xkb_keymap, consumed);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
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?
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
mods = xkb_state_serialize_mods (mir_keymap->xkb_state, XKB_STATE_MODS_EFFECTIVE);
|
||||
|
||||
return get_gdk_modifiers (mir_keymap->xkb_keymap, mods);
|
||||
}
|
||||
|
||||
static void
|
||||
update_direction (GdkMirKeymap *keymap)
|
||||
{
|
||||
gint num_layouts;
|
||||
gint *rtl;
|
||||
guint key;
|
||||
gboolean have_rtl, have_ltr;
|
||||
gint i;
|
||||
|
||||
num_layouts = xkb_keymap_num_layouts (keymap->xkb_keymap);
|
||||
|
||||
g_free (keymap->direction);
|
||||
keymap->direction = g_new0 (PangoDirection, num_layouts);
|
||||
|
||||
rtl = g_new0 (gint, num_layouts);
|
||||
|
||||
for (key = 8; key < 255; key++) /* FIXME: min/max keycode */
|
||||
{
|
||||
gint layouts;
|
||||
gint layout;
|
||||
|
||||
layouts = xkb_keymap_num_layouts_for_key (keymap->xkb_keymap, key);
|
||||
for (layout = 0; layout < layouts; layout++)
|
||||
{
|
||||
const xkb_keysym_t *syms;
|
||||
gint num_syms;
|
||||
gint sym;
|
||||
|
||||
num_syms = xkb_keymap_key_get_syms_by_level (keymap->xkb_keymap, key, layout, 0, &syms);
|
||||
for (sym = 0; sym < num_syms; sym++)
|
||||
{
|
||||
PangoDirection dir;
|
||||
dir = pango_unichar_direction (xkb_keysym_to_utf32 (syms[sym]));
|
||||
switch (dir)
|
||||
{
|
||||
case PANGO_DIRECTION_RTL:
|
||||
rtl[layout]++;
|
||||
break;
|
||||
case PANGO_DIRECTION_LTR:
|
||||
rtl[layout]--;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
have_rtl = have_ltr = FALSE;
|
||||
for (i = 0; i < num_layouts; i++)
|
||||
{
|
||||
if (rtl[i] > 0)
|
||||
{
|
||||
keymap->direction[i] = PANGO_DIRECTION_RTL;
|
||||
have_rtl = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
keymap->direction[i] = PANGO_DIRECTION_LTR;
|
||||
have_ltr = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (have_rtl && have_ltr)
|
||||
keymap->bidi = TRUE;
|
||||
|
||||
g_free (rtl);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_keymap_init (GdkMirKeymap *keymap)
|
||||
{
|
||||
struct xkb_context *context;
|
||||
struct xkb_rule_names names;
|
||||
|
||||
context = xkb_context_new (0);
|
||||
|
||||
names.rules = "evdev";
|
||||
names.model = "pc105";
|
||||
names.layout = "us";
|
||||
names.variant = "";
|
||||
names.options = "";
|
||||
keymap->xkb_keymap = xkb_keymap_new_from_names (context, &names, 0);
|
||||
keymap->xkb_state = xkb_state_new (keymap->xkb_keymap);
|
||||
|
||||
xkb_context_unref (context);
|
||||
|
||||
update_direction (keymap);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_keymap_finalize (GObject *object)
|
||||
{
|
||||
GdkMirKeymap *keymap = GDK_MIR_KEYMAP (object);
|
||||
|
||||
xkb_keymap_unref (keymap->xkb_keymap);
|
||||
xkb_state_unref (keymap->xkb_state);
|
||||
g_free (keymap->direction);
|
||||
|
||||
G_OBJECT_CLASS (gdk_mir_keymap_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_keymap_class_init (GdkMirKeymapClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GdkKeymapClass *keymap_class = GDK_KEYMAP_CLASS (klass);
|
||||
|
||||
object_class->finalize = gdk_mir_keymap_finalize;
|
||||
|
||||
keymap_class->get_direction = gdk_mir_keymap_get_direction;
|
||||
keymap_class->have_bidi_layouts = gdk_mir_keymap_have_bidi_layouts;
|
||||
keymap_class->get_caps_lock_state = gdk_mir_keymap_get_caps_lock_state;
|
||||
keymap_class->get_num_lock_state = gdk_mir_keymap_get_num_lock_state;
|
||||
keymap_class->get_entries_for_keyval = gdk_mir_keymap_get_entries_for_keyval;
|
||||
keymap_class->get_entries_for_keycode = gdk_mir_keymap_get_entries_for_keycode;
|
||||
keymap_class->lookup_key = gdk_mir_keymap_lookup_key;
|
||||
keymap_class->translate_keyboard_state = gdk_mir_keymap_translate_keyboard_state;
|
||||
keymap_class->add_virtual_modifiers = gdk_mir_keymap_add_virtual_modifiers;
|
||||
keymap_class->map_virtual_modifiers = gdk_mir_keymap_map_virtual_modifiers;
|
||||
keymap_class->get_modifier_state = gdk_mir_keymap_get_modifier_state;
|
||||
}
|
||||
@@ -0,0 +1,250 @@
|
||||
/*
|
||||
* Copyright © 2014 Canonical Ltd
|
||||
*
|
||||
* 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 "gdkdeviceprivate.h"
|
||||
#include "gdkscreen.h"
|
||||
#include "gdkwindow.h"
|
||||
|
||||
typedef struct GdkMirPointer GdkMirPointer;
|
||||
typedef struct GdkMirPointerClass GdkMirPointerClass;
|
||||
|
||||
#define GDK_TYPE_MIR_POINTER (gdk_mir_pointer_get_type ())
|
||||
#define GDK_MIR_POINTER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_MIR_POINTER, GdkMirPointer))
|
||||
#define GDK_MIR_POINTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_MIR_POINTER, GdkMirPointerClass))
|
||||
#define GDK_IS_MIR_POINTER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_MIR_POINTER))
|
||||
#define GDK_IS_MIR_POINTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_MIR_POINTER))
|
||||
#define GDK_MIR_POINTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_MIR_POINTER, GdkMirPointerClass))
|
||||
|
||||
struct GdkMirPointer
|
||||
{
|
||||
GdkDevice parent_instance;
|
||||
|
||||
/* Location of pointer */
|
||||
gdouble x;
|
||||
gdouble y;
|
||||
|
||||
/* Window this pointer is over */
|
||||
GdkWindow *over_window;
|
||||
|
||||
/* Current modifier mask */
|
||||
GdkModifierType modifier_mask;
|
||||
};
|
||||
|
||||
struct GdkMirPointerClass
|
||||
{
|
||||
GdkDeviceClass parent_class;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GdkMirPointer, gdk_mir_pointer, GDK_TYPE_DEVICE)
|
||||
|
||||
GdkDevice *
|
||||
_gdk_mir_pointer_new (GdkDeviceManager *device_manager, const gchar *name)
|
||||
{
|
||||
return g_object_new (GDK_TYPE_MIR_POINTER,
|
||||
"display", gdk_device_manager_get_display (device_manager),
|
||||
"device-manager", device_manager,
|
||||
"name", name,
|
||||
"type", GDK_DEVICE_TYPE_MASTER,
|
||||
"input-source", GDK_SOURCE_MOUSE,
|
||||
"input-mode", GDK_MODE_SCREEN,
|
||||
"has-cursor", TRUE,
|
||||
NULL);
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_mir_pointer_set_location (GdkDevice *pointer,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
GdkWindow *window,
|
||||
GdkModifierType mask)
|
||||
{
|
||||
GdkMirPointer *p = GDK_MIR_POINTER (pointer);
|
||||
|
||||
p->x = x;
|
||||
p->y = y;
|
||||
if (p->over_window)
|
||||
g_object_unref (p->over_window);
|
||||
p->over_window = g_object_ref (window);
|
||||
p->modifier_mask = mask;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_mir_pointer_get_history (GdkDevice *device,
|
||||
GdkWindow *window,
|
||||
guint32 start,
|
||||
guint32 stop,
|
||||
GdkTimeCoord ***events,
|
||||
gint *n_events)
|
||||
{
|
||||
g_printerr ("gdk_mir_pointer_get_history\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_pointer_get_state (GdkDevice *device,
|
||||
GdkWindow *window,
|
||||
gdouble *axes,
|
||||
GdkModifierType *mask)
|
||||
{
|
||||
//g_printerr ("gdk_mir_pointer_get_state\n");
|
||||
GdkMirPointer *p = GDK_MIR_POINTER (device);
|
||||
gdouble x, y;
|
||||
|
||||
gdk_window_get_device_position_double (window, device, &x, &y, mask);
|
||||
if (axes)
|
||||
{
|
||||
axes[0] = p->x;
|
||||
axes[1] = p->y;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
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 */
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_pointer_warp (GdkDevice *device,
|
||||
GdkScreen *screen,
|
||||
gdouble x,
|
||||
gdouble y)
|
||||
{
|
||||
//g_printerr ("gdk_mir_pointer_warp\n");
|
||||
/* Mir doesn't support warping */
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_pointer_query_state (GdkDevice *device,
|
||||
GdkWindow *window,
|
||||
GdkWindow **root_window,
|
||||
GdkWindow **child_window,
|
||||
gdouble *root_x,
|
||||
gdouble *root_y,
|
||||
gdouble *win_x,
|
||||
gdouble *win_y,
|
||||
GdkModifierType *mask)
|
||||
{
|
||||
//g_printerr ("gdk_mir_pointer_query_state\n");
|
||||
GdkMirPointer *p = GDK_MIR_POINTER (device);
|
||||
|
||||
if (root_window)
|
||||
*root_window = gdk_screen_get_root_window (gdk_display_get_default_screen (gdk_device_get_display (device)));
|
||||
if (child_window)
|
||||
*child_window = p->over_window;
|
||||
if (root_x)
|
||||
*root_x = p->x;
|
||||
if (root_y)
|
||||
*root_y = p->y;
|
||||
if (win_x)
|
||||
*win_x = p->x; // FIXME
|
||||
if (win_y)
|
||||
*win_y = p->y;
|
||||
if (mask)
|
||||
*mask = p->modifier_mask;
|
||||
}
|
||||
|
||||
static GdkGrabStatus
|
||||
gdk_mir_pointer_grab (GdkDevice *device,
|
||||
GdkWindow *window,
|
||||
gboolean owner_events,
|
||||
GdkEventMask event_mask,
|
||||
GdkWindow *confine_to,
|
||||
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;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_pointer_ungrab (GdkDevice *device,
|
||||
guint32 time_)
|
||||
{
|
||||
//g_printerr ("gdk_mir_pointer_ungrab\n");
|
||||
/* Mir doesn't do grabs */
|
||||
}
|
||||
|
||||
static GdkWindow *
|
||||
gdk_mir_pointer_window_at_position (GdkDevice *device,
|
||||
gdouble *win_x,
|
||||
gdouble *win_y,
|
||||
GdkModifierType *mask,
|
||||
gboolean get_toplevel)
|
||||
{
|
||||
//g_printerr ("gdk_mir_pointer_window_at_position\n");
|
||||
GdkMirPointer *p = GDK_MIR_POINTER (device);
|
||||
|
||||
if (win_x)
|
||||
*win_x = p->x;
|
||||
if (win_y)
|
||||
*win_y = p->y;
|
||||
if (mask)
|
||||
*mask = p->modifier_mask;
|
||||
|
||||
return p->over_window;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_pointer_select_window_events (GdkDevice *device,
|
||||
GdkWindow *window,
|
||||
GdkEventMask event_mask)
|
||||
{
|
||||
g_printerr ("gdk_mir_pointer_select_window_events\n");
|
||||
// FIXME?
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_pointer_init (GdkMirPointer *device)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_pointer_finalize (GObject *object)
|
||||
{
|
||||
GdkMirPointer *p = GDK_MIR_POINTER (object);
|
||||
|
||||
if (p->over_window)
|
||||
g_object_unref (p->over_window);
|
||||
|
||||
G_OBJECT_CLASS (gdk_mir_pointer_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_pointer_class_init (GdkMirPointerClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GdkDeviceClass *device_class = GDK_DEVICE_CLASS (klass);
|
||||
|
||||
object_class->finalize = gdk_mir_pointer_finalize;
|
||||
|
||||
device_class->get_history = gdk_mir_pointer_get_history;
|
||||
device_class->get_state = gdk_mir_pointer_get_state;
|
||||
device_class->set_window_cursor = gdk_mir_pointer_set_window_cursor;
|
||||
device_class->warp = gdk_mir_pointer_warp;
|
||||
device_class->query_state = gdk_mir_pointer_query_state;
|
||||
device_class->grab = gdk_mir_pointer_grab;
|
||||
device_class->ungrab = gdk_mir_pointer_ungrab;
|
||||
device_class->window_at_position = gdk_mir_pointer_window_at_position;
|
||||
device_class->select_window_events = gdk_mir_pointer_select_window_events;
|
||||
}
|
||||
@@ -0,0 +1,720 @@
|
||||
/*
|
||||
* Copyright © 2014 Canonical Ltd
|
||||
*
|
||||
* 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 <string.h>
|
||||
|
||||
#include "gdkscreenprivate.h"
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include "gdkvisualprivate.h"
|
||||
#include "gdkinternals.h"
|
||||
|
||||
#include "gdkmir.h"
|
||||
#include "gdkmir-private.h"
|
||||
|
||||
#define VISUAL_TYPE GDK_VISUAL_TRUE_COLOR
|
||||
#define VISUAL_DEPTH 32
|
||||
|
||||
typedef struct GdkMirScreen GdkMirScreen;
|
||||
typedef struct GdkMirScreenClass GdkMirScreenClass;
|
||||
|
||||
#define GDK_TYPE_MIR_SCREEN (gdk_mir_screen_get_type ())
|
||||
#define GDK_MIR_SCREEN(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_MIR_SCREEN, GdkMirScreen))
|
||||
#define GDK_MIR_SCREEN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_MIR_SCREEN, GdkMirScreenClass))
|
||||
#define GDK_IS_MIR_SCREEN(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_MIR_SCREEN))
|
||||
#define GDK_IS_MIR_SCREEN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_MIR_SCREEN))
|
||||
#define GDK_MIR_SCREEN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_MIR_SCREEN, GdkMirScreenClass))
|
||||
|
||||
struct GdkMirScreen
|
||||
{
|
||||
GdkScreen parent_instance;
|
||||
|
||||
/* Display this screen is running on */
|
||||
GdkDisplay *display;
|
||||
|
||||
/* Current monitor configuration */
|
||||
MirDisplayConfiguration *display_config;
|
||||
|
||||
GdkVisual *visual;
|
||||
|
||||
GdkWindow *root_window;
|
||||
};
|
||||
|
||||
struct GdkMirScreenClass
|
||||
{
|
||||
GdkScreenClass parent_class;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GdkMirScreen, gdk_mir_screen, GDK_TYPE_SCREEN)
|
||||
|
||||
static MirConnection *
|
||||
get_connection (GdkMirScreen *screen)
|
||||
{
|
||||
return gdk_mir_display_get_mir_connection (GDK_DISPLAY (screen->display));
|
||||
}
|
||||
|
||||
static void
|
||||
get_screen_size (MirDisplayConfiguration *config, gint *width, gint *height)
|
||||
{
|
||||
uint32_t i;
|
||||
|
||||
*width = 0;
|
||||
*height = 0;
|
||||
|
||||
if (!config)
|
||||
return;
|
||||
|
||||
for (i = 0; i < config->num_outputs; i++)
|
||||
{
|
||||
MirDisplayOutput *o = &config->outputs[i];
|
||||
gint w, h;
|
||||
|
||||
if (!o->used)
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
static void
|
||||
config_changed_cb (MirConnection *connection, void *data)
|
||||
{
|
||||
GdkMirScreen *screen = data;
|
||||
gint old_width, old_height, new_width, new_height;
|
||||
|
||||
get_screen_size (screen->display_config, &old_width, &old_height);
|
||||
update_display_config (screen);
|
||||
get_screen_size (screen->display_config, &new_width, &new_height);
|
||||
|
||||
g_signal_emit_by_name (screen, "monitors-changed");
|
||||
if (old_width > 0 && (old_width != new_width || old_height != new_height))
|
||||
g_signal_emit_by_name (screen, "size-changed");
|
||||
}
|
||||
|
||||
GdkScreen *
|
||||
_gdk_mir_screen_new (GdkDisplay *display)
|
||||
{
|
||||
GdkMirScreen *screen;
|
||||
|
||||
screen = g_object_new (GDK_TYPE_MIR_SCREEN, NULL);
|
||||
screen->display = display;
|
||||
mir_connection_set_display_config_change_callback (get_connection (screen), config_changed_cb, display);
|
||||
update_display_config (screen);
|
||||
|
||||
return GDK_SCREEN (screen);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_screen_dispose (GObject *object)
|
||||
{
|
||||
G_OBJECT_CLASS (gdk_mir_screen_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_screen_finalize (GObject *object)
|
||||
{
|
||||
G_OBJECT_CLASS (gdk_mir_screen_parent_class)->finalize (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)
|
||||
{
|
||||
MirDisplayConfiguration *config;
|
||||
uint32_t i, j;
|
||||
|
||||
config = GDK_MIR_SCREEN (screen)->display_config;
|
||||
|
||||
for (i = 0, j = 0; i < config->num_outputs; i++)
|
||||
{
|
||||
if (!config->outputs[i].used)
|
||||
continue;
|
||||
|
||||
if (j == monitor_num)
|
||||
return &config->outputs[i];
|
||||
j++;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_mir_screen_get_width_mm (GdkScreen *screen)
|
||||
{
|
||||
g_printerr ("gdk_mir_screen_get_width_mm\n");
|
||||
// FIXME: A combination of all screens?
|
||||
return get_output (screen, 0)->physical_width_mm;
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_mir_screen_get_height_mm (GdkScreen *screen)
|
||||
{
|
||||
g_printerr ("gdk_mir_screen_get_height_mm\n");
|
||||
// FIXME: A combination of all screens?
|
||||
return get_output (screen, 0)->physical_height_mm;
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_mir_screen_get_number (GdkScreen *screen)
|
||||
{
|
||||
//g_printerr ("gdk_mir_screen_get_number\n");
|
||||
/* There is only one screen... */
|
||||
return 0;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
if (s->root_window)
|
||||
return s->root_window;
|
||||
|
||||
get_screen_size (GDK_MIR_SCREEN (screen)->display_config, &width, &height);
|
||||
|
||||
s->root_window = _gdk_display_create_window (s->display);
|
||||
s->root_window->impl = _gdk_mir_window_impl_new ();
|
||||
s->root_window->impl_window = s->root_window;
|
||||
s->root_window->visual = s->visual;
|
||||
s->root_window->window_type = GDK_WINDOW_ROOT;
|
||||
s->root_window->depth = VISUAL_DEPTH;
|
||||
s->root_window->x = 0;
|
||||
s->root_window->y = 0;
|
||||
s->root_window->abs_x = 0;
|
||||
s->root_window->abs_y = 0;
|
||||
s->root_window->width = width;
|
||||
s->root_window->height = height;
|
||||
s->root_window->viewable = TRUE;
|
||||
|
||||
return s->root_window;
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_mir_screen_get_n_monitors (GdkScreen *screen)
|
||||
{
|
||||
//g_printerr ("gdk_mir_screen_get_n_monitors\n");
|
||||
MirDisplayConfiguration *config;
|
||||
uint32_t i;
|
||||
gint count = 0;
|
||||
|
||||
config = GDK_MIR_SCREEN (screen)->display_config;
|
||||
|
||||
for (i = 0; i < config->num_outputs; i++)
|
||||
if (config->outputs[i].used)
|
||||
count++;
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_mir_screen_get_primary_monitor (GdkScreen *screen)
|
||||
{
|
||||
g_printerr ("gdk_mir_screen_get_primary_monitor\n");
|
||||
return 0; //?
|
||||
}
|
||||
|
||||
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);
|
||||
return get_output (screen, monitor_num)->physical_width_mm;
|
||||
}
|
||||
|
||||
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);
|
||||
return get_output (screen, monitor_num)->physical_height_mm;
|
||||
}
|
||||
|
||||
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);
|
||||
return NULL; //?
|
||||
}
|
||||
|
||||
static void
|
||||
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;
|
||||
|
||||
output = get_output (screen, monitor_num);
|
||||
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;
|
||||
}
|
||||
|
||||
static void
|
||||
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);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_screen_broadcast_client_message (GdkScreen *screen,
|
||||
GdkEvent *event)
|
||||
{
|
||||
g_printerr ("gdk_mir_screen_broadcast_client_message\n");
|
||||
// FIXME
|
||||
}
|
||||
|
||||
static gboolean
|
||||
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");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (strcmp (name, "gtk-font-name") == 0)
|
||||
{
|
||||
g_value_set_string (value, "Ubuntu");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (strcmp (name, "gtk-enable-animations") == 0)
|
||||
{
|
||||
g_value_set_boolean (value, TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (strcmp (name, "gtk-xft-dpi") == 0)
|
||||
{
|
||||
g_value_set_int (value, 96 * 1024);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (strcmp (name, "gtk-xft-antialias") == 0)
|
||||
{
|
||||
g_value_set_int (value, TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (strcmp (name, "gtk-xft-hinting") == 0)
|
||||
{
|
||||
g_value_set_int (value, TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (strcmp (name, "gtk-xft-hintstyle") == 0)
|
||||
{
|
||||
g_value_set_static_string (value, "hintfull");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (strcmp (name, "gtk-xft-rgba") == 0)
|
||||
{
|
||||
g_value_set_static_string (value, "rgba");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-modules"))
|
||||
{
|
||||
g_value_set_string (value, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-application-prefer-dark-theme"))
|
||||
{
|
||||
g_value_set_boolean (value, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-key-theme-name"))
|
||||
{
|
||||
g_value_set_string (value, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-double-click-time"))
|
||||
{
|
||||
g_value_set_int (value, 250);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-double-click-distance"))
|
||||
{
|
||||
g_value_set_int (value, 5);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-cursor-theme-name"))
|
||||
{
|
||||
g_value_set_string (value, "Raleigh");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-cursor-theme-size"))
|
||||
{
|
||||
g_value_set_int (value, 128);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-icon-theme-name"))
|
||||
{
|
||||
g_value_set_string (value, "hicolor");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-shell-shows-app-menu"))
|
||||
{
|
||||
g_value_set_boolean (value, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-shell-shows-menubar"))
|
||||
{
|
||||
g_value_set_boolean (value, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-shell-shows-desktop"))
|
||||
{
|
||||
g_value_set_boolean (value, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-recent-files-enabled"))
|
||||
{
|
||||
g_value_set_boolean (value, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-alternative-sort-arrows"))
|
||||
{
|
||||
g_value_set_boolean (value, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-enable-accels"))
|
||||
{
|
||||
g_value_set_boolean (value, TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-enable-mnemonics"))
|
||||
{
|
||||
g_value_set_boolean (value, TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-menu-images"))
|
||||
{
|
||||
g_value_set_boolean (value, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-button-images"))
|
||||
{
|
||||
g_value_set_boolean (value, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-split-cursor"))
|
||||
{
|
||||
g_value_set_boolean (value, TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-im-module"))
|
||||
{
|
||||
g_value_set_string (value, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-menu-bar-accel"))
|
||||
{
|
||||
g_value_set_string (value, "F10");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-cursor-blink"))
|
||||
{
|
||||
g_value_set_boolean (value, TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-cursor-blink-time"))
|
||||
{
|
||||
g_value_set_int (value, 1200);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-cursor-blink-timeout"))
|
||||
{
|
||||
g_value_set_int (value, 10);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-entry-select-on-focus"))
|
||||
{
|
||||
g_value_set_boolean (value, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-error-bell"))
|
||||
{
|
||||
g_value_set_boolean (value, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-label-select-on-focus"))
|
||||
{
|
||||
g_value_set_boolean (value, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
g_warning ("unknown property %s", name);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
static GdkVisual*
|
||||
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;
|
||||
}
|
||||
|
||||
static void
|
||||
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;
|
||||
}
|
||||
|
||||
static void
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_screen_init (GdkMirScreen *screen)
|
||||
{
|
||||
screen->visual = g_object_new (GDK_TYPE_VISUAL, NULL);
|
||||
screen->visual->screen = GDK_SCREEN (screen);
|
||||
screen->visual->type = VISUAL_TYPE;
|
||||
screen->visual->depth = VISUAL_DEPTH;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_screen_class_init (GdkMirScreenClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GdkScreenClass *screen_class = GDK_SCREEN_CLASS (klass);
|
||||
|
||||
object_class->dispose = gdk_mir_screen_dispose;
|
||||
object_class->finalize = gdk_mir_screen_finalize;
|
||||
|
||||
screen_class->get_display = gdk_mir_screen_get_display;
|
||||
screen_class->get_width = gdk_mir_screen_get_width;
|
||||
screen_class->get_height = gdk_mir_screen_get_height;
|
||||
screen_class->get_width_mm = gdk_mir_screen_get_width_mm;
|
||||
screen_class->get_height_mm = gdk_mir_screen_get_height_mm;
|
||||
screen_class->get_number = gdk_mir_screen_get_number;
|
||||
screen_class->get_root_window = gdk_mir_screen_get_root_window;
|
||||
screen_class->get_n_monitors = gdk_mir_screen_get_n_monitors;
|
||||
screen_class->get_primary_monitor = gdk_mir_screen_get_primary_monitor;
|
||||
screen_class->get_monitor_width_mm = gdk_mir_screen_get_monitor_width_mm;
|
||||
screen_class->get_monitor_height_mm = gdk_mir_screen_get_monitor_height_mm;
|
||||
screen_class->get_monitor_plug_name = gdk_mir_screen_get_monitor_plug_name;
|
||||
screen_class->get_monitor_geometry = gdk_mir_screen_get_monitor_geometry;
|
||||
screen_class->get_monitor_workarea = gdk_mir_screen_get_monitor_workarea;
|
||||
screen_class->list_visuals = gdk_mir_screen_list_visuals;
|
||||
screen_class->get_system_visual = gdk_mir_screen_get_system_visual;
|
||||
screen_class->get_rgba_visual = gdk_mir_screen_get_rgba_visual;
|
||||
screen_class->is_composited = gdk_mir_screen_is_composited;
|
||||
screen_class->make_display_name = gdk_mir_screen_make_display_name;
|
||||
screen_class->get_active_window = gdk_mir_screen_get_active_window;
|
||||
screen_class->get_window_stack = gdk_mir_screen_get_window_stack;
|
||||
screen_class->broadcast_client_message = gdk_mir_screen_broadcast_client_message;
|
||||
screen_class->get_setting = gdk_mir_screen_get_setting;
|
||||
screen_class->visual_get_best_depth = gdk_mir_screen_visual_get_best_depth;
|
||||
screen_class->visual_get_best_type = gdk_mir_screen_visual_get_best_type;
|
||||
screen_class->visual_get_best = gdk_mir_screen_visual_get_best;
|
||||
screen_class->visual_get_best_with_depth = gdk_mir_screen_visual_get_best_with_depth;
|
||||
screen_class->visual_get_best_with_type = gdk_mir_screen_visual_get_best_with_type;
|
||||
screen_class->visual_get_best_with_both = gdk_mir_screen_visual_get_best_with_both;
|
||||
screen_class->query_depths = gdk_mir_screen_query_depths;
|
||||
screen_class->query_visual_types = gdk_mir_screen_query_visual_types;
|
||||
screen_class->get_monitor_scale_factor = gdk_mir_screen_get_monitor_scale_factor;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright © 2014 Canonical Ltd
|
||||
*
|
||||
* 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 "gdkinternals.h"
|
||||
|
||||
#include "gdkmir.h"
|
||||
|
||||
#define GDK_MIR_WINDOW(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WINDOW_MIR, GdkMirWindow))
|
||||
#define GDK_MIR_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WINDOW_MIR, GdkMirWindowClass))
|
||||
#define GDK_IS_WINDOW_MIR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WINDOW_MIR))
|
||||
#define GDK_MIR_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WINDOW_MIR, GdkMirWindowClass))
|
||||
|
||||
typedef struct _GdkMirWindow GdkMirWindow;
|
||||
typedef struct _GdkMirWindowClass GdkMirWindowClass;
|
||||
|
||||
struct _GdkMirWindow
|
||||
{
|
||||
GdkWindow parent_instance;
|
||||
};
|
||||
|
||||
struct _GdkMirWindowClass
|
||||
{
|
||||
GdkWindowClass parent_class;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GdkMirWindow, gdk_mir_window, GDK_TYPE_WINDOW)
|
||||
|
||||
static void
|
||||
gdk_mir_window_init (GdkMirWindow *impl)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_window_class_init (GdkMirWindowClass *klass)
|
||||
{
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -654,6 +654,8 @@ update_context_from_dragging_info (id <NSDraggingInfo> sender)
|
||||
_gdk_quartz_drag_source_context = NULL;
|
||||
}
|
||||
|
||||
#ifdef AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER
|
||||
|
||||
- (void)setStyleMask:(NSUInteger)styleMask
|
||||
{
|
||||
gboolean was_fullscreen;
|
||||
@@ -669,4 +671,6 @@ update_context_from_dragging_info (id <NSDraggingInfo> sender)
|
||||
_gdk_quartz_window_update_fullscreen_state ([[self contentView] gdkWindow]);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
||||
@@ -42,7 +42,10 @@
|
||||
-(BOOL)trackManualResize;
|
||||
-(void)showAndMakeKey:(BOOL)makeKey;
|
||||
-(void)hide;
|
||||
|
||||
#ifdef AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER
|
||||
-(void)setStyleMask:(NSUInteger)styleMask;
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -125,10 +125,7 @@
|
||||
gchar *prev_str;
|
||||
markedRange = selectedRange = NSMakeRange (NSNotFound, 0);
|
||||
|
||||
prev_str = g_object_get_data (G_OBJECT (gdk_window), TIC_MARKED_TEXT);
|
||||
if (prev_str)
|
||||
g_free (prev_str);
|
||||
g_object_set_data (G_OBJECT (gdk_window), TIC_MARKED_TEXT, NULL);
|
||||
g_object_set_data_full (G_OBJECT (gdk_window), TIC_MARKED_TEXT, NULL, g_free);
|
||||
}
|
||||
|
||||
-(void)setMarkedText: (id)aString selectedRange: (NSRange)newSelection replacementRange: (NSRange)replacementRange
|
||||
@@ -155,10 +152,7 @@
|
||||
str = [aString UTF8String];
|
||||
}
|
||||
|
||||
prev_str = g_object_get_data (G_OBJECT (gdk_window), TIC_MARKED_TEXT);
|
||||
if (prev_str)
|
||||
g_free (prev_str);
|
||||
g_object_set_data (G_OBJECT (gdk_window), TIC_MARKED_TEXT, g_strdup (str));
|
||||
g_object_set_data_full (G_OBJECT (gdk_window), TIC_MARKED_TEXT, g_strdup (str), g_free);
|
||||
g_object_set_data (G_OBJECT (gdk_window), TIC_SELECTED_POS,
|
||||
GUINT_TO_POINTER (selectedRange.location));
|
||||
g_object_set_data (G_OBJECT (gdk_window), TIC_SELECTED_LEN,
|
||||
@@ -214,10 +208,7 @@
|
||||
str = [string UTF8String];
|
||||
}
|
||||
|
||||
prev_str = g_object_get_data (G_OBJECT (gdk_window), TIC_INSERT_TEXT);
|
||||
if (prev_str)
|
||||
g_free (prev_str);
|
||||
g_object_set_data (G_OBJECT (gdk_window), TIC_INSERT_TEXT, g_strdup (str));
|
||||
g_object_set_data_full (G_OBJECT (gdk_window), TIC_INSERT_TEXT, g_strdup (str), g_free);
|
||||
GDK_NOTE (EVENTS, g_print ("insertText: set %s (%p, nsview %p): %s\n",
|
||||
TIC_INSERT_TEXT, gdk_window, self,
|
||||
str ? str : "(empty)"));
|
||||
|
||||
@@ -245,8 +245,7 @@ select_thread_func (void *arg)
|
||||
*
|
||||
* => POLLING_DESCRIPTORS: select thread picks up the file descriptors to begin polling
|
||||
*/
|
||||
if (current_pollfds)
|
||||
g_free (current_pollfds);
|
||||
g_free (current_pollfds);
|
||||
|
||||
current_pollfds = next_pollfds;
|
||||
current_n_pollfds = next_n_pollfds;
|
||||
|
||||
@@ -107,12 +107,7 @@ static void
|
||||
gdk_quartz_screen_screen_rects_free (GdkQuartzScreen *screen)
|
||||
{
|
||||
screen->n_screens = 0;
|
||||
|
||||
if (screen->screen_rects)
|
||||
{
|
||||
g_free (screen->screen_rects);
|
||||
screen->screen_rects = NULL;
|
||||
}
|
||||
g_clear_pointer (&screen->screen_rects, g_free);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -44,12 +44,6 @@ static GSList *main_window_stack;
|
||||
|
||||
void _gdk_quartz_window_flush (GdkWindowImplQuartz *window_impl);
|
||||
|
||||
#ifndef AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER
|
||||
static FullscreenSavedGeometry *get_fullscreen_geometry (GdkWindow *window);
|
||||
#endif
|
||||
|
||||
#define FULLSCREEN_DATA "fullscreen-data"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
gint x, y;
|
||||
@@ -58,6 +52,12 @@ typedef struct
|
||||
} FullscreenSavedGeometry;
|
||||
|
||||
|
||||
#ifndef AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER
|
||||
static FullscreenSavedGeometry *get_fullscreen_geometry (GdkWindow *window);
|
||||
#endif
|
||||
|
||||
#define FULLSCREEN_DATA "fullscreen-data"
|
||||
|
||||
static void update_toplevel_order (void);
|
||||
static void clear_toplevel_order (void);
|
||||
|
||||
@@ -2050,18 +2050,6 @@ gdk_quartz_window_set_accept_focus (GdkWindow *window,
|
||||
window->accept_focus = accept_focus != FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_window_quartz_set_static_gravities (GdkWindow *window,
|
||||
gboolean use_static)
|
||||
{
|
||||
if (GDK_WINDOW_DESTROYED (window) ||
|
||||
!WINDOW_IS_TOPLEVEL (window))
|
||||
return FALSE;
|
||||
|
||||
/* FIXME: Implement */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_quartz_window_set_focus_on_map (GdkWindow *window,
|
||||
gboolean focus_on_map)
|
||||
@@ -2954,7 +2942,6 @@ gdk_window_impl_quartz_class_init (GdkWindowImplQuartzClass *klass)
|
||||
impl_class->get_device_state = gdk_window_quartz_get_device_state;
|
||||
impl_class->shape_combine_region = gdk_window_quartz_shape_combine_region;
|
||||
impl_class->input_shape_combine_region = gdk_window_quartz_input_shape_combine_region;
|
||||
impl_class->set_static_gravities = gdk_window_quartz_set_static_gravities;
|
||||
impl_class->destroy = gdk_quartz_window_destroy;
|
||||
impl_class->destroy_foreign = gdk_quartz_window_destroy_foreign;
|
||||
impl_class->get_shape = gdk_quartz_window_get_shape;
|
||||
|
||||
@@ -39,7 +39,9 @@ libgdk_wayland_la_SOURCES = \
|
||||
gdkdisplay-wayland.h \
|
||||
gdkdnd-wayland.c \
|
||||
gdkeventsource.c \
|
||||
gdkkeys-wayland.c \
|
||||
gdkkeys-wayland.c \
|
||||
gdkglcontext-wayland.c \
|
||||
gdkglcontext-wayland.h \
|
||||
gdkscreen-wayland.c \
|
||||
gdkselection-wayland.c \
|
||||
gdkwindow-wayland.c \
|
||||
@@ -54,6 +56,7 @@ libgdkinclude_HEADERS = \
|
||||
libgdkwaylandinclude_HEADERS = \
|
||||
gdkwaylanddevice.h \
|
||||
gdkwaylanddisplay.h \
|
||||
gdkwaylandglcontext.h \
|
||||
gdkwaylandselection.h \
|
||||
gdkwaylandwindow.h
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "gdkdevicemanager.h"
|
||||
#include "gdkkeysprivate.h"
|
||||
#include "gdkprivate-wayland.h"
|
||||
#include "gdkglcontext-wayland.h"
|
||||
|
||||
/**
|
||||
* SECTION:wayland_interaction
|
||||
@@ -216,6 +217,13 @@ _gdk_wayland_display_open (const gchar *display_name)
|
||||
GdkDisplay *display;
|
||||
GdkWaylandDisplay *display_wayland;
|
||||
|
||||
/* If this variable is unset then wayland initialisation will surely
|
||||
* fail, logging a fatal error in the process. Save ourselves from
|
||||
* that.
|
||||
*/
|
||||
if (g_getenv ("XDG_RUNTIME_DIR") == NULL)
|
||||
return NULL;
|
||||
|
||||
wl_log_set_handler_client(log_handler);
|
||||
|
||||
wl_display = wl_display_connect(display_name);
|
||||
@@ -540,6 +548,9 @@ gdk_wayland_display_class_init (GdkWaylandDisplayClass * class)
|
||||
display_class->convert_selection = _gdk_wayland_display_convert_selection;
|
||||
display_class->text_property_to_utf8_list = _gdk_wayland_display_text_property_to_utf8_list;
|
||||
display_class->utf8_to_string_target = _gdk_wayland_display_utf8_to_string_target;
|
||||
|
||||
display_class->destroy_gl_context = gdk_wayland_display_destroy_gl_context;
|
||||
display_class->make_gl_context_current = gdk_wayland_display_make_gl_context_current;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user