Compare commits
329 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 05e8057b5b | |||
| e89365e9e3 | |||
| 6484807719 | |||
| 527ff05107 | |||
| b89cfdb77f | |||
| 499687a11d | |||
| c5e26dd591 | |||
| bc17d1d5ea | |||
| b88ac0890e | |||
| d30baf34b3 | |||
| b927ad2c87 | |||
| 4540dac11a | |||
| aa9cac695d | |||
| 52412ca944 | |||
| cd82b18cfd | |||
| da5bb6ff22 | |||
| 7871f1e13b | |||
| dd18c7dedf | |||
| a34a6e9b84 | |||
| 0a5f29c9eb | |||
| 417be0719b | |||
| 3263a26cad | |||
| 00916c2b47 | |||
| e3320633a6 | |||
| 764a8cea59 | |||
| a2599c2bb9 | |||
| e2675306e1 | |||
| 7d1429cb91 | |||
| f13a018739 | |||
| 84b3b1fab5 | |||
| 048bb6db6f | |||
| 8c548d5579 | |||
| 09d5ec1b08 | |||
| 28bba484da | |||
| 191558cfa4 | |||
| cb0c1b3f08 | |||
| 91f200167e | |||
| 2b6fb005a8 | |||
| af6bec7539 | |||
| 38362c2803 | |||
| eb7c78aa48 | |||
| 7ab39b5461 | |||
| 0c44851848 | |||
| d72ed045df | |||
| 38eb182947 | |||
| 0eba21b2b5 | |||
| 21cba193ad | |||
| ee7c83e15a | |||
| 48dbbbc099 | |||
| 1c733857b3 | |||
| 85a6517d65 | |||
| d75147db0a | |||
| d3cf7088b3 | |||
| ffa7185397 | |||
| d7fe62817c | |||
| a034bdb17e | |||
| af20f7e9b5 | |||
| 15b7a4572b | |||
| 146bb70c2e | |||
| 494de142f6 | |||
| 5d979cde82 | |||
| f48b894468 | |||
| a6e47892be | |||
| 1e0c25d96a | |||
| f57eec5288 | |||
| e938befcbc | |||
| 2af8ac655b | |||
| cc3c0125a8 | |||
| 59f9be457f | |||
| d1ce514260 | |||
| ad5e72728f | |||
| 1bf24f7b19 | |||
| a3cedb0163 | |||
| 97bab27d82 | |||
| 6030da573d | |||
| 0128574ca1 | |||
| b27a169200 | |||
| bcd0704511 | |||
| 506566b6a4 | |||
| b67da38916 | |||
| 8519ab56f5 | |||
| 89d87e3482 | |||
| 04c9c6b428 | |||
| 9bd8ed0d82 | |||
| 40386c97eb | |||
| 6649cc6e5e | |||
| e69dc04a7f | |||
| c1361f7a5a | |||
| 351ffef704 | |||
| a1ddd3fead | |||
| 79f0f4ee8e | |||
| 7b8bfb4c80 | |||
| 7106cf6524 | |||
| e706e14fd9 | |||
| 3f1021048f | |||
| ddba7f8601 | |||
| 1660a0eaf1 | |||
| ffffb382e2 | |||
| 09453bc60b | |||
| f76b749e43 | |||
| 0aca2a03b4 | |||
| fd358990a2 | |||
| 01b91c1ba3 | |||
| cc02076b75 | |||
| b726a2d902 | |||
| 654ae5928a | |||
| 1c24514798 | |||
| 33f3ab9991 | |||
| 91511a80ac | |||
| a585457861 | |||
| 4a0ddac307 | |||
| f7d9ede82d | |||
| 65839f67f8 | |||
| df40db137b | |||
| 129bc27d53 | |||
| 274e2b221f | |||
| adc4009354 | |||
| f058a42bd3 | |||
| 3a8cb276e7 | |||
| eeaa73c12a | |||
| 3873861b27 | |||
| 8e455e333b | |||
| 3d10e6c3d1 | |||
| dcc7cf7114 | |||
| f1d0886087 | |||
| 951e4ee6b2 | |||
| f9e2c106bc | |||
| 53956e5389 | |||
| 3ab63fd03b | |||
| fb4927827b | |||
| cbbca38d88 | |||
| c64836e1c9 | |||
| 6b23fe3aa7 | |||
| 9defc7fc64 | |||
| 9d56f44cdf | |||
| 1b9da2bb17 | |||
| 2efc1729e2 | |||
| a66a0dde81 | |||
| 7062411bad | |||
| 9dbd137ec8 | |||
| 79fad9f221 | |||
| 8f9ee48aaa | |||
| 8eb9844a45 | |||
| b90132c917 | |||
| 23806b7788 | |||
| d266c0d105 | |||
| 581461c2b5 | |||
| f108f053d4 | |||
| df593ee651 | |||
| 4dcd011486 | |||
| 6fe7e373e2 | |||
| 0c3583b4bd | |||
| 5bd0179a88 | |||
| f116efd48e | |||
| 8057bee295 | |||
| ab330f1efc | |||
| e5dc66b10e | |||
| aa43d97a80 | |||
| eaf4fb68f3 | |||
| bfe193e6e2 | |||
| aa8dec3d27 | |||
| d2e7060150 | |||
| 08f3acb534 | |||
| 525f96f2f8 | |||
| b6b2682bd6 | |||
| 1832964188 | |||
| eb599653e6 | |||
| e1e88ce665 | |||
| 66d21689bc | |||
| 8186cb8bee | |||
| 9b8f28903b | |||
| 1cd42825c2 | |||
| 166444f115 | |||
| 3cd68c5de5 | |||
| 9e2357d5f3 | |||
| bd0c68f641 | |||
| c3a7d79154 | |||
| 25624083dd | |||
| 407b5246a6 | |||
| 6bedcf22bc | |||
| eeb9d6c398 | |||
| cf8d2374c5 | |||
| 9fa5378d83 | |||
| 90352d760d | |||
| c3c1763a9f | |||
| 9f7c9ce6ad | |||
| 1f155bf39a | |||
| 84014e3414 | |||
| 4ced1c90f1 | |||
| 54c3b947fc | |||
| 94007caf8d | |||
| 675c8b45b1 | |||
| ea59d174a0 | |||
| 32935d9fb0 | |||
| b390e1da4f | |||
| cccd1147e7 | |||
| d8db5f3217 | |||
| f5bb364bb5 | |||
| 82f57c6a93 | |||
| 20c41dce80 | |||
| a9de385ac5 | |||
| ead210c170 | |||
| 2ad471542a | |||
| d73cff5846 | |||
| 213376ee0a | |||
| 1cc100415f | |||
| d9ad7884e9 | |||
| f545d7a910 | |||
| 206eb647a4 | |||
| 00e637b480 | |||
| bfc8b7b7b6 | |||
| c44288c739 | |||
| 2fb5104731 | |||
| 0ae4d80766 | |||
| f5098e4fc5 | |||
| 28607f082c | |||
| f3968f2f1e | |||
| 88fa226223 | |||
| c4c496a31c | |||
| c1eac4a421 | |||
| b5d1323f49 | |||
| e297ac319d | |||
| bf852bea24 | |||
| a652507b7b | |||
| 4a2a76c231 | |||
| 8cb7369b7a | |||
| 588076d166 | |||
| 3a98b28ab7 | |||
| cfeedcc321 | |||
| d0aedbc9fc | |||
| 5557a528b6 | |||
| 5316eb0c35 | |||
| e6afe28de5 | |||
| eaf0353205 | |||
| f9f9bd3f5b | |||
| ca79688f52 | |||
| efa8f903c2 | |||
| f7d0b91267 | |||
| ed4f0de2b0 | |||
| 50b96dcdd5 | |||
| cf25f2c04b | |||
| ddf07ffe22 | |||
| 82f1eaacc9 | |||
| 4cdb07fa02 | |||
| bdd5393084 | |||
| 27b87ebec5 | |||
| 8c0df66d5f | |||
| e5238bf54f | |||
| e9abcde031 | |||
| d45281e6c7 | |||
| 3fd5ebffcb | |||
| 88a621fa13 | |||
| ce4b799f1e | |||
| 4dcacff312 | |||
| fd7667246d | |||
| b8cb15f28d | |||
| 51607ce93c | |||
| 66284cd245 | |||
| f9faecd5b7 | |||
| 92261b5022 | |||
| 91f5bfd211 | |||
| 63f20b173d | |||
| 25b3bd64af | |||
| fc4d36e50a | |||
| dbede0b115 | |||
| 1e40033852 | |||
| 478bf45320 | |||
| dac0b7d609 | |||
| d14987e819 | |||
| 3a0077f65f | |||
| 03882ef8e5 | |||
| 505e10f3ea | |||
| 1e01444de8 | |||
| 4404c43cd3 | |||
| 92a7c7cdc3 | |||
| 33db142eab | |||
| 68319afd23 | |||
| 25f4e597ee | |||
| db8339ca66 | |||
| 5ba02e3459 | |||
| 999509be61 | |||
| 5dca6dce91 | |||
| d3acfa8c2b | |||
| c1cc8c979b | |||
| eed74f6ea0 | |||
| e5a4b91997 | |||
| 885b34d382 | |||
| 3faf9d85bb | |||
| 4cd4c25c25 | |||
| bffa5dfddd | |||
| 2fe20878c3 | |||
| b28c3ef3d9 | |||
| ed5fb4bbfe | |||
| 2dd86aaa00 | |||
| eaf952d902 | |||
| 88cb6a46f2 | |||
| c76b4bdc77 | |||
| 62fe4eae16 | |||
| 99a40de8ad | |||
| b8376407a4 | |||
| a5643b0c83 | |||
| 828688d5cd | |||
| fc47b913b1 | |||
| 7d8b3357a5 | |||
| e0b98bc7de | |||
| 493b145496 | |||
| 1b2c11d7f5 | |||
| a56828237a | |||
| 56e2a7e8bb | |||
| f278f3610b | |||
| c111e633e9 | |||
| eea7cf30bb | |||
| 36bdcfaccb | |||
| 45bb820656 | |||
| 617deb8bb6 | |||
| 8efcd34dbe | |||
| a78b573f8b | |||
| 226f0e0567 | |||
| 4304a494ae | |||
| b71ff21530 | |||
| 6a7da77980 | |||
| c5f92340ee | |||
| 572a884e90 | |||
| 69bc9d0702 | |||
| 34ff9e359b | |||
| de705c2a2b | |||
| d1102f586c | |||
| ab65e8e178 | |||
| 4d741bac98 |
@@ -1,315 +1,3 @@
|
||||
Overview of Changes in 4.6.8, 24-10-2022
|
||||
========================================
|
||||
|
||||
* Input:
|
||||
- Fix problems with input method interactions that caused
|
||||
dead keys not to work
|
||||
|
||||
* GtkText:
|
||||
- Respect the no-emoji input hint fully
|
||||
|
||||
* GtkNotebook:
|
||||
- Fix an infinite loop in accessibility code
|
||||
- Event handling fixes
|
||||
|
||||
* GtkFileChooser:
|
||||
- Restore ~ and .functionality
|
||||
|
||||
* GtkTreeView:
|
||||
- Event handling fixes
|
||||
|
||||
* GtkTreeListModel:
|
||||
- Prevent possible crashes with collapsed nodes
|
||||
|
||||
* GtkGridView:
|
||||
- Fix issues with rubberband selection
|
||||
|
||||
* GtkEmojiChooser:
|
||||
- Fix navigation with arrow keys when filtered
|
||||
|
||||
* GtkPopover:
|
||||
- Fix problems with focus when dismissing popovers
|
||||
- Fix problems with focusing editable labels in popovers
|
||||
|
||||
* GtkStackSidebar:
|
||||
- Improve accessible presentation
|
||||
|
||||
* Wayland:
|
||||
- Make gtk_launch_uri more robust
|
||||
- Make monitor bounds handling more robust
|
||||
- Prevent shrinking clients due to wrong toplevel bounds
|
||||
|
||||
* Flatpak:
|
||||
- Fix file DND with the FileTransfer portal
|
||||
|
||||
* Translation updates
|
||||
Brazilian Portuguese
|
||||
Croatian
|
||||
Czech
|
||||
Georgian
|
||||
German
|
||||
Hungarian
|
||||
Icelandic
|
||||
Lithuanian
|
||||
Polish
|
||||
Portuguese
|
||||
Serbian
|
||||
Slovenian
|
||||
Swedish
|
||||
Turkish
|
||||
|
||||
|
||||
Overview of Changes in 4.6.7, 17-08-2022
|
||||
========================================
|
||||
|
||||
* Miscellaneous memory leak fixes
|
||||
|
||||
* GtkTreeView:
|
||||
- Fix a problem with DND
|
||||
- Fix a problem with row selection
|
||||
|
||||
* GtkTreePopover:
|
||||
- Support scrolling
|
||||
|
||||
* GtkGridView:
|
||||
- Fix issues with rubberband selection
|
||||
|
||||
* GtkSnapshot:
|
||||
- Make GtkSnapshot work from bindings
|
||||
|
||||
* X11:
|
||||
- Fix preferred action for DND
|
||||
|
||||
* Windows:
|
||||
- Fix DND
|
||||
|
||||
* Translation updates
|
||||
Croatian
|
||||
Georgian
|
||||
Indonesian
|
||||
Russian
|
||||
Serbian
|
||||
Spanish
|
||||
|
||||
|
||||
Overview of Changes in 4.6.6, 02-07-2022
|
||||
========================================
|
||||
|
||||
* Fix translations in GTKs own ui files
|
||||
|
||||
* Wayland:
|
||||
- Fix a problem with the activation protocol
|
||||
- Don't force the HighContrast icontheme
|
||||
|
||||
* Windows:
|
||||
- Fix a problem with builtin icons if the
|
||||
hicolor icontheme is not installed
|
||||
|
||||
* Translation updates:
|
||||
Brazilian Portuguese
|
||||
Russian
|
||||
Turkish
|
||||
|
||||
|
||||
Overview of Changes in 4.6.5, 27-05-2022
|
||||
========================================
|
||||
|
||||
* GtkFileChooser:
|
||||
- Fix pasting text into the name field
|
||||
|
||||
* GtkText:
|
||||
- Remove an assertion that is sometimes hit
|
||||
|
||||
* Wayland:
|
||||
- Ensure that our cursor surfaces don't violate
|
||||
protocol constraints
|
||||
|
||||
* Accssibility:
|
||||
- Fix a problem in the accessibility tree
|
||||
|
||||
* Translation updates:
|
||||
Brazilian Portuguese
|
||||
German
|
||||
Persian
|
||||
Polish
|
||||
Portuguese
|
||||
Russian
|
||||
Swedish
|
||||
Turkish
|
||||
Ukrainian
|
||||
|
||||
|
||||
Overview of Changes in 4.6.4, 13-05-2022
|
||||
========================================
|
||||
|
||||
* GtkFileChooser:
|
||||
- Fix select button sensitivity in select_folder mode
|
||||
- Fix some fallout from list model porting
|
||||
|
||||
* GtkListView, GtkColumnView:
|
||||
- Optimize scrolling
|
||||
|
||||
* print-to-file:
|
||||
- Handle nonexisting files better in the dialog
|
||||
|
||||
* Avoid infinite loops in size allocation
|
||||
|
||||
* CSS:
|
||||
- Optimize a case of reparenting that is important in GtkListView
|
||||
|
||||
* GSK:
|
||||
- Check for half-float support before using it
|
||||
|
||||
* Wayland:
|
||||
- Ignore empty preedit updates This fixes a problem with
|
||||
textview scrolling
|
||||
- Freeze popups when hidden. This addresses a frame rate drop
|
||||
|
||||
* Translation updates
|
||||
Hebrew
|
||||
Nepali
|
||||
|
||||
|
||||
Overview of Changes in 4.6.3, 21-04-2022
|
||||
========================================
|
||||
|
||||
* GtkOverlay:
|
||||
- Bring back positional style classes
|
||||
|
||||
* GtkFileChooser:
|
||||
- Prevent unwanted completion popups
|
||||
- Fix small problems in save mode
|
||||
- Fix buildable suport of GtkFileFilter
|
||||
|
||||
* GtkPopover:
|
||||
- Fix button positions in right-to-left locales
|
||||
|
||||
* GtkLabel:
|
||||
- Fix small issues with link handling
|
||||
|
||||
* Tooltips:
|
||||
- Don't restrict the minimum tooltip length
|
||||
|
||||
* Theme:
|
||||
- Don't use opacity for overlay scrollbars
|
||||
- Fix selection text color in vertical spin buttons
|
||||
|
||||
* GSK:
|
||||
- Accept textures that are generated by webkit
|
||||
- Align offscreen rendering to the pixel grid
|
||||
|
||||
* Accessibility
|
||||
- Fix a crash in startup when orca is running
|
||||
|
||||
* Input:
|
||||
- Fix display changes in GtkIMMultiContext
|
||||
- Fix activating on-screen keyboards
|
||||
- Always propagate hold events in GtkEventControllerScroll
|
||||
|
||||
* Windows:
|
||||
- Fix a critical warning in clipboard handling
|
||||
- Report serial numbers for events
|
||||
|
||||
* MacOS:
|
||||
- Prevent fullscreen transition reentrancy
|
||||
|
||||
|
||||
* Translation updates
|
||||
British English
|
||||
Czech
|
||||
German
|
||||
Indonesian
|
||||
Latvian
|
||||
|
||||
|
||||
Overview of Changes in 4.6.2, 18-03-2022
|
||||
========================================
|
||||
|
||||
* GtkScrolledWindow:
|
||||
- Set scroll-to-focus on viewports
|
||||
- Avoid doubly triggering deceleration
|
||||
|
||||
* GtkEntry:
|
||||
- Stop cursor blinking on focus-out
|
||||
|
||||
* Emoji:
|
||||
- Update Emoji data to CLDR 40 and Unicode 14
|
||||
- Add more locales for Emoji data (da, de, en, es,
|
||||
fr hu, it, ko, lt, ms, nl, pl, pt, ru, s, uk zh)
|
||||
|
||||
* GDK
|
||||
- Optimize texture conversions on x86 and ARM
|
||||
- Use EGK_KHR_swap_buffers_with_damage if available
|
||||
|
||||
* GSK
|
||||
- Avoid clearing opaque regions
|
||||
- Support using a non-default framebuffer
|
||||
- Handle large viewports by tiling
|
||||
|
||||
* Wayland:
|
||||
- Prefer xdg-activation over gtk-shell
|
||||
- text protocol: Fix text caret location
|
||||
- text protocol: Use serials to control outbound messages
|
||||
|
||||
* Inspector:
|
||||
- Show app ID and resource path
|
||||
|
||||
* Demos:
|
||||
- widget-factory: Handle F11 to toggle fullscreen
|
||||
|
||||
* Tools:
|
||||
- gtk-builder-tool: Allow use without display
|
||||
|
||||
* Windows:
|
||||
- Fix preedit window placement on HiDPI
|
||||
- Build improvements
|
||||
- Fix fullscreen handling
|
||||
|
||||
* MacOS:
|
||||
- Fix scrolling with an external mouse
|
||||
- Fix kinetic scrolling with overshoot
|
||||
- Improve monitor detection
|
||||
- Many input handling fixes
|
||||
- Support OpenGL accelerated video playback
|
||||
- Support fullscreen
|
||||
- Improve interactive window resizing and moving
|
||||
- Fix backdrop state handling
|
||||
- Fix GtkFileChooserNative filtering
|
||||
- Use CALayer and IOSurface for rendering
|
||||
- Use per monitor CVDisplayLink to support mixed-rate monitors
|
||||
- Start applications in foreground
|
||||
- Fix cursor blink time
|
||||
|
||||
* Translation updates
|
||||
Basque
|
||||
Brazilian Portuguese
|
||||
Catalan
|
||||
Chinese (China)
|
||||
Croatian
|
||||
Czech
|
||||
Danish
|
||||
Finnish
|
||||
Galician
|
||||
German
|
||||
Hebrew
|
||||
Hungarian
|
||||
Italian
|
||||
Kazakh
|
||||
Korean
|
||||
Lithuanian
|
||||
Norwegian Bokmål
|
||||
Persian
|
||||
Poliah
|
||||
Portuguese
|
||||
Russian
|
||||
Slovak
|
||||
Slovenian
|
||||
Spanish
|
||||
Swedish
|
||||
Turkish
|
||||
Ukrainian
|
||||
|
||||
|
||||
Overview of Changes in 4.6.1, 11-02-2022
|
||||
========================================
|
||||
|
||||
|
||||
@@ -223,7 +223,6 @@ static void
|
||||
destroy_gear (struct gear *g)
|
||||
{
|
||||
g_free (g->strips);
|
||||
g_free (g->vertices);
|
||||
g_free (g);
|
||||
}
|
||||
|
||||
|
||||
@@ -512,7 +512,7 @@ load_file (const char *demoname,
|
||||
|
||||
info_buffer = gtk_text_buffer_new (NULL);
|
||||
gtk_text_buffer_create_tag (info_buffer, "title",
|
||||
"font", "Sans 18",
|
||||
"size", 18 * 1024,
|
||||
"pixels-below-lines", 10,
|
||||
NULL);
|
||||
|
||||
|
||||
@@ -479,7 +479,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<child>
|
||||
<object class="GtkStackPage">
|
||||
<property name="name">page1</property>
|
||||
<property name="title" translatable="yes">Page _1</property>
|
||||
<property name="title" translatable="1">Page _1</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="child">
|
||||
<object class="GtkBox" id="page1">
|
||||
@@ -497,7 +497,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<property name="has-entry">1</property>
|
||||
<child internal-child="entry">
|
||||
<object class="GtkEntry" id="comboboxtext-entry">
|
||||
<property name="text" translatable="yes">comboboxentry</property>
|
||||
<property name="text" translatable="1">comboboxentry</property>
|
||||
</object>
|
||||
</child>
|
||||
<items>
|
||||
@@ -514,7 +514,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<child internal-child="entry">
|
||||
<object class="GtkEntry" id="comboboxtext-entry2">
|
||||
<property name="invisible-char">•</property>
|
||||
<property name="text" translatable="yes">comboboxentry</property>
|
||||
<property name="text" translatable="1">comboboxentry</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@@ -523,7 +523,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<object class="GtkEntry" id="entry1">
|
||||
<property name="enable-emoji-completion">1</property>
|
||||
<property name="invisible_char">•</property>
|
||||
<property name="placeholder-text" translatable="yes">Click icon to change mode</property>
|
||||
<property name="placeholder-text" translatable="1">Click icon to change mode</property>
|
||||
<property name="secondary-icon-name">view-refresh-symbolic</property>
|
||||
<property name="secondary-icon-tooltip-text">Change mode</property>
|
||||
<signal name="icon-release" handler="on_entry_icon_release" swapped="no"/>
|
||||
@@ -532,7 +532,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<child>
|
||||
<object class="GtkEntry" id="entry2">
|
||||
<property name="sensitive">0</property>
|
||||
<property name="text" translatable="yes">entry</property>
|
||||
<property name="text" translatable="1">entry</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -543,7 +543,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<child>
|
||||
<object class="GtkEntry" id="entry24">
|
||||
<property name="enable-emoji-completion">1</property>
|
||||
<property name="text" translatable="yes">entry</property>
|
||||
<property name="text" translatable="1">entry</property>
|
||||
<property name="hexpand">1</property>
|
||||
</object>
|
||||
</child>
|
||||
@@ -557,7 +557,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<child>
|
||||
<object class="GtkPasswordEntry">
|
||||
<property name="show-peek-icon">1</property>
|
||||
<property name="placeholder-text" translatable="yes">Password…</property>
|
||||
<property name="placeholder-text" translatable="1">Password…</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -612,13 +612,13 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<property name="spacing">20</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label3">
|
||||
<property name="label" translatable="yes">label</property>
|
||||
<property name="label" translatable="1">label</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label4">
|
||||
<property name="sensitive">0</property>
|
||||
<property name="label" translatable="yes">label</property>
|
||||
<property name="label" translatable="1">label</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -644,13 +644,13 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<property name="row-spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="checkbutton1">
|
||||
<property name="label" translatable="yes">checkbutton</property>
|
||||
<property name="label" translatable="1">checkbutton</property>
|
||||
<property name="active">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="checkbutton2">
|
||||
<property name="label" translatable="yes">checkbutton</property>
|
||||
<property name="label" translatable="1">checkbutton</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">1</property>
|
||||
@@ -659,7 +659,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="checkbutton3">
|
||||
<property name="label" translatable="yes">checkbutton</property>
|
||||
<property name="label" translatable="1">checkbutton</property>
|
||||
<property name="inconsistent">1</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
@@ -669,7 +669,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="checkbutton4">
|
||||
<property name="label" translatable="yes">checkbutton</property>
|
||||
<property name="label" translatable="1">checkbutton</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="active">1</property>
|
||||
<layout>
|
||||
@@ -680,7 +680,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="checkbutton5">
|
||||
<property name="label" translatable="yes">checkbutton</property>
|
||||
<property name="label" translatable="1">checkbutton</property>
|
||||
<property name="sensitive">0</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
@@ -690,7 +690,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="checkbutton6">
|
||||
<property name="label" translatable="yes">checkbutton</property>
|
||||
<property name="label" translatable="1">checkbutton</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="inconsistent">1</property>
|
||||
<layout>
|
||||
@@ -701,7 +701,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="radiobutton1">
|
||||
<property name="label" translatable="yes">radiobutton</property>
|
||||
<property name="label" translatable="1">radiobutton</property>
|
||||
<property name="active">1</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
@@ -711,7 +711,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton">
|
||||
<property name="label" translatable="yes">radiobutton</property>
|
||||
<property name="label" translatable="1">radiobutton</property>
|
||||
<property name="group">radiobutton1</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
@@ -721,7 +721,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="radiobutton3">
|
||||
<property name="label" translatable="yes">radiobutton</property>
|
||||
<property name="label" translatable="1">radiobutton</property>
|
||||
<property name="inconsistent">1</property>
|
||||
<property name="group">radiobutton1</property>
|
||||
<layout>
|
||||
@@ -732,7 +732,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="radiobutton4">
|
||||
<property name="label" translatable="yes">radiobutton</property>
|
||||
<property name="label" translatable="1">radiobutton</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="active">1</property>
|
||||
<layout>
|
||||
@@ -743,7 +743,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="radiobutton5">
|
||||
<property name="label" translatable="yes">radiobutton</property>
|
||||
<property name="label" translatable="1">radiobutton</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="group">radiobutton4</property>
|
||||
<layout>
|
||||
@@ -754,7 +754,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="radiobutton6">
|
||||
<property name="label" translatable="yes">radiobutton</property>
|
||||
<property name="label" translatable="1">radiobutton</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="inconsistent">1</property>
|
||||
<property name="group">radiobutton4</property>
|
||||
@@ -809,27 +809,27 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="togglebutton1">
|
||||
<property name="label" translatable="yes">togglebutton</property>
|
||||
<property name="label" translatable="1">togglebutton</property>
|
||||
<property name="receives-default">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="togglebutton2">
|
||||
<property name="label" translatable="yes">togglebutton</property>
|
||||
<property name="label" translatable="1">togglebutton</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="receives-default">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="togglebutton3">
|
||||
<property name="label" translatable="yes">togglebutton</property>
|
||||
<property name="label" translatable="1">togglebutton</property>
|
||||
<property name="receives-default">1</property>
|
||||
<property name="active">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="togglebutton4">
|
||||
<property name="label" translatable="yes">togglebutton</property>
|
||||
<property name="label" translatable="1">togglebutton</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="receives-default">1</property>
|
||||
<property name="active">1</property>
|
||||
@@ -874,7 +874,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLinkButton" id="linkbutton1">
|
||||
<property name="label" translatable="yes">link button</property>
|
||||
<property name="label" translatable="1">link button</property>
|
||||
<property name="receives-default">1</property>
|
||||
<property name="has-tooltip">1</property>
|
||||
<property name="has-frame">0</property>
|
||||
@@ -1061,7 +1061,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<object class="GtkFrame">
|
||||
<child type="label">
|
||||
<object class="GtkLabel" id="label1">
|
||||
<property name="label" translatable="yes"><b>Text Styles</b></property>
|
||||
<property name="label" translatable="1"><b>Text Styles</b></property>
|
||||
<property name="use-markup">1</property>
|
||||
</object>
|
||||
</child>
|
||||
@@ -1176,7 +1176,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn" id="treeviewcolumn3">
|
||||
<property name="title" translatable="yes">Cool</property>
|
||||
<property name="title" translatable="1">Cool</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererToggle" id="cellrenderertoggle1"/>
|
||||
<attributes>
|
||||
@@ -1188,7 +1188,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn" id="treeviewcolumn4">
|
||||
<property name="title" translatable="yes">Icon</property>
|
||||
<property name="title" translatable="1">Icon</property>
|
||||
<property name="reorderable">1</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererPixbuf" id="cellrendererpixbuf1"/>
|
||||
@@ -1200,7 +1200,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn" id="treeviewcolumn1">
|
||||
<property name="title" translatable="yes">Name</property>
|
||||
<property name="title" translatable="1">Name</property>
|
||||
<property name="resizable">1</property>
|
||||
<property name="reorderable">1</property>
|
||||
<property name="sort-indicator">1</property>
|
||||
@@ -1217,7 +1217,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn" id="treeviewcolumn2">
|
||||
<property name="title" translatable="yes">Nick</property>
|
||||
<property name="title" translatable="1">Nick</property>
|
||||
<property name="resizable">1</property>
|
||||
<property name="reorderable">1</property>
|
||||
<property name="sort-indicator">1</property>
|
||||
@@ -1281,7 +1281,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
</property>
|
||||
<property name="tab">
|
||||
<object class="GtkLabel" id="label5">
|
||||
<property name="label" translatable="yes">Sunset</property>
|
||||
<property name="label" translatable="1">Sunset</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
@@ -1307,7 +1307,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
</property>
|
||||
<property name="tab">
|
||||
<object class="GtkLabel" id="label6">
|
||||
<property name="label" translatable="yes">NYC</property>
|
||||
<property name="label" translatable="1">NYC</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
@@ -1333,7 +1333,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
</property>
|
||||
<property name="tab">
|
||||
<object class="GtkLabel" id="label7">
|
||||
<property name="label" translatable="yes">Beach</property>
|
||||
<property name="label" translatable="1">Beach</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
@@ -1352,7 +1352,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
</property>
|
||||
<property name="tab">
|
||||
<object class="GtkLabel" id="label8">
|
||||
<property name="label" translatable="yes">page 1</property>
|
||||
<property name="label" translatable="1">page 1</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
@@ -1367,7 +1367,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
</property>
|
||||
<property name="tab">
|
||||
<object class="GtkLabel" id="label9">
|
||||
<property name="label" translatable="yes">page 2</property>
|
||||
<property name="label" translatable="1">page 2</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
@@ -1382,7 +1382,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
</property>
|
||||
<property name="tab">
|
||||
<object class="GtkLabel" id="label10">
|
||||
<property name="label" translatable="yes">page 3</property>
|
||||
<property name="label" translatable="1">page 3</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
@@ -1401,7 +1401,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
</property>
|
||||
<property name="tab">
|
||||
<object class="GtkLabel" id="label11">
|
||||
<property name="label" translatable="yes">page 1</property>
|
||||
<property name="label" translatable="1">page 1</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
@@ -1416,7 +1416,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
</property>
|
||||
<property name="tab">
|
||||
<object class="GtkLabel" id="label12">
|
||||
<property name="label" translatable="yes">page 2</property>
|
||||
<property name="label" translatable="1">page 2</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
@@ -1431,7 +1431,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
</property>
|
||||
<property name="tab">
|
||||
<object class="GtkLabel" id="label13">
|
||||
<property name="label" translatable="yes">page 3</property>
|
||||
<property name="label" translatable="1">page 3</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
@@ -1450,7 +1450,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
</property>
|
||||
<property name="tab">
|
||||
<object class="GtkLabel" id="label14">
|
||||
<property name="label" translatable="yes">page 1</property>
|
||||
<property name="label" translatable="1">page 1</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
@@ -1465,7 +1465,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
</property>
|
||||
<property name="tab">
|
||||
<object class="GtkLabel" id="label15">
|
||||
<property name="label" translatable="yes">page 2</property>
|
||||
<property name="label" translatable="1">page 2</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
@@ -1480,7 +1480,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
</property>
|
||||
<property name="tab">
|
||||
<object class="GtkLabel" id="label16">
|
||||
<property name="label" translatable="yes">page 3</property>
|
||||
<property name="label" translatable="1">page 3</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
@@ -1496,7 +1496,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<child>
|
||||
<object class="GtkStackPage">
|
||||
<property name="name">page2</property>
|
||||
<property name="title" translatable="yes">Page _2</property>
|
||||
<property name="title" translatable="1">Page _2</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="child">
|
||||
<object class="GtkOverlay" id="page2">
|
||||
@@ -1527,7 +1527,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="page2reset">
|
||||
<property name="valign">3</property>
|
||||
<property name="label" translatable="yes">Reset</property>
|
||||
<property name="label" translatable="1">Reset</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -1700,7 +1700,7 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Row 1</property>
|
||||
<property name="label" translatable="1">Row 1</property>
|
||||
<property name="halign">1</property>
|
||||
<property name="valign">3</property>
|
||||
<property name="hexpand">1</property>
|
||||
@@ -1723,7 +1723,7 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Row 2</property>
|
||||
<property name="label" translatable="1">Row 2</property>
|
||||
<property name="halign">1</property>
|
||||
<property name="valign">3</property>
|
||||
<property name="hexpand">1</property>
|
||||
@@ -1747,7 +1747,7 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Row 3</property>
|
||||
<property name="label" translatable="1">Row 3</property>
|
||||
<property name="halign">1</property>
|
||||
<property name="valign">3</property>
|
||||
<property name="hexpand">1</property>
|
||||
@@ -1772,7 +1772,7 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Row 4</property>
|
||||
<property name="label" translatable="1">Row 4</property>
|
||||
<property name="halign">1</property>
|
||||
<property name="valign">3</property>
|
||||
<property name="hexpand">1</property>
|
||||
@@ -1797,7 +1797,7 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Row 5</property>
|
||||
<property name="label" translatable="1">Row 5</property>
|
||||
<property name="halign">1</property>
|
||||
<property name="valign">3</property>
|
||||
<property name="hexpand">1</property>
|
||||
@@ -1821,7 +1821,7 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Row 6</property>
|
||||
<property name="label" translatable="1">Row 6</property>
|
||||
<property name="halign">1</property>
|
||||
<property name="valign">3</property>
|
||||
<property name="hexpand">1</property>
|
||||
@@ -1843,7 +1843,7 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Row 7</property>
|
||||
<property name="label" translatable="1">Row 7</property>
|
||||
<property name="halign">1</property>
|
||||
<property name="valign">3</property>
|
||||
<property name="hexpand">1</property>
|
||||
@@ -1859,7 +1859,7 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Row 8</property>
|
||||
<property name="label" translatable="1">Row 8</property>
|
||||
<property name="halign">1</property>
|
||||
<property name="valign">3</property>
|
||||
<property name="hexpand">1</property>
|
||||
@@ -1896,16 +1896,16 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">New</property>
|
||||
<property name="label" translatable="1">New</property>
|
||||
<property name="icon-name">document-new</property>
|
||||
<property name="tooltip-text" translatable="yes">Create a new document</property>
|
||||
<property name="tooltip-text" translatable="1">Create a new document</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">Save</property>
|
||||
<property name="label" translatable="1">Save</property>
|
||||
<property name="icon-name">document-save</property>
|
||||
<property name="tooltip-text" translatable="yes">Save the current document</property>
|
||||
<property name="tooltip-text" translatable="1">Save the current document</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -1913,24 +1913,24 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">Search</property>
|
||||
<property name="label" translatable="1">Search</property>
|
||||
<property name="icon-name">edit-find</property>
|
||||
<property name="action-name">win.search</property>
|
||||
<property name="tooltip-text" translatable="yes">Search for it</property>
|
||||
<property name="tooltip-text" translatable="1">Search for it</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="sensitive">0</property>
|
||||
<property name="label" translatable="yes">Insert</property>
|
||||
<property name="label" translatable="1">Insert</property>
|
||||
<property name="icon-name">insert-image</property>
|
||||
<property name="tooltip-text" translatable="yes">Insert something</property>
|
||||
<property name="tooltip-text" translatable="1">Insert something</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkColorButton">
|
||||
<property name="rgba">#9141AC</property>
|
||||
<property name="tooltip-text" translatable="yes">Select a color</property>
|
||||
<property name="tooltip-text" translatable="1">Select a color</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@@ -2107,32 +2107,32 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
</child>
|
||||
<child type="label">
|
||||
<object class="GtkLabel" id="label19">
|
||||
<property name="label" translatable="yes">Expander</property>
|
||||
<property name="label" translatable="1">Expander</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="info_dialog_button">
|
||||
<property name="label" translatable="yes">_Inform</property>
|
||||
<property name="label" translatable="1">_Inform</property>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="action_dialog_button">
|
||||
<property name="label" translatable="yes">_Act</property>
|
||||
<property name="label" translatable="1">_Act</property>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="preference_dialog_button">
|
||||
<property name="label" translatable="yes">_Configure</property>
|
||||
<property name="label" translatable="1">_Configure</property>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="selection_dialog_button">
|
||||
<property name="label" translatable="yes">S_elect</property>
|
||||
<property name="label" translatable="1">S_elect</property>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
</child>
|
||||
@@ -2147,7 +2147,7 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<child>
|
||||
<object class="GtkStackPage">
|
||||
<property name="name">page3</property>
|
||||
<property name="title" translatable="yes">Page _3</property>
|
||||
<property name="title" translatable="1">Page _3</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="child">
|
||||
<object class="GtkBox">
|
||||
@@ -2179,7 +2179,7 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn">
|
||||
<property name="title" translatable="yes">Name</property>
|
||||
<property name="title" translatable="1">Name</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText"/>
|
||||
<attributes>
|
||||
@@ -2190,7 +2190,7 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn">
|
||||
<property name="title" translatable="yes">Birth</property>
|
||||
<property name="title" translatable="1">Birth</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText"/>
|
||||
<attributes>
|
||||
@@ -2201,7 +2201,7 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn">
|
||||
<property name="title" translatable="yes">Death</property>
|
||||
<property name="title" translatable="1">Death</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText"/>
|
||||
<attributes>
|
||||
@@ -2219,7 +2219,7 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<property name="selectable">1</property>
|
||||
<property name="halign">1</property>
|
||||
<property name="use-markup">1</property>
|
||||
<property name="label" translatable="yes"><small>Data source: <a href="http://en.wikipedia.org/wiki/Charlemagne#Ancestry">Wikipedia</a></small></property>
|
||||
<property name="label" translatable="1"><small>Data source: <a href="http://en.wikipedia.org/wiki/Charlemagne#Ancestry">Wikipedia</a></small></property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@@ -2553,28 +2553,28 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<object class="GtkButton" id="toolbutton1">
|
||||
<property name="icon-name">document-open-symbolic</property>
|
||||
<property name="focus-on-click">0</property>
|
||||
<property name="tooltip-text" translatable="yes">Insert ⌘</property>
|
||||
<property name="tooltip-text" translatable="1">Insert ⌘</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="toolbutton2">
|
||||
<property name="icon-name">send-to-symbolic</property>
|
||||
<property name="focus-on-click">0</property>
|
||||
<property name="tooltip-text" translatable="yes">Insert ⚽</property>
|
||||
<property name="tooltip-text" translatable="1">Insert ⚽</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="toolbutton3">
|
||||
<property name="icon-name">view-fullscreen-symbolic</property>
|
||||
<property name="focus-on-click">0</property>
|
||||
<property name="tooltip-text" translatable="yes">Insert ⤢</property>
|
||||
<property name="tooltip-text" translatable="1">Insert ⤢</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="toolbutton4">
|
||||
<property name="icon-name">star-new-symbolic</property>
|
||||
<property name="focus-on-click">0</property>
|
||||
<property name="tooltip-text" translatable="yes">Insert ☆</property>
|
||||
<property name="tooltip-text" translatable="1">Insert ☆</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@@ -2602,7 +2602,7 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="icon-name">edit-cut-symbolic</property>
|
||||
<property name="focus-on-click">0</property>
|
||||
<property name="tooltip-text" translatable="yes">Cut</property>
|
||||
<property name="tooltip-text" translatable="1">Cut</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -2610,7 +2610,7 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="icon-name">edit-copy-symbolic</property>
|
||||
<property name="focus-on-click">0</property>
|
||||
<property name="tooltip-text" translatable="yes">Copy</property>
|
||||
<property name="tooltip-text" translatable="1">Copy</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -2618,7 +2618,7 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="icon-name">edit-paste-symbolic</property>
|
||||
<property name="focus-on-click">0</property>
|
||||
<property name="tooltip-text" translatable="yes">Paste</property>
|
||||
<property name="tooltip-text" translatable="1">Paste</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@@ -2629,7 +2629,7 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<property name="valign">2</property>
|
||||
<property name="icon-name">edit-delete-symbolic</property>
|
||||
<property name="focus-on-click">0</property>
|
||||
<property name="tooltip-text" translatable="yes">Delete</property>
|
||||
<property name="tooltip-text" translatable="1">Delete</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@@ -2715,7 +2715,7 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Page 1</property>
|
||||
<property name="label" translatable="1">Page 1</property>
|
||||
<property name="halign">3</property>
|
||||
<property name="hexpand">1</property>
|
||||
</object>
|
||||
@@ -2747,7 +2747,7 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Page 2</property>
|
||||
<property name="label" translatable="1">Page 2</property>
|
||||
<property name="halign">3</property>
|
||||
<property name="hexpand">1</property>
|
||||
</object>
|
||||
@@ -2781,7 +2781,7 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
</property>
|
||||
<property name="tab">
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Page 3</property>
|
||||
<property name="label" translatable="1">Page 3</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
@@ -2810,7 +2810,7 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<child>
|
||||
<object class="GtkEntry">
|
||||
<property name="hexpand">1</property>
|
||||
<property name="placeholder-text" translatable="yes">Name…</property>
|
||||
<property name="placeholder-text" translatable="1">Name…</property>
|
||||
<property name="completion">name_completion</property>
|
||||
</object>
|
||||
</child>
|
||||
@@ -2818,7 +2818,7 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<object class="GtkEntry">
|
||||
<property name="hexpand">1</property>
|
||||
<property name="show-emoji-icon">1</property>
|
||||
<property name="placeholder-text" translatable="yes">Age…</property>
|
||||
<property name="placeholder-text" translatable="1">Age…</property>
|
||||
<signal name="notify::text" handler="age_entry_changed"/>
|
||||
</object>
|
||||
</child>
|
||||
@@ -2851,7 +2851,7 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
</property>
|
||||
<property name="tab">
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Page 1</property>
|
||||
<property name="label" translatable="1">Page 1</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
@@ -2866,7 +2866,7 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
</property>
|
||||
<property name="tab">
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Page 2</property>
|
||||
<property name="label" translatable="1">Page 2</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
@@ -2879,7 +2879,7 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
</property>
|
||||
<property name="tab">
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Page 3</property>
|
||||
<property name="label" translatable="1">Page 3</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
@@ -2892,7 +2892,7 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
</property>
|
||||
<property name="tab">
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Page 4</property>
|
||||
<property name="label" translatable="1">Page 4</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
@@ -2905,7 +2905,7 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
</property>
|
||||
<property name="tab">
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Page 5</property>
|
||||
<property name="label" translatable="1">Page 5</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
@@ -2932,19 +2932,19 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<property name="transient-for">window</property>
|
||||
<property name="resizable">0</property>
|
||||
<property name="modal">1</property>
|
||||
<property name="text" translatable="yes">Do something?</property>
|
||||
<property name="secondary-text" translatable="yes">If you don't do something,
|
||||
<property name="text" translatable="1">Do something?</property>
|
||||
<property name="secondary-text" translatable="1">If you don't do something,
|
||||
bad things might happen.</property>
|
||||
<property name="hide-on-close">1</property>
|
||||
<child type="action">
|
||||
<object class="GtkButton" id="cancel_info_dialog">
|
||||
<property name="label" translatable="yes">_Cancel</property>
|
||||
<property name="label" translatable="1">_Cancel</property>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child type="action">
|
||||
<object class="GtkButton" id="doit_info_dialog">
|
||||
<property name="label" translatable="yes">_Do It</property>
|
||||
<property name="label" translatable="1">_Do It</property>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
</child>
|
||||
@@ -2958,7 +2958,7 @@ bad things might happen.</property>
|
||||
<property name="resizable">0</property>
|
||||
<property name="modal">1</property>
|
||||
<property name="use-header-bar">1</property>
|
||||
<property name="title" translatable="yes">Zelda</property>
|
||||
<property name="title" translatable="1">Zelda</property>
|
||||
<property name="hide-on-close">1</property>
|
||||
<property name="default-widget">act_action_dialog</property>
|
||||
<child internal-child="content_area">
|
||||
@@ -2969,20 +2969,20 @@ bad things might happen.</property>
|
||||
<property name="margin-end">20</property>
|
||||
<property name="margin-top">20</property>
|
||||
<property name="margin-bottom">20</property>
|
||||
<property name="label" translatable="yes">To free the princess, you have to slay the dragon.</property>
|
||||
<property name="label" translatable="1">To free the princess, you have to slay the dragon.</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="action">
|
||||
<object class="GtkButton" id="cancel_action_dialog">
|
||||
<property name="label" translatable="yes">_Run</property>
|
||||
<property name="label" translatable="1">_Run</property>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child type="action">
|
||||
<object class="GtkButton" id="act_action_dialog">
|
||||
<property name="label" translatable="yes">_Act</property>
|
||||
<property name="label" translatable="1">_Act</property>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
</child>
|
||||
@@ -2996,7 +2996,7 @@ bad things might happen.</property>
|
||||
<property name="modal">1</property>
|
||||
<property name="resizable">0</property>
|
||||
<property name="use-header-bar">1</property>
|
||||
<property name="title" translatable="yes">Settings</property>
|
||||
<property name="title" translatable="1">Settings</property>
|
||||
<property name="hide-on-close">1</property>
|
||||
<child internal-child="content_area">
|
||||
<object class="GtkBox">
|
||||
@@ -3141,7 +3141,7 @@ bad things might happen.</property>
|
||||
<property name="transient-for">window</property>
|
||||
<property name="modal">1</property>
|
||||
<property name="use-header-bar">1</property>
|
||||
<property name="title" translatable="yes">Choose one</property>
|
||||
<property name="title" translatable="1">Choose one</property>
|
||||
<property name="hide-on-close">1</property>
|
||||
<property name="default-widget">select_selection_dialog</property>
|
||||
<child internal-child="content_area">
|
||||
@@ -3162,13 +3162,13 @@ bad things might happen.</property>
|
||||
</child>
|
||||
<child type="action">
|
||||
<object class="GtkButton" id="cancel_selection_dialog">
|
||||
<property name="label" translatable="yes">_Cancel</property>
|
||||
<property name="label" translatable="1">_Cancel</property>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child type="action">
|
||||
<object class="GtkButton" id="select_selection_dialog">
|
||||
<property name="label" translatable="yes">_Select</property>
|
||||
<property name="label" translatable="1">_Select</property>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
@@ -5,7 +5,7 @@ repository_url = "https://gitlab.gnome.org/GNOME/gtk.git"
|
||||
website_url = "https://www.gtk.org"
|
||||
authors = "GTK Development Team"
|
||||
logo_url = "gtk-logo.svg"
|
||||
license = "LGPL-2.1-or-later"
|
||||
license = "GPL-2.1-or-later"
|
||||
description = "The GTK toolkit"
|
||||
devhelp = true
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ repository_url = "https://gitlab.gnome.org/GNOME/gtk.git"
|
||||
website_url = "https://www.gtk.org"
|
||||
authors = "GTK Development Team"
|
||||
logo_url = "gtk-logo.svg"
|
||||
license = "LGPL-2.1-or-later"
|
||||
license = "GPL-2.1-or-later"
|
||||
description = "The GTK toolkit"
|
||||
dependencies = ["Gdk-4.0"]
|
||||
devhelp = true
|
||||
|
||||
@@ -16,6 +16,7 @@ SYNOPSIS
|
||||
| **gtk4-builder-tool** enumerate <FILE>
|
||||
| **gtk4-builder-tool** simplify [OPTIONS...] <FILE>
|
||||
| **gtk4-builder-tool** preview [OPTIONS...] <FILE>
|
||||
| **gtk4-builder-tool** screenshot [OPTIONS...] <FILE>
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
@@ -41,7 +42,7 @@ definition file.
|
||||
Preview
|
||||
^^^^^^^
|
||||
|
||||
The ``preview`` command displays the UI dfinition file.
|
||||
The ``preview`` command displays the UI definition file.
|
||||
|
||||
This command accepts options to specify the ID of the toplevel object and a CSS
|
||||
file to use.
|
||||
@@ -55,6 +56,33 @@ file to use.
|
||||
|
||||
Load style information from the given CSS file.
|
||||
|
||||
Screenshot
|
||||
^^^^^^^^^^
|
||||
|
||||
The ``screenshot`` command saves a rendering of the UI definition file
|
||||
as a png image or node file. The name of the file to write can be specified as
|
||||
a second FILE argument.
|
||||
|
||||
This command accepts options to specify the ID of the toplevel object and a CSS
|
||||
file to use.
|
||||
|
||||
``--id=ID``
|
||||
|
||||
The ID of the object to preview. If not specified, gtk4-builder-tool will
|
||||
choose a suitable object on its own.
|
||||
|
||||
``--css=FILE``
|
||||
|
||||
Load style information from the given CSS file.
|
||||
|
||||
``--node``
|
||||
|
||||
Write a serialized node file instead of a png image.
|
||||
|
||||
``--force``
|
||||
|
||||
Overwrite an existing file.
|
||||
|
||||
Simplification
|
||||
^^^^^^^^^^^^^^
|
||||
|
||||
|
||||
@@ -354,7 +354,6 @@ typedef struct {
|
||||
|
||||
typedef union {
|
||||
BroadwayReplyBase base;
|
||||
BroadwayReplySync sync;
|
||||
BroadwayReplyEvent event;
|
||||
BroadwayReplyQueryMouse query_mouse;
|
||||
BroadwayReplyNewSurface new_surface;
|
||||
|
||||
+18
-14
@@ -219,7 +219,11 @@ static void
|
||||
client_handle_request (BroadwayClient *client,
|
||||
BroadwayRequest *request)
|
||||
{
|
||||
BroadwayReply reply;
|
||||
BroadwayReplyNewSurface reply_new_surface;
|
||||
BroadwayReplySync reply_sync;
|
||||
BroadwayReplyQueryMouse reply_query_mouse;
|
||||
BroadwayReplyGrabPointer reply_grab_pointer;
|
||||
BroadwayReplyUngrabPointer reply_ungrab_pointer;
|
||||
guint32 before_serial, now_serial;
|
||||
guint32 global_id;
|
||||
int fd;
|
||||
@@ -229,7 +233,7 @@ client_handle_request (BroadwayClient *client,
|
||||
switch (request->base.type)
|
||||
{
|
||||
case BROADWAY_REQUEST_NEW_SURFACE:
|
||||
reply.new_surface.id =
|
||||
reply_new_surface.id =
|
||||
broadway_server_new_surface (server, client->id,
|
||||
request->new_surface.x,
|
||||
request->new_surface.y,
|
||||
@@ -237,9 +241,9 @@ client_handle_request (BroadwayClient *client,
|
||||
request->new_surface.height);
|
||||
client->surfaces =
|
||||
g_list_prepend (client->surfaces,
|
||||
GUINT_TO_POINTER (reply.new_surface.id));
|
||||
GUINT_TO_POINTER (reply_new_surface.id));
|
||||
|
||||
send_reply (client, request, &reply, sizeof (reply.new_surface),
|
||||
send_reply (client, request, (BroadwayReply *)&reply_new_surface, sizeof (reply_new_surface),
|
||||
BROADWAY_REPLY_NEW_SURFACE);
|
||||
break;
|
||||
case BROADWAY_REQUEST_FLUSH:
|
||||
@@ -247,7 +251,7 @@ client_handle_request (BroadwayClient *client,
|
||||
break;
|
||||
case BROADWAY_REQUEST_SYNC:
|
||||
broadway_server_flush (server);
|
||||
send_reply (client, request, &reply, sizeof (reply.sync),
|
||||
send_reply (client, request, (BroadwayReply *)&reply_sync, sizeof (reply_sync),
|
||||
BROADWAY_REPLY_SYNC);
|
||||
break;
|
||||
case BROADWAY_REQUEST_ROUNDTRIP:
|
||||
@@ -257,11 +261,11 @@ client_handle_request (BroadwayClient *client,
|
||||
break;
|
||||
case BROADWAY_REQUEST_QUERY_MOUSE:
|
||||
broadway_server_query_mouse (server,
|
||||
&reply.query_mouse.surface,
|
||||
&reply.query_mouse.root_x,
|
||||
&reply.query_mouse.root_y,
|
||||
&reply.query_mouse.mask);
|
||||
send_reply (client, request, &reply, sizeof (reply.query_mouse),
|
||||
&reply_query_mouse.surface,
|
||||
&reply_query_mouse.root_x,
|
||||
&reply_query_mouse.root_y,
|
||||
&reply_query_mouse.mask);
|
||||
send_reply (client, request, (BroadwayReply *)&reply_query_mouse, sizeof (reply_query_mouse),
|
||||
BROADWAY_REPLY_QUERY_MOUSE);
|
||||
break;
|
||||
case BROADWAY_REQUEST_DESTROY_SURFACE:
|
||||
@@ -357,21 +361,21 @@ client_handle_request (BroadwayClient *client,
|
||||
request->move_resize.height);
|
||||
break;
|
||||
case BROADWAY_REQUEST_GRAB_POINTER:
|
||||
reply.grab_pointer.status =
|
||||
reply_grab_pointer.status =
|
||||
broadway_server_grab_pointer (server,
|
||||
client->id,
|
||||
request->grab_pointer.id,
|
||||
request->grab_pointer.owner_events,
|
||||
request->grab_pointer.event_mask,
|
||||
request->grab_pointer.time_);
|
||||
send_reply (client, request, &reply, sizeof (reply.grab_pointer),
|
||||
send_reply (client, request, (BroadwayReply *)&reply_grab_pointer, sizeof (reply_grab_pointer),
|
||||
BROADWAY_REPLY_GRAB_POINTER);
|
||||
break;
|
||||
case BROADWAY_REQUEST_UNGRAB_POINTER:
|
||||
reply.ungrab_pointer.status =
|
||||
reply_ungrab_pointer.status =
|
||||
broadway_server_ungrab_pointer (server,
|
||||
request->ungrab_pointer.time_);
|
||||
send_reply (client, request, &reply, sizeof (reply.ungrab_pointer),
|
||||
send_reply (client, request, (BroadwayReply *)&reply_ungrab_pointer, sizeof (reply_ungrab_pointer),
|
||||
BROADWAY_REPLY_UNGRAB_POINTER);
|
||||
break;
|
||||
case BROADWAY_REQUEST_FOCUS_SURFACE:
|
||||
|
||||
+15
-53
@@ -97,7 +97,7 @@ add_files (GDBusProxy *proxy,
|
||||
AddFileData *afd)
|
||||
{
|
||||
GUnixFDList *fd_list;
|
||||
GVariantBuilder fds, options;
|
||||
GVariantBuilder fds;
|
||||
int i;
|
||||
char *key;
|
||||
|
||||
@@ -146,10 +146,9 @@ add_files (GDBusProxy *proxy,
|
||||
|
||||
key = (char *)g_object_get_data (G_OBJECT (afd->task), "key");
|
||||
|
||||
g_variant_builder_init (&options, G_VARIANT_TYPE_VARDICT);
|
||||
g_dbus_proxy_call_with_unix_fd_list (proxy,
|
||||
"AddFiles",
|
||||
g_variant_new ("(saha{sv})", key, &fds, &options),
|
||||
g_variant_new ("(sah)", key, &fds),
|
||||
0, -1,
|
||||
fd_list,
|
||||
NULL,
|
||||
@@ -481,36 +480,20 @@ connection_closed (GDBusConnection *connection,
|
||||
}
|
||||
|
||||
static void
|
||||
finish_registration (void)
|
||||
got_proxy (GObject *source,
|
||||
GAsyncResult *result,
|
||||
gpointer data)
|
||||
{
|
||||
gdk_content_register_serializer (G_TYPE_FILE,
|
||||
"application/vnd.portal.filetransfer",
|
||||
portal_file_serializer,
|
||||
NULL,
|
||||
NULL);
|
||||
GError *error = NULL;
|
||||
|
||||
gdk_content_register_serializer (GDK_TYPE_FILE_LIST,
|
||||
"application/vnd.portal.filetransfer",
|
||||
portal_file_serializer,
|
||||
NULL,
|
||||
NULL);
|
||||
file_transfer_proxy = g_dbus_proxy_new_for_bus_finish (result, &error);
|
||||
if (!file_transfer_proxy)
|
||||
{
|
||||
g_message ("Failed to get file transfer portal: %s", error->message);
|
||||
g_clear_error (&error);
|
||||
return;
|
||||
}
|
||||
|
||||
gdk_content_register_deserializer ("application/vnd.portal.filetransfer",
|
||||
GDK_TYPE_FILE_LIST,
|
||||
portal_file_deserializer,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
gdk_content_register_deserializer ("application/vnd.portal.filetransfer",
|
||||
G_TYPE_FILE,
|
||||
portal_file_deserializer,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
/* FIXME: I missed up and used the wrong mime type here when
|
||||
* I implemented my own protocol. Keep these around for a while
|
||||
* so we can interoperate with existing flatpaks using GTK 4.6
|
||||
*/
|
||||
gdk_content_register_serializer (G_TYPE_FILE,
|
||||
"application/vnd.portal.files",
|
||||
portal_file_serializer,
|
||||
@@ -540,21 +523,6 @@ finish_registration (void)
|
||||
"closed", G_CALLBACK (connection_closed), NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
proxy_has_owner (GDBusProxy *proxy)
|
||||
{
|
||||
char *owner;
|
||||
|
||||
owner = g_dbus_proxy_get_name_owner (proxy);
|
||||
if (owner)
|
||||
{
|
||||
g_free (owner);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
file_transfer_portal_register (void)
|
||||
{
|
||||
@@ -563,8 +531,7 @@ file_transfer_portal_register (void)
|
||||
if (!called)
|
||||
{
|
||||
called = TRUE;
|
||||
|
||||
file_transfer_proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
|
||||
g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION,
|
||||
G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES
|
||||
| G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS
|
||||
| G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START,
|
||||
@@ -573,13 +540,8 @@ file_transfer_portal_register (void)
|
||||
"/org/freedesktop/portal/documents",
|
||||
"org.freedesktop.portal.FileTransfer",
|
||||
NULL,
|
||||
got_proxy,
|
||||
NULL);
|
||||
|
||||
if (file_transfer_proxy && !proxy_has_owner (file_transfer_proxy))
|
||||
g_clear_object (&file_transfer_proxy);
|
||||
|
||||
if (file_transfer_proxy)
|
||||
finish_registration ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -407,6 +407,8 @@ gdk_content_register_deserializer (const char *mime_type,
|
||||
g_return_if_fail (mime_type != NULL);
|
||||
g_return_if_fail (deserialize != NULL);
|
||||
|
||||
init ();
|
||||
|
||||
deserializer = g_slice_new0 (Deserializer);
|
||||
|
||||
deserializer->mime_type = g_intern_string (mime_type);
|
||||
|
||||
@@ -413,6 +413,8 @@ gdk_content_register_serializer (GType type,
|
||||
g_return_if_fail (mime_type != NULL);
|
||||
g_return_if_fail (serialize != NULL);
|
||||
|
||||
init ();
|
||||
|
||||
serializer = g_slice_new0 (Serializer);
|
||||
|
||||
serializer->mime_type = g_intern_string (mime_type);
|
||||
|
||||
+3
-3
@@ -1628,10 +1628,10 @@ gdk_display_check_egl_extensions (EGLDisplay egl_display,
|
||||
/* translators: Arguments are the number of missing extensions
|
||||
* followed by a comma-separated list of their names */
|
||||
g_dngettext (GETTEXT_PACKAGE,
|
||||
"EGL implementation is missing extension %s",
|
||||
"EGL implementation is missing %2$d extensions: %1$s",
|
||||
"EGL implementation is missing extension %2$s",
|
||||
"EGL implementation is missing %d extensions: %s",
|
||||
n_missing),
|
||||
missing->str, (int) n_missing);
|
||||
(int) n_missing, missing->str);
|
||||
|
||||
g_string_free (missing, TRUE);
|
||||
return FALSE;
|
||||
|
||||
+56
-24
@@ -597,7 +597,8 @@ _gdk_event_unqueue (GdkDisplay *display)
|
||||
|
||||
/*
|
||||
* If the last N events in the event queue are smooth scroll events
|
||||
* for the same surface and device, combine them into one.
|
||||
* for the same surface, the same device and the same scroll unit,
|
||||
* combine them into one.
|
||||
*
|
||||
* We give the remaining event a history with N items, and deltas
|
||||
* that are the sum over the history entries.
|
||||
@@ -611,6 +612,8 @@ gdk_event_queue_handle_scroll_compression (GdkDisplay *display)
|
||||
GdkEvent *last_event = NULL;
|
||||
GList *scrolls = NULL;
|
||||
GArray *history = NULL;
|
||||
GdkScrollUnit scroll_unit = GDK_SCROLL_UNIT_WHEEL;
|
||||
gboolean scroll_unit_defined = FALSE;
|
||||
GdkTimeCoord hist;
|
||||
|
||||
l = g_queue_peek_tail_link (&display->queued_events);
|
||||
@@ -618,6 +621,7 @@ gdk_event_queue_handle_scroll_compression (GdkDisplay *display)
|
||||
while (l)
|
||||
{
|
||||
GdkEvent *event = l->data;
|
||||
GdkScrollEvent *scroll_event = (GdkScrollEvent *) event;
|
||||
|
||||
if (event->flags & GDK_EVENT_PENDING)
|
||||
break;
|
||||
@@ -634,11 +638,17 @@ gdk_event_queue_handle_scroll_compression (GdkDisplay *display)
|
||||
device != event->device)
|
||||
break;
|
||||
|
||||
if (scroll_unit_defined &&
|
||||
scroll_unit != scroll_event->unit)
|
||||
break;
|
||||
|
||||
if (!last_event)
|
||||
last_event = event;
|
||||
|
||||
surface = event->surface;
|
||||
device = event->device;
|
||||
scroll_unit = scroll_event->unit;
|
||||
scroll_unit_defined = TRUE;
|
||||
scrolls = l;
|
||||
|
||||
l = l->prev;
|
||||
@@ -710,7 +720,8 @@ gdk_event_queue_handle_scroll_compression (GdkDisplay *display)
|
||||
gdk_event_get_modifier_state (old_event),
|
||||
dx,
|
||||
dy,
|
||||
gdk_scroll_event_is_stop (old_event));
|
||||
gdk_scroll_event_is_stop (old_event),
|
||||
scroll_unit);
|
||||
|
||||
((GdkScrollEvent *)event)->history = history;
|
||||
|
||||
@@ -746,15 +757,21 @@ gdk_motion_event_push_history (GdkEvent *event,
|
||||
|
||||
memset (&hist, 0, sizeof (GdkTimeCoord));
|
||||
hist.time = gdk_event_get_time (history_event);
|
||||
|
||||
if (tool)
|
||||
{
|
||||
hist.flags = gdk_device_tool_get_axes (tool);
|
||||
for (i = GDK_AXIS_X; i < GDK_AXIS_LAST; i++)
|
||||
gdk_event_get_axis (history_event, i, &hist.axes[i]);
|
||||
}
|
||||
else
|
||||
|
||||
/* GdkTimeCoord has no dedicated fields to record event position. For plain
|
||||
* pointer events, and for tools which don't report GDK_AXIS_X/GDK_AXIS_Y
|
||||
* on their own, we surface the position using the X and Y input axes.
|
||||
*/
|
||||
if (!(hist.flags & GDK_AXIS_FLAG_X) || !(hist.flags & GDK_AXIS_FLAG_Y))
|
||||
{
|
||||
hist.flags = GDK_AXIS_FLAG_X | GDK_AXIS_FLAG_Y;
|
||||
hist.flags |= GDK_AXIS_FLAG_X | GDK_AXIS_FLAG_Y;
|
||||
gdk_event_get_position (history_event, &hist.axes[GDK_AXIS_X], &hist.axes[GDK_AXIS_Y]);
|
||||
}
|
||||
|
||||
@@ -1764,7 +1781,7 @@ gdk_key_event_matches (GdkEvent *event,
|
||||
guint ev_keyval;
|
||||
int layout;
|
||||
int level;
|
||||
GdkModifierType ignored_modifiers;
|
||||
GdkModifierType consumed_modifiers;
|
||||
GdkModifierType shift_group_mask;
|
||||
gboolean group_mod_is_accel_mod = FALSE;
|
||||
const GdkModifierType mask = GDK_CONTROL_MASK |
|
||||
@@ -1783,23 +1800,7 @@ gdk_key_event_matches (GdkEvent *event,
|
||||
ev_keyval = self->translated[1].keyval;
|
||||
layout = self->translated[1].layout;
|
||||
level = self->translated[1].level;
|
||||
|
||||
/*
|
||||
* If a modifier is currently active (e.g. Shift is pressed) and was marked
|
||||
* as consumed, we ignore it for the purposes of matching shortcuts.
|
||||
* For example, when Ctrl+Shift+[plus/equals key] is translated into
|
||||
* Ctrl+plus on a keyboard where Shift+equals is the plus sign, we want
|
||||
* shortcuts for either <Control><Shift>plus or <Control>plus to match.
|
||||
* (See https://bugzilla.gnome.org/show_bug.cgi?id=100439)
|
||||
*
|
||||
* If a modifier is *not* currently active, the X11 backend can sometimes
|
||||
* mark it as consumed where the Wayland and Windows backends do not.
|
||||
* In this case, we still want to pay attention to its state.
|
||||
* For example, when Ctrl+x is translated into Ctrl+x, we only want to
|
||||
* trigger shortcuts for <Control>x, not for <Control><Shift>x.
|
||||
* (See https://gitlab.gnome.org/GNOME/gtk/-/issues/5095)
|
||||
*/
|
||||
ignored_modifiers = (self->translated[1].consumed & state);
|
||||
consumed_modifiers = self->translated[1].consumed;
|
||||
|
||||
/* if the group-toggling modifier is part of the default accel mod
|
||||
* mask, and it is active, disable it for matching
|
||||
@@ -1811,7 +1812,7 @@ gdk_key_event_matches (GdkEvent *event,
|
||||
if (mask & shift_group_mask)
|
||||
group_mod_is_accel_mod = TRUE;
|
||||
|
||||
if ((modifiers & ~ignored_modifiers & mask) == (state & ~ignored_modifiers & mask))
|
||||
if ((modifiers & ~consumed_modifiers & mask) == (state & ~consumed_modifiers & mask))
|
||||
{
|
||||
/* modifier match */
|
||||
GdkKeymapKey *keys;
|
||||
@@ -2350,7 +2351,8 @@ gdk_scroll_event_new (GdkSurface *surface,
|
||||
GdkModifierType state,
|
||||
double delta_x,
|
||||
double delta_y,
|
||||
gboolean is_stop)
|
||||
gboolean is_stop,
|
||||
GdkScrollUnit unit)
|
||||
{
|
||||
GdkScrollEvent *self = gdk_event_alloc (GDK_SCROLL, surface, device, time);
|
||||
|
||||
@@ -2360,6 +2362,7 @@ gdk_scroll_event_new (GdkSurface *surface,
|
||||
self->delta_x = delta_x;
|
||||
self->delta_y = delta_y;
|
||||
self->is_stop = is_stop;
|
||||
self->unit = unit;
|
||||
|
||||
return (GdkEvent *) self;
|
||||
}
|
||||
@@ -2379,6 +2382,7 @@ gdk_scroll_event_new_discrete (GdkSurface *surface,
|
||||
self->state = state;
|
||||
self->direction = direction;
|
||||
self->pointer_emulated = emulated;
|
||||
self->unit = GDK_SCROLL_UNIT_WHEEL;
|
||||
|
||||
return (GdkEvent *) self;
|
||||
}
|
||||
@@ -2412,6 +2416,9 @@ gdk_scroll_event_get_direction (GdkEvent *event)
|
||||
*
|
||||
* The deltas will be zero unless the scroll direction
|
||||
* is %GDK_SCROLL_SMOOTH.
|
||||
*
|
||||
* For the representation unit of these deltas, see
|
||||
* [method@Gdk.ScrollEvent.get_unit].
|
||||
*/
|
||||
void
|
||||
gdk_scroll_event_get_deltas (GdkEvent *event,
|
||||
@@ -2454,6 +2461,31 @@ gdk_scroll_event_is_stop (GdkEvent *event)
|
||||
return self->is_stop;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_scroll_event_get_unit:
|
||||
* @event: (type GdkScrollEvent): a scroll event.
|
||||
*
|
||||
* Extracts the scroll delta unit of a scroll event.
|
||||
*
|
||||
* The unit will always be %GDK_SCROLL_UNIT_WHEEL if the scroll direction is not
|
||||
* %GDK_SCROLL_SMOOTH.
|
||||
*
|
||||
* Returns: the scroll unit.
|
||||
*
|
||||
* Since: 4.8
|
||||
*/
|
||||
GdkScrollUnit
|
||||
gdk_scroll_event_get_unit (GdkEvent *event)
|
||||
{
|
||||
GdkScrollEvent *self = (GdkScrollEvent *) event;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_EVENT (event), GDK_SCROLL_UNIT_WHEEL);
|
||||
g_return_val_if_fail (GDK_IS_EVENT_TYPE (event, GDK_SCROLL),
|
||||
GDK_SCROLL_UNIT_WHEEL);
|
||||
|
||||
return self->unit;
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* {{{ GdkTouchpadEvent */
|
||||
|
||||
@@ -265,6 +265,37 @@ typedef enum
|
||||
GDK_SCROLL_SMOOTH
|
||||
} GdkScrollDirection;
|
||||
|
||||
/**
|
||||
* GdkScrollUnit:
|
||||
* @GDK_SCROLL_UNIT_WHEEL: The delta is in number of wheel clicks.
|
||||
* @GDK_SCROLL_UNIT_SURFACE: The delta is in surface pixels to scroll directly
|
||||
* on screen.
|
||||
*
|
||||
* Specifies the unit of scroll deltas.
|
||||
*
|
||||
* When you get %GDK_SCROLL_UNIT_WHEEL, a delta of 1.0 means 1 wheel detent
|
||||
* click in the south direction, 2.0 means 2 wheel detent clicks in the south
|
||||
* direction... This is the same logic for negative values but in the north
|
||||
* direction.
|
||||
*
|
||||
* If you get %GDK_SCROLL_UNIT_SURFACE, are managing a scrollable view and get a
|
||||
* value of 123, you have to scroll 123 surface logical pixels right if it's
|
||||
* @delta_x or down if it's @delta_y. This is the same logic for negative values
|
||||
* but you have to scroll left instead of right if it's @delta_x and up instead
|
||||
* of down if it's @delta_y.
|
||||
*
|
||||
* 1 surface logical pixel is equal to 1 real screen pixel multiplied by the
|
||||
* final scale factor of your graphical interface (the product of the desktop
|
||||
* scale factor and eventually a custom scale factor in your app).
|
||||
*
|
||||
* Since: 4.8
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GDK_SCROLL_UNIT_WHEEL,
|
||||
GDK_SCROLL_UNIT_SURFACE
|
||||
} GdkScrollUnit;
|
||||
|
||||
/**
|
||||
* GdkNotifyType:
|
||||
* @GDK_NOTIFY_ANCESTOR: the surface is entered from an ancestor or
|
||||
@@ -395,6 +426,8 @@ GDK_AVAILABLE_IN_ALL
|
||||
void gdk_scroll_event_get_deltas (GdkEvent *event,
|
||||
double *delta_x,
|
||||
double *delta_y);
|
||||
GDK_AVAILABLE_IN_4_8
|
||||
GdkScrollUnit gdk_scroll_event_get_unit (GdkEvent *event);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_scroll_event_is_stop (GdkEvent *event);
|
||||
|
||||
@@ -212,6 +212,7 @@ struct _GdkTouchEvent
|
||||
* @history: (element-type GdkTimeCoord): array of times and deltas
|
||||
* for other scroll events that were compressed before delivering the
|
||||
* current event
|
||||
* @unit: The scroll unit in which delta_x and delta_y are represented.
|
||||
*
|
||||
* Generated from button presses for the buttons 4 to 7. Wheel mice are
|
||||
* usually configured to generate button press events for buttons 4 and 5
|
||||
@@ -234,6 +235,7 @@ struct _GdkScrollEvent
|
||||
gboolean is_stop;
|
||||
GdkDeviceTool *tool;
|
||||
GArray *history; /* <GdkTimeCoord> */
|
||||
GdkScrollUnit unit;
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -486,7 +488,8 @@ GdkEvent * gdk_scroll_event_new (GdkSurface *surface,
|
||||
GdkModifierType state,
|
||||
double delta_x,
|
||||
double delta_y,
|
||||
gboolean is_stop);
|
||||
gboolean is_stop,
|
||||
GdkScrollUnit unit);
|
||||
|
||||
GdkEvent * gdk_scroll_event_new_discrete (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
|
||||
@@ -373,9 +373,6 @@ gdk_frame_clock_flush_idle (void *data)
|
||||
else
|
||||
priv->phase = GDK_FRAME_CLOCK_PHASE_NONE;
|
||||
|
||||
g_clear_handle_id (&priv->paint_idle_id, g_source_remove);
|
||||
gdk_frame_clock_paint_idle (data);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
+4
-18
@@ -1,7 +1,7 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
*
|
||||
* gdkglcontext.c: GL context abstraction
|
||||
*
|
||||
*
|
||||
* Copyright © 2014 Emmanuele Bassi
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
@@ -103,7 +103,6 @@ typedef struct {
|
||||
|
||||
guint has_khr_debug : 1;
|
||||
guint use_khr_debug : 1;
|
||||
guint has_half_float : 1;
|
||||
guint has_unpack_subimage : 1;
|
||||
guint has_debug_output : 1;
|
||||
guint extensions_checked : 1;
|
||||
@@ -1543,23 +1542,18 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
|
||||
glGetIntegerv (GL_MAX_LABEL_LENGTH, &priv->max_debug_label_length);
|
||||
}
|
||||
|
||||
priv->has_half_float = gdk_gl_context_check_version (context, 3, 0, 3, 0) ||
|
||||
epoxy_has_gl_extension ("OES_vertex_half_float");
|
||||
|
||||
GDK_DISPLAY_NOTE (gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context)), OPENGL,
|
||||
g_message ("%s version: %d.%d (%s)\n"
|
||||
"* GLSL version: %s\n"
|
||||
"* Extensions checked:\n"
|
||||
" - GL_KHR_debug: %s\n"
|
||||
" - GL_EXT_unpack_subimage: %s\n"
|
||||
" - OES_vertex_half_float: %s",
|
||||
" - GL_EXT_unpack_subimage: %s",
|
||||
gdk_gl_context_get_use_es (context) ? "OpenGL ES" : "OpenGL",
|
||||
priv->gl_version / 10, priv->gl_version % 10,
|
||||
priv->is_legacy ? "legacy" : "core",
|
||||
glGetString (GL_SHADING_LANGUAGE_VERSION),
|
||||
priv->has_khr_debug ? "yes" : "no",
|
||||
priv->has_unpack_subimage ? "yes" : "no",
|
||||
priv->has_half_float ? "yes" : "no"));
|
||||
priv->has_unpack_subimage ? "yes" : "no"));
|
||||
|
||||
priv->extensions_checked = TRUE;
|
||||
}
|
||||
@@ -1763,14 +1757,6 @@ gdk_gl_context_has_debug (GdkGLContext *self)
|
||||
return priv->debug_enabled || priv->use_khr_debug;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_gl_context_has_vertex_half_float (GdkGLContext *self)
|
||||
{
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (self);
|
||||
|
||||
return priv->has_half_float;
|
||||
}
|
||||
|
||||
/* This is currently private! */
|
||||
/* When using GL/ES, don't flip the 'R' and 'B' bits on Windows/ANGLE for glReadPixels() */
|
||||
gboolean
|
||||
@@ -1813,7 +1799,7 @@ gboolean
|
||||
gdk_gl_backend_can_be_used (GdkGLBackend backend_type,
|
||||
GError **error)
|
||||
{
|
||||
if (the_gl_backend_type == GDK_GL_NONE ||
|
||||
if (the_gl_backend_type == GDK_GL_NONE ||
|
||||
the_gl_backend_type == backend_type)
|
||||
return TRUE;
|
||||
|
||||
|
||||
@@ -139,8 +139,6 @@ gboolean gdk_gl_context_has_debug (GdkGLContext
|
||||
|
||||
gboolean gdk_gl_context_use_es_bgra (GdkGLContext *context);
|
||||
|
||||
gboolean gdk_gl_context_has_vertex_half_float (GdkGLContext *self) G_GNUC_PURE;
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_GL_CONTEXT_PRIVATE_H__ */
|
||||
|
||||
+2
-12
@@ -32,9 +32,6 @@ G_DEFINE_POINTER_TYPE (GdkToplevelSize, gdk_toplevel_size)
|
||||
#define UNCONFIGURED_WIDTH 400
|
||||
#define UNCONFIGURED_HEIGHT 300
|
||||
|
||||
#define DEFAULT_BOUNDS_WIDTH INT_MAX
|
||||
#define DEFAULT_BOUNDS_HEIGHT INT_MAX
|
||||
|
||||
void
|
||||
gdk_toplevel_size_init (GdkToplevelSize *size,
|
||||
int bounds_width,
|
||||
@@ -71,15 +68,8 @@ gdk_toplevel_size_get_bounds (GdkToplevelSize *size,
|
||||
g_return_if_fail (bounds_width);
|
||||
g_return_if_fail (bounds_height);
|
||||
|
||||
if (size->bounds_width > 0)
|
||||
*bounds_width = size->bounds_width;
|
||||
else
|
||||
*bounds_width = DEFAULT_BOUNDS_WIDTH;
|
||||
|
||||
if (size->bounds_height > 0)
|
||||
*bounds_height = size->bounds_height;
|
||||
else
|
||||
*bounds_height = DEFAULT_BOUNDS_HEIGHT;
|
||||
*bounds_width = size->bounds_width;
|
||||
*bounds_height = size->bounds_height;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -108,6 +108,16 @@
|
||||
*/
|
||||
#define GDK_VERSION_4_6 (G_ENCODE_VERSION (4, 6))
|
||||
|
||||
/**
|
||||
* GDK_VERSION_4_8:
|
||||
*
|
||||
* A macro that evaluates to the 4.8 version of GDK, in a format
|
||||
* that can be used by the C pre-processor.
|
||||
*
|
||||
* Since: 4.8
|
||||
*/
|
||||
#define GDK_VERSION_4_8 (G_ENCODE_VERSION (4, 8))
|
||||
|
||||
|
||||
/* evaluates to the current stable version; for development cycles,
|
||||
* this means the next stable target, with a hard backstop to the
|
||||
@@ -249,4 +259,18 @@
|
||||
# define GDK_DEPRECATED_IN_4_6_FOR(f) _GDK_EXTERN
|
||||
#endif
|
||||
|
||||
#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_4_8
|
||||
# define GDK_AVAILABLE_IN_4_8 GDK_UNAVAILABLE(4, 8)
|
||||
#else
|
||||
# define GDK_AVAILABLE_IN_4_8 _GDK_EXTERN
|
||||
#endif
|
||||
|
||||
#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_4_8
|
||||
# define GDK_DEPRECATED_IN_4_8 GDK_DEPRECATED
|
||||
# define GDK_DEPRECATED_IN_4_8_FOR(f) GDK_DEPRECATED_FOR(f)
|
||||
#else
|
||||
# define GDK_DEPRECATED_IN_4_8 _GDK_EXTERN
|
||||
# define GDK_DEPRECATED_IN_4_8_FOR(f) _GDK_EXTERN
|
||||
#endif
|
||||
|
||||
#endif /* __GDK_VERSION_MACROS_H__ */
|
||||
|
||||
@@ -644,7 +644,8 @@ fill_scroll_event (GdkMacosDisplay *self,
|
||||
NULL,
|
||||
get_time_from_ns_event (nsevent),
|
||||
state,
|
||||
0.0, 0.0, TRUE);
|
||||
0.0, 0.0, TRUE,
|
||||
GDK_SCROLL_UNIT_SURFACE);
|
||||
|
||||
dx = [nsevent deltaX];
|
||||
dy = [nsevent deltaY];
|
||||
@@ -665,7 +666,8 @@ fill_scroll_event (GdkMacosDisplay *self,
|
||||
state,
|
||||
-sx,
|
||||
-sy,
|
||||
FALSE);
|
||||
FALSE,
|
||||
GDK_SCROLL_UNIT_SURFACE);
|
||||
|
||||
/* Fall through for scroll emulation */
|
||||
}
|
||||
@@ -714,7 +716,8 @@ fill_scroll_event (GdkMacosDisplay *self,
|
||||
NULL,
|
||||
get_time_from_ns_event (nsevent),
|
||||
state,
|
||||
0.0, 0.0, TRUE);
|
||||
0.0, 0.0, TRUE,
|
||||
GDK_SCROLL_UNIT_SURFACE);
|
||||
}
|
||||
|
||||
return g_steal_pointer (&ret);
|
||||
|
||||
@@ -596,6 +596,11 @@ gdk_macos_surface_class_init (GdkMacosSurfaceClass *klass)
|
||||
surface_class->set_input_region = gdk_macos_surface_set_input_region;
|
||||
surface_class->set_opaque_region = gdk_macos_surface_set_opaque_region;
|
||||
|
||||
/**
|
||||
* GdkMacosSurface:native: (attributes org.gtk.Property.get=gdk_macos_surface_get_native_window)
|
||||
*
|
||||
* The "native" property contains the underlying NSWindow.
|
||||
*/
|
||||
properties [PROP_NATIVE] =
|
||||
g_param_spec_pointer ("native",
|
||||
"Native",
|
||||
@@ -758,6 +763,27 @@ _gdk_macos_surface_get_native (GdkMacosSurface *self)
|
||||
return (NSWindow *)self->window;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_macos_surface_get_native_window: (attributes org.gtk.Method.get_property=native)
|
||||
* @self: a #GdkMacosSurface
|
||||
*
|
||||
* Gets the underlying NSWindow used by the surface.
|
||||
*
|
||||
* The NSWindow's contentView is an implementation detail and may change
|
||||
* between releases of GTK.
|
||||
*
|
||||
* Returns: (nullable): a #NSWindow or %NULL
|
||||
*
|
||||
* Since: 4.8
|
||||
*/
|
||||
gpointer
|
||||
gdk_macos_surface_get_native_window (GdkMacosSurface *self)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_MACOS_SURFACE (self), NULL);
|
||||
|
||||
return _gdk_macos_surface_get_native (self);
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_macos_surface_set_geometry_hints (GdkMacosSurface *self,
|
||||
const GdkGeometry *geometry,
|
||||
|
||||
@@ -36,7 +36,9 @@ typedef struct _GdkMacosSurfaceClass GdkMacosSurfaceClass;
|
||||
#define GDK_IS_MACOS_SURFACE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_MACOS_SURFACE))
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gdk_macos_surface_get_type (void);
|
||||
GType gdk_macos_surface_get_type (void);
|
||||
GDK_AVAILABLE_IN_4_8
|
||||
gpointer gdk_macos_surface_get_native_window (GdkMacosSurface *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -200,51 +200,23 @@ wl_cursor_destroy(struct wl_cursor *cursor)
|
||||
}
|
||||
|
||||
static struct wl_cursor *
|
||||
wl_cursor_create_from_xcursor_images(struct wl_cursor_theme *theme,
|
||||
wl_cursor_create_from_xcursor_images(XcursorImages *images,
|
||||
struct wl_cursor_theme *theme,
|
||||
const char *name,
|
||||
unsigned int size,
|
||||
unsigned int scale)
|
||||
unsigned int load_size)
|
||||
{
|
||||
char *path;
|
||||
XcursorImages *images;
|
||||
struct cursor *cursor;
|
||||
struct cursor_image *image;
|
||||
int i, nbytes;
|
||||
unsigned int load_size;
|
||||
int load_scale = 1;
|
||||
|
||||
load_size = size * scale;
|
||||
|
||||
path = g_strconcat (theme->path, "/", name, NULL);
|
||||
images = xcursor_load_images (path, load_size);
|
||||
|
||||
if (!images)
|
||||
{
|
||||
g_free (path);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (images->images[0]->width != load_size ||
|
||||
images->images[0]->height != load_size)
|
||||
{
|
||||
xcursor_images_destroy (images);
|
||||
images = xcursor_load_images (path, size);
|
||||
load_scale = scale;
|
||||
}
|
||||
|
||||
g_free (path);
|
||||
int i, size;
|
||||
|
||||
cursor = malloc(sizeof *cursor);
|
||||
if (!cursor) {
|
||||
xcursor_images_destroy (images);
|
||||
if (!cursor)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
cursor->cursor.images =
|
||||
malloc(images->nimage * sizeof cursor->cursor.images[0]);
|
||||
if (!cursor->cursor.images) {
|
||||
free(cursor);
|
||||
xcursor_images_destroy (images);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -260,37 +232,22 @@ wl_cursor_create_from_xcursor_images(struct wl_cursor_theme *theme,
|
||||
image->theme = theme;
|
||||
image->buffer = NULL;
|
||||
|
||||
image->image.width = images->images[i]->width * load_scale;
|
||||
image->image.height = images->images[i]->height * load_scale;
|
||||
image->image.hotspot_x = images->images[i]->xhot * load_scale;
|
||||
image->image.hotspot_y = images->images[i]->yhot * load_scale;
|
||||
image->image.width = images->images[i]->width;
|
||||
image->image.height = images->images[i]->height;
|
||||
image->image.hotspot_x = images->images[i]->xhot;
|
||||
image->image.hotspot_y = images->images[i]->yhot;
|
||||
image->image.delay = images->images[i]->delay;
|
||||
|
||||
nbytes = image->image.width * image->image.height * 4;
|
||||
image->offset = shm_pool_allocate(theme->pool, nbytes);
|
||||
size = image->image.width * image->image.height * 4;
|
||||
image->offset = shm_pool_allocate(theme->pool, size);
|
||||
if (image->offset < 0) {
|
||||
free(image);
|
||||
break;
|
||||
}
|
||||
|
||||
if (load_scale == 1) {
|
||||
/* copy pixels to shm pool */
|
||||
memcpy(theme->pool->data + image->offset,
|
||||
images->images[i]->pixels, nbytes);
|
||||
}
|
||||
else {
|
||||
/* scale image up while copying it */
|
||||
for (int y = 0; y < image->image.height; y++) {
|
||||
char *p = theme->pool->data + image->offset + y * image->image.width * 4;
|
||||
char *q = ((char *)images->images[i]->pixels) + (y / load_scale) * images->images[i]->width * 4;
|
||||
for (int x = 0; x < image->image.width; x++) {
|
||||
p[4 * x] = q[4 * (x/load_scale)];
|
||||
p[4 * x + 1] = q[4 * (x/load_scale) + 1];
|
||||
p[4 * x + 2] = q[4 * (x/load_scale) + 2];
|
||||
p[4 * x + 3] = q[4 * (x/load_scale) + 3];
|
||||
}
|
||||
}
|
||||
}
|
||||
/* copy pixels to shm pool */
|
||||
memcpy(theme->pool->data + image->offset,
|
||||
images->images[i]->pixels, size);
|
||||
cursor->total_delay += image->image.delay;
|
||||
cursor->cursor.images[i] = (struct wl_cursor_image *) image;
|
||||
}
|
||||
@@ -300,24 +257,27 @@ wl_cursor_create_from_xcursor_images(struct wl_cursor_theme *theme,
|
||||
free(cursor->cursor.name);
|
||||
free(cursor->cursor.images);
|
||||
free(cursor);
|
||||
xcursor_images_destroy (images);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
xcursor_images_destroy (images);
|
||||
|
||||
return &cursor->cursor;
|
||||
}
|
||||
|
||||
static void
|
||||
load_cursor(struct wl_cursor_theme *theme,
|
||||
const char *name,
|
||||
unsigned int size,
|
||||
unsigned int scale)
|
||||
load_cursor(struct wl_cursor_theme *theme, const char *name, unsigned int size)
|
||||
{
|
||||
XcursorImages *images;
|
||||
struct wl_cursor *cursor;
|
||||
char *path;
|
||||
|
||||
cursor = wl_cursor_create_from_xcursor_images(theme, name, size, scale);
|
||||
path = g_strconcat (theme->path, "/", name, NULL);
|
||||
images = xcursor_load_images (path, size);
|
||||
g_free (path);
|
||||
|
||||
if (!images)
|
||||
return;
|
||||
|
||||
cursor = wl_cursor_create_from_xcursor_images(images, theme, name, size);
|
||||
|
||||
if (cursor) {
|
||||
theme->cursor_count++;
|
||||
@@ -332,6 +292,8 @@ load_cursor(struct wl_cursor_theme *theme,
|
||||
theme->cursors[theme->cursor_count - 1] = cursor;
|
||||
}
|
||||
}
|
||||
|
||||
xcursor_images_destroy (images);
|
||||
}
|
||||
|
||||
/** Load a cursor theme to memory shared with the compositor
|
||||
@@ -411,7 +373,7 @@ wl_cursor_theme_get_cursor(struct wl_cursor_theme *theme,
|
||||
return theme->cursors[i];
|
||||
}
|
||||
|
||||
load_cursor (theme, name, theme->size, scale);
|
||||
load_cursor (theme, name, size);
|
||||
|
||||
if (i < theme->cursor_count) {
|
||||
if (size == theme->cursors[i]->size &&
|
||||
|
||||
@@ -59,17 +59,13 @@ gdk_wayland_app_launch_context_get_startup_notify_id (GAppLaunchContext *context
|
||||
if (display->xdg_activation)
|
||||
{
|
||||
struct xdg_activation_token_v1 *token;
|
||||
struct wl_event_queue *event_queue;
|
||||
struct wl_surface *wl_surface = NULL;
|
||||
GdkWaylandSeat *seat;
|
||||
GdkSurface *focus_surface;
|
||||
AppLaunchData app_launch_data = { 0 };
|
||||
|
||||
event_queue = wl_display_create_queue (display->wl_display);
|
||||
|
||||
seat = GDK_WAYLAND_SEAT (gdk_display_get_default_seat (GDK_DISPLAY (display)));
|
||||
focus_surface = gdk_wayland_device_get_focus (gdk_seat_get_keyboard (GDK_SEAT (seat)));
|
||||
token = xdg_activation_v1_get_activation_token (display->xdg_activation);
|
||||
wl_proxy_set_queue ((struct wl_proxy *) token, event_queue);
|
||||
|
||||
xdg_activation_token_v1_add_listener (token,
|
||||
&token_listener,
|
||||
@@ -77,21 +73,16 @@ gdk_wayland_app_launch_context_get_startup_notify_id (GAppLaunchContext *context
|
||||
xdg_activation_token_v1_set_serial (token,
|
||||
_gdk_wayland_seat_get_last_implicit_grab_serial (seat, NULL),
|
||||
gdk_wayland_seat_get_wl_seat (GDK_SEAT (seat)));
|
||||
|
||||
focus_surface = gdk_wayland_device_get_focus (gdk_seat_get_keyboard (GDK_SEAT (seat)));
|
||||
if (focus_surface)
|
||||
wl_surface = gdk_wayland_surface_get_wl_surface (focus_surface);
|
||||
if (wl_surface)
|
||||
xdg_activation_token_v1_set_surface (token, wl_surface);
|
||||
|
||||
xdg_activation_token_v1_set_surface (token,
|
||||
gdk_wayland_surface_get_wl_surface (focus_surface));
|
||||
xdg_activation_token_v1_commit (token);
|
||||
|
||||
while (app_launch_data.token == NULL)
|
||||
wl_display_dispatch_queue (display->wl_display, event_queue);
|
||||
wl_display_roundtrip (display->wl_display);
|
||||
|
||||
xdg_activation_token_v1_destroy (token);
|
||||
id = app_launch_data.token;
|
||||
wl_event_queue_destroy (event_queue);
|
||||
}
|
||||
else if (display->gtk_shell_version >= 3)
|
||||
{
|
||||
|
||||
@@ -178,7 +178,6 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
|
||||
if (c)
|
||||
{
|
||||
struct wl_cursor_image *image;
|
||||
int cursor_scale;
|
||||
|
||||
if (image_index >= c->image_count)
|
||||
{
|
||||
@@ -190,22 +189,12 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
|
||||
|
||||
image = c->images[image_index];
|
||||
|
||||
cursor_scale = desired_scale;
|
||||
if ((image->width % cursor_scale != 0) ||
|
||||
(image->height % cursor_scale != 0))
|
||||
{
|
||||
g_warning (G_STRLOC " cursor image size (%dx%d) not an integer"
|
||||
"multiple of scale (%d)", image->width, image->height,
|
||||
cursor_scale);
|
||||
cursor_scale = 1;
|
||||
}
|
||||
*hotspot_x = image->hotspot_x / desired_scale;
|
||||
*hotspot_y = image->hotspot_y / desired_scale;
|
||||
|
||||
*hotspot_x = image->hotspot_x / cursor_scale;
|
||||
*hotspot_y = image->hotspot_y / cursor_scale;
|
||||
|
||||
*width = image->width / cursor_scale;
|
||||
*height = image->height / cursor_scale;
|
||||
*scale = cursor_scale;
|
||||
*width = image->width / desired_scale;
|
||||
*height = image->height / desired_scale;
|
||||
*scale = desired_scale;
|
||||
|
||||
return wl_cursor_image_get_buffer (image);
|
||||
}
|
||||
@@ -215,7 +204,7 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
|
||||
cairo_surface_t *surface;
|
||||
struct wl_buffer *buffer;
|
||||
|
||||
texture = g_object_ref (gdk_cursor_get_texture (cursor));
|
||||
texture = gdk_cursor_get_texture (cursor);
|
||||
|
||||
from_texture:
|
||||
surface = g_hash_table_lookup (display->cursor_surface_cache, cursor);
|
||||
@@ -245,8 +234,6 @@ from_texture:
|
||||
buffer = _gdk_wayland_shm_surface_get_wl_buffer (surface);
|
||||
wl_buffer_add_listener (buffer, &buffer_listener, surface);
|
||||
|
||||
g_object_unref (texture);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
@@ -1416,7 +1416,8 @@ flush_smooth_scroll_event (GdkWaylandSeat *seat,
|
||||
seat->pointer_info.time,
|
||||
device_get_modifiers (seat->logical_pointer),
|
||||
delta_x, delta_y,
|
||||
is_stop);
|
||||
is_stop,
|
||||
GDK_SCROLL_UNIT_SURFACE);
|
||||
|
||||
_gdk_wayland_display_deliver_event (seat->display, event);
|
||||
}
|
||||
@@ -1557,6 +1558,12 @@ pointer_handle_leave (void *data,
|
||||
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (seat->display);
|
||||
GdkDeviceGrabInfo *grab;
|
||||
|
||||
if (!surface)
|
||||
return;
|
||||
|
||||
if (!GDK_IS_SURFACE (wl_surface_get_user_data (surface)))
|
||||
return;
|
||||
|
||||
if (!seat->pointer_info.focus)
|
||||
return;
|
||||
|
||||
@@ -1749,10 +1756,10 @@ pointer_handle_axis (void *data,
|
||||
switch (axis)
|
||||
{
|
||||
case WL_POINTER_AXIS_VERTICAL_SCROLL:
|
||||
pointer_frame->delta_y = wl_fixed_to_double (value) / 10.0;
|
||||
pointer_frame->delta_y = wl_fixed_to_double (value);
|
||||
break;
|
||||
case WL_POINTER_AXIS_HORIZONTAL_SCROLL:
|
||||
pointer_frame->delta_x = wl_fixed_to_double (value) / 10.0;
|
||||
pointer_frame->delta_x = wl_fixed_to_double (value);
|
||||
break;
|
||||
default:
|
||||
g_return_if_reached ();
|
||||
@@ -1762,7 +1769,7 @@ pointer_handle_axis (void *data,
|
||||
|
||||
GDK_SEAT_NOTE (seat, EVENTS,
|
||||
g_message ("scroll, axis %s, value %f, seat %p",
|
||||
get_axis_name (axis), wl_fixed_to_double (value) / 10.0,
|
||||
get_axis_name (axis), wl_fixed_to_double (value),
|
||||
seat));
|
||||
|
||||
if (display->seat_version < WL_POINTER_HAS_FRAME)
|
||||
@@ -3988,7 +3995,8 @@ tablet_tool_handle_wheel (void *data,
|
||||
tablet->pointer_info.time,
|
||||
device_get_modifiers (tablet->logical_device),
|
||||
0, clicks,
|
||||
FALSE);
|
||||
FALSE,
|
||||
GDK_SCROLL_UNIT_WHEEL);
|
||||
|
||||
_gdk_wayland_display_deliver_event (seat->display, event);
|
||||
|
||||
|
||||
@@ -2169,7 +2169,8 @@ gdk_wayland_display_get_setting (GdkDisplay *display,
|
||||
{
|
||||
if (strcmp (name, "gtk-decoration-layout") == 0)
|
||||
set_decoration_layout_from_entry (display, entry, value);
|
||||
else if (strcmp (name, "gtk-theme-name") == 0)
|
||||
else if (strcmp (name, "gtk-theme-name") == 0 ||
|
||||
strcmp (name, "gtk-icon-theme-name") == 0)
|
||||
set_theme_from_entry (display, entry, value);
|
||||
else
|
||||
set_value_from_entry (display, entry, value);
|
||||
|
||||
@@ -113,7 +113,6 @@ struct _GdkWaylandSurface
|
||||
|
||||
PopupState popup_state;
|
||||
|
||||
unsigned int popup_thaw_upon_show : 1;
|
||||
unsigned int initial_configure_received : 1;
|
||||
unsigned int has_uncommitted_ack_configure : 1;
|
||||
unsigned int mapped : 1;
|
||||
@@ -1395,6 +1394,7 @@ configure_toplevel_geometry (GdkSurface *surface)
|
||||
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
||||
GdkDisplay *display = gdk_surface_get_display (surface);
|
||||
GdkMonitor *monitor;
|
||||
GdkRectangle monitor_geometry;
|
||||
int bounds_width, bounds_height;
|
||||
GdkToplevelSize size;
|
||||
GdkToplevelLayout *layout;
|
||||
@@ -1402,20 +1402,10 @@ configure_toplevel_geometry (GdkSurface *surface)
|
||||
GdkSurfaceHints mask;
|
||||
|
||||
monitor = g_list_model_get_item (gdk_display_get_monitors (display), 0);
|
||||
if (monitor)
|
||||
{
|
||||
GdkRectangle monitor_geometry;
|
||||
|
||||
gdk_monitor_get_geometry (monitor, &monitor_geometry);
|
||||
g_object_unref (monitor);
|
||||
bounds_width = monitor_geometry.width;
|
||||
bounds_height = monitor_geometry.height;
|
||||
}
|
||||
else
|
||||
{
|
||||
bounds_width = 0;
|
||||
bounds_height = 0;
|
||||
}
|
||||
gdk_monitor_get_geometry (monitor, &monitor_geometry);
|
||||
g_object_unref (monitor);
|
||||
bounds_width = monitor_geometry.width;
|
||||
bounds_height = monitor_geometry.height;
|
||||
|
||||
gdk_toplevel_size_init (&size, bounds_width, bounds_height);
|
||||
gdk_toplevel_notify_compute_size (GDK_TOPLEVEL (surface), &size);
|
||||
@@ -2994,9 +2984,6 @@ gdk_wayland_surface_hide_surface (GdkSurface *surface)
|
||||
|
||||
if (GDK_IS_POPUP (surface))
|
||||
{
|
||||
impl->popup_thaw_upon_show = TRUE;
|
||||
gdk_surface_freeze_updates (surface);
|
||||
|
||||
switch (impl->popup_state)
|
||||
{
|
||||
case POPUP_STATE_WAITING_FOR_REPOSITIONED:
|
||||
@@ -3236,12 +3223,6 @@ show_popup (GdkSurface *surface,
|
||||
if (!impl->display_server.wl_surface)
|
||||
gdk_wayland_surface_create_surface (surface);
|
||||
|
||||
if (impl->popup_thaw_upon_show)
|
||||
{
|
||||
impl->popup_thaw_upon_show = FALSE;
|
||||
gdk_surface_thaw_updates (surface);
|
||||
}
|
||||
|
||||
gdk_wayland_surface_map_popup (surface, width, height, layout);
|
||||
}
|
||||
|
||||
|
||||
+11
-23
@@ -142,6 +142,8 @@ struct _drop_target_context
|
||||
static void
|
||||
gdk_win32_drop_init (GdkWin32Drop *drop)
|
||||
{
|
||||
drop->droptarget_w32format_contentformat_map = g_array_new (FALSE, FALSE, sizeof (GdkWin32ContentFormatPair));
|
||||
|
||||
GDK_NOTE (DND, g_print ("gdk_win32_drop_init %p\n", drop));
|
||||
}
|
||||
|
||||
@@ -412,13 +414,9 @@ set_source_actions_helper (GdkDrop *drop,
|
||||
DWORD grfKeyState)
|
||||
{
|
||||
GdkDragAction user_action;
|
||||
GdkWin32Drop *drop_win32;
|
||||
|
||||
user_action = get_user_action (grfKeyState);
|
||||
|
||||
drop_win32 = GDK_WIN32_DROP (drop);
|
||||
drop_win32->actions = actions;
|
||||
|
||||
if (user_action != 0)
|
||||
gdk_drop_set_actions (drop, user_action);
|
||||
else
|
||||
@@ -473,7 +471,6 @@ idroptarget_dragenter (LPDROPTARGET This,
|
||||
GdkDragAction source_actions;
|
||||
GdkDragAction dest_actions;
|
||||
GdkContentFormats *formats;
|
||||
GArray *droptarget_w32format_contentformat_map;
|
||||
|
||||
GDK_NOTE (DND, g_print ("idroptarget_dragenter %p @ %ld : %ld"
|
||||
" for dest window 0x%p"
|
||||
@@ -494,8 +491,7 @@ idroptarget_dragenter (LPDROPTARGET This,
|
||||
|
||||
display = gdk_surface_get_display (ctx->surface);
|
||||
|
||||
droptarget_w32format_contentformat_map = g_array_new (FALSE, FALSE, sizeof (GdkWin32ContentFormatPair));
|
||||
formats = query_object_formats (pDataObj, droptarget_w32format_contentformat_map);
|
||||
formats = query_object_formats (pDataObj, NULL);
|
||||
drop = gdk_drop_new (display,
|
||||
gdk_seat_get_pointer (gdk_display_get_default_seat (display)),
|
||||
drag,
|
||||
@@ -503,7 +499,7 @@ idroptarget_dragenter (LPDROPTARGET This,
|
||||
ctx->surface,
|
||||
GDK_DRAG_PROTO_OLE2);
|
||||
drop_win32 = GDK_WIN32_DROP (drop);
|
||||
drop_win32->droptarget_w32format_contentformat_map = droptarget_w32format_contentformat_map;
|
||||
g_array_set_size (drop_win32->droptarget_w32format_contentformat_map, 0);
|
||||
gdk_content_formats_unref (formats);
|
||||
|
||||
ctx->drop = drop;
|
||||
@@ -524,7 +520,7 @@ idroptarget_dragenter (LPDROPTARGET This,
|
||||
drop_win32->last_key_state = grfKeyState;
|
||||
drop_win32->last_x = pt_x;
|
||||
drop_win32->last_y = pt_y;
|
||||
dest_actions = filter_actions (gdk_drop_get_actions (drop), source_actions);
|
||||
dest_actions = filter_actions (drop_win32->actions, source_actions);
|
||||
*pdwEffect_and_dwOKEffects = drop_effect_for_actions (dest_actions);
|
||||
|
||||
GDK_NOTE (DND, g_print ("idroptarget_dragenter returns S_OK with actions %s"
|
||||
@@ -558,7 +554,9 @@ idroptarget_dragover (LPDROPTARGET This,
|
||||
GdkDragAction source_actions;
|
||||
GdkDragAction dest_actions;
|
||||
|
||||
source_actions = actions_for_drop_effects (*pdwEffect_and_dwOKEffects);
|
||||
source_actions = set_source_actions_helper (ctx->drop,
|
||||
actions_for_drop_effects (*pdwEffect_and_dwOKEffects),
|
||||
grfKeyState);
|
||||
|
||||
GDK_NOTE (DND, g_print ("idroptarget_dragover %p @ %d : %d"
|
||||
" (raw %ld : %ld)"
|
||||
@@ -571,8 +569,7 @@ idroptarget_dragover (LPDROPTARGET This,
|
||||
|
||||
if (pt_x != drop_win32->last_x ||
|
||||
pt_y != drop_win32->last_y ||
|
||||
grfKeyState != drop_win32->last_key_state ||
|
||||
source_actions != drop_win32->actions)
|
||||
grfKeyState != drop_win32->last_key_state)
|
||||
{
|
||||
double x = 0.0;
|
||||
double y = 0.0;
|
||||
@@ -581,15 +578,13 @@ idroptarget_dragover (LPDROPTARGET This,
|
||||
x /= drop_win32->scale;
|
||||
y /= drop_win32->scale;
|
||||
|
||||
set_source_actions_helper (ctx->drop, source_actions, grfKeyState);
|
||||
|
||||
gdk_drop_emit_motion_event (ctx->drop, TRUE, x, y, GDK_CURRENT_TIME);
|
||||
drop_win32->last_key_state = grfKeyState;
|
||||
drop_win32->last_x = pt_x;
|
||||
drop_win32->last_y = pt_y;
|
||||
}
|
||||
|
||||
dest_actions = filter_actions (gdk_drop_get_actions (ctx->drop), source_actions);
|
||||
dest_actions = filter_actions (drop_win32->actions, source_actions);
|
||||
*pdwEffect_and_dwOKEffects = drop_effect_for_actions (dest_actions);
|
||||
|
||||
GDK_NOTE (DND, g_print ("idroptarget_dragover returns S_OK with actions %s"
|
||||
@@ -650,12 +645,8 @@ idroptarget_drop (LPDROPTARGET This,
|
||||
x /= drop_win32->scale;
|
||||
y /= drop_win32->scale;
|
||||
|
||||
gdk_drop_emit_motion_event (ctx->drop, TRUE, x, y, GDK_CURRENT_TIME);
|
||||
|
||||
gdk_drop_emit_drop_event (ctx->drop, TRUE, x, y, GDK_CURRENT_TIME);
|
||||
|
||||
gdk_drop_emit_leave_event (ctx->drop, TRUE, GDK_CURRENT_TIME);
|
||||
|
||||
while (!drop_win32->drop_finished)
|
||||
g_main_context_iteration (NULL, FALSE);
|
||||
|
||||
@@ -833,10 +824,7 @@ gdk_win32_drop_status (GdkDrop *drop,
|
||||
_gdk_win32_drag_action_to_string (gdk_drop_get_actions (drop)),
|
||||
_gdk_win32_drag_action_to_string (preferred)));
|
||||
|
||||
if (preferred != 0)
|
||||
actions = preferred;
|
||||
|
||||
gdk_drop_set_actions (drop, drop_win32->actions & actions);
|
||||
drop_win32->actions = actions;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -2729,7 +2729,8 @@ gdk_event_translate (MSG *msg,
|
||||
build_pointer_event_state (msg),
|
||||
delta_x,
|
||||
delta_y,
|
||||
FALSE);
|
||||
FALSE,
|
||||
GDK_SCROLL_UNIT_WHEEL);
|
||||
|
||||
/* Append the discrete version too */
|
||||
direction = 0;
|
||||
|
||||
@@ -1778,7 +1778,8 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
||||
state,
|
||||
delta_x,
|
||||
delta_y,
|
||||
delta_x == 0.0 && delta_y == 0.0);
|
||||
delta_x == 0.0 && delta_y == 0.0,
|
||||
GDK_SCROLL_UNIT_WHEEL);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
+16
-12
@@ -361,9 +361,9 @@ gdk_x11_drop_update_actions (GdkX11Drop *drop_x11)
|
||||
if (!drop_x11->xdnd_have_actions)
|
||||
actions = drop_x11->suggested_action;
|
||||
else if (drop_x11->suggested_action & GDK_ACTION_ASK)
|
||||
actions = drop_x11->xdnd_actions | GDK_ACTION_ASK;
|
||||
else
|
||||
actions = drop_x11->xdnd_actions & GDK_ACTION_ALL;
|
||||
else
|
||||
actions = drop_x11->suggested_action;
|
||||
|
||||
gdk_drop_set_actions (GDK_DROP (drop_x11), actions);
|
||||
}
|
||||
@@ -769,18 +769,22 @@ gdk_x11_drop_status (GdkDrop *drop,
|
||||
|
||||
possible_actions = actions & gdk_drop_get_actions (drop);
|
||||
|
||||
if (preferred & possible_actions)
|
||||
suggested_action = preferred;
|
||||
else if (drop_x11->suggested_action & possible_actions)
|
||||
if (drop_x11->suggested_action != 0)
|
||||
suggested_action = drop_x11->suggested_action;
|
||||
else if (possible_actions & GDK_ACTION_COPY)
|
||||
suggested_action = GDK_ACTION_COPY;
|
||||
else if (possible_actions & GDK_ACTION_MOVE)
|
||||
suggested_action = GDK_ACTION_MOVE;
|
||||
else if (possible_actions & GDK_ACTION_ASK)
|
||||
suggested_action = GDK_ACTION_ASK;
|
||||
else
|
||||
suggested_action = 0;
|
||||
suggested_action = preferred & possible_actions;
|
||||
|
||||
if (suggested_action == 0 && possible_actions != 0)
|
||||
{
|
||||
if (possible_actions & GDK_ACTION_COPY)
|
||||
suggested_action = GDK_ACTION_COPY;
|
||||
else if (possible_actions & GDK_ACTION_MOVE)
|
||||
suggested_action = GDK_ACTION_MOVE;
|
||||
else if (possible_actions & GDK_ACTION_ASK)
|
||||
suggested_action = GDK_ACTION_ASK;
|
||||
else
|
||||
suggested_action = 0;
|
||||
}
|
||||
|
||||
xev.xclient.type = ClientMessage;
|
||||
xev.xclient.message_type = gdk_x11_get_xatom_by_name_for_display (display, "XdndStatus");
|
||||
|
||||
@@ -280,7 +280,7 @@ compute_toplevel_size (GdkSurface *surface,
|
||||
gdk_toplevel_size_init (&size, bounds_width, bounds_height);
|
||||
gdk_toplevel_notify_compute_size (GDK_TOPLEVEL (surface), &size);
|
||||
|
||||
if (size.shadow.is_valid)
|
||||
if (size.shadow.is_valid && update_geometry)
|
||||
{
|
||||
update_shadow_size (surface,
|
||||
size.shadow.left,
|
||||
|
||||
@@ -282,7 +282,7 @@ snapshot_uniforms (GskGLUniformState *state,
|
||||
{
|
||||
const GskGLUniformMapping *mapping = &program->mappings[i];
|
||||
|
||||
if (!mapping->info.initial && mapping->location > -1)
|
||||
if (!mapping->info.initial && mapping->info.format && mapping->location > -1)
|
||||
{
|
||||
uniform[count].location = mapping->location;
|
||||
uniform[count].info = mapping->info;
|
||||
|
||||
+86
-110
@@ -44,9 +44,6 @@
|
||||
#include <gdk/gdkprofilerprivate.h>
|
||||
#include <gdk/gdktextureprivate.h>
|
||||
|
||||
#define ATLAS_SIZE 512
|
||||
#define MAX_OLD_RATIO 0.5
|
||||
|
||||
G_DEFINE_TYPE (GskGLDriver, gsk_gl_driver, G_TYPE_OBJECT)
|
||||
|
||||
static guint
|
||||
@@ -156,50 +153,6 @@ gsk_gl_driver_collect_unused_textures (GskGLDriver *self,
|
||||
return collected;
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_gl_texture_atlas_free (GskGLTextureAtlas *atlas)
|
||||
{
|
||||
if (atlas->texture_id != 0)
|
||||
{
|
||||
glDeleteTextures (1, &atlas->texture_id);
|
||||
atlas->texture_id = 0;
|
||||
}
|
||||
|
||||
g_clear_pointer (&atlas->nodes, g_free);
|
||||
g_slice_free (GskGLTextureAtlas, atlas);
|
||||
}
|
||||
|
||||
GskGLTextureAtlas *
|
||||
gsk_gl_driver_create_atlas (GskGLDriver *self)
|
||||
{
|
||||
GskGLTextureAtlas *atlas;
|
||||
|
||||
g_return_val_if_fail (GSK_IS_GL_DRIVER (self), NULL);
|
||||
|
||||
atlas = g_slice_new0 (GskGLTextureAtlas);
|
||||
atlas->width = ATLAS_SIZE;
|
||||
atlas->height = ATLAS_SIZE;
|
||||
/* TODO: We might want to change the strategy about the amount of
|
||||
* nodes here? stb_rect_pack.h says width is optimal. */
|
||||
atlas->nodes = g_malloc0_n (atlas->width, sizeof (struct stbrp_node));
|
||||
stbrp_init_target (&atlas->context, atlas->width, atlas->height, atlas->nodes, atlas->width);
|
||||
atlas->texture_id = gsk_gl_command_queue_create_texture (self->command_queue,
|
||||
atlas->width,
|
||||
atlas->height,
|
||||
GL_RGBA8,
|
||||
GL_LINEAR,
|
||||
GL_LINEAR);
|
||||
|
||||
gdk_gl_context_label_object_printf (gdk_gl_context_get_current (),
|
||||
GL_TEXTURE, atlas->texture_id,
|
||||
"Texture atlas %d",
|
||||
atlas->texture_id);
|
||||
|
||||
g_ptr_array_add (self->atlases, atlas);
|
||||
|
||||
return atlas;
|
||||
}
|
||||
|
||||
static void
|
||||
remove_program (gpointer data)
|
||||
{
|
||||
@@ -226,6 +179,29 @@ gsk_gl_driver_shader_weak_cb (gpointer data,
|
||||
g_hash_table_remove (self->shader_cache, where_object_was);
|
||||
}
|
||||
|
||||
G_GNUC_NULL_TERMINATED static inline GBytes *
|
||||
join_sources (GBytes *first_bytes,
|
||||
...)
|
||||
{
|
||||
GByteArray *byte_array = g_byte_array_new ();
|
||||
GBytes *bytes = first_bytes;
|
||||
va_list args;
|
||||
|
||||
va_start (args, first_bytes);
|
||||
while (bytes != NULL)
|
||||
{
|
||||
gsize len;
|
||||
const guint8 *data = g_bytes_get_data (bytes, &len);
|
||||
if (len > 0)
|
||||
g_byte_array_append (byte_array, data, len);
|
||||
g_bytes_unref (bytes);
|
||||
bytes = va_arg (args, GBytes *);
|
||||
}
|
||||
va_end (args);
|
||||
|
||||
return g_byte_array_free_to_bytes (byte_array);
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_gl_driver_dispose (GObject *object)
|
||||
{
|
||||
@@ -235,6 +211,10 @@ gsk_gl_driver_dispose (GObject *object)
|
||||
g_assert (self->in_frame == FALSE);
|
||||
|
||||
#define GSK_GL_NO_UNIFORMS
|
||||
#define GSK_GL_SHADER_RESOURCE(name)
|
||||
#define GSK_GL_SHADER_STRING(str)
|
||||
#define GSK_GL_SHADER_SINGLE(name)
|
||||
#define GSK_GL_SHADER_JOINED(kind, ...)
|
||||
#define GSK_GL_ADD_UNIFORM(pos, KEY, name)
|
||||
#define GSK_GL_DEFINE_PROGRAM(name, resource, uniforms) \
|
||||
GSK_GL_DELETE_PROGRAM(name); \
|
||||
@@ -248,6 +228,10 @@ gsk_gl_driver_dispose (GObject *object)
|
||||
} G_STMT_END;
|
||||
# include "gskglprograms.defs"
|
||||
#undef GSK_GL_NO_UNIFORMS
|
||||
#undef GSK_GL_SHADER_RESOURCE
|
||||
#undef GSK_GL_SHADER_STRING
|
||||
#undef GSK_GL_SHADER_SINGLE
|
||||
#undef GSK_GL_SHADER_JOINED
|
||||
#undef GSK_GL_ADD_UNIFORM
|
||||
#undef GSK_GL_DEFINE_PROGRAM
|
||||
|
||||
@@ -289,11 +273,10 @@ gsk_gl_driver_dispose (GObject *object)
|
||||
g_assert (!self->texture_id_to_key || g_hash_table_size (self->texture_id_to_key) == 0);
|
||||
g_assert (!self->key_to_texture_id|| g_hash_table_size (self->key_to_texture_id) == 0);
|
||||
|
||||
g_clear_object (&self->glyphs);
|
||||
g_clear_object (&self->icons);
|
||||
g_clear_object (&self->shadows);
|
||||
g_clear_object (&self->glyphs_library);
|
||||
g_clear_object (&self->icons_library);
|
||||
g_clear_object (&self->shadows_library);
|
||||
|
||||
g_clear_pointer (&self->atlases, g_ptr_array_unref);
|
||||
g_clear_pointer (&self->autorelease_framebuffers, g_array_unref);
|
||||
g_clear_pointer (&self->key_to_texture_id, g_hash_table_unref);
|
||||
g_clear_pointer (&self->textures, g_hash_table_unref);
|
||||
@@ -330,7 +313,6 @@ gsk_gl_driver_init (GskGLDriver *self)
|
||||
self->shader_cache = g_hash_table_new_full (NULL, NULL, NULL, remove_program);
|
||||
self->texture_pool = g_array_new (FALSE, FALSE, sizeof (guint));
|
||||
self->render_targets = g_ptr_array_new ();
|
||||
self->atlases = g_ptr_array_new_with_free_func ((GDestroyNotify)gsk_gl_texture_atlas_free);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -348,14 +330,14 @@ gsk_gl_driver_load_programs (GskGLDriver *self,
|
||||
|
||||
/* Setup preambles that are shared by all shaders */
|
||||
gsk_gl_compiler_set_preamble_from_resource (compiler,
|
||||
GSK_GL_COMPILER_ALL,
|
||||
"/org/gtk/libgsk/gl/preamble.glsl");
|
||||
GSK_GL_COMPILER_ALL,
|
||||
"/org/gtk/libgsk/gl/preamble.glsl");
|
||||
gsk_gl_compiler_set_preamble_from_resource (compiler,
|
||||
GSK_GL_COMPILER_VERTEX,
|
||||
"/org/gtk/libgsk/gl/preamble.vs.glsl");
|
||||
GSK_GL_COMPILER_VERTEX,
|
||||
"/org/gtk/libgsk/gl/preamble.vs.glsl");
|
||||
gsk_gl_compiler_set_preamble_from_resource (compiler,
|
||||
GSK_GL_COMPILER_FRAGMENT,
|
||||
"/org/gtk/libgsk/gl/preamble.fs.glsl");
|
||||
GSK_GL_COMPILER_FRAGMENT,
|
||||
"/org/gtk/libgsk/gl/preamble.fs.glsl");
|
||||
|
||||
/* Setup attributes that are provided via VBO */
|
||||
gsk_gl_compiler_bind_attribute (compiler, "aPosition", 0);
|
||||
@@ -365,10 +347,28 @@ gsk_gl_driver_load_programs (GskGLDriver *self,
|
||||
|
||||
/* Use XMacros to register all of our programs and their uniforms */
|
||||
#define GSK_GL_NO_UNIFORMS
|
||||
#define GSK_GL_SHADER_RESOURCE(name) \
|
||||
g_resources_lookup_data("/org/gtk/libgsk/gl/" name, 0, NULL)
|
||||
#define GSK_GL_SHADER_STRING(str) \
|
||||
g_bytes_new_static(str, strlen(str))
|
||||
#define GSK_GL_SHADER_SINGLE(bytes) \
|
||||
G_STMT_START { \
|
||||
GBytes *b = bytes; \
|
||||
gsk_gl_compiler_set_source (compiler, GSK_GL_COMPILER_ALL, b); \
|
||||
g_bytes_unref (b); \
|
||||
} G_STMT_END;
|
||||
#define GSK_GL_SHADER_JOINED(kind, ...) \
|
||||
G_STMT_START { \
|
||||
GBytes *bytes = join_sources(__VA_ARGS__); \
|
||||
gsk_gl_compiler_set_source (compiler, GSK_GL_COMPILER_##kind, bytes); \
|
||||
g_bytes_unref (bytes); \
|
||||
} G_STMT_END;
|
||||
#define GSK_GL_ADD_UNIFORM(pos, KEY, name) \
|
||||
gsk_gl_program_add_uniform (program, #name, UNIFORM_##KEY);
|
||||
#define GSK_GL_DEFINE_PROGRAM(name, resource, uniforms) \
|
||||
gsk_gl_compiler_set_source_from_resource (compiler, GSK_GL_COMPILER_ALL, resource); \
|
||||
#define GSK_GL_DEFINE_PROGRAM(name, sources, uniforms) \
|
||||
gsk_gl_compiler_set_source (compiler, GSK_GL_COMPILER_VERTEX, NULL); \
|
||||
gsk_gl_compiler_set_source (compiler, GSK_GL_COMPILER_FRAGMENT, NULL); \
|
||||
sources \
|
||||
GSK_GL_COMPILE_PROGRAM(name ## _no_clip, uniforms, "#define NO_CLIP 1\n"); \
|
||||
GSK_GL_COMPILE_PROGRAM(name ## _rect_clip, uniforms, "#define RECT_CLIP 1\n"); \
|
||||
GSK_GL_COMPILE_PROGRAM(name, uniforms, "");
|
||||
@@ -401,6 +401,11 @@ gsk_gl_driver_load_programs (GskGLDriver *self,
|
||||
#undef GSK_GL_DEFINE_PROGRAM_CLIP
|
||||
#undef GSK_GL_DEFINE_PROGRAM
|
||||
#undef GSK_GL_ADD_UNIFORM
|
||||
#undef GSK_GL_SHADER_SINGLE
|
||||
#undef GSK_GL_SHADER_JOINED
|
||||
#undef GSK_GL_SHADER_RESOURCE
|
||||
#undef GSK_GL_SHADER_STRING
|
||||
#undef GSK_GL_NO_UNIFORMS
|
||||
|
||||
ret = TRUE;
|
||||
|
||||
@@ -456,9 +461,9 @@ gsk_gl_driver_new (GskGLCommandQueue *command_queue,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
self->glyphs = gsk_gl_glyph_library_new (self);
|
||||
self->icons = gsk_gl_icon_library_new (self);
|
||||
self->shadows = gsk_gl_shadow_library_new (self);
|
||||
self->glyphs_library = gsk_gl_glyph_library_new (self);
|
||||
self->icons_library = gsk_gl_icon_library_new (self);
|
||||
self->shadows_library = gsk_gl_shadow_library_new (self);
|
||||
|
||||
gdk_profiler_end_mark (before, "create GskGLDriver", NULL);
|
||||
|
||||
@@ -518,37 +523,6 @@ failure:
|
||||
return g_steal_pointer (&driver);
|
||||
}
|
||||
|
||||
static GPtrArray *
|
||||
gsk_gl_driver_compact_atlases (GskGLDriver *self)
|
||||
{
|
||||
GPtrArray *removed = NULL;
|
||||
|
||||
g_assert (GSK_IS_GL_DRIVER (self));
|
||||
|
||||
for (guint i = self->atlases->len; i > 0; i--)
|
||||
{
|
||||
GskGLTextureAtlas *atlas = g_ptr_array_index (self->atlases, i - 1);
|
||||
|
||||
if (gsk_gl_texture_atlas_get_unused_ratio (atlas) > MAX_OLD_RATIO)
|
||||
{
|
||||
GSK_NOTE (GLYPH_CACHE,
|
||||
g_message ("Dropping atlas %d (%g.2%% old)", i,
|
||||
100.0 * gsk_gl_texture_atlas_get_unused_ratio (atlas)));
|
||||
if (removed == NULL)
|
||||
removed = g_ptr_array_new_with_free_func ((GDestroyNotify)gsk_gl_texture_atlas_free);
|
||||
g_ptr_array_add (removed, g_ptr_array_steal_index (self->atlases, i - 1));
|
||||
}
|
||||
}
|
||||
|
||||
GSK_NOTE (GLYPH_CACHE, {
|
||||
static guint timestamp;
|
||||
if (timestamp++ % 60 == 0)
|
||||
g_message ("%d atlases", self->atlases->len);
|
||||
});
|
||||
|
||||
return removed;
|
||||
}
|
||||
|
||||
/**
|
||||
* gsk_gl_driver_begin_frame:
|
||||
* @self: a `GskGLDriver`
|
||||
@@ -565,7 +539,6 @@ gsk_gl_driver_begin_frame (GskGLDriver *self,
|
||||
GskGLCommandQueue *command_queue)
|
||||
{
|
||||
gint64 last_frame_id;
|
||||
GPtrArray *removed;
|
||||
|
||||
g_return_if_fail (GSK_IS_GL_DRIVER (self));
|
||||
g_return_if_fail (GSK_IS_GL_COMMAND_QUEUE (command_queue));
|
||||
@@ -580,19 +553,14 @@ gsk_gl_driver_begin_frame (GskGLDriver *self,
|
||||
|
||||
gsk_gl_command_queue_begin_frame (self->command_queue);
|
||||
|
||||
/* Compact atlases with too many freed pixels */
|
||||
removed = gsk_gl_driver_compact_atlases (self);
|
||||
|
||||
/* Mark unused pixel regions of the atlases */
|
||||
gsk_gl_texture_library_begin_frame (GSK_GL_TEXTURE_LIBRARY (self->icons),
|
||||
self->current_frame_id,
|
||||
removed);
|
||||
gsk_gl_texture_library_begin_frame (GSK_GL_TEXTURE_LIBRARY (self->glyphs),
|
||||
self->current_frame_id,
|
||||
removed);
|
||||
gsk_gl_texture_library_begin_frame (GSK_GL_TEXTURE_LIBRARY (self->icons_library),
|
||||
self->current_frame_id);
|
||||
gsk_gl_texture_library_begin_frame (GSK_GL_TEXTURE_LIBRARY (self->glyphs_library),
|
||||
self->current_frame_id);
|
||||
|
||||
/* Cleanup old shadows */
|
||||
gsk_gl_shadow_library_begin_frame (self->shadows);
|
||||
gsk_gl_shadow_library_begin_frame (self->shadows_library);
|
||||
|
||||
/* Remove all textures that are from a previous frame or are no
|
||||
* longer used by linked GdkTexture. We do this at the beginning
|
||||
@@ -600,9 +568,6 @@ gsk_gl_driver_begin_frame (GskGLDriver *self,
|
||||
* we block on any resources while delivering our frames.
|
||||
*/
|
||||
gsk_gl_driver_collect_unused_textures (self, last_frame_id - 1);
|
||||
|
||||
/* Now free atlas textures */
|
||||
g_clear_pointer (&removed, g_ptr_array_unref);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1182,14 +1147,23 @@ void
|
||||
gsk_gl_driver_save_atlases_to_png (GskGLDriver *self,
|
||||
const char *directory)
|
||||
{
|
||||
GPtrArray *atlases;
|
||||
|
||||
g_return_if_fail (GSK_IS_GL_DRIVER (self));
|
||||
|
||||
if (directory == NULL)
|
||||
directory = ".";
|
||||
|
||||
for (guint i = 0; i < self->atlases->len; i++)
|
||||
#define copy_atlases(dst, library) \
|
||||
g_ptr_array_extend(dst, GSK_GL_TEXTURE_LIBRARY(library)->atlases, NULL, NULL)
|
||||
atlases = g_ptr_array_new ();
|
||||
copy_atlases (atlases, self->glyphs_library);
|
||||
copy_atlases (atlases, self->icons_library);
|
||||
#undef copy_atlases
|
||||
|
||||
for (guint i = 0; i < atlases->len; i++)
|
||||
{
|
||||
GskGLTextureAtlas *atlas = g_ptr_array_index (self->atlases, i);
|
||||
GskGLTextureAtlas *atlas = g_ptr_array_index (atlases, i);
|
||||
char *filename = g_strdup_printf ("%s%sframe-%d-atlas-%d.png",
|
||||
directory,
|
||||
G_DIR_SEPARATOR_S,
|
||||
@@ -1198,6 +1172,8 @@ gsk_gl_driver_save_atlases_to_png (GskGLDriver *self,
|
||||
write_atlas_to_png (self, atlas, filename);
|
||||
g_free (filename);
|
||||
}
|
||||
|
||||
g_ptr_array_unref (atlases);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -100,17 +100,15 @@ struct _GskGLDriver
|
||||
GskGLCommandQueue *shared_command_queue;
|
||||
GskGLCommandQueue *command_queue;
|
||||
|
||||
GskGLGlyphLibrary *glyphs;
|
||||
GskGLIconLibrary *icons;
|
||||
GskGLShadowLibrary *shadows;
|
||||
GskGLGlyphLibrary *glyphs_library;
|
||||
GskGLIconLibrary *icons_library;
|
||||
GskGLShadowLibrary *shadows_library;
|
||||
|
||||
GArray *texture_pool;
|
||||
GHashTable *textures;
|
||||
GHashTable *key_to_texture_id;
|
||||
GHashTable *texture_id_to_key;
|
||||
|
||||
GPtrArray *atlases;
|
||||
|
||||
GHashTable *shader_cache;
|
||||
|
||||
GArray *autorelease_framebuffers;
|
||||
@@ -184,7 +182,6 @@ void gsk_gl_driver_add_texture_slices (GskGLDriver *s
|
||||
GskGLProgram * gsk_gl_driver_lookup_shader (GskGLDriver *self,
|
||||
GskGLShader *shader,
|
||||
GError **error);
|
||||
GskGLTextureAtlas * gsk_gl_driver_create_atlas (GskGLDriver *self);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
void gsk_gl_driver_save_atlases_to_png (GskGLDriver *self,
|
||||
|
||||
@@ -84,15 +84,64 @@ gsk_gl_glyph_value_free (gpointer data)
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_gl_glyph_library_begin_frame (GskGLTextureLibrary *library,
|
||||
gint64 frame_id,
|
||||
GPtrArray *removed_atlases)
|
||||
gsk_gl_glyph_library_clear_cache (GskGLTextureLibrary *library)
|
||||
{
|
||||
GskGLGlyphLibrary *self = (GskGLGlyphLibrary *)library;
|
||||
|
||||
g_assert (GSK_IS_GL_GLYPH_LIBRARY (self));
|
||||
|
||||
memset (self->front, 0, sizeof self->front);
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_gl_glyph_library_init_atlas (GskGLTextureLibrary *self,
|
||||
GskGLTextureAtlas *atlas)
|
||||
{
|
||||
gboolean packed G_GNUC_UNUSED;
|
||||
int x, y;
|
||||
guint gl_format;
|
||||
guint gl_type;
|
||||
guint8 pixel_data[4 * 3 * 3];
|
||||
|
||||
g_assert (GSK_IS_GL_GLYPH_LIBRARY (self));
|
||||
g_assert (atlas != NULL);
|
||||
|
||||
/* Insert a single pixel at 0,0 for use in coloring */
|
||||
|
||||
gdk_gl_context_push_debug_group_printf (gdk_gl_context_get_current (),
|
||||
"Initializing Atlas");
|
||||
|
||||
packed = gsk_gl_texture_library_allocate (self, atlas, 3, 3, &x, &y);
|
||||
g_assert (packed);
|
||||
g_assert (x == 0 && y == 0);
|
||||
|
||||
memset (pixel_data, 255, sizeof pixel_data);
|
||||
|
||||
if (gdk_gl_context_get_use_es (gdk_gl_context_get_current ()))
|
||||
{
|
||||
gl_format = GL_RGBA;
|
||||
gl_type = GL_UNSIGNED_BYTE;
|
||||
}
|
||||
else
|
||||
{
|
||||
gl_format = GL_BGRA;
|
||||
gl_type = GL_UNSIGNED_INT_8_8_8_8_REV;
|
||||
}
|
||||
|
||||
glBindTexture (GL_TEXTURE_2D, atlas->texture_id);
|
||||
|
||||
glTexSubImage2D (GL_TEXTURE_2D, 0,
|
||||
0, 0,
|
||||
3, 3,
|
||||
gl_format, gl_type,
|
||||
pixel_data);
|
||||
|
||||
gdk_gl_context_pop_debug_group (gdk_gl_context_get_current ());
|
||||
|
||||
self->driver->command_queue->n_uploads++;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gsk_gl_glyph_library_finalize (GObject *object)
|
||||
{
|
||||
@@ -111,7 +160,8 @@ gsk_gl_glyph_library_class_init (GskGLGlyphLibraryClass *klass)
|
||||
|
||||
object_class->finalize = gsk_gl_glyph_library_finalize;
|
||||
|
||||
library_class->begin_frame = gsk_gl_glyph_library_begin_frame;
|
||||
library_class->clear_cache = gsk_gl_glyph_library_clear_cache;
|
||||
library_class->init_atlas = gsk_gl_glyph_library_init_atlas;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
+16
-16
@@ -1,71 +1,71 @@
|
||||
GSK_GL_DEFINE_PROGRAM (blend,
|
||||
"/org/gtk/libgsk/gl/blend.glsl",
|
||||
GSK_GL_SHADER_SINGLE (GSK_GL_SHADER_RESOURCE ("blend.glsl")),
|
||||
GSK_GL_ADD_UNIFORM (1, BLEND_SOURCE2, u_source2)
|
||||
GSK_GL_ADD_UNIFORM (2, BLEND_MODE, u_mode))
|
||||
|
||||
GSK_GL_DEFINE_PROGRAM (blit,
|
||||
"/org/gtk/libgsk/gl/blit.glsl",
|
||||
GSK_GL_SHADER_SINGLE (GSK_GL_SHADER_RESOURCE ("blit.glsl")),
|
||||
GSK_GL_NO_UNIFORMS)
|
||||
|
||||
GSK_GL_DEFINE_PROGRAM (blur,
|
||||
"/org/gtk/libgsk/gl/blur.glsl",
|
||||
GSK_GL_SHADER_SINGLE (GSK_GL_SHADER_RESOURCE ("blur.glsl")),
|
||||
GSK_GL_ADD_UNIFORM (1, BLUR_RADIUS, u_blur_radius)
|
||||
GSK_GL_ADD_UNIFORM (2, BLUR_SIZE, u_blur_size)
|
||||
GSK_GL_ADD_UNIFORM (3, BLUR_DIR, u_blur_dir))
|
||||
|
||||
GSK_GL_DEFINE_PROGRAM (border,
|
||||
"/org/gtk/libgsk/gl/border.glsl",
|
||||
GSK_GL_SHADER_SINGLE (GSK_GL_SHADER_RESOURCE ("border.glsl")),
|
||||
GSK_GL_ADD_UNIFORM (1, BORDER_WIDTHS, u_widths)
|
||||
GSK_GL_ADD_UNIFORM (2, BORDER_OUTLINE_RECT, u_outline_rect))
|
||||
|
||||
GSK_GL_DEFINE_PROGRAM (color,
|
||||
"/org/gtk/libgsk/gl/color.glsl",
|
||||
GSK_GL_SHADER_SINGLE (GSK_GL_SHADER_RESOURCE ("color.glsl")),
|
||||
GSK_GL_NO_UNIFORMS)
|
||||
|
||||
GSK_GL_DEFINE_PROGRAM (coloring,
|
||||
"/org/gtk/libgsk/gl/coloring.glsl",
|
||||
GSK_GL_SHADER_SINGLE (GSK_GL_SHADER_RESOURCE ("coloring.glsl")),
|
||||
GSK_GL_NO_UNIFORMS)
|
||||
|
||||
GSK_GL_DEFINE_PROGRAM (color_matrix,
|
||||
"/org/gtk/libgsk/gl/color_matrix.glsl",
|
||||
GSK_GL_SHADER_SINGLE (GSK_GL_SHADER_RESOURCE ("color_matrix.glsl")),
|
||||
GSK_GL_ADD_UNIFORM (1, COLOR_MATRIX_COLOR_MATRIX, u_color_matrix)
|
||||
GSK_GL_ADD_UNIFORM (2, COLOR_MATRIX_COLOR_OFFSET, u_color_offset))
|
||||
|
||||
GSK_GL_DEFINE_PROGRAM (conic_gradient,
|
||||
"/org/gtk/libgsk/gl/conic_gradient.glsl",
|
||||
GSK_GL_SHADER_SINGLE (GSK_GL_SHADER_RESOURCE ("conic_gradient.glsl")),
|
||||
GSK_GL_ADD_UNIFORM (1, CONIC_GRADIENT_COLOR_STOPS, u_color_stops)
|
||||
GSK_GL_ADD_UNIFORM (2, CONIC_GRADIENT_NUM_COLOR_STOPS, u_num_color_stops)
|
||||
GSK_GL_ADD_UNIFORM (3, CONIC_GRADIENT_GEOMETRY, u_geometry))
|
||||
|
||||
GSK_GL_DEFINE_PROGRAM (cross_fade,
|
||||
"/org/gtk/libgsk/gl/cross_fade.glsl",
|
||||
GSK_GL_SHADER_SINGLE (GSK_GL_SHADER_RESOURCE ("cross_fade.glsl")),
|
||||
GSK_GL_ADD_UNIFORM (1, CROSS_FADE_PROGRESS, u_progress)
|
||||
GSK_GL_ADD_UNIFORM (2, CROSS_FADE_SOURCE2, u_source2))
|
||||
|
||||
GSK_GL_DEFINE_PROGRAM (filled_border,
|
||||
"/org/gtk/libgsk/gl/filled_border.glsl",
|
||||
GSK_GL_SHADER_SINGLE (GSK_GL_SHADER_RESOURCE ("filled_border.glsl")),
|
||||
GSK_GL_ADD_UNIFORM (1, FILLED_BORDER_WIDTHS, u_widths)
|
||||
GSK_GL_ADD_UNIFORM (2, FILLED_BORDER_OUTLINE_RECT, u_outline_rect))
|
||||
|
||||
GSK_GL_DEFINE_PROGRAM (inset_shadow,
|
||||
"/org/gtk/libgsk/gl/inset_shadow.glsl",
|
||||
GSK_GL_SHADER_SINGLE (GSK_GL_SHADER_RESOURCE ("inset_shadow.glsl")),
|
||||
GSK_GL_ADD_UNIFORM (1, INSET_SHADOW_SPREAD, u_spread)
|
||||
GSK_GL_ADD_UNIFORM (2, INSET_SHADOW_OFFSET, u_offset)
|
||||
GSK_GL_ADD_UNIFORM (3, INSET_SHADOW_OUTLINE_RECT, u_outline_rect))
|
||||
|
||||
GSK_GL_DEFINE_PROGRAM (linear_gradient,
|
||||
"/org/gtk/libgsk/gl/linear_gradient.glsl",
|
||||
GSK_GL_SHADER_SINGLE (GSK_GL_SHADER_RESOURCE ("linear_gradient.glsl")),
|
||||
GSK_GL_ADD_UNIFORM (1, LINEAR_GRADIENT_COLOR_STOPS, u_color_stops)
|
||||
GSK_GL_ADD_UNIFORM (2, LINEAR_GRADIENT_NUM_COLOR_STOPS, u_num_color_stops)
|
||||
GSK_GL_ADD_UNIFORM (3, LINEAR_GRADIENT_POINTS, u_points)
|
||||
GSK_GL_ADD_UNIFORM (4, LINEAR_GRADIENT_REPEAT, u_repeat))
|
||||
|
||||
GSK_GL_DEFINE_PROGRAM (outset_shadow,
|
||||
"/org/gtk/libgsk/gl/outset_shadow.glsl",
|
||||
GSK_GL_SHADER_SINGLE (GSK_GL_SHADER_RESOURCE ("outset_shadow.glsl")),
|
||||
GSK_GL_ADD_UNIFORM (1, OUTSET_SHADOW_OUTLINE_RECT, u_outline_rect))
|
||||
|
||||
GSK_GL_DEFINE_PROGRAM (radial_gradient,
|
||||
"/org/gtk/libgsk/gl/radial_gradient.glsl",
|
||||
GSK_GL_SHADER_SINGLE (GSK_GL_SHADER_RESOURCE ("radial_gradient.glsl")),
|
||||
GSK_GL_ADD_UNIFORM (1, RADIAL_GRADIENT_COLOR_STOPS, u_color_stops)
|
||||
GSK_GL_ADD_UNIFORM (2, RADIAL_GRADIENT_NUM_COLOR_STOPS, u_num_color_stops)
|
||||
GSK_GL_ADD_UNIFORM (3, RADIAL_GRADIENT_REPEAT, u_repeat)
|
||||
@@ -73,12 +73,12 @@ GSK_GL_DEFINE_PROGRAM (radial_gradient,
|
||||
GSK_GL_ADD_UNIFORM (5, RADIAL_GRADIENT_GEOMETRY, u_geometry))
|
||||
|
||||
GSK_GL_DEFINE_PROGRAM (repeat,
|
||||
"/org/gtk/libgsk/gl/repeat.glsl",
|
||||
GSK_GL_SHADER_SINGLE (GSK_GL_SHADER_RESOURCE ("repeat.glsl")),
|
||||
GSK_GL_ADD_UNIFORM (1, REPEAT_CHILD_BOUNDS, u_child_bounds)
|
||||
GSK_GL_ADD_UNIFORM (2, REPEAT_TEXTURE_RECT, u_texture_rect))
|
||||
|
||||
GSK_GL_DEFINE_PROGRAM (unblurred_outset_shadow,
|
||||
"/org/gtk/libgsk/gl/unblurred_outset_shadow.glsl",
|
||||
GSK_GL_SHADER_SINGLE (GSK_GL_SHADER_RESOURCE ("unblurred_outset_shadow.glsl")),
|
||||
GSK_GL_ADD_UNIFORM (1, UNBLURRED_OUTSET_SHADOW_SPREAD, u_spread)
|
||||
GSK_GL_ADD_UNIFORM (2, UNBLURRED_OUTSET_SHADOW_OFFSET, u_offset)
|
||||
GSK_GL_ADD_UNIFORM (3, UNBLURRED_OUTSET_SHADOW_OUTLINE_RECT, u_outline_rect))
|
||||
|
||||
+1
-21
@@ -24,7 +24,6 @@
|
||||
#include <gdk/gdkdisplayprivate.h>
|
||||
#include <gdk/gdkglcontextprivate.h>
|
||||
#include <gdk/gdksurfaceprivate.h>
|
||||
#include <gdk/gdkintl.h>
|
||||
#include <gsk/gskdebugprivate.h>
|
||||
#include <gsk/gskrendererprivate.h>
|
||||
#include <gsk/gskrendernodeprivate.h>
|
||||
@@ -94,7 +93,6 @@ gsk_gl_renderer_realize (GskRenderer *renderer,
|
||||
GdkDisplay *display;
|
||||
gboolean ret = FALSE;
|
||||
gboolean debug_shaders = FALSE;
|
||||
GdkGLAPI api;
|
||||
|
||||
if (self->context != NULL)
|
||||
return TRUE;
|
||||
@@ -117,24 +115,6 @@ gsk_gl_renderer_realize (GskRenderer *renderer,
|
||||
if (!context || !gdk_gl_context_realize (context, error))
|
||||
goto failure;
|
||||
|
||||
api = gdk_gl_context_get_api (context);
|
||||
if (api == GDK_GL_API_GLES)
|
||||
{
|
||||
gdk_gl_context_make_current (context);
|
||||
|
||||
if (!gdk_gl_context_has_vertex_half_float (context))
|
||||
{
|
||||
int major, minor;
|
||||
|
||||
gdk_gl_context_get_version (context, &major, &minor);
|
||||
g_set_error (error,
|
||||
GDK_GL_ERROR, GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
_("This GLES %d.%d implementation does not support half-float vertex data"),
|
||||
major, minor);
|
||||
goto failure;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GSK_RENDERER_DEBUG_CHECK (GSK_RENDERER (self), SHADERS))
|
||||
debug_shaders = TRUE;
|
||||
@@ -351,7 +331,7 @@ gsk_gl_renderer_render_texture (GskRenderer *renderer,
|
||||
{
|
||||
for (x = 0; x < width; x += max_size)
|
||||
{
|
||||
texture = gsk_gl_renderer_render_texture (renderer, root,
|
||||
texture = gsk_gl_renderer_render_texture (renderer, root,
|
||||
&GRAPHENE_RECT_INIT (x, y,
|
||||
MIN (max_size, viewport->size.width - x),
|
||||
MIN (max_size, viewport->size.height - y)));
|
||||
|
||||
+8
-62
@@ -2512,7 +2512,9 @@ gsk_gl_render_job_visit_blurred_outset_shadow_node (GskGLRenderJob *job,
|
||||
scaled_outline.corner[i].height *= scale_y;
|
||||
}
|
||||
|
||||
cached_tid = gsk_gl_shadow_library_lookup (job->driver->shadows, &scaled_outline, blur_radius);
|
||||
cached_tid = gsk_gl_shadow_library_lookup (job->driver->shadows_library,
|
||||
&scaled_outline,
|
||||
blur_radius);
|
||||
|
||||
if (cached_tid == 0)
|
||||
{
|
||||
@@ -2574,7 +2576,7 @@ gsk_gl_render_job_visit_blurred_outset_shadow_node (GskGLRenderJob *job,
|
||||
blur_radius * scale_x,
|
||||
blur_radius * scale_y);
|
||||
|
||||
gsk_gl_shadow_library_insert (job->driver->shadows,
|
||||
gsk_gl_shadow_library_insert (job->driver->shadows_library,
|
||||
&scaled_outline,
|
||||
blur_radius,
|
||||
blurred_texture_id);
|
||||
@@ -2858,58 +2860,6 @@ gsk_gl_render_job_visit_cross_fade_node (GskGLRenderJob *job,
|
||||
gsk_gl_render_job_end_draw (job);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
is_non_branching (const GskRenderNode *node)
|
||||
{
|
||||
switch ((int)gsk_render_node_get_node_type (node))
|
||||
{
|
||||
case GSK_COLOR_NODE:
|
||||
case GSK_LINEAR_GRADIENT_NODE:
|
||||
case GSK_REPEATING_LINEAR_GRADIENT_NODE:
|
||||
case GSK_RADIAL_GRADIENT_NODE:
|
||||
case GSK_REPEATING_RADIAL_GRADIENT_NODE:
|
||||
case GSK_CONIC_GRADIENT_NODE:
|
||||
case GSK_BORDER_NODE:
|
||||
case GSK_TEXTURE_NODE:
|
||||
case GSK_INSET_SHADOW_NODE:
|
||||
case GSK_OUTSET_SHADOW_NODE:
|
||||
case GSK_TEXT_NODE:
|
||||
case GSK_CAIRO_NODE:
|
||||
return TRUE;
|
||||
|
||||
case GSK_TRANSFORM_NODE:
|
||||
return is_non_branching (gsk_transform_node_get_child (node));
|
||||
|
||||
case GSK_OPACITY_NODE:
|
||||
return is_non_branching (gsk_opacity_node_get_child (node));
|
||||
|
||||
case GSK_COLOR_MATRIX_NODE:
|
||||
return is_non_branching (gsk_color_matrix_node_get_child (node));
|
||||
|
||||
case GSK_CLIP_NODE:
|
||||
return is_non_branching (gsk_clip_node_get_child (node));
|
||||
|
||||
case GSK_ROUNDED_CLIP_NODE:
|
||||
return is_non_branching (gsk_rounded_clip_node_get_child (node));
|
||||
|
||||
case GSK_SHADOW_NODE:
|
||||
return is_non_branching (gsk_shadow_node_get_child (node));
|
||||
|
||||
case GSK_BLUR_NODE:
|
||||
return is_non_branching (gsk_shadow_node_get_child (node));
|
||||
|
||||
case GSK_DEBUG_NODE:
|
||||
return is_non_branching (gsk_debug_node_get_child (node));
|
||||
|
||||
case GSK_CONTAINER_NODE:
|
||||
return gsk_container_node_get_n_children (node) == 1 &&
|
||||
is_non_branching (gsk_container_node_get_child (node, 0));
|
||||
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
gsk_gl_render_job_visit_opacity_node (GskGLRenderJob *job,
|
||||
const GskRenderNode *node)
|
||||
@@ -2922,11 +2872,7 @@ gsk_gl_render_job_visit_opacity_node (GskGLRenderJob *job,
|
||||
{
|
||||
float prev_alpha = gsk_gl_render_job_set_alpha (job, new_alpha);
|
||||
|
||||
/* Handle a few easy cases without offscreen. We bail out
|
||||
* as soon as we see nodes with multiple children - in theory,
|
||||
* we would only need offscreens for overlapping children.
|
||||
*/
|
||||
if (is_non_branching (child))
|
||||
if (!gsk_render_node_use_offscreen_for_opacity (child))
|
||||
{
|
||||
gsk_gl_render_job_visit_node (job, child);
|
||||
gsk_gl_render_job_set_alpha (job, prev_alpha);
|
||||
@@ -2996,7 +2942,7 @@ gsk_gl_render_job_visit_text_node (GskGLRenderJob *job,
|
||||
guint num_glyphs = gsk_text_node_get_num_glyphs (node);
|
||||
float x = offset->x + job->offset_x;
|
||||
float y = offset->y + job->offset_y;
|
||||
GskGLGlyphLibrary *library = job->driver->glyphs;
|
||||
GskGLGlyphLibrary *library = job->driver->glyphs_library;
|
||||
GskGLCommandBatch *batch;
|
||||
int x_position = 0;
|
||||
GskGLGlyphKey lookup;
|
||||
@@ -3499,14 +3445,14 @@ gsk_gl_render_job_upload_texture (GskGLRenderJob *job,
|
||||
GdkTexture *texture,
|
||||
GskGLRenderOffscreen *offscreen)
|
||||
{
|
||||
if (gsk_gl_texture_library_can_cache ((GskGLTextureLibrary *)job->driver->icons,
|
||||
if (gsk_gl_texture_library_can_cache ((GskGLTextureLibrary *)job->driver->icons_library,
|
||||
texture->width,
|
||||
texture->height) &&
|
||||
!GDK_IS_GL_TEXTURE (texture))
|
||||
{
|
||||
const GskGLIconData *icon_data;
|
||||
|
||||
gsk_gl_icon_library_lookup_or_add (job->driver->icons, texture, &icon_data);
|
||||
gsk_gl_icon_library_lookup_or_add (job->driver->icons_library, texture, &icon_data);
|
||||
offscreen->texture_id = GSK_GL_TEXTURE_ATLAS_ENTRY_TEXTURE (icon_data);
|
||||
memcpy (&offscreen->area, &icon_data->entry.area, sizeof offscreen->area);
|
||||
}
|
||||
|
||||
@@ -29,9 +29,9 @@
|
||||
|
||||
struct _GskGLShadowLibrary
|
||||
{
|
||||
GObject parent_instance;
|
||||
GObject parent_instance;
|
||||
GskGLDriver *driver;
|
||||
GArray *shadows;
|
||||
GArray *shadows;
|
||||
};
|
||||
|
||||
typedef struct _Shadow
|
||||
|
||||
+318
-158
@@ -27,7 +27,10 @@
|
||||
#include "gskgldriverprivate.h"
|
||||
#include "gskgltexturelibraryprivate.h"
|
||||
|
||||
#define MAX_FRAME_AGE 60
|
||||
#define DEFAULT_MAX_FRAME_AGE 60
|
||||
#define DEFAULT_ATLAS_WIDTH 512
|
||||
#define DEFAULT_ATLAS_HEIGHT 512
|
||||
#define MAX_OLD_RATIO 0.5
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE (GskGLTextureLibrary, gsk_gl_texture_library, G_TYPE_OBJECT)
|
||||
|
||||
@@ -39,6 +42,149 @@ enum {
|
||||
|
||||
static GParamSpec *properties [N_PROPS];
|
||||
|
||||
static void
|
||||
gsk_gl_texture_atlas_free (GskGLTextureAtlas *atlas)
|
||||
{
|
||||
if (atlas->texture_id != 0)
|
||||
{
|
||||
glDeleteTextures (1, &atlas->texture_id);
|
||||
atlas->texture_id = 0;
|
||||
}
|
||||
|
||||
g_clear_pointer (&atlas->nodes, g_free);
|
||||
g_slice_free (GskGLTextureAtlas, atlas);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gsk_gl_texture_library_real_compact (GskGLTextureLibrary *self,
|
||||
gint64 frame_id)
|
||||
{
|
||||
GPtrArray *removed = NULL;
|
||||
gboolean ret = FALSE;
|
||||
gboolean periodic_scan;
|
||||
|
||||
g_assert (GSK_IS_GL_TEXTURE_LIBRARY (self));
|
||||
|
||||
periodic_scan = (self->max_frame_age > 0 &&
|
||||
(frame_id % self->max_frame_age) == 0);
|
||||
|
||||
for (guint i = self->atlases->len; i > 0; i--)
|
||||
{
|
||||
GskGLTextureAtlas *atlas = g_ptr_array_index (self->atlases, i - 1);
|
||||
|
||||
if (gsk_gl_texture_atlas_get_unused_ratio (atlas) > MAX_OLD_RATIO)
|
||||
{
|
||||
GSK_NOTE (GLYPH_CACHE,
|
||||
g_message ("Dropping atlas %d (%g.2%% old)", i,
|
||||
100.0 * gsk_gl_texture_atlas_get_unused_ratio (atlas)));
|
||||
if (removed == NULL)
|
||||
removed = g_ptr_array_new_with_free_func ((GDestroyNotify)gsk_gl_texture_atlas_free);
|
||||
g_ptr_array_add (removed, g_ptr_array_steal_index (self->atlases, i - 1));
|
||||
}
|
||||
}
|
||||
|
||||
if (periodic_scan || removed != NULL)
|
||||
{
|
||||
GskGLTextureAtlasEntry *entry;
|
||||
GHashTableIter iter;
|
||||
guint dropped = 0;
|
||||
guint atlased = 0;
|
||||
|
||||
g_hash_table_iter_init (&iter, self->hash_table);
|
||||
while (g_hash_table_iter_next (&iter, NULL, (gpointer *)&entry))
|
||||
{
|
||||
if (entry->is_atlased)
|
||||
{
|
||||
if (removed && g_ptr_array_find (removed, entry->atlas, NULL))
|
||||
{
|
||||
g_hash_table_iter_remove (&iter);
|
||||
dropped++;
|
||||
}
|
||||
else if (periodic_scan)
|
||||
{
|
||||
gsk_gl_texture_atlas_entry_mark_unused (entry);
|
||||
entry->accessed = FALSE;
|
||||
if (entry->is_atlased)
|
||||
atlased++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!entry->accessed)
|
||||
{
|
||||
gsk_gl_driver_release_texture (self->driver, entry->texture);
|
||||
g_hash_table_iter_remove (&iter);
|
||||
dropped++;
|
||||
}
|
||||
|
||||
if (periodic_scan)
|
||||
entry->accessed = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
GSK_NOTE (GLYPH_CACHE, g_message ("%s: Dropped %d individual items",
|
||||
G_OBJECT_TYPE_NAME (self),
|
||||
dropped);
|
||||
g_message ("%s: %d items cached (%d atlased, %d individually)",
|
||||
G_OBJECT_TYPE_NAME (self),
|
||||
g_hash_table_size (self->hash_table),
|
||||
atlased,
|
||||
g_hash_table_size (self->hash_table) - atlased));
|
||||
|
||||
if (dropped > 0)
|
||||
gsk_gl_texture_library_clear_cache (self);
|
||||
|
||||
ret = TRUE;
|
||||
|
||||
g_clear_pointer (&removed, g_ptr_array_unref);
|
||||
}
|
||||
|
||||
GSK_NOTE (GLYPH_CACHE, {
|
||||
static gint64 last_message;
|
||||
gint64 now = g_get_monotonic_time ();
|
||||
if (now - last_message > G_USEC_PER_SEC)
|
||||
{
|
||||
last_message = now;
|
||||
g_message ("%s contains %d atlases",
|
||||
G_OBJECT_TYPE_NAME (self),
|
||||
self->atlases->len);
|
||||
}
|
||||
});
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gsk_gl_texture_library_real_allocate (GskGLTextureLibrary *self,
|
||||
GskGLTextureAtlas *atlas,
|
||||
int width,
|
||||
int height,
|
||||
int *out_x,
|
||||
int *out_y)
|
||||
{
|
||||
stbrp_rect rect;
|
||||
|
||||
g_assert (GSK_IS_GL_TEXTURE_LIBRARY (self));
|
||||
g_assert (atlas != NULL);
|
||||
g_assert (width > 0);
|
||||
g_assert (height > 0);
|
||||
g_assert (out_x != NULL);
|
||||
g_assert (out_y != NULL);
|
||||
|
||||
rect.w = width;
|
||||
rect.h = height;
|
||||
|
||||
stbrp_pack_rects (&atlas->context, &rect, 1);
|
||||
|
||||
if (rect.was_packed)
|
||||
{
|
||||
*out_x = rect.x;
|
||||
*out_y = rect.y;
|
||||
}
|
||||
|
||||
return rect.was_packed;
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_gl_texture_library_constructed (GObject *object)
|
||||
{
|
||||
@@ -52,6 +198,7 @@ gsk_gl_texture_library_dispose (GObject *object)
|
||||
{
|
||||
GskGLTextureLibrary *self = (GskGLTextureLibrary *)object;
|
||||
|
||||
g_clear_pointer (&self->atlases, g_ptr_array_unref);
|
||||
g_clear_object (&self->driver);
|
||||
|
||||
G_OBJECT_CLASS (gsk_gl_texture_library_parent_class)->dispose (object);
|
||||
@@ -105,6 +252,9 @@ gsk_gl_texture_library_class_init (GskGLTextureLibraryClass *klass)
|
||||
object_class->get_property = gsk_gl_texture_library_get_property;
|
||||
object_class->set_property = gsk_gl_texture_library_set_property;
|
||||
|
||||
klass->compact = gsk_gl_texture_library_real_compact;
|
||||
klass->allocate = gsk_gl_texture_library_real_allocate;
|
||||
|
||||
properties [PROP_DRIVER] =
|
||||
g_param_spec_object ("driver",
|
||||
"Driver",
|
||||
@@ -118,6 +268,10 @@ gsk_gl_texture_library_class_init (GskGLTextureLibraryClass *klass)
|
||||
static void
|
||||
gsk_gl_texture_library_init (GskGLTextureLibrary *self)
|
||||
{
|
||||
self->max_frame_age = DEFAULT_MAX_FRAME_AGE;
|
||||
self->atlas_width = DEFAULT_ATLAS_WIDTH;
|
||||
self->atlas_height = DEFAULT_ATLAS_HEIGHT;
|
||||
self->atlases = g_ptr_array_new_with_free_func ((GDestroyNotify)gsk_gl_texture_atlas_free);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -136,78 +290,14 @@ gsk_gl_texture_library_set_funcs (GskGLTextureLibrary *self,
|
||||
|
||||
void
|
||||
gsk_gl_texture_library_begin_frame (GskGLTextureLibrary *self,
|
||||
gint64 frame_id,
|
||||
GPtrArray *removed_atlases)
|
||||
gint64 frame_id)
|
||||
{
|
||||
GHashTableIter iter;
|
||||
|
||||
g_return_if_fail (GSK_IS_GL_TEXTURE_LIBRARY (self));
|
||||
|
||||
gsk_gl_texture_library_compact (self, frame_id);
|
||||
|
||||
if (GSK_GL_TEXTURE_LIBRARY_GET_CLASS (self)->begin_frame)
|
||||
GSK_GL_TEXTURE_LIBRARY_GET_CLASS (self)->begin_frame (self, frame_id, removed_atlases);
|
||||
|
||||
if (removed_atlases != NULL)
|
||||
{
|
||||
GskGLTextureAtlasEntry *entry;
|
||||
guint dropped = 0;
|
||||
|
||||
g_hash_table_iter_init (&iter, self->hash_table);
|
||||
while (g_hash_table_iter_next (&iter, NULL, (gpointer *)&entry))
|
||||
{
|
||||
if (entry->is_atlased)
|
||||
{
|
||||
for (guint i = 0; i < removed_atlases->len; i++)
|
||||
{
|
||||
GskGLTextureAtlas *atlas = g_ptr_array_index (removed_atlases, i);
|
||||
|
||||
if (atlas == entry->atlas)
|
||||
{
|
||||
g_hash_table_iter_remove (&iter);
|
||||
dropped++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GSK_NOTE (GLYPH_CACHE,
|
||||
if (dropped > 0)
|
||||
g_message ("%s: Dropped %d items",
|
||||
G_OBJECT_TYPE_NAME (self), dropped));
|
||||
}
|
||||
|
||||
if (frame_id % MAX_FRAME_AGE == 0)
|
||||
{
|
||||
GskGLTextureAtlasEntry *entry;
|
||||
int atlased = 0;
|
||||
int dropped = 0;
|
||||
|
||||
g_hash_table_iter_init (&iter, self->hash_table);
|
||||
while (g_hash_table_iter_next (&iter, NULL, (gpointer *)&entry))
|
||||
{
|
||||
if (!entry->is_atlased && !entry->accessed)
|
||||
{
|
||||
gsk_gl_driver_release_texture (self->driver, entry->texture);
|
||||
g_hash_table_iter_remove (&iter);
|
||||
dropped++;
|
||||
continue;
|
||||
}
|
||||
|
||||
gsk_gl_texture_atlas_entry_mark_unused (entry);
|
||||
entry->accessed = FALSE;
|
||||
if (entry->is_atlased)
|
||||
atlased++;
|
||||
}
|
||||
|
||||
GSK_NOTE (GLYPH_CACHE, g_message ("%s: Dropped %d individual items",
|
||||
G_OBJECT_TYPE_NAME (self),
|
||||
dropped);
|
||||
g_message ("%s: %d items cached (%d atlased, %d individually)",
|
||||
G_OBJECT_TYPE_NAME (self),
|
||||
g_hash_table_size (self->hash_table),
|
||||
atlased,
|
||||
g_hash_table_size (self->hash_table) - atlased));
|
||||
}
|
||||
GSK_GL_TEXTURE_LIBRARY_GET_CLASS (self)->begin_frame (self, frame_id);
|
||||
}
|
||||
|
||||
static GskGLTexture *
|
||||
@@ -234,90 +324,29 @@ gsk_gl_texture_library_pack_one (GskGLTextureLibrary *self,
|
||||
return texture;
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
gsk_gl_texture_atlas_pack (GskGLTextureAtlas *self,
|
||||
int width,
|
||||
int height,
|
||||
int *out_x,
|
||||
int *out_y)
|
||||
{
|
||||
stbrp_rect rect;
|
||||
|
||||
rect.w = width;
|
||||
rect.h = height;
|
||||
|
||||
stbrp_pack_rects (&self->context, &rect, 1);
|
||||
|
||||
if (rect.was_packed)
|
||||
{
|
||||
*out_x = rect.x;
|
||||
*out_y = rect.y;
|
||||
}
|
||||
|
||||
return rect.was_packed;
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_gl_texture_atlas_initialize (GskGLDriver *driver,
|
||||
GskGLTextureAtlas *atlas)
|
||||
{
|
||||
/* Insert a single pixel at 0,0 for use in coloring */
|
||||
|
||||
gboolean packed G_GNUC_UNUSED;
|
||||
int x, y;
|
||||
guint gl_format;
|
||||
guint gl_type;
|
||||
guint8 pixel_data[4 * 3 * 3];
|
||||
|
||||
gdk_gl_context_push_debug_group_printf (gdk_gl_context_get_current (),
|
||||
"Initializing Atlas");
|
||||
|
||||
packed = gsk_gl_texture_atlas_pack (atlas, 3, 3, &x, &y);
|
||||
g_assert (packed);
|
||||
g_assert (x == 0 && y == 0);
|
||||
|
||||
memset (pixel_data, 255, sizeof pixel_data);
|
||||
|
||||
if (gdk_gl_context_get_use_es (gdk_gl_context_get_current ()))
|
||||
{
|
||||
gl_format = GL_RGBA;
|
||||
gl_type = GL_UNSIGNED_BYTE;
|
||||
}
|
||||
else
|
||||
{
|
||||
gl_format = GL_BGRA;
|
||||
gl_type = GL_UNSIGNED_INT_8_8_8_8_REV;
|
||||
}
|
||||
|
||||
glBindTexture (GL_TEXTURE_2D, atlas->texture_id);
|
||||
|
||||
glTexSubImage2D (GL_TEXTURE_2D, 0,
|
||||
0, 0,
|
||||
3, 3,
|
||||
gl_format, gl_type,
|
||||
pixel_data);
|
||||
|
||||
gdk_gl_context_pop_debug_group (gdk_gl_context_get_current ());
|
||||
|
||||
driver->command_queue->n_uploads++;
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_gl_texture_atlases_pack (GskGLDriver *driver,
|
||||
int width,
|
||||
int height,
|
||||
GskGLTextureAtlas **out_atlas,
|
||||
int *out_x,
|
||||
int *out_y)
|
||||
gsk_gl_texture_library_pack_any_atlas (GskGLTextureLibrary *self,
|
||||
int width,
|
||||
int height,
|
||||
GskGLTextureAtlas **out_atlas,
|
||||
int *out_x,
|
||||
int *out_y)
|
||||
{
|
||||
GskGLTextureAtlas *atlas = NULL;
|
||||
int x, y;
|
||||
|
||||
for (guint i = 0; i < driver->atlases->len; i++)
|
||||
{
|
||||
atlas = g_ptr_array_index (driver->atlases, i);
|
||||
g_assert (GSK_IS_GL_TEXTURE_LIBRARY (self));
|
||||
g_assert (width > 0);
|
||||
g_assert (height > 0);
|
||||
g_assert (out_atlas != NULL);
|
||||
g_assert (out_x != NULL);
|
||||
g_assert (out_y != NULL);
|
||||
|
||||
if (gsk_gl_texture_atlas_pack (atlas, width, height, &x, &y))
|
||||
for (guint i = 0; i < self->atlases->len; i++)
|
||||
{
|
||||
atlas = g_ptr_array_index (self->atlases, i);
|
||||
|
||||
if (gsk_gl_texture_library_allocate (self, atlas, width, height, &x, &y))
|
||||
break;
|
||||
|
||||
atlas = NULL;
|
||||
@@ -326,12 +355,10 @@ gsk_gl_texture_atlases_pack (GskGLDriver *driver,
|
||||
if (atlas == NULL)
|
||||
{
|
||||
/* No atlas has enough space, so create a new one... */
|
||||
atlas = gsk_gl_driver_create_atlas (driver);
|
||||
|
||||
gsk_gl_texture_atlas_initialize (driver, atlas);
|
||||
atlas = gsk_gl_texture_library_acquire_atlas (self);
|
||||
|
||||
/* Pack it onto that one, which surely has enough space... */
|
||||
if (!gsk_gl_texture_atlas_pack (atlas, width, height, &x, &y))
|
||||
if (!gsk_gl_texture_library_allocate (self, atlas, width, height, &x, &y))
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
@@ -380,17 +407,19 @@ gsk_gl_texture_library_pack (GskGLTextureLibrary *self,
|
||||
*out_packed_x = 0;
|
||||
*out_packed_y = 0;
|
||||
}
|
||||
else if (width <= self->max_entry_size && height <= self->max_entry_size)
|
||||
else if (self->max_entry_size == 0 ||
|
||||
(width <= self->max_entry_size &&
|
||||
height <= self->max_entry_size))
|
||||
{
|
||||
int packed_x;
|
||||
int packed_y;
|
||||
|
||||
gsk_gl_texture_atlases_pack (self->driver,
|
||||
padding + width + padding,
|
||||
padding + height + padding,
|
||||
&atlas,
|
||||
&packed_x,
|
||||
&packed_y);
|
||||
gsk_gl_texture_library_pack_any_atlas (self,
|
||||
padding + width + padding,
|
||||
padding + height + padding,
|
||||
&atlas,
|
||||
&packed_x,
|
||||
&packed_y);
|
||||
|
||||
entry->atlas = atlas;
|
||||
entry->is_atlased = TRUE;
|
||||
@@ -424,3 +453,134 @@ gsk_gl_texture_library_pack (GskGLTextureLibrary *self,
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
/*
|
||||
* gsk_gl_texture_library_clear_cache:
|
||||
*
|
||||
* Clear the front cache if the texture library is using one. For
|
||||
* example the glyph cache would drop it's front cache to force
|
||||
* next lookups to fall through to the GHashTable key lookup.
|
||||
*/
|
||||
void
|
||||
gsk_gl_texture_library_clear_cache (GskGLTextureLibrary *self)
|
||||
{
|
||||
g_return_if_fail (GSK_IS_GL_TEXTURE_LIBRARY (self));
|
||||
|
||||
if (GSK_GL_TEXTURE_LIBRARY_GET_CLASS (self)->clear_cache)
|
||||
GSK_GL_TEXTURE_LIBRARY_GET_CLASS (self)->clear_cache (self);
|
||||
}
|
||||
|
||||
/*
|
||||
* gsk_gl_texture_library_compact:
|
||||
*
|
||||
* Requests that the texture library compact it's altases. That
|
||||
* generally means to traverse them to look for unused pixels over
|
||||
* a certain threshold and release them if necessary.
|
||||
*
|
||||
* Returns: %TRUE if any compaction occurred.
|
||||
*/
|
||||
gboolean
|
||||
gsk_gl_texture_library_compact (GskGLTextureLibrary *self,
|
||||
gint64 frame_id)
|
||||
{
|
||||
g_return_val_if_fail (GSK_IS_GL_TEXTURE_LIBRARY (self), FALSE);
|
||||
|
||||
if (GSK_GL_TEXTURE_LIBRARY_GET_CLASS (self)->compact)
|
||||
return GSK_GL_TEXTURE_LIBRARY_GET_CLASS (self)->compact (self, frame_id);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
gsk_gl_texture_library_reset (GskGLTextureLibrary *self)
|
||||
{
|
||||
g_return_if_fail (GSK_IS_GL_TEXTURE_LIBRARY (self));
|
||||
|
||||
gsk_gl_texture_library_clear_cache (self);
|
||||
|
||||
g_hash_table_remove_all (self->hash_table);
|
||||
|
||||
if (self->atlases->len)
|
||||
g_ptr_array_remove_range (self->atlases, 0, self->atlases->len);
|
||||
}
|
||||
|
||||
void
|
||||
gsk_gl_texture_library_set_atlas_size (GskGLTextureLibrary *self,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
g_return_if_fail (GSK_IS_GL_TEXTURE_LIBRARY (self));
|
||||
|
||||
if (width <= 0)
|
||||
width = DEFAULT_ATLAS_WIDTH;
|
||||
|
||||
if (height <= 0)
|
||||
height = DEFAULT_ATLAS_HEIGHT;
|
||||
|
||||
self->atlas_height = height;
|
||||
self->atlas_width = width;
|
||||
|
||||
gsk_gl_texture_library_reset (self);
|
||||
}
|
||||
|
||||
/*
|
||||
* gsk_gl_texture_library_acquire_atlas:
|
||||
*
|
||||
* Allocates a new texture atlas based on the current size
|
||||
* and format requirements.
|
||||
*/
|
||||
GskGLTextureAtlas *
|
||||
gsk_gl_texture_library_acquire_atlas (GskGLTextureLibrary *self)
|
||||
{
|
||||
GskGLTextureAtlas *atlas;
|
||||
|
||||
g_return_val_if_fail (GSK_IS_GL_TEXTURE_LIBRARY (self), NULL);
|
||||
g_return_val_if_fail (GSK_IS_GL_DRIVER (self->driver), NULL);
|
||||
g_return_val_if_fail (GSK_IS_GL_COMMAND_QUEUE (self->driver->command_queue), NULL);
|
||||
g_return_val_if_fail (self->atlas_width > 0, NULL);
|
||||
g_return_val_if_fail (self->atlas_height > 0, NULL);
|
||||
|
||||
atlas = g_slice_new0 (GskGLTextureAtlas);
|
||||
atlas->width = self->atlas_width;
|
||||
atlas->height = self->atlas_height;
|
||||
/* TODO: We might want to change the strategy about the amount of
|
||||
* nodes here? stb_rect_pack.h says width is optimal. */
|
||||
atlas->nodes = g_malloc0_n (atlas->width, sizeof (struct stbrp_node));
|
||||
stbrp_init_target (&atlas->context, atlas->width, atlas->height, atlas->nodes, atlas->width);
|
||||
atlas->texture_id = gsk_gl_command_queue_create_texture (self->driver->command_queue,
|
||||
atlas->width,
|
||||
atlas->height,
|
||||
GL_RGBA8,
|
||||
GL_LINEAR,
|
||||
GL_LINEAR);
|
||||
|
||||
gdk_gl_context_label_object_printf (gdk_gl_context_get_current (),
|
||||
GL_TEXTURE, atlas->texture_id,
|
||||
"Texture atlas %d",
|
||||
atlas->texture_id);
|
||||
|
||||
g_ptr_array_add (self->atlases, atlas);
|
||||
|
||||
if (GSK_GL_TEXTURE_LIBRARY_GET_CLASS (self)->init_atlas)
|
||||
GSK_GL_TEXTURE_LIBRARY_GET_CLASS (self)->init_atlas (self, atlas);
|
||||
|
||||
return atlas;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gsk_gl_texture_library_allocate (GskGLTextureLibrary *self,
|
||||
GskGLTextureAtlas *atlas,
|
||||
int width,
|
||||
int height,
|
||||
int *out_x,
|
||||
int *out_y)
|
||||
{
|
||||
g_assert (GSK_IS_GL_TEXTURE_LIBRARY (self));
|
||||
g_assert (atlas != NULL);
|
||||
g_assert (width > 0);
|
||||
g_assert (height > 0);
|
||||
g_assert (out_x != NULL);
|
||||
g_assert (out_y != NULL);
|
||||
|
||||
return GSK_GL_TEXTURE_LIBRARY_GET_CLASS (self)->allocate (self, atlas, width, height, out_x, out_y);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,6 @@ typedef struct _GskGLTextureAtlas
|
||||
*/
|
||||
int unused_pixels;
|
||||
|
||||
void *user_data;
|
||||
} GskGLTextureAtlas;
|
||||
|
||||
typedef struct _GskGLTextureAtlasEntry
|
||||
@@ -89,40 +88,67 @@ typedef struct _GskGLTextureAtlasEntry
|
||||
|
||||
typedef struct _GskGLTextureLibrary
|
||||
{
|
||||
GObject parent_instance;
|
||||
GObject parent_instance;
|
||||
GskGLDriver *driver;
|
||||
GHashTable *hash_table;
|
||||
guint max_entry_size;
|
||||
GPtrArray *atlases;
|
||||
GHashTable *hash_table;
|
||||
guint max_entry_size;
|
||||
guint max_frame_age;
|
||||
guint atlas_width;
|
||||
guint atlas_height;
|
||||
} GskGLTextureLibrary;
|
||||
|
||||
typedef struct _GskGLTextureLibraryClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
|
||||
void (*begin_frame) (GskGLTextureLibrary *library,
|
||||
gint64 frame_id,
|
||||
GPtrArray *removed_atlases);
|
||||
void (*begin_frame) (GskGLTextureLibrary *library,
|
||||
gint64 frame_id);
|
||||
gboolean (*compact) (GskGLTextureLibrary *library,
|
||||
gint64 frame_id);
|
||||
void (*clear_cache) (GskGLTextureLibrary *library);
|
||||
void (*init_atlas) (GskGLTextureLibrary *library,
|
||||
GskGLTextureAtlas *atlas);
|
||||
gboolean (*allocate) (GskGLTextureLibrary *library,
|
||||
GskGLTextureAtlas *atlas,
|
||||
int width,
|
||||
int height,
|
||||
int *out_x,
|
||||
int *out_y);
|
||||
} GskGLTextureLibraryClass;
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GskGLTextureLibrary, g_object_unref)
|
||||
|
||||
GType gsk_gl_texture_library_get_type (void) G_GNUC_CONST;
|
||||
void gsk_gl_texture_library_set_funcs (GskGLTextureLibrary *self,
|
||||
GHashFunc hash_func,
|
||||
GEqualFunc equal_func,
|
||||
GDestroyNotify key_destroy,
|
||||
GDestroyNotify value_destroy);
|
||||
void gsk_gl_texture_library_begin_frame (GskGLTextureLibrary *self,
|
||||
gint64 frame_id,
|
||||
GPtrArray *removed_atlases);
|
||||
gpointer gsk_gl_texture_library_pack (GskGLTextureLibrary *self,
|
||||
gpointer key,
|
||||
gsize valuelen,
|
||||
guint width,
|
||||
guint height,
|
||||
int padding,
|
||||
guint *out_packed_x,
|
||||
guint *out_packed_y);
|
||||
GType gsk_gl_texture_library_get_type (void) G_GNUC_CONST;
|
||||
gboolean gsk_gl_texture_library_compact (GskGLTextureLibrary *self,
|
||||
gint64 frame_id);
|
||||
void gsk_gl_texture_library_clear_cache (GskGLTextureLibrary *self);
|
||||
void gsk_gl_texture_library_reset (GskGLTextureLibrary *self);
|
||||
void gsk_gl_texture_library_set_atlas_size (GskGLTextureLibrary *self,
|
||||
int width,
|
||||
int height);
|
||||
GskGLTextureAtlas *gsk_gl_texture_library_acquire_atlas (GskGLTextureLibrary *self);
|
||||
void gsk_gl_texture_library_set_funcs (GskGLTextureLibrary *self,
|
||||
GHashFunc hash_func,
|
||||
GEqualFunc equal_func,
|
||||
GDestroyNotify key_destroy,
|
||||
GDestroyNotify value_destroy);
|
||||
void gsk_gl_texture_library_begin_frame (GskGLTextureLibrary *self,
|
||||
gint64 frame_id);
|
||||
gboolean gsk_gl_texture_library_allocate (GskGLTextureLibrary *self,
|
||||
GskGLTextureAtlas *atlas,
|
||||
int width,
|
||||
int height,
|
||||
int *out_x,
|
||||
int *out_y);
|
||||
gpointer gsk_gl_texture_library_pack (GskGLTextureLibrary *self,
|
||||
gpointer key,
|
||||
gsize valuelen,
|
||||
guint width,
|
||||
guint height,
|
||||
int padding,
|
||||
guint *out_packed_x,
|
||||
guint *out_packed_y);
|
||||
|
||||
static inline void
|
||||
gsk_gl_texture_atlas_mark_unused (GskGLTextureAtlas *self,
|
||||
|
||||
+16
-3
@@ -58,14 +58,14 @@ value_render_node_init (GValue *value)
|
||||
{
|
||||
value->data[0].v_pointer = NULL;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
value_render_node_free_value (GValue *value)
|
||||
{
|
||||
if (value->data[0].v_pointer != NULL)
|
||||
gsk_render_node_unref (value->data[0].v_pointer);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
value_render_node_copy_value (const GValue *src,
|
||||
GValue *dst)
|
||||
@@ -75,7 +75,7 @@ value_render_node_copy_value (const GValue *src,
|
||||
else
|
||||
dst->data[0].v_pointer = NULL;
|
||||
}
|
||||
|
||||
|
||||
static gpointer
|
||||
value_render_node_peek_pointer (const GValue *value)
|
||||
{
|
||||
@@ -738,3 +738,16 @@ gsk_render_node_prefers_high_depth (const GskRenderNode *node)
|
||||
{
|
||||
return node->prefers_high_depth;
|
||||
}
|
||||
|
||||
/* Whether we need an offscreen to handle opacity correctly for this node.
|
||||
* We don't if there is only one drawing node inside (could be child
|
||||
* node, or grandchild, or...).
|
||||
*
|
||||
* For containers with multiple children, we can avoid the offscreen if
|
||||
* the children are known not to overlap.
|
||||
*/
|
||||
gboolean
|
||||
gsk_render_node_use_offscreen_for_opacity (const GskRenderNode *node)
|
||||
{
|
||||
return node->offscreen_for_opacity;
|
||||
}
|
||||
|
||||
@@ -139,6 +139,7 @@ gsk_color_node_new (const GdkRGBA *rgba,
|
||||
|
||||
self = gsk_render_node_alloc (GSK_COLOR_NODE);
|
||||
node = (GskRenderNode *) self;
|
||||
node->offscreen_for_opacity = FALSE;
|
||||
|
||||
self->color = *rgba;
|
||||
graphene_rect_init_from_rect (&node->bounds, bounds);
|
||||
@@ -284,6 +285,7 @@ gsk_linear_gradient_node_new (const graphene_rect_t *bounds,
|
||||
|
||||
self = gsk_render_node_alloc (GSK_LINEAR_GRADIENT_NODE);
|
||||
node = (GskRenderNode *) self;
|
||||
node->offscreen_for_opacity = FALSE;
|
||||
|
||||
graphene_rect_init_from_rect (&node->bounds, bounds);
|
||||
graphene_point_init_from_point (&self->start, start);
|
||||
@@ -336,6 +338,7 @@ gsk_repeating_linear_gradient_node_new (const graphene_rect_t *bounds,
|
||||
|
||||
self = gsk_render_node_alloc (GSK_REPEATING_LINEAR_GRADIENT_NODE);
|
||||
node = (GskRenderNode *) self;
|
||||
node->offscreen_for_opacity = FALSE;
|
||||
|
||||
graphene_rect_init_from_rect (&node->bounds, bounds);
|
||||
graphene_point_init_from_point (&self->start, start);
|
||||
@@ -584,6 +587,7 @@ gsk_radial_gradient_node_new (const graphene_rect_t *bounds,
|
||||
|
||||
self = gsk_render_node_alloc (GSK_RADIAL_GRADIENT_NODE);
|
||||
node = (GskRenderNode *) self;
|
||||
node->offscreen_for_opacity = FALSE;
|
||||
|
||||
graphene_rect_init_from_rect (&node->bounds, bounds);
|
||||
graphene_point_init_from_point (&self->center, center);
|
||||
@@ -652,6 +656,7 @@ gsk_repeating_radial_gradient_node_new (const graphene_rect_t *bounds,
|
||||
|
||||
self = gsk_render_node_alloc (GSK_REPEATING_RADIAL_GRADIENT_NODE);
|
||||
node = (GskRenderNode *) self;
|
||||
node->offscreen_for_opacity = FALSE;
|
||||
|
||||
graphene_rect_init_from_rect (&node->bounds, bounds);
|
||||
graphene_point_init_from_point (&self->center, center);
|
||||
@@ -1030,6 +1035,7 @@ gsk_conic_gradient_node_new (const graphene_rect_t *bounds,
|
||||
|
||||
self = gsk_render_node_alloc (GSK_CONIC_GRADIENT_NODE);
|
||||
node = (GskRenderNode *) self;
|
||||
node->offscreen_for_opacity = FALSE;
|
||||
|
||||
graphene_rect_init_from_rect (&node->bounds, bounds);
|
||||
graphene_point_init_from_point (&self->center, center);
|
||||
@@ -1413,6 +1419,7 @@ gsk_border_node_new (const GskRoundedRect *outline,
|
||||
|
||||
self = gsk_render_node_alloc (GSK_BORDER_NODE);
|
||||
node = (GskRenderNode *) self;
|
||||
node->offscreen_for_opacity = FALSE;
|
||||
|
||||
gsk_rounded_rect_init_copy (&self->outline, outline);
|
||||
memcpy (self->border_width, border_width, sizeof (self->border_width));
|
||||
@@ -1559,6 +1566,7 @@ gsk_texture_node_new (GdkTexture *texture,
|
||||
|
||||
self = gsk_render_node_alloc (GSK_TEXTURE_NODE);
|
||||
node = (GskRenderNode *) self;
|
||||
node->offscreen_for_opacity = FALSE;
|
||||
|
||||
self->texture = g_object_ref (texture);
|
||||
graphene_rect_init_from_rect (&node->bounds, bounds);
|
||||
@@ -2014,6 +2022,7 @@ gsk_inset_shadow_node_new (const GskRoundedRect *outline,
|
||||
|
||||
self = gsk_render_node_alloc (GSK_INSET_SHADOW_NODE);
|
||||
node = (GskRenderNode *) self;
|
||||
node->offscreen_for_opacity = FALSE;
|
||||
|
||||
gsk_rounded_rect_init_copy (&self->outline, outline);
|
||||
self->color = *color;
|
||||
@@ -2313,6 +2322,7 @@ gsk_outset_shadow_node_new (const GskRoundedRect *outline,
|
||||
|
||||
self = gsk_render_node_alloc (GSK_OUTSET_SHADOW_NODE);
|
||||
node = (GskRenderNode *) self;
|
||||
node->offscreen_for_opacity = FALSE;
|
||||
|
||||
gsk_rounded_rect_init_copy (&self->outline, outline);
|
||||
self->color = *color;
|
||||
@@ -2506,6 +2516,7 @@ gsk_cairo_node_new (const graphene_rect_t *bounds)
|
||||
|
||||
self = gsk_render_node_alloc (GSK_CAIRO_NODE);
|
||||
node = (GskRenderNode *) self;
|
||||
node->offscreen_for_opacity = FALSE;
|
||||
|
||||
graphene_rect_init_from_rect (&node->bounds, bounds);
|
||||
|
||||
@@ -2576,6 +2587,7 @@ struct _GskContainerNode
|
||||
{
|
||||
GskRenderNode render_node;
|
||||
|
||||
gboolean disjoint;
|
||||
guint n_children;
|
||||
GskRenderNode **children;
|
||||
};
|
||||
@@ -2724,6 +2736,7 @@ gsk_container_node_new (GskRenderNode **children,
|
||||
self = gsk_render_node_alloc (GSK_CONTAINER_NODE);
|
||||
node = (GskRenderNode *) self;
|
||||
|
||||
self->disjoint = TRUE;
|
||||
self->n_children = n_children;
|
||||
|
||||
if (n_children == 0)
|
||||
@@ -2743,11 +2756,14 @@ gsk_container_node_new (GskRenderNode **children,
|
||||
for (guint i = 1; i < n_children; i++)
|
||||
{
|
||||
self->children[i] = gsk_render_node_ref (children[i]);
|
||||
self->disjoint &= !graphene_rect_intersection (&bounds, &(children[i]->bounds), NULL);
|
||||
graphene_rect_union (&bounds, &(children[i]->bounds), &bounds);
|
||||
node->prefers_high_depth |= gsk_render_node_prefers_high_depth (children[i]);
|
||||
node->offscreen_for_opacity |= children[i]->offscreen_for_opacity;
|
||||
}
|
||||
|
||||
graphene_rect_init_from_rect (&node->bounds, &bounds);
|
||||
node->offscreen_for_opacity |= !self->disjoint;
|
||||
}
|
||||
|
||||
return node;
|
||||
@@ -2801,6 +2817,24 @@ gsk_container_node_get_children (const GskRenderNode *node,
|
||||
return self->children;
|
||||
}
|
||||
|
||||
/*< private>
|
||||
* gsk_container_node_is_disjoint:
|
||||
* @node: a container `GskRenderNode`
|
||||
*
|
||||
* Returns `TRUE` if it is known that the child nodes are not
|
||||
* overlapping. There is no guarantee that they do overlap
|
||||
* if this function return FALSE.
|
||||
*
|
||||
* Returns: `TRUE` if children don't overlap
|
||||
*/
|
||||
gboolean
|
||||
gsk_container_node_is_disjoint (const GskRenderNode *node)
|
||||
{
|
||||
const GskContainerNode *self = (const GskContainerNode *) node;
|
||||
|
||||
return self->disjoint;
|
||||
}
|
||||
|
||||
/*** GSK_TRANSFORM_NODE ***/
|
||||
|
||||
/**
|
||||
@@ -2962,6 +2996,7 @@ gsk_transform_node_new (GskRenderNode *child,
|
||||
|
||||
self = gsk_render_node_alloc (GSK_TRANSFORM_NODE);
|
||||
node = (GskRenderNode *) self;
|
||||
node->offscreen_for_opacity = child->offscreen_for_opacity;
|
||||
|
||||
self->child = gsk_render_node_ref (child);
|
||||
self->transform = gsk_transform_ref (transform);
|
||||
@@ -3106,6 +3141,7 @@ gsk_opacity_node_new (GskRenderNode *child,
|
||||
|
||||
self = gsk_render_node_alloc (GSK_OPACITY_NODE);
|
||||
node = (GskRenderNode *) self;
|
||||
node->offscreen_for_opacity = child->offscreen_for_opacity;
|
||||
|
||||
self->child = gsk_render_node_ref (child);
|
||||
self->opacity = CLAMP (opacity, 0.0, 1.0);
|
||||
@@ -3309,6 +3345,7 @@ gsk_color_matrix_node_new (GskRenderNode *child,
|
||||
|
||||
self = gsk_render_node_alloc (GSK_COLOR_MATRIX_NODE);
|
||||
node = (GskRenderNode *) self;
|
||||
node->offscreen_for_opacity = child->offscreen_for_opacity;
|
||||
|
||||
self->child = gsk_render_node_ref (child);
|
||||
graphene_matrix_init_from_matrix (&self->color_matrix, color_matrix);
|
||||
@@ -3457,6 +3494,7 @@ gsk_repeat_node_new (const graphene_rect_t *bounds,
|
||||
|
||||
self = gsk_render_node_alloc (GSK_REPEAT_NODE);
|
||||
node = (GskRenderNode *) self;
|
||||
node->offscreen_for_opacity = TRUE;
|
||||
|
||||
graphene_rect_init_from_rect (&node->bounds, bounds);
|
||||
|
||||
@@ -3594,6 +3632,7 @@ gsk_clip_node_new (GskRenderNode *child,
|
||||
|
||||
self = gsk_render_node_alloc (GSK_CLIP_NODE);
|
||||
node = (GskRenderNode *) self;
|
||||
node->offscreen_for_opacity = child->offscreen_for_opacity;
|
||||
|
||||
self->child = gsk_render_node_ref (child);
|
||||
graphene_rect_normalize_r (clip, &self->clip);
|
||||
@@ -3727,6 +3766,7 @@ gsk_rounded_clip_node_new (GskRenderNode *child,
|
||||
|
||||
self = gsk_render_node_alloc (GSK_ROUNDED_CLIP_NODE);
|
||||
node = (GskRenderNode *) self;
|
||||
node->offscreen_for_opacity = child->offscreen_for_opacity;
|
||||
|
||||
self->child = gsk_render_node_ref (child);
|
||||
gsk_rounded_rect_init_copy (&self->clip, clip);
|
||||
@@ -3946,6 +3986,7 @@ gsk_shadow_node_new (GskRenderNode *child,
|
||||
|
||||
self = gsk_render_node_alloc (GSK_SHADOW_NODE);
|
||||
node = (GskRenderNode *) self;
|
||||
node->offscreen_for_opacity = child->offscreen_for_opacity;
|
||||
|
||||
self->child = gsk_render_node_ref (child);
|
||||
self->n_shadows = n_shadows;
|
||||
@@ -4142,6 +4183,7 @@ gsk_blend_node_new (GskRenderNode *bottom,
|
||||
|
||||
self = gsk_render_node_alloc (GSK_BLEND_NODE);
|
||||
node = (GskRenderNode *) self;
|
||||
node->offscreen_for_opacity = TRUE;
|
||||
|
||||
self->bottom = gsk_render_node_ref (bottom);
|
||||
self->top = gsk_render_node_ref (top);
|
||||
@@ -4292,6 +4334,7 @@ gsk_cross_fade_node_new (GskRenderNode *start,
|
||||
|
||||
self = gsk_render_node_alloc (GSK_CROSS_FADE_NODE);
|
||||
node = (GskRenderNode *) self;
|
||||
node->offscreen_for_opacity = TRUE;
|
||||
|
||||
self->start = gsk_render_node_ref (start);
|
||||
self->end = gsk_render_node_ref (end);
|
||||
@@ -4478,6 +4521,7 @@ gsk_text_node_new (PangoFont *font,
|
||||
|
||||
self = gsk_render_node_alloc (GSK_TEXT_NODE);
|
||||
node = (GskRenderNode *) self;
|
||||
node->offscreen_for_opacity = FALSE;
|
||||
|
||||
self->font = g_object_ref (font);
|
||||
self->color = *color;
|
||||
@@ -4884,6 +4928,7 @@ gsk_blur_node_new (GskRenderNode *child,
|
||||
|
||||
self = gsk_render_node_alloc (GSK_BLUR_NODE);
|
||||
node = (GskRenderNode *) self;
|
||||
node->offscreen_for_opacity = child->offscreen_for_opacity;
|
||||
|
||||
self->child = gsk_render_node_ref (child);
|
||||
self->radius = radius;
|
||||
@@ -5013,6 +5058,7 @@ gsk_debug_node_new (GskRenderNode *child,
|
||||
|
||||
self = gsk_render_node_alloc (GSK_DEBUG_NODE);
|
||||
node = (GskRenderNode *) self;
|
||||
node->offscreen_for_opacity = child->offscreen_for_opacity;
|
||||
|
||||
self->child = gsk_render_node_ref (child);
|
||||
self->message = message;
|
||||
@@ -5174,6 +5220,7 @@ gsk_gl_shader_node_new (GskGLShader *shader,
|
||||
|
||||
self = gsk_render_node_alloc (GSK_GL_SHADER_NODE);
|
||||
node = (GskRenderNode *) self;
|
||||
node->offscreen_for_opacity = TRUE;
|
||||
|
||||
graphene_rect_init_from_rect (&node->bounds, bounds);
|
||||
self->shader = g_object_ref (shader);
|
||||
|
||||
@@ -29,6 +29,7 @@ struct _GskRenderNode
|
||||
graphene_rect_t bounds;
|
||||
|
||||
guint prefers_high_depth : 1;
|
||||
guint offscreen_for_opacity : 1;
|
||||
};
|
||||
|
||||
struct _GskRenderNodeClass
|
||||
@@ -113,6 +114,10 @@ void gsk_transform_node_get_translate (const GskRenderNode *no
|
||||
float *dy);
|
||||
gboolean gsk_render_node_prefers_high_depth (const GskRenderNode *node);
|
||||
|
||||
gboolean gsk_container_node_is_disjoint (const GskRenderNode *node);
|
||||
|
||||
gboolean gsk_render_node_use_offscreen_for_opacity (const GskRenderNode *node);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -285,14 +285,6 @@
|
||||
...
|
||||
fun:g_intern_static_string
|
||||
}
|
||||
{
|
||||
glib GQuark
|
||||
Memcheck:Leak
|
||||
match-leak-kinds: definite
|
||||
fun:malloc
|
||||
...
|
||||
fun:g_intern_string
|
||||
}
|
||||
|
||||
# Threads
|
||||
{
|
||||
|
||||
+14
-24
@@ -436,11 +436,7 @@ get_parent_context_ref (GtkAccessible *accessible)
|
||||
gtk_accessible_get_at_context (GTK_ACCESSIBLE (parent));
|
||||
|
||||
if (parent_context != NULL)
|
||||
{
|
||||
gtk_at_context_realize (parent_context);
|
||||
|
||||
res = gtk_at_spi_context_to_ref (GTK_AT_SPI_CONTEXT (parent_context));
|
||||
}
|
||||
res = gtk_at_spi_context_to_ref (GTK_AT_SPI_CONTEXT (parent_context));
|
||||
}
|
||||
|
||||
if (res == NULL)
|
||||
@@ -1422,7 +1418,7 @@ gtk_at_spi_context_unregister_object (GtkAtSpiContext *self)
|
||||
g_clear_pointer (&self->interfaces, g_variant_unref);
|
||||
}
|
||||
/* }}} */
|
||||
/* {{{ GObject boilerplate */
|
||||
/* {{{ GObject boilerplate */
|
||||
static void
|
||||
gtk_at_spi_context_finalize (GObject *gobject)
|
||||
{
|
||||
@@ -1447,22 +1443,6 @@ gtk_at_spi_context_constructed (GObject *gobject)
|
||||
|
||||
static const char *get_bus_address (GdkDisplay *display);
|
||||
|
||||
static void
|
||||
register_object (GtkAtSpiRoot *root,
|
||||
GtkAtSpiContext *context)
|
||||
{
|
||||
GtkAccessible *accessible = gtk_at_context_get_accessible (GTK_AT_CONTEXT (context));
|
||||
|
||||
gtk_atspi_connect_text_signals (accessible,
|
||||
(GtkAtspiTextChangedCallback *)emit_text_changed,
|
||||
(GtkAtspiTextSelectionCallback *)emit_text_selection_changed,
|
||||
context);
|
||||
gtk_atspi_connect_selection_signals (accessible,
|
||||
(GtkAtspiSelectionCallback *)emit_selection_changed,
|
||||
context);
|
||||
gtk_at_spi_context_register_object (context);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_at_spi_context_realize (GtkATContext *context)
|
||||
{
|
||||
@@ -1509,10 +1489,11 @@ gtk_at_spi_context_realize (GtkATContext *context)
|
||||
if (self->connection == NULL)
|
||||
return;
|
||||
|
||||
GtkAccessible *accessible = gtk_at_context_get_accessible (context);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GTK_DEBUG_CHECK (A11Y))
|
||||
{
|
||||
GtkAccessible *accessible = gtk_at_context_get_accessible (context);
|
||||
GtkAccessibleRole role = gtk_at_context_get_accessible_role (context);
|
||||
char *role_name = g_enum_to_string (GTK_TYPE_ACCESSIBLE_ROLE, role);
|
||||
g_message ("Realizing ATSPI context “%s” for accessible “%s”, with role: “%s”",
|
||||
@@ -1523,7 +1504,16 @@ gtk_at_spi_context_realize (GtkATContext *context)
|
||||
}
|
||||
#endif
|
||||
|
||||
gtk_at_spi_root_queue_register (self->root, self, register_object);
|
||||
gtk_atspi_connect_text_signals (accessible,
|
||||
(GtkAtspiTextChangedCallback *)emit_text_changed,
|
||||
(GtkAtspiTextSelectionCallback *)emit_text_selection_changed,
|
||||
self);
|
||||
gtk_atspi_connect_selection_signals (accessible,
|
||||
(GtkAtspiSelectionCallback *)emit_selection_changed,
|
||||
self);
|
||||
gtk_at_spi_context_register_object (self);
|
||||
|
||||
gtk_at_spi_root_queue_register (self->root, self);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
+10
-36
@@ -106,7 +106,6 @@ gtk_at_spi_root_dispose (GObject *gobject)
|
||||
|
||||
g_clear_object (&self->cache);
|
||||
g_clear_object (&self->connection);
|
||||
g_clear_pointer (&self->queued_contexts, g_list_free);
|
||||
|
||||
G_OBJECT_CLASS (gtk_at_spi_root_parent_class)->dispose (gobject);
|
||||
}
|
||||
@@ -475,24 +474,16 @@ gtk_at_spi_root_child_changed (GtkAtSpiRoot *self,
|
||||
window_ref);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
GtkAtSpiRoot *root;
|
||||
GtkAtSpiRootRegisterFunc register_func;
|
||||
} RegistrationData;
|
||||
|
||||
static void
|
||||
on_registration_reply (GObject *gobject,
|
||||
GAsyncResult *result,
|
||||
gpointer user_data)
|
||||
{
|
||||
RegistrationData *data = user_data;
|
||||
GtkAtSpiRoot *self = data->root;
|
||||
GtkAtSpiRoot *self = user_data;
|
||||
|
||||
GError *error = NULL;
|
||||
GVariant *reply = g_dbus_connection_call_finish (G_DBUS_CONNECTION (gobject), result, &error);
|
||||
|
||||
self->register_id = 0;
|
||||
|
||||
if (error != NULL)
|
||||
{
|
||||
g_critical ("Unable to register the application: %s", error->message);
|
||||
@@ -518,28 +509,19 @@ on_registration_reply (GObject *gobject,
|
||||
/* Drain the list of queued GtkAtSpiContexts, and add them to the cache */
|
||||
if (self->queued_contexts != NULL)
|
||||
{
|
||||
self->queued_contexts = g_list_reverse (self->queued_contexts);
|
||||
for (GList *l = self->queued_contexts; l != NULL; l = l->next)
|
||||
{
|
||||
if (data->register_func != NULL)
|
||||
data->register_func (self, l->data);
|
||||
|
||||
gtk_at_spi_cache_add_context (self->cache, l->data);
|
||||
}
|
||||
gtk_at_spi_cache_add_context (self->cache, l->data);
|
||||
|
||||
g_clear_pointer (&self->queued_contexts, g_list_free);
|
||||
}
|
||||
|
||||
self->toplevels = gtk_window_get_toplevels ();
|
||||
|
||||
g_free (data);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
root_register (gpointer user_data)
|
||||
root_register (gpointer data)
|
||||
{
|
||||
RegistrationData *data = user_data;
|
||||
GtkAtSpiRoot *self = data->root;
|
||||
GtkAtSpiRoot *self = data;
|
||||
const char *unique_name;
|
||||
|
||||
/* Register the root element; every application has a single root, so we only
|
||||
@@ -595,7 +577,9 @@ root_register (gpointer user_data)
|
||||
G_DBUS_CALL_FLAGS_NONE, -1,
|
||||
NULL,
|
||||
on_registration_reply,
|
||||
data);
|
||||
self);
|
||||
|
||||
self->register_id = 0;
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
@@ -603,24 +587,18 @@ root_register (gpointer user_data)
|
||||
/*< private >
|
||||
* gtk_at_spi_root_queue_register:
|
||||
* @self: a `GtkAtSpiRoot`
|
||||
* @context: the AtSpi context to register
|
||||
* @func: the function to call when the root has been registered
|
||||
*
|
||||
* Queues the registration of the root object on the AT-SPI bus.
|
||||
*/
|
||||
void
|
||||
gtk_at_spi_root_queue_register (GtkAtSpiRoot *self,
|
||||
GtkAtSpiContext *context,
|
||||
GtkAtSpiRootRegisterFunc func)
|
||||
gtk_at_spi_root_queue_register (GtkAtSpiRoot *self,
|
||||
GtkAtSpiContext *context)
|
||||
{
|
||||
/* The cache is available if the root has finished registering itself; if we
|
||||
* are still waiting for the registration to finish, add the context to a queue
|
||||
*/
|
||||
if (self->cache != NULL)
|
||||
{
|
||||
if (func != NULL)
|
||||
func (self, context);
|
||||
|
||||
gtk_at_spi_cache_add_context (self->cache, context);
|
||||
return;
|
||||
}
|
||||
@@ -634,11 +612,7 @@ gtk_at_spi_root_queue_register (GtkAtSpiRoot *self,
|
||||
if (self->register_id != 0)
|
||||
return;
|
||||
|
||||
RegistrationData *data = g_new (RegistrationData, 1);
|
||||
data->root = self;
|
||||
data->register_func = func;
|
||||
|
||||
self->register_id = g_idle_add (root_register, data);
|
||||
self->register_id = g_idle_add (root_register, self);
|
||||
gdk_source_set_static_name_by_id (self->register_id, "[gtk] ATSPI root registration");
|
||||
}
|
||||
|
||||
|
||||
@@ -34,13 +34,9 @@ G_DECLARE_FINAL_TYPE (GtkAtSpiRoot, gtk_at_spi_root, GTK, AT_SPI_ROOT, GObject)
|
||||
GtkAtSpiRoot *
|
||||
gtk_at_spi_root_new (const char *bus_address);
|
||||
|
||||
typedef void (* GtkAtSpiRootRegisterFunc) (GtkAtSpiRoot *root,
|
||||
GtkAtSpiContext *context);
|
||||
|
||||
void
|
||||
gtk_at_spi_root_queue_register (GtkAtSpiRoot *self,
|
||||
GtkAtSpiContext *context,
|
||||
GtkAtSpiRootRegisterFunc func);
|
||||
GtkAtSpiContext *context);
|
||||
|
||||
void
|
||||
gtk_at_spi_root_unregister (GtkAtSpiRoot *self,
|
||||
|
||||
@@ -864,7 +864,7 @@ notebook_handle_method (GDBusConnection *connection,
|
||||
|
||||
for (child = gtk_widget_get_first_child (widget);
|
||||
child;
|
||||
child = gtk_widget_get_next_sibling (child))
|
||||
child = gtk_widget_get_next_sibling (widget))
|
||||
{
|
||||
/* skip actions */
|
||||
if (gtk_accessible_get_accessible_role (GTK_ACCESSIBLE (child)) != GTK_ACCESSIBLE_ROLE_TAB)
|
||||
|
||||
+1
-12
@@ -152,24 +152,13 @@ gtk_css_data_url_parse (const char *url,
|
||||
gsize read;
|
||||
gsize written;
|
||||
gpointer data;
|
||||
GError *local_error = NULL;
|
||||
|
||||
data = g_convert_with_fallback (bdata, bsize,
|
||||
"UTF-8", charset,
|
||||
(char *) "*",
|
||||
&read, &written, &local_error);
|
||||
&read, &written, NULL);
|
||||
g_free (bdata);
|
||||
|
||||
if (local_error)
|
||||
{
|
||||
g_propagate_error (error, local_error);
|
||||
g_free (charset);
|
||||
g_free (data);
|
||||
g_free (mimetype);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
bdata = data;
|
||||
bsize = written;
|
||||
}
|
||||
|
||||
@@ -991,15 +991,13 @@ gtk_action_muxer_unregister_observer (GtkActionObservable *observable,
|
||||
GtkActionObserver *observer)
|
||||
{
|
||||
GtkActionMuxer *muxer = GTK_ACTION_MUXER (observable);
|
||||
Action *action = find_observers (muxer, name);
|
||||
Action *action;
|
||||
|
||||
action = find_observers (muxer, name);
|
||||
if (action)
|
||||
{
|
||||
if (g_slist_find (action->watchers, observer) != NULL)
|
||||
{
|
||||
g_object_weak_unref (G_OBJECT (observer), gtk_action_muxer_weak_notify, action);
|
||||
gtk_action_muxer_unregister_internal (action, observer);
|
||||
}
|
||||
g_object_weak_unref (G_OBJECT (observer), gtk_action_muxer_weak_notify, action);
|
||||
gtk_action_muxer_unregister_internal (action, observer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1271,7 +1269,7 @@ gtk_action_muxer_insert (GtkActionMuxer *muxer,
|
||||
if (!muxer->groups)
|
||||
muxer->groups = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, gtk_action_muxer_free_group);
|
||||
|
||||
group = g_slice_new0 (Group);
|
||||
group = g_slice_new (Group);
|
||||
group->muxer = muxer;
|
||||
group->group = g_object_ref (action_group);
|
||||
group->prefix = g_strdup (prefix);
|
||||
|
||||
+2
-41
@@ -288,12 +288,6 @@ gtk_box_layout_compute_opposite_size (GtkBoxLayout *self,
|
||||
*natural = largest_nat;
|
||||
}
|
||||
|
||||
/* if widgets haven't reached their min opposite size at this
|
||||
* huge value, things went massively wrong and we need to bail to not
|
||||
* cause an infinite loop.
|
||||
*/
|
||||
#define MAX_ALLOWED_SIZE (1 << 20)
|
||||
|
||||
static int
|
||||
distribute_remaining_size (GtkRequestedSize *sizes,
|
||||
gsize n_sizes,
|
||||
@@ -327,40 +321,7 @@ distribute_remaining_size (GtkRequestedSize *sizes,
|
||||
{
|
||||
int test;
|
||||
|
||||
if (min > MAX_ALLOWED_SIZE)
|
||||
{
|
||||
/* sanity check! */
|
||||
for (i = 0; i < n_sizes; i++)
|
||||
{
|
||||
int check_min, check_nat;
|
||||
gtk_widget_measure (sizes[i].data,
|
||||
orientation,
|
||||
MAX_ALLOWED_SIZE,
|
||||
&sizes[i].minimum_size, &sizes[i].natural_size,
|
||||
NULL, NULL);
|
||||
gtk_widget_measure (sizes[i].data,
|
||||
orientation,
|
||||
-1,
|
||||
&check_min, &check_nat,
|
||||
NULL, NULL);
|
||||
if (check_min < sizes[i].minimum_size)
|
||||
{
|
||||
g_critical ("%s %p reports a minimum %s of %u, but minimum %s for %s of %u is %u. Expect overlapping widgets.",
|
||||
G_OBJECT_TYPE_NAME (sizes[i].data), sizes[i].data,
|
||||
orientation == GTK_ORIENTATION_HORIZONTAL ? "width" : "height",
|
||||
check_min,
|
||||
orientation == GTK_ORIENTATION_HORIZONTAL ? "width" : "height",
|
||||
orientation == GTK_ORIENTATION_HORIZONTAL ? "height" : "width",
|
||||
MAX_ALLOWED_SIZE, sizes[i].minimum_size);
|
||||
sizes[i].minimum_size = check_min;
|
||||
sizes[i].natural_size = check_nat;
|
||||
}
|
||||
total_size += sizes[i].minimum_size;
|
||||
}
|
||||
return MAX (0, available - total_size);
|
||||
}
|
||||
|
||||
if (max == MAX_ALLOWED_SIZE)
|
||||
if (max == G_MAXINT)
|
||||
test = min * 2;
|
||||
else
|
||||
test = (min + max) / 2;
|
||||
@@ -504,7 +465,7 @@ gtk_box_layout_compute_opposite_size_for_size (GtkBoxLayout *self,
|
||||
self->orientation,
|
||||
available,
|
||||
min_size,
|
||||
MAX_ALLOWED_SIZE);
|
||||
G_MAXINT);
|
||||
|
||||
/* Bring children up to size first */
|
||||
available = gtk_distribute_natural_allocation (available, nvis_children, sizes);
|
||||
|
||||
+22
-16
@@ -523,11 +523,26 @@ gtk_center_layout_allocate (GtkLayoutManager *layout_manager,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_center_layout_dispose (GObject *object)
|
||||
{
|
||||
GtkCenterLayout *self = GTK_CENTER_LAYOUT (object);
|
||||
|
||||
g_clear_object (&self->start_widget);
|
||||
g_clear_object (&self->center_widget);
|
||||
g_clear_object (&self->end_widget);
|
||||
|
||||
G_OBJECT_CLASS (gtk_center_layout_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_center_layout_class_init (GtkCenterLayoutClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GtkLayoutManagerClass *layout_class = GTK_LAYOUT_MANAGER_CLASS (klass);
|
||||
|
||||
object_class->dispose = gtk_center_layout_dispose;
|
||||
|
||||
layout_class->get_request_mode = gtk_center_layout_get_request_mode;
|
||||
layout_class->measure = gtk_center_layout_measure;
|
||||
layout_class->allocate = gtk_center_layout_allocate;
|
||||
@@ -641,11 +656,8 @@ gtk_center_layout_set_start_widget (GtkCenterLayout *self,
|
||||
g_return_if_fail (GTK_IS_CENTER_LAYOUT (self));
|
||||
g_return_if_fail (widget == NULL || GTK_IS_WIDGET (widget));
|
||||
|
||||
if (self->start_widget == widget)
|
||||
return;
|
||||
|
||||
self->start_widget = widget;
|
||||
gtk_layout_manager_layout_changed (GTK_LAYOUT_MANAGER (self));
|
||||
if (g_set_object (&self->start_widget, widget))
|
||||
gtk_layout_manager_layout_changed (GTK_LAYOUT_MANAGER (self));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -680,11 +692,8 @@ gtk_center_layout_set_center_widget (GtkCenterLayout *self,
|
||||
g_return_if_fail (GTK_IS_CENTER_LAYOUT (self));
|
||||
g_return_if_fail (widget == NULL || GTK_IS_WIDGET (widget));
|
||||
|
||||
if (self->center_widget == widget)
|
||||
return;
|
||||
|
||||
self->center_widget = widget;
|
||||
gtk_layout_manager_layout_changed (GTK_LAYOUT_MANAGER (self));
|
||||
if (g_set_object (&self->center_widget, widget))
|
||||
gtk_layout_manager_layout_changed (GTK_LAYOUT_MANAGER (self));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -706,7 +715,7 @@ gtk_center_layout_get_center_widget (GtkCenterLayout *self)
|
||||
/**
|
||||
* gtk_center_layout_set_end_widget:
|
||||
* @self: a `GtkCenterLayout`
|
||||
* @widget: (nullable) (transfer none): the new end widget
|
||||
* @widget: (nullable): the new end widget
|
||||
*
|
||||
* Sets the new end widget of @self.
|
||||
*
|
||||
@@ -719,11 +728,8 @@ gtk_center_layout_set_end_widget (GtkCenterLayout *self,
|
||||
g_return_if_fail (GTK_IS_CENTER_LAYOUT (self));
|
||||
g_return_if_fail (widget == NULL || GTK_IS_WIDGET (widget));
|
||||
|
||||
if (self->end_widget == widget)
|
||||
return;
|
||||
|
||||
self->end_widget = widget;
|
||||
gtk_layout_manager_layout_changed (GTK_LAYOUT_MANAGER (self));
|
||||
if (g_set_object (&self->end_widget, widget))
|
||||
gtk_layout_manager_layout_changed (GTK_LAYOUT_MANAGER (self));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-3
@@ -1703,9 +1703,8 @@ gtk_column_view_sort_by_column (GtkColumnView *self,
|
||||
g_return_if_fail (column == NULL || GTK_IS_COLUMN_VIEW_COLUMN (column));
|
||||
g_return_if_fail (column == NULL || gtk_column_view_column_get_column_view (column) == self);
|
||||
|
||||
if (column == NULL)
|
||||
gtk_column_view_sorter_clear (GTK_COLUMN_VIEW_SORTER (self->sorter));
|
||||
else
|
||||
gtk_column_view_sorter_clear (GTK_COLUMN_VIEW_SORTER (self->sorter));
|
||||
if (column != NULL)
|
||||
gtk_column_view_sorter_set_column (GTK_COLUMN_VIEW_SORTER (self->sorter),
|
||||
column,
|
||||
direction == GTK_SORT_DESCENDING);
|
||||
|
||||
+8
-8
@@ -239,7 +239,7 @@ gtk_css_node_dispose (GObject *object)
|
||||
}
|
||||
|
||||
gtk_css_node_set_invalid (cssnode, FALSE);
|
||||
|
||||
|
||||
g_clear_pointer (&cssnode->cache, gtk_css_node_style_cache_unref);
|
||||
|
||||
G_OBJECT_CLASS (gtk_css_node_parent_class)->dispose (object);
|
||||
@@ -292,7 +292,7 @@ may_use_global_parent_cache (GtkCssNode *node)
|
||||
{
|
||||
GtkStyleProvider *provider;
|
||||
GtkCssNode *parent;
|
||||
|
||||
|
||||
parent = gtk_css_node_get_parent (node);
|
||||
if (parent == NULL)
|
||||
return FALSE;
|
||||
@@ -700,10 +700,10 @@ gtk_css_node_invalidate_style (GtkCssNode *cssnode)
|
||||
|
||||
cssnode->style_is_invalid = TRUE;
|
||||
gtk_css_node_set_invalid (cssnode, TRUE);
|
||||
|
||||
|
||||
if (cssnode->first_child)
|
||||
gtk_css_node_invalidate_style (cssnode->first_child);
|
||||
|
||||
|
||||
if (cssnode->next_sibling)
|
||||
gtk_css_node_invalidate_style (cssnode->next_sibling);
|
||||
}
|
||||
@@ -796,7 +796,7 @@ gtk_css_node_reposition (GtkCssNode *node,
|
||||
gtk_css_node_invalidate_style (node->next_sibling);
|
||||
}
|
||||
|
||||
gtk_css_node_invalidate (node, (old_parent != new_parent ? GTK_CSS_CHANGE_ANY_PARENT : 0)
|
||||
gtk_css_node_invalidate (node, GTK_CSS_CHANGE_ANY_PARENT
|
||||
| GTK_CSS_CHANGE_ANY_SIBLING
|
||||
| GTK_CSS_CHANGE_NTH_CHILD
|
||||
| (node->previous_sibling ? 0 : GTK_CSS_CHANGE_FIRST_CHILD)
|
||||
@@ -842,7 +842,7 @@ gtk_css_node_insert_before (GtkCssNode *parent,
|
||||
g_return_if_fail (next_sibling == NULL || next_sibling->parent == parent);
|
||||
g_return_if_fail (cssnode != next_sibling);
|
||||
|
||||
if (cssnode->next_sibling == next_sibling &&
|
||||
if (cssnode->next_sibling == next_sibling &&
|
||||
cssnode->parent == parent)
|
||||
return;
|
||||
|
||||
@@ -1067,7 +1067,7 @@ gtk_css_node_set_visible (GtkCssNode *cssnode,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (cssnode->previous_sibling)
|
||||
{
|
||||
if (gtk_css_node_is_last_child (cssnode))
|
||||
@@ -1424,7 +1424,7 @@ gtk_css_node_print (GtkCssNode *cssnode,
|
||||
|
||||
change = gtk_css_static_style_get_change (gtk_css_style_get_static_style (style));
|
||||
g_string_append (string, " ");
|
||||
gtk_css_change_print (change, string);
|
||||
gtk_css_change_print (change, string);
|
||||
}
|
||||
|
||||
g_string_append_c (string, '\n');
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
static GtkCssValue * gtk_css_calc_value_new (guint n_terms);
|
||||
static GtkCssValue * gtk_css_calc_value_new_sum (GtkCssValue *a,
|
||||
GtkCssValue *b);
|
||||
static gsize gtk_css_value_calc_get_size (gsize n_terms);
|
||||
|
||||
enum {
|
||||
TYPE_CALC = 0,
|
||||
@@ -79,13 +78,9 @@ gtk_css_value_number_free (GtkCssValue *number)
|
||||
|
||||
for (guint i = 0; i < n_terms; i++)
|
||||
_gtk_css_value_unref (number->calc.terms[i]);
|
||||
}
|
||||
|
||||
g_slice_free1 (gtk_css_value_calc_get_size (n_terms), number);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_slice_free (GtkCssValue, number);
|
||||
}
|
||||
g_slice_free (GtkCssValue, number);
|
||||
}
|
||||
|
||||
static double
|
||||
|
||||
+16
-16
@@ -208,21 +208,6 @@ gtk_drop_target_end_drop (GtkDropTarget *self)
|
||||
g_object_thaw_notify (G_OBJECT (self));
|
||||
}
|
||||
|
||||
static GdkDragAction
|
||||
make_action_unique (GdkDragAction actions)
|
||||
{
|
||||
if (actions & GDK_ACTION_COPY)
|
||||
return GDK_ACTION_COPY;
|
||||
|
||||
if (actions & GDK_ACTION_MOVE)
|
||||
return GDK_ACTION_MOVE;
|
||||
|
||||
if (actions & GDK_ACTION_LINK)
|
||||
return GDK_ACTION_LINK;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_drop_target_do_drop (GtkDropTarget *self)
|
||||
{
|
||||
@@ -234,7 +219,7 @@ gtk_drop_target_do_drop (GtkDropTarget *self)
|
||||
g_signal_emit (self, signals[DROP], 0, &self->value, self->coords.x, self->coords.y, &success);
|
||||
|
||||
if (success)
|
||||
gdk_drop_finish (self->drop, make_action_unique (self->actions & gdk_drop_get_actions (self->drop)));
|
||||
gdk_drop_finish (self->drop, gdk_drop_get_actions (self->drop));
|
||||
else
|
||||
gdk_drop_finish (self->drop, 0);
|
||||
|
||||
@@ -363,6 +348,21 @@ gtk_drop_target_accept (GtkDropTarget *self,
|
||||
return gdk_content_formats_match_gtype (self->formats, gdk_drop_get_formats (drop)) != G_TYPE_INVALID;
|
||||
}
|
||||
|
||||
static GdkDragAction
|
||||
make_action_unique (GdkDragAction actions)
|
||||
{
|
||||
if (actions & GDK_ACTION_COPY)
|
||||
return GDK_ACTION_COPY;
|
||||
|
||||
if (actions & GDK_ACTION_MOVE)
|
||||
return GDK_ACTION_MOVE;
|
||||
|
||||
if (actions & GDK_ACTION_LINK)
|
||||
return GDK_ACTION_LINK;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static GdkDragAction
|
||||
gtk_drop_target_enter (GtkDropTarget *self,
|
||||
double x,
|
||||
|
||||
+1
-13
@@ -193,23 +193,11 @@ gtk_editable_label_prepare_drag (GtkDragSource *source,
|
||||
gtk_label_get_label (GTK_LABEL (self->label)));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
stop_editing_soon (gpointer data)
|
||||
{
|
||||
GtkEventController *controller = data;
|
||||
GtkWidget *widget = gtk_event_controller_get_widget (controller);
|
||||
|
||||
if (!gtk_event_controller_focus_contains_focus (GTK_EVENT_CONTROLLER_FOCUS (controller)))
|
||||
gtk_editable_label_stop_editing (GTK_EDITABLE_LABEL (widget), TRUE);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_editable_label_focus_out (GtkEventController *controller,
|
||||
GtkEditableLabel *self)
|
||||
{
|
||||
g_timeout_add (100, stop_editing_soon, controller);
|
||||
gtk_editable_label_stop_editing (self, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
+53
-111
@@ -1034,34 +1034,6 @@ gtk_emoji_chooser_show (GtkWidget *widget)
|
||||
gtk_editable_set_text (GTK_EDITABLE (chooser->search_entry), "");
|
||||
}
|
||||
|
||||
static EmojiSection *
|
||||
find_section (GtkEmojiChooser *chooser,
|
||||
GtkWidget *box)
|
||||
{
|
||||
if (box == chooser->recent.box)
|
||||
return &chooser->recent;
|
||||
else if (box == chooser->people.box)
|
||||
return &chooser->people;
|
||||
else if (box == chooser->body.box)
|
||||
return &chooser->body;
|
||||
else if (box == chooser->nature.box)
|
||||
return &chooser->nature;
|
||||
else if (box == chooser->food.box)
|
||||
return &chooser->food;
|
||||
else if (box == chooser->travel.box)
|
||||
return &chooser->travel;
|
||||
else if (box == chooser->activities.box)
|
||||
return &chooser->activities;
|
||||
else if (box == chooser->objects.box)
|
||||
return &chooser->objects;
|
||||
else if (box == chooser->symbols.box)
|
||||
return &chooser->symbols;
|
||||
else if (box == chooser->flags.box)
|
||||
return &chooser->flags;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static EmojiSection *
|
||||
find_next_section (GtkEmojiChooser *chooser,
|
||||
GtkWidget *box,
|
||||
@@ -1133,111 +1105,81 @@ keynav_failed (GtkWidget *box,
|
||||
GtkWidget *focus;
|
||||
GtkWidget *child;
|
||||
GtkWidget *sibling;
|
||||
GtkAllocation alloc;
|
||||
int i;
|
||||
int column;
|
||||
int n_columns = 7;
|
||||
int child_x;
|
||||
|
||||
focus = gtk_root_get_focus (gtk_widget_get_root (box));
|
||||
if (focus == NULL)
|
||||
return FALSE;
|
||||
|
||||
child = gtk_widget_get_ancestor (focus, GTK_TYPE_EMOJI_CHOOSER_CHILD);
|
||||
|
||||
column = 0;
|
||||
child_x = G_MAXINT;
|
||||
for (sibling = gtk_widget_get_first_child (box);
|
||||
sibling;
|
||||
sibling = gtk_widget_get_next_sibling (sibling))
|
||||
/* determine the number of columns */
|
||||
child_x = -1;
|
||||
for (i = 0; i < 20; i++)
|
||||
{
|
||||
if (!gtk_widget_get_child_visible (sibling))
|
||||
continue;
|
||||
GtkAllocation alloc;
|
||||
|
||||
gtk_widget_get_allocation (sibling, &alloc);
|
||||
|
||||
if (alloc.x < child_x)
|
||||
column = 0;
|
||||
gtk_widget_get_allocation (GTK_WIDGET (gtk_flow_box_get_child_at_index (GTK_FLOW_BOX (box), i)),
|
||||
&alloc);
|
||||
if (alloc.x > child_x)
|
||||
child_x = alloc.x;
|
||||
else
|
||||
column++;
|
||||
|
||||
child_x = alloc.x;
|
||||
|
||||
if (sibling == child)
|
||||
break;
|
||||
{
|
||||
n_columns = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
n_columns = MAX (n_columns, 1);
|
||||
|
||||
child = gtk_widget_get_ancestor (focus, GTK_TYPE_EMOJI_CHOOSER_CHILD);
|
||||
|
||||
i = 0;
|
||||
for (sibling = gtk_widget_get_first_child (box);
|
||||
sibling != child;
|
||||
sibling = gtk_widget_get_next_sibling (sibling))
|
||||
i++;
|
||||
|
||||
column = i % n_columns;
|
||||
|
||||
if (direction == GTK_DIR_DOWN)
|
||||
{
|
||||
next = find_section (chooser, box);
|
||||
while (TRUE)
|
||||
{
|
||||
next = find_next_section (chooser, box, TRUE);
|
||||
if (next == NULL)
|
||||
return FALSE;
|
||||
|
||||
i = 0;
|
||||
for (sibling = gtk_widget_get_first_child (next->box);
|
||||
sibling;
|
||||
sibling = gtk_widget_get_next_sibling (sibling), i++)
|
||||
{
|
||||
next = find_next_section (chooser, next->box, TRUE);
|
||||
if (next == NULL)
|
||||
return FALSE;
|
||||
|
||||
i = 0;
|
||||
child_x = G_MAXINT;
|
||||
for (sibling = gtk_widget_get_first_child (next->box);
|
||||
sibling;
|
||||
sibling = gtk_widget_get_next_sibling (sibling))
|
||||
if (i == column)
|
||||
{
|
||||
if (!gtk_widget_get_child_visible (sibling))
|
||||
continue;
|
||||
|
||||
gtk_widget_get_allocation (sibling, &alloc);
|
||||
|
||||
if (alloc.x < child_x)
|
||||
i = 0;
|
||||
else
|
||||
i++;
|
||||
|
||||
child_x = alloc.x;
|
||||
|
||||
if (i == column)
|
||||
{
|
||||
gtk_widget_grab_focus (sibling);
|
||||
return TRUE;
|
||||
}
|
||||
gtk_widget_grab_focus (sibling);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (direction == GTK_DIR_UP)
|
||||
{
|
||||
next = find_section (chooser, box);
|
||||
while (TRUE)
|
||||
next = find_next_section (chooser, box, FALSE);
|
||||
if (next == NULL)
|
||||
return FALSE;
|
||||
|
||||
i = 0;
|
||||
child = NULL;
|
||||
for (sibling = gtk_widget_get_first_child (next->box);
|
||||
sibling;
|
||||
sibling = gtk_widget_get_next_sibling (sibling), i++)
|
||||
{
|
||||
next = find_next_section (chooser, next->box, FALSE);
|
||||
if (next == NULL)
|
||||
return FALSE;
|
||||
|
||||
i = 0;
|
||||
child_x = G_MAXINT;
|
||||
child = NULL;
|
||||
for (sibling = gtk_widget_get_first_child (next->box);
|
||||
sibling;
|
||||
sibling = gtk_widget_get_next_sibling (sibling))
|
||||
{
|
||||
if (!gtk_widget_get_child_visible (sibling))
|
||||
continue;
|
||||
|
||||
gtk_widget_get_allocation (sibling, &alloc);
|
||||
|
||||
if (alloc.x < child_x)
|
||||
i = 0;
|
||||
else
|
||||
i++;
|
||||
|
||||
child_x = alloc.x;
|
||||
|
||||
if (i == column)
|
||||
child = sibling;
|
||||
}
|
||||
|
||||
if (child)
|
||||
{
|
||||
gtk_widget_grab_focus (child);
|
||||
return TRUE;
|
||||
}
|
||||
if ((i % n_columns) == column)
|
||||
child = sibling;
|
||||
}
|
||||
if (child)
|
||||
{
|
||||
gtk_widget_grab_focus (child);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -67,6 +67,7 @@
|
||||
|
||||
#define SCROLL_CAPTURE_THRESHOLD_MS 150
|
||||
#define HOLD_TIMEOUT_MS 50
|
||||
#define SURFACE_UNIT_DISCRETE_MAPPING 10
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -85,6 +86,8 @@ struct _GtkEventControllerScroll
|
||||
double cur_dx;
|
||||
double cur_dy;
|
||||
|
||||
GdkScrollUnit cur_unit;
|
||||
|
||||
guint hold_timeout_id;
|
||||
guint active : 1;
|
||||
};
|
||||
@@ -345,6 +348,7 @@ gtk_event_controller_scroll_handle_event (GtkEventController *controller,
|
||||
double dx = 0, dy = 0;
|
||||
gboolean handled = GDK_EVENT_PROPAGATE;
|
||||
GdkEventType event_type;
|
||||
GdkScrollUnit scroll_unit;
|
||||
|
||||
event_type = gdk_event_get_event_type (event);
|
||||
|
||||
@@ -360,6 +364,8 @@ gtk_event_controller_scroll_handle_event (GtkEventController *controller,
|
||||
|
||||
g_clear_handle_id (&scroll->hold_timeout_id, g_source_remove);
|
||||
|
||||
scroll_unit = gdk_scroll_event_get_unit (event);
|
||||
|
||||
/* FIXME: Handle device changes */
|
||||
direction = gdk_scroll_event_get_direction (event);
|
||||
if (direction == GDK_SCROLL_SMOOTH)
|
||||
@@ -380,18 +386,31 @@ gtk_event_controller_scroll_handle_event (GtkEventController *controller,
|
||||
scroll->cur_dy += dy;
|
||||
dx = dy = 0;
|
||||
|
||||
if (ABS (scroll->cur_dx) >= 1)
|
||||
if (scroll_unit == GDK_SCROLL_UNIT_SURFACE)
|
||||
{
|
||||
steps = trunc (scroll->cur_dx);
|
||||
scroll->cur_dx -= steps;
|
||||
dx = steps;
|
||||
}
|
||||
dx = (int) scroll->cur_dx / SURFACE_UNIT_DISCRETE_MAPPING;
|
||||
scroll->cur_dx -= dx * SURFACE_UNIT_DISCRETE_MAPPING;
|
||||
|
||||
if (ABS (scroll->cur_dy) >= 1)
|
||||
dy = (int) scroll->cur_dy / SURFACE_UNIT_DISCRETE_MAPPING;
|
||||
scroll->cur_dy -= dy * SURFACE_UNIT_DISCRETE_MAPPING;
|
||||
|
||||
scroll_unit = GDK_SCROLL_UNIT_WHEEL;
|
||||
}
|
||||
else
|
||||
{
|
||||
steps = trunc (scroll->cur_dy);
|
||||
scroll->cur_dy -= steps;
|
||||
dy = steps;
|
||||
if (ABS (scroll->cur_dx) >= 1)
|
||||
{
|
||||
steps = trunc (scroll->cur_dx);
|
||||
scroll->cur_dx -= steps;
|
||||
dx = steps;
|
||||
}
|
||||
|
||||
if (ABS (scroll->cur_dy) >= 1)
|
||||
{
|
||||
steps = trunc (scroll->cur_dy);
|
||||
scroll->cur_dy -= steps;
|
||||
dy = steps;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -423,6 +442,8 @@ gtk_event_controller_scroll_handle_event (GtkEventController *controller,
|
||||
dx = 0;
|
||||
}
|
||||
|
||||
scroll->cur_unit = scroll_unit;
|
||||
|
||||
if (dx != 0 || dy != 0)
|
||||
g_signal_emit (controller, signals[SCROLL], 0, dx, dy, &handled);
|
||||
else if (direction == GDK_SCROLL_SMOOTH &&
|
||||
@@ -492,6 +513,9 @@ gtk_event_controller_scroll_class_init (GtkEventControllerScrollClass *klass)
|
||||
* Signals that the widget should scroll by the
|
||||
* amount specified by @dx and @dy.
|
||||
*
|
||||
* For the representation unit of the deltas, see
|
||||
* [method@Gtk.EventControllerScroll.get_unit].
|
||||
*
|
||||
* Returns: %TRUE if the scroll event was handled,
|
||||
* %FALSE otherwise.
|
||||
*/
|
||||
@@ -609,3 +633,26 @@ gtk_event_controller_scroll_get_flags (GtkEventControllerScroll *scroll)
|
||||
|
||||
return scroll->flags;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_event_controller_scroll_get_unit:
|
||||
* @scroll: a `GtkEventControllerScroll`.
|
||||
*
|
||||
* Gets the scroll unit of the last
|
||||
* [signal@Gtk.EventControllerScroll::scroll] signal received.
|
||||
*
|
||||
* Always returns %GDK_SCROLL_UNIT_WHEEL if the
|
||||
* %GTK_EVENT_CONTROLLER_SCROLL_DISCRETE flag is set.
|
||||
*
|
||||
* Returns: the scroll unit.
|
||||
*
|
||||
* Since: 4.8
|
||||
*/
|
||||
GdkScrollUnit
|
||||
gtk_event_controller_scroll_get_unit (GtkEventControllerScroll *scroll)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_EVENT_CONTROLLER_SCROLL (scroll),
|
||||
GDK_SCROLL_UNIT_WHEEL);
|
||||
|
||||
return scroll->cur_unit;
|
||||
}
|
||||
|
||||
@@ -71,6 +71,9 @@ GDK_AVAILABLE_IN_ALL
|
||||
GtkEventControllerScrollFlags
|
||||
gtk_event_controller_scroll_get_flags (GtkEventControllerScroll *scroll);
|
||||
|
||||
GDK_AVAILABLE_IN_4_8
|
||||
GdkScrollUnit gtk_event_controller_scroll_get_unit (GtkEventControllerScroll *scroll);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_EVENT_CONTROLLER_SCROLL_H__ */
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "gtkfilefilterprivate.h"
|
||||
|
||||
#include "macos/gdkmacos.h"
|
||||
#include "macos/gdkmacosdisplay-private.h"
|
||||
#include "macos/gdkmacossurface-private.h"
|
||||
|
||||
typedef struct {
|
||||
@@ -368,6 +369,9 @@ filechooser_quartz_launch (FileChooserQuartzData *data)
|
||||
[data->key_window makeKeyAndOrderFront:nil];
|
||||
}
|
||||
|
||||
/* Need to clear our cached copy of ordered windows */
|
||||
_gdk_macos_display_clear_sorting (GDK_MACOS_DISPLAY (gdk_display_get_default ()));
|
||||
|
||||
if (!data->skip_response)
|
||||
{
|
||||
g_slist_free_full (self->custom_files, g_object_unref);
|
||||
|
||||
+16
-49
@@ -236,7 +236,6 @@ struct _GtkFileChooserWidget
|
||||
LocationMode location_mode;
|
||||
|
||||
GtkWidget *external_entry;
|
||||
GtkEventController *external_entry_controller;
|
||||
|
||||
GtkWidget *choice_box;
|
||||
GHashTable *choices;
|
||||
@@ -2194,9 +2193,7 @@ update_default (GtkFileChooserWidget *impl)
|
||||
return;
|
||||
|
||||
files = gtk_file_chooser_get_files (GTK_FILE_CHOOSER (impl));
|
||||
sensitive = (g_list_model_get_n_items (files) > 0 ||
|
||||
impl->action == GTK_FILE_CHOOSER_ACTION_SAVE ||
|
||||
impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
|
||||
sensitive = (g_list_model_get_n_items (files) > 0 || impl->action == GTK_FILE_CHOOSER_ACTION_SAVE);
|
||||
gtk_widget_set_sensitive (button, sensitive);
|
||||
|
||||
g_object_unref (files);
|
||||
@@ -2303,28 +2300,6 @@ forward_key (GtkEventControllerKey *key,
|
||||
return gtk_event_controller_key_forward (key, GTK_WIDGET (impl));
|
||||
}
|
||||
|
||||
static void
|
||||
external_entry_setup (GtkFileChooserWidget *impl)
|
||||
{
|
||||
/* Make keybindings (for example, Ctrl+H to toggle showing hidden files)
|
||||
* work even when the focus is on the external entry (which is outside
|
||||
* the hierarchy of GtkFileChooserWidget) */
|
||||
|
||||
impl->external_entry_controller = gtk_event_controller_key_new ();
|
||||
gtk_event_controller_set_propagation_phase (impl->external_entry_controller,
|
||||
GTK_PHASE_BUBBLE);
|
||||
g_signal_connect (impl->external_entry_controller, "key-pressed",
|
||||
G_CALLBACK (forward_key), impl);
|
||||
gtk_widget_add_controller (impl->external_entry, impl->external_entry_controller);
|
||||
}
|
||||
|
||||
static void
|
||||
external_entry_disconnect (GtkFileChooserWidget *impl)
|
||||
{
|
||||
gtk_widget_remove_controller (impl->external_entry, impl->external_entry_controller);
|
||||
impl->external_entry_controller = NULL;
|
||||
}
|
||||
|
||||
/* Creates the widgets specific to Save mode */
|
||||
static void
|
||||
save_widgets_create (GtkFileChooserWidget *impl)
|
||||
@@ -2346,7 +2321,10 @@ save_widgets_create (GtkFileChooserWidget *impl)
|
||||
impl->location_entry = impl->external_entry;
|
||||
g_object_add_weak_pointer (G_OBJECT (impl->external_entry), (gpointer *)&impl->location_entry);
|
||||
location_entry_setup (impl);
|
||||
external_entry_setup (impl);
|
||||
|
||||
g_signal_connect_after (gtk_entry_get_key_controller (GTK_ENTRY (impl->external_entry)),
|
||||
"key-pressed",
|
||||
G_CALLBACK (forward_key), impl);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2383,7 +2361,9 @@ save_widgets_destroy (GtkFileChooserWidget *impl)
|
||||
{
|
||||
if (impl->external_entry && impl->external_entry == impl->location_entry)
|
||||
{
|
||||
external_entry_disconnect (impl);
|
||||
g_signal_handlers_disconnect_by_func (gtk_entry_get_key_controller (GTK_ENTRY (impl->external_entry)),
|
||||
forward_key, impl);
|
||||
|
||||
location_entry_disconnect (impl);
|
||||
impl->location_entry = NULL;
|
||||
}
|
||||
@@ -3122,6 +3102,7 @@ gtk_file_chooser_widget_dispose (GObject *object)
|
||||
GtkFileChooserWidget *impl = (GtkFileChooserWidget *) object;
|
||||
|
||||
cancel_all_operations (impl);
|
||||
|
||||
g_clear_pointer (&impl->rename_file_popover, gtk_widget_unparent);
|
||||
g_clear_pointer (&impl->browse_files_popover, gtk_widget_unparent);
|
||||
g_clear_object (&impl->extra_widget);
|
||||
@@ -3129,7 +3110,6 @@ gtk_file_chooser_widget_dispose (GObject *object)
|
||||
|
||||
if (impl->external_entry && impl->location_entry == impl->external_entry)
|
||||
{
|
||||
external_entry_disconnect (impl);
|
||||
location_entry_disconnect (impl);
|
||||
impl->external_entry = NULL;
|
||||
}
|
||||
@@ -5466,7 +5446,7 @@ gtk_file_chooser_widget_get_files (GtkFileChooser *chooser)
|
||||
* So we want the selection to be "bar/foo.txt". Jump to the case for the
|
||||
* filename entry to see if that is the case.
|
||||
*/
|
||||
if (g_list_model_get_n_items (G_LIST_MODEL (info.result)) == 0 && impl->location_entry)
|
||||
if (info.result == NULL && impl->location_entry)
|
||||
goto file_entry;
|
||||
}
|
||||
else if (impl->location_entry &&
|
||||
@@ -5484,7 +5464,7 @@ gtk_file_chooser_widget_get_files (GtkFileChooser *chooser)
|
||||
goto out;
|
||||
|
||||
if (!is_well_formed)
|
||||
goto empty;
|
||||
return NULL;
|
||||
|
||||
if (info.file_from_entry)
|
||||
{
|
||||
@@ -5494,7 +5474,7 @@ gtk_file_chooser_widget_get_files (GtkFileChooser *chooser)
|
||||
else if (!file_list_seen)
|
||||
goto file_list;
|
||||
else
|
||||
goto empty;
|
||||
return NULL;
|
||||
}
|
||||
else if (impl->toplevel_last_focus_widget == impl->browse_files_tree_view)
|
||||
goto file_list;
|
||||
@@ -5515,7 +5495,7 @@ gtk_file_chooser_widget_get_files (GtkFileChooser *chooser)
|
||||
* then we fall back to the current directory
|
||||
*/
|
||||
if (impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER &&
|
||||
g_list_model_get_n_items (G_LIST_MODEL (info.result)) == 0)
|
||||
info.result == NULL)
|
||||
{
|
||||
GFile *current_folder;
|
||||
|
||||
@@ -5526,11 +5506,6 @@ gtk_file_chooser_widget_get_files (GtkFileChooser *chooser)
|
||||
}
|
||||
|
||||
return G_LIST_MODEL (info.result);
|
||||
|
||||
empty:
|
||||
|
||||
g_list_store_remove_all (info.result);
|
||||
return G_LIST_MODEL (info.result);
|
||||
}
|
||||
|
||||
/* Shows or hides the filter widgets */
|
||||
@@ -7760,17 +7735,9 @@ captured_key (GtkEventControllerKey *controller,
|
||||
impl->location_mode == LOCATION_MODE_FILENAME_ENTRY))
|
||||
return GDK_EVENT_PROPAGATE;
|
||||
|
||||
if (keyval == GDK_KEY_slash || keyval == GDK_KEY_asciitilde || keyval == GDK_KEY_period)
|
||||
if (keyval == GDK_KEY_slash)
|
||||
return GDK_EVENT_PROPAGATE;
|
||||
|
||||
if (impl->location_entry)
|
||||
{
|
||||
GtkWidget *focus = gtk_root_get_focus (gtk_widget_get_root (GTK_WIDGET (impl)));
|
||||
|
||||
if (focus && gtk_widget_is_ancestor (focus, impl->location_entry))
|
||||
return GDK_EVENT_PROPAGATE;
|
||||
}
|
||||
|
||||
handled = gtk_event_controller_key_forward (controller, GTK_WIDGET (impl->search_entry));
|
||||
if (handled == GDK_EVENT_STOP)
|
||||
operation_mode_set (impl, OPERATION_MODE_SEARCH);
|
||||
@@ -7880,11 +7847,11 @@ gtk_file_chooser_widget_set_save_entry (GtkFileChooserWidget *impl,
|
||||
g_return_if_fail (GTK_IS_FILE_CHOOSER_WIDGET (impl));
|
||||
g_return_if_fail (entry == NULL || GTK_IS_FILE_CHOOSER_ENTRY (entry));
|
||||
|
||||
impl->external_entry = entry;
|
||||
|
||||
if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
|
||||
{
|
||||
save_widgets_destroy (impl);
|
||||
|
||||
impl->external_entry = entry;
|
||||
save_widgets_create (impl);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -339,7 +339,7 @@ parser_end_element (GtkBuildableParseContext *context,
|
||||
{
|
||||
SubParserData *data = (SubParserData*)user_data;
|
||||
|
||||
if (data->string && data->parsing)
|
||||
if (data->string)
|
||||
{
|
||||
switch (data->type)
|
||||
{
|
||||
|
||||
+17
-23
@@ -204,7 +204,7 @@ cell_augment (GtkRbTree *tree,
|
||||
* index of the returned row
|
||||
* @offset: (out caller-allocates) (optional): stores the offset
|
||||
* in pixels between y and top of cell.
|
||||
* @size: (out caller-allocates) (optional): stores the height
|
||||
* @offset: (out caller-allocates) (optional): stores the height
|
||||
* of the cell
|
||||
*
|
||||
* Gets the Cell that occupies the leftmost position in the row at offset
|
||||
@@ -413,19 +413,6 @@ gtk_grid_view_get_allocation_across (GtkListBase *base,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int
|
||||
gtk_grid_view_compute_total_height (GtkGridView *self)
|
||||
{
|
||||
Cell *cell;
|
||||
CellAugment *aug;
|
||||
|
||||
cell = gtk_list_item_manager_get_root (self->item_manager);
|
||||
if (cell == NULL)
|
||||
return 0;
|
||||
aug = gtk_list_item_manager_get_item_augment (self->item_manager, cell);
|
||||
return aug->size;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_grid_view_get_position_from_allocation (GtkListBase *base,
|
||||
int across,
|
||||
@@ -441,9 +428,6 @@ gtk_grid_view_get_position_from_allocation (GtkListBase *base,
|
||||
return FALSE;
|
||||
|
||||
n_items = gtk_list_base_get_n_items (base);
|
||||
along = CLAMP (along, 0, gtk_grid_view_compute_total_height (self) - 1);
|
||||
across = across < 0 ? 0 : across;
|
||||
|
||||
if (!gtk_grid_view_get_cell_at_y (self,
|
||||
along,
|
||||
&pos,
|
||||
@@ -483,19 +467,16 @@ gtk_grid_view_get_items_in_rect (GtkListBase *base,
|
||||
|
||||
result = gtk_bitset_new_empty ();
|
||||
|
||||
if (rect->y >= gtk_grid_view_compute_total_height (self))
|
||||
return result;
|
||||
|
||||
n_items = gtk_list_base_get_n_items (base);
|
||||
if (n_items == 0)
|
||||
return result;
|
||||
|
||||
first_column = fmax (floor (rect->x / self->column_width), 0);
|
||||
last_column = fmin (floor ((rect->x + rect->width) / self->column_width), self->n_columns - 1);
|
||||
first_column = floor (rect->x / self->column_width);
|
||||
last_column = floor ((rect->x + rect->width) / self->column_width);
|
||||
if (!gtk_grid_view_get_cell_at_y (self, rect->y, &first_row, NULL, NULL))
|
||||
first_row = rect->y < 0 ? 0 : n_items - 1;
|
||||
if (!gtk_grid_view_get_cell_at_y (self, rect->y + rect->height, &last_row, NULL, NULL))
|
||||
last_row = rect->y + rect->height < 0 ? 0 : n_items - 1;
|
||||
last_row = rect->y < 0 ? 0 : n_items - 1;
|
||||
|
||||
gtk_bitset_add_rectangle (result,
|
||||
first_row + first_column,
|
||||
@@ -741,6 +722,19 @@ cell_set_size (Cell *cell,
|
||||
gtk_rb_tree_node_mark_dirty (cell);
|
||||
}
|
||||
|
||||
static int
|
||||
gtk_grid_view_compute_total_height (GtkGridView *self)
|
||||
{
|
||||
Cell *cell;
|
||||
CellAugment *aug;
|
||||
|
||||
cell = gtk_list_item_manager_get_root (self->item_manager);
|
||||
if (cell == NULL)
|
||||
return 0;
|
||||
aug = gtk_list_item_manager_get_item_augment (self->item_manager, cell);
|
||||
return aug->size;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_grid_view_size_allocate (GtkWidget *widget,
|
||||
int width,
|
||||
|
||||
+2
-12
@@ -1719,7 +1719,7 @@ static const char builtin_hicolor_index[] =
|
||||
"[Icon Theme]\n"
|
||||
"Name=Hicolor\n"
|
||||
"Hidden=True\n"
|
||||
"Directories=16x16/actions,16x16/status,22x22/actions,24x24/actions,24x24/status,32x32/actions,32x32/status,48x48/status,64x64/actions,scalable/status,scalable/actions\n"
|
||||
"Directories=16x16/actions,16x16/status,22x22/actions,24x24/actions,24x24/status,32x32/actions,32x32/status,48x48/status,64x64/actions\n"
|
||||
"[16x16/actions]\n"
|
||||
"Size=16\n"
|
||||
"Type=Threshold\n"
|
||||
@@ -1746,17 +1746,7 @@ static const char builtin_hicolor_index[] =
|
||||
"Type=Threshold\n"
|
||||
"[64x64/actions]\n"
|
||||
"Size=64\n"
|
||||
"Type=Threshold\n"
|
||||
"[scalable/status]\n"
|
||||
"MinSize=1\n"
|
||||
"Size=128\n"
|
||||
"MaxSize=256\n"
|
||||
"Type=Scalable\n"
|
||||
"[scalable/actions]\n"
|
||||
"MinSize=1\n"
|
||||
"Size=128\n"
|
||||
"MaxSize=256\n"
|
||||
"Type=Scalable\n";
|
||||
"Type=Threshold\n";
|
||||
|
||||
static void
|
||||
insert_theme (GtkIconTheme *self,
|
||||
|
||||
+29
-30
@@ -5726,35 +5726,8 @@ drag_scroll_timeout (gpointer data)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GdkDragAction
|
||||
gtk_icon_view_get_action (GtkWidget *widget,
|
||||
GdkDrop *drop)
|
||||
{
|
||||
GtkIconView *iconview = GTK_ICON_VIEW (widget);
|
||||
GdkDrag *drag = gdk_drop_get_drag (drop);
|
||||
GdkDragAction actions;
|
||||
|
||||
actions = gdk_drop_get_actions (drop);
|
||||
|
||||
if (drag == iconview->priv->drag &&
|
||||
actions & GDK_ACTION_MOVE)
|
||||
return GDK_ACTION_MOVE;
|
||||
|
||||
if (actions & GDK_ACTION_COPY)
|
||||
return GDK_ACTION_COPY;
|
||||
|
||||
if (actions & GDK_ACTION_MOVE)
|
||||
return GDK_ACTION_MOVE;
|
||||
|
||||
if (actions & GDK_ACTION_LINK)
|
||||
return GDK_ACTION_LINK;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
set_destination (GtkIconView *icon_view,
|
||||
GdkDrop *drop,
|
||||
GtkDropTargetAsync *dest,
|
||||
int x,
|
||||
int y,
|
||||
@@ -5841,7 +5814,7 @@ set_destination (GtkIconView *icon_view,
|
||||
out:
|
||||
if (can_drop)
|
||||
{
|
||||
*suggested_action = gtk_icon_view_get_action (widget, drop);
|
||||
*suggested_action = GDK_ACTION_ALL;
|
||||
|
||||
gtk_icon_view_set_drag_dest_item (GTK_ICON_VIEW (widget),
|
||||
path, pos);
|
||||
@@ -6081,7 +6054,7 @@ gtk_icon_view_drag_motion (GtkDropTargetAsync *dest,
|
||||
gboolean empty;
|
||||
GdkDragAction result;
|
||||
|
||||
if (!set_destination (icon_view, drop, dest, x, y, &suggested_action, &target))
|
||||
if (!set_destination (icon_view, dest, x, y, &suggested_action, &target))
|
||||
return 0;
|
||||
|
||||
gtk_icon_view_get_drag_dest_item (icon_view, &path, &pos);
|
||||
@@ -6146,7 +6119,7 @@ gtk_icon_view_drag_drop (GtkDropTargetAsync *dest,
|
||||
if (!check_model_dnd (model, GTK_TYPE_TREE_DRAG_DEST, "drop"))
|
||||
return FALSE;
|
||||
|
||||
if (!set_destination (icon_view, drop, dest, x, y, &suggested_action, &target))
|
||||
if (!set_destination (icon_view, dest, x, y, &suggested_action, &target))
|
||||
return FALSE;
|
||||
|
||||
path = get_logical_destination (icon_view, &drop_append_mode);
|
||||
@@ -6176,6 +6149,32 @@ gtk_icon_view_drag_drop (GtkDropTargetAsync *dest,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static GdkDragAction
|
||||
gtk_icon_view_get_action (GtkWidget *widget,
|
||||
GdkDrop *drop)
|
||||
{
|
||||
GtkIconView *iconview = GTK_ICON_VIEW (widget);
|
||||
GdkDrag *drag = gdk_drop_get_drag (drop);
|
||||
GdkDragAction actions;
|
||||
|
||||
actions = gdk_drop_get_actions (drop);
|
||||
|
||||
if (drag == iconview->priv->drag &&
|
||||
actions & GDK_ACTION_MOVE)
|
||||
return GDK_ACTION_MOVE;
|
||||
|
||||
if (actions & GDK_ACTION_COPY)
|
||||
return GDK_ACTION_COPY;
|
||||
|
||||
if (actions & GDK_ACTION_MOVE)
|
||||
return GDK_ACTION_MOVE;
|
||||
|
||||
if (actions & GDK_ACTION_LINK)
|
||||
return GDK_ACTION_LINK;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_icon_view_drag_data_received (GObject *source,
|
||||
GAsyncResult *result,
|
||||
|
||||
+10
-28
@@ -132,9 +132,7 @@ gtk_image_definition_new_paintable (GdkPaintable *paintable)
|
||||
GtkImageDefinition *
|
||||
gtk_image_definition_ref (GtkImageDefinition *def)
|
||||
{
|
||||
GtkImageDefinitionEmpty *empty = (GtkImageDefinitionEmpty *) def;
|
||||
|
||||
empty->ref_count++;
|
||||
def->empty.ref_count++;
|
||||
|
||||
return def;
|
||||
}
|
||||
@@ -142,11 +140,9 @@ gtk_image_definition_ref (GtkImageDefinition *def)
|
||||
void
|
||||
gtk_image_definition_unref (GtkImageDefinition *def)
|
||||
{
|
||||
GtkImageDefinitionEmpty *empty = (GtkImageDefinitionEmpty *) def;
|
||||
def->empty.ref_count--;
|
||||
|
||||
empty->ref_count--;
|
||||
|
||||
if (empty->ref_count > 0)
|
||||
if (def->empty.ref_count > 0)
|
||||
return;
|
||||
|
||||
switch (def->type)
|
||||
@@ -156,22 +152,13 @@ gtk_image_definition_unref (GtkImageDefinition *def)
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
case GTK_IMAGE_PAINTABLE:
|
||||
{
|
||||
GtkImageDefinitionPaintable *paintable = (GtkImageDefinitionPaintable *) def;
|
||||
g_object_unref (paintable->paintable);
|
||||
}
|
||||
g_object_unref (def->paintable.paintable);
|
||||
break;
|
||||
case GTK_IMAGE_ICON_NAME:
|
||||
{
|
||||
GtkImageDefinitionIconName *icon_name = (GtkImageDefinitionIconName *) def;
|
||||
g_free (icon_name->icon_name);
|
||||
}
|
||||
g_free (def->icon_name.icon_name);
|
||||
break;
|
||||
case GTK_IMAGE_GICON:
|
||||
{
|
||||
GtkImageDefinitionGIcon *gicon = (GtkImageDefinitionGIcon *) def;
|
||||
g_object_unref (gicon->gicon);
|
||||
}
|
||||
g_object_unref (def->gicon.gicon);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -202,32 +189,27 @@ gtk_image_definition_get_scale (const GtkImageDefinition *def)
|
||||
const char *
|
||||
gtk_image_definition_get_icon_name (const GtkImageDefinition *def)
|
||||
{
|
||||
const GtkImageDefinitionIconName *icon_name = (const GtkImageDefinitionIconName *) def;
|
||||
|
||||
if (def->type != GTK_IMAGE_ICON_NAME)
|
||||
return NULL;
|
||||
|
||||
return icon_name->icon_name;
|
||||
return def->icon_name.icon_name;
|
||||
}
|
||||
|
||||
GIcon *
|
||||
gtk_image_definition_get_gicon (const GtkImageDefinition *def)
|
||||
{
|
||||
const GtkImageDefinitionGIcon *gicon = (const GtkImageDefinitionGIcon *) def;
|
||||
|
||||
if (def->type != GTK_IMAGE_GICON)
|
||||
return NULL;
|
||||
|
||||
return gicon->gicon;
|
||||
return def->gicon.gicon;
|
||||
}
|
||||
|
||||
GdkPaintable *
|
||||
gtk_image_definition_get_paintable (const GtkImageDefinition *def)
|
||||
{
|
||||
const GtkImageDefinitionPaintable *paintable = (const GtkImageDefinitionPaintable *) def;
|
||||
|
||||
if (def->type != GTK_IMAGE_PAINTABLE)
|
||||
return NULL;
|
||||
|
||||
return paintable->paintable;
|
||||
return def->paintable.paintable;
|
||||
}
|
||||
|
||||
|
||||
+27
-57
@@ -98,11 +98,6 @@ struct _GtkIMContextWayland
|
||||
|
||||
static void gtk_im_context_wayland_focus_out (GtkIMContext *context);
|
||||
|
||||
static void commit_state (GtkIMContextWayland *context);
|
||||
static void notify_surrounding_text (GtkIMContextWayland *context);
|
||||
static void notify_cursor_location (GtkIMContextWayland *context);
|
||||
static void notify_content_type (GtkIMContextWayland *context);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkIMContextWayland, gtk_im_context_wayland, GTK_TYPE_IM_CONTEXT_SIMPLE,
|
||||
gtk_im_module_ensure_extension_point ();
|
||||
g_io_extension_point_implement (GTK_IM_MODULE_EXTENSION_POINT_NAME,
|
||||
@@ -133,8 +128,7 @@ gtk_im_context_wayland_get_global (GtkIMContextWayland *self)
|
||||
}
|
||||
|
||||
static void
|
||||
notify_im_change (GtkIMContextWayland *context,
|
||||
enum zwp_text_input_v3_change_cause cause)
|
||||
notify_external_change (GtkIMContextWayland *context)
|
||||
{
|
||||
GtkIMContextWaylandGlobal *global;
|
||||
gboolean result;
|
||||
@@ -143,13 +137,9 @@ notify_im_change (GtkIMContextWayland *context,
|
||||
if (global == NULL)
|
||||
return;
|
||||
|
||||
context->surrounding_change = cause;
|
||||
context->surrounding_change = ZWP_TEXT_INPUT_V3_CHANGE_CAUSE_OTHER;
|
||||
|
||||
g_signal_emit_by_name (global->current, "retrieve-surrounding", &result);
|
||||
notify_surrounding_text (context);
|
||||
notify_content_type (context);
|
||||
notify_cursor_location (context);
|
||||
commit_state (context);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -184,9 +174,6 @@ text_input_preedit_apply (GtkIMContextWaylandGlobal *global)
|
||||
return;
|
||||
|
||||
context = GTK_IM_CONTEXT_WAYLAND (global->current);
|
||||
if (context->pending_preedit.text == NULL &&
|
||||
context->current_preedit.text == NULL)
|
||||
return;
|
||||
|
||||
state_change = ((context->pending_preedit.text == NULL)
|
||||
!= (context->current_preedit.text == NULL));
|
||||
@@ -263,14 +250,9 @@ text_input_delete_surrounding_text_apply (GtkIMContextWaylandGlobal *global)
|
||||
len = context->pending_surrounding_delete.after_length
|
||||
+ context->pending_surrounding_delete.before_length;
|
||||
if (len > 0)
|
||||
{
|
||||
g_signal_emit_by_name (global->current, "delete-surrounding",
|
||||
-context->pending_surrounding_delete.before_length,
|
||||
len, &retval);
|
||||
notify_im_change (GTK_IM_CONTEXT_WAYLAND (context),
|
||||
ZWP_TEXT_INPUT_V3_CHANGE_CAUSE_INPUT_METHOD);
|
||||
}
|
||||
|
||||
g_signal_emit_by_name (global->current, "delete-surrounding",
|
||||
-context->pending_surrounding_delete.before_length,
|
||||
len, &retval);
|
||||
context->pending_surrounding_delete = defaults;
|
||||
}
|
||||
|
||||
@@ -280,25 +262,17 @@ text_input_done (void *data,
|
||||
uint32_t serial)
|
||||
{
|
||||
GtkIMContextWaylandGlobal *global = data;
|
||||
GtkIMContextWayland *context;
|
||||
gboolean update_im;
|
||||
gboolean result;
|
||||
|
||||
global->done_serial = serial;
|
||||
|
||||
if (!global->current)
|
||||
return;
|
||||
|
||||
context = GTK_IM_CONTEXT_WAYLAND (global->current);
|
||||
update_im = (context->pending_commit != NULL ||
|
||||
g_strcmp0 (context->pending_preedit.text,
|
||||
context->current_preedit.text) != 0);
|
||||
|
||||
text_input_delete_surrounding_text_apply (global);
|
||||
text_input_commit_apply (global);
|
||||
g_signal_emit_by_name (global->current, "retrieve-surrounding", &result);
|
||||
text_input_preedit_apply (global);
|
||||
|
||||
if (update_im && global->serial == serial)
|
||||
notify_im_change (context, ZWP_TEXT_INPUT_V3_CHANGE_CAUSE_INPUT_METHOD);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -315,6 +289,8 @@ notify_surrounding_text (GtkIMContextWayland *context)
|
||||
global = gtk_im_context_wayland_get_global (context);
|
||||
if (global == NULL)
|
||||
return;
|
||||
if (global->done_serial != global->serial)
|
||||
return;
|
||||
|
||||
len = strlen (context->surrounding.text);
|
||||
cursor = context->surrounding.cursor_idx;
|
||||
@@ -389,6 +365,8 @@ notify_cursor_location (GtkIMContextWayland *context)
|
||||
global = gtk_im_context_wayland_get_global (context);
|
||||
if (global == NULL)
|
||||
return;
|
||||
if (global->done_serial != global->serial)
|
||||
return;
|
||||
|
||||
rect = context->cursor_rect;
|
||||
gtk_widget_translate_coordinates (context->widget,
|
||||
@@ -479,6 +457,8 @@ notify_content_type (GtkIMContextWayland *context)
|
||||
global = gtk_im_context_wayland_get_global (context);
|
||||
if (global == NULL)
|
||||
return;
|
||||
if (global->done_serial != global->serial)
|
||||
return;
|
||||
|
||||
g_object_get (context,
|
||||
"input-hints", &hints,
|
||||
@@ -544,6 +524,7 @@ released_cb (GtkGestureClick *gesture,
|
||||
{
|
||||
GtkIMContextWaylandGlobal *global;
|
||||
GtkInputHints hints;
|
||||
gboolean result;
|
||||
|
||||
global = gtk_im_context_wayland_get_global (context);
|
||||
if (global == NULL)
|
||||
@@ -560,8 +541,8 @@ released_cb (GtkGestureClick *gesture,
|
||||
x, y))
|
||||
{
|
||||
zwp_text_input_v3_enable (global->text_input);
|
||||
notify_im_change (GTK_IM_CONTEXT_WAYLAND (context),
|
||||
ZWP_TEXT_INPUT_V3_CHANGE_CAUSE_OTHER);
|
||||
g_signal_emit_by_name (global->current, "retrieve-surrounding", &result);
|
||||
commit_state (context);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -693,9 +674,12 @@ static void
|
||||
enable (GtkIMContextWayland *context_wayland,
|
||||
GtkIMContextWaylandGlobal *global)
|
||||
{
|
||||
gboolean result;
|
||||
zwp_text_input_v3_enable (global->text_input);
|
||||
notify_im_change (context_wayland,
|
||||
ZWP_TEXT_INPUT_V3_CHANGE_CAUSE_OTHER);
|
||||
g_signal_emit_by_name (global->current, "retrieve-surrounding", &result);
|
||||
notify_content_type (context_wayland);
|
||||
notify_cursor_location (context_wayland);
|
||||
commit_state (context_wayland);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -705,12 +689,6 @@ disable (GtkIMContextWayland *context_wayland,
|
||||
zwp_text_input_v3_disable (global->text_input);
|
||||
commit_state (context_wayland);
|
||||
|
||||
/* The commit above will still count in the .done event accounting,
|
||||
* we should account for it, lest the serial gets out of sync after
|
||||
* a future focus_in/enable.
|
||||
*/
|
||||
global->done_serial++;
|
||||
|
||||
/* after disable, incoming state changes won't take effect anyway */
|
||||
if (context_wayland->current_preedit.text)
|
||||
{
|
||||
@@ -873,8 +851,7 @@ gtk_im_context_wayland_focus_out (GtkIMContext *context)
|
||||
static void
|
||||
gtk_im_context_wayland_reset (GtkIMContext *context)
|
||||
{
|
||||
notify_im_change (GTK_IM_CONTEXT_WAYLAND (context),
|
||||
ZWP_TEXT_INPUT_V3_CHANGE_CAUSE_OTHER);
|
||||
notify_external_change (GTK_IM_CONTEXT_WAYLAND (context));
|
||||
|
||||
GTK_IM_CONTEXT_CLASS (gtk_im_context_wayland_parent_class)->reset (context);
|
||||
}
|
||||
@@ -909,6 +886,8 @@ gtk_im_context_wayland_set_cursor_location (GtkIMContext *context,
|
||||
gtk_event_controller_reset (GTK_EVENT_CONTROLLER (context_wayland->gesture));
|
||||
|
||||
context_wayland->cursor_rect = *rect;
|
||||
notify_cursor_location (context_wayland);
|
||||
commit_state (context_wayland);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -942,6 +921,9 @@ gtk_im_context_wayland_set_surrounding (GtkIMContext *context,
|
||||
context_wayland->surrounding.text = g_strndup (text, len);
|
||||
context_wayland->surrounding.cursor_idx = cursor_index;
|
||||
context_wayland->surrounding.anchor_idx = selection_bound;
|
||||
|
||||
notify_surrounding_text (context_wayland);
|
||||
commit_state (context_wayland);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -963,17 +945,6 @@ gtk_im_context_wayland_get_surrounding (GtkIMContext *context,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_im_context_wayland_commit (GtkIMContext *context,
|
||||
const gchar *str)
|
||||
{
|
||||
if (GTK_IM_CONTEXT_CLASS (gtk_im_context_wayland_parent_class)->commit)
|
||||
GTK_IM_CONTEXT_CLASS (gtk_im_context_wayland_parent_class)->commit (context, str);
|
||||
|
||||
notify_im_change (GTK_IM_CONTEXT_WAYLAND (context),
|
||||
ZWP_TEXT_INPUT_V3_CHANGE_CAUSE_INPUT_METHOD);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_im_context_wayland_class_init (GtkIMContextWaylandClass *klass)
|
||||
{
|
||||
@@ -992,7 +963,6 @@ gtk_im_context_wayland_class_init (GtkIMContextWaylandClass *klass)
|
||||
im_context_class->set_use_preedit = gtk_im_context_wayland_set_use_preedit;
|
||||
im_context_class->set_surrounding_with_selection = gtk_im_context_wayland_set_surrounding;
|
||||
im_context_class->get_surrounding_with_selection = gtk_im_context_wayland_get_surrounding;
|
||||
im_context_class->commit = gtk_im_context_wayland_commit;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -181,8 +181,6 @@ gtk_kinetic_scrolling_tick (GtkKineticScrolling *data,
|
||||
{
|
||||
case GTK_KINETIC_SCROLLING_PHASE_DECELERATING:
|
||||
{
|
||||
double last_position = data->position;
|
||||
double last_time = data->t;
|
||||
double exp_part;
|
||||
|
||||
data->t += time_delta;
|
||||
@@ -199,8 +197,7 @@ gtk_kinetic_scrolling_tick (GtkKineticScrolling *data,
|
||||
{
|
||||
gtk_kinetic_scrolling_init_overshoot(data, data->upper, data->position, data->velocity);
|
||||
}
|
||||
else if (fabs(data->velocity) < 1 ||
|
||||
(last_time != 0.0 && fabs(data->position - last_position) < 1))
|
||||
else if (fabs(data->velocity) < 0.1)
|
||||
{
|
||||
gtk_kinetic_scrolling_stop (data);
|
||||
}
|
||||
@@ -254,6 +251,5 @@ gtk_kinetic_scrolling_stop (GtkKineticScrolling *data)
|
||||
{
|
||||
data->phase = GTK_KINETIC_SCROLLING_PHASE_FINISHED;
|
||||
data->position = round (data->position);
|
||||
data->velocity = 0;
|
||||
}
|
||||
}
|
||||
|
||||
+15
-18
@@ -1566,28 +1566,25 @@ gtk_list_base_stop_rubberband (GtkListBase *self,
|
||||
return;
|
||||
|
||||
rubberband_selection = gtk_list_base_get_items_in_rect (self, &rect);
|
||||
if (gtk_bitset_is_empty (rubberband_selection))
|
||||
{
|
||||
gtk_bitset_unref (rubberband_selection);
|
||||
return;
|
||||
}
|
||||
|
||||
if (modify && extend) /* Ctrl + Shift */
|
||||
{
|
||||
if (gtk_bitset_is_empty (rubberband_selection))
|
||||
{
|
||||
selected = gtk_bitset_ref (rubberband_selection);
|
||||
mask = gtk_bitset_ref (rubberband_selection);
|
||||
}
|
||||
else
|
||||
{
|
||||
GtkBitset *current;
|
||||
guint min = gtk_bitset_get_minimum (rubberband_selection);
|
||||
guint max = gtk_bitset_get_maximum (rubberband_selection);
|
||||
/* toggle the rubberband, keep the rest */
|
||||
current = gtk_selection_model_get_selection_in_range (model, min, max - min + 1);
|
||||
selected = gtk_bitset_copy (current);
|
||||
gtk_bitset_unref (current);
|
||||
gtk_bitset_intersect (selected, rubberband_selection);
|
||||
gtk_bitset_difference (selected, rubberband_selection);
|
||||
GtkBitset *current;
|
||||
guint min = gtk_bitset_get_minimum (rubberband_selection);
|
||||
guint max = gtk_bitset_get_maximum (rubberband_selection);
|
||||
/* toggle the rubberband, keep the rest */
|
||||
current = gtk_selection_model_get_selection_in_range (model, min, max - min + 1);
|
||||
selected = gtk_bitset_copy (current);
|
||||
gtk_bitset_unref (current);
|
||||
gtk_bitset_intersect (selected, rubberband_selection);
|
||||
gtk_bitset_difference (selected, rubberband_selection);
|
||||
|
||||
mask = gtk_bitset_ref (rubberband_selection);
|
||||
}
|
||||
mask = gtk_bitset_ref (rubberband_selection);
|
||||
}
|
||||
else if (modify) /* Ctrl */
|
||||
{
|
||||
|
||||
@@ -247,22 +247,6 @@ gtk_list_item_new (void)
|
||||
return g_object_new (GTK_TYPE_LIST_ITEM, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_list_item_do_notify (GtkListItem *list_item,
|
||||
gboolean notify_item,
|
||||
gboolean notify_position,
|
||||
gboolean notify_selected)
|
||||
{
|
||||
GObject *object = G_OBJECT (list_item);
|
||||
|
||||
if (notify_item)
|
||||
g_object_notify_by_pspec (object, properties[PROP_ITEM]);
|
||||
if (notify_position)
|
||||
g_object_notify_by_pspec (object, properties[PROP_POSITION]);
|
||||
if (notify_selected)
|
||||
g_object_notify_by_pspec (object, properties[PROP_SELECTED]);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_list_item_get_item: (attributes org.gtk.Method.get_property=item)
|
||||
* @self: a `GtkListItem`
|
||||
|
||||
@@ -162,5 +162,9 @@ gtk_list_item_factory_update (GtkListItemFactory *self,
|
||||
|
||||
list_item = gtk_list_item_widget_get_list_item (widget);
|
||||
|
||||
g_object_freeze_notify (G_OBJECT (list_item));
|
||||
|
||||
GTK_LIST_ITEM_FACTORY_GET_CLASS (self)->update (self, widget, list_item, position, item, selected);
|
||||
|
||||
g_object_thaw_notify (G_OBJECT (list_item));
|
||||
}
|
||||
|
||||
@@ -40,11 +40,6 @@ struct _GtkListItem
|
||||
|
||||
GtkListItem * gtk_list_item_new (void);
|
||||
|
||||
void gtk_list_item_do_notify (GtkListItem *list_item,
|
||||
gboolean notify_item,
|
||||
gboolean notify_position,
|
||||
gboolean notify_selected);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
+16
-23
@@ -485,27 +485,20 @@ gtk_list_item_widget_update (GtkListItemWidget *self,
|
||||
gboolean selected)
|
||||
{
|
||||
GtkListItemWidgetPrivate *priv = gtk_list_item_widget_get_instance_private (self);
|
||||
gboolean was_selected;
|
||||
|
||||
was_selected = priv->selected;
|
||||
|
||||
if (priv->list_item)
|
||||
gtk_list_item_factory_update (priv->factory, self, position, item, selected);
|
||||
else
|
||||
gtk_list_item_widget_default_update (self, NULL, position, item, selected);
|
||||
|
||||
/* don't look at selected variable, it's not reentrancy safe */
|
||||
if (was_selected != priv->selected)
|
||||
{
|
||||
if (priv->selected)
|
||||
gtk_widget_set_state_flags (GTK_WIDGET (self), GTK_STATE_FLAG_SELECTED, FALSE);
|
||||
else
|
||||
gtk_widget_unset_state_flags (GTK_WIDGET (self), GTK_STATE_FLAG_SELECTED);
|
||||
if (selected)
|
||||
gtk_widget_set_state_flags (GTK_WIDGET (self), GTK_STATE_FLAG_SELECTED, FALSE);
|
||||
else
|
||||
gtk_widget_unset_state_flags (GTK_WIDGET (self), GTK_STATE_FLAG_SELECTED);
|
||||
|
||||
gtk_accessible_update_state (GTK_ACCESSIBLE (self),
|
||||
GTK_ACCESSIBLE_STATE_SELECTED, priv->selected,
|
||||
-1);
|
||||
}
|
||||
gtk_accessible_update_state (GTK_ACCESSIBLE (self),
|
||||
GTK_ACCESSIBLE_STATE_SELECTED, selected,
|
||||
-1);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -561,29 +554,29 @@ gtk_list_item_widget_default_update (GtkListItemWidget *self,
|
||||
gpointer item,
|
||||
gboolean selected)
|
||||
{
|
||||
/* Track notify manually instead of freeze/thaw_notify for performance reasons. */
|
||||
gboolean notify_item = FALSE, notify_position = FALSE, notify_selected = FALSE;
|
||||
GtkListItemWidgetPrivate *priv = gtk_list_item_widget_get_instance_private (self);
|
||||
|
||||
/* FIXME: It's kinda evil to notify external objects from here... */
|
||||
|
||||
|
||||
if (g_set_object (&priv->item, item))
|
||||
notify_item = TRUE;
|
||||
{
|
||||
if (list_item)
|
||||
g_object_notify (G_OBJECT (list_item), "item");
|
||||
}
|
||||
|
||||
if (priv->position != position)
|
||||
{
|
||||
priv->position = position;
|
||||
notify_position = TRUE;
|
||||
if (list_item)
|
||||
g_object_notify (G_OBJECT (list_item), "position");
|
||||
}
|
||||
|
||||
if (priv->selected != selected)
|
||||
{
|
||||
priv->selected = selected;
|
||||
notify_selected = TRUE;
|
||||
if (list_item)
|
||||
g_object_notify (G_OBJECT (list_item), "selected");
|
||||
}
|
||||
|
||||
if (list_item)
|
||||
gtk_list_item_do_notify (list_item, notify_item, notify_position, notify_selected);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
+1
-6
@@ -377,9 +377,6 @@ gtk_list_view_get_items_in_rect (GtkListBase *base,
|
||||
|
||||
result = gtk_bitset_new_empty ();
|
||||
|
||||
if (rect->y >= gtk_list_view_get_list_height (self))
|
||||
return result;
|
||||
|
||||
n_items = gtk_list_base_get_n_items (base);
|
||||
if (n_items == 0)
|
||||
return result;
|
||||
@@ -393,7 +390,7 @@ gtk_list_view_get_items_in_rect (GtkListBase *base,
|
||||
if (row)
|
||||
last = gtk_list_item_manager_get_item_position (self->item_manager, row);
|
||||
else
|
||||
last = rect->y + rect->height < 0 ? 0 : n_items - 1;
|
||||
last = rect->y < 0 ? 0 : n_items - 1;
|
||||
|
||||
gtk_bitset_add_range_closed (result, first, last);
|
||||
return result;
|
||||
@@ -428,8 +425,6 @@ gtk_list_view_get_position_from_allocation (GtkListBase *base,
|
||||
if (across >= self->list_width)
|
||||
return FALSE;
|
||||
|
||||
along = CLAMP (along, 0, gtk_list_view_get_list_height (self) - 1);
|
||||
|
||||
row = gtk_list_view_get_row_at_y (self, along, &remaining);
|
||||
if (row == NULL)
|
||||
return FALSE;
|
||||
|
||||
+46
-44
@@ -897,31 +897,11 @@ rewrite_event_for_surface (GdkEvent *event,
|
||||
GdkSurface *new_surface)
|
||||
{
|
||||
GdkEventType type;
|
||||
double x, y;
|
||||
double x = -G_MAXDOUBLE, y = -G_MAXDOUBLE;
|
||||
double dx, dy;
|
||||
|
||||
type = gdk_event_get_event_type (event);
|
||||
|
||||
switch ((guint) type)
|
||||
{
|
||||
case GDK_BUTTON_PRESS:
|
||||
case GDK_BUTTON_RELEASE:
|
||||
case GDK_MOTION_NOTIFY:
|
||||
case GDK_TOUCH_BEGIN:
|
||||
case GDK_TOUCH_UPDATE:
|
||||
case GDK_TOUCH_END:
|
||||
case GDK_TOUCH_CANCEL:
|
||||
case GDK_TOUCHPAD_SWIPE:
|
||||
case GDK_TOUCHPAD_PINCH:
|
||||
case GDK_TOUCHPAD_HOLD:
|
||||
gdk_event_get_position (event, &x, &y);
|
||||
gdk_surface_translate_coordinates (gdk_event_get_surface (event), new_surface, &x, &y);
|
||||
break;
|
||||
default:
|
||||
x = y = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
switch ((guint) type)
|
||||
{
|
||||
case GDK_BUTTON_PRESS:
|
||||
@@ -1031,8 +1011,7 @@ rewrite_event_for_grabs (GdkEvent *event)
|
||||
display = gdk_event_get_display (event);
|
||||
device = gdk_event_get_device (event);
|
||||
|
||||
if (!gdk_device_grab_info (display, device, &grab_surface, &owner_events) ||
|
||||
!owner_events)
|
||||
if (!gdk_device_grab_info (display, device, &grab_surface, &owner_events))
|
||||
return NULL;
|
||||
break;
|
||||
default:
|
||||
@@ -1042,11 +1021,24 @@ rewrite_event_for_grabs (GdkEvent *event)
|
||||
event_widget = gtk_get_event_widget (event);
|
||||
grab_widget = GTK_WIDGET (gtk_native_get_for_surface (grab_surface));
|
||||
|
||||
if (grab_widget &&
|
||||
gtk_main_get_window_group (grab_widget) != gtk_main_get_window_group (event_widget))
|
||||
return rewrite_event_for_surface (event, grab_surface);
|
||||
else
|
||||
if (!grab_widget)
|
||||
return NULL;
|
||||
|
||||
/* If owner_events was set, events in client surfaces get forwarded
|
||||
* as normal, but we consider other window groups foreign surfaces.
|
||||
*/
|
||||
if (owner_events &&
|
||||
gtk_main_get_window_group (grab_widget) == gtk_main_get_window_group (event_widget))
|
||||
return NULL;
|
||||
|
||||
/* If owner_events was not set, events only get sent to the grabbing
|
||||
* surface.
|
||||
*/
|
||||
if (!owner_events &&
|
||||
grab_surface == gtk_native_get_surface (gtk_widget_get_native (event_widget)))
|
||||
return NULL;
|
||||
|
||||
return rewrite_event_for_surface (event, grab_surface);
|
||||
}
|
||||
|
||||
static GdkEvent *
|
||||
@@ -1082,19 +1074,30 @@ rewrite_event_for_toplevel (GdkEvent *event)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
translate_coordinates (double event_x,
|
||||
double event_y,
|
||||
double *x,
|
||||
double *y,
|
||||
GtkWidget *widget)
|
||||
translate_event_coordinates (GdkEvent *event,
|
||||
double *x,
|
||||
double *y,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
GtkWidget *event_widget;
|
||||
GtkNative *native;
|
||||
graphene_point_t p;
|
||||
double event_x, event_y;
|
||||
double native_x, native_y;
|
||||
|
||||
*x = *y = 0;
|
||||
native = gtk_widget_get_native (widget);
|
||||
|
||||
if (!gtk_widget_compute_point (GTK_WIDGET (native),
|
||||
if (!gdk_event_get_position (event, &event_x, &event_y))
|
||||
return FALSE;
|
||||
|
||||
event_widget = gtk_get_event_widget (event);
|
||||
native = gtk_widget_get_native (event_widget);
|
||||
|
||||
gtk_native_get_surface_transform (GTK_NATIVE (native), &native_x, &native_y);
|
||||
event_x -= native_x;
|
||||
event_y -= native_y;
|
||||
|
||||
if (!gtk_widget_compute_point (event_widget,
|
||||
widget,
|
||||
&GRAPHENE_POINT_INIT (event_x, event_y),
|
||||
&p))
|
||||
@@ -1106,13 +1109,12 @@ translate_coordinates (double event_x,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
gtk_synthesize_crossing_events (GtkRoot *toplevel,
|
||||
GtkCrossingType crossing_type,
|
||||
GtkWidget *old_target,
|
||||
GtkWidget *new_target,
|
||||
double surface_x,
|
||||
double surface_y,
|
||||
GdkEvent *event,
|
||||
GdkCrossingMode mode,
|
||||
GdkDrop *drop)
|
||||
{
|
||||
@@ -1168,7 +1170,7 @@ gtk_synthesize_crossing_events (GtkRoot *toplevel,
|
||||
crossing.new_descendent = NULL;
|
||||
}
|
||||
check_crossing_invariants (widget, &crossing);
|
||||
translate_coordinates (surface_x, surface_y, &x, &y, widget);
|
||||
translate_event_coordinates (event, &x, &y, widget);
|
||||
gtk_widget_handle_crossing (widget, &crossing, x, y);
|
||||
if (crossing_type == GTK_CROSSING_POINTER)
|
||||
gtk_widget_unset_state_flags (widget, GTK_STATE_FLAG_PRELIGHT);
|
||||
@@ -1211,7 +1213,7 @@ gtk_synthesize_crossing_events (GtkRoot *toplevel,
|
||||
crossing.old_descendent = old_target ? crossing.new_descendent : NULL;
|
||||
}
|
||||
|
||||
translate_coordinates (surface_x, surface_y, &x, &y, widget);
|
||||
translate_event_coordinates (event, &x, &y, widget);
|
||||
gtk_widget_handle_crossing (widget, &crossing, x, y);
|
||||
if (crossing_type == GTK_CROSSING_POINTER)
|
||||
gtk_widget_set_state_flags (widget, GTK_STATE_FLAG_PRELIGHT, FALSE);
|
||||
@@ -1378,7 +1380,7 @@ handle_pointing_event (GdkEvent *event)
|
||||
|
||||
old_target = update_pointer_focus_state (toplevel, event, NULL);
|
||||
gtk_synthesize_crossing_events (GTK_ROOT (toplevel), GTK_CROSSING_POINTER, old_target, NULL,
|
||||
x, y, gdk_crossing_event_get_mode (event), NULL);
|
||||
event, gdk_crossing_event_get_mode (event), NULL);
|
||||
break;
|
||||
case GDK_TOUCH_END:
|
||||
case GDK_TOUCH_CANCEL:
|
||||
@@ -1391,7 +1393,7 @@ handle_pointing_event (GdkEvent *event)
|
||||
old_target = update_pointer_focus_state (toplevel, event, NULL);
|
||||
gtk_drop_begin_event (drop, GDK_DRAG_LEAVE);
|
||||
gtk_synthesize_crossing_events (GTK_ROOT (toplevel), GTK_CROSSING_DROP, old_target, NULL,
|
||||
x, y, GDK_CROSSING_NORMAL, drop);
|
||||
event, GDK_CROSSING_NORMAL, drop);
|
||||
gtk_drop_end_event (drop);
|
||||
}
|
||||
break;
|
||||
@@ -1418,7 +1420,7 @@ handle_pointing_event (GdkEvent *event)
|
||||
sequence))
|
||||
{
|
||||
gtk_synthesize_crossing_events (GTK_ROOT (toplevel), GTK_CROSSING_POINTER, old_target, target,
|
||||
x, y, GDK_CROSSING_NORMAL, NULL);
|
||||
event, GDK_CROSSING_NORMAL, NULL);
|
||||
}
|
||||
|
||||
gtk_window_maybe_update_cursor (toplevel, NULL, device);
|
||||
@@ -1429,7 +1431,7 @@ handle_pointing_event (GdkEvent *event)
|
||||
GdkDrop *drop = gdk_dnd_event_get_drop (event);
|
||||
gtk_drop_begin_event (drop, type);
|
||||
gtk_synthesize_crossing_events (GTK_ROOT (toplevel), GTK_CROSSING_DROP, old_target, target,
|
||||
x, y, GDK_CROSSING_NORMAL, gdk_dnd_event_get_drop (event));
|
||||
event, GDK_CROSSING_NORMAL, gdk_dnd_event_get_drop (event));
|
||||
gtk_drop_end_event (drop);
|
||||
}
|
||||
else if (type == GDK_TOUCH_BEGIN)
|
||||
@@ -1469,7 +1471,7 @@ handle_pointing_event (GdkEvent *event)
|
||||
new_target = GTK_WIDGET (toplevel);
|
||||
|
||||
gtk_synthesize_crossing_events (GTK_ROOT (toplevel), GTK_CROSSING_POINTER, target, new_target,
|
||||
x, y, GDK_CROSSING_UNGRAB, NULL);
|
||||
event, GDK_CROSSING_UNGRAB, NULL);
|
||||
gtk_window_maybe_update_cursor (toplevel, NULL, device);
|
||||
update_pointer_focus_state (toplevel, event, new_target);
|
||||
}
|
||||
|
||||
@@ -2605,7 +2605,6 @@ gtk_notebook_gesture_pressed (GtkGestureClick *gesture,
|
||||
if (arrow != ARROW_NONE)
|
||||
{
|
||||
gtk_notebook_arrow_button_press (notebook, arrow, button);
|
||||
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -6811,7 +6810,6 @@ gtk_notebook_child_reordered (GtkNotebook *notebook,
|
||||
|
||||
gtk_widget_insert_after (page->tab_widget, notebook->tabs_widget, sibling);
|
||||
|
||||
update_arrow_state (notebook);
|
||||
gtk_notebook_update_labels (notebook);
|
||||
gtk_widget_queue_allocate (notebook->tabs_widget);
|
||||
}
|
||||
|
||||
+1
-10
@@ -1995,19 +1995,10 @@ gtk_paned_set_focus_child (GtkWidget *widget,
|
||||
/* If there is one or more paned widgets between us and the
|
||||
* focus widget, we want the topmost of those as last_focus
|
||||
*/
|
||||
for (w = last_focus; w && w != GTK_WIDGET (paned); w = gtk_widget_get_parent (w))
|
||||
for (w = last_focus; w != GTK_WIDGET (paned); w = gtk_widget_get_parent (w))
|
||||
if (GTK_IS_PANED (w))
|
||||
last_focus = w;
|
||||
|
||||
if (w == NULL)
|
||||
{
|
||||
g_warning ("Error finding last focus widget of GtkPaned %p, "
|
||||
"gtk_paned_set_focus_child was called on widget %p "
|
||||
"which is not child of %p.",
|
||||
widget, child, widget);
|
||||
return;
|
||||
}
|
||||
|
||||
focus_child = gtk_widget_get_focus_child (widget);
|
||||
if (focus_child == paned->start_child)
|
||||
gtk_paned_set_last_start_child_focus (paned, last_focus);
|
||||
|
||||
@@ -146,7 +146,7 @@ gtk_printer_option_widget_finalize (GObject *object)
|
||||
{
|
||||
GtkPrinterOptionWidget *widget = GTK_PRINTER_OPTION_WIDGET (object);
|
||||
GtkPrinterOptionWidgetPrivate *priv = widget->priv;
|
||||
|
||||
|
||||
if (priv->source)
|
||||
{
|
||||
g_signal_handler_disconnect (priv->source,
|
||||
@@ -154,7 +154,7 @@ gtk_printer_option_widget_finalize (GObject *object)
|
||||
g_object_unref (priv->source);
|
||||
priv->source = NULL;
|
||||
}
|
||||
|
||||
|
||||
G_OBJECT_CLASS (gtk_printer_option_widget_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ gtk_printer_option_widget_set_property (GObject *object,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkPrinterOptionWidget *widget;
|
||||
|
||||
|
||||
widget = GTK_PRINTER_OPTION_WIDGET (object);
|
||||
|
||||
switch (prop_id)
|
||||
@@ -246,7 +246,7 @@ gtk_printer_option_widget_set_source (GtkPrinterOptionWidget *widget,
|
||||
|
||||
if (source)
|
||||
g_object_ref (source);
|
||||
|
||||
|
||||
if (priv->source)
|
||||
{
|
||||
g_signal_handler_disconnect (priv->source,
|
||||
@@ -672,17 +672,6 @@ dialog_response_callback (GtkDialog *dialog,
|
||||
g_free (filename_short);
|
||||
g_object_unref (info);
|
||||
}
|
||||
else
|
||||
{
|
||||
const char *path = g_file_peek_path (new_location);
|
||||
char *filename_utf8 = g_utf8_make_valid (path, -1);
|
||||
|
||||
char *filename_short = trim_long_filename (filename_utf8);
|
||||
gtk_button_set_label (GTK_BUTTON (priv->button), filename_short);
|
||||
|
||||
g_free (filename_short);
|
||||
g_free (filename_utf8);
|
||||
}
|
||||
}
|
||||
|
||||
gtk_window_destroy (GTK_WINDOW (dialog));
|
||||
@@ -730,7 +719,18 @@ filesave_choose_cb (GtkWidget *button,
|
||||
{
|
||||
priv->last_location = g_file_new_for_uri (priv->source->value);
|
||||
if (priv->last_location)
|
||||
gtk_file_chooser_set_file (GTK_FILE_CHOOSER (dialog), priv->last_location, NULL);
|
||||
{
|
||||
char *basename;
|
||||
char *basename_utf8;
|
||||
|
||||
gtk_file_chooser_select_file (GTK_FILE_CHOOSER (dialog), priv->last_location, NULL);
|
||||
|
||||
basename = g_file_get_basename (priv->last_location);
|
||||
basename_utf8 = g_filename_to_utf8 (basename, -1, NULL, NULL, NULL);
|
||||
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), basename_utf8);
|
||||
g_free (basename_utf8);
|
||||
g_free (basename);
|
||||
}
|
||||
}
|
||||
|
||||
g_signal_connect (dialog, "response",
|
||||
@@ -760,7 +760,7 @@ filter_numeric (const char *val,
|
||||
filtered_val[j] = val[i];
|
||||
j++;
|
||||
}
|
||||
else if (allow_dec && !dec_set &&
|
||||
else if (allow_dec && !dec_set &&
|
||||
(val[i] == '.' || val[i] == ','))
|
||||
{
|
||||
/* allow one period or comma
|
||||
@@ -796,7 +796,7 @@ combo_changed_cb (GtkWidget *combo,
|
||||
gboolean custom = TRUE;
|
||||
|
||||
g_signal_handler_block (priv->source, priv->source_changed_handler);
|
||||
|
||||
|
||||
value = combo_box_get (priv->combo, &custom);
|
||||
|
||||
/* Handle constraints if the user entered a custom value. */
|
||||
@@ -851,7 +851,7 @@ entry_changed_cb (GtkWidget *entry,
|
||||
{
|
||||
GtkPrinterOptionWidgetPrivate *priv = widget->priv;
|
||||
const char *value;
|
||||
|
||||
|
||||
g_signal_handler_block (priv->source, priv->source_changed_handler);
|
||||
value = gtk_editable_get_text (GTK_EDITABLE (entry));
|
||||
if (value)
|
||||
@@ -867,7 +867,7 @@ radio_changed_cb (GtkWidget *button,
|
||||
{
|
||||
GtkPrinterOptionWidgetPrivate *priv = widget->priv;
|
||||
char *value;
|
||||
|
||||
|
||||
g_signal_handler_block (priv->source, priv->source_changed_handler);
|
||||
value = g_object_get_data (G_OBJECT (button), "value");
|
||||
if (value)
|
||||
@@ -928,9 +928,9 @@ construct_widgets (GtkPrinterOptionWidget *widget)
|
||||
GtkWidget *group;
|
||||
|
||||
source = priv->source;
|
||||
|
||||
|
||||
deconstruct_widgets (widget);
|
||||
|
||||
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (widget), TRUE);
|
||||
|
||||
if (source == NULL)
|
||||
@@ -1112,7 +1112,7 @@ update_widgets (GtkPrinterOptionWidget *widget)
|
||||
GtkPrinterOption *source;
|
||||
|
||||
source = priv->source;
|
||||
|
||||
|
||||
if (source == NULL)
|
||||
{
|
||||
gtk_widget_hide (priv->image);
|
||||
|
||||
@@ -152,15 +152,6 @@ char * _gtk_elide_underscores (const char *original);
|
||||
|
||||
void setlocale_initialization (void);
|
||||
|
||||
void gtk_synthesize_crossing_events (GtkRoot *toplevel,
|
||||
GtkCrossingType crossing_type,
|
||||
GtkWidget *old_target,
|
||||
GtkWidget *new_target,
|
||||
double surface_x,
|
||||
double surface_y,
|
||||
GdkCrossingMode mode,
|
||||
GdkDrop *drop);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_PRIVATE_H__ */
|
||||
|
||||
+11
-9
@@ -2202,25 +2202,27 @@ gtk_range_scroll_controller_scroll (GtkEventControllerScroll *scroll,
|
||||
GtkRange *range)
|
||||
{
|
||||
GtkRangePrivate *priv = gtk_range_get_instance_private (range);
|
||||
double scroll_unit, delta;
|
||||
double delta;
|
||||
gboolean handled;
|
||||
GtkOrientation move_orientation;
|
||||
|
||||
#ifdef GDK_WINDOWING_MACOS
|
||||
scroll_unit = 1;
|
||||
#else
|
||||
scroll_unit = gtk_adjustment_get_page_increment (priv->adjustment);
|
||||
#endif
|
||||
GdkScrollUnit scroll_unit;
|
||||
|
||||
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL && dx != 0)
|
||||
{
|
||||
move_orientation = GTK_ORIENTATION_HORIZONTAL;
|
||||
delta = dx * scroll_unit;
|
||||
delta = dx;
|
||||
}
|
||||
else
|
||||
{
|
||||
move_orientation = GTK_ORIENTATION_VERTICAL;
|
||||
delta = dy * scroll_unit;
|
||||
delta = dy;
|
||||
}
|
||||
|
||||
scroll_unit = gtk_event_controller_scroll_get_unit (scroll);
|
||||
|
||||
if (scroll_unit == GDK_SCROLL_UNIT_WHEEL)
|
||||
{
|
||||
delta *= gtk_adjustment_get_page_increment (priv->adjustment);
|
||||
}
|
||||
|
||||
if (delta != 0 && should_invert_move (range, move_orientation))
|
||||
|
||||
+86
-88
@@ -54,10 +54,6 @@
|
||||
#include "gtkviewport.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
|
||||
#ifdef GDK_WINDOWING_WAYLAND
|
||||
#include <gdk/wayland/gdkwayland.h>
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
|
||||
/**
|
||||
@@ -1062,6 +1058,11 @@ gtk_scrolled_window_decelerate (GtkScrolledWindow *scrolled_window,
|
||||
gtk_scrolled_window_start_deceleration (scrolled_window);
|
||||
priv->x_velocity = priv->y_velocity = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_clear_pointer (&priv->hscrolling, gtk_kinetic_scrolling_free);
|
||||
g_clear_pointer (&priv->vscrolling, gtk_kinetic_scrolling_free);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1232,16 +1233,14 @@ check_update_scrollbar_proximity (GtkScrolledWindow *sw,
|
||||
}
|
||||
|
||||
static double
|
||||
get_scroll_unit (GtkScrolledWindow *sw,
|
||||
GtkOrientation orientation,
|
||||
GtkEventControllerScroll *scroll)
|
||||
get_wheel_detent_scroll_step (GtkScrolledWindow *sw,
|
||||
GtkOrientation orientation)
|
||||
{
|
||||
GtkScrolledWindowPrivate *priv = gtk_scrolled_window_get_instance_private (sw);
|
||||
GdkDisplay *display = gtk_widget_get_display (GTK_WIDGET (sw));
|
||||
GtkScrollbar *scrollbar;
|
||||
GtkAdjustment *adj;
|
||||
double page_size;
|
||||
double scroll_unit;
|
||||
double scroll_step;
|
||||
|
||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
scrollbar = GTK_SCROLLBAR (priv->hscrollbar);
|
||||
@@ -1253,32 +1252,9 @@ get_scroll_unit (GtkScrolledWindow *sw,
|
||||
|
||||
adj = gtk_scrollbar_get_adjustment (scrollbar);
|
||||
page_size = gtk_adjustment_get_page_size (adj);
|
||||
scroll_unit = pow (page_size, 2.0 / 3.0);
|
||||
scroll_step = pow (page_size, 2.0 / 3.0);
|
||||
|
||||
#ifdef GDK_WINDOWING_MACOS
|
||||
{
|
||||
GdkEvent *event = gtk_event_controller_get_current_event (GTK_EVENT_CONTROLLER (scroll));
|
||||
|
||||
if (event != NULL &&
|
||||
gdk_event_get_event_type (event) == GDK_SCROLL &&
|
||||
gdk_scroll_event_get_direction (event) == GDK_SCROLL_SMOOTH)
|
||||
scroll_unit = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef GDK_WINDOWING_WAYLAND
|
||||
if (GDK_IS_WAYLAND_DISPLAY (display))
|
||||
{
|
||||
GdkEvent *event = gtk_event_controller_get_current_event (GTK_EVENT_CONTROLLER (scroll));
|
||||
|
||||
if (event != NULL &&
|
||||
gdk_event_get_event_type (event) == GDK_SCROLL &&
|
||||
gdk_scroll_event_get_direction (event) == GDK_SCROLL_SMOOTH)
|
||||
scroll_unit = 25;
|
||||
}
|
||||
#endif
|
||||
|
||||
return scroll_unit;
|
||||
return scroll_step;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -1420,12 +1396,18 @@ scrolled_window_scroll (GtkScrolledWindow *scrolled_window,
|
||||
{
|
||||
GtkAdjustment *adj;
|
||||
double new_value;
|
||||
double scroll_unit;
|
||||
GdkScrollUnit scroll_unit;
|
||||
|
||||
adj = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (priv->hscrollbar));
|
||||
scroll_unit = get_scroll_unit (scrolled_window, GTK_ORIENTATION_HORIZONTAL, scroll);
|
||||
scroll_unit = gtk_event_controller_scroll_get_unit (scroll);
|
||||
|
||||
new_value = priv->unclamped_hadj_value + delta_x * scroll_unit;
|
||||
if (scroll_unit == GDK_SCROLL_UNIT_WHEEL)
|
||||
{
|
||||
delta_x *= get_wheel_detent_scroll_step (scrolled_window,
|
||||
GTK_ORIENTATION_HORIZONTAL);
|
||||
}
|
||||
|
||||
new_value = priv->unclamped_hadj_value + delta_x;
|
||||
_gtk_scrolled_window_set_adjustment_value (scrolled_window, adj,
|
||||
new_value);
|
||||
}
|
||||
@@ -1435,12 +1417,18 @@ scrolled_window_scroll (GtkScrolledWindow *scrolled_window,
|
||||
{
|
||||
GtkAdjustment *adj;
|
||||
double new_value;
|
||||
double scroll_unit;
|
||||
GdkScrollUnit scroll_unit;
|
||||
|
||||
adj = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (priv->vscrollbar));
|
||||
scroll_unit = get_scroll_unit (scrolled_window, GTK_ORIENTATION_VERTICAL, scroll);
|
||||
scroll_unit = gtk_event_controller_scroll_get_unit (scroll);
|
||||
|
||||
new_value = priv->unclamped_vadj_value + delta_y * scroll_unit;
|
||||
if (scroll_unit == GDK_SCROLL_UNIT_WHEEL)
|
||||
{
|
||||
delta_y *= get_wheel_detent_scroll_step (scrolled_window,
|
||||
GTK_ORIENTATION_VERTICAL);
|
||||
}
|
||||
|
||||
new_value = priv->unclamped_vadj_value + delta_y;
|
||||
_gtk_scrolled_window_set_adjustment_value (scrolled_window, adj,
|
||||
new_value);
|
||||
}
|
||||
@@ -1487,30 +1475,36 @@ scroll_controller_decelerate (GtkEventControllerScroll *scroll,
|
||||
double initial_vel_y,
|
||||
GtkScrolledWindow *scrolled_window)
|
||||
{
|
||||
double unit_x, unit_y;
|
||||
GdkScrollUnit scroll_unit;
|
||||
gboolean shifted;
|
||||
GdkModifierType state;
|
||||
|
||||
|
||||
scroll_unit = gtk_event_controller_scroll_get_unit (scroll);
|
||||
state = gtk_event_controller_get_current_event_state (GTK_EVENT_CONTROLLER (scroll));
|
||||
|
||||
shifted = (state & GDK_SHIFT_MASK) != 0;
|
||||
|
||||
unit_x = get_scroll_unit (scrolled_window, GTK_ORIENTATION_HORIZONTAL, scroll);
|
||||
unit_y = get_scroll_unit (scrolled_window, GTK_ORIENTATION_VERTICAL, scroll);
|
||||
|
||||
if (shifted)
|
||||
{
|
||||
gtk_scrolled_window_decelerate (scrolled_window,
|
||||
initial_vel_y * unit_x,
|
||||
initial_vel_x * unit_y);
|
||||
double tmp;
|
||||
|
||||
tmp = initial_vel_x;
|
||||
initial_vel_x = initial_vel_y;
|
||||
initial_vel_y = tmp;
|
||||
}
|
||||
else
|
||||
|
||||
if (scroll_unit == GDK_SCROLL_UNIT_WHEEL)
|
||||
{
|
||||
gtk_scrolled_window_decelerate (scrolled_window,
|
||||
initial_vel_x * unit_x,
|
||||
initial_vel_y * unit_y);
|
||||
initial_vel_x *= get_wheel_detent_scroll_step (scrolled_window,
|
||||
GTK_ORIENTATION_HORIZONTAL);
|
||||
|
||||
initial_vel_y *= get_wheel_detent_scroll_step (scrolled_window,
|
||||
GTK_ORIENTATION_VERTICAL);
|
||||
}
|
||||
|
||||
gtk_scrolled_window_decelerate (scrolled_window,
|
||||
initial_vel_x,
|
||||
initial_vel_y);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -3281,6 +3275,7 @@ scrolled_window_deceleration_cb (GtkWidget *widget,
|
||||
GtkAdjustment *hadjustment, *vadjustment;
|
||||
gint64 current_time;
|
||||
double position, elapsed;
|
||||
gboolean retval = G_SOURCE_REMOVE;
|
||||
|
||||
current_time = gdk_frame_clock_get_frame_time (frame_clock);
|
||||
elapsed = (current_time - priv->last_deceleration_time) / (double)G_TIME_SPAN_SECOND;
|
||||
@@ -3296,28 +3291,23 @@ scrolled_window_deceleration_cb (GtkWidget *widget,
|
||||
{
|
||||
priv->unclamped_hadj_value = position;
|
||||
gtk_adjustment_set_value (hadjustment, position);
|
||||
retval = G_SOURCE_CONTINUE;
|
||||
}
|
||||
else if (priv->hscrolling)
|
||||
g_clear_pointer (&priv->hscrolling, gtk_kinetic_scrolling_free);
|
||||
|
||||
if (priv->vscrolling &&
|
||||
gtk_kinetic_scrolling_tick (priv->vscrolling, elapsed, &position, NULL))
|
||||
{
|
||||
priv->unclamped_vadj_value = position;
|
||||
gtk_adjustment_set_value (vadjustment, position);
|
||||
}
|
||||
else if (priv->vscrolling)
|
||||
g_clear_pointer (&priv->vscrolling, gtk_kinetic_scrolling_free);
|
||||
|
||||
if (!priv->hscrolling && !priv->vscrolling)
|
||||
{
|
||||
gtk_scrolled_window_cancel_deceleration (scrolled_window);
|
||||
return G_SOURCE_REMOVE;
|
||||
retval = G_SOURCE_CONTINUE;
|
||||
}
|
||||
|
||||
gtk_scrolled_window_invalidate_overshoot (scrolled_window);
|
||||
if (retval == G_SOURCE_REMOVE)
|
||||
gtk_scrolled_window_cancel_deceleration (scrolled_window);
|
||||
else
|
||||
gtk_scrolled_window_invalidate_overshoot (scrolled_window);
|
||||
|
||||
return G_SOURCE_CONTINUE;
|
||||
return retval;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -3381,19 +3371,23 @@ gtk_scrolled_window_start_deceleration (GtkScrolledWindow *scrolled_window)
|
||||
GtkAdjustment *hadjustment;
|
||||
|
||||
gtk_scrolled_window_accumulate_velocity (&priv->hscrolling, elapsed, &priv->x_velocity);
|
||||
g_clear_pointer (&priv->hscrolling, gtk_kinetic_scrolling_free);
|
||||
|
||||
hadjustment = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (priv->hscrollbar));
|
||||
lower = gtk_adjustment_get_lower (hadjustment);
|
||||
upper = gtk_adjustment_get_upper (hadjustment);
|
||||
upper -= gtk_adjustment_get_page_size (hadjustment);
|
||||
priv->hscrolling =
|
||||
gtk_kinetic_scrolling_new (lower,
|
||||
upper,
|
||||
MAX_OVERSHOOT_DISTANCE,
|
||||
DECELERATION_FRICTION,
|
||||
OVERSHOOT_FRICTION,
|
||||
priv->unclamped_hadj_value,
|
||||
priv->x_velocity);
|
||||
if (priv->x_velocity != 0)
|
||||
{
|
||||
hadjustment = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (priv->hscrollbar));
|
||||
lower = gtk_adjustment_get_lower (hadjustment);
|
||||
upper = gtk_adjustment_get_upper (hadjustment);
|
||||
upper -= gtk_adjustment_get_page_size (hadjustment);
|
||||
priv->hscrolling =
|
||||
gtk_kinetic_scrolling_new (lower,
|
||||
upper,
|
||||
MAX_OVERSHOOT_DISTANCE,
|
||||
DECELERATION_FRICTION,
|
||||
OVERSHOOT_FRICTION,
|
||||
priv->unclamped_hadj_value,
|
||||
priv->x_velocity);
|
||||
}
|
||||
}
|
||||
else
|
||||
g_clear_pointer (&priv->hscrolling, gtk_kinetic_scrolling_free);
|
||||
@@ -3404,19 +3398,23 @@ gtk_scrolled_window_start_deceleration (GtkScrolledWindow *scrolled_window)
|
||||
GtkAdjustment *vadjustment;
|
||||
|
||||
gtk_scrolled_window_accumulate_velocity (&priv->vscrolling, elapsed, &priv->y_velocity);
|
||||
g_clear_pointer (&priv->vscrolling, gtk_kinetic_scrolling_free);
|
||||
|
||||
vadjustment = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (priv->vscrollbar));
|
||||
lower = gtk_adjustment_get_lower(vadjustment);
|
||||
upper = gtk_adjustment_get_upper(vadjustment);
|
||||
upper -= gtk_adjustment_get_page_size(vadjustment);
|
||||
priv->vscrolling =
|
||||
gtk_kinetic_scrolling_new (lower,
|
||||
upper,
|
||||
MAX_OVERSHOOT_DISTANCE,
|
||||
DECELERATION_FRICTION,
|
||||
OVERSHOOT_FRICTION,
|
||||
priv->unclamped_vadj_value,
|
||||
priv->y_velocity);
|
||||
if (priv->y_velocity != 0)
|
||||
{
|
||||
vadjustment = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (priv->vscrollbar));
|
||||
lower = gtk_adjustment_get_lower(vadjustment);
|
||||
upper = gtk_adjustment_get_upper(vadjustment);
|
||||
upper -= gtk_adjustment_get_page_size(vadjustment);
|
||||
priv->vscrolling =
|
||||
gtk_kinetic_scrolling_new (lower,
|
||||
upper,
|
||||
MAX_OVERSHOOT_DISTANCE,
|
||||
DECELERATION_FRICTION,
|
||||
OVERSHOOT_FRICTION,
|
||||
priv->unclamped_vadj_value,
|
||||
priv->y_velocity);
|
||||
}
|
||||
}
|
||||
else
|
||||
g_clear_pointer (&priv->vscrolling, gtk_kinetic_scrolling_free);
|
||||
|
||||
+78
-6
@@ -106,6 +106,7 @@ enum {
|
||||
PROP_0,
|
||||
PROP_PLACEHOLDER_TEXT,
|
||||
PROP_ACTIVATES_DEFAULT,
|
||||
PROP_SEARCH_DELAY,
|
||||
NUM_PROPERTIES,
|
||||
};
|
||||
|
||||
@@ -122,6 +123,8 @@ struct _GtkSearchEntry
|
||||
GtkWidget *capture_widget;
|
||||
GtkEventController *capture_widget_controller;
|
||||
|
||||
guint search_delay;
|
||||
|
||||
GtkWidget *entry;
|
||||
GtkWidget *icon;
|
||||
|
||||
@@ -150,9 +153,6 @@ G_DEFINE_TYPE_WITH_CODE (GtkSearchEntry, gtk_search_entry, GTK_TYPE_WIDGET,
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_EDITABLE,
|
||||
gtk_search_entry_editable_init))
|
||||
|
||||
/* 150 mseconds of delay */
|
||||
#define DELAYED_TIMEOUT_ID 150
|
||||
|
||||
static void
|
||||
text_changed (GtkSearchEntry *entry)
|
||||
{
|
||||
@@ -224,6 +224,10 @@ gtk_search_entry_set_property (GObject *object,
|
||||
}
|
||||
break;
|
||||
|
||||
case PROP_SEARCH_DELAY:
|
||||
gtk_search_entry_set_search_delay (entry, g_value_get_uint (value));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
@@ -250,6 +254,10 @@ gtk_search_entry_get_property (GObject *object,
|
||||
g_value_set_boolean (value, gtk_text_get_activates_default (GTK_TEXT (entry->entry)));
|
||||
break;
|
||||
|
||||
case PROP_SEARCH_DELAY:
|
||||
g_value_set_uint (value, entry->search_delay);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
@@ -315,6 +323,21 @@ gtk_search_entry_class_init (GtkSearchEntryClass *klass)
|
||||
FALSE,
|
||||
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GtkSearchEntry:search-delay:
|
||||
*
|
||||
* The delay in milliseconds from last keypress to the search
|
||||
* changed signal.
|
||||
*
|
||||
* Since: 4.8
|
||||
*/
|
||||
props[PROP_SEARCH_DELAY] =
|
||||
g_param_spec_uint ("search-delay",
|
||||
P_("Search delay"),
|
||||
P_("The delay from last keypress to the search-changed signal. If this is not set, it defaults to 150ms"),
|
||||
0, G_MAXUINT, 150,
|
||||
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
g_object_class_install_properties (object_class, NUM_PROPERTIES, props);
|
||||
gtk_editable_install_properties (object_class, NUM_PROPERTIES);
|
||||
|
||||
@@ -339,8 +362,9 @@ gtk_search_entry_class_init (GtkSearchEntryClass *klass)
|
||||
* GtkSearchEntry::search-changed:
|
||||
* @entry: the entry on which the signal was emitted
|
||||
*
|
||||
* Emitted with a short delay of 150 milliseconds after the
|
||||
* last change to the entry text.
|
||||
* Emitted with a delay. The length of the delay can be
|
||||
* changed with the [property@Gtk.SearchEntry:search-delay]
|
||||
* property.
|
||||
*/
|
||||
signals[SEARCH_CHANGED] =
|
||||
g_signal_new (I_("search-changed"),
|
||||
@@ -526,7 +550,7 @@ reset_timeout (GtkSearchEntry *entry)
|
||||
{
|
||||
if (entry->delayed_changed_id > 0)
|
||||
g_source_remove (entry->delayed_changed_id);
|
||||
entry->delayed_changed_id = g_timeout_add (DELAYED_TIMEOUT_ID,
|
||||
entry->delayed_changed_id = g_timeout_add (entry->search_delay,
|
||||
gtk_search_entry_changed_timeout_cb,
|
||||
entry);
|
||||
gdk_source_set_static_name_by_id (entry->delayed_changed_id, "[gtk] gtk_search_entry_changed_timeout_cb");
|
||||
@@ -595,6 +619,8 @@ gtk_search_entry_init (GtkSearchEntry *entry)
|
||||
GtkWidget *icon;
|
||||
GtkGesture *press, *catchall;
|
||||
|
||||
entry->search_delay = 150;
|
||||
|
||||
/* The search icon is purely presentational */
|
||||
icon = g_object_new (GTK_TYPE_IMAGE,
|
||||
"accessible-role", GTK_ACCESSIBLE_ROLE_PRESENTATION,
|
||||
@@ -773,6 +799,52 @@ gtk_search_entry_get_key_capture_widget (GtkSearchEntry *entry)
|
||||
return entry->capture_widget;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_search_entry_set_search_delay:
|
||||
* @entry: a `GtkSearchEntry`
|
||||
* @delay: a delay in milliseconds
|
||||
*
|
||||
* Set the delay to be used between the last keypress and the
|
||||
* [signal@Gtk.SearchEntry::search-changed] signal being emitted.
|
||||
*
|
||||
* Since: 4.8
|
||||
*/
|
||||
void
|
||||
gtk_search_entry_set_search_delay (GtkSearchEntry *entry,
|
||||
guint delay)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_SEARCH_ENTRY (entry));
|
||||
|
||||
if (entry->search_delay == delay)
|
||||
return;
|
||||
|
||||
entry->search_delay = delay;
|
||||
|
||||
/* Apply the updated timeout */
|
||||
reset_timeout (entry);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (entry), props[PROP_SEARCH_DELAY]);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_search_entry_get_search_delay
|
||||
* @entry: a `GtkSearchEntry`
|
||||
*
|
||||
* Get the delay to be used between the last keypress and the
|
||||
* [signal@Gtk.SearchEntry::search-changed] signal being emitted.
|
||||
*
|
||||
* Returns: a delay in milliseconds.
|
||||
*
|
||||
* Since: 4.8
|
||||
*/
|
||||
guint
|
||||
gtk_search_entry_get_search_delay (GtkSearchEntry *entry)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_SEARCH_ENTRY (entry), 0);
|
||||
|
||||
return entry->search_delay;
|
||||
}
|
||||
|
||||
GtkEventController *
|
||||
gtk_search_entry_get_key_controller (GtkSearchEntry *entry)
|
||||
{
|
||||
|
||||
@@ -54,6 +54,11 @@ void gtk_search_entry_set_key_capture_widget (GtkSearchEntry *entry,
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkWidget* gtk_search_entry_get_key_capture_widget (GtkSearchEntry *entry);
|
||||
|
||||
GDK_AVAILABLE_IN_4_8
|
||||
void gtk_search_entry_set_search_delay (GtkSearchEntry *entry,
|
||||
guint delay);
|
||||
GDK_AVAILABLE_IN_4_8
|
||||
guint gtk_search_entry_get_search_delay (GtkSearchEntry *entry);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
+3
-1
@@ -127,7 +127,9 @@ gtk_show_uri_full (GtkWindow *parent,
|
||||
data->task = g_task_new (parent, cancellable, callback, user_data);
|
||||
g_task_set_source_tag (data->task, gtk_show_uri);
|
||||
|
||||
if (!parent || !gtk_window_export_handle (parent, window_handle_exported, data))
|
||||
if (parent)
|
||||
gtk_window_export_handle (parent, window_handle_exported, data);
|
||||
else
|
||||
window_handle_exported (parent, NULL, data);
|
||||
}
|
||||
|
||||
|
||||
+22
-20
@@ -163,10 +163,7 @@ gtk_snapshot_dispose (GObject *object)
|
||||
GtkSnapshot *snapshot = GTK_SNAPSHOT (object);
|
||||
|
||||
if (!gtk_snapshot_states_is_empty (&snapshot->state_stack))
|
||||
{
|
||||
GskRenderNode *node = gtk_snapshot_to_node (snapshot);
|
||||
g_clear_pointer (&node, gsk_render_node_unref);
|
||||
}
|
||||
gsk_render_node_unref (gtk_snapshot_to_node (snapshot));
|
||||
|
||||
g_assert (gtk_snapshot_states_is_empty (&snapshot->state_stack));
|
||||
g_assert (gtk_snapshot_nodes_is_empty (&snapshot->nodes));
|
||||
@@ -182,6 +179,11 @@ gtk_snapshot_class_init (GtkSnapshotClass *klass)
|
||||
gobject_class->dispose = gtk_snapshot_dispose;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_snapshot_init (GtkSnapshot *self)
|
||||
{
|
||||
}
|
||||
|
||||
static GskRenderNode *
|
||||
gtk_snapshot_collect_default (GtkSnapshot *snapshot,
|
||||
GtkSnapshotState *state,
|
||||
@@ -268,18 +270,6 @@ gtk_snapshot_state_clear (GtkSnapshotState *state)
|
||||
gsk_transform_unref (state->transform);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_snapshot_init (GtkSnapshot *self)
|
||||
{
|
||||
gtk_snapshot_states_init (&self->state_stack);
|
||||
gtk_snapshot_nodes_init (&self->nodes);
|
||||
|
||||
gtk_snapshot_push_state (self,
|
||||
NULL,
|
||||
gtk_snapshot_collect_default,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_snapshot_new:
|
||||
*
|
||||
@@ -290,7 +280,19 @@ gtk_snapshot_init (GtkSnapshot *self)
|
||||
GtkSnapshot *
|
||||
gtk_snapshot_new (void)
|
||||
{
|
||||
return g_object_new (GTK_TYPE_SNAPSHOT, NULL);
|
||||
GtkSnapshot *snapshot;
|
||||
|
||||
snapshot = g_object_new (GTK_TYPE_SNAPSHOT, NULL);
|
||||
|
||||
gtk_snapshot_states_init (&snapshot->state_stack);
|
||||
gtk_snapshot_nodes_init (&snapshot->nodes);
|
||||
|
||||
gtk_snapshot_push_state (snapshot,
|
||||
NULL,
|
||||
gtk_snapshot_collect_default,
|
||||
NULL);
|
||||
|
||||
return snapshot;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -759,7 +761,7 @@ gtk_snapshot_ensure_translate (GtkSnapshot *snapshot,
|
||||
gtk_snapshot_autopush_transform (snapshot);
|
||||
state = gtk_snapshot_get_current_state (snapshot);
|
||||
}
|
||||
|
||||
|
||||
gsk_transform_to_translate (state->transform, dx, dy);
|
||||
}
|
||||
|
||||
@@ -848,7 +850,7 @@ gtk_snapshot_push_clip (GtkSnapshot *snapshot,
|
||||
{
|
||||
GtkSnapshotState *state;
|
||||
float scale_x, scale_y, dx, dy;
|
||||
|
||||
|
||||
gtk_snapshot_ensure_affine (snapshot, &scale_x, &scale_y, &dx, &dy);
|
||||
|
||||
state = gtk_snapshot_push_state (snapshot,
|
||||
@@ -2515,7 +2517,7 @@ gtk_snapshot_append_border (GtkSnapshot *snapshot,
|
||||
gsk_rounded_rect_scale_affine (&real_outline, outline, scale_x, scale_y, dx, dy);
|
||||
|
||||
node = gsk_border_node_new (&real_outline,
|
||||
(float[4]) {
|
||||
(float[4]) {
|
||||
border_width[0] * scale_y,
|
||||
border_width[1] * scale_x,
|
||||
border_width[2] * scale_y,
|
||||
|
||||
+3
-5
@@ -1638,11 +1638,9 @@ gtk_stack_remove (GtkStack *stack,
|
||||
* @stack: a `GtkStack`
|
||||
* @child: a child of @stack
|
||||
*
|
||||
* Retrieves the stack page for the given @child.
|
||||
* Returns the `GtkStackPage` object for @child.
|
||||
*
|
||||
* If the given @child is not a child widget of the stack, this function will return `NULL`.
|
||||
*
|
||||
* Returns: (transfer none) (nullable): the stack page object
|
||||
* Returns: (transfer none): the `GtkStackPage` for @child
|
||||
*/
|
||||
GtkStackPage *
|
||||
gtk_stack_get_page (GtkStack *stack,
|
||||
@@ -2585,7 +2583,7 @@ gtk_stack_measure (GtkWidget *widget,
|
||||
int min_for_size;
|
||||
|
||||
gtk_widget_measure (child, OPPOSITE_ORIENTATION (orientation), -1, &min_for_size, NULL, NULL, NULL);
|
||||
|
||||
|
||||
gtk_widget_measure (child, orientation, MAX (min_for_size, for_size), &child_min, &child_nat, NULL, NULL);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -34,8 +34,6 @@
|
||||
#include "gtkwidgetprivate.h"
|
||||
#include "gtkintl.h"
|
||||
|
||||
#include <glib/gi18n-lib.h>
|
||||
|
||||
/**
|
||||
* GtkStackSidebar:
|
||||
*
|
||||
@@ -150,11 +148,6 @@ gtk_stack_sidebar_init (GtkStackSidebar *self)
|
||||
|
||||
self->list = GTK_LIST_BOX (gtk_list_box_new ());
|
||||
gtk_widget_add_css_class (GTK_WIDGET (self->list), "navigation-sidebar");
|
||||
gtk_accessible_update_property (GTK_ACCESSIBLE (self->list),
|
||||
GTK_ACCESSIBLE_PROPERTY_LABEL,
|
||||
C_("accessibility", "Sidebar"),
|
||||
-1);
|
||||
|
||||
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), GTK_WIDGET (self->list));
|
||||
|
||||
|
||||
+18
-31
@@ -1523,13 +1523,13 @@ gtk_text_class_init (GtkTextClass *class)
|
||||
NULL);
|
||||
|
||||
/* Emoji */
|
||||
gtk_widget_class_add_binding_action (widget_class,
|
||||
gtk_widget_class_add_binding_signal (widget_class,
|
||||
GDK_KEY_period, GDK_CONTROL_MASK,
|
||||
"misc.insert-emoji",
|
||||
"insert-emoji",
|
||||
NULL);
|
||||
gtk_widget_class_add_binding_action (widget_class,
|
||||
gtk_widget_class_add_binding_signal (widget_class,
|
||||
GDK_KEY_semicolon, GDK_CONTROL_MASK,
|
||||
"misc.insert-emoji",
|
||||
"insert-emoji",
|
||||
NULL);
|
||||
|
||||
/* Undo/Redo */
|
||||
@@ -3808,6 +3808,8 @@ gtk_text_move_cursor (GtkText *self,
|
||||
GtkTextPrivate *priv = gtk_text_get_instance_private (self);
|
||||
int new_pos = priv->current_pos;
|
||||
|
||||
gtk_text_reset_im_context (self);
|
||||
|
||||
if (priv->current_pos != priv->selection_bound && !extend_selection)
|
||||
{
|
||||
/* If we have a current selection and aren't extending it, move to the
|
||||
@@ -3934,9 +3936,6 @@ gtk_text_move_cursor (GtkText *self,
|
||||
gtk_text_set_selection_bounds (self, new_pos, new_pos);
|
||||
|
||||
gtk_text_pend_cursor_blink (self);
|
||||
|
||||
priv->need_im_reset = TRUE;
|
||||
gtk_text_reset_im_context (self);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -3964,6 +3963,8 @@ gtk_text_delete_from_cursor (GtkText *self,
|
||||
int end_pos = priv->current_pos;
|
||||
int old_n_bytes = gtk_entry_buffer_get_bytes (get_buffer (self));
|
||||
|
||||
gtk_text_reset_im_context (self);
|
||||
|
||||
if (!priv->editable)
|
||||
{
|
||||
gtk_widget_error_bell (GTK_WIDGET (self));
|
||||
@@ -3973,8 +3974,6 @@ gtk_text_delete_from_cursor (GtkText *self,
|
||||
if (priv->selection_bound != priv->current_pos)
|
||||
{
|
||||
gtk_text_delete_selection (self);
|
||||
gtk_text_schedule_im_reset (self);
|
||||
gtk_text_reset_im_context (self);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4039,11 +4038,6 @@ gtk_text_delete_from_cursor (GtkText *self,
|
||||
|
||||
if (gtk_entry_buffer_get_bytes (get_buffer (self)) == old_n_bytes)
|
||||
gtk_widget_error_bell (GTK_WIDGET (self));
|
||||
else
|
||||
{
|
||||
gtk_text_schedule_im_reset (self);
|
||||
gtk_text_reset_im_context (self);
|
||||
}
|
||||
|
||||
gtk_text_pend_cursor_blink (self);
|
||||
}
|
||||
@@ -4054,6 +4048,8 @@ gtk_text_backspace (GtkText *self)
|
||||
GtkTextPrivate *priv = gtk_text_get_instance_private (self);
|
||||
int prev_pos;
|
||||
|
||||
gtk_text_reset_im_context (self);
|
||||
|
||||
if (!priv->editable)
|
||||
{
|
||||
gtk_widget_error_bell (GTK_WIDGET (self));
|
||||
@@ -4063,8 +4059,6 @@ gtk_text_backspace (GtkText *self)
|
||||
if (priv->selection_bound != priv->current_pos)
|
||||
{
|
||||
gtk_text_delete_selection (self);
|
||||
gtk_text_schedule_im_reset (self);
|
||||
gtk_text_reset_im_context (self);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4109,9 +4103,6 @@ gtk_text_backspace (GtkText *self)
|
||||
{
|
||||
gtk_editable_delete_text (GTK_EDITABLE (self), prev_pos, priv->current_pos);
|
||||
}
|
||||
|
||||
gtk_text_schedule_im_reset (self);
|
||||
gtk_text_reset_im_context (self);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -4332,11 +4323,9 @@ gtk_text_delete_surrounding_cb (GtkIMContext *context,
|
||||
GtkTextPrivate *priv = gtk_text_get_instance_private (self);
|
||||
|
||||
if (priv->editable)
|
||||
{
|
||||
gtk_editable_delete_text (GTK_EDITABLE (self),
|
||||
priv->current_pos + offset,
|
||||
priv->current_pos + offset + n_chars);
|
||||
}
|
||||
gtk_editable_delete_text (GTK_EDITABLE (self),
|
||||
priv->current_pos + offset,
|
||||
priv->current_pos + offset + n_chars);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -4351,8 +4340,10 @@ gtk_text_enter_text (GtkText *self,
|
||||
{
|
||||
GtkTextPrivate *priv = gtk_text_get_instance_private (self);
|
||||
int tmp_pos;
|
||||
gboolean old_need_im_reset;
|
||||
guint text_length;
|
||||
|
||||
old_need_im_reset = priv->need_im_reset;
|
||||
priv->need_im_reset = FALSE;
|
||||
|
||||
if (priv->selection_bound != priv->current_pos)
|
||||
@@ -4370,6 +4361,8 @@ gtk_text_enter_text (GtkText *self,
|
||||
tmp_pos = priv->current_pos;
|
||||
gtk_editable_insert_text (GTK_EDITABLE (self), str, strlen (str), &tmp_pos);
|
||||
gtk_text_set_selection_bounds (self, tmp_pos, tmp_pos);
|
||||
|
||||
priv->need_im_reset = old_need_im_reset;
|
||||
}
|
||||
|
||||
/* All changes to priv->current_pos and priv->selection_bound
|
||||
@@ -6578,13 +6571,7 @@ blink_cb (GtkWidget *widget,
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
if (priv->selection_bound != priv->current_pos)
|
||||
{
|
||||
g_warning ("GtkText - unexpected blinking selection. Removing");
|
||||
|
||||
gtk_text_check_cursor_blink (self);
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
g_assert (priv->selection_bound == priv->current_pos);
|
||||
|
||||
blink_timeout = get_cursor_blink_timeout (self);
|
||||
blink_time = get_cursor_time (self);
|
||||
|
||||
+18
-20
@@ -5516,8 +5516,17 @@ gtk_text_view_key_controller_im_update (GtkEventControllerKey *controller,
|
||||
GtkTextView *text_view)
|
||||
{
|
||||
GtkTextViewPrivate *priv = text_view->priv;
|
||||
GtkTextMark *insert;
|
||||
GtkTextIter iter;
|
||||
gboolean can_insert;
|
||||
|
||||
insert = gtk_text_buffer_get_insert (get_buffer (text_view));
|
||||
gtk_text_buffer_get_iter_at_mark (get_buffer (text_view), &iter, insert);
|
||||
can_insert = gtk_text_iter_can_insert (&iter, priv->editable);
|
||||
|
||||
priv->need_im_reset = TRUE;
|
||||
if (!can_insert)
|
||||
gtk_text_view_reset_im_context (text_view);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -6349,6 +6358,8 @@ gtk_text_view_move_cursor (GtkTextView *text_view,
|
||||
return;
|
||||
}
|
||||
|
||||
gtk_text_view_reset_im_context (text_view);
|
||||
|
||||
if (step == GTK_MOVEMENT_PAGES)
|
||||
{
|
||||
if (!gtk_text_view_scroll_pages (text_view, count, extend_selection))
|
||||
@@ -6532,9 +6543,6 @@ gtk_text_view_move_cursor (GtkTextView *text_view,
|
||||
|
||||
gtk_text_view_check_cursor_blink (text_view);
|
||||
gtk_text_view_pend_cursor_blink (text_view);
|
||||
|
||||
priv->need_im_reset = TRUE;
|
||||
gtk_text_view_reset_im_context (text_view);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -6825,16 +6833,14 @@ gtk_text_view_delete_from_cursor (GtkTextView *text_view,
|
||||
|
||||
priv = text_view->priv;
|
||||
|
||||
gtk_text_view_reset_im_context (text_view);
|
||||
|
||||
if (type == GTK_DELETE_CHARS)
|
||||
{
|
||||
/* Char delete deletes the selection, if one exists */
|
||||
if (gtk_text_buffer_delete_selection (get_buffer (text_view), TRUE,
|
||||
priv->editable))
|
||||
{
|
||||
priv->need_im_reset = TRUE;
|
||||
gtk_text_view_reset_im_context (text_view);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
gtk_text_buffer_get_iter_at_mark (get_buffer (text_view), &insert,
|
||||
@@ -6961,9 +6967,6 @@ gtk_text_view_delete_from_cursor (GtkTextView *text_view,
|
||||
{
|
||||
gtk_widget_error_bell (GTK_WIDGET (text_view));
|
||||
}
|
||||
|
||||
priv->need_im_reset = TRUE;
|
||||
gtk_text_view_reset_im_context (text_view);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -6974,14 +6977,12 @@ gtk_text_view_backspace (GtkTextView *text_view)
|
||||
|
||||
priv = text_view->priv;
|
||||
|
||||
gtk_text_view_reset_im_context (text_view);
|
||||
|
||||
/* Backspace deletes the selection, if one exists */
|
||||
if (gtk_text_buffer_delete_selection (get_buffer (text_view), TRUE,
|
||||
priv->editable))
|
||||
{
|
||||
priv->need_im_reset = TRUE;
|
||||
gtk_text_view_reset_im_context (text_view);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
|
||||
gtk_text_buffer_get_iter_at_mark (get_buffer (text_view),
|
||||
&insert,
|
||||
@@ -6994,9 +6995,6 @@ gtk_text_view_backspace (GtkTextView *text_view)
|
||||
DV(g_print (G_STRLOC": scrolling onscreen\n"));
|
||||
gtk_text_view_scroll_mark_onscreen (text_view,
|
||||
gtk_text_buffer_get_insert (get_buffer (text_view)));
|
||||
|
||||
priv->need_im_reset = TRUE;
|
||||
gtk_text_view_reset_im_context (text_view);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -8687,7 +8685,7 @@ gtk_text_view_delete_surrounding_handler (GtkIMContext *context,
|
||||
gtk_text_iter_forward_chars (&end, offset + n_chars);
|
||||
|
||||
gtk_text_buffer_delete_interactive (priv->buffer, &start, &end,
|
||||
priv->editable);
|
||||
priv->editable);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
+11
-16
@@ -436,20 +436,6 @@ gtk_tree_list_model_items_changed_cb (GListModel *model,
|
||||
|
||||
static void gtk_tree_list_row_destroy (GtkTreeListRow *row);
|
||||
|
||||
static void
|
||||
gtk_tree_list_model_clear_node_children (TreeNode *node)
|
||||
{
|
||||
if (node->model)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (node->model,
|
||||
gtk_tree_list_model_items_changed_cb,
|
||||
node);
|
||||
g_clear_object (&node->model);
|
||||
}
|
||||
|
||||
g_clear_pointer (&node->children, gtk_rb_tree_unref);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tree_list_model_clear_node (gpointer data)
|
||||
{
|
||||
@@ -458,7 +444,15 @@ gtk_tree_list_model_clear_node (gpointer data)
|
||||
if (node->row)
|
||||
gtk_tree_list_row_destroy (node->row);
|
||||
|
||||
gtk_tree_list_model_clear_node_children (node);
|
||||
if (node->model)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (node->model,
|
||||
gtk_tree_list_model_items_changed_cb,
|
||||
node);
|
||||
g_object_unref (node->model);
|
||||
}
|
||||
if (node->children)
|
||||
gtk_rb_tree_unref (node->children);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -553,7 +547,8 @@ gtk_tree_list_model_collapse_node (GtkTreeListModel *self,
|
||||
|
||||
n_items = tree_node_get_n_children (node);
|
||||
|
||||
gtk_tree_list_model_clear_node_children (node);
|
||||
g_clear_pointer (&node->children, gtk_rb_tree_unref);
|
||||
g_clear_object (&node->model);
|
||||
|
||||
tree_node_mark_dirty (node);
|
||||
|
||||
|
||||
+6
-24
@@ -30,8 +30,6 @@
|
||||
#include "gtkgizmoprivate.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
#include "gtkbuiltiniconprivate.h"
|
||||
#include "gtkscrolledwindow.h"
|
||||
#include "gtkviewport.h"
|
||||
|
||||
// TODO
|
||||
// positioning + sizing
|
||||
@@ -228,22 +226,12 @@ gtk_tree_popover_class_init (GtkTreePopoverClass *class)
|
||||
G_TYPE_NONE, 1, G_TYPE_STRING);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
gtk_tree_popover_get_stack (GtkTreePopover *popover)
|
||||
{
|
||||
GtkWidget *sw = gtk_popover_get_child (GTK_POPOVER (popover));
|
||||
GtkWidget *vp = gtk_scrolled_window_get_child (GTK_SCROLLED_WINDOW (sw));
|
||||
GtkWidget *stack = gtk_viewport_get_child (GTK_VIEWPORT (vp));
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tree_popover_add_submenu (GtkTreePopover *popover,
|
||||
GtkWidget *submenu,
|
||||
const char *name)
|
||||
{
|
||||
GtkWidget *stack = gtk_tree_popover_get_stack (popover);
|
||||
GtkWidget *stack = gtk_popover_get_child (GTK_POPOVER (popover));
|
||||
gtk_stack_add_named (GTK_STACK (stack), submenu, name);
|
||||
}
|
||||
|
||||
@@ -251,7 +239,7 @@ static GtkWidget *
|
||||
gtk_tree_popover_get_submenu (GtkTreePopover *popover,
|
||||
const char *name)
|
||||
{
|
||||
GtkWidget *stack = gtk_tree_popover_get_stack (popover);
|
||||
GtkWidget *stack = gtk_popover_get_child (GTK_POPOVER (popover));
|
||||
return gtk_stack_get_child_by_name (GTK_STACK (stack), name);
|
||||
}
|
||||
|
||||
@@ -259,26 +247,20 @@ void
|
||||
gtk_tree_popover_open_submenu (GtkTreePopover *popover,
|
||||
const char *name)
|
||||
{
|
||||
GtkWidget *stack = gtk_tree_popover_get_stack (popover);
|
||||
GtkWidget *stack = gtk_popover_get_child (GTK_POPOVER (popover));
|
||||
gtk_stack_set_visible_child_name (GTK_STACK (stack), name);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tree_popover_init (GtkTreePopover *popover)
|
||||
{
|
||||
GtkWidget *sw;
|
||||
GtkWidget *stack;
|
||||
|
||||
sw = gtk_scrolled_window_new ();
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
|
||||
gtk_scrolled_window_set_propagate_natural_height (GTK_SCROLLED_WINDOW (sw), TRUE);
|
||||
gtk_popover_set_child (GTK_POPOVER (popover), sw);
|
||||
|
||||
stack = gtk_stack_new ();
|
||||
gtk_stack_set_vhomogeneous (GTK_STACK (stack), FALSE);
|
||||
gtk_stack_set_transition_type (GTK_STACK (stack), GTK_STACK_TRANSITION_TYPE_SLIDE_LEFT_RIGHT);
|
||||
gtk_stack_set_interpolate_size (GTK_STACK (stack), TRUE);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), stack);
|
||||
gtk_popover_set_child (GTK_POPOVER (popover), stack);
|
||||
|
||||
gtk_widget_add_css_class (GTK_WIDGET (popover), "menu");
|
||||
}
|
||||
@@ -483,7 +465,7 @@ static GtkWidget *
|
||||
gtk_tree_popover_get_path_item (GtkTreePopover *popover,
|
||||
GtkTreePath *search)
|
||||
{
|
||||
GtkWidget *stack = gtk_tree_popover_get_stack (popover);
|
||||
GtkWidget *stack = gtk_popover_get_child (GTK_POPOVER (popover));
|
||||
GtkWidget *item = NULL;
|
||||
GtkWidget *stackchild;
|
||||
GtkWidget *child;
|
||||
@@ -797,7 +779,7 @@ rebuild_menu (GtkTreePopover *popover)
|
||||
GtkWidget *stack;
|
||||
GtkWidget *child;
|
||||
|
||||
stack = gtk_tree_popover_get_stack (popover);
|
||||
stack = gtk_popover_get_child (GTK_POPOVER (popover));
|
||||
while ((child = gtk_widget_get_first_child (stack)))
|
||||
gtk_stack_remove (GTK_STACK (stack), child);
|
||||
|
||||
|
||||
+44
-55
@@ -2770,13 +2770,6 @@ gtk_tree_view_click_gesture_pressed (GtkGestureClick *gesture,
|
||||
gboolean rtl;
|
||||
GtkWidget *target;
|
||||
|
||||
gtk_tree_view_convert_widget_to_bin_window_coords (tree_view, x, y,
|
||||
&bin_x, &bin_y);
|
||||
|
||||
/* Are we clicking a column header? */
|
||||
if (bin_y < 0)
|
||||
return;
|
||||
|
||||
/* check if this is a click in a child widget */
|
||||
target = gtk_event_controller_get_target (GTK_EVENT_CONTROLLER (gesture));
|
||||
if (gtk_widget_is_ancestor (target, widget))
|
||||
@@ -2792,6 +2785,13 @@ gtk_tree_view_click_gesture_pressed (GtkGestureClick *gesture,
|
||||
return;
|
||||
}
|
||||
|
||||
/* Because grab_focus can cause reentrancy, we delay grab_focus until after
|
||||
* we're done handling the button press.
|
||||
*/
|
||||
gtk_tree_view_convert_widget_to_bin_window_coords (tree_view, x, y,
|
||||
&bin_x, &bin_y);
|
||||
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
|
||||
|
||||
if (n_press > 1)
|
||||
gtk_gesture_set_state (priv->drag_gesture,
|
||||
GTK_EVENT_SEQUENCE_DENIED);
|
||||
@@ -2819,7 +2819,6 @@ gtk_tree_view_click_gesture_pressed (GtkGestureClick *gesture,
|
||||
}
|
||||
|
||||
grab_focus_and_unset_draw_keyfocus (tree_view);
|
||||
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2868,8 +2867,8 @@ gtk_tree_view_click_gesture_pressed (GtkGestureClick *gesture,
|
||||
continue;
|
||||
|
||||
background_area.width = gtk_tree_view_column_get_width (candidate);
|
||||
if ((background_area.x > x) ||
|
||||
(background_area.x + background_area.width <= x))
|
||||
if ((background_area.x > bin_x) ||
|
||||
(background_area.x + background_area.width <= bin_x))
|
||||
{
|
||||
background_area.x += background_area.width;
|
||||
continue;
|
||||
@@ -2943,7 +2942,6 @@ gtk_tree_view_click_gesture_pressed (GtkGestureClick *gesture,
|
||||
{
|
||||
GtkCellArea *area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (column));
|
||||
cell_editable = gtk_cell_area_get_edit_widget (area);
|
||||
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
|
||||
|
||||
if (cell_editable != NULL)
|
||||
{
|
||||
@@ -2976,7 +2974,7 @@ gtk_tree_view_click_gesture_pressed (GtkGestureClick *gesture,
|
||||
focus_cell = _gtk_tree_view_column_get_cell_at_pos (column,
|
||||
&cell_area,
|
||||
&background_area,
|
||||
x, y);
|
||||
bin_x, bin_y);
|
||||
|
||||
if (focus_cell)
|
||||
gtk_tree_view_column_focus_cell (column, focus_cell);
|
||||
@@ -3001,10 +2999,7 @@ gtk_tree_view_click_gesture_pressed (GtkGestureClick *gesture,
|
||||
}
|
||||
|
||||
if (button == GDK_BUTTON_PRIMARY && n_press == 2)
|
||||
{
|
||||
gtk_tree_view_row_activated (tree_view, path, column);
|
||||
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
|
||||
}
|
||||
gtk_tree_view_row_activated (tree_view, path, column);
|
||||
else
|
||||
{
|
||||
if (n_press == 1)
|
||||
@@ -3041,11 +3036,6 @@ gtk_tree_view_drag_gesture_begin (GtkGestureDrag *gesture,
|
||||
|
||||
gtk_tree_view_convert_widget_to_bin_window_coords (tree_view, start_x, start_y,
|
||||
&bin_x, &bin_y);
|
||||
|
||||
/* Are we dragging a column header? */
|
||||
if (bin_y < 0)
|
||||
return;
|
||||
|
||||
priv->press_start_x = priv->rubber_band_x = bin_x;
|
||||
priv->press_start_y = priv->rubber_band_y = bin_y;
|
||||
gtk_tree_rbtree_find_offset (priv->tree, bin_y + priv->dy,
|
||||
@@ -6530,9 +6520,6 @@ gtk_tree_view_top_row_to_dy (GtkTreeView *tree_view)
|
||||
if (priv->in_top_row_to_dy)
|
||||
return;
|
||||
|
||||
if (gtk_adjustment_is_animating (priv->vadjustment))
|
||||
return;
|
||||
|
||||
if (priv->top_row)
|
||||
path = gtk_tree_row_reference_get_path (priv->top_row);
|
||||
else
|
||||
@@ -6858,36 +6845,9 @@ scroll_row_timeout (gpointer data)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GdkDragAction
|
||||
gtk_tree_view_get_action (GtkWidget *widget,
|
||||
GdkDrop *drop)
|
||||
{
|
||||
GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
|
||||
TreeViewDragInfo *di;
|
||||
GdkDrag *drag = gdk_drop_get_drag (drop);
|
||||
GdkDragAction actions;
|
||||
|
||||
di = get_info (tree_view);
|
||||
|
||||
actions = gdk_drop_get_actions (drop);
|
||||
|
||||
if (di && di->drag == drag &&
|
||||
actions & GDK_ACTION_MOVE)
|
||||
return GDK_ACTION_MOVE;
|
||||
|
||||
if (actions & GDK_ACTION_COPY)
|
||||
return GDK_ACTION_COPY;
|
||||
|
||||
if (actions & GDK_ACTION_MOVE)
|
||||
return GDK_ACTION_MOVE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Returns TRUE if event should not be propagated to parent widgets */
|
||||
static gboolean
|
||||
set_destination_row (GtkTreeView *tree_view,
|
||||
GdkDrop *drop,
|
||||
GtkDropTargetAsync *dest,
|
||||
/* coordinates relative to the widget */
|
||||
int x,
|
||||
@@ -6993,7 +6953,7 @@ set_destination_row (GtkTreeView *tree_view,
|
||||
out:
|
||||
if (can_drop)
|
||||
{
|
||||
*suggested_action = gtk_tree_view_get_action (widget, drop);
|
||||
*suggested_action = GDK_ACTION_COPY | GDK_ACTION_MOVE;
|
||||
|
||||
gtk_tree_view_set_drag_dest_row (GTK_TREE_VIEW (widget),
|
||||
path, pos);
|
||||
@@ -7258,7 +7218,7 @@ gtk_tree_view_drag_motion (GtkDropTargetAsync *dest,
|
||||
GdkDragAction suggested_action = 0;
|
||||
GType target;
|
||||
|
||||
if (!set_destination_row (tree_view, drop, dest, x, y, &suggested_action, &target))
|
||||
if (!set_destination_row (tree_view, dest, x, y, &suggested_action, &target))
|
||||
return 0;
|
||||
|
||||
priv->event_last_x = x;
|
||||
@@ -7338,7 +7298,7 @@ gtk_tree_view_drag_drop (GtkDropTargetAsync *dest,
|
||||
if (!check_model_dnd (model, GTK_TYPE_TREE_DRAG_DEST, "drag_drop"))
|
||||
return FALSE;
|
||||
|
||||
if (!set_destination_row (tree_view, drop, dest, x, y, &suggested_action, &target))
|
||||
if (!set_destination_row (tree_view, dest, x, y, &suggested_action, &target))
|
||||
return FALSE;
|
||||
|
||||
path = get_logical_dest_row (tree_view, &path_down_mode, &drop_append_mode);
|
||||
@@ -7371,6 +7331,32 @@ gtk_tree_view_drag_drop (GtkDropTargetAsync *dest,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static GdkDragAction
|
||||
gtk_tree_view_get_action (GtkWidget *widget,
|
||||
GdkDrop *drop)
|
||||
{
|
||||
GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
|
||||
TreeViewDragInfo *di;
|
||||
GdkDrag *drag = gdk_drop_get_drag (drop);
|
||||
GdkDragAction actions;
|
||||
|
||||
di = get_info (tree_view);
|
||||
|
||||
actions = gdk_drop_get_actions (drop);
|
||||
|
||||
if (di && di->drag == drag &&
|
||||
actions & GDK_ACTION_MOVE)
|
||||
return GDK_ACTION_MOVE;
|
||||
|
||||
if (actions & GDK_ACTION_COPY)
|
||||
return GDK_ACTION_COPY;
|
||||
|
||||
if (actions & GDK_ACTION_MOVE)
|
||||
return GDK_ACTION_MOVE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tree_view_drag_data_received (GObject *source,
|
||||
GAsyncResult *result,
|
||||
@@ -10127,7 +10113,10 @@ gtk_tree_view_real_start_interactive_search (GtkTreeView *tree_view,
|
||||
gtk_editable_set_text (GTK_EDITABLE (priv->search_entry), "");
|
||||
|
||||
/* Grab focus without selecting all the text. */
|
||||
gtk_text_grab_focus_without_selecting (GTK_TEXT (priv->search_entry));
|
||||
if (GTK_IS_ENTRY (priv->search_entry))
|
||||
gtk_entry_grab_focus_without_selecting (GTK_ENTRY (priv->search_entry));
|
||||
else
|
||||
gtk_widget_grab_focus (priv->search_entry);
|
||||
|
||||
gtk_popover_popup (GTK_POPOVER (priv->search_popover));
|
||||
if (priv->search_entry_changed_id == 0)
|
||||
|
||||
+8
-50
@@ -180,7 +180,6 @@ typedef struct
|
||||
|
||||
GtkWidget *default_widget;
|
||||
GtkWidget *focus_widget;
|
||||
GtkWidget *move_focus_widget;
|
||||
GtkWindow *transient_parent;
|
||||
GtkWindowGeometryInfo *geometry_info;
|
||||
GtkWindowGroup *group;
|
||||
@@ -2048,12 +2047,7 @@ gtk_window_root_set_focus (GtkRoot *root,
|
||||
|
||||
if (focus == priv->focus_widget)
|
||||
{
|
||||
if (priv->move_focus &&
|
||||
focus && gtk_widget_is_visible (focus))
|
||||
{
|
||||
priv->move_focus = FALSE;
|
||||
g_clear_object (&priv->move_focus_widget);
|
||||
}
|
||||
priv->move_focus = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2073,12 +2067,7 @@ gtk_window_root_set_focus (GtkRoot *root,
|
||||
|
||||
g_clear_object (&old_focus);
|
||||
|
||||
if (priv->move_focus &&
|
||||
focus && gtk_widget_is_visible (focus))
|
||||
{
|
||||
priv->move_focus = FALSE;
|
||||
g_clear_object (&priv->move_focus_widget);
|
||||
}
|
||||
priv->move_focus = FALSE;
|
||||
|
||||
g_object_notify (G_OBJECT (self), "focus-widget");
|
||||
}
|
||||
@@ -2602,7 +2591,6 @@ gtk_window_dispose (GObject *object)
|
||||
g_list_free_full (priv->foci, (GDestroyNotify) gtk_pointer_focus_unref);
|
||||
priv->foci = NULL;
|
||||
|
||||
g_clear_object (&priv->move_focus_widget);
|
||||
gtk_window_set_focus (window, NULL);
|
||||
gtk_window_set_default_widget (window, NULL);
|
||||
|
||||
@@ -4731,25 +4719,7 @@ maybe_unset_focus_and_default (GtkWindow *window)
|
||||
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
|
||||
|
||||
if (priv->move_focus)
|
||||
{
|
||||
GtkWidget *parent;
|
||||
|
||||
parent = _gtk_widget_get_parent (priv->move_focus_widget);
|
||||
|
||||
while (parent)
|
||||
{
|
||||
if (_gtk_widget_get_visible (parent))
|
||||
{
|
||||
if (gtk_widget_grab_focus (parent))
|
||||
break;
|
||||
}
|
||||
|
||||
parent = _gtk_widget_get_parent (parent);
|
||||
}
|
||||
|
||||
priv->move_focus = FALSE;
|
||||
g_clear_object (&priv->move_focus_widget);
|
||||
}
|
||||
gtk_widget_child_focus (GTK_WIDGET (window), GTK_DIR_TAB_FORWARD);
|
||||
|
||||
if (priv->unset_default)
|
||||
gtk_window_set_default_widget (window, NULL);
|
||||
@@ -5042,9 +5012,6 @@ synthesize_focus_change_events (GtkWindow *window,
|
||||
GtkWidget *prev;
|
||||
gboolean seen_ancestor;
|
||||
|
||||
if (old_focus == new_focus)
|
||||
return;
|
||||
|
||||
if (old_focus && new_focus)
|
||||
ancestor = gtk_widget_common_ancestor (old_focus, new_focus);
|
||||
else
|
||||
@@ -5208,10 +5175,7 @@ _gtk_window_unset_focus_and_default (GtkWindow *window,
|
||||
|
||||
child = priv->focus_widget;
|
||||
if (child && (child == widget || gtk_widget_is_ancestor (child, widget)))
|
||||
{
|
||||
priv->move_focus_widget = g_object_ref (widget);
|
||||
priv->move_focus = TRUE;
|
||||
}
|
||||
priv->move_focus = TRUE;
|
||||
|
||||
child = priv->default_widget;
|
||||
if (child && (child == widget || gtk_widget_is_ancestor (child, widget)))
|
||||
@@ -6367,6 +6331,10 @@ gtk_window_unexport_handle (GtkWindow *window)
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
if (GDK_IS_X11_DISPLAY (gtk_widget_get_display (GTK_WIDGET (window))))
|
||||
return;
|
||||
#endif
|
||||
|
||||
g_warning ("Couldn't unexport handle for %s surface, unsupported windowing system",
|
||||
G_OBJECT_TYPE_NAME (priv->surface));
|
||||
@@ -6498,17 +6466,7 @@ gtk_window_update_pointer_focus_on_state_change (GtkWindow *window,
|
||||
else if (focus->target == widget ||
|
||||
gtk_widget_is_ancestor (focus->target, widget))
|
||||
{
|
||||
GtkWidget *old_target;
|
||||
|
||||
old_target = g_object_ref (focus->target);
|
||||
gtk_pointer_focus_repick_target (focus);
|
||||
gtk_synthesize_crossing_events (GTK_ROOT (window),
|
||||
GTK_CROSSING_POINTER,
|
||||
old_target, focus->target,
|
||||
focus->x, focus->y,
|
||||
GDK_CROSSING_NORMAL,
|
||||
NULL);
|
||||
g_object_unref (old_target);
|
||||
}
|
||||
|
||||
gtk_pointer_focus_unref (focus);
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 725 B |
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user