Compare commits
427 Commits
tagged-ent
...
cube-spin
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
47ffaefa25 | ||
|
|
9d0a42dc14 | ||
|
|
ec9be21771 | ||
|
|
1944ffe351 | ||
|
|
a8dccef507 | ||
|
|
90f460c236 | ||
|
|
e5e516468a | ||
|
|
b88c9439aa | ||
|
|
95f9c8a5eb | ||
|
|
fbc8bb979d | ||
|
|
e861b0d6c1 | ||
|
|
7918eaf677 | ||
|
|
bf2a93ca0e | ||
|
|
606aea2302 | ||
|
|
b21882bcea | ||
|
|
fee8f6b9be | ||
|
|
3a8a9fc2bd | ||
|
|
866bc13557 | ||
|
|
d10a73f509 | ||
|
|
3c44f83909 | ||
|
|
38fbb6856c | ||
|
|
9ca5495380 | ||
|
|
4b07d28153 | ||
|
|
c04190e761 | ||
|
|
822791d8a9 | ||
|
|
f070872b36 | ||
|
|
f3e47ee92e | ||
|
|
e612b55bd4 | ||
|
|
6d38f1dcb5 | ||
|
|
d4df5211f3 | ||
|
|
2e67c2eb8f | ||
|
|
47d4b06eca | ||
|
|
5ddce32e1a | ||
|
|
8846f28369 | ||
|
|
62d0bd7153 | ||
|
|
d5175526f9 | ||
|
|
7935f9d3b8 | ||
|
|
7cc5e51a92 | ||
|
|
8542ac2c42 | ||
|
|
b3eddbb45d | ||
|
|
e3dbf8d524 | ||
|
|
5dd5ff5236 | ||
|
|
d3be32f8ea | ||
|
|
0c81ea2f28 | ||
|
|
c564a349e5 | ||
|
|
42d580dc07 | ||
|
|
4784c5a980 | ||
|
|
6b08227110 | ||
|
|
6f470affef | ||
|
|
c30fc92b3e | ||
|
|
7222bda146 | ||
|
|
eaae9650d9 | ||
|
|
f20f02c416 | ||
|
|
94533495aa | ||
|
|
c9e08efcbf | ||
|
|
e0f9c98e44 | ||
|
|
80c26ab904 | ||
|
|
f0845d98a2 | ||
|
|
121bbcec4b | ||
|
|
700183e5b6 | ||
|
|
8d993160c2 | ||
|
|
fc3cae34ec | ||
|
|
866640c0c2 | ||
|
|
0f7ca7e550 | ||
|
|
18d1ea19e0 | ||
|
|
208cae2f05 | ||
|
|
ecba428d52 | ||
|
|
3f0f7c73e0 | ||
|
|
3d6a456c85 | ||
|
|
65c394dbaa | ||
|
|
4d9f4ed14b | ||
|
|
56d420c06e | ||
|
|
dec2cf49dd | ||
|
|
3d524cc67d | ||
|
|
396deb44fa | ||
|
|
3631878cee | ||
|
|
26de69eaae | ||
|
|
f89c93ea8e | ||
|
|
6b050a277e | ||
|
|
7e88fcf24e | ||
|
|
a443145a4d | ||
|
|
bbb6772934 | ||
|
|
3600d129bf | ||
|
|
14ad26a599 | ||
|
|
8c807303da | ||
|
|
5c2697633c | ||
|
|
4a1019bed0 | ||
|
|
0d43d11387 | ||
|
|
8ef4e231ec | ||
|
|
2f358469af | ||
|
|
be944e0a31 | ||
|
|
e5722367b3 | ||
|
|
2440e89a72 | ||
|
|
9212727f53 | ||
|
|
733271e09a | ||
|
|
868d3cd609 | ||
|
|
4a15b16198 | ||
|
|
7ac250dea7 | ||
|
|
c507160bf2 | ||
|
|
84480b3da8 | ||
|
|
6c30b474f5 | ||
|
|
2fd2c61d37 | ||
|
|
411dc7e138 | ||
|
|
141f758c5c | ||
|
|
5fb96392e3 | ||
|
|
7843382784 | ||
|
|
544fe83864 | ||
|
|
8a9290d0ba | ||
|
|
8d4343a550 | ||
|
|
8984320964 | ||
|
|
c0aaa43122 | ||
|
|
5935f26a1d | ||
|
|
562cc8b9ab | ||
|
|
9021e7d3cd | ||
|
|
03eb455c93 | ||
|
|
6288043ec2 | ||
|
|
7e4707642a | ||
|
|
8dece0e940 | ||
|
|
21580309d3 | ||
|
|
f1d61d5515 | ||
|
|
2d10a7b9c4 | ||
|
|
54a969e0ad | ||
|
|
eb4e7b9172 | ||
|
|
de741e57f3 | ||
|
|
0481f123ea | ||
|
|
6f072c80db | ||
|
|
2ed533c3e1 | ||
|
|
27c286773c | ||
|
|
f7d3815fa8 | ||
|
|
d45996c728 | ||
|
|
6b6f26ed45 | ||
|
|
060e30de3f | ||
|
|
fc33bf2d1f | ||
|
|
dd5c981b63 | ||
|
|
9a4c19349e | ||
|
|
3389ddf6fc | ||
|
|
341660e056 | ||
|
|
b42bf99b13 | ||
|
|
18d814d2ce | ||
|
|
6fce18e1a1 | ||
|
|
cf4226586a | ||
|
|
0481aa10e7 | ||
|
|
edbaa0964f | ||
|
|
fbefec52a5 | ||
|
|
d59d8b5dd4 | ||
|
|
87a13fe3d2 | ||
|
|
2f85443e37 | ||
|
|
311aa01e01 | ||
|
|
3bbbe9f71b | ||
|
|
890b759091 | ||
|
|
d997903d29 | ||
|
|
b097f0a7d8 | ||
|
|
1b5b1bfd0e | ||
|
|
c94867f8a1 | ||
|
|
c8d250deb1 | ||
|
|
dbac377ad2 | ||
|
|
0638dca29a | ||
|
|
ae68dc7a7d | ||
|
|
20b4a8b38c | ||
|
|
65965bed16 | ||
|
|
630442f31c | ||
|
|
d6dfa41f10 | ||
|
|
8cf06befc0 | ||
|
|
128a34fe37 | ||
|
|
0285919f4a | ||
|
|
1fed357752 | ||
|
|
ef9863ab63 | ||
|
|
5cbf6f5fbd | ||
|
|
15fda18791 | ||
|
|
f7856e887e | ||
|
|
1b8595b5f2 | ||
|
|
24754c3259 | ||
|
|
4dfe2a8aa8 | ||
|
|
ab7507150b | ||
|
|
e657d9d553 | ||
|
|
36e00ae95e | ||
|
|
f2dff5115f | ||
|
|
a246f8c22a | ||
|
|
6efa1fc006 | ||
|
|
3d37f08f38 | ||
|
|
160f1e581a | ||
|
|
661e195ffc | ||
|
|
551ced9ae4 | ||
|
|
799cb39e08 | ||
|
|
0615668dd9 | ||
|
|
1ada7bbc02 | ||
|
|
81658105f7 | ||
|
|
d9ef734458 | ||
|
|
73760e5835 | ||
|
|
5638882dca | ||
|
|
8da56cef79 | ||
|
|
64ab82c403 | ||
|
|
56df49971a | ||
|
|
0bf136a902 | ||
|
|
2479d60012 | ||
|
|
6990f73940 | ||
|
|
254c27acbe | ||
|
|
558405e1bc | ||
|
|
f47c376fb1 | ||
|
|
5679b9a687 | ||
|
|
24235f61ab | ||
|
|
a44ac75e65 | ||
|
|
85c8e29d78 | ||
|
|
8fb797866d | ||
|
|
96a677e5ca | ||
|
|
07054ca20d | ||
|
|
8f6a48832d | ||
|
|
658588dfe7 | ||
|
|
480d8aec06 | ||
|
|
0d91481587 | ||
|
|
8650980797 | ||
|
|
2b0d1bca43 | ||
|
|
f7e328e5f7 | ||
|
|
b40743121b | ||
|
|
93c1353c69 | ||
|
|
1196380f28 | ||
|
|
26f99bf20c | ||
|
|
65d9b7ee86 | ||
|
|
688f0997f4 | ||
|
|
430ea05aea | ||
|
|
17f4211e4f | ||
|
|
ecd6446d08 | ||
|
|
1540797237 | ||
|
|
898728fb2d | ||
|
|
fc2b412c0c | ||
|
|
1ce5327058 | ||
|
|
ad3773b2e1 | ||
|
|
8619b109cc | ||
|
|
6ddb61119a | ||
|
|
492a38c229 | ||
|
|
181a4bce25 | ||
|
|
93905a8513 | ||
|
|
4f06b669c5 | ||
|
|
f3ed3e99c3 | ||
|
|
4f5a8207bc | ||
|
|
2f1194c0c1 | ||
|
|
921eccb459 | ||
|
|
888b92674f | ||
|
|
7d354b5084 | ||
|
|
4238a04c7b | ||
|
|
adb547a147 | ||
|
|
cdcd2bb073 | ||
|
|
06f790d663 | ||
|
|
c73972f7df | ||
|
|
8d5f1ae662 | ||
|
|
a3abf0693d | ||
|
|
7ca24f12d7 | ||
|
|
f68855341e | ||
|
|
31d9ecb5c3 | ||
|
|
f13e6179e8 | ||
|
|
d279c666a9 | ||
|
|
7819a5aab9 | ||
|
|
15300f839e | ||
|
|
94b0e99be5 | ||
|
|
8c1d852a84 | ||
|
|
2738926dcb | ||
|
|
029ec38e63 | ||
|
|
2bf1561b48 | ||
|
|
bd44831987 | ||
|
|
ab5d3e756b | ||
|
|
92f1bdcf45 | ||
|
|
64b9114d98 | ||
|
|
a1cc809c60 | ||
|
|
7c19ab66ee | ||
|
|
7ca528b896 | ||
|
|
2870f4dbfe | ||
|
|
f14d998c95 | ||
|
|
34e859a5bc | ||
|
|
5822a35087 | ||
|
|
a3b73a416e | ||
|
|
d3cecd65a5 | ||
|
|
470720e11a | ||
|
|
c3f43cf1f2 | ||
|
|
5251253fc0 | ||
|
|
f5e112fd2d | ||
|
|
56ee1f3566 | ||
|
|
4afad781fe | ||
|
|
8e4c441f78 | ||
|
|
d07cd892e7 | ||
|
|
44198cc779 | ||
|
|
4bba279085 | ||
|
|
36539a22d7 | ||
|
|
ad96220448 | ||
|
|
73139d524b | ||
|
|
f454a31caa | ||
|
|
3863e44360 | ||
|
|
8566218485 | ||
|
|
1475575799 | ||
|
|
bc901ffa5a | ||
|
|
b114d45c5f | ||
|
|
9a1c698070 | ||
|
|
884088f649 | ||
|
|
ad5c5d477e | ||
|
|
1513bf4174 | ||
|
|
eacbeb9efd | ||
|
|
18da852e15 | ||
|
|
39fbf13fcb | ||
|
|
9105de9170 | ||
|
|
eeed55d45c | ||
|
|
3a3b325f8e | ||
|
|
dbe58452d7 | ||
|
|
a8bf5eee0f | ||
|
|
bd113aa85c | ||
|
|
1fecbd4241 | ||
|
|
3545abc7a1 | ||
|
|
70b341139b | ||
|
|
b391aea2b3 | ||
|
|
979e9bec27 | ||
|
|
e737b42113 | ||
|
|
cf00c36c85 | ||
|
|
3cc84d2860 | ||
|
|
791bf0c2eb | ||
|
|
3a3c2d14ab | ||
|
|
4916280883 | ||
|
|
0e1a50366a | ||
|
|
20f7588a84 | ||
|
|
348912dff4 | ||
|
|
610692d07b | ||
|
|
45ea288ba2 | ||
|
|
b79545e83c | ||
|
|
02318dbda7 | ||
|
|
afbfccb89e | ||
|
|
bed4c68041 | ||
|
|
8ceff21497 | ||
|
|
4fe67310fb | ||
|
|
f35b8a7541 | ||
|
|
9948ca7be2 | ||
|
|
eaf41cc90c | ||
|
|
9e0c471b03 | ||
|
|
dc282991c6 | ||
|
|
7931ab5f33 | ||
|
|
416a4cf5ea | ||
|
|
bbd4e2f60d | ||
|
|
5577e30ad4 | ||
|
|
5caf8ca76b | ||
|
|
fda4546de5 | ||
|
|
fe7dcf6eec | ||
|
|
539e3d387b | ||
|
|
efbb26b8cb | ||
|
|
69251d051a | ||
|
|
d930c4a4d1 | ||
|
|
f36e41600a | ||
|
|
78d013f8d3 | ||
|
|
b4ae491b45 | ||
|
|
1469d01e2e | ||
|
|
b0083b33bb | ||
|
|
c5c75f338e | ||
|
|
572266429f | ||
|
|
91ad2eef5c | ||
|
|
14890fad47 | ||
|
|
5a6a7b50af | ||
|
|
8438880906 | ||
|
|
df6494d73a | ||
|
|
9335cde8e8 | ||
|
|
e836c575ce | ||
|
|
47fb1ec4c4 | ||
|
|
f0624266dc | ||
|
|
74ab3cdf75 | ||
|
|
58c2bea959 | ||
|
|
d3c45cb979 | ||
|
|
df27cb7240 | ||
|
|
397b8ee9d5 | ||
|
|
6687a0892a | ||
|
|
77c0e68b57 | ||
|
|
fd667bb203 | ||
|
|
d773bc0689 | ||
|
|
eddc823378 | ||
|
|
eb1310effe | ||
|
|
8a0182e401 | ||
|
|
edc4f954c6 | ||
|
|
c35554cf68 | ||
|
|
9861887f1a | ||
|
|
3ae31b0e79 | ||
|
|
06df7e6f2c | ||
|
|
0d39cb7379 | ||
|
|
cc216c9e84 | ||
|
|
09fea73a40 | ||
|
|
704e377fae | ||
|
|
12663d2844 | ||
|
|
4e8aa0c37a | ||
|
|
ea4f552d50 | ||
|
|
2501152842 | ||
|
|
a13d8501d4 | ||
|
|
69b1a348c6 | ||
|
|
b82e57fec6 | ||
|
|
5dbfb18d11 | ||
|
|
b6893b6d9f | ||
|
|
4001e7645b | ||
|
|
ac8b192eab | ||
|
|
fad9468e77 | ||
|
|
222d310370 | ||
|
|
fe95391184 | ||
|
|
e16cdb141c | ||
|
|
08badd23cd | ||
|
|
cc2c39209c | ||
|
|
d633beaccd | ||
|
|
23fb77af43 | ||
|
|
ccbaec0231 | ||
|
|
89470ab201 | ||
|
|
a3901f2563 | ||
|
|
5dd0863bd7 | ||
|
|
8d93321461 | ||
|
|
3ccbcf9f55 | ||
|
|
ef5108c89f | ||
|
|
0230a7b1e5 | ||
|
|
55337c588c | ||
|
|
9e231f6333 | ||
|
|
3ebf19b783 | ||
|
|
9591d40742 | ||
|
|
de6132a158 | ||
|
|
ddb52a5b5e | ||
|
|
47249431e3 | ||
|
|
f9041230c6 | ||
|
|
e54ce8f328 | ||
|
|
8d987be673 | ||
|
|
445dca42f5 | ||
|
|
c53e9ed6aa | ||
|
|
2b9436b279 | ||
|
|
bd99ae3767 | ||
|
|
0e603a6646 | ||
|
|
9d0e8b85c1 | ||
|
|
da0bd697b8 | ||
|
|
3471aac4ef | ||
|
|
593774133f | ||
|
|
3fa28ffd92 | ||
|
|
5383d11bb4 | ||
|
|
ed65ab1ba9 |
@@ -13,7 +13,7 @@ stages:
|
||||
- subprojects/pango/
|
||||
|
||||
fedora-x86_64:
|
||||
image: registry.gitlab.gnome.org/gnome/gtk/master:v2
|
||||
image: registry.gitlab.gnome.org/gnome/gtk/master:v3
|
||||
stage: build
|
||||
script:
|
||||
- bash -x ./.gitlab-ci/test-docker.sh
|
||||
@@ -64,7 +64,7 @@ flatpak:widget-factory:
|
||||
<<: *flatpak-defaults
|
||||
|
||||
pages:
|
||||
image: registry.gitlab.gnome.org/gnome/gtk/master:v2
|
||||
image: registry.gitlab.gnome.org/gnome/gtk/master:v3
|
||||
stage: deploy
|
||||
script:
|
||||
- meson -Ddocumentation=true _build .
|
||||
|
||||
@@ -70,7 +70,7 @@ RUN dnf -y install \
|
||||
xorg-x11-server-Xvfb \
|
||||
&& dnf clean all
|
||||
|
||||
RUN pip3 install meson==0.49.0
|
||||
RUN pip3 install meson==0.50.0
|
||||
|
||||
ARG HOST_USER_ID=5555
|
||||
ENV HOST_USER_ID ${HOST_USER_ID}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
set -e
|
||||
|
||||
TAG="registry.gitlab.gnome.org/gnome/gtk/master:v2"
|
||||
TAG="registry.gitlab.gnome.org/gnome/gtk/master:v3"
|
||||
|
||||
sudo docker build --build-arg HOST_USER_ID="$UID" --tag "${TAG}" \
|
||||
--file "Dockerfile" .
|
||||
|
||||
@@ -26,7 +26,9 @@ ccache --show-stats
|
||||
|
||||
xvfb-run -a -s "-screen 0 1024x768x24" \
|
||||
meson test \
|
||||
--timeout-multiplier 2 \
|
||||
--print-errorlogs \
|
||||
--suite=gtk \
|
||||
--no-suite=gtk:gsk \
|
||||
--no-suite=gtk:reftest \
|
||||
--no-suite=gtk:a11y
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
## Version information
|
||||
<!--
|
||||
- Which version of GTK+ you are using
|
||||
- Which version of GTK you are using
|
||||
- What operating system and version
|
||||
- For Linux, which distribution
|
||||
- If you built GTK+ yourself, the list of options used to configure the build
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
## Version information
|
||||
<!--
|
||||
- Which version of GTK+ you are using
|
||||
- Which version of GTK you are using
|
||||
- What operating system and version
|
||||
- for Linux, which distribution
|
||||
- If you built GTK+ yourself, the list of options used to configure the build
|
||||
|
||||
31
build-aux/meson/post-install.py
Normal file
31
build-aux/meson/post-install.py
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
if 'DESTDIR' not in os.environ:
|
||||
gtk_api_version = sys.argv[1]
|
||||
gtk_abi_version = sys.argv[2]
|
||||
gtk_libdir = sys.argv[3]
|
||||
gtk_datadir = sys.argv[4]
|
||||
|
||||
gtk_moduledir = os.path.join(gtk_libdir, 'gtk-' + gtk_api_version, gtk_abi_version)
|
||||
gtk_printmodule_dir = os.path.join(gtk_moduledir, 'printbackends')
|
||||
gtk_immodule_dir = os.path.join(gtk_moduledir, 'immodules')
|
||||
|
||||
print('Compiling GSettings schemas...')
|
||||
subprocess.call(['glib-compile-schemas',
|
||||
os.path.join(gtk_datadir, 'glib-2.0', 'schemas')])
|
||||
|
||||
print('Updating icon cache...')
|
||||
subprocess.call(['gtk-update-icon-cache', '-q', '-t' ,'-f',
|
||||
os.path.join(gtk_datadir, 'icons', 'hicolor')])
|
||||
|
||||
print('Updating module cache for print backends...')
|
||||
os.makedirs(gtk_printmodule_dir, exist_ok=True)
|
||||
subprocess.call(['gio-querymodules', gtk_printmodule_dir])
|
||||
|
||||
print('Updating module cache for input methods...')
|
||||
os.makedirs(gtk_immodule_dir, exist_ok=True)
|
||||
subprocess.call(['gio-querymodules', gtk_immodule_dir])
|
||||
@@ -1,26 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
gtk_api_version=$1
|
||||
gtk_abi_version=$2
|
||||
gtk_libdir=$3
|
||||
gtk_datadir=$4
|
||||
|
||||
# Package managers set this so we don't need to run
|
||||
if [ -z "$DESTDIR" ]; then
|
||||
echo Compiling GSettings schemas...
|
||||
glib-compile-schemas ${gtk_datadir}/glib-2.0/schemas
|
||||
|
||||
echo Updating desktop database...
|
||||
update-desktop-database -q ${gtk_datadir}/applications
|
||||
|
||||
echo Updating icon cache...
|
||||
gtk-update-icon-cache -q -t -f ${gtk_datadir}/icons/hicolor
|
||||
|
||||
echo Updating module cache for print backends...
|
||||
mkdir -p ${gtk_libdir}/gtk-4.0/4.0.0/printbackends
|
||||
gio-querymodules ${gtk_libdir}/gtk-4.0/4.0.0/printbackends
|
||||
|
||||
echo Updating module cache for input methods...
|
||||
mkdir -p ${gtk_libdir}/gtk-4.0/4.0.0/immodules
|
||||
gio-querymodules ${gtk_libdir}/gtk-4.0/4.0.0/immodules
|
||||
fi
|
||||
@@ -80,7 +80,7 @@ on_entry_changed (GtkWidget *widget, gpointer data)
|
||||
|
||||
page_number = gtk_assistant_get_current_page (assistant);
|
||||
current_page = gtk_assistant_get_nth_page (assistant, page_number);
|
||||
text = gtk_entry_get_text (GTK_ENTRY (widget));
|
||||
text = gtk_editable_get_text (GTK_EDITABLE (widget));
|
||||
|
||||
if (text && *text)
|
||||
gtk_assistant_set_page_complete (assistant, current_page, TRUE);
|
||||
|
||||
@@ -71,20 +71,12 @@ find_toplevel_at_pointer (GdkDisplay *display)
|
||||
GdkSurface *pointer_window;
|
||||
GtkWidget *widget = NULL;
|
||||
|
||||
pointer_window = gdk_device_get_surface_at_position (gtk_get_current_event_device (),
|
||||
NULL, NULL);
|
||||
pointer_window = gdk_device_get_surface_at_position (gtk_get_current_event_device (), NULL, NULL);
|
||||
|
||||
/* The user data field of a GdkSurface is used to store a pointer
|
||||
* to the widget that created it.
|
||||
*/
|
||||
if (pointer_window)
|
||||
{
|
||||
gpointer widget_ptr;
|
||||
gdk_surface_get_user_data (pointer_window, &widget_ptr);
|
||||
widget = widget_ptr;
|
||||
}
|
||||
widget = GTK_WIDGET (gtk_root_get_for_surface (pointer_window));
|
||||
|
||||
return widget ? gtk_widget_get_toplevel (widget) : NULL;
|
||||
return widget;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -28,7 +28,7 @@ copy_button_clicked (GtkWidget *button,
|
||||
clipboard = gtk_widget_get_clipboard (entry);
|
||||
|
||||
/* Set clipboard text */
|
||||
gdk_clipboard_set_text (clipboard, gtk_entry_get_text (GTK_ENTRY (entry)));
|
||||
gdk_clipboard_set_text (clipboard, gtk_editable_get_text (GTK_EDITABLE (entry)));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -50,7 +50,7 @@ paste_received (GObject *source_object,
|
||||
if (text)
|
||||
{
|
||||
/* Set the entry text */
|
||||
gtk_entry_set_text (GTK_ENTRY (entry), text);
|
||||
gtk_editable_set_text (GTK_EDITABLE (entry), text);
|
||||
g_free (text);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -256,7 +256,7 @@ mask_entry_set_background (MaskEntry *entry)
|
||||
{
|
||||
if (entry->mask)
|
||||
{
|
||||
if (!g_regex_match_simple (entry->mask, gtk_entry_get_text (GTK_ENTRY (entry)), 0, 0))
|
||||
if (!g_regex_match_simple (entry->mask, gtk_editable_get_text (GTK_EDITABLE (entry)), 0, 0))
|
||||
{
|
||||
PangoAttrList *attrs;
|
||||
|
||||
|
||||
@@ -189,6 +189,7 @@
|
||||
<file>paintable_animated.c</file>
|
||||
<file>paintable_mediastream.c</file>
|
||||
<file>panes.c</file>
|
||||
<file>password_entry.c</file>
|
||||
<file>pickers.c</file>
|
||||
<file>pixbufs.c</file>
|
||||
<file>popover.c</file>
|
||||
@@ -206,6 +207,7 @@
|
||||
<file>spinbutton.c</file>
|
||||
<file>spinner.c</file>
|
||||
<file>tabs.c</file>
|
||||
<file>tagged_entry.c</file>
|
||||
<file>textview.c</file>
|
||||
<file>textscroll.c</file>
|
||||
<file>theming_style_classes.c</file>
|
||||
@@ -217,6 +219,9 @@
|
||||
<gresource prefix="/textview">
|
||||
<file>floppybuddy.gif</file>
|
||||
</gresource>
|
||||
<gresource prefix="/tagged_entry">
|
||||
<file>tagstyle.css</file>
|
||||
</gresource>
|
||||
<gresource prefix="/listbox">
|
||||
<file>listbox.ui</file>
|
||||
<file>messages.txt</file>
|
||||
@@ -261,6 +266,10 @@
|
||||
<gresource prefix="/dnd">
|
||||
<file>dnd.css</file>
|
||||
</gresource>
|
||||
<gresource prefix="/tagged_entry">
|
||||
<file>demotaggedentry.c</file>
|
||||
<file>demotaggedentry.h</file>
|
||||
</gresource>
|
||||
<gresource prefix="/org/gtk/Demo">
|
||||
<file>icons/16x16/actions/application-exit.png</file>
|
||||
<file>icons/16x16/actions/document-new.png</file>
|
||||
|
||||
493
demos/gtk-demo/demotaggedentry.c
Normal file
493
demos/gtk-demo/demotaggedentry.c
Normal file
@@ -0,0 +1,493 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 2019 Red Hat, Inc.
|
||||
*
|
||||
* Authors:
|
||||
* - Matthias Clasen <mclasen@redhat.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "demotaggedentry.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <gtk/gtk-a11y.h>
|
||||
|
||||
typedef struct {
|
||||
GtkWidget *box;
|
||||
GtkWidget *entry;
|
||||
} DemoTaggedEntryPrivate;
|
||||
|
||||
static void demo_tagged_entry_editable_init (GtkEditableInterface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (DemoTaggedEntry, demo_tagged_entry, GTK_TYPE_WIDGET,
|
||||
G_ADD_PRIVATE (DemoTaggedEntry)
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_EDITABLE, demo_tagged_entry_editable_init))
|
||||
|
||||
static void
|
||||
demo_tagged_entry_init (DemoTaggedEntry *entry)
|
||||
{
|
||||
DemoTaggedEntryPrivate *priv = demo_tagged_entry_get_instance_private (entry);
|
||||
|
||||
gtk_widget_set_has_surface (GTK_WIDGET (entry), FALSE);
|
||||
|
||||
priv->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
gtk_widget_set_parent (priv->box, GTK_WIDGET (entry));
|
||||
|
||||
priv->entry = gtk_text_new ();
|
||||
gtk_widget_set_hexpand (priv->entry, TRUE);
|
||||
gtk_widget_set_vexpand (priv->entry, TRUE);
|
||||
gtk_widget_set_hexpand (priv->box, FALSE);
|
||||
gtk_widget_set_vexpand (priv->box, FALSE);
|
||||
gtk_container_add (GTK_CONTAINER (priv->box), priv->entry);
|
||||
gtk_editable_init_delegate (GTK_EDITABLE (entry));
|
||||
}
|
||||
|
||||
static void
|
||||
demo_tagged_entry_dispose (GObject *object)
|
||||
{
|
||||
DemoTaggedEntry *entry = DEMO_TAGGED_ENTRY (object);
|
||||
DemoTaggedEntryPrivate *priv = demo_tagged_entry_get_instance_private (entry);
|
||||
|
||||
if (priv->entry)
|
||||
gtk_editable_finish_delegate (GTK_EDITABLE (entry));
|
||||
|
||||
g_clear_pointer (&priv->entry, gtk_widget_unparent);
|
||||
g_clear_pointer (&priv->box, gtk_widget_unparent);
|
||||
|
||||
G_OBJECT_CLASS (demo_tagged_entry_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
demo_tagged_entry_finalize (GObject *object)
|
||||
{
|
||||
G_OBJECT_CLASS (demo_tagged_entry_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
demo_tagged_entry_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
if (gtk_editable_delegate_set_property (object, prop_id, value, pspec))
|
||||
return;
|
||||
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
|
||||
static void
|
||||
demo_tagged_entry_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
if (gtk_editable_delegate_get_property (object, prop_id, value, pspec))
|
||||
return;
|
||||
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
|
||||
static void
|
||||
demo_tagged_entry_measure (GtkWidget *widget,
|
||||
GtkOrientation orientation,
|
||||
int for_size,
|
||||
int *minimum,
|
||||
int *natural,
|
||||
int *minimum_baseline,
|
||||
int *natural_baseline)
|
||||
{
|
||||
DemoTaggedEntry *entry = DEMO_TAGGED_ENTRY (widget);
|
||||
DemoTaggedEntryPrivate *priv = demo_tagged_entry_get_instance_private (entry);
|
||||
|
||||
gtk_widget_measure (priv->box, orientation, for_size,
|
||||
minimum, natural,
|
||||
minimum_baseline, natural_baseline);
|
||||
}
|
||||
|
||||
static void
|
||||
demo_tagged_entry_size_allocate (GtkWidget *widget,
|
||||
int width,
|
||||
int height,
|
||||
int baseline)
|
||||
{
|
||||
DemoTaggedEntry *entry = DEMO_TAGGED_ENTRY (widget);
|
||||
DemoTaggedEntryPrivate *priv = demo_tagged_entry_get_instance_private (entry);
|
||||
|
||||
gtk_widget_size_allocate (priv->box,
|
||||
&(GtkAllocation) { 0, 0, width, height },
|
||||
baseline);
|
||||
}
|
||||
|
||||
static void
|
||||
demo_tagged_entry_grab_focus (GtkWidget *widget)
|
||||
{
|
||||
DemoTaggedEntry *entry = DEMO_TAGGED_ENTRY (widget);
|
||||
DemoTaggedEntryPrivate *priv = demo_tagged_entry_get_instance_private (entry);
|
||||
|
||||
gtk_widget_grab_focus (priv->entry);
|
||||
}
|
||||
|
||||
static void
|
||||
demo_tagged_entry_class_init (DemoTaggedEntryClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
|
||||
object_class->dispose = demo_tagged_entry_dispose;
|
||||
object_class->finalize = demo_tagged_entry_finalize;
|
||||
object_class->get_property = demo_tagged_entry_get_property;
|
||||
object_class->set_property = demo_tagged_entry_set_property;
|
||||
|
||||
widget_class->measure = demo_tagged_entry_measure;
|
||||
widget_class->size_allocate = demo_tagged_entry_size_allocate;
|
||||
widget_class->grab_focus = demo_tagged_entry_grab_focus;
|
||||
|
||||
gtk_editable_install_properties (object_class, 1);
|
||||
|
||||
gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_ENTRY_ACCESSIBLE);
|
||||
gtk_widget_class_set_css_name (widget_class, "entry");
|
||||
}
|
||||
|
||||
static GtkEditable *
|
||||
demo_tagged_entry_get_delegate (GtkEditable *editable)
|
||||
{
|
||||
DemoTaggedEntry *entry = DEMO_TAGGED_ENTRY (editable);
|
||||
DemoTaggedEntryPrivate *priv = demo_tagged_entry_get_instance_private (entry);
|
||||
|
||||
return GTK_EDITABLE (priv->entry);
|
||||
}
|
||||
|
||||
static void
|
||||
demo_tagged_entry_editable_init (GtkEditableInterface *iface)
|
||||
{
|
||||
iface->get_delegate = demo_tagged_entry_get_delegate;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
demo_tagged_entry_new (void)
|
||||
{
|
||||
return GTK_WIDGET (g_object_new (DEMO_TYPE_TAGGED_ENTRY, NULL));
|
||||
}
|
||||
|
||||
void
|
||||
demo_tagged_entry_add_tag (DemoTaggedEntry *entry,
|
||||
GtkWidget *tag)
|
||||
{
|
||||
DemoTaggedEntryPrivate *priv = demo_tagged_entry_get_instance_private (entry);
|
||||
|
||||
g_return_if_fail (DEMO_IS_TAGGED_ENTRY (entry));
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (priv->box), tag);
|
||||
}
|
||||
|
||||
void
|
||||
demo_tagged_entry_insert_tag_after (DemoTaggedEntry *entry,
|
||||
GtkWidget *tag,
|
||||
GtkWidget *sibling)
|
||||
{
|
||||
DemoTaggedEntryPrivate *priv = demo_tagged_entry_get_instance_private (entry);
|
||||
|
||||
g_return_if_fail (DEMO_IS_TAGGED_ENTRY (entry));
|
||||
|
||||
if (sibling == NULL)
|
||||
gtk_container_add (GTK_CONTAINER (priv->box), tag);
|
||||
else
|
||||
gtk_box_insert_child_after (GTK_BOX (priv->box), tag, sibling);
|
||||
}
|
||||
|
||||
void
|
||||
demo_tagged_entry_remove_tag (DemoTaggedEntry *entry,
|
||||
GtkWidget *tag)
|
||||
{
|
||||
DemoTaggedEntryPrivate *priv = demo_tagged_entry_get_instance_private (entry);
|
||||
|
||||
g_return_if_fail (DEMO_IS_TAGGED_ENTRY (entry));
|
||||
|
||||
gtk_container_remove (GTK_CONTAINER (priv->box), tag);
|
||||
}
|
||||
|
||||
struct _DemoTaggedEntryTag
|
||||
{
|
||||
GtkWidget parent;
|
||||
GtkWidget *box;
|
||||
GtkWidget *label;
|
||||
GtkWidget *button;
|
||||
|
||||
gboolean has_close_button;
|
||||
char *style;
|
||||
};
|
||||
|
||||
struct _DemoTaggedEntryTagClass
|
||||
{
|
||||
GtkWidgetClass parent_class;
|
||||
};
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_LABEL,
|
||||
PROP_HAS_CLOSE_BUTTON,
|
||||
};
|
||||
|
||||
enum {
|
||||
SIGNAL_CLICKED,
|
||||
SIGNAL_BUTTON_CLICKED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0, };
|
||||
|
||||
G_DEFINE_TYPE (DemoTaggedEntryTag, demo_tagged_entry_tag, GTK_TYPE_WIDGET)
|
||||
|
||||
static void
|
||||
on_released (GtkGestureMultiPress *gesture,
|
||||
int n_press,
|
||||
double x,
|
||||
double y,
|
||||
DemoTaggedEntryTag *tag)
|
||||
{
|
||||
g_signal_emit (tag, signals[SIGNAL_CLICKED], 0);
|
||||
}
|
||||
|
||||
static void
|
||||
demo_tagged_entry_tag_init (DemoTaggedEntryTag *tag)
|
||||
{
|
||||
GtkGesture *gesture;
|
||||
GtkCssProvider *provider;
|
||||
|
||||
gtk_widget_set_has_surface (GTK_WIDGET (tag), FALSE);
|
||||
|
||||
tag->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
gtk_widget_set_parent (tag->box, GTK_WIDGET (tag));
|
||||
tag->label = gtk_label_new ("");
|
||||
gtk_container_add (GTK_CONTAINER (tag->box), tag->label);
|
||||
|
||||
gesture = gtk_gesture_multi_press_new ();
|
||||
g_signal_connect (gesture, "released", G_CALLBACK (on_released), tag);
|
||||
gtk_widget_add_controller (GTK_WIDGET (tag), GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
provider = gtk_css_provider_new ();
|
||||
gtk_css_provider_load_from_resource (provider, "/tagged_entry/tagstyle.css");
|
||||
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
|
||||
GTK_STYLE_PROVIDER (provider),
|
||||
800);
|
||||
g_object_unref (provider);
|
||||
}
|
||||
|
||||
static void
|
||||
demo_tagged_entry_tag_dispose (GObject *object)
|
||||
{
|
||||
DemoTaggedEntryTag *tag = DEMO_TAGGED_ENTRY_TAG (object);
|
||||
|
||||
g_clear_pointer (&tag->box, gtk_widget_unparent);
|
||||
|
||||
G_OBJECT_CLASS (demo_tagged_entry_tag_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
demo_tagged_entry_tag_finalize (GObject *object)
|
||||
{
|
||||
DemoTaggedEntryTag *tag = DEMO_TAGGED_ENTRY_TAG (object);
|
||||
|
||||
g_clear_pointer (&tag->box, gtk_widget_unparent);
|
||||
g_clear_pointer (&tag->style, g_free);
|
||||
|
||||
G_OBJECT_CLASS (demo_tagged_entry_tag_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
demo_tagged_entry_tag_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
DemoTaggedEntryTag *tag = DEMO_TAGGED_ENTRY_TAG (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_LABEL:
|
||||
demo_tagged_entry_tag_set_label (tag, g_value_get_string (value));
|
||||
break;
|
||||
|
||||
case PROP_HAS_CLOSE_BUTTON:
|
||||
demo_tagged_entry_tag_set_has_close_button (tag, g_value_get_boolean (value));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
demo_tagged_entry_tag_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
DemoTaggedEntryTag *tag = DEMO_TAGGED_ENTRY_TAG (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_LABEL:
|
||||
g_value_set_string (value, demo_tagged_entry_tag_get_label (tag));
|
||||
break;
|
||||
|
||||
case PROP_HAS_CLOSE_BUTTON:
|
||||
g_value_set_boolean (value, demo_tagged_entry_tag_get_has_close_button (tag));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
demo_tagged_entry_tag_measure (GtkWidget *widget,
|
||||
GtkOrientation orientation,
|
||||
int for_size,
|
||||
int *minimum,
|
||||
int *natural,
|
||||
int *minimum_baseline,
|
||||
int *natural_baseline)
|
||||
{
|
||||
DemoTaggedEntryTag *tag = DEMO_TAGGED_ENTRY_TAG (widget);
|
||||
|
||||
gtk_widget_measure (tag->box, orientation, for_size,
|
||||
minimum, natural,
|
||||
minimum_baseline, natural_baseline);
|
||||
}
|
||||
|
||||
static void
|
||||
demo_tagged_entry_tag_size_allocate (GtkWidget *widget,
|
||||
int width,
|
||||
int height,
|
||||
int baseline)
|
||||
{
|
||||
DemoTaggedEntryTag *tag = DEMO_TAGGED_ENTRY_TAG (widget);
|
||||
|
||||
gtk_widget_size_allocate (tag->box,
|
||||
&(GtkAllocation) { 0, 0, width, height },
|
||||
baseline);
|
||||
}
|
||||
|
||||
static void
|
||||
demo_tagged_entry_tag_class_init (DemoTaggedEntryTagClass *class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
|
||||
|
||||
object_class->dispose = demo_tagged_entry_tag_dispose;
|
||||
object_class->finalize = demo_tagged_entry_tag_finalize;
|
||||
object_class->set_property = demo_tagged_entry_tag_set_property;
|
||||
object_class->get_property = demo_tagged_entry_tag_get_property;
|
||||
|
||||
widget_class->measure = demo_tagged_entry_tag_measure;
|
||||
widget_class->size_allocate = demo_tagged_entry_tag_size_allocate;
|
||||
|
||||
signals[SIGNAL_CLICKED] =
|
||||
g_signal_new ("clicked",
|
||||
DEMO_TYPE_TAGGED_ENTRY_TAG,
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
0, NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 0);
|
||||
signals[SIGNAL_BUTTON_CLICKED] =
|
||||
g_signal_new ("button-clicked",
|
||||
DEMO_TYPE_TAGGED_ENTRY_TAG,
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
0, NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
g_object_class_install_property (object_class, PROP_LABEL,
|
||||
g_param_spec_string ("label", "Label", "Label",
|
||||
NULL, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (object_class, PROP_HAS_CLOSE_BUTTON,
|
||||
g_param_spec_boolean ("has-close-button", "Has close button", "Whether this tag has a close button",
|
||||
FALSE, G_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
|
||||
|
||||
gtk_widget_class_set_css_name (widget_class, "tag");
|
||||
}
|
||||
|
||||
DemoTaggedEntryTag *
|
||||
demo_tagged_entry_tag_new (const char *label)
|
||||
{
|
||||
return DEMO_TAGGED_ENTRY_TAG (g_object_new (DEMO_TYPE_TAGGED_ENTRY_TAG,
|
||||
"label", label,
|
||||
NULL));
|
||||
}
|
||||
|
||||
const char *
|
||||
demo_tagged_entry_tag_get_label (DemoTaggedEntryTag *tag)
|
||||
{
|
||||
g_return_val_if_fail (DEMO_IS_TAGGED_ENTRY_TAG (tag), NULL);
|
||||
|
||||
return gtk_label_get_label (GTK_LABEL (tag->label));
|
||||
}
|
||||
|
||||
void
|
||||
demo_tagged_entry_tag_set_label (DemoTaggedEntryTag *tag,
|
||||
const char *label)
|
||||
{
|
||||
g_return_if_fail (DEMO_IS_TAGGED_ENTRY_TAG (tag));
|
||||
|
||||
gtk_label_set_label (GTK_LABEL (tag->label), label);
|
||||
}
|
||||
|
||||
static void
|
||||
on_button_clicked (GtkButton *button,
|
||||
DemoTaggedEntryTag *tag)
|
||||
{
|
||||
g_signal_emit (tag, signals[SIGNAL_BUTTON_CLICKED], 0);
|
||||
}
|
||||
|
||||
void
|
||||
demo_tagged_entry_tag_set_has_close_button (DemoTaggedEntryTag *tag,
|
||||
gboolean has_close_button)
|
||||
{
|
||||
g_return_if_fail (DEMO_IS_TAGGED_ENTRY_TAG (tag));
|
||||
|
||||
if ((tag->button != NULL) == has_close_button)
|
||||
return;
|
||||
|
||||
if (!has_close_button && tag->button)
|
||||
{
|
||||
gtk_container_remove (GTK_CONTAINER (tag->box), tag->button);
|
||||
tag->button = NULL;
|
||||
}
|
||||
else if (has_close_button && tag->button == NULL)
|
||||
{
|
||||
GtkWidget *image;
|
||||
|
||||
image = gtk_image_new_from_icon_name ("window-close-symbolic");
|
||||
tag->button = gtk_button_new ();
|
||||
gtk_container_add (GTK_CONTAINER (tag->button), image);
|
||||
gtk_widget_set_halign (tag->button, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (tag->button, GTK_ALIGN_CENTER);
|
||||
gtk_button_set_relief (GTK_BUTTON (tag->button), GTK_RELIEF_NONE);
|
||||
gtk_container_add (GTK_CONTAINER (tag->box), tag->button);
|
||||
g_signal_connect (tag->button, "clicked", G_CALLBACK (on_button_clicked), tag);
|
||||
}
|
||||
|
||||
g_object_notify (G_OBJECT (tag), "has-close-button");
|
||||
}
|
||||
|
||||
gboolean
|
||||
demo_tagged_entry_tag_get_has_close_button (DemoTaggedEntryTag *tag)
|
||||
{
|
||||
g_return_val_if_fail (DEMO_IS_TAGGED_ENTRY_TAG (tag), FALSE);
|
||||
|
||||
return tag->button != NULL;
|
||||
}
|
||||
89
demos/gtk-demo/demotaggedentry.h
Normal file
89
demos/gtk-demo/demotaggedentry.h
Normal file
@@ -0,0 +1,89 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 2019 Red Hat, Inc.
|
||||
*
|
||||
* Authors:
|
||||
* - Matthias Clasen <mclasen@redhat.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __DEMO_TAGGED_ENTRY_H__
|
||||
#define __DEMO_TAGGED_ENTRY_H__
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define DEMO_TYPE_TAGGED_ENTRY (demo_tagged_entry_get_type ())
|
||||
#define DEMO_TAGGED_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DEMO_TYPE_TAGGED_ENTRY, DemoTaggedEntry))
|
||||
#define DEMO_TAGGED_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DEMO_TYPE_TAGGED_ENTRY, DemoTaggedEntryClass))
|
||||
#define DEMO_IS_TAGGED_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DEMO_TYPE_TAGGED_ENTRY))
|
||||
#define DEMO_IS_TAGGED_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DEMO_TYPE_TAGGED_ENTRY))
|
||||
#define DEMO_TAGGED_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DEMO_TYPE_TAGGED_ENTRY, DemoTaggedEntryClass))
|
||||
|
||||
typedef struct _DemoTaggedEntry DemoTaggedEntry;
|
||||
typedef struct _DemoTaggedEntryClass DemoTaggedEntryClass;
|
||||
|
||||
struct _DemoTaggedEntry
|
||||
{
|
||||
GtkWidget parent;
|
||||
};
|
||||
|
||||
struct _DemoTaggedEntryClass
|
||||
{
|
||||
GtkWidgetClass parent_class;
|
||||
};
|
||||
|
||||
#define DEMO_TYPE_TAGGED_ENTRY_TAG (demo_tagged_entry_tag_get_type ())
|
||||
#define DEMO_TAGGED_ENTRY_TAG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DEMO_TYPE_TAGGED_ENTRY_TAG, DemoTaggedEntryTag))
|
||||
#define DEMO_TAGGED_ENTRY_TAG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DEMO_TYPE_TAGGED_ENTRY_TAG, DemoTaggedEntryTag))
|
||||
#define DEMO_IS_TAGGED_ENTRY_TAG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DEMO_TYPE_TAGGED_ENTRY_TAG))
|
||||
#define DEMO_IS_TAGGED_ENTRY_TAG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DEMO_TYPE_TAGGED_ENTRY_TAG))
|
||||
#define DEMO_TAGGED_ENTRY_TAG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DEMO_TYPE_TAGGED_ENTRY_TAG, DemoTaggedEntryTagClass))
|
||||
|
||||
typedef struct _DemoTaggedEntryTag DemoTaggedEntryTag;
|
||||
typedef struct _DemoTaggedEntryTagClass DemoTaggedEntryTagClass;
|
||||
|
||||
|
||||
GType demo_tagged_entry_get_type (void) G_GNUC_CONST;
|
||||
GType demo_tagged_entry_tag_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkWidget * demo_tagged_entry_new (void);
|
||||
|
||||
void demo_tagged_entry_add_tag (DemoTaggedEntry *entry,
|
||||
GtkWidget *tag);
|
||||
|
||||
void demo_tagged_entry_insert_tag_after (DemoTaggedEntry *entry,
|
||||
GtkWidget *tag,
|
||||
GtkWidget *sibling);
|
||||
|
||||
void demo_tagged_entry_remove_tag (DemoTaggedEntry *entry,
|
||||
GtkWidget *tag);
|
||||
|
||||
DemoTaggedEntryTag *
|
||||
demo_tagged_entry_tag_new (const char *label);
|
||||
|
||||
const char * demo_tagged_entry_tag_get_label (DemoTaggedEntryTag *tag);
|
||||
|
||||
void demo_tagged_entry_tag_set_label (DemoTaggedEntryTag *tag,
|
||||
const char *label);
|
||||
|
||||
gboolean demo_tagged_entry_tag_get_has_close_button (DemoTaggedEntryTag *tag);
|
||||
|
||||
void demo_tagged_entry_tag_set_has_close_button (DemoTaggedEntryTag *tag,
|
||||
gboolean has_close_button);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __DEMO_TAGGED_ENTRY_H__ */
|
||||
@@ -69,7 +69,7 @@ interactive_dialog_clicked (GtkButton *button,
|
||||
label = gtk_label_new_with_mnemonic ("_Entry 1");
|
||||
gtk_grid_attach (GTK_GRID (table), label, 0, 0, 1, 1);
|
||||
local_entry1 = gtk_entry_new ();
|
||||
gtk_entry_set_text (GTK_ENTRY (local_entry1), gtk_entry_get_text (GTK_ENTRY (entry1)));
|
||||
gtk_editable_set_text (GTK_EDITABLE (local_entry1), gtk_editable_get_text (GTK_EDITABLE (entry1)));
|
||||
gtk_grid_attach (GTK_GRID (table), local_entry1, 1, 0, 1, 1);
|
||||
gtk_label_set_mnemonic_widget (GTK_LABEL (label), local_entry1);
|
||||
|
||||
@@ -77,7 +77,7 @@ interactive_dialog_clicked (GtkButton *button,
|
||||
gtk_grid_attach (GTK_GRID (table), label, 0, 1, 1, 1);
|
||||
|
||||
local_entry2 = gtk_entry_new ();
|
||||
gtk_entry_set_text (GTK_ENTRY (local_entry2), gtk_entry_get_text (GTK_ENTRY (entry2)));
|
||||
gtk_editable_set_text (GTK_EDITABLE (local_entry2), gtk_editable_get_text (GTK_EDITABLE (entry2)));
|
||||
gtk_grid_attach (GTK_GRID (table), local_entry2, 1, 1, 1, 1);
|
||||
gtk_label_set_mnemonic_widget (GTK_LABEL (label), local_entry2);
|
||||
|
||||
@@ -85,8 +85,8 @@ interactive_dialog_clicked (GtkButton *button,
|
||||
|
||||
if (response == GTK_RESPONSE_OK)
|
||||
{
|
||||
gtk_entry_set_text (GTK_ENTRY (entry1), gtk_entry_get_text (GTK_ENTRY (local_entry1)));
|
||||
gtk_entry_set_text (GTK_ENTRY (entry2), gtk_entry_get_text (GTK_ENTRY (local_entry2)));
|
||||
gtk_editable_set_text (GTK_EDITABLE (entry1), gtk_editable_get_text (GTK_EDITABLE (local_entry1)));
|
||||
gtk_editable_set_text (GTK_EDITABLE (entry2), gtk_editable_get_text (GTK_EDITABLE (local_entry2)));
|
||||
}
|
||||
|
||||
gtk_widget_destroy (dialog);
|
||||
|
||||
@@ -196,10 +196,10 @@ edit_label_done (GtkWidget *entry, gpointer data)
|
||||
GtkWidget *label;
|
||||
int x, y;
|
||||
|
||||
gtk_container_child_get (GTK_CONTAINER (fixed), entry, "x", &x, "y", &y, NULL);
|
||||
gtk_fixed_get_child_position (GTK_FIXED (fixed), entry, &x, &y);
|
||||
|
||||
label = GTK_WIDGET (g_object_get_data (G_OBJECT (entry), "label"));
|
||||
gtk_label_set_text (GTK_LABEL (label), gtk_entry_get_text (GTK_ENTRY (entry)));
|
||||
gtk_label_set_text (GTK_LABEL (label), gtk_editable_get_text (GTK_EDITABLE (entry)));
|
||||
|
||||
gtk_widget_destroy (entry);
|
||||
}
|
||||
@@ -210,7 +210,7 @@ edit_cb (GtkWidget *child)
|
||||
GtkWidget *fixed = gtk_widget_get_parent (child);
|
||||
int x, y;
|
||||
|
||||
gtk_container_child_get (GTK_CONTAINER (fixed), child, "x", &x, "y", &y, NULL);
|
||||
gtk_fixed_get_child_position (GTK_FIXED (fixed), child, &x, &y);
|
||||
|
||||
if (GTK_IS_LABEL (child))
|
||||
{
|
||||
@@ -218,7 +218,7 @@ edit_cb (GtkWidget *child)
|
||||
|
||||
g_object_set_data (G_OBJECT (entry), "label", child);
|
||||
|
||||
gtk_entry_set_text (GTK_ENTRY (entry), gtk_label_get_text (GTK_LABEL (child)));
|
||||
gtk_editable_set_text (GTK_EDITABLE (entry), gtk_label_get_text (GTK_LABEL (child)));
|
||||
g_signal_connect (entry, "activate", G_CALLBACK (edit_label_done), NULL);
|
||||
gtk_fixed_put (GTK_FIXED (fixed), entry, x, y);
|
||||
gtk_widget_grab_focus (entry);
|
||||
|
||||
@@ -23,58 +23,46 @@
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<child type="end">
|
||||
<object class="GtkLabel">
|
||||
<property name="label">fps</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">end</property>
|
||||
</packing>
|
||||
<packing/>
|
||||
</child>
|
||||
<child>
|
||||
<child type="end">
|
||||
<object class="GtkLabel">
|
||||
<property name="label" bind-source="bowl" bind-property="framerate"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">end</property>
|
||||
</packing>
|
||||
<packing/>
|
||||
</child>
|
||||
<child>
|
||||
<child type="end">
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Icons, </property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">end</property>
|
||||
</packing>
|
||||
<packing/>
|
||||
</child>
|
||||
<child>
|
||||
<child type="end">
|
||||
<object class="GtkLabel">
|
||||
<property name="label" bind-source="bowl" bind-property="count"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">end</property>
|
||||
</packing>
|
||||
<packing/>
|
||||
</child>
|
||||
<child>
|
||||
<child type="end">
|
||||
<object class="GtkToggleButton" id="changes_allow">
|
||||
<property name="visible" bind-source="changes_allow" bind-property="active" bind-flags="invert-boolean"/>
|
||||
<property name="icon-name">changes-allow</property>
|
||||
<property name="relief">none</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">end</property>
|
||||
</packing>
|
||||
<packing/>
|
||||
</child>
|
||||
<child>
|
||||
<child type="end">
|
||||
<object class="GtkToggleButton" id="changes_prevent">
|
||||
<property name="active" bind-source="changes_allow" bind-property="active" bind-flags="bidirectional|invert-boolean">1</property>
|
||||
<property name="visible" bind-source="changes_prevent" bind-property="active" bind-flags="invert-boolean">0</property>
|
||||
<property name="active" bind-source="changes_allow" bind-property="active" bind-flags="bidirectional|invert-boolean"/>
|
||||
<property name="visible" bind-source="changes_prevent" bind-property="active" bind-flags="invert-boolean"/>
|
||||
<property name="icon-name">changes-prevent</property>
|
||||
<property name="relief">none</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">end</property>
|
||||
</packing>
|
||||
<packing/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
@@ -82,7 +70,7 @@
|
||||
<object class="GtkFishbowl" id="bowl">
|
||||
<property name="visible">True</property>
|
||||
<property name="animating">True</property>
|
||||
<property name="benchmark" bind-source="changes_allow" bind-property="active" bind-flags="invert-boolean">1</property>
|
||||
<property name="benchmark" bind-source="changes_allow" bind-property="active" bind-flags="invert-boolean"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
@@ -305,7 +305,7 @@ update_display (void)
|
||||
char *font_desc;
|
||||
char *features;
|
||||
|
||||
text = gtk_entry_get_text (GTK_ENTRY (entry));
|
||||
text = gtk_editable_get_text (GTK_EDITABLE (entry));
|
||||
|
||||
if (gtk_label_get_selection_bounds (GTK_LABEL (label), &ins, &bound))
|
||||
{
|
||||
@@ -728,7 +728,7 @@ adjustment_changed (GtkAdjustment *adjustment,
|
||||
char *str;
|
||||
|
||||
str = g_strdup_printf ("%g", gtk_adjustment_get_value (adjustment));
|
||||
gtk_entry_set_text (GTK_ENTRY (entry), str);
|
||||
gtk_editable_set_text (GTK_EDITABLE (entry), str);
|
||||
g_free (str);
|
||||
|
||||
update_display ();
|
||||
@@ -741,7 +741,7 @@ entry_activated (GtkEntry *entry,
|
||||
gdouble value;
|
||||
gchar *err = NULL;
|
||||
|
||||
value = g_strtod (gtk_entry_get_text (entry), &err);
|
||||
value = g_strtod (gtk_editable_get_text (GTK_EDITABLE (entry)), &err);
|
||||
if (err != NULL)
|
||||
gtk_adjustment_set_value (adjustment, value);
|
||||
}
|
||||
@@ -821,7 +821,7 @@ add_axis (FT_Var_Axis *ax, FT_Fixed value, int i)
|
||||
gtk_grid_attach (GTK_GRID (variations_grid), axis_scale, 1, i, 1, 1);
|
||||
axis_entry = gtk_entry_new ();
|
||||
gtk_widget_set_valign (axis_entry, GTK_ALIGN_BASELINE);
|
||||
gtk_entry_set_width_chars (GTK_ENTRY (axis_entry), 4);
|
||||
gtk_editable_set_width_chars (GTK_EDITABLE (axis_entry), 4);
|
||||
gtk_grid_attach (GTK_GRID (variations_grid), axis_entry, 2, i, 1, 1);
|
||||
|
||||
axis = g_new (Axis, 1);
|
||||
@@ -1639,7 +1639,7 @@ static char *text;
|
||||
static void
|
||||
switch_to_entry (void)
|
||||
{
|
||||
text = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry)));
|
||||
text = g_strdup (gtk_editable_get_text (GTK_EDITABLE (entry)));
|
||||
gtk_stack_set_visible_child_name (GTK_STACK (stack), "entry");
|
||||
gtk_widget_grab_focus (entry);
|
||||
}
|
||||
@@ -1677,7 +1677,7 @@ entry_key_press (GtkEventController *controller,
|
||||
{
|
||||
if (keyval == GDK_KEY_Escape)
|
||||
{
|
||||
gtk_entry_set_text (GTK_ENTRY (entry), text);
|
||||
gtk_editable_set_text (GTK_EDITABLE (entry), text);
|
||||
stop_edit ();
|
||||
return GDK_EVENT_STOP;
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ demos = files([
|
||||
'paintable_animated.c',
|
||||
'paintable_mediastream.c',
|
||||
'panes.c',
|
||||
'password_entry.c',
|
||||
'pickers.c',
|
||||
'pixbufs.c',
|
||||
'popover.c',
|
||||
@@ -64,6 +65,7 @@ demos = files([
|
||||
'spinner.c',
|
||||
'stack.c',
|
||||
'tabs.c',
|
||||
'tagged_entry.c',
|
||||
'textmask.c',
|
||||
'textview.c',
|
||||
'textscroll.c',
|
||||
@@ -75,7 +77,13 @@ demos = files([
|
||||
|
||||
gtkdemo_deps = [ libgtk_dep, ]
|
||||
|
||||
extra_demo_sources = files(['main.c', 'gtkfishbowl.c', 'fontplane.c', 'gtkgears.c', 'puzzlepiece.c', 'bluroverlay.c'])
|
||||
extra_demo_sources = files(['main.c',
|
||||
'gtkfishbowl.c',
|
||||
'fontplane.c',
|
||||
'gtkgears.c',
|
||||
'puzzlepiece.c',
|
||||
'bluroverlay.c',
|
||||
'demotaggedentry.c'])
|
||||
|
||||
if harfbuzz_dep.found() and pangoft_dep.found()
|
||||
demos += files('font_features.c')
|
||||
|
||||
@@ -30,4 +30,11 @@
|
||||
<translation type="gettext">gtk-4.0</translation>
|
||||
<update_contact>matthias.clasen_at_gmail.com</update_contact>
|
||||
<developer_name>Matthias Clasen and others</developer_name>
|
||||
<releases>
|
||||
<release version="3.94.0" date="2018-06-25">
|
||||
<description>
|
||||
<p>A new developers snapshot towards GTK 4.0.</p>
|
||||
</description>
|
||||
</release>
|
||||
</releases>
|
||||
</component>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
static void
|
||||
do_number (GtkButton *button, GtkEntry *entry)
|
||||
{
|
||||
gtk_entry_set_text (entry, gtk_button_get_label (button));
|
||||
gtk_editable_set_text (GTK_EDITABLE (entry), gtk_button_get_label (button));
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
||||
@@ -171,8 +171,24 @@ on_pad_knob_change (GSimpleAction *action,
|
||||
}
|
||||
|
||||
static void
|
||||
drawing_area_hierarchy_changed (GtkWidget *widget,
|
||||
GtkWidget *previous_toplevel)
|
||||
drawing_area_unroot (GtkWidget *widget)
|
||||
{
|
||||
DrawingArea *area = (DrawingArea *) widget;
|
||||
GtkWidget *toplevel;
|
||||
|
||||
toplevel = gtk_widget_get_toplevel (widget);
|
||||
|
||||
if (area->pad_controller)
|
||||
{
|
||||
gtk_widget_remove_controller (toplevel, GTK_EVENT_CONTROLLER (area->pad_controller));
|
||||
area->pad_controller = NULL;
|
||||
}
|
||||
|
||||
GTK_WIDGET_CLASS (drawing_area_parent_class)->unroot (widget);
|
||||
}
|
||||
|
||||
static void
|
||||
drawing_area_root (GtkWidget *widget)
|
||||
{
|
||||
DrawingArea *area = (DrawingArea *) widget;
|
||||
GSimpleActionGroup *action_group;
|
||||
@@ -180,20 +196,12 @@ drawing_area_hierarchy_changed (GtkWidget *widget,
|
||||
GtkWidget *toplevel;
|
||||
gint i;
|
||||
|
||||
if (previous_toplevel && area->pad_controller)
|
||||
{
|
||||
gtk_widget_remove_controller (previous_toplevel,
|
||||
GTK_EVENT_CONTROLLER (area->pad_controller));
|
||||
area->pad_controller = NULL;
|
||||
}
|
||||
GTK_WIDGET_CLASS (drawing_area_parent_class)->root (widget);
|
||||
|
||||
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (area));
|
||||
if (!GTK_IS_WINDOW (toplevel))
|
||||
return;
|
||||
|
||||
action_group = g_simple_action_group_new ();
|
||||
area->pad_controller = gtk_pad_controller_new (G_ACTION_GROUP (action_group),
|
||||
NULL);
|
||||
area->pad_controller = gtk_pad_controller_new (G_ACTION_GROUP (action_group), NULL);
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (pad_actions); i++)
|
||||
{
|
||||
@@ -220,8 +228,7 @@ drawing_area_hierarchy_changed (GtkWidget *widget,
|
||||
gtk_pad_controller_set_action_entries (area->pad_controller, pad_actions,
|
||||
G_N_ELEMENTS (pad_actions));
|
||||
|
||||
gtk_widget_add_controller (toplevel,
|
||||
GTK_EVENT_CONTROLLER (area->pad_controller));
|
||||
gtk_widget_add_controller (toplevel, GTK_EVENT_CONTROLLER (area->pad_controller));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -233,7 +240,8 @@ drawing_area_class_init (DrawingAreaClass *klass)
|
||||
widget_class->snapshot = drawing_area_snapshot;
|
||||
widget_class->map = drawing_area_map;
|
||||
widget_class->unmap = drawing_area_unmap;
|
||||
widget_class->hierarchy_changed = drawing_area_hierarchy_changed;
|
||||
widget_class->root = drawing_area_root;
|
||||
widget_class->unroot = drawing_area_unroot;
|
||||
|
||||
area_signals[COLOR_SET] =
|
||||
g_signal_new ("color-set",
|
||||
|
||||
89
demos/gtk-demo/password_entry.c
Normal file
89
demos/gtk-demo/password_entry.c
Normal file
@@ -0,0 +1,89 @@
|
||||
/* Entry/Password Entry
|
||||
*
|
||||
* GtkPasswordEntry provides common functionality of
|
||||
* entries that are used to enter passwords and other
|
||||
* secrets.
|
||||
*
|
||||
* It will display a warning if CapsLock is on, and it
|
||||
* can optionally provide a way to see the text.
|
||||
*/
|
||||
|
||||
#include <glib/gi18n.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static GtkWidget *entry;
|
||||
static GtkWidget *entry2;
|
||||
static GtkWidget *button;
|
||||
|
||||
static void
|
||||
update_button (GObject *object,
|
||||
GParamSpec *pspec,
|
||||
gpointer data)
|
||||
{
|
||||
const char *text = gtk_editable_get_text (GTK_EDITABLE (entry));
|
||||
const char *text2 = gtk_editable_get_text (GTK_EDITABLE (entry2));
|
||||
|
||||
gtk_widget_set_sensitive (button,
|
||||
text[0] != '\0' && g_str_equal (text, text2));
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_password_entry (GtkWidget *do_widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
GtkWidget *box;
|
||||
GtkWidget *header;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_display (GTK_WINDOW (window),
|
||||
gtk_widget_get_display (do_widget));
|
||||
header = gtk_header_bar_new ();
|
||||
gtk_header_bar_set_title (GTK_HEADER_BAR (header), "Choose a Password");
|
||||
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), FALSE);
|
||||
gtk_window_set_titlebar (GTK_WINDOW (window), header);
|
||||
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
|
||||
gtk_window_set_deletable (GTK_WINDOW (window), FALSE);
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
|
||||
g_object_set (box, "margin", 18, NULL);
|
||||
gtk_container_add (GTK_CONTAINER (window), box);
|
||||
|
||||
entry = gtk_password_entry_new ();
|
||||
gtk_password_entry_set_show_peek_icon (GTK_PASSWORD_ENTRY (entry), TRUE);
|
||||
g_object_set (entry,
|
||||
"placeholder-text", "Password",
|
||||
"activates-default", TRUE,
|
||||
NULL);
|
||||
g_signal_connect (entry, "notify::text", G_CALLBACK (update_button), NULL);
|
||||
gtk_container_add (GTK_CONTAINER (box), entry);
|
||||
|
||||
entry2 = gtk_password_entry_new ();
|
||||
gtk_password_entry_set_show_peek_icon (GTK_PASSWORD_ENTRY (entry2), TRUE);
|
||||
g_object_set (entry2,
|
||||
"placeholder-text", "Confirm",
|
||||
"activates-default", TRUE,
|
||||
NULL);
|
||||
g_signal_connect (entry2, "notify::text", G_CALLBACK (update_button), NULL);
|
||||
gtk_container_add (GTK_CONTAINER (box), entry2);
|
||||
|
||||
button = gtk_button_new_with_mnemonic ("_Done");
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (button), "suggested-action");
|
||||
g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_widget_destroy), window);
|
||||
gtk_widget_set_sensitive (button, FALSE);
|
||||
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button);
|
||||
|
||||
gtk_widget_set_can_default (button, TRUE);
|
||||
gtk_window_set_default (GTK_WINDOW (window), button);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
gtk_widget_show (window);
|
||||
else
|
||||
gtk_widget_destroy (window);
|
||||
|
||||
return window;
|
||||
}
|
||||
@@ -85,7 +85,7 @@ stop_search (GtkButton *button,
|
||||
static void
|
||||
clear_entry (GtkEntry *entry)
|
||||
{
|
||||
gtk_entry_set_text (entry, "");
|
||||
gtk_editable_set_text (GTK_EDITABLE (entry), "");
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -246,7 +246,10 @@ do_search_entry (GtkWidget *do_widget)
|
||||
gtk_container_add (GTK_CONTAINER (vbox), hbox);
|
||||
|
||||
/* Create our entry */
|
||||
entry = gtk_search_entry_new ();
|
||||
entry = gtk_entry_new ();
|
||||
gtk_entry_set_icon_from_icon_name (GTK_ENTRY (entry),
|
||||
GTK_ENTRY_ICON_PRIMARY,
|
||||
"edit-find-symbolic");
|
||||
gtk_container_add (GTK_CONTAINER (hbox), entry);
|
||||
|
||||
/* Create the find and cancel buttons */
|
||||
|
||||
@@ -19,7 +19,7 @@ hex_spin_input (GtkSpinButton *spin_button,
|
||||
gchar *err;
|
||||
gdouble res;
|
||||
|
||||
buf = gtk_spin_button_get_text (spin_button);
|
||||
buf = gtk_editable_get_text (GTK_EDITABLE (spin_button));
|
||||
res = strtol (buf, &err, 16);
|
||||
*new_val = res;
|
||||
if (*err)
|
||||
@@ -41,8 +41,8 @@ hex_spin_output (GtkSpinButton *spin_button)
|
||||
buf = g_strdup ("0x00");
|
||||
else
|
||||
buf = g_strdup_printf ("0x%.2X", (gint) val);
|
||||
if (strcmp (buf, gtk_spin_button_get_text (spin_button)))
|
||||
gtk_spin_button_set_text (spin_button, buf);
|
||||
if (strcmp (buf, gtk_editable_get_text (GTK_EDITABLE (spin_button))))
|
||||
gtk_editable_set_text (GTK_EDITABLE (spin_button), buf);
|
||||
g_free (buf);
|
||||
|
||||
return TRUE;
|
||||
@@ -60,7 +60,7 @@ time_spin_input (GtkSpinButton *spin_button,
|
||||
gchar *endh;
|
||||
gchar *endm;
|
||||
|
||||
text = gtk_spin_button_get_text (spin_button);
|
||||
text = gtk_editable_get_text (GTK_EDITABLE (spin_button));
|
||||
str = g_strsplit (text, ":", 2);
|
||||
|
||||
if (g_strv_length (str) == 2)
|
||||
@@ -99,8 +99,8 @@ time_spin_output (GtkSpinButton *spin_button)
|
||||
hours = gtk_adjustment_get_value (adjustment) / 60.0;
|
||||
minutes = (hours - floor (hours)) * 60.0;
|
||||
buf = g_strdup_printf ("%02.0f:%02.0f", floor (hours), floor (minutes + 0.5));
|
||||
if (strcmp (buf, gtk_spin_button_get_text (spin_button)))
|
||||
gtk_spin_button_set_text (spin_button, buf);
|
||||
if (strcmp (buf, gtk_editable_get_text (GTK_EDITABLE (spin_button))))
|
||||
gtk_editable_set_text (GTK_EDITABLE (spin_button), buf);
|
||||
g_free (buf);
|
||||
|
||||
return TRUE;
|
||||
@@ -132,7 +132,7 @@ month_spin_input (GtkSpinButton *spin_button,
|
||||
for (i = 1; i <= 12; i++)
|
||||
{
|
||||
tmp1 = g_ascii_strup (month[i - 1], -1);
|
||||
tmp2 = g_ascii_strup (gtk_spin_button_get_text (spin_button), -1);
|
||||
tmp2 = g_ascii_strup (gtk_editable_get_text (GTK_EDITABLE (spin_button)), -1);
|
||||
if (strstr (tmp1, tmp2) == tmp1)
|
||||
found = TRUE;
|
||||
g_free (tmp1);
|
||||
@@ -162,8 +162,8 @@ month_spin_output (GtkSpinButton *spin_button)
|
||||
for (i = 1; i <= 12; i++)
|
||||
if (fabs (value - (double)i) < 1e-5)
|
||||
{
|
||||
if (strcmp (month[i-1], gtk_spin_button_get_text (spin_button)))
|
||||
gtk_spin_button_set_text (spin_button, month[i-1]);
|
||||
if (strcmp (month[i-1], gtk_editable_get_text (GTK_EDITABLE (spin_button))))
|
||||
gtk_editable_set_text (GTK_EDITABLE (spin_button), month[i-1]);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
||||
112
demos/gtk-demo/tagged_entry.c
Normal file
112
demos/gtk-demo/tagged_entry.c
Normal file
@@ -0,0 +1,112 @@
|
||||
/* Entry/Tagged Entry
|
||||
*
|
||||
* This example shows how to build a complex composite
|
||||
* entry using GtkText, outside of GTK.
|
||||
*
|
||||
* This tagged entry can display tags and other widgets
|
||||
* inside the entry area.
|
||||
*/
|
||||
|
||||
#include <glib/gi18n.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "demotaggedentry.h"
|
||||
|
||||
static GtkWidget *spinner = NULL;
|
||||
|
||||
static void
|
||||
closed_cb (DemoTaggedEntryTag *tag, DemoTaggedEntry *entry)
|
||||
{
|
||||
demo_tagged_entry_remove_tag (entry, GTK_WIDGET (tag));
|
||||
}
|
||||
|
||||
static void
|
||||
add_tag (GtkButton *button, DemoTaggedEntry *entry)
|
||||
{
|
||||
DemoTaggedEntryTag *tag;
|
||||
|
||||
tag = demo_tagged_entry_tag_new ("Blue");
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (tag)), "blue");
|
||||
demo_tagged_entry_tag_set_has_close_button (tag, TRUE);
|
||||
g_signal_connect (tag, "button-clicked", G_CALLBACK (closed_cb), entry);
|
||||
|
||||
if (spinner == NULL)
|
||||
demo_tagged_entry_add_tag (entry, GTK_WIDGET (tag));
|
||||
else
|
||||
demo_tagged_entry_insert_tag_after (entry, GTK_WIDGET (tag), gtk_widget_get_prev_sibling (spinner));
|
||||
}
|
||||
|
||||
static void
|
||||
toggle_spinner (GtkCheckButton *button, DemoTaggedEntry *entry)
|
||||
{
|
||||
if (spinner)
|
||||
{
|
||||
demo_tagged_entry_remove_tag (entry, spinner);
|
||||
spinner = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
spinner = gtk_spinner_new ();
|
||||
gtk_spinner_start (GTK_SPINNER (spinner));
|
||||
demo_tagged_entry_add_tag (entry, spinner);
|
||||
}
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_tagged_entry (GtkWidget *do_widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
GtkWidget *box;
|
||||
GtkWidget *box2;
|
||||
GtkWidget *header;
|
||||
GtkWidget *entry;
|
||||
GtkWidget *button;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_display (GTK_WINDOW (window),
|
||||
gtk_widget_get_display (do_widget));
|
||||
header = gtk_header_bar_new ();
|
||||
gtk_header_bar_set_title (GTK_HEADER_BAR (header), "A tagged entry");
|
||||
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), FALSE);
|
||||
gtk_window_set_titlebar (GTK_WINDOW (window), header);
|
||||
gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
|
||||
gtk_window_set_deletable (GTK_WINDOW (window), FALSE);
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
|
||||
g_object_set (box, "margin", 18, NULL);
|
||||
gtk_container_add (GTK_CONTAINER (window), box);
|
||||
|
||||
entry = demo_tagged_entry_new ();
|
||||
gtk_container_add (GTK_CONTAINER (box), entry);
|
||||
|
||||
box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
|
||||
gtk_widget_set_halign (box2, GTK_ALIGN_END);
|
||||
gtk_container_add (GTK_CONTAINER (box), box2);
|
||||
|
||||
button = gtk_button_new_with_mnemonic ("Add _Tag");
|
||||
g_signal_connect (button, "clicked", G_CALLBACK (add_tag), entry);
|
||||
gtk_container_add (GTK_CONTAINER (box2), button);
|
||||
|
||||
button = gtk_check_button_new_with_mnemonic ("_Spinner");
|
||||
g_signal_connect (button, "toggled", G_CALLBACK (toggle_spinner), entry);
|
||||
gtk_container_add (GTK_CONTAINER (box2), button);
|
||||
|
||||
button = gtk_button_new_with_mnemonic ("_Done");
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (button), "suggested-action");
|
||||
g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_widget_destroy), window);
|
||||
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button);
|
||||
|
||||
gtk_widget_set_can_default (button, TRUE);
|
||||
gtk_window_set_default (GTK_WINDOW (window), button);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
gtk_widget_show (window);
|
||||
else
|
||||
gtk_widget_destroy (window);
|
||||
|
||||
return window;
|
||||
}
|
||||
19
demos/gtk-demo/tagstyle.css
Normal file
19
demos/gtk-demo/tagstyle.css
Normal file
@@ -0,0 +1,19 @@
|
||||
tag {
|
||||
margin: 4px;
|
||||
padding: 4px;
|
||||
border-radius: 4px;
|
||||
background: lightskyblue;
|
||||
}
|
||||
tag box {
|
||||
border-spacing: 4px;
|
||||
}
|
||||
tag label,
|
||||
tag image {
|
||||
color: white;
|
||||
}
|
||||
tag button {
|
||||
min-height: 0;
|
||||
min-width: 0;
|
||||
padding: 0;
|
||||
border: 1px solid white;
|
||||
}
|
||||
@@ -11,41 +11,36 @@
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="label" translatable="yes">Normal</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="is-important">1</property>
|
||||
<property name="icon-name">edit-find</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="homogeneous">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="label" translatable="yes">Active</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="is-important">1</property>
|
||||
<property name="icon-name">edit-find</property>
|
||||
<property name="active">1</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="homogeneous">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="label" translatable="yes">Insensitive</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="is-important">1</property>
|
||||
<property name="icon-name">edit-find</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="homogeneous">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="label" translatable="yes">Raised</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="is-important">1</property>
|
||||
@@ -54,12 +49,10 @@
|
||||
<class name="raised"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="homogeneous">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="label" translatable="yes">Raised Active</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="is-important">1</property>
|
||||
@@ -69,12 +62,10 @@
|
||||
<class name="raised"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="homogeneous">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="label" translatable="yes">Insensitive Active</property>
|
||||
<property name="use-underline">1</property>
|
||||
@@ -82,9 +73,6 @@
|
||||
<property name="is-important">1</property>
|
||||
<property name="active">1</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="homogeneous">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolItem">
|
||||
@@ -149,68 +137,56 @@
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="label" translatable="yes">Normal</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="icon-name">list-add-symbolic</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="homogeneous">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="label" translatable="yes">Normal</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="icon-name">list-add-symbolic</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="homogeneous">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="label" translatable="yes">Active</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="icon-name">list-remove-symbolic</property>
|
||||
<property name="active">1</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="homogeneous">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="label" translatable="yes">Active</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="icon-name">list-remove-symbolic</property>
|
||||
<property name="active">1</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="homogeneous">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="label" translatable="yes">Insensitive</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="icon-name">edit-find-symbolic</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="homogeneous">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton">
|
||||
<property name="homogeneous">1</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="label" translatable="yes">Insensitive Active</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="icon-name">go-up-symbolic</property>
|
||||
<property name="active">1</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="homogeneous">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
@@ -68,7 +68,7 @@ search_text_changed (GtkEntry *entry, IconBrowserWindow *win)
|
||||
{
|
||||
const gchar *text;
|
||||
|
||||
text = gtk_entry_get_text (entry);
|
||||
text = gtk_editable_get_text (GTK_EDITABLE (entry));
|
||||
|
||||
if (text[0] == '\0')
|
||||
return;
|
||||
@@ -322,7 +322,7 @@ icon_visible_func (GtkTreeModel *model,
|
||||
gboolean visible;
|
||||
|
||||
search = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (win->search));
|
||||
search_text = gtk_entry_get_text (GTK_ENTRY (win->searchentry));
|
||||
search_text = gtk_editable_get_text (GTK_EDITABLE (win->searchentry));
|
||||
|
||||
if (win->symbolic)
|
||||
column = ICON_STORE_SYMBOLIC_NAME_COLUMN;
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<child type="end">
|
||||
<object class="GtkToggleButton" id="search">
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
@@ -46,9 +46,7 @@
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">end</property>
|
||||
</packing>
|
||||
<packing/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
@@ -31,4 +31,11 @@
|
||||
<translation type="gettext">gtk-4.0</translation>
|
||||
<update_contact>matthias.clasen_at_gmail.com</update_contact>
|
||||
<developer_name>Matthias Clasen and others</developer_name>
|
||||
<releases>
|
||||
<release version="3.94.0" date="2018-06-25">
|
||||
<description>
|
||||
<p>A new developers snapshot towards GTK 4.0.</p>
|
||||
</description>
|
||||
</release>
|
||||
</releases>
|
||||
</component>
|
||||
|
||||
@@ -48,7 +48,7 @@ change_transition_state (GSimpleAction *action,
|
||||
GtkStackTransitionType transition;
|
||||
|
||||
if (g_variant_get_boolean (state))
|
||||
transition = GTK_STACK_TRANSITION_TYPE_SLIDE_LEFT_RIGHT;
|
||||
transition = GTK_STACK_TRANSITION_TYPE_ROTATE_LEFT_RIGHT;
|
||||
else
|
||||
transition = GTK_STACK_TRANSITION_TYPE_NONE;
|
||||
|
||||
@@ -1406,7 +1406,7 @@ open_popover_text_changed (GtkEntry *entry, GParamSpec *pspec, GtkWidget *button
|
||||
{
|
||||
const gchar *text;
|
||||
|
||||
text = gtk_entry_get_text (entry);
|
||||
text = gtk_editable_get_text (GTK_EDITABLE (entry));
|
||||
gtk_widget_set_sensitive (button, strlen (text) > 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -411,15 +411,12 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<property name="stack">toplevel_stack</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<child type="end">
|
||||
<object class="GtkMenuButton" id="gear_menu_button">
|
||||
<property name="valign">center</property>
|
||||
<property name="menu-model">gear_menu</property>
|
||||
<property name="icon-name">open-menu-symbolic</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">end</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
@@ -429,7 +426,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<property name="margin">10</property>
|
||||
<child>
|
||||
<object class="GtkStack" id="toplevel_stack">
|
||||
<property name="transition-duration">30000</property>
|
||||
<property name="transition-duration">1000</property>
|
||||
<child>
|
||||
<object class="GtkStackPage">
|
||||
<property name="name">page1</property>
|
||||
@@ -1432,6 +1429,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<object class="GtkOverlay" id="page2">
|
||||
<child type="overlay">
|
||||
<object class="GtkRevealer" id="page2revealer">
|
||||
<property name="transition-type">swing-down</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">start</property>
|
||||
<child>
|
||||
@@ -1587,16 +1585,13 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<property name="halign">center</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<child type="end">
|
||||
<object class="GtkMenuButton">
|
||||
<property name="menu-model">dinner_menu</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="icon-name">emblem-system-symbolic</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">end</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
@@ -2847,6 +2842,7 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolItem">
|
||||
<property name="expand-item">1</property>
|
||||
<child>
|
||||
<object class="GtkScale">
|
||||
<property name="draw-value">0</property>
|
||||
@@ -2854,9 +2850,6 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolItem">
|
||||
|
||||
@@ -213,6 +213,7 @@ gdk_surface_get_pass_through
|
||||
gdk_surface_move
|
||||
gdk_surface_resize
|
||||
gdk_surface_move_resize
|
||||
gdk_surface_move_to_rect
|
||||
gdk_surface_has_native
|
||||
gdk_surface_raise
|
||||
gdk_surface_lower
|
||||
@@ -240,7 +241,6 @@ gdk_surface_thaw_updates
|
||||
gdk_surface_get_frame_clock
|
||||
|
||||
<SUBSECTION>
|
||||
gdk_surface_set_user_data
|
||||
gdk_surface_set_accept_focus
|
||||
gdk_surface_get_accept_focus
|
||||
gdk_surface_set_focus_on_map
|
||||
@@ -252,7 +252,6 @@ gdk_surface_set_title
|
||||
GDK_PARENT_RELATIVE
|
||||
gdk_surface_set_cursor
|
||||
gdk_surface_get_cursor
|
||||
gdk_surface_get_user_data
|
||||
gdk_surface_get_geometry
|
||||
gdk_surface_set_geometry_hints
|
||||
gdk_surface_get_width
|
||||
@@ -272,17 +271,14 @@ gdk_surface_get_frame_extents
|
||||
gdk_surface_get_origin
|
||||
gdk_surface_get_root_coords
|
||||
gdk_surface_get_device_position
|
||||
gdk_surface_get_device_position_double
|
||||
GdkModifierType
|
||||
GdkModifierIntent
|
||||
gdk_surface_get_parent
|
||||
gdk_surface_get_toplevel
|
||||
gdk_surface_get_children
|
||||
gdk_surface_get_children_with_user_data
|
||||
gdk_surface_peek_children
|
||||
gdk_surface_set_icon_name
|
||||
gdk_surface_set_transient_for
|
||||
gdk_surface_set_role
|
||||
gdk_surface_set_startup_id
|
||||
gdk_surface_set_group
|
||||
gdk_surface_get_group
|
||||
@@ -377,6 +373,7 @@ gdk_content_formats_builder_to_formats
|
||||
GDK_TYPE_FILE_LIST
|
||||
gdk_file_list_get_type
|
||||
gdk_content_formats_get_type
|
||||
gdk_content_formats_builder_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
@@ -442,6 +439,7 @@ gdk_keymap_get_modifier_state
|
||||
gdk_keymap_add_virtual_modifiers
|
||||
gdk_keymap_map_virtual_modifiers
|
||||
gdk_keymap_get_modifier_mask
|
||||
gdk_keymap_get_display
|
||||
|
||||
<SUBSECTION>
|
||||
gdk_keyval_name
|
||||
@@ -502,7 +500,6 @@ gdk_device_get_has_cursor
|
||||
gdk_device_get_n_axes
|
||||
gdk_device_get_n_keys
|
||||
gdk_device_get_axes
|
||||
gdk_device_warp
|
||||
gdk_device_get_seat
|
||||
|
||||
<SUBSECTION>
|
||||
@@ -512,9 +509,7 @@ gdk_device_ungrab
|
||||
<SUBSECTION>
|
||||
gdk_device_get_state
|
||||
gdk_device_get_position
|
||||
gdk_device_get_position_double
|
||||
gdk_device_get_surface_at_position
|
||||
gdk_device_get_surface_at_position_double
|
||||
gdk_device_get_history
|
||||
gdk_device_free_history
|
||||
GdkTimeCoord
|
||||
@@ -622,6 +617,7 @@ GDK_BUTTON_SECONDARY
|
||||
gdk_event_new
|
||||
gdk_event_copy
|
||||
gdk_event_get_axes
|
||||
gdk_event_get_axis
|
||||
gdk_event_get_button
|
||||
gdk_event_get_click_count
|
||||
gdk_event_get_coords
|
||||
@@ -662,9 +658,6 @@ gdk_event_get_touchpad_gesture_n_fingers
|
||||
gdk_event_get_touchpad_gesture_phase
|
||||
gdk_event_get_touchpad_scale
|
||||
gdk_event_is_sent
|
||||
<SUBSECTION>
|
||||
gdk_event_handler_set
|
||||
GdkEventFunc
|
||||
|
||||
<SUBSECTION>
|
||||
gdk_get_show_events
|
||||
@@ -687,6 +680,7 @@ GDK_TYPE_SCROLL_DIRECTION
|
||||
GDK_TYPE_NOTIFY_TYPE
|
||||
GDK_IS_EVENT
|
||||
gdk_event_get_type
|
||||
gdk_event_sequence_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
@@ -782,7 +776,6 @@ GDK_ACTION_ALL
|
||||
|
||||
gdk_drag_get_display
|
||||
gdk_drag_get_actions
|
||||
gdk_drag_get_suggested_action
|
||||
gdk_drag_get_selected_action
|
||||
gdk_drag_get_formats
|
||||
gdk_drag_get_device
|
||||
|
||||
@@ -15,7 +15,9 @@ private_headers = [
|
||||
'gdkdisplaymanagerprivate.h',
|
||||
'gdkdisplayprivate.h',
|
||||
'gdkdndprivate.h',
|
||||
'gdkdragprivate.h',
|
||||
'gdkdrawcontextprivate.h',
|
||||
'gdkdropprivate.h',
|
||||
'gdkeventsprivate.h',
|
||||
'gdkframeclockidleprivate.h',
|
||||
'gdkframeclockprivate.h',
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
<title>API Reference</title>
|
||||
<xi:include href="xml/GskRenderer.xml" />
|
||||
<xi:include href="xml/GskRenderNode.xml" />
|
||||
<xi:include href="xml/GskRoundedRect.xml" />
|
||||
<xi:include href="xml/GskTransform.xml" />
|
||||
</reference>
|
||||
|
||||
<index id="api-index-full">
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
<FILE>GskRenderer</FILE>
|
||||
gsk_renderer_new_for_surface
|
||||
gsk_renderer_get_surface
|
||||
gsk_renderer_get_display
|
||||
gsk_renderer_realize
|
||||
gsk_renderer_unrealize
|
||||
gsk_renderer_is_realized
|
||||
gsk_renderer_render
|
||||
gsk_renderer_render_texture
|
||||
<SUBSECTION Standard>
|
||||
@@ -67,11 +67,7 @@ gsk_container_node_get_n_children
|
||||
gsk_container_node_get_child
|
||||
gsk_transform_node_new
|
||||
gsk_transform_node_get_child
|
||||
gsk_transform_node_peek_transform
|
||||
gsk_offset_node_new
|
||||
gsk_offset_node_get_child
|
||||
gsk_offset_node_get_x_offset
|
||||
gsk_offset_node_get_y_offset
|
||||
gsk_transform_node_get_transform
|
||||
gsk_opacity_node_new
|
||||
gsk_opacity_node_get_child
|
||||
gsk_opacity_node_get_opacity
|
||||
@@ -144,3 +140,40 @@ gsk_rounded_rect_contains_point
|
||||
gsk_rounded_rect_contains_rect
|
||||
gsk_rounded_rect_intersects_rect
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>GskTransform</FILE>
|
||||
GskTransform
|
||||
gsk_transform_ref
|
||||
gsk_transform_unref
|
||||
<SUBSECTION>
|
||||
GskTransformCategory
|
||||
gsk_transform_get_category
|
||||
<SUBSECTION>
|
||||
gsk_transform_print
|
||||
gsk_transform_to_string
|
||||
gsk_transform_to_matrix
|
||||
gsk_transform_to_2d
|
||||
gsk_transform_to_affine
|
||||
gsk_transform_to_translate
|
||||
<SUBSECTION>
|
||||
gsk_transform_transform
|
||||
gsk_transform_invert
|
||||
gsk_transform_matrix
|
||||
gsk_transform_translate
|
||||
gsk_transform_translate_3d
|
||||
gsk_transform_rotate
|
||||
gsk_transform_rotate_3d
|
||||
gsk_transform_scale
|
||||
gsk_transform_scale_3d
|
||||
gsk_transform_perspective
|
||||
<SUBSECTION>
|
||||
gsk_transform_equal
|
||||
<SUBSECTION>
|
||||
gsk_transform_transform_bounds
|
||||
<SUBSECTION Private>
|
||||
GSK_TYPE_TRANSFORM
|
||||
gsk_transform_get_type
|
||||
gsk_transform_new
|
||||
</SECTION>
|
||||
|
||||
|
||||
@@ -546,7 +546,7 @@ checkbutton:indeterminate {
|
||||
GTK adds several additional ways to specify colors.
|
||||
</para>
|
||||
|
||||
<literallayout><code>〈gtk color〉 = 〈symbolic color〉 | 〈color expression〉 | 〈win32 color〉</code>
|
||||
<literallayout><code>〈gtk color〉 = 〈symbolic color〉 | 〈color expression〉</code>
|
||||
</literallayout>
|
||||
|
||||
<para>
|
||||
@@ -592,13 +592,6 @@ checkbutton:indeterminate {
|
||||
|
||||
<literallayout><code>〈color expression〉 = lighter( 〈color〉 ) | darker( 〈color〉 ) | shade( 〈color〉, 〈number〉 ) |</code>
|
||||
<code> alpha( 〈color〉, 〈number〉 ) | mix( 〈color〉, 〈color〉, 〈number〉 )</code>
|
||||
</literallayout>
|
||||
|
||||
<para>
|
||||
On Windows, GTK allows to refer to system colors, as follows:
|
||||
</para>
|
||||
|
||||
<literallayout><code>〈win32 color〉 = -gtk-win32-color( 〈name〉, 〈integer〉 )</code>
|
||||
</literallayout>
|
||||
|
||||
</refsect2>
|
||||
@@ -737,7 +730,7 @@ label {
|
||||
GTK extends the CSS syntax for images and also uses it for specifying icons.
|
||||
</para>
|
||||
|
||||
<literallayout><code>〈gtk image〉 = 〈themed icon〉 | 〈scaled image〉 | 〈recolored image〉 | 〈win32 theme part〉</code>
|
||||
<literallayout><code>〈gtk image〉 = 〈themed icon〉 | 〈scaled image〉 | 〈recolored image〉</code>
|
||||
</literallayout>
|
||||
|
||||
<para>
|
||||
@@ -815,13 +808,6 @@ arrow {
|
||||
}
|
||||
]]></programlisting>
|
||||
</example>
|
||||
<para>
|
||||
On Windows, GTK allows to refer to system theme parts as images, as follows:
|
||||
</para>
|
||||
|
||||
<literallayout><code>〈win32 theme part〉 = -gtk-win32-theme-part( 〈name〉, 〈integer〉 〈integer〉</code>
|
||||
<code> [ , [ over( 〈integer〉 〈integer〉 [ , 〈alpha value〉 ]? ) | margins( 〈integer〉{1,4} ) ] ]* )</code>
|
||||
</literallayout>
|
||||
|
||||
</refsect2>
|
||||
|
||||
|
||||
@@ -65,20 +65,6 @@ We use <literallayout> for syntax productions, and each line is put in a <code>
|
||||
not quite the same as the CSS definition of rem.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Whereever a number is allowed, GTK also accepts a Windows-specific
|
||||
theme size:
|
||||
</para>
|
||||
|
||||
<literallayout>
|
||||
<code>〈win32 theme size〉 = 〈win32 size〉 | 〈win32 part size〉</code>
|
||||
<code>〈win32 size〉 = -gtk-win32-size ( 〈theme name〉, 〈metric id〉 )</code>
|
||||
<code>〈win32 part size〉 = [ -gtk-win32-part-width | -gtk-win32-part-height |</code>
|
||||
<code> -gtk-win32-part-border-top | -gtk-win32-part-border-right |</code>
|
||||
<code> -gtk-win32-part-border-bottom | -gtk-win32-part-border-left ]</code>
|
||||
<code> ( 〈theme name〉 , 〈integer〉 , 〈integer〉 )</code>
|
||||
</literallayout>
|
||||
|
||||
<literallayout><code>〈calc expression〉 = calc( 〈calc sum〉 )</code>
|
||||
<code>〈calc sum〉 = 〈calc product〉 [ [ + | - ] 〈calc product〉 ]*</code>
|
||||
<code>〈calc product〉 = 〈calc value〉 [ * 〈calc value〉 | / 〈number〉 ]*</code>
|
||||
|
||||
@@ -26,72 +26,53 @@
|
||||
widgets and windows, you should read this chapter; this will be
|
||||
useful to know if you decide to implement your own widgets. This
|
||||
chapter will also clarify the reasons behind the ways certain
|
||||
things are done in GTK; for example, why you cannot change the
|
||||
background color of all widgets with the same method.
|
||||
things are done in GTK.
|
||||
</para>
|
||||
|
||||
<refsect2 id="drawing model windows">
|
||||
|
||||
<title>Windows and events</title>
|
||||
|
||||
<para>
|
||||
Programs that run in a windowing system generally create
|
||||
rectangular regions in the screen called
|
||||
<firstterm>windows</firstterm>. Traditional windowing systems
|
||||
do not automatically save the graphical content of windows, and
|
||||
instead ask client programs to repaint those windows whenever it
|
||||
is needed. For example, if a window that is stacked below other
|
||||
windows gets raised to the top, then a client program has to
|
||||
repaint the area that was previously obscured. When the
|
||||
windowing system asks a client program to redraw part of a
|
||||
window, it sends an <firstterm>exposure event</firstterm> to the
|
||||
program for that window.
|
||||
Applications that use a windowing system generally create
|
||||
rectangular regions in the screen called <firstterm>surfaces</firstterm>
|
||||
(GTK is following the Wayland terminology, other windowing systems
|
||||
such as X11 may call these <firstterm>windows</firstterm>).
|
||||
Traditional windowing systems do not automatically save the
|
||||
graphical content of surfaces, and instead ask applications to
|
||||
provide new content whenever it is needed.
|
||||
For example, if a window that is stacked below other
|
||||
windows gets raised to the top, then the application has to
|
||||
repaint it, so the previously obscured area can be shown.
|
||||
When the windowing system asks an application to redraw
|
||||
a window, it sends a <firstterm>frame event</firstterm>
|
||||
(<firstterm>expose event</firstterm> in X11 terminology)
|
||||
for that window.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Each GTK toplevel window or dialog is associated with a
|
||||
windowing system surface. Child widgets such as buttons or
|
||||
entries don't have their own surface; they use the surface
|
||||
of their toplevel.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Here, "windows" means "rectangular regions with automatic
|
||||
clipping", instead of "toplevel application windows". Most
|
||||
windowing systems support nested windows, where the contents of
|
||||
child windows get clipped by the boundaries of their parents.
|
||||
Although GTK and GDK in particular may run on a windowing
|
||||
system with no such notion of nested windows, GDK presents the
|
||||
illusion of being under such a system. A toplevel window may
|
||||
contain many subwindows and sub-subwindows, for example, one for
|
||||
the menu bar, one for the document area, one for each scrollbar,
|
||||
and one for the status bar. In addition, controls that receive
|
||||
user input, such as clickable buttons, are likely to have their
|
||||
own subwindows as well.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
In practice, most windows in modern GTK application are client-side
|
||||
constructs. Only few windows (in particular toplevel windows) are
|
||||
<emphasis>native</emphasis>, which means that they represent a
|
||||
window from the underlying windowing system on which GTK is running.
|
||||
For example, on X11 it corresponds to a <type>Window</type>; on Win32,
|
||||
it corresponds to a <type>HANDLE</type>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Generally, the drawing cycle begins when GTK receives an
|
||||
exposure event from the underlying windowing system: if the
|
||||
Generally, the drawing cycle begins when GTK receives
|
||||
a frame event from the underlying windowing system: if the
|
||||
user drags a window over another one, the windowing system will
|
||||
tell the underlying window that it needs to repaint itself. The
|
||||
tell the underlying surface that it needs to repaint itself. The
|
||||
drawing cycle can also be initiated when a widget itself decides
|
||||
that it needs to update its display. For example, when the user
|
||||
types a character in a <link
|
||||
linkend="GtkEntry"><classname>GtkEntry</classname></link>
|
||||
widget, the entry asks GTK to queue a redraw operation for
|
||||
itself.
|
||||
types a character in an entry widget, the entry asks GTK to queue
|
||||
a redraw operation for itself.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The windowing system generates events for native windows. The GDK
|
||||
interface to the windowing system translates such native events into
|
||||
<link linkend="GdkEvent"><structname>GdkEvent</structname></link>
|
||||
structures and sends them on to the GTK layer. In turn, the GTK layer
|
||||
finds the widget that corresponds to a particular
|
||||
<classname>GdkSurface</classname> and emits the corresponding event
|
||||
signals on that widget.
|
||||
The windowing system generates frame events for surfaces. The GDK
|
||||
interface to the windowing system translates such events into
|
||||
emissions of the ::render signal on the affected surfaces.
|
||||
The GTK toplevel window connects to that signal, and reacts appropriately.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
@@ -112,8 +93,13 @@
|
||||
it does. On top of this GTK has a frame clock that gives a
|
||||
“pulse” to the application. This clock beats at a steady rate,
|
||||
which is tied to the framerate of the output (this is synced to
|
||||
the monitor via the window manager/compositor). The clock has
|
||||
several phases:
|
||||
the monitor via the window manager/compositor). A typical
|
||||
refresh rate is 60 frames per second, so a new “pulse” happens
|
||||
roughly every 16 milliseconds.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The clock has several phases:
|
||||
<itemizedlist>
|
||||
<listitem><para>Events</para></listitem>
|
||||
<listitem><para>Update</para></listitem>
|
||||
@@ -125,24 +111,24 @@
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The Events phase is a long stretch of time between each
|
||||
redraw where we get input events from the user and other events
|
||||
The Events phase is a stretch of time between each redraw where
|
||||
GTK processes input events from the user and other events
|
||||
(like e.g. network I/O). Some events, like mouse motion are
|
||||
compressed so that we only get a single mouse motion event per
|
||||
clock cycle.
|
||||
compressed so that only a single mouse motion event per clock
|
||||
cycle needs to be handled.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Once the Events phase is over we pause all external events and
|
||||
run the redraw loop. First is the Update phase, where all
|
||||
Once the Events phase is over, external events are paused and
|
||||
the redraw loop is run. First is the Update phase, where all
|
||||
animations are run to calculate the new state based on the
|
||||
estimated time the next frame will be visible (available via
|
||||
the frame clock). This often involves geometry changes which
|
||||
drives the next phase, Layout. If there are any changes in
|
||||
widget size requirements we calculate a new layout for the
|
||||
widget hierarchy (i.e. we assign sizes and positions). Then
|
||||
we go to the Paint phase where we redraw the regions of the
|
||||
window that need redrawing.
|
||||
drive the next phase, Layout. If there are any changes in
|
||||
widget size requirements the new layout is calculated for the
|
||||
widget hierarchy (i.e. sizes and positions for all widgets are
|
||||
determined). Then comes the Paint phase, where we redraw the
|
||||
regions of the window that need redrawing.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
@@ -184,162 +170,57 @@
|
||||
</para>
|
||||
</refsect2>
|
||||
|
||||
<refsect2 id="scene-graph">
|
||||
<title>The scene graph</title>
|
||||
|
||||
<para>
|
||||
The first step in “drawing” a window is that GTK creates
|
||||
<firstterm>render nodes</firstterm> for all the widgets
|
||||
in the window. The render nodes are combined into a tree
|
||||
that you can think of as a <firstterm>scene graph</firstterm>
|
||||
describing your window contents.
|
||||
</para>
|
||||
<para>
|
||||
Render nodes belong to the GSK layer, and there are various kinds
|
||||
of them, for the various kinds of drawing primitives you are likely
|
||||
to need when translating widget content and CSS styling. Typical
|
||||
examples are text nodes, gradient nodes, texture nodes or clip nodes.
|
||||
<para>
|
||||
<para>
|
||||
In the past, all drawing in GTK happened via cairo. It is still possible
|
||||
to use cairo for drawing your custom widget contents, by using a cairo
|
||||
render node.
|
||||
</para>
|
||||
</para>
|
||||
A GSK <firstterm>renderer</firstterm> takes these render nodes, transforms
|
||||
them into rendering commands for the drawing API it targets, and arranges
|
||||
for the resulting drawing to be associated with the right surface. GSK has
|
||||
renderers for OpenGL, Vulkan and cairo.
|
||||
</para>
|
||||
</refsect2>
|
||||
|
||||
<refsect2 id="hierarchical-drawing">
|
||||
<title>Hierarchical drawing</title>
|
||||
|
||||
<para>
|
||||
During the Paint phase we will send a single expose event to
|
||||
the toplevel window. The event handler will create a cairo
|
||||
context for the window and emit a GtkWidget::draw() signal
|
||||
on it, which will propagate down the entire widget hierarchy
|
||||
in back-to-front order, using the clipping and transform of
|
||||
the cairo context. This lets each widget draw its content at
|
||||
the right place and time, correctly handling things like
|
||||
partial transparencies and overlapping widgets.
|
||||
During the Paint phase GTK receives a single ::render signal on the toplevel
|
||||
window. The signal handler will create a snapshot object (which is a
|
||||
helper for creating a scene graph) and emit a GtkWidget::snapshot() signal,
|
||||
which will propagate down the widget hierarchy. This lets each widget
|
||||
snapshot its content at the right place and time, correctly handling things
|
||||
like partial transparencies and overlapping widgets.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
When generating the event, GDK also sets up double buffering to
|
||||
avoid the flickering that would result from each widget drawing
|
||||
itself in turn. <xref linkend="double-buffering"/> describes
|
||||
the double buffering mechanism in detail.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Normally, there is only a single cairo context which is used in
|
||||
the entire repaint, rather than one per GdkSurface. This means you
|
||||
have to respect (and not reset) existing clip and transformations
|
||||
set on it.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Most widgets, including those that create their own GdkSurfaces have
|
||||
a transparent background, so they draw on top of whatever widgets
|
||||
are below them. This was not the case in GTK 2 where the theme set
|
||||
the background of most widgets to the default background color. (In
|
||||
fact, transparent GdkSurfaces used to be impossible.)
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The whole rendering hierarchy is captured in the call stack, rather
|
||||
than having multiple separate draw emissions, so you can use effects
|
||||
like e.g. cairo_push/pop_group() which will affect all the widgets
|
||||
below you in the hierarchy. This makes it possible to have e.g.
|
||||
partially transparent containers.
|
||||
To avoid excessive work when generating scene graphs, GTK caches render nodes.
|
||||
Each widget keeps a reference to its render node (which in turn, will refer to
|
||||
the render nodes of children, and grandchildren, and so on), and will reuse
|
||||
that node during the Paint phase. Invalidating a widget (by calling
|
||||
gtk_widget_queue_draw()) discards the cached render node, forcing the widget
|
||||
to regenerate it the next time it needs to handle a ::snapshot.
|
||||
</para>
|
||||
</refsect2>
|
||||
|
||||
<refsect2 id="scrolling drawing model">
|
||||
<title>Scrolling</title>
|
||||
|
||||
<para>
|
||||
Traditionally, GTK has used self-copy operations to implement
|
||||
scrolling with native windows. With transparent backgrounds, this
|
||||
no longer works. Instead, we just mark the entire affected area for
|
||||
repainting when these operations are used. This allows (partially)
|
||||
transparent backgrounds, and it also more closely models modern
|
||||
hardware where self-copy operations are problematic (they break the
|
||||
rendering pipeline).
|
||||
</para>
|
||||
</refsect2>
|
||||
|
||||
</refsect1>
|
||||
|
||||
<refsect1 id="double-buffering">
|
||||
<title>Double buffering</title>
|
||||
|
||||
<para>
|
||||
If each of the drawing calls made by each subwidget's
|
||||
<literal>draw</literal> handler were sent directly to the
|
||||
windowing system, flicker could result. This is because areas may get
|
||||
redrawn repeatedly: the background, then decorative frames, then text
|
||||
labels, etc. To avoid flicker, GTK employs a <firstterm>double
|
||||
buffering</firstterm> system at the GDK level. Widgets normally don't
|
||||
know that they are drawing to an off-screen buffer; they just issue their
|
||||
normal drawing commands, and the buffer gets sent to the windowing system
|
||||
when all drawing operations are done.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Two basic functions in GDK form the core of the double-buffering
|
||||
mechanism: <link
|
||||
linkend="gdk_surface_begin_paint_region"><function>gdk_surface_begin_paint_region()</function></link>
|
||||
and <link
|
||||
linkend="gdk_surface_end_paint"><function>gdk_surface_end_paint()</function></link>.
|
||||
The first function tells a <classname>GdkSurface</classname> to
|
||||
create a temporary off-screen buffer for drawing. All
|
||||
subsequent drawing operations to this window get automatically
|
||||
redirected to that buffer. The second function actually paints
|
||||
the buffer onto the on-screen window, and frees the buffer.
|
||||
</para>
|
||||
|
||||
<refsect2 id="automatic-double-buffering">
|
||||
<title>Automatic double buffering</title>
|
||||
|
||||
<para>
|
||||
It would be inconvenient for all widgets to call
|
||||
<function>gdk_surface_begin_paint_region()</function> and
|
||||
<function>gdk_surface_end_paint()</function> at the beginning
|
||||
and end of their draw handlers.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
To make this easier, GTK normally calls
|
||||
<function>gdk_surface_begin_paint_region()</function>
|
||||
before emitting the #GtkWidget::draw signal, and
|
||||
then it calls <function>gdk_surface_end_paint()</function>
|
||||
after the signal has been emitted. This is convenient for
|
||||
most widgets, as they do not need to worry about creating
|
||||
their own temporary drawing buffers or about calling those
|
||||
functions.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
However, some widgets may prefer to disable this kind of
|
||||
automatic double buffering and do things on their own.
|
||||
To do this, call the
|
||||
<function>gtk_widget_set_double_buffered()</function>
|
||||
function in your widget's constructor. Double buffering
|
||||
can only be turned off for widgets that have a native
|
||||
window.
|
||||
</para>
|
||||
|
||||
<example id="disabling-double-buffering">
|
||||
<title>Disabling automatic double buffering</title>
|
||||
|
||||
<programlisting>
|
||||
static void
|
||||
my_widget_init (MyWidget *widget)
|
||||
{
|
||||
...
|
||||
|
||||
gtk_widget_set_double_buffered (widget, FALSE);
|
||||
|
||||
...
|
||||
}
|
||||
</programlisting>
|
||||
</example>
|
||||
|
||||
<para>
|
||||
When is it convenient to disable double buffering? Generally,
|
||||
this is the case only if your widget gets drawn in such a way
|
||||
that the different drawing operations do not overlap each
|
||||
other. For example, this may be the case for a simple image
|
||||
viewer: it can just draw the image in a single operation.
|
||||
This would <emphasis>not</emphasis> be the case with a word
|
||||
processor, since it will need to draw and over-draw the page's
|
||||
background, then the background for highlighted text, and then
|
||||
the text itself.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Even if you turn off double buffering on a widget, you
|
||||
can still call
|
||||
<function>gdk_surface_begin_paint_region()</function> and
|
||||
<function>gdk_surface_end_paint()</function> by hand to use
|
||||
temporary drawing buffers.
|
||||
</para>
|
||||
</refsect2>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
@@ -827,7 +827,7 @@ search_text_changed (GtkEntry *entry,
|
||||
GtkTextBuffer *buffer;
|
||||
GtkTextIter start, match_start, match_end;
|
||||
|
||||
text = gtk_entry_get_text (entry);
|
||||
text = gtk_editable_get_text (GTK_EDITABLE (entry));
|
||||
|
||||
if (text[0] == '\0')
|
||||
return;
|
||||
|
||||
@@ -68,6 +68,7 @@
|
||||
|
||||
<chapter id="WindowWidgets">
|
||||
<title>Windows</title>
|
||||
<xi:include href="xml/gtkroot.xml" />
|
||||
<xi:include href="xml/gtkwindow.xml" />
|
||||
<xi:include href="xml/gtkdialog.xml" />
|
||||
<xi:include href="xml/gtkmessagedialog.xml" />
|
||||
@@ -99,6 +100,13 @@
|
||||
<xi:include href="xml/gtkfixed.xml" />
|
||||
</chapter>
|
||||
|
||||
<chapter id="LayoutManagers">
|
||||
<title>Layout Managers</title>
|
||||
<xi:include href="xml/gtklayoutmanager.xml" />
|
||||
<xi:include href="xml/gtklayoutchild.xml" />
|
||||
<xi:include href="xml/gtkboxlayout.xml" />
|
||||
</chapter>
|
||||
|
||||
<chapter id="DisplayWidgets">
|
||||
<title>Display Widgets</title>
|
||||
<xi:include href="xml/gtklabel.xml" />
|
||||
@@ -344,7 +352,6 @@
|
||||
<xi:include href="xml/gtkselection.xml" />
|
||||
<xi:include href="xml/gtktesting.xml" />
|
||||
<xi:include href="xml/filesystem.xml" />
|
||||
<xi:include href="xml/gtktransform.xml" />
|
||||
</part>
|
||||
|
||||
<part id="theming">
|
||||
|
||||
@@ -424,6 +424,7 @@ gtk_selection_model_select_range
|
||||
gtk_selection_model_unselect_range
|
||||
gtk_selection_model_select_all
|
||||
gtk_selection_model_unselect_all
|
||||
gtk_selection_model_query_range
|
||||
<SUBSECTION>
|
||||
gtk_selection_model_selection_changed
|
||||
<SUBSECTION Standard>
|
||||
@@ -675,12 +676,6 @@ gtk_combo_box_new
|
||||
gtk_combo_box_new_with_entry
|
||||
gtk_combo_box_new_with_model
|
||||
gtk_combo_box_new_with_model_and_entry
|
||||
gtk_combo_box_get_wrap_width
|
||||
gtk_combo_box_set_wrap_width
|
||||
gtk_combo_box_get_row_span_column
|
||||
gtk_combo_box_set_row_span_column
|
||||
gtk_combo_box_get_column_span_column
|
||||
gtk_combo_box_set_column_span_column
|
||||
gtk_combo_box_get_active
|
||||
gtk_combo_box_set_active
|
||||
gtk_combo_box_get_active_iter
|
||||
@@ -695,6 +690,7 @@ gtk_combo_box_popdown
|
||||
gtk_combo_box_get_popup_accessible
|
||||
gtk_combo_box_get_row_separator_func
|
||||
gtk_combo_box_set_row_separator_func
|
||||
GtkSensitivityType
|
||||
gtk_combo_box_set_button_sensitivity
|
||||
gtk_combo_box_get_button_sensitivity
|
||||
gtk_combo_box_get_has_entry
|
||||
@@ -923,8 +919,6 @@ gtk_entry_new
|
||||
gtk_entry_new_with_buffer
|
||||
gtk_entry_get_buffer
|
||||
gtk_entry_set_buffer
|
||||
gtk_entry_set_text
|
||||
gtk_entry_get_text
|
||||
gtk_entry_get_text_length
|
||||
gtk_entry_set_visibility
|
||||
gtk_entry_get_visibility
|
||||
@@ -937,10 +931,6 @@ gtk_entry_set_activates_default
|
||||
gtk_entry_get_activates_default
|
||||
gtk_entry_set_has_frame
|
||||
gtk_entry_get_has_frame
|
||||
gtk_entry_set_width_chars
|
||||
gtk_entry_get_width_chars
|
||||
gtk_entry_set_max_width_chars
|
||||
gtk_entry_get_max_width_chars
|
||||
gtk_entry_set_alignment
|
||||
gtk_entry_get_alignment
|
||||
gtk_entry_set_placeholder_text
|
||||
@@ -1006,6 +996,8 @@ gtk_entry_get_type
|
||||
<TITLE>GtkPasswordEntry</TITLE>
|
||||
GtkPasswordEntry
|
||||
gtk_password_entry_new
|
||||
gtk_password_entry_set_show_peek_icon
|
||||
gtk_password_entry_get_show_peek_icon
|
||||
<SUBSECTION Private>
|
||||
gtk_password_entry_get_type
|
||||
</SECTION>
|
||||
@@ -1306,6 +1298,8 @@ gtk_file_filter_get_type
|
||||
<TITLE>GtkFilterListModel</TITLE>
|
||||
GtkFilterListModel
|
||||
gtk_filter_list_model_new
|
||||
gtk_filter_list_model_new_for_type
|
||||
gtk_filter_list_model_set_model
|
||||
gtk_filter_list_model_get_model
|
||||
gtk_filter_list_model_set_filter_func
|
||||
gtk_filter_list_model_has_filter
|
||||
@@ -1395,6 +1389,7 @@ gtk_font_chooser_set_font
|
||||
gtk_font_chooser_get_font_desc
|
||||
gtk_font_chooser_set_font_desc
|
||||
gtk_font_chooser_get_font_features
|
||||
gtk_font_chooser_get_language
|
||||
gtk_font_chooser_set_language
|
||||
gtk_font_chooser_get_preview_text
|
||||
gtk_font_chooser_set_preview_text
|
||||
@@ -1819,7 +1814,6 @@ gtk_menu_new
|
||||
gtk_menu_new_from_model
|
||||
gtk_menu_set_display
|
||||
gtk_menu_reorder_child
|
||||
gtk_menu_attach
|
||||
gtk_menu_popup_at_rect
|
||||
gtk_menu_popup_at_widget
|
||||
gtk_menu_popup_at_pointer
|
||||
@@ -1841,7 +1835,6 @@ gtk_menu_attach_to_widget
|
||||
gtk_menu_detach
|
||||
gtk_menu_get_attach_widget
|
||||
gtk_menu_get_for_attach_widget
|
||||
GtkMenuPositionFunc
|
||||
GtkMenuDetachFunc
|
||||
<SUBSECTION Standard>
|
||||
GTK_MENU
|
||||
@@ -2281,11 +2274,6 @@ gtk_range_set_increments
|
||||
gtk_range_set_range
|
||||
gtk_range_get_round_digits
|
||||
gtk_range_set_round_digits
|
||||
GtkSensitivityType
|
||||
gtk_range_set_lower_stepper_sensitivity
|
||||
gtk_range_get_lower_stepper_sensitivity
|
||||
gtk_range_set_upper_stepper_sensitivity
|
||||
gtk_range_get_upper_stepper_sensitivity
|
||||
gtk_range_get_flippable
|
||||
gtk_range_set_flippable
|
||||
gtk_range_get_range_rect
|
||||
@@ -2718,12 +2706,6 @@ gtk_spin_button_get_snap_to_ticks
|
||||
gtk_spin_button_get_update_policy
|
||||
gtk_spin_button_get_value
|
||||
gtk_spin_button_get_wrap
|
||||
gtk_spin_button_set_text
|
||||
gtk_spin_button_get_text
|
||||
gtk_spin_button_set_max_width_chars
|
||||
gtk_spin_button_get_max_width_chars
|
||||
gtk_spin_button_set_width_chars
|
||||
gtk_spin_button_get_width_chars
|
||||
GTK_INPUT_ERROR
|
||||
<SUBSECTION Standard>
|
||||
GTK_SPIN_BUTTON
|
||||
@@ -4400,6 +4382,9 @@ gtk_snapshot_push_clip
|
||||
gtk_snapshot_push_rounded_clip
|
||||
gtk_snapshot_push_cross_fade
|
||||
gtk_snapshot_push_blend
|
||||
gtk_snapshot_push_blur
|
||||
gtk_snapshot_push_shadow
|
||||
gtk_snapshot_push_debug
|
||||
gtk_snapshot_pop
|
||||
gtk_snapshot_save
|
||||
gtk_snapshot_restore
|
||||
@@ -4411,6 +4396,7 @@ gtk_snapshot_rotate
|
||||
gtk_snapshot_rotate_3d
|
||||
gtk_snapshot_scale
|
||||
gtk_snapshot_scale_3d
|
||||
gtk_snapshot_perspective
|
||||
gtk_snapshot_append_node
|
||||
gtk_snapshot_append_cairo
|
||||
gtk_snapshot_append_texture
|
||||
@@ -4426,6 +4412,8 @@ gtk_snapshot_render_frame
|
||||
gtk_snapshot_render_focus
|
||||
gtk_snapshot_render_layout
|
||||
gtk_snapshot_render_insertion_cursor
|
||||
<SUBSECTION Private>
|
||||
gtk_snapshot_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
@@ -4493,6 +4481,7 @@ gtk_widget_set_parent
|
||||
gtk_widget_set_parent_surface
|
||||
gtk_widget_get_parent_surface
|
||||
gtk_widget_get_toplevel
|
||||
gtk_widget_get_root
|
||||
gtk_widget_get_ancestor
|
||||
gtk_widget_is_ancestor
|
||||
gtk_widget_translate_coordinates
|
||||
@@ -4515,7 +4504,6 @@ gtk_widget_get_cursor
|
||||
gtk_widget_set_cursor
|
||||
gtk_widget_set_cursor_from_name
|
||||
gtk_widget_mnemonic_activate
|
||||
gtk_widget_send_focus_change
|
||||
gtk_widget_class_set_accessible_type
|
||||
gtk_widget_class_set_accessible_role
|
||||
gtk_widget_get_accessible
|
||||
@@ -4553,7 +4541,6 @@ gtk_widget_get_allocated_width
|
||||
gtk_widget_get_allocated_height
|
||||
gtk_widget_get_allocation
|
||||
gtk_widget_get_allocated_baseline
|
||||
gtk_widget_get_allocated_size
|
||||
gtk_widget_get_width
|
||||
gtk_widget_get_height
|
||||
gtk_widget_compute_bounds
|
||||
@@ -4610,6 +4597,8 @@ gtk_widget_get_first_child
|
||||
gtk_widget_get_last_child
|
||||
gtk_widget_insert_before
|
||||
gtk_widget_insert_after
|
||||
gtk_widget_set_layout_manager
|
||||
gtk_widget_get_layout_manager
|
||||
|
||||
<SUBSECTION>
|
||||
gtk_widget_get_path
|
||||
@@ -4706,8 +4695,6 @@ gtk_window_activate_focus
|
||||
gtk_window_activate_default
|
||||
gtk_window_set_modal
|
||||
gtk_window_set_default_size
|
||||
gtk_window_set_gravity
|
||||
gtk_window_get_gravity
|
||||
gtk_window_set_hide_on_close
|
||||
gtk_window_get_hide_on_close
|
||||
GtkWindowPosition
|
||||
@@ -4755,20 +4742,14 @@ gtk_window_set_urgency_hint
|
||||
gtk_window_set_accept_focus
|
||||
gtk_window_set_focus_on_map
|
||||
gtk_window_set_startup_id
|
||||
gtk_window_set_role
|
||||
gtk_window_get_decorated
|
||||
gtk_window_get_deletable
|
||||
gtk_window_get_default_icon_list
|
||||
gtk_window_get_default_icon_name
|
||||
gtk_window_get_default_size
|
||||
gtk_window_get_destroy_with_parent
|
||||
gtk_window_get_icon
|
||||
gtk_window_get_icon_list
|
||||
gtk_window_get_icon_name
|
||||
gtk_window_get_mnemonic_modifier
|
||||
gtk_window_get_modal
|
||||
gtk_window_get_position
|
||||
gtk_window_get_role
|
||||
gtk_window_get_size
|
||||
gtk_window_get_title
|
||||
gtk_window_get_transient_for
|
||||
@@ -4782,15 +4763,8 @@ gtk_window_get_focus_on_map
|
||||
gtk_window_get_group
|
||||
gtk_window_has_group
|
||||
gtk_window_get_window_type
|
||||
gtk_window_move
|
||||
gtk_window_resize
|
||||
gtk_window_set_default_icon_list
|
||||
gtk_window_set_default_icon
|
||||
gtk_window_set_default_icon_from_file
|
||||
gtk_window_set_default_icon_name
|
||||
gtk_window_set_icon
|
||||
gtk_window_set_icon_list
|
||||
gtk_window_set_icon_from_file
|
||||
gtk_window_set_icon_name
|
||||
gtk_window_set_auto_startup_notification
|
||||
gtk_window_get_mnemonics_visible
|
||||
@@ -5899,38 +5873,6 @@ gtk_mount_operation_get_type
|
||||
GtkMountOperationPrivate
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtktransform</FILE>
|
||||
<TITLE>3D transformations</TITLE>
|
||||
GtkTransformType;
|
||||
GtkTransform;
|
||||
gtk_transform_ref
|
||||
gtk_transform_unref
|
||||
<SUBSECTION>
|
||||
gtk_transform_print
|
||||
gtk_transform_to_string
|
||||
gtk_transform_to_matrix
|
||||
<SUBSECTION>
|
||||
gtk_transform_identity
|
||||
gtk_transform_transform
|
||||
gtk_transform_matrix
|
||||
gtk_transform_translate
|
||||
gtk_transform_translate_3d
|
||||
gtk_transform_rotate
|
||||
gtk_transform_rotate_3d
|
||||
gtk_transform_scale
|
||||
gtk_transform_scale_3d
|
||||
<SUBSECTION>
|
||||
gtk_transform_equal
|
||||
<SUBSECTION>
|
||||
gtk_transform_get_transform_type
|
||||
gtk_transform_get_next
|
||||
<SUBSECTION Private>
|
||||
GTK_TYPE_TRANSFORM
|
||||
gdk_transform_get_type
|
||||
gtk_transform_new
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkorientable</FILE>
|
||||
<TITLE>Orientable</TITLE>
|
||||
@@ -6277,6 +6219,10 @@ gtk_color_chooser_get_use_alpha
|
||||
gtk_color_chooser_set_use_alpha
|
||||
gtk_color_chooser_add_palette
|
||||
|
||||
<SUBSECTION>
|
||||
gtk_hsv_to_rgb
|
||||
gtk_rgb_to_hsv
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_COLOR_CHOOSER
|
||||
GTK_COLOR_CHOOSER
|
||||
@@ -6394,6 +6340,7 @@ gtk_stack_add_named
|
||||
gtk_stack_add_titled
|
||||
gtk_stack_get_child_by_name
|
||||
gtk_stack_get_page
|
||||
gtk_stack_get_pages
|
||||
gtk_stack_page_get_child
|
||||
gtk_stack_set_visible_child
|
||||
gtk_stack_get_visible_child
|
||||
@@ -6424,6 +6371,7 @@ GTK_STACK_GET_CLASS
|
||||
|
||||
<SUBSECTION Private>
|
||||
gtk_stack_get_type
|
||||
gtk_stack_page_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
@@ -6585,6 +6533,7 @@ gtk_popover_get_type
|
||||
<TITLE>GtkPopoverMenu</TITLE>
|
||||
GtkPopoverMenu
|
||||
gtk_popover_menu_new
|
||||
gtk_popover_menu_add_submenu
|
||||
gtk_popover_menu_open_submenu
|
||||
|
||||
<SUBSECTION Standard>
|
||||
@@ -6703,8 +6652,8 @@ gtk_gesture_single_get_type
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkeventcontrollerlegacy</FILE>
|
||||
<TITLE>GtkEventControllerlegacy</TITLE>
|
||||
GtkEventControllerlegacy
|
||||
<TITLE>GtkEventControllerLegacy</TITLE>
|
||||
GtkEventControllerLegacy
|
||||
gtk_event_controller_legacy_new
|
||||
|
||||
<SUBSECTION Standard>
|
||||
@@ -6745,6 +6694,8 @@ gtk_event_controller_scroll_get_type
|
||||
<TITLE>GtkEventControllerMotion</TITLE>
|
||||
GtkEventControllerMotion
|
||||
gtk_event_controller_motion_new
|
||||
gtk_event_controller_motion_get_pointer_origin
|
||||
gtk_event_controller_motion_get_pointer_target
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_EVENT_CONTROLLER_MOTION
|
||||
@@ -6763,6 +6714,12 @@ gtk_event_controller_motion_get_type
|
||||
<TITLE>GtkEventControllerKey</TITLE>
|
||||
GtkEventControllerKey
|
||||
gtk_event_controller_key_new
|
||||
gtk_event_controller_key_set_im_context
|
||||
gtk_event_controller_key_get_im_context
|
||||
gtk_event_controller_key_forward
|
||||
gtk_event_controller_key_get_group
|
||||
gtk_event_controller_key_get_focus_origin
|
||||
gtk_event_controller_key_get_focus_target
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_EVENT_CONTROLLER_KEY
|
||||
@@ -7196,3 +7153,65 @@ gtk_media_stream_error_valist
|
||||
GTK_TYPE_MEDIA_STREAM
|
||||
gtk_media_stream_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkroot</FILE>
|
||||
<TITLE>GtkRoot</TITLE>
|
||||
GtkRoot
|
||||
gtk_root_get_for_surface
|
||||
gtk_root_get_focus
|
||||
gtk_root_set_focus
|
||||
|
||||
<SUBSECTION>
|
||||
gtk_root_install_properties
|
||||
|
||||
<SUBSECTION Private>
|
||||
gtk_root_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtklayoutmanager</FILE>
|
||||
GtkLayoutManager
|
||||
GtkLayoutManagerClass
|
||||
|
||||
gtk_layout_manager_measure
|
||||
gtk_layout_manager_allocate
|
||||
gtk_layout_manager_get_request_mode
|
||||
gtk_layout_manager_get_widget
|
||||
gtk_layout_manager_get_layout_child
|
||||
gtk_layout_manager_layout_changed
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_LAYOUT_MANAGER
|
||||
gtk_layout_manager_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtklayoutchild</FILE>
|
||||
GtkLayoutChild
|
||||
GtkLayoutChildClass
|
||||
|
||||
gtk_layout_child_get_layout_manager
|
||||
gtk_layout_child_get_child_widget
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_LAYOUT_CHILD
|
||||
gtk_layout_child_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkboxlayout</FILE>
|
||||
GtkBoxLayout
|
||||
|
||||
gtk_box_layout_new
|
||||
gtk_box_layout_set_homogeneous
|
||||
gtk_box_layout_get_homogeneous
|
||||
gtk_box_layout_set_spacing
|
||||
gtk_box_layout_get_spacing
|
||||
gtk_box_layout_set_baseline_position
|
||||
gtk_box_layout_get_baseline_position
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_BOX_LAYOUT
|
||||
gtk_box_layout_get_type
|
||||
</SECTION>
|
||||
|
||||
@@ -137,6 +137,7 @@ gtk_radio_tool_button_get_type
|
||||
gtk_range_get_type
|
||||
gtk_recent_manager_get_type
|
||||
gtk_revealer_get_type
|
||||
gtk_root_get_type
|
||||
gtk_scale_button_get_type
|
||||
gtk_scale_get_type
|
||||
gtk_scrollable_get_type
|
||||
|
||||
@@ -289,6 +289,28 @@
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Stop using gdk_pointer_warp()</title>
|
||||
<para>
|
||||
Warping the pointer is disorienting and unfriendly to users.
|
||||
GTK 4 does not support it. In special circumstances (such as when
|
||||
implementing remote connection UIs) it can be necessary to
|
||||
warp the pointer; in this case, use platform APIs such as XWarpPointer
|
||||
directly.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Adapt to coordinate api changes</title>
|
||||
<para>
|
||||
A number of coordinate apis in GTK 3 had _double variants:
|
||||
gdk_device_get_position(), gdk_device_get_surface_at_position(),
|
||||
gdk_surface_get_device_position(). These have been changed to use
|
||||
doubles, and the _double variants have been removed. Update your
|
||||
code accordingly.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Adapt to GdkKeymap API changes</title>
|
||||
<para>
|
||||
@@ -321,12 +343,22 @@
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Adapt to GtkHeaderBar API changes</title>
|
||||
<title>Adapt to GtkHeaderBar and GtkActionBar API changes</title>
|
||||
<para>
|
||||
The gtk_header_bar_set_show_close_button() function has been renamed to
|
||||
the more accurate name gtk_header_bar_set_show_title_buttons(). The corresponding
|
||||
getter and the property itself have also been renamed.
|
||||
</para>
|
||||
<para>
|
||||
The ::pack-type child properties of GtkHeaderBar and GtkActionBar have
|
||||
been removed. If you need to programmatically place children, use the
|
||||
pack_start() and pack_end() APIs. In ui files, use the type attribute
|
||||
on the child element.
|
||||
</para>
|
||||
<para>
|
||||
gtk4-builder-tool can help with this conversion, with the --3to4 option
|
||||
of the simplify command.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
@@ -608,7 +640,7 @@
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Adapt to changes in the API of GtkEntry and GtkSearchEntry</title>
|
||||
<title>Adapt to changes in the API of GtkEntry, GtkSearchEntry adn GtkSpinButton</title>
|
||||
<para>
|
||||
The GtkEditable has been made more useful, and the core functionality of
|
||||
GtkEntry has been broken out as a GtkText widget. GtkEntry, GtkSearchEntry,
|
||||
@@ -620,7 +652,8 @@
|
||||
<para>
|
||||
Use GtkEditable API for editable functionality, and widget-specific APIs for
|
||||
things that go beyond the common interface. For password entries, use
|
||||
GtkPasswordEntry.
|
||||
GtkPasswordEntry. As an example, gtk_spin_button_set_max_width_chars()
|
||||
has been removed in favor of gtk_editable_set_max_width_chars().
|
||||
</para>
|
||||
</section>
|
||||
|
||||
|
||||
@@ -47,8 +47,7 @@ this reference manual for details.
|
||||
|
||||
<qandaentry>
|
||||
<question><para>
|
||||
Where can I get help with GTK, submit a bug report, or make a feature
|
||||
request?
|
||||
Where can I get help with GTK, submit a bug report, or make a feature request?
|
||||
</para></question>
|
||||
|
||||
<answer>
|
||||
@@ -63,13 +62,14 @@ See the <link linkend="gtk-resources">documentation on this topic</link>.
|
||||
|
||||
|
||||
<qandaentry>
|
||||
<question><para>How do I port from one GTK
|
||||
version to another?</para></question>
|
||||
<question><para>
|
||||
How do I port from one GTK version to another?
|
||||
</para></question>
|
||||
|
||||
<answer>
|
||||
|
||||
<para>
|
||||
See <xref linkend="gtk-migrating-2-to-3"/>.
|
||||
See <xref linkend="migrating"/>.
|
||||
You may also find useful information in the documentation for
|
||||
specific widgets and functions.
|
||||
</para>
|
||||
@@ -88,8 +88,7 @@ against the documentation.
|
||||
|
||||
<qandaentry>
|
||||
<question><para>
|
||||
How does memory management work in GTK? Should I free data returned
|
||||
from functions?
|
||||
How does memory management work in GTK? Should I free data returned from functions?
|
||||
</para></question>
|
||||
|
||||
<answer>
|
||||
@@ -528,10 +527,9 @@ the call away if it appears that the value is not being used.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
A common workaround for this problem is to store the result in a volatile
|
||||
variable, which keeps the compiler from optimizing the call away.
|
||||
GLib provides the g_type_ensure() function to work around this problem.
|
||||
<informalexample><programlisting>
|
||||
volatile GType dummy = GTK_TYPE_BLAH;
|
||||
g_type_ensure (GTK_TYPE_BLAH);
|
||||
</programlisting></informalexample>
|
||||
</para>
|
||||
</answer>
|
||||
@@ -546,32 +544,9 @@ How do I create a transparent toplevel window ?
|
||||
|
||||
<answer>
|
||||
<para>
|
||||
To make a window transparent, it needs to use a visual which supports that.
|
||||
This is done by getting the RGBA visual of the screen with
|
||||
gdk_screen_get_rgba_visual() and setting it on the window. Note that
|
||||
gdk_screen_get_rgba_visual() will return %NULL if transparent windows
|
||||
are not supported on the screen, you should fall back to
|
||||
gdk_screen_get_system_visual() in that case. Additionally, note that this
|
||||
will change from screen to screen, so it needs to be repeated whenever the
|
||||
window is moved to a different screen.
|
||||
<informalexample><programlisting>
|
||||
GdkVisual *visual;
|
||||
|
||||
visual = gdk_screen_get_rgba_visual (screen);
|
||||
if (visual == NULL)
|
||||
visual = gdk_screen_get_system_visual (screen);
|
||||
|
||||
gtk_widget_set_visual (GTK_WIDGET (window), visual);
|
||||
</programlisting></informalexample>
|
||||
To fill the alpha channel on the window simply use cairos
|
||||
RGBA drawing capabilities.
|
||||
</para>
|
||||
<para>
|
||||
Note that the presence of an RGBA visual is no guarantee that the
|
||||
window will actually appear transparent on screen. On X11, this
|
||||
requires a compositing manager to be running. See
|
||||
gdk_display_is_composited() for a way to find out if the alpha
|
||||
channel will be respected.
|
||||
Any toplevel window can be transparent.
|
||||
It is just a matter of setting a transparent background
|
||||
in the CSS style for it.
|
||||
</para>
|
||||
</answer>
|
||||
</qandaentry>
|
||||
@@ -587,9 +562,19 @@ channel will be respected.
|
||||
|
||||
<answer>
|
||||
<para>
|
||||
See <link linkend="TreeWidget">tree widget overview</link> — you
|
||||
should use the #GtkTreeView widget. (A list is just a tree with no branches,
|
||||
so the tree widget is used for lists as well).
|
||||
This question has different answers, depending on the size of the dataset
|
||||
and the required formatting flexibility.
|
||||
</para>
|
||||
<para>
|
||||
If you want to display a large amount of data in a uniform way, your
|
||||
best option is a #GtkTreeView widget. See <link linkend="TreeWidget">tree
|
||||
widget overview</link>. A list is just a tree with no branches, so the treeview
|
||||
widget is used for lists as well.
|
||||
</para>
|
||||
<para>
|
||||
If you want to display a small amount of items, but need flexible formatting
|
||||
and widgetry inside the list, then you probably want to use a #GtkListBox,
|
||||
which uses regular widgets for display.
|
||||
</para>
|
||||
</answer>
|
||||
</qandaentry>
|
||||
@@ -620,7 +605,11 @@ single-line text entry, see #GtkEntry.
|
||||
|
||||
<answer>
|
||||
<para>
|
||||
#GtkImage can display images in just about any format GTK understands.
|
||||
GTK has two widgets that are dedicated to displaying images. #GtkImage, for
|
||||
small, fixed-size icons and #GtkPicture for content images.
|
||||
</para>
|
||||
<para>
|
||||
Both can display images in just about any format GTK understands.
|
||||
You can also use #GtkDrawingArea if you need to do something more complex,
|
||||
such as draw text or graphics over the top of the image.
|
||||
</para>
|
||||
@@ -653,9 +642,10 @@ How do I change the color of a widget?
|
||||
</para></question>
|
||||
|
||||
<answer><para>
|
||||
See gtk_widget_override_color() and gtk_widget_override_background_color().
|
||||
You can also change the appearance of a widget by installing a
|
||||
custom style provider, see gtk_style_context_add_provider().
|
||||
The background color of a widget is determined by the CSS style that applies
|
||||
to it. To change that, you can set style classes on the widget, and provide
|
||||
custom CSS to change the appearance. Such CSS can be loaded with
|
||||
gtk_css_provider_load_from_file() and its variants. See gtk_style_context_add_provider().
|
||||
</para></answer>
|
||||
</qandaentry>
|
||||
|
||||
@@ -665,16 +655,6 @@ How do I change the font of a widget?
|
||||
</para></question>
|
||||
|
||||
<answer><para>
|
||||
This has several possible answers, depending on what exactly you want to
|
||||
achieve. One option is gtk_widget_override_font().
|
||||
<informalexample><programlisting>
|
||||
PangoFontDesc *font_desc = pango_font_description_new (<!-- -->);
|
||||
pango_font_description_set_size (font_desc, 40);
|
||||
gtk_widget_override_font (widget, font);
|
||||
pango_font_description_free (font_desc);
|
||||
</programlisting></informalexample>
|
||||
</para>
|
||||
<para>
|
||||
If you want to make the text of a label larger, you can use
|
||||
gtk_label_set_markup():
|
||||
<informalexample><programlisting>
|
||||
@@ -939,32 +919,28 @@ How do I use cairo to draw in GTK applications ?
|
||||
</para></question>
|
||||
|
||||
<answer><para>
|
||||
The #GtkWidget::draw signal gets a ready-to-use cairo context
|
||||
as parameter that you should use.
|
||||
</para>
|
||||
<para>
|
||||
All drawing in GTK is normally done in a draw handler, and GTK
|
||||
creates a temporary pixmap for double-buffering the drawing.
|
||||
It is possible to turn off double-buffering, with
|
||||
gtk_widget_set_double_buffered(), but this is not ideal,
|
||||
since it can cause some flickering.
|
||||
Use gtk_snapshot_append_cairo() in your #GtkWidget::snapshot signal handler
|
||||
to optain a cairo context and draw with that.
|
||||
</para>
|
||||
</answer>
|
||||
</qandaentry>
|
||||
|
||||
<qandaentry>
|
||||
<question><para>
|
||||
Can I improve the performance of my application by using the
|
||||
Glitz or GL backend of cairo ?
|
||||
Can I improve the performance of my application by using another backend
|
||||
of cairo (such as GL) ?
|
||||
</para></question>
|
||||
|
||||
<answer><para>
|
||||
No. The GDK X11 backend uses the cairo X backend (and the other
|
||||
GDK backends use their respective native cairo backends). The
|
||||
GTK developers believe that the best way to improving the GDK
|
||||
drawing performance is to optimize the cairo X backend and the
|
||||
relevant code paths in the X server that is uses (mostly the
|
||||
Render extension).
|
||||
No. Most drawing in GTK is not done via cairo anymore (but instead
|
||||
by the GL or Vulkan renderers of GSK).
|
||||
</para>
|
||||
<para>
|
||||
If you use cairo for drawing your own widgets, gtk_snapshot_append_cairo()
|
||||
will choose the most appropriate surface type for you.
|
||||
</para>
|
||||
<para>
|
||||
If you are interested in using GL for your own drawing, see #GtkGLArea.
|
||||
</para></answer>
|
||||
</qandaentry>
|
||||
|
||||
@@ -974,8 +950,11 @@ Can I use cairo to draw on a #GdkPixbuf ?
|
||||
</para></question>
|
||||
|
||||
<answer><para>
|
||||
No, at least not yet. The cairo image surface does not support the
|
||||
pixel format used by GdkPixbuf.
|
||||
No. The cairo image surface does not support the pixel format used by GdkPixbuf.
|
||||
</para>
|
||||
<para>
|
||||
If you need to get cairo drawing into a format that can be displayed efficiently
|
||||
by GTK, you may want to use an image surface and gdk_memory_texture_new().
|
||||
</para></answer>
|
||||
</qandaentry>
|
||||
|
||||
|
||||
@@ -150,11 +150,8 @@ see for example <link
|
||||
linkend="gtk-window-iconify">gtk_window_iconify()</link> or <link
|
||||
linkend="gtk-window-maximize">gtk_window_maximize()</link> or <link
|
||||
linkend="gtk-window-set-decorated">gtk_window_set_decorated()</link>.
|
||||
Keep in mind that <link
|
||||
linkend="gtk-window-move">gtk_window_move()</link> and window sizing
|
||||
are ultimately controlled by the window manager as well and most
|
||||
window managers <emphasis>will</emphasis> ignore certain requests from
|
||||
time to time, in the interests of good user interface.
|
||||
Keep in mind that most window managers <emphasis>will</emphasis> ignore
|
||||
certain requests from time to time, in the interests of good user interface.
|
||||
</para>
|
||||
|
||||
<!--
|
||||
|
||||
@@ -226,7 +226,7 @@ create_entry (void)
|
||||
widget = gtk_entry_new ();
|
||||
gtk_widget_set_halign (widget, GTK_ALIGN_FILL);
|
||||
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
|
||||
gtk_entry_set_text (GTK_ENTRY (widget), "Entry");
|
||||
gtk_editable_set_text (GTK_EDITABLE (widget), "Entry");
|
||||
gtk_editable_set_position (GTK_EDITABLE (widget), -1);
|
||||
|
||||
return new_widget_info ("entry", widget, SMALL);
|
||||
@@ -320,7 +320,7 @@ create_combo_box_entry (void)
|
||||
g_object_unref (model);
|
||||
|
||||
child = gtk_bin_get_child (GTK_BIN (widget));
|
||||
gtk_entry_set_text (GTK_ENTRY (child), "Combo Box Entry");
|
||||
gtk_editable_set_text (GTK_EDITABLE (child), "Combo Box Entry");
|
||||
gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
|
||||
|
||||
@@ -399,7 +399,7 @@ create_search_bar (void)
|
||||
widget = gtk_search_bar_new ();
|
||||
|
||||
entry = gtk_search_entry_new ();
|
||||
gtk_entry_set_text (GTK_ENTRY (entry), "Search Bar");
|
||||
gtk_editable_set_text (GTK_EDITABLE (entry), "Search Bar");
|
||||
gtk_container_add (GTK_CONTAINER (widget), entry);
|
||||
gtk_widget_show (entry);
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ search_text_changed (GtkEntry *entry,
|
||||
GtkTextBuffer *buffer;
|
||||
GtkTextIter start, match_start, match_end;
|
||||
|
||||
text = gtk_entry_get_text (entry);
|
||||
text = gtk_editable_get_text (GTK_EDITABLE (entry));
|
||||
|
||||
if (text[0] == '\0')
|
||||
return;
|
||||
@@ -58,7 +58,7 @@ find_word (GtkButton *button,
|
||||
const gchar *word;
|
||||
|
||||
word = gtk_button_get_label (button);
|
||||
gtk_entry_set_text (GTK_ENTRY (win->searchentry), word);
|
||||
gtk_editable_set_text (GTK_EDITABLE (win->searchentry), word);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -22,25 +22,21 @@
|
||||
<property name="stack">stack</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<child type="end">
|
||||
<object class="GtkToggleButton" id="search">
|
||||
<property name="sensitive">0</property>
|
||||
<property name="icon-name">edit-find-symbolic</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">end</property>
|
||||
</packing>
|
||||
<packing/>
|
||||
</child>
|
||||
<child>
|
||||
<child type="end">
|
||||
<object class="GtkMenuButton" id="gears">
|
||||
<property name="direction">none</property>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">end</property>
|
||||
</packing>
|
||||
<packing/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
@@ -25,7 +25,7 @@ search_text_changed (GtkEntry *entry,
|
||||
GtkTextBuffer *buffer;
|
||||
GtkTextIter start, match_start, match_end;
|
||||
|
||||
text = gtk_entry_get_text (entry);
|
||||
text = gtk_editable_get_text (GTK_EDITABLE (entry));
|
||||
|
||||
if (text[0] == '\0')
|
||||
return;
|
||||
|
||||
@@ -13,14 +13,12 @@
|
||||
<property name="stack">stack</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<child type="end">
|
||||
<object class="GtkToggleButton" id="search">
|
||||
<property name="sensitive">0</property>
|
||||
<property name="icon-name">edit-find-symbolic</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">end</property>
|
||||
</packing>
|
||||
<packing/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
@@ -29,7 +29,7 @@ search_text_changed (GtkEntry *entry,
|
||||
GtkTextBuffer *buffer;
|
||||
GtkTextIter start, match_start, match_end;
|
||||
|
||||
text = gtk_entry_get_text (entry);
|
||||
text = gtk_editable_get_text (GTK_EDITABLE (entry));
|
||||
|
||||
if (text[0] == '\0')
|
||||
return;
|
||||
@@ -56,7 +56,7 @@ find_word (GtkButton *button,
|
||||
const gchar *word;
|
||||
|
||||
word = gtk_button_get_label (button);
|
||||
gtk_entry_set_text (GTK_ENTRY (win->searchentry), word);
|
||||
gtk_editable_set_text (GTK_EDITABLE (win->searchentry), word);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -13,25 +13,21 @@
|
||||
<property name="stack">stack</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<child type="end">
|
||||
<object class="GtkToggleButton" id="search">
|
||||
<property name="sensitive">0</property>
|
||||
<property name="icon-name">edit-find-symbolic</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">end</property>
|
||||
</packing>
|
||||
<packing/>
|
||||
</child>
|
||||
<child>
|
||||
<child type="end">
|
||||
<object class="GtkMenuButton" id="gears">
|
||||
<property name="direction">none</property>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">end</property>
|
||||
</packing>
|
||||
<packing/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
@@ -31,7 +31,7 @@ search_text_changed (GtkEntry *entry,
|
||||
GtkTextBuffer *buffer;
|
||||
GtkTextIter start, match_start, match_end;
|
||||
|
||||
text = gtk_entry_get_text (entry);
|
||||
text = gtk_editable_get_text (GTK_EDITABLE (entry));
|
||||
|
||||
if (text[0] == '\0')
|
||||
return;
|
||||
@@ -58,7 +58,7 @@ find_word (GtkButton *button,
|
||||
const gchar *word;
|
||||
|
||||
word = gtk_button_get_label (button);
|
||||
gtk_entry_set_text (GTK_ENTRY (win->searchentry), word);
|
||||
gtk_editable_set_text (GTK_EDITABLE (win->searchentry), word);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -24,25 +24,21 @@
|
||||
<property name="stack">stack</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<child type="end">
|
||||
<object class="GtkToggleButton" id="search">
|
||||
<property name="sensitive">0</property>
|
||||
<property name="icon-name">edit-find-symbolic</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">end</property>
|
||||
</packing>
|
||||
<packing/>
|
||||
</child>
|
||||
<child>
|
||||
<child type="end">
|
||||
<object class="GtkMenuButton" id="gears">
|
||||
<property name="direction">none</property>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">end</property>
|
||||
</packing>
|
||||
<packing/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
@@ -364,7 +364,7 @@ combo_changed (GtkComboBox *combo,
|
||||
str = g_strjoinv (",", accels);
|
||||
g_strfreev (accels);
|
||||
|
||||
gtk_entry_set_text (entry, str);
|
||||
gtk_editable_set_text (GTK_EDITABLE (entry), str);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -389,7 +389,7 @@ response (GtkDialog *dialog,
|
||||
if (!action)
|
||||
return;
|
||||
|
||||
str = gtk_entry_get_text (entry);
|
||||
str = gtk_editable_get_text (GTK_EDITABLE (entry));
|
||||
accels = g_strsplit (str, ",", 0);
|
||||
|
||||
gtk_application_set_accels_for_action (gtk_window_get_application (user_data), action, (const gchar **) accels);
|
||||
|
||||
@@ -22,6 +22,9 @@ typedef enum { /* Sync changes with broadway.js */
|
||||
BROADWAY_NODE_CLIP = 10,
|
||||
BROADWAY_NODE_KEEP_ALL = 11,
|
||||
BROADWAY_NODE_KEEP_THIS = 12,
|
||||
BROADWAY_NODE_TRANSFORM = 13,
|
||||
BROADWAY_NODE_DEBUG = 14,
|
||||
BROADWAY_NODE_REUSE = 15,
|
||||
} BroadwayNodeType;
|
||||
|
||||
static const char *broadway_node_type_names[] G_GNUC_UNUSED = {
|
||||
@@ -38,6 +41,8 @@ static const char *broadway_node_type_names[] G_GNUC_UNUSED = {
|
||||
"CLIP",
|
||||
"KEEP_ALL",
|
||||
"KEEP_THIS",
|
||||
"TRANSLATE",
|
||||
"DEBUG",
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct {
|
||||
int id;
|
||||
guint32 tag;
|
||||
@@ -126,23 +125,56 @@ struct BroadwaySurface {
|
||||
gint32 transient_for;
|
||||
guint32 texture;
|
||||
BroadwayNode *nodes;
|
||||
GHashTable *node_lookup;
|
||||
};
|
||||
|
||||
struct _BroadwayTexture {
|
||||
grefcount refcount;
|
||||
guint32 id;
|
||||
GBytes *bytes;
|
||||
};
|
||||
|
||||
static void broadway_server_resync_surfaces (BroadwayServer *server);
|
||||
static void send_outstanding_roundtrips (BroadwayServer *server);
|
||||
|
||||
static void broadway_server_ref_texture (BroadwayServer *server,
|
||||
guint32 id);
|
||||
|
||||
static GType broadway_server_get_type (void);
|
||||
|
||||
G_DEFINE_TYPE (BroadwayServer, broadway_server, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
broadway_node_free (BroadwayNode *node)
|
||||
broadway_texture_free (BroadwayTexture *texture)
|
||||
{
|
||||
g_bytes_unref (texture->bytes);
|
||||
g_free (texture);
|
||||
}
|
||||
|
||||
static void
|
||||
broadway_node_unref (BroadwayServer *server,
|
||||
BroadwayNode *node)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < node->n_children; i++)
|
||||
broadway_node_free (node->children[i]);
|
||||
|
||||
g_free (node);
|
||||
if (g_ref_count_dec (&node->refcount))
|
||||
{
|
||||
for (i = 0; i < node->n_children; i++)
|
||||
broadway_node_unref (server, node->children[i]);
|
||||
|
||||
if (node->texture_id)
|
||||
broadway_server_release_texture (server, node->texture_id);
|
||||
|
||||
g_free (node);
|
||||
}
|
||||
}
|
||||
|
||||
static BroadwayNode *
|
||||
broadway_node_ref (BroadwayNode *node)
|
||||
{
|
||||
g_ref_count_inc (&node->refcount);
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
gboolean
|
||||
@@ -204,7 +236,7 @@ broadway_server_init (BroadwayServer *server)
|
||||
server->surface_id_hash = g_hash_table_new (NULL, NULL);
|
||||
server->id_counter = 0;
|
||||
server->textures = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL,
|
||||
(GDestroyNotify)g_bytes_unref);
|
||||
(GDestroyNotify)broadway_texture_free);
|
||||
|
||||
root = g_new0 (BroadwaySurface, 1);
|
||||
root->id = server->id_counter++;
|
||||
@@ -241,10 +273,12 @@ broadway_server_class_init (BroadwayServerClass * class)
|
||||
}
|
||||
|
||||
static void
|
||||
broadway_surface_free (BroadwaySurface *surface)
|
||||
broadway_surface_free (BroadwayServer *server,
|
||||
BroadwaySurface *surface)
|
||||
{
|
||||
if (surface->nodes)
|
||||
broadway_node_free (surface->nodes);
|
||||
broadway_node_unref (server, surface->nodes);
|
||||
g_hash_table_unref (surface->node_lookup);
|
||||
g_free (surface);
|
||||
}
|
||||
|
||||
@@ -1477,7 +1511,7 @@ broadway_server_destroy_surface (BroadwayServer *server,
|
||||
server->surfaces = g_list_remove (server->surfaces, surface);
|
||||
g_hash_table_remove (server->surface_id_hash,
|
||||
GINT_TO_POINTER (id));
|
||||
broadway_surface_free (surface);
|
||||
broadway_surface_free (server, surface);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1605,53 +1639,242 @@ broadway_server_has_client (BroadwayServer *server)
|
||||
return server->output != NULL;
|
||||
}
|
||||
|
||||
#define NODE_SIZE_COLOR 1
|
||||
#define NODE_SIZE_FLOAT 1
|
||||
#define NODE_SIZE_POINT 2
|
||||
#define NODE_SIZE_MATRIX 16
|
||||
#define NODE_SIZE_SIZE 2
|
||||
#define NODE_SIZE_RECT (NODE_SIZE_POINT + NODE_SIZE_SIZE)
|
||||
#define NODE_SIZE_RRECT (NODE_SIZE_RECT + 4 * NODE_SIZE_SIZE)
|
||||
#define NODE_SIZE_COLOR_STOP (NODE_SIZE_FLOAT + NODE_SIZE_COLOR)
|
||||
#define NODE_SIZE_SHADOW (NODE_SIZE_COLOR + 3 * NODE_SIZE_FLOAT)
|
||||
|
||||
static guint32
|
||||
rotl (guint32 value, int shift)
|
||||
{
|
||||
if ((shift &= 32 - 1) == 0)
|
||||
return value;
|
||||
return (value << shift) | (value >> (32 - shift));
|
||||
}
|
||||
|
||||
static BroadwayNode *
|
||||
decode_nodes (BroadwayServer *server,
|
||||
BroadwaySurface *surface,
|
||||
int len,
|
||||
guint32 data[],
|
||||
GHashTable *client_texture_map,
|
||||
int *pos)
|
||||
{
|
||||
BroadwayNode *node;
|
||||
guint32 type, id;
|
||||
guint32 i, n_stops, n_shadows, n_chars;
|
||||
guint32 size, n_children;
|
||||
gint32 texture_offset;
|
||||
guint32 hash;
|
||||
guint32 transform_type;
|
||||
|
||||
g_assert (*pos < len);
|
||||
|
||||
size = 0;
|
||||
n_children = 0;
|
||||
texture_offset = -1;
|
||||
|
||||
type = data[(*pos)++];
|
||||
id = data[(*pos)++];
|
||||
switch (type) {
|
||||
case BROADWAY_NODE_REUSE:
|
||||
node = g_hash_table_lookup (surface->node_lookup, GINT_TO_POINTER(id));
|
||||
g_assert (node != NULL);
|
||||
return broadway_node_ref (node);
|
||||
break;
|
||||
case BROADWAY_NODE_COLOR:
|
||||
size = NODE_SIZE_RECT + NODE_SIZE_COLOR;
|
||||
break;
|
||||
case BROADWAY_NODE_BORDER:
|
||||
size = NODE_SIZE_RRECT + 4 * NODE_SIZE_FLOAT + 4 * NODE_SIZE_COLOR;
|
||||
break;
|
||||
case BROADWAY_NODE_INSET_SHADOW:
|
||||
case BROADWAY_NODE_OUTSET_SHADOW:
|
||||
size = NODE_SIZE_RRECT + NODE_SIZE_COLOR + 4 * NODE_SIZE_FLOAT;
|
||||
break;
|
||||
case BROADWAY_NODE_TEXTURE:
|
||||
texture_offset = 4;
|
||||
size = 5;
|
||||
break;
|
||||
case BROADWAY_NODE_CONTAINER:
|
||||
size = 1;
|
||||
n_children = data[*pos];
|
||||
break;
|
||||
case BROADWAY_NODE_ROUNDED_CLIP:
|
||||
size = NODE_SIZE_RRECT;
|
||||
n_children = 1;
|
||||
break;
|
||||
case BROADWAY_NODE_CLIP:
|
||||
size = NODE_SIZE_RECT;
|
||||
n_children = 1;
|
||||
break;
|
||||
case BROADWAY_NODE_TRANSFORM:
|
||||
transform_type = data[(*pos)];
|
||||
size = 1;
|
||||
if (transform_type == 0) {
|
||||
size += NODE_SIZE_POINT;
|
||||
} else if (transform_type == 1) {
|
||||
size += NODE_SIZE_MATRIX;
|
||||
} else {
|
||||
g_assert_not_reached();
|
||||
}
|
||||
n_children = 1;
|
||||
break;
|
||||
case BROADWAY_NODE_LINEAR_GRADIENT:
|
||||
size = NODE_SIZE_RECT + 2 * NODE_SIZE_POINT;
|
||||
n_stops = data[*pos + size++];
|
||||
size += n_stops * NODE_SIZE_COLOR_STOP;
|
||||
break;
|
||||
case BROADWAY_NODE_SHADOW:
|
||||
size = 1;
|
||||
n_shadows = data[*pos];
|
||||
size += n_shadows * NODE_SIZE_SHADOW;
|
||||
n_children = 1;
|
||||
break;
|
||||
case BROADWAY_NODE_OPACITY:
|
||||
size = NODE_SIZE_FLOAT;
|
||||
n_children = 1;
|
||||
break;
|
||||
case BROADWAY_NODE_DEBUG:
|
||||
n_chars = data[*pos];
|
||||
size = 1 + (n_chars + 3) / 4;
|
||||
n_children = 1;
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
node = g_malloc (sizeof(BroadwayNode) + (size - 1) * sizeof(guint32) + n_children * sizeof (BroadwayNode *));
|
||||
g_ref_count_init (&node->refcount);
|
||||
node->type = type;
|
||||
node->id = id;
|
||||
node->texture_id = 0;
|
||||
node->n_children = n_children;
|
||||
node->children = (BroadwayNode **)((char *)node + sizeof(BroadwayNode) + (size - 1) * sizeof(guint32));
|
||||
node->n_data = size;
|
||||
for (i = 0; i < size; i++)
|
||||
{
|
||||
node->data[i] = data[(*pos)++];
|
||||
if (i == texture_offset)
|
||||
{
|
||||
node->texture_id = GPOINTER_TO_INT (g_hash_table_lookup (client_texture_map, GINT_TO_POINTER (node->data[i])));
|
||||
broadway_server_ref_texture (server, node->texture_id);
|
||||
node->data[i] = node->texture_id;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < n_children; i++)
|
||||
node->children[i] = decode_nodes (server, surface, len, data, client_texture_map, pos);
|
||||
|
||||
hash = node->type << 16;
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
hash ^= rotl (node->data[i], i);
|
||||
|
||||
for (i = 0; i < n_children; i++)
|
||||
hash ^= rotl (node->children[i]->hash, i);
|
||||
|
||||
node->hash = hash;
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
static void
|
||||
init_node_lookup (BroadwaySurface *surface,
|
||||
BroadwayNode *node)
|
||||
{
|
||||
int i;
|
||||
|
||||
g_hash_table_insert (surface->node_lookup, GINT_TO_POINTER(node->id), node);
|
||||
for (i = 0; i < node->n_children; i++)
|
||||
init_node_lookup (surface, node->children[i]);
|
||||
}
|
||||
|
||||
/* passes ownership of nodes */
|
||||
void
|
||||
broadway_server_surface_set_nodes (BroadwayServer *server,
|
||||
gint id,
|
||||
BroadwayNode *root)
|
||||
broadway_server_surface_update_nodes (BroadwayServer *server,
|
||||
gint id,
|
||||
guint32 data[],
|
||||
int len,
|
||||
GHashTable *client_texture_map)
|
||||
{
|
||||
BroadwaySurface *surface;
|
||||
int pos = 0;
|
||||
BroadwayNode *root;
|
||||
|
||||
surface = broadway_server_lookup_surface (server, id);
|
||||
if (surface == NULL)
|
||||
return;
|
||||
|
||||
root = decode_nodes (server, surface, len, data, client_texture_map, &pos);
|
||||
|
||||
if (server->output != NULL)
|
||||
broadway_output_surface_set_nodes (server->output, surface->id,
|
||||
root,
|
||||
surface->nodes);
|
||||
|
||||
if (surface->nodes)
|
||||
broadway_node_free (surface->nodes);
|
||||
broadway_node_unref (server, surface->nodes);
|
||||
|
||||
surface->nodes = root;
|
||||
|
||||
g_hash_table_remove_all (surface->node_lookup);
|
||||
|
||||
init_node_lookup (surface, surface->nodes);
|
||||
}
|
||||
|
||||
guint32
|
||||
broadway_server_upload_texture (BroadwayServer *server,
|
||||
GBytes *texture)
|
||||
GBytes *bytes)
|
||||
{
|
||||
guint32 id;
|
||||
BroadwayTexture *texture;
|
||||
|
||||
texture = g_new0 (BroadwayTexture, 1);
|
||||
g_ref_count_init (&texture->refcount);
|
||||
texture->id = ++server->next_texture_id;
|
||||
texture->bytes = g_bytes_ref (bytes);
|
||||
|
||||
id = ++server->next_texture_id;
|
||||
g_hash_table_replace (server->textures,
|
||||
GINT_TO_POINTER (id),
|
||||
g_bytes_ref (texture));
|
||||
GINT_TO_POINTER (texture->id),
|
||||
texture);
|
||||
|
||||
if (server->output)
|
||||
broadway_output_upload_texture (server->output, id, texture);
|
||||
broadway_output_upload_texture (server->output, texture->id, texture->bytes);
|
||||
|
||||
return id;
|
||||
return texture->id;
|
||||
}
|
||||
|
||||
static void
|
||||
broadway_server_ref_texture (BroadwayServer *server,
|
||||
guint32 id)
|
||||
{
|
||||
BroadwayTexture *texture;
|
||||
|
||||
texture = g_hash_table_lookup (server->textures, GINT_TO_POINTER (id));
|
||||
if (texture)
|
||||
g_ref_count_inc (&texture->refcount);
|
||||
}
|
||||
|
||||
void
|
||||
broadway_server_release_texture (BroadwayServer *server,
|
||||
guint32 id)
|
||||
{
|
||||
g_hash_table_remove (server->textures, GINT_TO_POINTER (id));
|
||||
BroadwayTexture *texture;
|
||||
|
||||
if (server->output)
|
||||
broadway_output_release_texture (server->output, id);
|
||||
texture = g_hash_table_lookup (server->textures, GINT_TO_POINTER (id));
|
||||
|
||||
if (texture && g_ref_count_dec (&texture->refcount))
|
||||
{
|
||||
g_hash_table_remove (server->textures, GINT_TO_POINTER (id));
|
||||
|
||||
if (server->output)
|
||||
broadway_output_release_texture (server->output, id);
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
@@ -1801,6 +2024,7 @@ broadway_server_new_surface (BroadwayServer *server,
|
||||
surface->width = width;
|
||||
surface->height = height;
|
||||
surface->is_temp = is_temp;
|
||||
surface->node_lookup = g_hash_table_new (g_direct_hash, g_direct_equal);
|
||||
|
||||
g_hash_table_insert (server->surface_id_hash,
|
||||
GINT_TO_POINTER (surface->id),
|
||||
@@ -1835,9 +2059,12 @@ broadway_server_resync_surfaces (BroadwayServer *server)
|
||||
/* First upload all textures */
|
||||
g_hash_table_iter_init (&iter, server->textures);
|
||||
while (g_hash_table_iter_next (&iter, &key, &value))
|
||||
broadway_output_upload_texture (server->output,
|
||||
GPOINTER_TO_INT (key),
|
||||
(GBytes *)value);
|
||||
{
|
||||
BroadwayTexture *texture = value;
|
||||
broadway_output_upload_texture (server->output,
|
||||
GPOINTER_TO_INT (key),
|
||||
texture->bytes);
|
||||
}
|
||||
|
||||
/* Then create all surfaces */
|
||||
for (l = server->surfaces; l != NULL; l = l->next)
|
||||
|
||||
@@ -19,12 +19,16 @@ typedef struct _BroadwayServerClass BroadwayServerClass;
|
||||
#define BROADWAY_SERVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BROADWAY_TYPE_SERVER, BroadwayServerClass))
|
||||
|
||||
typedef struct _BroadwayNode BroadwayNode;
|
||||
typedef struct _BroadwayTexture BroadwayTexture;
|
||||
|
||||
struct _BroadwayNode {
|
||||
grefcount refcount;
|
||||
guint32 type;
|
||||
guint32 id;
|
||||
guint32 hash; /* deep hash */
|
||||
guint32 n_children;
|
||||
BroadwayNode **children;
|
||||
guint32 texture_id;
|
||||
guint32 n_data;
|
||||
guint32 data[1];
|
||||
};
|
||||
@@ -99,9 +103,11 @@ void broadway_server_release_texture (BroadwayServer *
|
||||
guint32 id);
|
||||
cairo_surface_t * broadway_server_create_surface (int width,
|
||||
int height);
|
||||
void broadway_server_surface_set_nodes (BroadwayServer *server,
|
||||
void broadway_server_surface_update_nodes (BroadwayServer *server,
|
||||
gint id,
|
||||
BroadwayNode *root);
|
||||
guint32 data[],
|
||||
int len,
|
||||
GHashTable *client_texture_map);
|
||||
gboolean broadway_server_surface_move_resize (BroadwayServer *server,
|
||||
gint id,
|
||||
gboolean with_move,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -215,116 +215,6 @@ get_client_serial (BroadwayClient *client, guint32 daemon_serial)
|
||||
return client_serial;
|
||||
}
|
||||
|
||||
#define NODE_SIZE_COLOR 1
|
||||
#define NODE_SIZE_FLOAT 1
|
||||
#define NODE_SIZE_POINT 2
|
||||
#define NODE_SIZE_SIZE 2
|
||||
#define NODE_SIZE_RECT (NODE_SIZE_POINT + NODE_SIZE_SIZE)
|
||||
#define NODE_SIZE_RRECT (NODE_SIZE_RECT + 4 * NODE_SIZE_SIZE)
|
||||
#define NODE_SIZE_COLOR_STOP (NODE_SIZE_FLOAT + NODE_SIZE_COLOR)
|
||||
#define NODE_SIZE_SHADOW (NODE_SIZE_COLOR + 3 * NODE_SIZE_FLOAT)
|
||||
|
||||
static guint32
|
||||
rotl (guint32 value, int shift)
|
||||
{
|
||||
if ((shift &= 32 - 1) == 0)
|
||||
return value;
|
||||
return (value << shift) | (value >> (32 - shift));
|
||||
}
|
||||
|
||||
static BroadwayNode *
|
||||
decode_nodes (BroadwayClient *client,
|
||||
int len, guint32 data[], int *pos)
|
||||
{
|
||||
BroadwayNode *node;
|
||||
guint32 type;
|
||||
guint32 i, n_stops, n_shadows;
|
||||
guint32 size, n_children;
|
||||
gint32 texture_offset;
|
||||
guint32 hash;
|
||||
|
||||
g_assert (*pos < len);
|
||||
|
||||
size = 0;
|
||||
n_children = 0;
|
||||
texture_offset = -1;
|
||||
|
||||
type = data[(*pos)++];
|
||||
switch (type) {
|
||||
case BROADWAY_NODE_COLOR:
|
||||
size = NODE_SIZE_RECT + NODE_SIZE_COLOR;
|
||||
break;
|
||||
case BROADWAY_NODE_BORDER:
|
||||
size = NODE_SIZE_RRECT + 4 * NODE_SIZE_FLOAT + 4 * NODE_SIZE_COLOR;
|
||||
break;
|
||||
case BROADWAY_NODE_INSET_SHADOW:
|
||||
case BROADWAY_NODE_OUTSET_SHADOW:
|
||||
size = NODE_SIZE_RRECT + NODE_SIZE_COLOR + 4 * NODE_SIZE_FLOAT;
|
||||
break;
|
||||
case BROADWAY_NODE_TEXTURE:
|
||||
texture_offset = 4;
|
||||
size = 5;
|
||||
break;
|
||||
case BROADWAY_NODE_CONTAINER:
|
||||
size = 1;
|
||||
n_children = data[*pos];
|
||||
break;
|
||||
case BROADWAY_NODE_ROUNDED_CLIP:
|
||||
size = NODE_SIZE_RRECT;
|
||||
n_children = 1;
|
||||
break;
|
||||
case BROADWAY_NODE_CLIP:
|
||||
size = NODE_SIZE_RECT;
|
||||
n_children = 1;
|
||||
break;
|
||||
case BROADWAY_NODE_LINEAR_GRADIENT:
|
||||
size = NODE_SIZE_RECT + 2 * NODE_SIZE_POINT;
|
||||
n_stops = data[*pos + size++];
|
||||
size += n_stops * NODE_SIZE_COLOR_STOP;
|
||||
break;
|
||||
case BROADWAY_NODE_SHADOW:
|
||||
size = 1;
|
||||
n_shadows = data[*pos];
|
||||
size += n_shadows * NODE_SIZE_SHADOW;
|
||||
n_children = 1;
|
||||
break;
|
||||
case BROADWAY_NODE_OPACITY:
|
||||
size = NODE_SIZE_FLOAT;
|
||||
n_children = 1;
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
node = g_malloc (sizeof(BroadwayNode) + (size - 1) * sizeof(guint32) + n_children * sizeof (BroadwayNode *));
|
||||
node->type = type;
|
||||
node->n_children = n_children;
|
||||
node->children = (BroadwayNode **)((char *)node + sizeof(BroadwayNode) + (size - 1) * sizeof(guint32));
|
||||
node->n_data = size;
|
||||
for (i = 0; i < size; i++)
|
||||
{
|
||||
node->data[i] = data[(*pos)++];
|
||||
if (i == texture_offset)
|
||||
node->data[i] = GPOINTER_TO_INT (g_hash_table_lookup (client->textures,
|
||||
GINT_TO_POINTER (node->data[i])));
|
||||
}
|
||||
|
||||
for (i = 0; i < n_children; i++)
|
||||
node->children[i] = decode_nodes (client, len, data, pos);
|
||||
|
||||
hash = node->type << 16;
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
hash ^= rotl (node->data[i], i);
|
||||
|
||||
for (i = 0; i < n_children; i++)
|
||||
hash ^= rotl (node->children[i]->hash, i);
|
||||
|
||||
node->hash = hash;
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
static void
|
||||
client_handle_request (BroadwayClient *client,
|
||||
BroadwayRequest *request)
|
||||
@@ -400,13 +290,10 @@ client_handle_request (BroadwayClient *client,
|
||||
{
|
||||
gsize array_size = request->base.size - sizeof (BroadwayRequestSetNodes) + sizeof(guint32);
|
||||
int n_data = array_size / sizeof(guint32);
|
||||
int pos = 0;
|
||||
BroadwayNode *node;
|
||||
|
||||
node = decode_nodes (client, n_data, request->set_nodes.data, &pos);
|
||||
|
||||
broadway_server_surface_set_nodes (server, request->set_nodes.id,
|
||||
node);
|
||||
broadway_server_surface_update_nodes (server, request->set_nodes.id,
|
||||
request->set_nodes.data, n_data,
|
||||
client->textures);
|
||||
}
|
||||
break;
|
||||
case BROADWAY_REQUEST_UPLOAD_TEXTURE:
|
||||
|
||||
@@ -36,9 +36,6 @@ static void gdk_broadway_device_get_state (GdkDevice *device,
|
||||
static void gdk_broadway_device_set_surface_cursor (GdkDevice *device,
|
||||
GdkSurface *surface,
|
||||
GdkCursor *cursor);
|
||||
static void gdk_broadway_device_warp (GdkDevice *device,
|
||||
gdouble x,
|
||||
gdouble y);
|
||||
static void gdk_broadway_device_query_state (GdkDevice *device,
|
||||
GdkSurface *surface,
|
||||
GdkSurface **child_surface,
|
||||
@@ -73,7 +70,6 @@ gdk_broadway_device_class_init (GdkBroadwayDeviceClass *klass)
|
||||
device_class->get_history = gdk_broadway_device_get_history;
|
||||
device_class->get_state = gdk_broadway_device_get_state;
|
||||
device_class->set_surface_cursor = gdk_broadway_device_set_surface_cursor;
|
||||
device_class->warp = gdk_broadway_device_warp;
|
||||
device_class->query_state = gdk_broadway_device_query_state;
|
||||
device_class->grab = gdk_broadway_device_grab;
|
||||
device_class->ungrab = gdk_broadway_device_ungrab;
|
||||
@@ -110,7 +106,7 @@ gdk_broadway_device_get_state (GdkDevice *device,
|
||||
{
|
||||
gdouble x, y;
|
||||
|
||||
gdk_surface_get_device_position_double (surface, device, &x, &y, mask);
|
||||
gdk_surface_get_device_position (surface, device, &x, &y, mask);
|
||||
|
||||
if (axes)
|
||||
{
|
||||
@@ -126,13 +122,6 @@ gdk_broadway_device_set_surface_cursor (GdkDevice *device,
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_device_warp (GdkDevice *device,
|
||||
gdouble x,
|
||||
gdouble y)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_device_query_state (GdkDevice *device,
|
||||
GdkSurface *surface,
|
||||
|
||||
@@ -380,7 +380,7 @@ gdk_broadway_display_ensure_texture (GdkDisplay *display,
|
||||
data = g_new0 (BroadwayTextureData, 1);
|
||||
data->id = id;
|
||||
data->display = g_object_ref (display);
|
||||
g_object_set_data_full (G_OBJECT (texture), "broadway-data", data, (GDestroyNotify)broadway_texture_data_free);
|
||||
g_object_set_data_full (G_OBJECT (texture), "broadway-data", data, (GDestroyNotify)broadway_texture_data_free);
|
||||
}
|
||||
|
||||
return data->id;
|
||||
|
||||
@@ -64,6 +64,8 @@ gdk_broadway_draw_context_end_frame (GdkDrawContext *draw_context,
|
||||
|
||||
g_array_unref (self->nodes);
|
||||
self->nodes = NULL;
|
||||
|
||||
/* We now sent all new texture refs to the daemon via the nodes, so we can drop them here */
|
||||
g_ptr_array_unref (self->node_textures);
|
||||
self->node_textures = NULL;
|
||||
}
|
||||
|
||||
@@ -501,12 +501,6 @@ gdk_broadway_surface_set_title (GdkSurface *surface,
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_surface_set_role (GdkSurface *surface,
|
||||
const gchar *role)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_surface_set_startup_id (GdkSurface *surface,
|
||||
const gchar *startup_id)
|
||||
@@ -1232,6 +1226,9 @@ gdk_broadway_surface_begin_resize_drag (GdkSurface *surface,
|
||||
|
||||
mv_resize = get_move_resize_data (gdk_surface_get_display (surface), TRUE);
|
||||
|
||||
if (mv_resize->moveresize_surface != NULL)
|
||||
return; /* already a drag operation in progress */
|
||||
|
||||
mv_resize->is_resize = TRUE;
|
||||
mv_resize->moveresize_button = button;
|
||||
mv_resize->resize_edge = edge;
|
||||
@@ -1272,6 +1269,9 @@ gdk_broadway_surface_begin_move_drag (GdkSurface *surface,
|
||||
|
||||
mv_resize = get_move_resize_data (gdk_surface_get_display (surface), TRUE);
|
||||
|
||||
if (mv_resize->moveresize_surface != NULL)
|
||||
return; /* already a drag operation in progress */
|
||||
|
||||
mv_resize->is_resize = FALSE;
|
||||
mv_resize->moveresize_button = button;
|
||||
mv_resize->moveresize_x = root_x;
|
||||
@@ -1352,7 +1352,6 @@ gdk_surface_impl_broadway_class_init (GdkSurfaceImplBroadwayClass *klass)
|
||||
impl_class->set_urgency_hint = gdk_broadway_surface_set_urgency_hint;
|
||||
impl_class->set_geometry_hints = gdk_broadway_surface_set_geometry_hints;
|
||||
impl_class->set_title = gdk_broadway_surface_set_title;
|
||||
impl_class->set_role = gdk_broadway_surface_set_role;
|
||||
impl_class->set_startup_id = gdk_broadway_surface_set_startup_id;
|
||||
impl_class->set_transient_for = gdk_broadway_surface_set_transient_for;
|
||||
impl_class->get_frame_extents = gdk_broadway_surface_get_frame_extents;
|
||||
|
||||
@@ -20,8 +20,6 @@ void gdk_surface_thaw_toplevel_updates (GdkSurface *surface);
|
||||
|
||||
gboolean gdk_surface_supports_edge_constraints (GdkSurface *surface);
|
||||
|
||||
GObject * gdk_event_get_user_data (const GdkEvent *event);
|
||||
|
||||
guint32 gdk_display_get_last_seen_time (GdkDisplay *display);
|
||||
|
||||
void gdk_display_set_double_click_time (GdkDisplay *display,
|
||||
@@ -40,4 +38,8 @@ PangoDirection gdk_unichar_direction (gunichar ch);
|
||||
PangoDirection gdk_find_base_dir (const char *text,
|
||||
int len);
|
||||
|
||||
void gdk_surface_set_widget (GdkSurface *surface,
|
||||
gpointer widget);
|
||||
gpointer gdk_surface_get_widget (GdkSurface *surface);
|
||||
|
||||
#endif /* __GDK__PRIVATE_H__ */
|
||||
|
||||
18
gdk/gdk.c
18
gdk/gdk.c
@@ -33,6 +33,8 @@
|
||||
|
||||
#include "gdk-private.h"
|
||||
|
||||
#include "gdkconstructor.h"
|
||||
|
||||
#ifndef HAVE_XCONVERTCASE
|
||||
#include "gdkkeysyms.h"
|
||||
#endif
|
||||
@@ -51,12 +53,12 @@
|
||||
* This section describes the GDK initialization functions and miscellaneous
|
||||
* utility functions, as well as deprecation facilities.
|
||||
*
|
||||
* The GDK and GTK+ headers annotate deprecated APIs in a way that produces
|
||||
* The GDK and GTK headers annotate deprecated APIs in a way that produces
|
||||
* compiler warnings if these deprecated APIs are used. The warnings
|
||||
* can be turned off by defining the macro %GDK_DISABLE_DEPRECATION_WARNINGS
|
||||
* before including the glib.h header.
|
||||
*
|
||||
* GDK and GTK+ also provide support for building applications against
|
||||
* GDK and GTK also provide support for building applications against
|
||||
* defined subsets of deprecated or new APIs. Define the macro
|
||||
* %GDK_VERSION_MIN_REQUIRED to specify up to what version
|
||||
* you want to receive warnings about deprecated APIs. Define the
|
||||
@@ -108,14 +110,6 @@
|
||||
* of deprecated GDK APIs.
|
||||
*/
|
||||
|
||||
typedef struct _GdkPredicate GdkPredicate;
|
||||
|
||||
struct _GdkPredicate
|
||||
{
|
||||
GdkEventFunc func;
|
||||
gpointer data;
|
||||
};
|
||||
|
||||
typedef struct _GdkThreadsDispatch GdkThreadsDispatch;
|
||||
|
||||
struct _GdkThreadsDispatch
|
||||
@@ -307,11 +301,11 @@ gdk_should_use_portal (void)
|
||||
* locked for performance reasons. So e.g. you must coordinate
|
||||
* accesses to the same #GHashTable from multiple threads.
|
||||
*
|
||||
* GTK+, however, is not thread safe. You should only use GTK+ and GDK
|
||||
* GTK, however, is not thread safe. You should only use GTK and GDK
|
||||
* from the thread gtk_init() and gtk_main() were called on.
|
||||
* This is usually referred to as the “main thread”.
|
||||
*
|
||||
* Signals on GTK+ and GDK types, as well as non-signal callbacks, are
|
||||
* Signals on GTK and GDK types, as well as non-signal callbacks, are
|
||||
* emitted in the main thread.
|
||||
*
|
||||
* You can schedule work in the main thread safely from other threads
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
*
|
||||
* [Cairo](http://cairographics.org) is a graphics
|
||||
* library that supports vector graphics and image compositing that
|
||||
* can be used with GDK. GTK+ does all of its drawing using cairo.
|
||||
* can be used with GDK and GTK.
|
||||
*
|
||||
* GDK does not wrap the cairo API, instead it allows to create cairo
|
||||
* contexts which can be used to draw on #GdkSurfaces. Additional
|
||||
|
||||
120
gdk/gdkconstructor.h
Normal file
120
gdk/gdkconstructor.h
Normal file
@@ -0,0 +1,120 @@
|
||||
/*
|
||||
If G_HAS_CONSTRUCTORS is true then the compiler support *both* constructors and
|
||||
destructors, in a sane way, including e.g. on library unload. If not you're on
|
||||
your own.
|
||||
|
||||
Some compilers need #pragma to handle this, which does not work with macros,
|
||||
so the way you need to use this is (for constructors):
|
||||
|
||||
#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
|
||||
#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(my_constructor)
|
||||
#endif
|
||||
G_DEFINE_CONSTRUCTOR(my_constructor)
|
||||
static void my_constructor(void) {
|
||||
...
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __GTK_DOC_IGNORE__
|
||||
|
||||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
|
||||
|
||||
#define G_HAS_CONSTRUCTORS 1
|
||||
|
||||
#define G_DEFINE_CONSTRUCTOR(_func) static void __attribute__((constructor)) _func (void);
|
||||
#define G_DEFINE_DESTRUCTOR(_func) static void __attribute__((destructor)) _func (void);
|
||||
|
||||
#elif defined (_MSC_VER) && (_MSC_VER >= 1500)
|
||||
/* Visual studio 2008 and later has _Pragma */
|
||||
|
||||
#define G_HAS_CONSTRUCTORS 1
|
||||
|
||||
/* We do some weird things to avoid the constructors being optimized
|
||||
* away on VS2015 if WholeProgramOptimization is enabled. First we
|
||||
* make a reference to the array from the wrapper to make sure its
|
||||
* references. Then we use a pragma to make sure the wrapper function
|
||||
* symbol is always included at the link stage. Also, the symbols
|
||||
* need to be extern (but not dllexport), even though they are not
|
||||
* really used from another object file.
|
||||
*/
|
||||
|
||||
/* We need to account for differences between the mangling of symbols
|
||||
* for Win32 (x86) and x64 programs, as symbols on Win32 are prefixed
|
||||
* with an underscore but symbols on x64 are not.
|
||||
*/
|
||||
#ifdef _WIN64
|
||||
#define G_MSVC_SYMBOL_PREFIX ""
|
||||
#else
|
||||
#define G_MSVC_SYMBOL_PREFIX "_"
|
||||
#endif
|
||||
|
||||
#define G_DEFINE_CONSTRUCTOR(_func) G_MSVC_CTOR (_func, G_MSVC_SYMBOL_PREFIX)
|
||||
#define G_DEFINE_DESTRUCTOR(_func) G_MSVC_DTOR (_func, G_MSVC_SYMBOL_PREFIX)
|
||||
|
||||
#define G_MSVC_CTOR(_func,_sym_prefix) \
|
||||
static void _func(void); \
|
||||
extern int (* _array ## _func)(void); \
|
||||
int _func ## _wrapper(void) { _func(); g_slist_find (NULL, _array ## _func); return 0; } \
|
||||
__pragma(comment(linker,"/include:" _sym_prefix # _func "_wrapper")) \
|
||||
__pragma(section(".CRT$XCU",read)) \
|
||||
__declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _wrapper;
|
||||
|
||||
#define G_MSVC_DTOR(_func,_sym_prefix) \
|
||||
static void _func(void); \
|
||||
extern int (* _array ## _func)(void); \
|
||||
int _func ## _constructor(void) { atexit (_func); g_slist_find (NULL, _array ## _func); return 0; } \
|
||||
__pragma(comment(linker,"/include:" _sym_prefix # _func "_constructor")) \
|
||||
__pragma(section(".CRT$XCU",read)) \
|
||||
__declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _constructor;
|
||||
|
||||
#elif defined (_MSC_VER)
|
||||
|
||||
#define G_HAS_CONSTRUCTORS 1
|
||||
|
||||
/* Pre Visual studio 2008 must use #pragma section */
|
||||
#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
|
||||
#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
|
||||
|
||||
#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
|
||||
section(".CRT$XCU",read)
|
||||
#define G_DEFINE_CONSTRUCTOR(_func) \
|
||||
static void _func(void); \
|
||||
static int _func ## _wrapper(void) { _func(); return 0; } \
|
||||
__declspec(allocate(".CRT$XCU")) static int (*p)(void) = _func ## _wrapper;
|
||||
|
||||
#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
|
||||
section(".CRT$XCU",read)
|
||||
#define G_DEFINE_DESTRUCTOR(_func) \
|
||||
static void _func(void); \
|
||||
static int _func ## _constructor(void) { atexit (_func); return 0; } \
|
||||
__declspec(allocate(".CRT$XCU")) static int (* _array ## _func)(void) = _func ## _constructor;
|
||||
|
||||
#elif defined(__SUNPRO_C)
|
||||
|
||||
/* This is not tested, but i believe it should work, based on:
|
||||
* http://opensource.apple.com/source/OpenSSL098/OpenSSL098-35/src/fips/fips_premain.c
|
||||
*/
|
||||
|
||||
#define G_HAS_CONSTRUCTORS 1
|
||||
|
||||
#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
|
||||
#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
|
||||
|
||||
#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
|
||||
init(_func)
|
||||
#define G_DEFINE_CONSTRUCTOR(_func) \
|
||||
static void _func(void);
|
||||
|
||||
#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
|
||||
fini(_func)
|
||||
#define G_DEFINE_DESTRUCTOR(_func) \
|
||||
static void _func(void);
|
||||
|
||||
#else
|
||||
|
||||
/* constructors not supported for this compiler */
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* __GTK_DOC_IGNORE__ */
|
||||
107
gdk/gdkdevice.c
107
gdk/gdkdevice.c
@@ -529,7 +529,7 @@ gdk_device_get_state (GdkDevice *device,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_device_get_position_double:
|
||||
* gdk_device_get_position:
|
||||
* @device: pointer device to query status about.
|
||||
* @x: (out) (allow-none): location to store root window X coordinate of @device, or %NULL.
|
||||
* @y: (out) (allow-none): location to store root window Y coordinate of @device, or %NULL.
|
||||
@@ -540,9 +540,9 @@ gdk_device_get_state (GdkDevice *device,
|
||||
* unless there is an ongoing grab on them. See gdk_device_grab().
|
||||
**/
|
||||
void
|
||||
gdk_device_get_position_double (GdkDevice *device,
|
||||
gdouble *x,
|
||||
gdouble *y)
|
||||
gdk_device_get_position (GdkDevice *device,
|
||||
double *x,
|
||||
double *y)
|
||||
{
|
||||
GdkDisplay *display;
|
||||
gdouble tmp_x, tmp_y;
|
||||
@@ -568,33 +568,7 @@ gdk_device_get_position_double (GdkDevice *device,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_device_get_position:
|
||||
* @device: pointer device to query status about.
|
||||
* @x: (out) (allow-none): location to store root window X coordinate of @device, or %NULL.
|
||||
* @y: (out) (allow-none): location to store root window Y coordinate of @device, or %NULL.
|
||||
*
|
||||
* Gets the current location of @device. As a slave device
|
||||
* coordinates are those of its master pointer, This function
|
||||
* may not be called on devices of type %GDK_DEVICE_TYPE_SLAVE,
|
||||
* unless there is an ongoing grab on them, see gdk_device_grab().
|
||||
**/
|
||||
void
|
||||
gdk_device_get_position (GdkDevice *device,
|
||||
gint *x,
|
||||
gint *y)
|
||||
{
|
||||
gdouble tmp_x, tmp_y;
|
||||
|
||||
gdk_device_get_position_double (device, &tmp_x, &tmp_y);
|
||||
if (x)
|
||||
*x = round (tmp_x);
|
||||
if (y)
|
||||
*y = round (tmp_y);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* gdk_device_get_surface_at_position_double:
|
||||
* gdk_device_get_surface_at_position:
|
||||
* @device: pointer #GdkDevice to query info to.
|
||||
* @win_x: (out) (allow-none): return location for the X coordinate of the device location,
|
||||
* relative to the surface origin, or %NULL.
|
||||
@@ -613,9 +587,9 @@ gdk_device_get_position (GdkDevice *device,
|
||||
* device position, or %NULL.
|
||||
**/
|
||||
GdkSurface *
|
||||
gdk_device_get_surface_at_position_double (GdkDevice *device,
|
||||
gdouble *win_x,
|
||||
gdouble *win_y)
|
||||
gdk_device_get_surface_at_position (GdkDevice *device,
|
||||
double *win_x,
|
||||
double *win_y)
|
||||
{
|
||||
gdouble tmp_x, tmp_y;
|
||||
GdkSurface *surface;
|
||||
@@ -642,43 +616,6 @@ gdk_device_get_surface_at_position_double (GdkDevice *device,
|
||||
return surface;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_device_get_surface_at_position:
|
||||
* @device: pointer #GdkDevice to query info to.
|
||||
* @win_x: (out) (allow-none): return location for the X coordinate of the device location,
|
||||
* relative to the surface origin, or %NULL.
|
||||
* @win_y: (out) (allow-none): return location for the Y coordinate of the device location,
|
||||
* relative to the surface origin, or %NULL.
|
||||
*
|
||||
* Obtains the surface underneath @device, returning the location of the device in @win_x and @win_y. Returns
|
||||
* %NULL if the surface tree under @device is not known to GDK (for example, belongs to another application).
|
||||
*
|
||||
* As a slave device coordinates are those of its master pointer, This
|
||||
* function may not be called on devices of type %GDK_DEVICE_TYPE_SLAVE,
|
||||
* unless there is an ongoing grab on them, see gdk_device_grab().
|
||||
*
|
||||
* Returns: (nullable) (transfer none): the #GdkSurface under the
|
||||
* device position, or %NULL.
|
||||
**/
|
||||
GdkSurface *
|
||||
gdk_device_get_surface_at_position (GdkDevice *device,
|
||||
gint *win_x,
|
||||
gint *win_y)
|
||||
{
|
||||
gdouble tmp_x, tmp_y;
|
||||
GdkSurface *surface;
|
||||
|
||||
surface =
|
||||
gdk_device_get_surface_at_position_double (device, &tmp_x, &tmp_y);
|
||||
|
||||
if (win_x)
|
||||
*win_x = round (tmp_x);
|
||||
if (win_y)
|
||||
*win_y = round (tmp_y);
|
||||
|
||||
return surface;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_device_get_history: (skip)
|
||||
* @device: a #GdkDevice
|
||||
@@ -1425,34 +1362,6 @@ gdk_device_ungrab (GdkDevice *device,
|
||||
GDK_DEVICE_GET_CLASS (device)->ungrab (device, time_);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_device_warp:
|
||||
* @device: the device to warp.
|
||||
* @x: the X coordinate of the destination.
|
||||
* @y: the Y coordinate of the destination.
|
||||
*
|
||||
* Warps @device in @display to the point @x,@y,
|
||||
* unless the device is confined to a surface by a grab,
|
||||
* in which case it will be moved
|
||||
* as far as allowed by the grab. Warping the pointer
|
||||
* creates events as if the user had moved the mouse
|
||||
* instantaneously to the destination.
|
||||
*
|
||||
* Note that the pointer should normally be under the
|
||||
* control of the user. This function was added to cover
|
||||
* some rare use cases like keyboard navigation support
|
||||
* for the color picker in the #GtkColorSelectionDialog.
|
||||
**/
|
||||
void
|
||||
gdk_device_warp (GdkDevice *device,
|
||||
gint x,
|
||||
gint y)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_DEVICE (device));
|
||||
|
||||
GDK_DEVICE_GET_CLASS (device)->warp (device, x, y);
|
||||
}
|
||||
|
||||
/* Private API */
|
||||
void
|
||||
_gdk_device_reset_axes (GdkDevice *device)
|
||||
|
||||
@@ -167,25 +167,13 @@ void gdk_device_get_state (GdkDevice *device,
|
||||
gdouble *axes,
|
||||
GdkModifierType *mask);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_device_get_position (GdkDevice *device,
|
||||
gint *x,
|
||||
gint *y);
|
||||
void gdk_device_get_position (GdkDevice *device,
|
||||
double *x,
|
||||
double *y);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkSurface *
|
||||
gdk_device_get_surface_at_position
|
||||
(GdkDevice *device,
|
||||
gint *win_x,
|
||||
gint *win_y);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_device_get_position_double (GdkDevice *device,
|
||||
gdouble *x,
|
||||
gdouble *y);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkSurface *
|
||||
gdk_device_get_surface_at_position_double
|
||||
(GdkDevice *device,
|
||||
gdouble *win_x,
|
||||
gdouble *win_y);
|
||||
GdkSurface * gdk_device_get_surface_at_position (GdkDevice *device,
|
||||
double *win_x,
|
||||
double *win_y);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_device_get_history (GdkDevice *device,
|
||||
GdkSurface *surface,
|
||||
@@ -236,11 +224,6 @@ GDK_DEPRECATED_FOR(gdk_seat_ungrab)
|
||||
void gdk_device_ungrab (GdkDevice *device,
|
||||
guint32 time_);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_device_warp (GdkDevice *device,
|
||||
gint x,
|
||||
gint y);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkSurface *gdk_device_get_last_event_surface (GdkDevice *device);
|
||||
|
||||
|
||||
@@ -86,9 +86,6 @@ struct _GdkDeviceClass
|
||||
GdkSurface *surface,
|
||||
GdkCursor *cursor);
|
||||
|
||||
void (* warp) (GdkDevice *device,
|
||||
gdouble x,
|
||||
gdouble y);
|
||||
void (* query_state) (GdkDevice *device,
|
||||
GdkSurface *surface,
|
||||
GdkSurface **child_surface,
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
*
|
||||
* You can use gdk_display_manager_get() to obtain the #GdkDisplayManager
|
||||
* singleton, but that should be rarely necessary. Typically, initializing
|
||||
* GTK+ opens a display that you can work with without ever accessing the
|
||||
* GTK opens a display that you can work with without ever accessing the
|
||||
* #GdkDisplayManager.
|
||||
*
|
||||
* The GDK library can be built with support for multiple backends.
|
||||
|
||||
104
gdk/gdkevents.c
104
gdk/gdkevents.c
@@ -67,10 +67,6 @@
|
||||
/* Private variable declarations
|
||||
*/
|
||||
|
||||
static GdkEventFunc _gdk_event_func = NULL; /* Callback for events */
|
||||
static gpointer _gdk_event_data = NULL;
|
||||
static GDestroyNotify _gdk_event_notify = NULL;
|
||||
|
||||
static void gdk_event_constructed (GObject *object);
|
||||
static void gdk_event_finalize (GObject *object);
|
||||
|
||||
@@ -153,14 +149,16 @@ gdk_event_class_init (GdkEventClass *klass)
|
||||
void
|
||||
_gdk_event_emit (GdkEvent *event)
|
||||
{
|
||||
if (gdk_event_get_event_type (event) == GDK_NOTHING)
|
||||
{
|
||||
g_warning ("Ignoring GDK_NOTHING events; they're good for nothing");
|
||||
return;
|
||||
}
|
||||
|
||||
if (gdk_drag_handle_source_event (event))
|
||||
return;
|
||||
|
||||
if (gdk_surface_handle_event (event))
|
||||
return;
|
||||
|
||||
if (_gdk_event_func)
|
||||
(*_gdk_event_func) (event, _gdk_event_data);
|
||||
gdk_surface_handle_event (event);
|
||||
}
|
||||
|
||||
/*********************************************
|
||||
@@ -415,33 +413,6 @@ _gdk_event_queue_flush (GdkDisplay *display)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_event_handler_set:
|
||||
* @func: the function to call to handle events from GDK.
|
||||
* @data: user data to pass to the function.
|
||||
* @notify: the function to call when the handler function is removed, i.e. when
|
||||
* gdk_event_handler_set() is called with another event handler.
|
||||
*
|
||||
* Sets the function to call to handle all events from GDK.
|
||||
*
|
||||
* Note that GTK+ uses this to install its own event handler, so it is
|
||||
* usually not useful for GTK+ applications. (Although an application
|
||||
* can call this function then call gtk_main_do_event() to pass
|
||||
* events to GTK+.)
|
||||
**/
|
||||
void
|
||||
gdk_event_handler_set (GdkEventFunc func,
|
||||
gpointer data,
|
||||
GDestroyNotify notify)
|
||||
{
|
||||
if (_gdk_event_notify)
|
||||
(*_gdk_event_notify) (_gdk_event_data);
|
||||
|
||||
_gdk_event_func = func;
|
||||
_gdk_event_data = data;
|
||||
_gdk_event_notify = notify;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_event_new:
|
||||
* @type: a #GdkEventType
|
||||
@@ -593,8 +564,8 @@ gdk_event_copy (const GdkEvent *event)
|
||||
g_object_ref (new_event->any.device);
|
||||
if (new_event->any.source_device)
|
||||
g_object_ref (new_event->any.source_device);
|
||||
if (new_event->any.user_data)
|
||||
g_object_ref (new_event->any.user_data);
|
||||
if (new_event->any.target)
|
||||
g_object_ref (new_event->any.target);
|
||||
|
||||
switch ((guint) event->any.type)
|
||||
{
|
||||
@@ -602,6 +573,13 @@ gdk_event_copy (const GdkEvent *event)
|
||||
case GDK_LEAVE_NOTIFY:
|
||||
if (event->crossing.child_surface != NULL)
|
||||
g_object_ref (event->crossing.child_surface);
|
||||
if (event->crossing.related_target)
|
||||
g_object_ref (event->crossing.related_target);
|
||||
break;
|
||||
|
||||
case GDK_FOCUS_CHANGE:
|
||||
if (event->focus_change.related_target)
|
||||
g_object_ref (event->focus_change.related_target);
|
||||
break;
|
||||
|
||||
case GDK_DRAG_ENTER:
|
||||
@@ -663,6 +641,11 @@ gdk_event_finalize (GObject *object)
|
||||
case GDK_ENTER_NOTIFY:
|
||||
case GDK_LEAVE_NOTIFY:
|
||||
g_clear_object (&event->crossing.child_surface);
|
||||
g_clear_object (&event->crossing.related_target);
|
||||
break;
|
||||
|
||||
case GDK_FOCUS_CHANGE:
|
||||
g_clear_object (&event->focus_change.related_target);
|
||||
break;
|
||||
|
||||
case GDK_DRAG_ENTER:
|
||||
@@ -704,7 +687,7 @@ gdk_event_finalize (GObject *object)
|
||||
|
||||
g_clear_object (&event->any.device);
|
||||
g_clear_object (&event->any.source_device);
|
||||
g_clear_object (&event->any.user_data);
|
||||
g_clear_object (&event->any.target);
|
||||
|
||||
G_OBJECT_CLASS (gdk_event_parent_class)->finalize (object);
|
||||
}
|
||||
@@ -1933,16 +1916,39 @@ gdk_event_get_scancode (GdkEvent *event)
|
||||
}
|
||||
|
||||
void
|
||||
gdk_event_set_user_data (GdkEvent *event,
|
||||
GObject *user_data)
|
||||
gdk_event_set_target (GdkEvent *event,
|
||||
GObject *target)
|
||||
{
|
||||
g_set_object (&event->any.user_data, user_data);
|
||||
g_set_object (&event->any.target, target);
|
||||
}
|
||||
|
||||
GObject *
|
||||
gdk_event_get_user_data (const GdkEvent *event)
|
||||
gdk_event_get_target (const GdkEvent *event)
|
||||
{
|
||||
return event->any.user_data;
|
||||
return event->any.target;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_event_set_related_target (GdkEvent *event,
|
||||
GObject *target)
|
||||
{
|
||||
if (event->any.type == GDK_ENTER_NOTIFY ||
|
||||
event->any.type == GDK_LEAVE_NOTIFY)
|
||||
g_set_object (&event->crossing.related_target, target);
|
||||
else if (event->any.type == GDK_FOCUS_CHANGE)
|
||||
g_set_object (&event->focus_change.related_target, target);
|
||||
}
|
||||
|
||||
GObject *
|
||||
gdk_event_get_related_target (const GdkEvent *event)
|
||||
{
|
||||
if (event->any.type == GDK_ENTER_NOTIFY ||
|
||||
event->any.type == GDK_LEAVE_NOTIFY)
|
||||
return event->crossing.related_target;
|
||||
else if (event->any.type == GDK_FOCUS_CHANGE)
|
||||
return event->focus_change.related_target;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2009,6 +2015,11 @@ gdk_event_get_crossing_mode (const GdkEvent *event,
|
||||
*mode = event->crossing.mode;
|
||||
return TRUE;
|
||||
}
|
||||
else if (event->any.type == GDK_FOCUS_CHANGE)
|
||||
{
|
||||
*mode = event->focus_change.mode;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@@ -2035,6 +2046,11 @@ gdk_event_get_crossing_detail (const GdkEvent *event,
|
||||
*detail = event->crossing.detail;
|
||||
return TRUE;
|
||||
}
|
||||
else if (event->any.type == GDK_FOCUS_CHANGE)
|
||||
{
|
||||
*detail = event->focus_change.detail;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -125,18 +125,6 @@ typedef struct _GdkEventPadGroupMode GdkEventPadGroupMode;
|
||||
typedef struct _GdkEventSequence GdkEventSequence;
|
||||
typedef union _GdkEvent GdkEvent;
|
||||
|
||||
/**
|
||||
* GdkEventFunc:
|
||||
* @event: the #GdkEvent to process.
|
||||
* @data: (closure): user data set when the event handler was installed with
|
||||
* gdk_event_handler_set().
|
||||
*
|
||||
* Specifies the type of function passed to gdk_event_handler_set() to
|
||||
* handle all GDK events.
|
||||
*/
|
||||
typedef void (*GdkEventFunc) (GdkEvent *event,
|
||||
gpointer data);
|
||||
|
||||
/**
|
||||
* GdkEventType:
|
||||
* @GDK_NOTHING: a special code to indicate a null event.
|
||||
@@ -446,11 +434,6 @@ gboolean gdk_events_get_center (GdkEvent *event1,
|
||||
gdouble *x,
|
||||
gdouble *y);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_event_handler_set (GdkEventFunc func,
|
||||
gpointer data,
|
||||
GDestroyNotify notify);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_event_set_display (GdkEvent *event,
|
||||
GdkDisplay *display);
|
||||
|
||||
@@ -61,7 +61,7 @@ struct _GdkEventAny
|
||||
GdkDevice *device;
|
||||
GdkDevice *source_device;
|
||||
GdkDisplay *display;
|
||||
GObject *user_data;
|
||||
GObject *target;
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -303,6 +303,7 @@ struct _GdkEventCrossing
|
||||
GdkNotifyType detail;
|
||||
gboolean focus;
|
||||
guint state;
|
||||
GObject *related_target;
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -312,6 +313,8 @@ struct _GdkEventCrossing
|
||||
* @send_event: %TRUE if the event was sent explicitly.
|
||||
* @in: %TRUE if the surface has gained the keyboard focus, %FALSE if
|
||||
* it has lost the focus.
|
||||
* @mode: the crossing mode
|
||||
* @detail: the kind of crossing that happened
|
||||
*
|
||||
* Describes a change of keyboard focus.
|
||||
*/
|
||||
@@ -319,6 +322,9 @@ struct _GdkEventFocus
|
||||
{
|
||||
GdkEventAny any;
|
||||
gint16 in;
|
||||
GdkCrossingMode mode;
|
||||
GdkNotifyType detail;
|
||||
GObject *related_target;
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -632,8 +638,12 @@ union _GdkEvent
|
||||
GdkEventPadGroupMode pad_group_mode;
|
||||
};
|
||||
|
||||
void gdk_event_set_user_data (GdkEvent *event,
|
||||
GObject *user_data);
|
||||
void gdk_event_set_target (GdkEvent *event,
|
||||
GObject *user_data);
|
||||
GObject * gdk_event_get_target (const GdkEvent *event);
|
||||
void gdk_event_set_related_target (GdkEvent *event,
|
||||
GObject *user_data);
|
||||
GObject * gdk_event_get_related_target (const GdkEvent *event);
|
||||
|
||||
|
||||
#endif /* __GDK_EVENTS_PRIVATE_H__ */
|
||||
|
||||
@@ -179,7 +179,7 @@ gdk_frame_clock_class_init (GdkFrameClockClass *klass)
|
||||
* This signal is emitted as the second step of toolkit and
|
||||
* application processing of the frame. Any work to update
|
||||
* sizes and positions of application elements should be
|
||||
* performed. GTK+ normally handles this internally.
|
||||
* performed. GTK normally handles this internally.
|
||||
*/
|
||||
signals[LAYOUT] =
|
||||
g_signal_new (g_intern_static_string ("layout"),
|
||||
@@ -197,7 +197,7 @@ gdk_frame_clock_class_init (GdkFrameClockClass *klass)
|
||||
* This signal is emitted as the third step of toolkit and
|
||||
* application processing of the frame. The frame is
|
||||
* repainted. GDK normally handles this internally and
|
||||
* produces expose events, which are turned into GTK+
|
||||
* produces expose events, which are turned into GTK
|
||||
* #GtkWidget::draw signals.
|
||||
*/
|
||||
signals[PAINT] =
|
||||
@@ -230,7 +230,7 @@ gdk_frame_clock_class_init (GdkFrameClockClass *klass)
|
||||
* @clock: the frame clock emitting the signal
|
||||
*
|
||||
* This signal is emitted after processing of the frame is
|
||||
* finished, and is handled internally by GTK+ to resume normal
|
||||
* finished, and is handled internally by GTK to resume normal
|
||||
* event processing. Applications should not handle this signal.
|
||||
*/
|
||||
signals[RESUME_EVENTS] =
|
||||
@@ -289,7 +289,7 @@ gdk_frame_clock_get_frame_time (GdkFrameClock *frame_clock)
|
||||
* content and want to continually request the
|
||||
* %GDK_FRAME_CLOCK_PHASE_UPDATE phase for a period of time,
|
||||
* you should use gdk_frame_clock_begin_updating() instead, since
|
||||
* this allows GTK+ to adjust system parameters to get maximally
|
||||
* this allows GTK to adjust system parameters to get maximally
|
||||
* smooth animations.
|
||||
*/
|
||||
void
|
||||
|
||||
@@ -298,7 +298,7 @@ gdk_gl_texture_quads (GdkGLContext *paint_context,
|
||||
* @width: The width of the region to draw
|
||||
* @height: The height of the region to draw
|
||||
*
|
||||
* This is the main way to draw GL content in GTK+. It takes a render buffer ID
|
||||
* This is the main way to draw GL content in GTK. It takes a render buffer ID
|
||||
* (@source_type == #GL_RENDERBUFFER) or a texture id (@source_type == #GL_TEXTURE)
|
||||
* and draws it onto @cr with an OVER operation, respecting the current clip.
|
||||
* The top left corner of the rectangle specified by @x, @y, @width and @height
|
||||
|
||||
@@ -145,7 +145,7 @@ struct _GdkSurface
|
||||
GdkSurface *parent;
|
||||
GdkSurface *transient_for;
|
||||
|
||||
gpointer user_data;
|
||||
gpointer widget;
|
||||
|
||||
gint x;
|
||||
gint y;
|
||||
|
||||
@@ -264,7 +264,7 @@ gdk_seat_get_capabilities (GdkSeat *seat)
|
||||
* commonly.
|
||||
*
|
||||
* Grabs are used for operations which need complete control over the
|
||||
* events corresponding to the given capabilities. For example in GTK+ this
|
||||
* events corresponding to the given capabilities. For example in GTK this
|
||||
* is used for Drag and Drop operations, popup menus and such.
|
||||
*
|
||||
* Note that if the event mask of a #GdkSurface has selected both button press
|
||||
@@ -350,7 +350,7 @@ gdk_seat_get_slaves (GdkSeat *seat,
|
||||
* Returns the master device that routes pointer events.
|
||||
*
|
||||
* Returns: (transfer none) (nullable): a master #GdkDevice with pointer
|
||||
* capabilities. This object is owned by GTK+ and must not be freed.
|
||||
* capabilities. This object is owned by GTK and must not be freed.
|
||||
**/
|
||||
GdkDevice *
|
||||
gdk_seat_get_pointer (GdkSeat *seat)
|
||||
@@ -370,7 +370,7 @@ gdk_seat_get_pointer (GdkSeat *seat)
|
||||
* Returns the master device that routes keyboard events.
|
||||
*
|
||||
* Returns: (transfer none) (nullable): a master #GdkDevice with keyboard
|
||||
* capabilities. This object is owned by GTK+ and must not be freed.
|
||||
* capabilities. This object is owned by GTK and must not be freed.
|
||||
**/
|
||||
GdkDevice *
|
||||
gdk_seat_get_keyboard (GdkSeat *seat)
|
||||
@@ -405,7 +405,7 @@ gdk_seat_device_removed (GdkSeat *seat,
|
||||
*
|
||||
* Returns the #GdkDisplay this seat belongs to.
|
||||
*
|
||||
* Returns: (transfer none): a #GdkDisplay. This object is owned by GTK+
|
||||
* Returns: (transfer none): a #GdkDisplay. This object is owned by GTK
|
||||
* and must not be freed.
|
||||
**/
|
||||
GdkDisplay *
|
||||
|
||||
3098
gdk/gdksurface.c
3098
gdk/gdksurface.c
File diff suppressed because it is too large
Load Diff
@@ -491,9 +491,6 @@ GDK_AVAILABLE_IN_ALL
|
||||
void gdk_surface_focus (GdkSurface *surface,
|
||||
guint32 timestamp);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_surface_set_user_data (GdkSurface *surface,
|
||||
gpointer user_data);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_surface_get_accept_focus (GdkSurface *surface);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_surface_set_accept_focus (GdkSurface *surface,
|
||||
@@ -573,9 +570,6 @@ GDK_AVAILABLE_IN_ALL
|
||||
void gdk_surface_set_title (GdkSurface *surface,
|
||||
const gchar *title);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_surface_set_role (GdkSurface *surface,
|
||||
const gchar *role);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_surface_set_startup_id (GdkSurface *surface,
|
||||
const gchar *startup_id);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
@@ -595,9 +589,6 @@ GDK_AVAILABLE_IN_ALL
|
||||
GdkCursor *gdk_surface_get_device_cursor (GdkSurface *surface,
|
||||
GdkDevice *device);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_surface_get_user_data (GdkSurface *surface,
|
||||
gpointer *data);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_surface_get_geometry (GdkSurface *surface,
|
||||
gint *x,
|
||||
gint *y,
|
||||
@@ -646,18 +637,12 @@ GDK_AVAILABLE_IN_ALL
|
||||
gint gdk_surface_get_scale_factor (GdkSurface *surface);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkSurface * gdk_surface_get_device_position (GdkSurface *surface,
|
||||
GdkSurface * gdk_surface_get_device_position (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
gint *x,
|
||||
gint *y,
|
||||
double *x,
|
||||
double *y,
|
||||
GdkModifierType *mask);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkSurface * gdk_surface_get_device_position_double (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
gdouble *x,
|
||||
gdouble *y,
|
||||
GdkModifierType *mask);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkSurface * gdk_surface_get_parent (GdkSurface *surface);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkSurface * gdk_surface_get_toplevel (GdkSurface *surface);
|
||||
@@ -666,9 +651,6 @@ GDK_AVAILABLE_IN_ALL
|
||||
GList * gdk_surface_get_children (GdkSurface *surface);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GList * gdk_surface_peek_children (GdkSurface *surface);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GList * gdk_surface_get_children_with_user_data (GdkSurface *surface,
|
||||
gpointer user_data);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_surface_set_icon_list (GdkSurface *surface,
|
||||
@@ -740,31 +722,31 @@ void gdk_surface_register_dnd (GdkSurface *surface);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_surface_begin_resize_drag (GdkSurface *surface,
|
||||
GdkSurfaceEdge edge,
|
||||
gint button,
|
||||
gint root_x,
|
||||
gint root_y,
|
||||
guint32 timestamp);
|
||||
gint button,
|
||||
gint x,
|
||||
gint y,
|
||||
guint32 timestamp);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_surface_begin_resize_drag_for_device (GdkSurface *surface,
|
||||
GdkSurfaceEdge edge,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint root_x,
|
||||
gint root_y,
|
||||
guint32 timestamp);
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint x,
|
||||
gint y,
|
||||
guint32 timestamp);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_surface_begin_move_drag (GdkSurface *surface,
|
||||
gint button,
|
||||
gint root_x,
|
||||
gint root_y,
|
||||
guint32 timestamp);
|
||||
gint button,
|
||||
gint x,
|
||||
gint y,
|
||||
guint32 timestamp);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_surface_begin_move_drag_for_device (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint root_x,
|
||||
gint root_y,
|
||||
guint32 timestamp);
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint x,
|
||||
gint y,
|
||||
guint32 timestamp);
|
||||
|
||||
/* Interface for dirty-region queueing */
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
|
||||
@@ -136,8 +136,6 @@ struct _GdkSurfaceImplClass
|
||||
GdkSurfaceHints geom_mask);
|
||||
void (* set_title) (GdkSurface *surface,
|
||||
const gchar *title);
|
||||
void (* set_role) (GdkSurface *surface,
|
||||
const gchar *role);
|
||||
void (* set_startup_id) (GdkSurface *surface,
|
||||
const gchar *startup_id);
|
||||
void (* set_transient_for) (GdkSurface *surface,
|
||||
|
||||
@@ -200,7 +200,7 @@ typedef enum
|
||||
* @GDK_HYPER_MASK: the Hyper modifier
|
||||
* @GDK_META_MASK: the Meta modifier
|
||||
* @GDK_MODIFIER_RESERVED_29_MASK: A reserved bit flag; do not use in your own code
|
||||
* @GDK_RELEASE_MASK: not used in GDK itself. GTK+ uses it to differentiate
|
||||
* @GDK_RELEASE_MASK: not used in GDK itself. GTK uses it to differentiate
|
||||
* between (keyval, modifiers) pairs from key press and release events.
|
||||
* @GDK_MODIFIER_MASK: a mask covering all modifier types.
|
||||
*
|
||||
@@ -454,7 +454,7 @@ typedef enum {
|
||||
* GdkSurfaceTypeHint:
|
||||
* @GDK_SURFACE_TYPE_HINT_NORMAL: Normal toplevel window.
|
||||
* @GDK_SURFACE_TYPE_HINT_DIALOG: Dialog window.
|
||||
* @GDK_SURFACE_TYPE_HINT_MENU: Window used to implement a menu; GTK+ uses
|
||||
* @GDK_SURFACE_TYPE_HINT_MENU: Window used to implement a menu; GTK uses
|
||||
* this hint only for torn-off menus, see #GtkTearoffMenuItem.
|
||||
* @GDK_SURFACE_TYPE_HINT_TOOLBAR: Window used to implement toolbars.
|
||||
* @GDK_SURFACE_TYPE_HINT_SPLASHSCREEN: Window used to display a splash
|
||||
@@ -514,7 +514,7 @@ typedef enum
|
||||
*
|
||||
* An enumeration describing the way in which a device
|
||||
* axis (valuator) maps onto the predefined valuator
|
||||
* types that GTK+ understands.
|
||||
* types that GTK understands.
|
||||
*
|
||||
* Note that the X and Y axes are not really needed; pointer devices
|
||||
* report their location via the x/y members of events regardless. Whether
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
*
|
||||
* A macro that should be defined before including the gdk.h header.
|
||||
* If it is defined, no compiler warnings will be produced for uses
|
||||
* of deprecated GDK and GTK+ APIs.
|
||||
* of deprecated GDK and GTK APIs.
|
||||
*/
|
||||
|
||||
#ifdef GDK_DISABLE_DEPRECATION_WARNINGS
|
||||
@@ -54,6 +54,7 @@
|
||||
|
||||
#define GDK_VERSION_3_92 (G_ENCODE_VERSION (3, 92))
|
||||
#define GDK_VERSION_3_94 (G_ENCODE_VERSION (3, 94))
|
||||
|
||||
/**
|
||||
* GDK_VERSION_4_0:
|
||||
*
|
||||
@@ -137,6 +138,13 @@
|
||||
# define GDK_AVAILABLE_IN_4_0 _GDK_EXTERN
|
||||
#endif
|
||||
|
||||
#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_92
|
||||
# define GDK_DEPRECATED_IN_4_0 GDK_DEPRECATED
|
||||
# define GDK_DEPRECATED_IN_4_0_FOR(f) GDK_DEPRECATED_FOR(f)
|
||||
#else
|
||||
# define GDK_DEPRECATED_IN_4_0 _GDK_EXTERN
|
||||
# define GDK_DEPRECATED_IN_4_0_FOR(f) _GDK_EXTERN
|
||||
#endif
|
||||
|
||||
#endif /* __GDK_VERSION_MACROS_H__ */
|
||||
|
||||
|
||||
@@ -1008,7 +1008,7 @@ gdk_display_create_vulkan_instance (GdkDisplay *display,
|
||||
.pNext = NULL,
|
||||
.pApplicationName = g_get_application_name (),
|
||||
.applicationVersion = 0,
|
||||
.pEngineName = "GTK+",
|
||||
.pEngineName = "GTK",
|
||||
.engineVersion = VK_MAKE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION, GDK_MICRO_VERSION),
|
||||
.apiVersion = VK_API_VERSION_1_0
|
||||
},
|
||||
|
||||
@@ -160,6 +160,7 @@ gdkx11_inc = include_directories('x11')
|
||||
gdkwayland_inc = include_directories('wayland')
|
||||
|
||||
wlinc = include_directories('.')
|
||||
win32rcinc = include_directories('win32/rc')
|
||||
|
||||
gdk_gen_headers = [gdkenum_h, gdkmarshal_h, gdkconfig, gdkversionmacros]
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ gdk_quartz_device_core_get_state (GdkDevice *device,
|
||||
{
|
||||
gdouble x_pos, y_pos;
|
||||
|
||||
gdk_surface_get_device_position_double (window, device, &x_pos, &y_pos, mask);
|
||||
gdk_surface_get_device_position (window, device, &x_pos, &y_pos, mask);
|
||||
|
||||
if (axes)
|
||||
{
|
||||
|
||||
@@ -1739,17 +1739,6 @@ gdk_quartz_surface_set_title (GdkSurface *window,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_quartz_surface_set_role (GdkSurface *window,
|
||||
const gchar *role)
|
||||
{
|
||||
if (GDK_SURFACE_DESTROYED (window) ||
|
||||
SURFACE_IS_TOPLEVEL (window))
|
||||
return;
|
||||
|
||||
/* FIXME: Implement */
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_quartz_surface_set_startup_id (GdkSurface *window,
|
||||
const gchar *startup_id)
|
||||
@@ -2754,7 +2743,6 @@ gdk_surface_impl_quartz_class_init (GdkSurfaceImplQuartzClass *klass)
|
||||
impl_class->set_urgency_hint = gdk_quartz_surface_set_urgency_hint;
|
||||
impl_class->set_geometry_hints = gdk_quartz_surface_set_geometry_hints;
|
||||
impl_class->set_title = gdk_quartz_surface_set_title;
|
||||
impl_class->set_role = gdk_quartz_surface_set_role;
|
||||
impl_class->set_startup_id = gdk_quartz_surface_set_startup_id;
|
||||
impl_class->set_transient_for = gdk_quartz_surface_set_transient_for;
|
||||
impl_class->get_frame_extents = gdk_quartz_surface_get_frame_extents;
|
||||
|
||||
@@ -321,7 +321,7 @@ gdk_wayland_device_get_state (GdkDevice *device,
|
||||
{
|
||||
gdouble x, y;
|
||||
|
||||
gdk_surface_get_device_position_double (surface, device, &x, &y, mask);
|
||||
gdk_surface_get_device_position (surface, device, &x, &y, mask);
|
||||
|
||||
if (axes)
|
||||
{
|
||||
@@ -517,13 +517,6 @@ gdk_wayland_device_set_surface_cursor (GdkDevice *device,
|
||||
gdk_wayland_device_update_surface_cursor (device);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_device_warp (GdkDevice *device,
|
||||
gdouble x,
|
||||
gdouble y)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
get_coordinates (GdkDevice *device,
|
||||
double *x,
|
||||
@@ -621,9 +614,9 @@ emulate_crossing (GdkSurface *surface,
|
||||
gdk_event_set_device (event, device);
|
||||
gdk_event_set_source_device (event, device);
|
||||
|
||||
gdk_surface_get_device_position_double (surface, device,
|
||||
&event->crossing.x, &event->crossing.y,
|
||||
&event->crossing.state);
|
||||
gdk_surface_get_device_position (surface, device,
|
||||
&event->crossing.x, &event->crossing.y,
|
||||
&event->crossing.state);
|
||||
event->crossing.x_root = event->crossing.x;
|
||||
event->crossing.y_root = event->crossing.y;
|
||||
|
||||
@@ -871,7 +864,6 @@ gdk_wayland_device_class_init (GdkWaylandDeviceClass *klass)
|
||||
device_class->get_history = gdk_wayland_device_get_history;
|
||||
device_class->get_state = gdk_wayland_device_get_state;
|
||||
device_class->set_surface_cursor = gdk_wayland_device_set_surface_cursor;
|
||||
device_class->warp = gdk_wayland_device_warp;
|
||||
device_class->query_state = gdk_wayland_device_query_state;
|
||||
device_class->grab = gdk_wayland_device_grab;
|
||||
device_class->ungrab = gdk_wayland_device_ungrab;
|
||||
|
||||
@@ -2447,8 +2447,7 @@ gdk_wayland_surface_map (GdkSurface *surface)
|
||||
GDK_SURFACE_IMPL_WAYLAND (attached_grab_surface->impl);
|
||||
grab_device = gdk_seat_get_pointer (attached_impl->grab_input_seat);
|
||||
transient_for =
|
||||
gdk_device_get_surface_at_position (grab_device,
|
||||
NULL, NULL);
|
||||
gdk_device_get_surface_at_position (grab_device, NULL, NULL);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -2465,8 +2464,13 @@ gdk_wayland_surface_map (GdkSurface *surface)
|
||||
* position of the device that holds the grab.
|
||||
*/
|
||||
if (impl->position_method == POSITION_METHOD_NONE && grab_device)
|
||||
gdk_surface_get_device_position (transient_for, grab_device,
|
||||
&surface->x, &surface->y, NULL);
|
||||
{
|
||||
double px, py;
|
||||
gdk_surface_get_device_position (transient_for, grab_device,
|
||||
&px, &py, NULL);
|
||||
surface->x = round (px);
|
||||
surface->y = round (py);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3182,12 +3186,6 @@ gdk_wayland_surface_set_title (GdkSurface *surface,
|
||||
gdk_wayland_surface_sync_title (surface);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_surface_set_role (GdkSurface *surface,
|
||||
const gchar *role)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_surface_set_startup_id (GdkSurface *surface,
|
||||
const gchar *startup_id)
|
||||
@@ -3556,8 +3554,8 @@ gdk_wayland_surface_begin_resize_drag (GdkSurface *surface,
|
||||
GdkSurfaceEdge edge,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint root_x,
|
||||
gint root_y,
|
||||
gint x,
|
||||
gint y,
|
||||
guint32 timestamp)
|
||||
{
|
||||
GdkSurfaceImplWayland *impl;
|
||||
@@ -3646,8 +3644,8 @@ static void
|
||||
gdk_wayland_surface_begin_move_drag (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint root_x,
|
||||
gint root_y,
|
||||
gint x,
|
||||
gint y,
|
||||
guint32 timestamp)
|
||||
{
|
||||
GdkSurfaceImplWayland *impl;
|
||||
@@ -3854,7 +3852,6 @@ _gdk_surface_impl_wayland_class_init (GdkSurfaceImplWaylandClass *klass)
|
||||
impl_class->set_urgency_hint = gdk_wayland_surface_set_urgency_hint;
|
||||
impl_class->set_geometry_hints = gdk_wayland_surface_set_geometry_hints;
|
||||
impl_class->set_title = gdk_wayland_surface_set_title;
|
||||
impl_class->set_role = gdk_wayland_surface_set_role;
|
||||
impl_class->set_startup_id = gdk_wayland_surface_set_startup_id;
|
||||
impl_class->set_transient_for = gdk_wayland_surface_set_transient_for;
|
||||
impl_class->get_frame_extents = gdk_wayland_surface_get_frame_extents;
|
||||
|
||||
@@ -112,14 +112,6 @@ gdk_device_virtual_set_surface_cursor (GdkDevice *device,
|
||||
g_set_object (&GDK_SURFACE_IMPL_WIN32 (window->impl)->cursor, win32_hcursor);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_device_virtual_warp (GdkDevice *device,
|
||||
gdouble x,
|
||||
gdouble y)
|
||||
{
|
||||
SetCursorPos (x - _gdk_offset_x, y - _gdk_offset_y);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_device_virtual_query_state (GdkDevice *device,
|
||||
GdkSurface *window,
|
||||
@@ -198,7 +190,6 @@ gdk_device_virtual_class_init (GdkDeviceVirtualClass *klass)
|
||||
device_class->get_history = gdk_device_virtual_get_history;
|
||||
device_class->get_state = gdk_device_virtual_get_state;
|
||||
device_class->set_surface_cursor = gdk_device_virtual_set_surface_cursor;
|
||||
device_class->warp = gdk_device_virtual_warp;
|
||||
device_class->query_state = gdk_device_virtual_query_state;
|
||||
device_class->grab = gdk_device_virtual_grab;
|
||||
device_class->ungrab = gdk_device_virtual_ungrab;
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include <windowsx.h>
|
||||
#include <objbase.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "gdkdevice-win32.h"
|
||||
#include "gdkwin32.h"
|
||||
@@ -45,14 +46,14 @@ gdk_device_win32_get_state (GdkDevice *device,
|
||||
gdouble *axes,
|
||||
GdkModifierType *mask)
|
||||
{
|
||||
gint x_int, y_int;
|
||||
double x, y;
|
||||
|
||||
gdk_surface_get_device_position (window, device, &x_int, &y_int, mask);
|
||||
gdk_surface_get_device_position (window, device, &x, &y, mask);
|
||||
|
||||
if (axes)
|
||||
{
|
||||
axes[0] = x_int;
|
||||
axes[1] = y_int;
|
||||
axes[0] = round (x);
|
||||
axes[1] = round (y);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,13 +64,6 @@ gdk_device_win32_set_surface_cursor (GdkDevice *device,
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_device_win32_warp (GdkDevice *device,
|
||||
gdouble x,
|
||||
gdouble y)
|
||||
{
|
||||
}
|
||||
|
||||
static GdkModifierType
|
||||
get_current_mask (void)
|
||||
{
|
||||
@@ -286,7 +280,6 @@ gdk_device_win32_class_init (GdkDeviceWin32Class *klass)
|
||||
device_class->get_history = gdk_device_win32_get_history;
|
||||
device_class->get_state = gdk_device_win32_get_state;
|
||||
device_class->set_surface_cursor = gdk_device_win32_set_surface_cursor;
|
||||
device_class->warp = gdk_device_win32_warp;
|
||||
device_class->query_state = gdk_device_win32_query_state;
|
||||
device_class->grab = gdk_device_win32_grab;
|
||||
device_class->ungrab = gdk_device_win32_ungrab;
|
||||
|
||||
@@ -99,13 +99,6 @@ gdk_device_wintab_set_surface_cursor (GdkDevice *device,
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_device_wintab_warp (GdkDevice *device,
|
||||
gdouble x,
|
||||
gdouble y)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_device_wintab_query_state (GdkDevice *device,
|
||||
GdkSurface *window,
|
||||
@@ -291,7 +284,6 @@ gdk_device_wintab_class_init (GdkDeviceWintabClass *klass)
|
||||
device_class->get_history = gdk_device_wintab_get_history;
|
||||
device_class->get_state = gdk_device_wintab_get_state;
|
||||
device_class->set_surface_cursor = gdk_device_wintab_set_surface_cursor;
|
||||
device_class->warp = gdk_device_wintab_warp;
|
||||
device_class->query_state = gdk_device_wintab_query_state;
|
||||
device_class->grab = gdk_device_wintab_grab;
|
||||
device_class->ungrab = gdk_device_wintab_ungrab;
|
||||
|
||||
@@ -883,15 +883,12 @@ gdk_input_other_event (GdkDisplay *display,
|
||||
GdkDeviceManagerWin32 *device_manager;
|
||||
GdkDeviceWintab *source_device = NULL;
|
||||
GdkDeviceGrabInfo *last_grab;
|
||||
GdkEventMask masktest;
|
||||
guint key_state;
|
||||
POINT pt;
|
||||
GdkSurfaceImplWin32 *impl;
|
||||
|
||||
PACKET packet;
|
||||
gint root_x, root_y;
|
||||
gint num_axes;
|
||||
gint x, y;
|
||||
double x, y;
|
||||
guint translated_buttons, button_diff, button_mask;
|
||||
/* Translation from tablet button state to GDK button state for
|
||||
* buttons 1-3 - swap button 2 and 3.
|
||||
@@ -911,7 +908,7 @@ gdk_input_other_event (GdkDisplay *display,
|
||||
g_object_ref (window);
|
||||
|
||||
GDK_NOTE (EVENTS_OR_INPUT,
|
||||
g_print ("gdk_input_other_event: window=%p %+d%+d\n",
|
||||
g_print ("gdk_input_other_event: window=%p %+g%+g\n",
|
||||
window ? GDK_SURFACE_HWND (window) : NULL, x, y));
|
||||
|
||||
if (msg->message == WT_PACKET || msg->message == WT_CSRCHANGE)
|
||||
|
||||
@@ -38,6 +38,8 @@
|
||||
|
||||
#include <dwmapi.h>
|
||||
|
||||
#include "gdkwin32langnotification.h"
|
||||
|
||||
static int debug_indent = 0;
|
||||
|
||||
/**
|
||||
@@ -536,6 +538,7 @@ _gdk_win32_display_open (const gchar *display_name)
|
||||
NULL);
|
||||
_gdk_device_manager->display = _gdk_display;
|
||||
|
||||
_gdk_win32_lang_notification_init ();
|
||||
_gdk_drag_init ();
|
||||
_gdk_drop_init ();
|
||||
|
||||
@@ -701,6 +704,7 @@ gdk_win32_display_finalize (GObject *object)
|
||||
|
||||
_gdk_win32_display_finalize_cursors (display_win32);
|
||||
_gdk_win32_dnd_exit ();
|
||||
_gdk_win32_lang_notification_exit ();
|
||||
|
||||
g_ptr_array_free (display_win32->monitors, TRUE);
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
#include <io.h>
|
||||
#include <fcntl.h>
|
||||
#include <math.h>
|
||||
|
||||
/*
|
||||
* Support for OLE-2 drag and drop added at Archaeopteryx Software, 2001
|
||||
@@ -1717,6 +1718,7 @@ _gdk_win32_surface_drag_begin (GdkSurface *surface,
|
||||
GdkDrag *drag;
|
||||
GdkWin32Drag *drag_win32;
|
||||
GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get ();
|
||||
double px, py;
|
||||
int x_root, y_root;
|
||||
|
||||
g_return_val_if_fail (surface != NULL, NULL);
|
||||
@@ -1731,9 +1733,9 @@ _gdk_win32_surface_drag_begin (GdkSurface *surface,
|
||||
|
||||
GDK_NOTE (DND, g_print ("_gdk_win32_surface_drag_begin\n"));
|
||||
|
||||
gdk_device_get_position (device, &x_root, &y_root);
|
||||
x_root += dx;
|
||||
y_root += dy;
|
||||
gdk_device_get_position (device, &px, &px);
|
||||
x_root = round (px) + dx;
|
||||
y_root = round (py) + dy;
|
||||
|
||||
drag_win32->start_x = x_root;
|
||||
drag_win32->start_y = y_root;
|
||||
@@ -1840,7 +1842,6 @@ gdk_win32_drag_find_window (GdkDrag *drag,
|
||||
{
|
||||
GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
|
||||
find_window_enum_arg a;
|
||||
HWND result;
|
||||
|
||||
g_assert (_win32_main_thread == NULL ||
|
||||
_win32_main_thread == g_thread_self ());
|
||||
@@ -2439,7 +2440,6 @@ gdk_dnd_handle_key_event (GdkDrag *drag,
|
||||
{
|
||||
drag_win32->util_data.last_x += dx;
|
||||
drag_win32->util_data.last_y += dy;
|
||||
gdk_device_warp (pointer, drag_win32->util_data.last_x, drag_win32->util_data.last_y);
|
||||
}
|
||||
|
||||
if (drag_win32->drag_surface)
|
||||
|
||||
@@ -1090,7 +1090,6 @@ static void
|
||||
gdk_win32_drop_finish (GdkDrop *drop,
|
||||
GdkDragAction action)
|
||||
{
|
||||
GdkDrag *drag;
|
||||
GdkWin32Drop *drop_win32 = GDK_WIN32_DROP (drop);
|
||||
|
||||
g_return_if_fail (drop != NULL);
|
||||
@@ -1103,12 +1102,6 @@ gdk_win32_drop_finish (GdkDrop *drop,
|
||||
|
||||
if (drop_win32->protocol == GDK_DRAG_PROTO_OLE2)
|
||||
return;
|
||||
/* FIXME: remove?
|
||||
drag = gdk_drop_get_drag (drop);
|
||||
|
||||
if (drag != NULL)
|
||||
_gdk_win32_local_drag_drop_response (drag, action);
|
||||
*/
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user