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