Compare commits
69 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d94d6e560b | |||
| 33b160569f | |||
| fd941bd764 | |||
| 18e451da6e | |||
| 0e05d33eee | |||
| e5b2e528ca | |||
| 355a4cdc14 | |||
| d45dc8f3c3 | |||
| dd8cf478b0 | |||
| c33786446c | |||
| c4b7848aeb | |||
| 2d88021014 | |||
| 5cf832da40 | |||
| bbbc5198a3 | |||
| 2e4eaa7cfd | |||
| 07a4c8174f | |||
| 5f20868ec8 | |||
| 5d2c04b9d1 | |||
| 62c32d742e | |||
| 736438ecfb | |||
| b02c3cf4a9 | |||
| cf4b293b75 | |||
| 64534d1fc2 | |||
| 380299681a | |||
| bbe6075408 | |||
| 9615fa61a0 | |||
| 5a0ec9859e | |||
| 03d89b557a | |||
| d12924f241 | |||
| e349e46abd | |||
| 888be799d9 | |||
| 365a4f7535 | |||
| 6468ae821f | |||
| 4f04075a8f | |||
| ae058ae7ef | |||
| 7f0fe69b6e | |||
| ce879ae739 | |||
| df2bb4a92d | |||
| e45d9994a4 | |||
| 447ddb08fc | |||
| 0df96ac738 | |||
| 688d8c0796 | |||
| fb7047d212 | |||
| 1bb03e26a4 | |||
| 7df706715c | |||
| 40455db2f5 | |||
| 64ec631874 | |||
| de593da052 | |||
| a308c35112 | |||
| 412ba5cc2d | |||
| e4e11aa4a2 | |||
| e48285f759 | |||
| dcd2dba384 | |||
| 1a6a1118a4 | |||
| d6476eb99a | |||
| cdd97bbff7 | |||
| a447b2fee2 | |||
| 4af317307f | |||
| aa0c220f7d | |||
| 39966dbaf8 | |||
| fbb70becef | |||
| 388dcb4234 | |||
| e8a9fad467 | |||
| ccb7da408e | |||
| 1764558d8c | |||
| 90ee273c66 | |||
| b0b26cc2e0 | |||
| 990e049510 | |||
| 8f013f4055 |
@@ -10,7 +10,7 @@ TEST_PROGS =
|
||||
### testing rules
|
||||
|
||||
# Xvfb based test rules
|
||||
XVFB = Xvfb -ac -noreset -screen 0 1024x768x16
|
||||
XVFB = Xvfb -ac -noreset -screen 0 800x600x16
|
||||
XIDS = 101 102 103 104 105 106 107 197 199 211 223 227 293 307 308 309 310 311 \
|
||||
491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 \
|
||||
991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 \
|
||||
@@ -29,7 +29,7 @@ endif
|
||||
XVFB_START = \
|
||||
${XVFB} -help 2>/dev/null 1>&2 \
|
||||
&& XID=`for id in $(XIDS) ; do test -e /tmp/.X$$id-lock || { echo $$id; exit 0; }; done; exit 1` \
|
||||
&& { ${XVFB} :$$XID -nolisten tcp -auth /dev/null >/dev/null 2>&1 & \
|
||||
&& { ${XVFB} :$$XID -screen 0 800x600x16 -nolisten tcp -auth /dev/null >/dev/null 2>&1 & \
|
||||
trap "kill -15 $$! " 0 HUP INT QUIT TRAP USR1 PIPE TERM ; } \
|
||||
|| { echo "Gtk+Tests:ERROR: Failed to start Xvfb environment for X11 target tests."; exit 1; } \
|
||||
&& DISPLAY=:$$XID && export DISPLAY
|
||||
|
||||
@@ -1,146 +1,3 @@
|
||||
Overview of Changes in GTK+ 3.3.14
|
||||
==================================
|
||||
|
||||
* Theming
|
||||
- Fixes for border handling in GtkEntry,
|
||||
GtkCellRendererText, GtkComboBox
|
||||
- Parse values more carefully, supporting
|
||||
percentages, angles
|
||||
- Implement CSS linear-gradient syntax
|
||||
- Support background-size
|
||||
- Support a gtk.gresource file in themes
|
||||
|
||||
* Bugs fixed
|
||||
543520 Cups custom options are not sent properly
|
||||
649121 Crash in GtkAppChooserDialog packagekit button
|
||||
669176 Regression: atk-add-key-event-listener doesn't work
|
||||
|
||||
* Updated translations
|
||||
Galician
|
||||
Norwegian bokmål
|
||||
Spanish
|
||||
|
||||
|
||||
Overview of Changes in GTK+ 3.3.10
|
||||
==================================
|
||||
|
||||
* GtkApplication:
|
||||
- Move application menu handling over from GIO
|
||||
- Fix resize grip positioning in GtkApplicationWindow
|
||||
|
||||
* Wayland:
|
||||
- Make combo boxes work
|
||||
- Make key modifiers work like on X11
|
||||
- Make mouse buttons work correctly
|
||||
|
||||
* Quartz:
|
||||
- Make key modifiers work more like they do on X11
|
||||
|
||||
* Printing:
|
||||
- Fix handling of custom cups options
|
||||
|
||||
* Accessibility:
|
||||
- Bring key snooping support back for now
|
||||
|
||||
* Translation updates:
|
||||
Spanish
|
||||
|
||||
|
||||
Overview of Changes in GTK+ 3.3.8
|
||||
=================================
|
||||
|
||||
* GtkApplication:
|
||||
- Supports logout notification and inhibiting
|
||||
- Buttons, toolbuttons and switches can now be connected
|
||||
to GActions
|
||||
|
||||
* GtkSpinButton no longer allows to change the value
|
||||
when not editable
|
||||
|
||||
* GtkLabel link support has been rewritten to be be
|
||||
more robust
|
||||
|
||||
* GtkBuilder:
|
||||
- Supports the 'id' in GtkComboBoxText
|
||||
- Can parse GVariant-valued properties
|
||||
- Support loading from a GResource
|
||||
|
||||
* GtkImage:
|
||||
- Support loading from a GResource
|
||||
|
||||
* GtkUIManager:
|
||||
- Support loading from a GResource
|
||||
|
||||
* Accessibility:
|
||||
- key snooping support has been removed
|
||||
|
||||
* Wayland backend:
|
||||
- Cursor handling updates
|
||||
- Look for cursors in the 'weston' directory
|
||||
- Make resize grips work
|
||||
- Implement device grabs
|
||||
- Implement window geometry hints
|
||||
- Set surface type based on window type hint
|
||||
- Add basic clipboard and selection implementations
|
||||
- Implement client-side keyboard repeat
|
||||
- Update GdkWindow focus state to match reality
|
||||
|
||||
* Theming:
|
||||
- Improved CSS compliance for selector matching
|
||||
- Improved CSS compliance for value resolution,
|
||||
including full support for 'inherit', 'initial',
|
||||
'currentColor', 'none'
|
||||
- Support border-style properties
|
||||
- 'window-unfocused' has been renamed to 'backdrop'
|
||||
|
||||
* New deprecations:
|
||||
- GdkColor
|
||||
- GtkButton::inner-border
|
||||
|
||||
* Miscellaneous:
|
||||
- Turn default theme css files and dnd cursors into
|
||||
GResources
|
||||
|
||||
* Bugs fixed:
|
||||
543520 Cups custom options are not sent properly
|
||||
612396 ...default of entry-text-column for GtkComboBoxText
|
||||
613728 Rationalize GtkTreeView focus
|
||||
620240 GNOME Drag & Drop broken for remote X sessions
|
||||
629878 Missing "Back" and "Forward" icons for Firefox
|
||||
631414 Add symbolic constants for event emission control
|
||||
639875 crashes when unparenting a tab from a window...
|
||||
657367 GtkAction: Hold a reference to proxy widgets
|
||||
659516 gtk_css_provider_to_string lacks "since" tag
|
||||
660139 GtkGrid gives Gtk-Warnings about negative sizes when empty
|
||||
660309 check x11 backend when create xim module
|
||||
663479 "Finishing" ("Completion") and "Advanced" tabs are empty
|
||||
665015 "Widget (%s) has more than one label" unwanted warnings
|
||||
666103 Should be able to match the parent where a dropdown menu...
|
||||
666600 allocate the CSS border and deprecate GtkButton-inner-border
|
||||
666685 SIGSEGV in _gtk_tree_selection_internal_select_node
|
||||
666710 Fix compose sequences disabling other sequences
|
||||
666842 [patch] "sticky" window state reported wrongly on X11
|
||||
667018 Fix compilation on Windows
|
||||
667229 gtkspinbutton: Respect value of inherited 'editable' property
|
||||
667394 Gtk(Tool)Button: add an 'action-name' property
|
||||
667473 gdk_rgba_free (NULL)
|
||||
667485 gdk_rgba_parse error checking
|
||||
667534 Non-XInput2 build fix
|
||||
667546 GApplication doc mentions g_application_set_app_menu
|
||||
667628 GtkWindow:application property should have G_PARAM_CONSTRUCT
|
||||
667695 GAction leaked in examples/plugman.c
|
||||
667705 fix up GtkApplication on OS X
|
||||
666921 Fix the _NET_SUPPORTING_WM_CHECK window fetch to be spec...
|
||||
|
||||
* Translation updates:
|
||||
Arabic
|
||||
Bulgarian
|
||||
Finnish
|
||||
Hebrew
|
||||
Norwegian bokmål
|
||||
Spanish
|
||||
|
||||
|
||||
Overview of Changes in GTK+ 3.3.6
|
||||
=================================
|
||||
|
||||
|
||||
@@ -565,9 +565,7 @@ mkdir $(CopyDir)\share\glib-2.0\schemas
|
||||
|
||||
copy ..\..\..\gtk\org.gtk.Settings.FileChooser.gschema.xml $(CopyDir)\share\glib-2.0\schemas
|
||||
|
||||
copy ..\..\..\gtk\org.gtk.WindowState.gschema.xml $(CopyDir)\share\glib-2.0\schemas
|
||||
|
||||
echo "Compiling gsettings XML Files..."
|
||||
echo "Compiling gsettings XML File(s)..."
|
||||
|
||||
$(CopyDir)\bin\glib-compile-schemas.exe $(CopyDir)\share\glib-2.0\schemas
|
||||
|
||||
|
||||
@@ -339,8 +339,7 @@ copy $(ConfigurationName)\$(PlatformName)\bin\gailutil.lib $(OutDir)\lib
&#
|
||||
|
||||
mkdir $(OutDir)\share\glib-2.0\schemas

|
||||
copy ..\..\..\gtk\org.gtk.Settings.FileChooser.gschema.xml $(OutDir)\share\glib-2.0\schemas

|
||||
copy ..\..\..\gtk\org.gtk.WindowState.gschema.xml $(OutDir)\share\glib-2.0\schemas

|
||||
echo "Compiling gsettings XML Files..."

|
||||
echo "Compiling gsettings XML File(s)..."

|
||||
$(OutDir)\bin\glib-compile-schemas.exe $(OutDir)\share\glib-2.0\schemas

|
||||
"
|
||||
/>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
m4_define([gtk_major_version], [3])
|
||||
m4_define([gtk_minor_version], [3])
|
||||
m4_define([gtk_micro_version], [14])
|
||||
m4_define([gtk_micro_version], [7])
|
||||
m4_define([gtk_interface_age], [0])
|
||||
m4_define([gtk_binary_age],
|
||||
[m4_eval(100 * gtk_minor_version + gtk_micro_version)])
|
||||
@@ -39,11 +39,11 @@ AC_CONFIG_AUX_DIR([build-aux])
|
||||
m4_define([gtk_binary_version], [3.0.0])
|
||||
|
||||
# required versions of other packages
|
||||
m4_define([glib_required_version], [2.31.14])
|
||||
m4_define([glib_required_version], [2.31.6])
|
||||
m4_define([pango_required_version], [1.29.0])
|
||||
m4_define([atk_required_version], [2.1.5])
|
||||
m4_define([cairo_required_version], [1.10.0])
|
||||
m4_define([gdk_pixbuf_required_version], [2.25.2])
|
||||
m4_define([gdk_pixbuf_required_version], [2.23.5])
|
||||
m4_define([introspection_required_version], [0.10.1])
|
||||
GLIB_REQUIRED_VERSION=glib_required_version
|
||||
PANGO_REQUIRED_VERSION=pango_required_version
|
||||
@@ -1529,13 +1529,6 @@ fi
|
||||
|
||||
GLIB_GSETTINGS
|
||||
|
||||
#############
|
||||
# Resources #
|
||||
#############
|
||||
|
||||
GLIB_COMPILE_RESOURCES=`$PKG_CONFIG --variable glib_compile_resources gio-2.0`
|
||||
AC_SUBST(GLIB_COMPILE_RESOURCES)
|
||||
|
||||
##################################################
|
||||
# GObject introspection
|
||||
##################################################
|
||||
@@ -1754,7 +1747,6 @@ tests/a11y/Makefile
|
||||
tests/css/Makefile
|
||||
tests/css/parser/Makefile
|
||||
tests/reftests/Makefile
|
||||
tests/visuals/Makefile
|
||||
docs/Makefile
|
||||
docs/reference/Makefile
|
||||
docs/reference/gdk/Makefile
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
libgtk1 for Debian
|
||||
----------------------
|
||||
|
||||
The GIMP Tool Kit (gtk) is a set of widgets to help you program
|
||||
programs for the X Windowing System easily and powerfully.
|
||||
|
||||
gtk is the moving force behind The GNU Image Manipulation Program (The
|
||||
GIMP) -- the number one freely-available image editing and creation
|
||||
program available.
|
||||
|
||||
gtk is rapidly under development, and the source tree has officially
|
||||
been separated from The GIMP now, as other teams of programmers
|
||||
are beginning to write software using its great widget set -- like
|
||||
GNOME, a desktop interface for X, and gzilla, a freely available
|
||||
web browser for X.
|
||||
|
||||
Ben Gertzfield <che@debian.org>, Mon, 29 Sep 1997 13:11:45 -0700
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
# Adjust debian/changelog and build a new
|
||||
# Debian package of a CVS archive.
|
||||
|
||||
# Written 17 November 1998 by Ben Gertzfield
|
||||
# <che@debian.org>
|
||||
|
||||
# This work is released under the GNU
|
||||
# General Public License, version 2 or
|
||||
# later.
|
||||
|
||||
use strict;
|
||||
use diagnostics;
|
||||
use File::Copy;
|
||||
|
||||
my $maintainer = 'Ben Gertzfield <che@debian.org>';
|
||||
|
||||
my @date = localtime;
|
||||
|
||||
my $datestr = sprintf("%d%.2d%.2d", $date[5] + 1900, $date[4] + 1, $date[3]);
|
||||
my $revision = '01';
|
||||
|
||||
open (CHANGELOG, 'debian/changelog') or die "Couldn't open debian/changelog: $!\n";
|
||||
|
||||
$_ = <CHANGELOG>;
|
||||
chomp;
|
||||
|
||||
close CHANGELOG;
|
||||
|
||||
my ($package, $last_date, $last_revision) = /^(.*?) \((.*?)\.(.*)?\)/;
|
||||
|
||||
if ($last_date eq $datestr) {
|
||||
$revision = sprintf("%.2d", $last_revision + 1);
|
||||
}
|
||||
|
||||
my $new_version = "$datestr.$revision";
|
||||
|
||||
copy('debian/changelog', 'debian/changelog.old') or die "Couldn't copy debian/changelog to debian/changelog.old: $!\n";
|
||||
|
||||
open(NEWCHANGELOG, ">debian/changelog") or die "Couldn't open debian/changelog for writing: $!\n";
|
||||
|
||||
print NEWCHANGELOG "$package ($new_version) unstable; urgency=low\n\n * CVS snapshot build at " . scalar localtime() . "\n\n -- $maintainer " . `date -R` . "\n";
|
||||
|
||||
open(OLDCHANGELOG, "debian/changelog.old") or die "Couldn't open debian/changelog.old: $!\n";
|
||||
|
||||
while (<OLDCHANGELOG>) {
|
||||
print NEWCHANGELOG;
|
||||
}
|
||||
|
||||
close OLDCHANGELOG;
|
||||
close NEWCHANGELOG;
|
||||
|
||||
unlink('debian/changelog.old') or die "Couldn't unlink debian/changelog.old: $!\n";
|
||||
|
||||
open(NEWVERSION, '>debian/version') or die "Couldn't open debian/version for writing: $!\n";
|
||||
print NEWVERSION "$new_version\n";
|
||||
close NEWVERSION;
|
||||
|
||||
system('dpkg-buildpackage -b -rfakeroot -us -uc');
|
||||
unlink 'debian/version' or die "Couldn't unlink debian/version: $!\n";
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
gtk+-cvs (19981116.01) unstable; urgency=low
|
||||
|
||||
* First test build from CVS
|
||||
|
||||
-- Ben Gertzfield <che@debian.org> Tue, 17 Nov 1998 12:02:13 -0800
|
||||
|
||||
Local variables:
|
||||
mode: debian-changelog
|
||||
add-log-mailing-address: "che@debian.org"
|
||||
End:
|
||||
@@ -0,0 +1,81 @@
|
||||
Source: gtk+-cvs
|
||||
Priority: extra
|
||||
Section: libs
|
||||
Maintainer: Ben Gertzfield <che@debian.org>
|
||||
Standards-Version: 2.4.0.0
|
||||
|
||||
Package: libgtk-cvs-1.1
|
||||
Architecture: any
|
||||
Section: libs
|
||||
Depends: ${shlibs:Depends}
|
||||
Conflicts: libgtk-dev (<< 1:1.0.2), libgtk1.1
|
||||
Description: CVS build of the GIMP Toolkit set of widgets for X
|
||||
**THIS IS NOT AN OFFICIAL DEBIAN PACKAGE! THIS IS AN AUTOMATED CVS
|
||||
BUILD OF THE GTK+ LIBRARIES! BEWARE! IT MAY NOT WORK!**
|
||||
.
|
||||
The GIMP Toolkit is a freely available set of widgets for X.
|
||||
GTK is easy to use, and has been implemented in such projects as
|
||||
The GNU Image Manipulation Program (The GIMP), GNOME, a GNU
|
||||
desktop set of utilities for X, and gzilla, a GNU web-browser.
|
||||
.
|
||||
This is the unstable 1.1 branch of GTK. It is not intended for use
|
||||
with stable projects!
|
||||
|
||||
Package: libgtk-cvs-dev
|
||||
Architecture: any
|
||||
Section: devel
|
||||
Depends: libgtk-cvs-1.1 (=${Source-Version}), libglib-cvs-dev
|
||||
Suggests: libgtk-cvs-doc
|
||||
Provides: libgtk1.1-dev
|
||||
Replaces: libgtk1.1-dev
|
||||
Conflicts: libgtk-dev, libgtk1 (<< 1:1.0.4), libgtk1.1-dev
|
||||
Description: CVS build of development files for the GIMP Toolkit
|
||||
**THIS IS NOT AN OFFICIAL DEBIAN PACKAGE! THIS IS AN AUTOMATED CVS
|
||||
BUILD OF THE GTK+ LIBRARIES! BEWARE! IT MAY NOT WORK!**
|
||||
.
|
||||
This package contains the header files and static libraries for the
|
||||
GIMP Toolkit set of widgets for X.
|
||||
.
|
||||
This is the unstable, 1.1 branch of GTK+. This is not intended for
|
||||
use with stable releases of programs!
|
||||
.
|
||||
Install this package if you wish to develop your own X programs using
|
||||
the GIMP Toolkit 1.1, or if you wish to compile your own plug-ins for
|
||||
The GIMP.
|
||||
|
||||
Package: libgtk-cvs-doc
|
||||
Architecture: all
|
||||
Section: doc
|
||||
Conflicts: libgtk-dev (<< 1:0.99.4), libgtk-doc, libgtk1.1-doc
|
||||
Description: CVS build of documentation for the GIMP Toolkit
|
||||
**THIS IS NOT AN OFFICIAL DEBIAN PACKAGE! THIS IS AN AUTOMATED CVS
|
||||
BUILD OF THE GTK+ LIBRARIES! BEWARE! IT MAY NOT WORK!**
|
||||
.
|
||||
This package contains lots of info-files, HTML docs, FAQs, and
|
||||
other handy documentation about the GIMP Toolkit set of widgets
|
||||
for X.
|
||||
.
|
||||
This package documents the unstable 1.1 release of the GIMP Toolkit.
|
||||
.
|
||||
Install this package if you want to have lots of info about the
|
||||
GIMP toolkit when you're programming.
|
||||
|
||||
Package: libgtk-cvs-dbg
|
||||
Architecture: any
|
||||
Section: devel
|
||||
Depends: libgtk-cvs-1.1 (= ${Source-Version}), libgtk-cvs-dev (= ${Source-Version})
|
||||
Suggests: libgtk-cvs-doc
|
||||
Conflicts: libgtk1.1-dbg
|
||||
Description: CVS build of debugging files for the GIMP Toolkit
|
||||
**THIS IS NOT AN OFFICIAL DEBIAN PACKAGE! THIS IS AN AUTOMATED CVS
|
||||
BUILD OF THE GTK+ LIBRARIES! BEWARE! IT MAY NOT WORK!**
|
||||
.
|
||||
This package contains the debugging static libraries for the
|
||||
GIMP Toolkit set of widgets for X.
|
||||
.
|
||||
This is the unstable, 1.1 branch of GTK+. This is not intended for
|
||||
use with stable releases of programs!
|
||||
.
|
||||
Install this package if you wish to debug your own X programs using
|
||||
the GIMP Toolkit 1.1, or if you wish to debug your own plug-ins for
|
||||
The GIMP.
|
||||
@@ -0,0 +1,8 @@
|
||||
This package was debianized by Ben Gertzfield <che@debian.org> on
|
||||
Tue, 17 Nov 1998 12:07:17 -0800
|
||||
|
||||
It was produced from the CVS repository at cvs.gimp.org.
|
||||
|
||||
It may be redistributed under the terms of the GNU LGPL, Version 2 or
|
||||
later, found on Debian systems in the file /usr/doc/copyright/LGPL.
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
usr/lib/libgdk.so
|
||||
usr/lib/libgdk.a
|
||||
usr/lib/libgtk.so
|
||||
usr/lib/libgtk.a
|
||||
usr/include/gdk/
|
||||
usr/include/gtk/
|
||||
usr/bin/gtk-config
|
||||
usr/man/man1/gtk-config.1
|
||||
usr/share/aclocal/gtk.m4
|
||||
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
#DEBHELPER#
|
||||
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
install-info --quiet --remove gtk
|
||||
|
||||
#DEBHELPER#
|
||||
@@ -0,0 +1,8 @@
|
||||
usr/info/gdk.info
|
||||
usr/info/gtk.info
|
||||
usr/info/gtk.info-1
|
||||
usr/info/gtk.info-2
|
||||
usr/info/gtk.info-3
|
||||
usr/info/gtk.info-4
|
||||
usr/info/gtk.info-5
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
install-info --quiet --description="The GIMP Toolkit." \
|
||||
--section "The GIMP" "The GIMP" /usr/info/gtk.info.gz
|
||||
|
||||
install-info --quiet --description="The GIMP Drawing Kit." \
|
||||
--section "The GIMP" "The GIMP" /usr/info/gdk.info.gz
|
||||
|
||||
#DEBHELPER#
|
||||
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
install-info --quiet --remove gtk
|
||||
install-info --quiet --remove gdk
|
||||
|
||||
#DEBHELPER#
|
||||
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
ldconfig
|
||||
|
||||
#DEBHELPER#
|
||||
@@ -0,0 +1,160 @@
|
||||
#!/usr/bin/make -f
|
||||
|
||||
# debian/rules file for gtk+ Debian package
|
||||
# written April 1998 by Ben Gertzfield <che@debian.org
|
||||
|
||||
build: build-stamp
|
||||
build-stamp:
|
||||
dh_testdir
|
||||
./autogen.sh --prefix=/usr --with-xinput=xfree
|
||||
$(MAKE)
|
||||
cd docs && make distdocs
|
||||
cd ..
|
||||
touch build-stamp
|
||||
|
||||
build-dbg: build-dbg-stamp
|
||||
build-dbg-stamp:
|
||||
dh_testdir
|
||||
./configure --prefix=/usr --with-xinput=xfree --enable-debug=yes
|
||||
$(MAKE)
|
||||
touch build-dbg-stamp
|
||||
|
||||
clean:
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
rm -f build-stamp build-dbg-stamp install-stamp install-dbg-stamp
|
||||
# Add here commands to clean up after the build process.
|
||||
-$(MAKE) clean
|
||||
cd docs
|
||||
-$(MAKE) maintainer-clean
|
||||
cd ..
|
||||
-$(MAKE) distclean
|
||||
find . -name '*.o' -o -name '_libs' -o -name '*.lo' -o -name '*.a' -o -name '.deps' | xargs rm -rf
|
||||
dh_clean
|
||||
|
||||
clean-dbg:
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
rm -f build-stamp build-dbg-stamp install-stamp install-dbg-stamp
|
||||
# Add here commands to clean up after the build process.
|
||||
-$(MAKE) clean
|
||||
cd docs
|
||||
-$(MAKE) maintainer-clean
|
||||
cd ..
|
||||
-$(MAKE) distclean
|
||||
find . -name '*.o' -o -name '_libs' -o -name '*.lo' -o -name '*.a' -o -name '.deps' | xargs rm -rf
|
||||
dh_clean -k
|
||||
|
||||
install: install-stamp
|
||||
install-stamp: build
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_clean
|
||||
$(MAKE) prefix=`pwd`/debian/tmp/usr install
|
||||
touch install-stamp
|
||||
|
||||
install-dbg: install-dbg-stamp
|
||||
install-dbg-stamp: build-dbg
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_clean -k
|
||||
$(MAKE) prefix=`pwd`/debian/libgtk-cvs-dbg/usr install
|
||||
touch install-dbg-stamp
|
||||
|
||||
# Build architecture-independent files here.
|
||||
binary-indep: build install libgtk-cvs-doc
|
||||
# We have nothing to do by default.
|
||||
|
||||
# Build architecture-dependent files here.
|
||||
binary-arch: build install libgtk-cvs-dev libgtk-cvs-1.1 libgtk-cvs-dbg
|
||||
|
||||
libgtk-cvs-1.1: build
|
||||
dh_testdir -plibgtk-cvs-1.1
|
||||
dh_testroot -plibgtk-cvs-1.1
|
||||
dh_installdirs -plibgtk-cvs-1.1
|
||||
# Add here commands to install the files into debian/tmp
|
||||
rm -rf debian/tmp/usr/bin debian/tmp/usr/include debian/tmp/usr/info debian/tmp/usr/lib/glib debian/tmp/usr/share/aclocal debian/tmp/usr/man debian/tmp/usr/lib/*.la
|
||||
dh_installdocs -plibgtk-cvs-1.1
|
||||
dh_installchangelogs -plibgtk-cvs-1.1
|
||||
dh_strip -plibgtk-cvs-1.1
|
||||
dh_compress -plibgtk-cvs-1.1
|
||||
dh_fixperms -plibgtk-cvs-1.1
|
||||
dh_installdeb -plibgtk-cvs-1.1
|
||||
dh_shlibdeps -plibgtk-cvs-1.1
|
||||
dh_gencontrol -plibgtk-cvs-1.1
|
||||
dh_makeshlibs -plibgtk-cvs-1.1 -V 'libgtk-cvs-1.1 (='`cat debian/version`')'
|
||||
dh_md5sums -plibgtk-cvs-1.1
|
||||
dh_builddeb -plibgtk-cvs-1.1
|
||||
|
||||
libgtk-cvs-dev: build
|
||||
dh_testdir -plibgtk-cvs-dev
|
||||
dh_testroot -plibgtk-cvs-dev
|
||||
dh_clean -plibgtk-cvs-dev -k
|
||||
dh_installdirs -plibgtk-cvs-dev
|
||||
# Add here commands to install the files into debian/tmp
|
||||
dh_movefiles -plibgtk-cvs-dev
|
||||
cp gtk-config debian/tmp/usr/bin
|
||||
dh_installdocs -plibgtk-cvs-dev
|
||||
dh_installchangelogs -plibgtk-cvs-dev
|
||||
dh_strip -plibgtk-cvs-dev
|
||||
dh_compress -plibgtk-cvs-dev
|
||||
dh_fixperms -plibgtk-cvs-dev
|
||||
dh_installdeb -plibgtk-cvs-dev
|
||||
dh_shlibdeps -plibgtk-cvs-dev
|
||||
dh_gencontrol -plibgtk-cvs-dev
|
||||
dh_md5sums -plibgtk-cvs-dev
|
||||
dh_builddeb -plibgtk-cvs-dev
|
||||
|
||||
libgtk-cvs-doc:
|
||||
dh_testdir -plibgtk-cvs-doc
|
||||
dh_testroot -plibgtk-cvs-doc
|
||||
dh_clean -plibgtk-cvs-doc -k
|
||||
dh_installdirs -plibgtk-cvs-doc usr/doc/libgtk-cvs-doc/faq-html \
|
||||
usr/doc/libgtk-cvs-doc/tutorial-html usr/doc/libgtk-cvs-doc/italian-tutorial-html usr/doc/libgtk-cvs-doc/french-tutorial-html usr/doc/libgtk-cvs-doc/gdk-html
|
||||
dh_movefiles -plibgtk-cvs-doc
|
||||
cp docs/html/gtkfaq*.html debian/libgtk-cvs-doc/usr/doc/libgtk-cvs-doc/faq-html
|
||||
cp docs/html/gtk_tut-*.html debian/libgtk-cvs-doc/usr/doc/libgtk-cvs-doc/tutorial-html
|
||||
cp docs/html/*.gif debian/libgtk-cvs-doc/usr/doc/libgtk-cvs-doc/tutorial-html
|
||||
cp docs/html/gtk_tut.html debian/libgtk-cvs-doc/usr/doc/libgtk-cvs-doc/tutorial-html
|
||||
cp docs/html/gtk_tut_it*.html debian/libgtk-cvs-doc/usr/doc/libgtk-cvs-doc/italian-tutorial-html
|
||||
cp docs/html/*.gif debian/libgtk-cvs-doc/usr/doc/libgtk-cvs-doc/italian-tutorial-html
|
||||
cp docs/html/gtk_tut_fr*.html debian/libgtk-cvs-doc/usr/doc/libgtk-cvs-doc/french-tutorial-html
|
||||
cp docs/html/*.gif debian/libgtk-cvs-doc/usr/doc/libgtk-cvs-doc/french-tutorial-html
|
||||
cp docs/html/gdk* debian/libgtk-cvs-doc/usr/doc/libgtk-cvs-doc/gdk-html
|
||||
cp docs/text/*.txt debian/libgtk-cvs-doc/usr/doc/libgtk-cvs-doc/
|
||||
|
||||
dh_installdocs -plibgtk-cvs-doc docs/{debugging,developers,styles,text_widget,widget_system,gtk-config,refcounting}.txt TODO NEWS
|
||||
dh_installchangelogs -plibgtk-cvs-doc
|
||||
dh_strip -plibgtk-cvs-doc
|
||||
dh_compress -plibgtk-cvs-doc
|
||||
dh_fixperms -plibgtk-cvs-doc
|
||||
dh_installdeb -plibgtk-cvs-doc
|
||||
dh_shlibdeps -plibgtk-cvs-doc
|
||||
dh_gencontrol -plibgtk-cvs-doc
|
||||
dh_md5sums -plibgtk-cvs-doc
|
||||
dh_builddeb -plibgtk-cvs-doc
|
||||
|
||||
libgtk-cvs-dbg: clean-dbg install-dbg
|
||||
dh_testdir -plibgtk-cvs-dbg
|
||||
dh_testroot -plibgtk-cvs-dbg
|
||||
dh_installdirs -plibgtk-cvs-dbg
|
||||
# Add here commands to install the files into debian/libgtk-cvs-dbg
|
||||
rm -rf debian/libgtk-cvs-dbg/usr/bin debian/libgtk-cvs-dbg/usr/include debian/libgtk-cvs-dbg/usr/info debian/libgtk-cvs-dbg/usr/lib/glib debian/libgtk-cvs-dbg/usr/man debian/libgtk-cvs-dbg/usr/share debian/libgtk-cvs-dbg/usr/lib/*.{la,so*}
|
||||
for file in `find debian/libgtk-cvs-dbg/usr/lib -name '*.a'` ; do \
|
||||
mv $$file debian/libgtk-cvs-dbg/usr/lib/`basename $$file .a`_g.a; \
|
||||
done
|
||||
dh_installdocs -plibgtk-cvs-dbg
|
||||
dh_installchangelogs -plibgtk-cvs-dbg
|
||||
dh_compress -plibgtk-cvs-dbg
|
||||
dh_fixperms -plibgtk-cvs-dbg
|
||||
dh_installdeb -plibgtk-cvs-dbg
|
||||
dh_shlibdeps -plibgtk-cvs-dbg
|
||||
dh_gencontrol -plibgtk-cvs-dbg
|
||||
dh_md5sums -plibgtk-cvs-dbg
|
||||
dh_builddeb -plibgtk-cvs-dbg
|
||||
|
||||
source diff:
|
||||
@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
|
||||
|
||||
binary: binary-indep binary-arch
|
||||
.PHONY: build clean binary-indep binary-arch binary
|
||||
@@ -6,7 +6,6 @@ democodedir=$(datadir)/gtk-$(GTK_API_VERSION)/demo
|
||||
## These should be in the order you want them to appear in the
|
||||
## demo app, which means alphabetized by demo title, not filename
|
||||
demos = \
|
||||
application.c \
|
||||
appwindow.c \
|
||||
assistant.c \
|
||||
builder.c \
|
||||
@@ -66,24 +65,13 @@ LDADDS = \
|
||||
$(GTK_DEP_LIBS) \
|
||||
-lm
|
||||
|
||||
bin_PROGRAMS = gtk3-demo gtk3-demo-application
|
||||
bin_PROGRAMS = gtk3-demo
|
||||
|
||||
BUILT_SOURCES = demos.h application_resources.c
|
||||
BUILT_SOURCES = demos.h
|
||||
|
||||
EXTRA_DIST += \
|
||||
$(IMAGEFILES) \
|
||||
demo.ui \
|
||||
application.gresource.xml \
|
||||
application.ui \
|
||||
menus.ui \
|
||||
gtk-logo-24.png \
|
||||
gtk-logo-48.png \
|
||||
org.gtk.Demo.gschema.xml
|
||||
|
||||
gsettings_SCHEMAS = \
|
||||
org.gtk.Demo.gschema.xml
|
||||
|
||||
@GSETTINGS_RULES@
|
||||
EXTRA_DIST += \
|
||||
$(IMAGEFILES) \
|
||||
demo.ui
|
||||
|
||||
demos.h: @REBUILD@ $(demos) geninclude.pl
|
||||
$(AM_V_GEN) (here=`pwd` ; cd $(srcdir) && $(PERL) $$here/geninclude.pl $(demos)) > demos.h
|
||||
@@ -98,17 +86,8 @@ gtk3_demo_DEPENDENCIES = $(DEPS)
|
||||
gtk3_demo_LDADD = $(LDADDS)
|
||||
gtk3_demo_LDFLAGS = -export-dynamic
|
||||
|
||||
gtk3_demo_application_SOURCES = \
|
||||
application-standalone.c \
|
||||
application_resources.c
|
||||
|
||||
gtk3_demo_application_LDADD = $(LDADDS)
|
||||
|
||||
application_resources.c: application.gresource.xml gtk-logo-24.png gtk-logo-48.png application.ui menus.ui
|
||||
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate-source $(srcdir)/application.gresource.xml
|
||||
|
||||
IMAGEFILES= alphatest.png \
|
||||
apple-red.png \
|
||||
apple-red.png \
|
||||
background.jpg \
|
||||
floppybuddy.gif \
|
||||
gnome-applets.png \
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
#define STANDALONE
|
||||
|
||||
#include "application.c"
|
||||
@@ -1,485 +0,0 @@
|
||||
/* Application class
|
||||
*
|
||||
* Demonstrates a simple application.
|
||||
*
|
||||
* This examples uses GtkApplication, GtkApplicationWindow, GtkBuilder
|
||||
* as well as GMenu and GResource. Due to the way GtkApplication is structured,
|
||||
* it is run as a separate process.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#ifdef STANDALONE
|
||||
|
||||
static void
|
||||
show_action_dialog (GSimpleAction *action)
|
||||
{
|
||||
const gchar *name;
|
||||
GtkWidget *dialog;
|
||||
|
||||
name = g_action_get_name (G_ACTION (action));
|
||||
|
||||
dialog = gtk_message_dialog_new (NULL,
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_INFO,
|
||||
GTK_BUTTONS_CLOSE,
|
||||
"You activated action: \"%s\"",
|
||||
name);
|
||||
|
||||
g_signal_connect (dialog, "response",
|
||||
G_CALLBACK (gtk_widget_destroy), NULL);
|
||||
|
||||
gtk_widget_show (dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
show_action_infobar (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer window)
|
||||
{
|
||||
GtkWidget *infobar;
|
||||
GtkWidget *message;
|
||||
gchar *text;
|
||||
const gchar *name;
|
||||
const gchar *value;
|
||||
|
||||
name = g_action_get_name (G_ACTION (action));
|
||||
value = g_variant_get_string (parameter, NULL);
|
||||
|
||||
message = g_object_get_data (G_OBJECT (window), "message");
|
||||
infobar = g_object_get_data (G_OBJECT (window), "infobar");
|
||||
text = g_strdup_printf ("You activated radio action: \"%s\".\n"
|
||||
"Current value: %s", name, value);
|
||||
gtk_label_set_text (GTK_LABEL (message), text);
|
||||
gtk_widget_show (infobar);
|
||||
g_free (text);
|
||||
}
|
||||
|
||||
static void
|
||||
activate_action (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
show_action_dialog (action);
|
||||
}
|
||||
|
||||
static void
|
||||
activate_toggle (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
GVariant *state;
|
||||
|
||||
show_action_dialog (action);
|
||||
|
||||
state = g_action_get_state (G_ACTION (action));
|
||||
g_action_change_state (G_ACTION (action), g_variant_new_boolean (!g_variant_get_boolean (state)));
|
||||
g_variant_unref (state);
|
||||
}
|
||||
|
||||
static void
|
||||
activate_radio (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
show_action_infobar (action, parameter, user_data);
|
||||
|
||||
g_action_change_state (G_ACTION (action), parameter);
|
||||
}
|
||||
|
||||
static void
|
||||
activate_about (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkWidget *window = user_data;
|
||||
GdkPixbuf *pixbuf;
|
||||
GInputStream *stream;
|
||||
|
||||
const gchar *authors[] = {
|
||||
"Peter Mattis",
|
||||
"Spencer Kimball",
|
||||
"Josh MacDonald",
|
||||
"and many more...",
|
||||
NULL
|
||||
};
|
||||
|
||||
const gchar *documentors[] = {
|
||||
"Owen Taylor",
|
||||
"Tony Gale",
|
||||
"Matthias Clasen <mclasen@redhat.com>",
|
||||
"and many more...",
|
||||
NULL
|
||||
};
|
||||
|
||||
stream = g_resources_open_stream ("/logos/gtk-logo-48.png", 0, NULL);
|
||||
pixbuf = gdk_pixbuf_new_from_stream (stream, NULL, NULL);
|
||||
g_object_unref (stream);
|
||||
|
||||
gtk_show_about_dialog (GTK_WINDOW (window),
|
||||
"program-name", "GTK+ Code Demos",
|
||||
"version", g_strdup_printf ("%s,\nRunning against GTK+ %d.%d.%d",
|
||||
PACKAGE_VERSION,
|
||||
gtk_get_major_version (),
|
||||
gtk_get_minor_version (),
|
||||
gtk_get_micro_version ()),
|
||||
"copyright", "(C) 1997-2009 The GTK+ Team",
|
||||
"license-type", GTK_LICENSE_LGPL_2_1,
|
||||
"website", "http://www.gtk.org",
|
||||
"comments", "Program to demonstrate GTK+ functions.",
|
||||
"authors", authors,
|
||||
"documenters", documentors,
|
||||
"logo", pixbuf,
|
||||
"title", "About GTK+ Code Demos",
|
||||
NULL);
|
||||
g_object_unref (pixbuf);
|
||||
}
|
||||
|
||||
static void
|
||||
activate_quit (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkApplication *app = user_data;
|
||||
GtkWidget *win;
|
||||
GList *list, *next;
|
||||
|
||||
list = gtk_application_get_windows (app);
|
||||
while (list)
|
||||
{
|
||||
win = list->data;
|
||||
next = list->next;
|
||||
|
||||
gtk_widget_destroy (GTK_WIDGET (win));
|
||||
|
||||
list = next;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
register_stock_icons (void)
|
||||
{
|
||||
static gboolean registered = FALSE;
|
||||
|
||||
if (!registered)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
GtkIconFactory *factory;
|
||||
GtkIconSet *icon_set;
|
||||
GInputStream *stream;
|
||||
|
||||
static GtkStockItem items[] = {
|
||||
{ "demo-gtk-logo", "_GTK!", 0, 0, NULL }
|
||||
};
|
||||
|
||||
registered = TRUE;
|
||||
|
||||
gtk_stock_add (items, G_N_ELEMENTS (items));
|
||||
|
||||
factory = gtk_icon_factory_new ();
|
||||
gtk_icon_factory_add_default (factory);
|
||||
|
||||
stream = g_resources_open_stream ("/logos/gtk-logo-24.png", 0, NULL);
|
||||
pixbuf = gdk_pixbuf_new_from_stream (stream, NULL, NULL);
|
||||
g_object_unref (stream);
|
||||
|
||||
icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
|
||||
gtk_icon_factory_add (factory, "demo-gtk-logo", icon_set);
|
||||
gtk_icon_set_unref (icon_set);
|
||||
g_object_unref (pixbuf);
|
||||
|
||||
/* Drop our reference to the factory, GTK will hold a reference. */
|
||||
g_object_unref (factory);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
update_statusbar (GtkTextBuffer *buffer,
|
||||
GtkStatusbar *statusbar)
|
||||
{
|
||||
gchar *msg;
|
||||
gint row, col;
|
||||
gint count;
|
||||
GtkTextIter iter;
|
||||
|
||||
/* clear any previous message, underflow is allowed */
|
||||
gtk_statusbar_pop (statusbar, 0);
|
||||
|
||||
count = gtk_text_buffer_get_char_count (buffer);
|
||||
|
||||
gtk_text_buffer_get_iter_at_mark (buffer,
|
||||
&iter,
|
||||
gtk_text_buffer_get_insert (buffer));
|
||||
|
||||
row = gtk_text_iter_get_line (&iter);
|
||||
col = gtk_text_iter_get_line_offset (&iter);
|
||||
|
||||
msg = g_strdup_printf ("Cursor at row %d column %d - %d chars in document",
|
||||
row, col, count);
|
||||
|
||||
gtk_statusbar_push (statusbar, 0, msg);
|
||||
|
||||
g_free (msg);
|
||||
}
|
||||
|
||||
static void
|
||||
mark_set_callback (GtkTextBuffer *buffer,
|
||||
const GtkTextIter *new_location,
|
||||
GtkTextMark *mark,
|
||||
gpointer data)
|
||||
{
|
||||
update_statusbar (buffer, GTK_STATUSBAR (data));
|
||||
}
|
||||
|
||||
static void
|
||||
change_theme_state (GSimpleAction *action,
|
||||
GVariant *state,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkSettings *settings = gtk_settings_get_default ();
|
||||
|
||||
g_object_set (G_OBJECT (settings),
|
||||
"gtk-application-prefer-dark-theme",
|
||||
g_variant_get_boolean (state),
|
||||
NULL);
|
||||
|
||||
g_simple_action_set_state (action, state);
|
||||
}
|
||||
|
||||
static void
|
||||
change_titlebar_state (GSimpleAction *action,
|
||||
GVariant *state,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkWindow *window = user_data;
|
||||
|
||||
gtk_window_set_hide_titlebar_when_maximized (GTK_WINDOW (window),
|
||||
g_variant_get_boolean (state));
|
||||
|
||||
g_simple_action_set_state (action, state);
|
||||
}
|
||||
|
||||
static void
|
||||
change_radio_state (GSimpleAction *action,
|
||||
GVariant *state,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_simple_action_set_state (action, state);
|
||||
}
|
||||
|
||||
static GActionEntry app_entries[] = {
|
||||
{ "new", activate_action, NULL, NULL, NULL },
|
||||
{ "open", activate_action, NULL, NULL, NULL },
|
||||
{ "save", activate_action, NULL, NULL, NULL },
|
||||
{ "save-as", activate_action, NULL, NULL, NULL },
|
||||
{ "quit", activate_quit, NULL, NULL, NULL },
|
||||
{ "dark", activate_toggle, NULL, "false", change_theme_state }
|
||||
};
|
||||
|
||||
static GActionEntry win_entries[] = {
|
||||
{ "titlebar", activate_toggle, NULL, "false", change_titlebar_state },
|
||||
{ "shape", activate_radio, "s", "'oval'", change_radio_state },
|
||||
{ "bold", activate_toggle, NULL, "false", NULL },
|
||||
{ "about", activate_about, NULL, NULL, NULL },
|
||||
{ "file1", activate_action, NULL, NULL, NULL },
|
||||
{ "logo", activate_action, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
static void
|
||||
clicked_cb (GtkWidget *widget, GtkWidget *info)
|
||||
{
|
||||
gtk_widget_hide (info);
|
||||
}
|
||||
|
||||
static void
|
||||
startup (GApplication *app)
|
||||
{
|
||||
GtkBuilder *builder;
|
||||
GMenuModel *appmenu;
|
||||
GMenuModel *menubar;
|
||||
|
||||
builder = gtk_builder_new ();
|
||||
gtk_builder_add_from_resource (builder, "/ui/menus.ui", NULL);
|
||||
|
||||
appmenu = (GMenuModel *)gtk_builder_get_object (builder, "appmenu");
|
||||
menubar = (GMenuModel *)gtk_builder_get_object (builder, "menubar");
|
||||
|
||||
gtk_application_set_app_menu (GTK_APPLICATION (app), appmenu);
|
||||
gtk_application_set_menubar (GTK_APPLICATION (app), menubar);
|
||||
|
||||
g_object_unref (builder);
|
||||
}
|
||||
|
||||
static void
|
||||
activate (GApplication *app)
|
||||
{
|
||||
GtkBuilder *builder;
|
||||
GtkWidget *window;
|
||||
GtkWidget *grid;
|
||||
GtkWidget *contents;
|
||||
GtkWidget *status;
|
||||
GtkWidget *message;
|
||||
GtkWidget *button;
|
||||
GtkWidget *infobar;
|
||||
GtkWidget *menutool;
|
||||
GMenuModel *toolmenu;
|
||||
GtkTextBuffer *buffer;
|
||||
|
||||
window = gtk_application_window_new (GTK_APPLICATION (app));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Application Class");
|
||||
gtk_window_set_icon_name (GTK_WINDOW (window), "document-open");
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 200, 200);
|
||||
|
||||
g_action_map_add_action_entries (G_ACTION_MAP (window),
|
||||
win_entries, G_N_ELEMENTS (win_entries),
|
||||
window);
|
||||
|
||||
builder = gtk_builder_new ();
|
||||
gtk_builder_add_from_resource (builder, "/ui/application.ui", NULL);
|
||||
|
||||
grid = (GtkWidget *)gtk_builder_get_object (builder, "grid");
|
||||
contents = (GtkWidget *)gtk_builder_get_object (builder, "contents");
|
||||
status = (GtkWidget *)gtk_builder_get_object (builder, "status");
|
||||
message = (GtkWidget *)gtk_builder_get_object (builder, "message");
|
||||
button = (GtkWidget *)gtk_builder_get_object (builder, "button");
|
||||
infobar = (GtkWidget *)gtk_builder_get_object (builder, "infobar");
|
||||
menutool = (GtkWidget *)gtk_builder_get_object (builder, "menutool");
|
||||
toolmenu = (GMenuModel *)gtk_builder_get_object (builder, "toolmenu");
|
||||
|
||||
g_object_set_data (G_OBJECT (window), "message", message);
|
||||
g_object_set_data (G_OBJECT (window), "infobar", infobar);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (window), grid);
|
||||
|
||||
gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON (menutool),
|
||||
gtk_menu_new_from_model (toolmenu));
|
||||
|
||||
gtk_widget_grab_focus (contents);
|
||||
g_signal_connect (button, "clicked", G_CALLBACK (clicked_cb), infobar);
|
||||
|
||||
/* Show text widget info in the statusbar */
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (contents));
|
||||
g_signal_connect_object (buffer, "changed",
|
||||
G_CALLBACK (update_statusbar), status, 0);
|
||||
g_signal_connect_object (buffer, "mark-set",
|
||||
G_CALLBACK (mark_set_callback), status, 0);
|
||||
|
||||
update_statusbar (buffer, GTK_STATUSBAR (status));
|
||||
|
||||
gtk_widget_show_all (window);
|
||||
|
||||
g_object_unref (builder);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
GtkApplication *app;
|
||||
GSettings *settings;
|
||||
GAction *action;
|
||||
|
||||
gtk_init (NULL, NULL);
|
||||
|
||||
register_stock_icons ();
|
||||
|
||||
app = gtk_application_new ("org.gtk.Demo", 0);
|
||||
settings = g_settings_new ("org.gtk.Demo");
|
||||
|
||||
g_action_map_add_action_entries (G_ACTION_MAP (app),
|
||||
app_entries, G_N_ELEMENTS (app_entries),
|
||||
app);
|
||||
|
||||
action = g_settings_create_action (settings, "color");
|
||||
|
||||
g_action_map_add_action (G_ACTION_MAP (app), action);
|
||||
|
||||
g_signal_connect (app, "startup", G_CALLBACK (startup), NULL);
|
||||
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
|
||||
|
||||
g_application_run (G_APPLICATION (app), 0, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else /* !STANDALONE */
|
||||
|
||||
static gboolean name_seen;
|
||||
static GtkWidget *placeholder;
|
||||
|
||||
static void
|
||||
on_name_appeared (GDBusConnection *connection,
|
||||
const gchar *name,
|
||||
const gchar *name_owner,
|
||||
gpointer user_data)
|
||||
{
|
||||
name_seen = TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
on_name_vanished (GDBusConnection *connection,
|
||||
const gchar *name,
|
||||
gpointer user_data)
|
||||
{
|
||||
if (!name_seen)
|
||||
return;
|
||||
|
||||
if (placeholder)
|
||||
{
|
||||
gtk_widget_destroy (placeholder);
|
||||
g_object_unref (placeholder);
|
||||
placeholder = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_application (GtkWidget *toplevel)
|
||||
{
|
||||
static guint watch = 0;
|
||||
|
||||
if (watch == 0)
|
||||
watch = g_bus_watch_name (G_BUS_TYPE_SESSION,
|
||||
"org.gtk.Demo",
|
||||
0,
|
||||
on_name_appeared,
|
||||
on_name_vanished,
|
||||
NULL, NULL);
|
||||
|
||||
if (placeholder == NULL)
|
||||
{
|
||||
const gchar *command;
|
||||
GError *error = NULL;
|
||||
|
||||
if (g_file_test ("./gtk3-demo-application", G_FILE_TEST_IS_EXECUTABLE))
|
||||
command = "./gtk3-demo-application";
|
||||
else
|
||||
command = "gtk3-demo-application";
|
||||
|
||||
if (!g_spawn_command_line_async (command, &error))
|
||||
{
|
||||
g_warning ("%s", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
placeholder = gtk_label_new ("");
|
||||
g_object_ref_sink (placeholder);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_dbus_connection_call_sync (g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL),
|
||||
"org.gtk.Demo",
|
||||
"/org/gtk/Demo",
|
||||
"org.gtk.Actions",
|
||||
"Activate",
|
||||
g_variant_new ("(sava{sv})", "quit", NULL, NULL),
|
||||
NULL,
|
||||
0,
|
||||
G_MAXINT,
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
return placeholder;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<gresources>
|
||||
<gresource prefix="/logos">
|
||||
<file>gtk-logo-24.png</file>
|
||||
<file>gtk-logo-48.png</file>
|
||||
</gresource>
|
||||
<gresource prefix="/ui">
|
||||
<file>application.ui</file>
|
||||
<file>menus.ui</file>
|
||||
</gresource>
|
||||
</gresources>
|
||||
@@ -1,104 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<interface>
|
||||
<object class="GtkGrid" id="grid">
|
||||
<child>
|
||||
<object class="GtkToolbar" id="toolbar">
|
||||
<property name="orientation">horizontal</property>
|
||||
<property name="halign">fill</property>
|
||||
<property name="hexpand">True</property>
|
||||
<child>
|
||||
<object class="GtkMenuToolButton" id="menutool">
|
||||
<property name="stock-id">gtk-open</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="quit">
|
||||
<property name="stock-id">gtk-quit</property>
|
||||
<property name="action-name">app.quit</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparatorToolItem" id="sep"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="logo">
|
||||
<property name="stock-id">demo-gtk-logo</property>
|
||||
<property name="action-name">win.logo</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkInfoBar" id="infobar">
|
||||
<property name="no-show-all">True</property>
|
||||
<property name="halign">fill</property>
|
||||
<property name="hexpand">True</property>
|
||||
<child internal-child="content_area">
|
||||
<object class="GtkBox" id="content_area">
|
||||
<child>
|
||||
<object class="GtkLabel" id="message">
|
||||
<property name="visible">True</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="halign">fill</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child internal-child="action_area">
|
||||
<object class="GtkBox" id="action_area">
|
||||
<child>
|
||||
<object class="GtkButton" id="button">
|
||||
<property name="visible">True</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="label">gtk-ok</property>
|
||||
<property name="use-stock">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="sw">
|
||||
<property name="shadow-type">in</property>
|
||||
<child>
|
||||
<object class="GtkTextView" id="contents">
|
||||
<property name="halign">fill</property>
|
||||
<property name="valign">fill</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="vexpand">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStatusbar" id="status">
|
||||
<property name="halign">fill</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<menu id="toolmenu">
|
||||
<item>
|
||||
<attribute name="label">File1</attribute>
|
||||
<attribute name="action">win.file1</attribute>
|
||||
</item>
|
||||
</menu>
|
||||
</interface>
|
||||
@@ -1,8 +1,6 @@
|
||||
/* Application window
|
||||
/* Application main window
|
||||
*
|
||||
* Demonstrates a typical application window with menubar, toolbar, statusbar.
|
||||
*
|
||||
* This example uses GtkUIManager and GtkActionGroup.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
@@ -23,14 +23,14 @@ apply_changes_gradually (gpointer data)
|
||||
if (fraction < 1.0)
|
||||
{
|
||||
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress_bar), fraction);
|
||||
return G_SOURCE_CONTINUE;
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Close automatically once changes are fully applied. */
|
||||
gtk_widget_destroy (assistant);
|
||||
assistant = NULL;
|
||||
return G_SOURCE_REMOVE;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -172,7 +172,7 @@ button_press (GtkWidget *widget,
|
||||
GtkWidget *menu;
|
||||
GtkWidget *item;
|
||||
|
||||
if (button->button != GDK_BUTTON_SECONDARY)
|
||||
if (button->button != 3)
|
||||
return FALSE;
|
||||
|
||||
menu = gtk_menu_new ();
|
||||
|
||||
@@ -97,7 +97,7 @@ scribble_button_press_event (GtkWidget *widget,
|
||||
if (surface == NULL)
|
||||
return FALSE; /* paranoia check, in case we haven't gotten a configure event */
|
||||
|
||||
if (event->button == GDK_BUTTON_PRIMARY)
|
||||
if (event->button == 1)
|
||||
draw_brush (widget, event->x, event->y);
|
||||
|
||||
/* We've handled the event, stop processing */
|
||||
|
||||
@@ -116,7 +116,7 @@ if (defined @child_arrays) {
|
||||
}
|
||||
|
||||
# toplevel
|
||||
print "\nDemo gtk_demos[] = {\n";
|
||||
print "\nDemo testgtk_demos[] = {\n";
|
||||
|
||||
$first = 1;
|
||||
foreach $href (@demos) {
|
||||
|
||||
|
Before Width: | Height: | Size: 674 B |
|
Before Width: | Height: | Size: 2.3 KiB |
@@ -144,7 +144,7 @@ event_after (GtkWidget *text_view,
|
||||
|
||||
event = (GdkEventButton *)ev;
|
||||
|
||||
if (event->button != GDK_BUTTON_PRIMARY)
|
||||
if (event->button != 1)
|
||||
return FALSE;
|
||||
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view));
|
||||
|
||||
@@ -63,13 +63,7 @@ do_links (GtkWidget *do_widget)
|
||||
label = gtk_label_new ("Some <a href=\"http://en.wikipedia.org/wiki/Text\""
|
||||
"title=\"plain text\">text</a> may be marked up\n"
|
||||
"as hyperlinks, which can be clicked\n"
|
||||
"or activated via <a href=\"keynav\">keynav</a>\n"
|
||||
"and they work fine with other markup, like when\n"
|
||||
"searching on <a href=\"http://www.google.com/\">"
|
||||
"<span color=\"#0266C8\">G</span><span color=\"#F90101\">o</span>"
|
||||
"<span color=\"#F2B50F\">o</span><span color=\"#0266C8\">g</span>"
|
||||
"<span color=\"#00933B\">l</span><span color=\"#F90101\">e</span>"
|
||||
"</a>.");
|
||||
"or activated via <a href=\"keynav\">keynav</a>");
|
||||
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
|
||||
g_signal_connect (label, "activate-link", G_CALLBACK (activate_link), NULL);
|
||||
gtk_container_add (GTK_CONTAINER (window), label);
|
||||
|
||||
@@ -60,7 +60,7 @@ spinner_timeout (gpointer data)
|
||||
guint pulse;
|
||||
|
||||
if (model == NULL)
|
||||
return G_SOURCE_REMOVE;
|
||||
return FALSE;
|
||||
|
||||
gtk_tree_model_get_iter_first (model, &iter);
|
||||
gtk_tree_model_get (model, &iter,
|
||||
@@ -77,7 +77,7 @@ spinner_timeout (gpointer data)
|
||||
COLUMN_ACTIVE, TRUE,
|
||||
-1);
|
||||
|
||||
return G_SOURCE_CONTINUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GtkTreeModel *
|
||||
|
||||
@@ -782,7 +782,7 @@ create_tree (void)
|
||||
GtkTreeIter iter;
|
||||
GtkWidget *box, *label, *scrolled_window;
|
||||
|
||||
Demo *d = gtk_demos;
|
||||
Demo *d = testgtk_demos;
|
||||
|
||||
model = gtk_tree_store_new (NUM_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_INT);
|
||||
tree_view = gtk_tree_view_new ();
|
||||
@@ -936,8 +936,10 @@ main (int argc, char **argv)
|
||||
* these few lines, which are just a hack so gtk-demo will work
|
||||
* in the GTK tree without installing it.
|
||||
*/
|
||||
if (g_file_test ("../../modules/input/immodules.cache", G_FILE_TEST_EXISTS))
|
||||
if (g_file_test ("../../gdk-pixbuf/libpixbufloader-pnm.la",
|
||||
G_FILE_TEST_EXISTS))
|
||||
{
|
||||
g_setenv ("GDK_PIXBUF_MODULE_FILE", "../../gdk-pixbuf/loaders.cache", TRUE);
|
||||
g_setenv ("GTK_IM_MODULE_FILE", "../../modules/input/immodules.cache", TRUE);
|
||||
}
|
||||
/* -- End of hack -- */
|
||||
@@ -1000,7 +1002,7 @@ main (int argc, char **argv)
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
|
||||
gtk_widget_show_all (window);
|
||||
|
||||
load_file (gtk_demos[0].filename);
|
||||
load_file (testgtk_demos[0].filename);
|
||||
|
||||
gtk_main ();
|
||||
|
||||
|
||||
@@ -1,107 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<interface>
|
||||
<menu id="appmenu">
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_New</attribute>
|
||||
<attribute name="action">app.new</attribute>
|
||||
<attribute name="accel"><Primary>n</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Open</attribute>
|
||||
<attribute name="action">app.open</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Save</attribute>
|
||||
<attribute name="action">app.save</attribute>
|
||||
<attribute name="accel"><Primary>s</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">Save _As...</attribute>
|
||||
<attribute name="action">app.save-as</attribute>
|
||||
<attribute name="accel"><Primary>s</attribute>
|
||||
</item>
|
||||
</section>
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Quit</attribute>
|
||||
<attribute name="action">app.quit</attribute>
|
||||
<attribute name="accel"><Primary>q</attribute>
|
||||
</item>
|
||||
</section>
|
||||
</menu>
|
||||
<menu id="menubar">
|
||||
<submenu>
|
||||
<attribute name="label" translatable="yes">_Preferences</attribute>
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Prefer Dark Theme</attribute>
|
||||
<attribute name="action">app.dark</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Hide Titlebar when maximized</attribute>
|
||||
<attribute name="action">win.titlebar</attribute>
|
||||
</item>
|
||||
<submenu>
|
||||
<attribute name="label" translatable="yes">_Color</attribute>
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Red</attribute>
|
||||
<attribute name="action">app.color</attribute>
|
||||
<attribute name="target">red</attribute>
|
||||
<attribute name="accel"><Primary>r</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Green</attribute>
|
||||
<attribute name="action">app.color</attribute>
|
||||
<attribute name="target">green</attribute>
|
||||
<attribute name="accel"><Primary>g</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Blue</attribute>
|
||||
<attribute name="action">app.color</attribute>
|
||||
<attribute name="target">blue</attribute>
|
||||
<attribute name="accel"><Primary>b</attribute>
|
||||
</item>
|
||||
</section>
|
||||
</submenu>
|
||||
<submenu>
|
||||
<attribute name="label" translatable="yes">_Shape</attribute>
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Square</attribute>
|
||||
<attribute name="action">win.shape</attribute>
|
||||
<attribute name="target">square</attribute>
|
||||
<attribute name="accel"><Primary>s</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Rectangle</attribute>
|
||||
<attribute name="action">win.shape</attribute>
|
||||
<attribute name="target">rectangle</attribute>
|
||||
<attribute name="accel"><Primary>r</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Oval</attribute>
|
||||
<attribute name="action">win.shape</attribute>
|
||||
<attribute name="target">oval</attribute>
|
||||
<attribute name="accel"><Primary>o</attribute>
|
||||
</item>
|
||||
</section>
|
||||
</submenu>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Bold</attribute>
|
||||
<attribute name="action">win.bold</attribute>
|
||||
<attribute name="accel"><Primary>b</attribute>
|
||||
</item>
|
||||
</section>
|
||||
</submenu>
|
||||
<submenu>
|
||||
<attribute name="label" translatable="yes">_Help</attribute>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_About</attribute>
|
||||
<attribute name="action">win.about</attribute>
|
||||
<attribute name="accel"><Primary>a</attribute>
|
||||
</item>
|
||||
</submenu>
|
||||
</menu>
|
||||
</interface>
|
||||
@@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<schemalist>
|
||||
|
||||
<enum id='org.gtk.Demo.Color'>
|
||||
<value nick='red' value='0'/>
|
||||
<value nick='green' value='1'/>
|
||||
<value nick='blue' value='2'/>
|
||||
</enum>
|
||||
|
||||
<schema id='org.gtk.Demo' path='/org/gtk/Demo/'>
|
||||
<key name='color' enum='org.gtk.Demo.Color'>
|
||||
<default>'red'</default>
|
||||
</key>
|
||||
</schema>
|
||||
|
||||
</schemalist>
|
||||
@@ -180,7 +180,7 @@ timeout (gpointer data)
|
||||
GDK_THREADS_LEAVE ();
|
||||
|
||||
frame_num++;
|
||||
return G_SOURCE_CONTINUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static guint timeout_id;
|
||||
|
||||
@@ -29,7 +29,8 @@ static gboolean
|
||||
search_progress (gpointer data)
|
||||
{
|
||||
gtk_entry_progress_pulse (GTK_ENTRY (data));
|
||||
return G_SOURCE_CONTINUE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -49,7 +49,7 @@ scroll_to_end (GtkTextView *textview)
|
||||
if (count > 150)
|
||||
count = 0;
|
||||
|
||||
return G_SOURCE_CONTINUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Scroll to the bottom of the buffer.
|
||||
@@ -100,7 +100,7 @@ scroll_to_bottom (GtkTextView *textview)
|
||||
if (count > 40)
|
||||
count = 0;
|
||||
|
||||
return G_SOURCE_CONTINUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static guint
|
||||
|
||||
@@ -350,7 +350,7 @@ interactive_canvas_real_drag_leave (gpointer data)
|
||||
gtk_widget_queue_draw (widget);
|
||||
}
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -759,9 +759,6 @@ GDK_PRIORITY_EVENTS
|
||||
GDK_PRIORITY_REDRAW
|
||||
GDK_EVENT_PROPAGATE
|
||||
GDK_EVENT_STOP
|
||||
GDK_BUTTON_PRIMARY
|
||||
GDK_BUTTON_MIDDLE
|
||||
GDK_BUTTON_SECONDARY
|
||||
|
||||
<SUBSECTION>
|
||||
gdk_events_pending
|
||||
|
||||
@@ -123,8 +123,7 @@ content_files = \
|
||||
glossary.xml \
|
||||
migrating-2to3.xml \
|
||||
migrating-checklist.sgml \
|
||||
migrating-unique-GtkApplication.xml \
|
||||
migrating-smclient-GtkApplication.xml \
|
||||
migrating-GtkApplication.xml \
|
||||
migrating-GtkGrid.xml \
|
||||
migrating-GtkStyleContext.xml \
|
||||
objects_grouped.sgml \
|
||||
@@ -147,8 +146,7 @@ expand_content_files = \
|
||||
glossary.xml \
|
||||
migrating-2to3.xml \
|
||||
migrating-checklist.sgml \
|
||||
migrating-unique-GtkApplication.xml \
|
||||
migrating-smclient-GtkApplication.xml \
|
||||
migrating-GtkApplication.xml \
|
||||
migrating-GtkGrid.xml \
|
||||
migrating-GtkStyleContext.xml \
|
||||
question_index.sgml \
|
||||
|
||||
@@ -339,7 +339,6 @@
|
||||
<title>Application support</title>
|
||||
<xi:include href="xml/gtkapplication.xml" />
|
||||
<xi:include href="xml/gtkapplicationwindow.xml" />
|
||||
<xi:include href="xml/gtkactionable.xml" />
|
||||
</chapter>
|
||||
</part>
|
||||
|
||||
@@ -356,12 +355,11 @@
|
||||
</para>
|
||||
</partintro>
|
||||
|
||||
<xi:include href="xml/migrating-checklist.sgml" />
|
||||
<xi:include href="xml/migrating-2to3.xml" />
|
||||
<xi:include href="xml/migrating-GtkStyleContext.xml" />
|
||||
<xi:include href="xml/migrating-unique-GtkApplication.xml" />
|
||||
<xi:include href="xml/migrating-smclient-GtkApplication.xml" />
|
||||
<xi:include href="xml/migrating-GtkApplication.xml" />
|
||||
<xi:include href="xml/migrating-GtkGrid.xml" />
|
||||
<xi:include href="xml/migrating-checklist.sgml" />
|
||||
</part>
|
||||
|
||||
<part>
|
||||
|
||||
@@ -37,7 +37,6 @@ gtk_about_dialog_get_logo
|
||||
gtk_about_dialog_set_logo
|
||||
gtk_about_dialog_get_logo_icon_name
|
||||
gtk_about_dialog_set_logo_icon_name
|
||||
gtk_about_dialog_add_credit_section
|
||||
gtk_show_about_dialog
|
||||
<SUBSECTION Standard>
|
||||
GTK_ABOUT_DIALOG
|
||||
@@ -2060,7 +2059,6 @@ gtk_link_button_get_type
|
||||
<TITLE>GtkMenu</TITLE>
|
||||
GtkMenu
|
||||
gtk_menu_new
|
||||
gtk_menu_new_from_model
|
||||
gtk_menu_set_screen
|
||||
gtk_menu_reorder_child
|
||||
gtk_menu_attach
|
||||
@@ -2105,7 +2103,6 @@ gtk_menu_get_type
|
||||
<TITLE>GtkMenuBar</TITLE>
|
||||
GtkMenuBar
|
||||
gtk_menu_bar_new
|
||||
gtk_menu_bar_new_from_model
|
||||
GtkPackDirection
|
||||
gtk_menu_bar_set_pack_direction
|
||||
gtk_menu_bar_get_pack_direction
|
||||
@@ -2939,6 +2936,9 @@ gtk_scrolled_window_get_min_content_width
|
||||
gtk_scrolled_window_set_min_content_width
|
||||
gtk_scrolled_window_get_min_content_height
|
||||
gtk_scrolled_window_set_min_content_height
|
||||
GtkKineticScrollingFlags
|
||||
gtk_scrolled_window_set_kinetic_scrolling
|
||||
gtk_scrolled_window_get_kinetic_scrolling
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_SCROLLED_WINDOW
|
||||
@@ -5297,7 +5297,6 @@ gtk_window_set_gravity
|
||||
gtk_window_get_gravity
|
||||
gtk_window_set_position
|
||||
gtk_window_set_transient_for
|
||||
gtk_window_set_attached_to
|
||||
gtk_window_set_destroy_with_parent
|
||||
gtk_window_set_hide_titlebar_when_maximized
|
||||
gtk_window_set_screen
|
||||
@@ -5356,7 +5355,6 @@ gtk_window_get_role
|
||||
gtk_window_get_size
|
||||
gtk_window_get_title
|
||||
gtk_window_get_transient_for
|
||||
gtk_window_get_attached_to
|
||||
gtk_window_get_type_hint
|
||||
gtk_window_get_skip_taskbar_hint
|
||||
gtk_window_get_skip_pager_hint
|
||||
@@ -5685,7 +5683,6 @@ gtk_style_context_add_provider_for_screen
|
||||
gtk_style_context_get
|
||||
gtk_style_context_get_direction
|
||||
gtk_style_context_get_junction_sides
|
||||
gtk_style_context_set_parent
|
||||
gtk_style_context_get_path
|
||||
gtk_style_context_get_property
|
||||
gtk_style_context_get_screen
|
||||
@@ -5694,7 +5691,6 @@ gtk_style_context_get_style
|
||||
gtk_style_context_get_style_property
|
||||
gtk_style_context_get_style_valist
|
||||
gtk_style_context_get_valist
|
||||
gtk_style_context_get_section
|
||||
gtk_style_context_get_color
|
||||
gtk_style_context_get_background_color
|
||||
gtk_style_context_get_border_color
|
||||
@@ -5719,7 +5715,6 @@ gtk_style_context_restore
|
||||
gtk_style_context_save
|
||||
gtk_style_context_set_direction
|
||||
gtk_style_context_set_junction_sides
|
||||
gtk_style_context_set_parent
|
||||
gtk_style_context_set_path
|
||||
gtk_style_context_add_class
|
||||
gtk_style_context_remove_class
|
||||
@@ -7014,14 +7009,6 @@ gtk_application_add_window
|
||||
gtk_application_remove_window
|
||||
gtk_application_get_windows
|
||||
|
||||
<SUBSECTION>
|
||||
GtkApplicationInhibitFlags
|
||||
gtk_application_inhibit
|
||||
gtk_application_uninhibit
|
||||
gtk_application_is_inhibited
|
||||
GtkApplicationEndSessionStyle
|
||||
gtk_application_end_session
|
||||
|
||||
<SUBSECTION>
|
||||
gtk_application_get_app_menu
|
||||
gtk_application_set_app_menu
|
||||
@@ -7063,32 +7050,6 @@ gtk_application_window_get_type
|
||||
GtkApplicationWindowPrivate
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkactionable</FILE>
|
||||
<TITLE>GtkActionable</TITLE>
|
||||
GtkActionable
|
||||
GtkActionableInterface
|
||||
|
||||
<SUBSECTION>
|
||||
gtk_actionable_get_action_name
|
||||
gtk_actionable_set_action_name
|
||||
|
||||
<SUBSECTION>
|
||||
gtk_actionable_get_action_target_value
|
||||
gtk_actionable_set_action_target_value
|
||||
gtk_actionable_set_action_target
|
||||
|
||||
<SUBSECTION>
|
||||
gtk_actionable_set_detailed_action_name
|
||||
|
||||
<SUBSECTION Standard>
|
||||
gtk_actionable_get_type
|
||||
GTK_ACTIONABLE
|
||||
GTK_ACTIONABLE_GET_IFACE
|
||||
GTK_IS_ACTIONABLE
|
||||
GTK_TYPE_ACTIONABLE
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkgrid</FILE>
|
||||
<TITLE>GtkGrid</TITLE>
|
||||
|
||||
@@ -6,7 +6,6 @@ gtk_accel_group_get_type
|
||||
gtk_accel_label_get_type
|
||||
gtk_accel_map_get_type
|
||||
gtk_accessible_get_type
|
||||
gtk_actionable_get_type
|
||||
gtk_action_get_type
|
||||
gtk_action_group_get_type
|
||||
gtk_activatable_get_type
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
||||
]>
|
||||
<chapter id="gtk-migrating-unique-GtkApplication">
|
||||
<chapter id="gtk-migrating-GtkApplication">
|
||||
|
||||
<title>Migrating from libunique to GApplication or GtkApplication</title>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
<example><title>A unique application</title>
|
||||
<para>Here is a simple application using libunique:
|
||||
<informalexample><programlisting>
|
||||
<programlisting>
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
@@ -53,9 +53,9 @@ main (int argc, char *argv[])
|
||||
|
||||
return 0;
|
||||
}
|
||||
</programlisting></informalexample>
|
||||
</programlisting>
|
||||
The same application using GtkApplication:
|
||||
<informalexample><programlisting>
|
||||
<programlisting>
|
||||
static void
|
||||
activate (GtkApplication *app)
|
||||
{
|
||||
@@ -85,13 +85,13 @@ main (int argc, char *argv[])
|
||||
app = gtk_application_new ("org.gtk.TestApplication", 0);
|
||||
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
|
||||
|
||||
status = g_application_run (G_APPLICATION (app), argc, argv);
|
||||
status = g_application_run (app);
|
||||
|
||||
g_object_unref (app);
|
||||
|
||||
return status;
|
||||
}
|
||||
</programlisting></informalexample>
|
||||
</programlisting>
|
||||
</para>
|
||||
</example>
|
||||
<section><title>Uniqueness</title>
|
||||
@@ -3,10 +3,10 @@
|
||||
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
||||
]>
|
||||
<chapter id="gtk-migrating-checklist">
|
||||
<title>Migration Details Checklist</title>
|
||||
<title>Migration Checklist</title>
|
||||
|
||||
<para>
|
||||
This chapter includes a checklist of smaller things you need to do to
|
||||
This chapter includes a checklist of things you need to do to
|
||||
ensure that your programs are good citizens in the GTK+ world. By
|
||||
paying attention to the points in the checklist, you ensure that
|
||||
many automatic features of GTK+ will work correctly in your
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
||||
]>
|
||||
<chapter id="gtk-migrating-smclient-GtkApplication">
|
||||
|
||||
<title>Migrating from EggSMClient to GtkApplication</title>
|
||||
|
||||
<para>
|
||||
EggSMClient provides 'session management' support for applications.
|
||||
This means a number of things:
|
||||
<itemizedlist>
|
||||
<listitem>logout notification and negotiation</listitem>
|
||||
<listitem>application state saving</listitem>
|
||||
<listitem>restarting of applications with saved state</listitem>
|
||||
</itemizedlist>
|
||||
EggSMClient supports this functionality to varying degrees on
|
||||
Windows and OS X, as well as with XSMP and D-Bus based session
|
||||
managers in X11.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Starting with GTK+ 3.4, #GtkApplication supports logout notification
|
||||
and negotiation similar to EggSMClient.
|
||||
</para>
|
||||
<table>
|
||||
<tgroup cols="2">
|
||||
<title>EggSMClient to GtkApplication</title>
|
||||
<thead>
|
||||
<row><entry>EggSMClient</entry><entry>GtkApplication</entry></row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row><entry>EggSMClient::quit-requested</entry><entry>instead of calling will_quit (FALSE,...) in response to this signal, install an inhibitor</entry></row>
|
||||
<row><entry>EggSMClient::quit</entry><entry>the #GtkApplication::quit signal</entry></row>
|
||||
<row><entry>EggSMClient::quit-cancelled</entry><entry></entry></row>
|
||||
<row><entry>egg_sm_client_will_quit</entry><entry>instead of calling will_quit (FALSE,...), install an inhibitor</entry></row>
|
||||
<row><entry>egg_sm_client_end_session</entry><entry>gtk_application_end_session()</entry></row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
|
||||
<para>
|
||||
At this point, GtkApplication has no special support for state saving.
|
||||
Applications can use GSettings or GKeyFile and save as much state as
|
||||
they see fit in response to #GtkApplication::quit or whenever they
|
||||
consider appropriate.
|
||||
</para>
|
||||
</chapter>
|
||||
@@ -121,9 +121,9 @@ Here's a simple example:
|
||||
do_small_part_of_task ();
|
||||
|
||||
if (task_complete)
|
||||
return G_SOURCE_REMOVE; /* removes the idle handler */
|
||||
return FALSE; /* removes the idle handler */
|
||||
else
|
||||
return G_SOURCE_CONTINUE; /* runs the idle handler again */
|
||||
return TRUE; /* runs the idle handler again */
|
||||
}
|
||||
|
||||
g_idle_add (my_idle_handler, NULL);
|
||||
|
||||
@@ -13,14 +13,6 @@ activate_toggle (GSimpleAction *action,
|
||||
g_variant_unref (state);
|
||||
}
|
||||
|
||||
static void
|
||||
activate_radio (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_action_change_state (G_ACTION (action), parameter);
|
||||
}
|
||||
|
||||
static void
|
||||
change_fullscreen_state (GSimpleAction *action,
|
||||
GVariant *state,
|
||||
@@ -34,29 +26,6 @@ change_fullscreen_state (GSimpleAction *action,
|
||||
g_simple_action_set_state (action, state);
|
||||
}
|
||||
|
||||
static void
|
||||
change_justify_state (GSimpleAction *action,
|
||||
GVariant *state,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkTextView *text = g_object_get_data (user_data, "bloatpad-text");
|
||||
const gchar *str;
|
||||
|
||||
str = g_variant_get_string (state, NULL);
|
||||
|
||||
if (g_str_equal (str, "left"))
|
||||
gtk_text_view_set_justification (text, GTK_JUSTIFY_LEFT);
|
||||
else if (g_str_equal (str, "center"))
|
||||
gtk_text_view_set_justification (text, GTK_JUSTIFY_CENTER);
|
||||
else if (g_str_equal (str, "right"))
|
||||
gtk_text_view_set_justification (text, GTK_JUSTIFY_RIGHT);
|
||||
else
|
||||
/* ignore this attempted change */
|
||||
return;
|
||||
|
||||
g_simple_action_set_state (action, state);
|
||||
}
|
||||
|
||||
static GtkClipboard *
|
||||
get_clipboard (GtkWidget *widget)
|
||||
{
|
||||
@@ -93,8 +62,7 @@ window_paste (GSimpleAction *action,
|
||||
static GActionEntry win_entries[] = {
|
||||
{ "copy", window_copy, NULL, NULL, NULL },
|
||||
{ "paste", window_paste, NULL, NULL, NULL },
|
||||
{ "fullscreen", activate_toggle, NULL, "false", change_fullscreen_state },
|
||||
{ "justify", activate_radio, "s", "'left'", change_justify_state }
|
||||
{ "fullscreen", activate_toggle, NULL, "false", change_fullscreen_state }
|
||||
};
|
||||
|
||||
static void
|
||||
@@ -102,9 +70,6 @@ new_window (GApplication *app,
|
||||
GFile *file)
|
||||
{
|
||||
GtkWidget *window, *grid, *scrolled, *view;
|
||||
GtkWidget *toolbar;
|
||||
GtkToolItem *button;
|
||||
GtkWidget *sw, *box, *label;
|
||||
|
||||
window = gtk_application_window_new (GTK_APPLICATION (app));
|
||||
gtk_window_set_default_size ((GtkWindow*)window, 640, 480);
|
||||
@@ -114,36 +79,6 @@ new_window (GApplication *app,
|
||||
grid = gtk_grid_new ();
|
||||
gtk_container_add (GTK_CONTAINER (window), grid);
|
||||
|
||||
toolbar = gtk_toolbar_new ();
|
||||
button = gtk_toggle_tool_button_new_from_stock (GTK_STOCK_JUSTIFY_LEFT);
|
||||
gtk_actionable_set_detailed_action_name (GTK_ACTIONABLE (button), "win.justify::left");
|
||||
gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (button));
|
||||
|
||||
button = gtk_toggle_tool_button_new_from_stock (GTK_STOCK_JUSTIFY_CENTER);
|
||||
gtk_actionable_set_detailed_action_name (GTK_ACTIONABLE (button), "win.justify::center");
|
||||
gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (button));
|
||||
|
||||
button = gtk_toggle_tool_button_new_from_stock (GTK_STOCK_JUSTIFY_RIGHT);
|
||||
gtk_actionable_set_detailed_action_name (GTK_ACTIONABLE (button), "win.justify::right");
|
||||
gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (button));
|
||||
|
||||
button = gtk_separator_tool_item_new ();
|
||||
gtk_separator_tool_item_set_draw (GTK_SEPARATOR_TOOL_ITEM (button), FALSE);
|
||||
gtk_tool_item_set_expand (GTK_TOOL_ITEM (button), TRUE);
|
||||
gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (button));
|
||||
|
||||
button = gtk_tool_item_new ();
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
|
||||
gtk_container_add (GTK_CONTAINER (button), box);
|
||||
label = gtk_label_new ("Fullscreen:");
|
||||
gtk_container_add (GTK_CONTAINER (box), label);
|
||||
sw = gtk_switch_new ();
|
||||
gtk_actionable_set_action_name (GTK_ACTIONABLE (sw), "win.fullscreen");
|
||||
gtk_container_add (GTK_CONTAINER (box), sw);
|
||||
gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (button));
|
||||
|
||||
gtk_grid_attach (GTK_GRID (grid), toolbar, 0, 0, 1, 1);
|
||||
|
||||
scrolled = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_widget_set_hexpand (scrolled, TRUE);
|
||||
gtk_widget_set_vexpand (scrolled, TRUE);
|
||||
@@ -153,7 +88,7 @@ new_window (GApplication *app,
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (scrolled), view);
|
||||
|
||||
gtk_grid_attach (GTK_GRID (grid), scrolled, 0, 1, 1, 1);
|
||||
gtk_grid_attach (GTK_GRID (grid), scrolled, 0, 0, 1, 1);
|
||||
|
||||
if (file != NULL)
|
||||
{
|
||||
@@ -207,15 +142,13 @@ new_activated (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
GApplication *app = user_data;
|
||||
|
||||
g_application_activate (app);
|
||||
g_application_activate (user_data);
|
||||
}
|
||||
|
||||
static void
|
||||
about_activated (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
show_about (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
gtk_show_about_dialog (NULL,
|
||||
"program-name", "Bloatpad",
|
||||
@@ -225,14 +158,16 @@ about_activated (GSimpleAction *action,
|
||||
}
|
||||
|
||||
static void
|
||||
quit_app (GtkApplication *app)
|
||||
quit_app (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
GList *list, *next;
|
||||
GtkWindow *win;
|
||||
|
||||
g_print ("Going down...\n");
|
||||
|
||||
list = gtk_application_get_windows (app);
|
||||
list = gtk_application_get_windows (GTK_APPLICATION (g_application_get_default ()));
|
||||
while (list)
|
||||
{
|
||||
win = list->data;
|
||||
@@ -244,20 +179,10 @@ quit_app (GtkApplication *app)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
quit_activated (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkApplication *app = user_data;
|
||||
|
||||
quit_app (app);
|
||||
}
|
||||
|
||||
static GActionEntry app_entries[] = {
|
||||
{ "new", new_activated, NULL, NULL, NULL },
|
||||
{ "about", about_activated, NULL, NULL, NULL },
|
||||
{ "quit", quit_activated, NULL, NULL, NULL },
|
||||
{ "about", show_about, NULL, NULL, NULL },
|
||||
{ "quit", quit_app, NULL, NULL, NULL },
|
||||
};
|
||||
|
||||
static void
|
||||
@@ -275,50 +200,25 @@ bloat_pad_startup (GApplication *application)
|
||||
"<interface>"
|
||||
" <menu id='app-menu'>"
|
||||
" <section>"
|
||||
" <item>"
|
||||
" <attribute name='label' translatable='yes'>_New Window</attribute>"
|
||||
" <attribute name='action'>app.new</attribute>"
|
||||
" <attribute name='accel'><Primary>n</attribute>"
|
||||
" </item>"
|
||||
" <item label='_New Window' action='app.new' accel='<Primary>n'/>"
|
||||
" </section>"
|
||||
" <section>"
|
||||
" <item>"
|
||||
" <attribute name='label' translatable='yes'>_About Bloatpad</attribute>"
|
||||
" <attribute name='action'>app.about</attribute>"
|
||||
" </item>"
|
||||
" <item label='_About Bloatpad' action='app.about'/>"
|
||||
" </section>"
|
||||
" <section>"
|
||||
" <item>"
|
||||
" <attribute name='label' translatable='yes'>_Quit</attribute>"
|
||||
" <attribute name='action'>app.quit</attribute>"
|
||||
" <attribute name='accel'><Primary>q</attribute>"
|
||||
" </item>"
|
||||
" <item label='_Quit' action='app.quit' accel='<Primary>q'/>"
|
||||
" </section>"
|
||||
" </menu>"
|
||||
" <menu id='menubar'>"
|
||||
" <submenu>"
|
||||
" <attribute name='label' translatable='yes'>_Edit</attribute>"
|
||||
" <submenu label='_Edit'>"
|
||||
" <section>"
|
||||
" <item>"
|
||||
" <attribute name='label' translatable='yes'>_Copy</attribute>"
|
||||
" <attribute name='action'>win.copy</attribute>"
|
||||
" <attribute name='accel'><Primary>c</attribute>"
|
||||
" </item>"
|
||||
" <item>"
|
||||
" <attribute name='label' translatable='yes'>_Parse</attribute>"
|
||||
" <attribute name='action'>win.parse</attribute>"
|
||||
" <attribute name='accel'><Primary>v</attribute>"
|
||||
" </item>"
|
||||
" <item label='_Copy' action='win.copy' accel='<Primary>c'/>"
|
||||
" <item label='_Paste' action='win.paste' accel='<Primary>v'/>"
|
||||
" </section>"
|
||||
" </submenu>"
|
||||
" <submenu>"
|
||||
" <attribute name='label' translatable='yes'>_View</attribute>"
|
||||
" <submenu label='_View'>"
|
||||
" <section>"
|
||||
" <item>"
|
||||
" <attribute name='label' translatable='yes'>_Fullscreen</attribute>"
|
||||
" <attribute name='action'>win.fullscreen</attribute>"
|
||||
" <attribute name='accel'>F11</attribute>"
|
||||
" </item>"
|
||||
" <item label='_Fullscreen' action='win.fullscreen'/>"
|
||||
" </section>"
|
||||
" </submenu>"
|
||||
" </menu>"
|
||||
@@ -347,33 +247,15 @@ bloat_pad_class_init (BloatPadClass *class)
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
quit_cb (GtkApplication *app)
|
||||
{
|
||||
g_print ("Session manager to us to quit\n");
|
||||
|
||||
quit_app (app);
|
||||
}
|
||||
|
||||
BloatPad *
|
||||
bloat_pad_new (void)
|
||||
{
|
||||
GtkApplication *bloat_pad;
|
||||
|
||||
g_type_init ();
|
||||
|
||||
g_set_application_name ("Bloatpad");
|
||||
|
||||
bloat_pad = g_object_new (bloat_pad_get_type (),
|
||||
"application-id", "org.gtk.Test.bloatpad",
|
||||
"flags", G_APPLICATION_HANDLES_OPEN,
|
||||
"inactivity-timeout", 30000,
|
||||
"register-session", TRUE,
|
||||
NULL);
|
||||
|
||||
g_signal_connect (bloat_pad, "quit", G_CALLBACK (quit_cb), NULL);
|
||||
|
||||
return bloat_pad;
|
||||
return g_object_new (bloat_pad_get_type (),
|
||||
"application-id", "org.gtk.Test.bloatpad",
|
||||
"flags", G_APPLICATION_HANDLES_OPEN,
|
||||
NULL);
|
||||
}
|
||||
|
||||
int
|
||||
@@ -383,12 +265,9 @@ main (int argc, char **argv)
|
||||
int status;
|
||||
|
||||
bloat_pad = bloat_pad_new ();
|
||||
|
||||
gtk_application_add_accelerator (GTK_APPLICATION (bloat_pad),
|
||||
"F11", "win.fullscreen", NULL);
|
||||
|
||||
status = g_application_run (G_APPLICATION (bloat_pad), argc, argv);
|
||||
|
||||
g_object_unref (bloat_pad);
|
||||
|
||||
return status;
|
||||
|
||||
@@ -86,11 +86,11 @@ button_press_event_cb (GtkWidget *widget,
|
||||
if (surface == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (event->button == GDK_BUTTON_PRIMARY)
|
||||
if (event->button == 1)
|
||||
{
|
||||
draw_brush (widget, event->x, event->y);
|
||||
}
|
||||
else if (event->button == GDK_BUTTON_SECONDARY)
|
||||
else if (event->button == 3)
|
||||
{
|
||||
clear_surface ();
|
||||
gtk_widget_queue_draw (widget);
|
||||
|
||||
@@ -223,7 +223,6 @@ enable_plugin (const gchar *name)
|
||||
g_signal_connect (action, "activate", G_CALLBACK (plugin_action), (gpointer)name);
|
||||
g_action_map_add_action (G_ACTION_MAP (g_application_get_default ()), action);
|
||||
g_print ("Actions of '%s' plugin added\n", name);
|
||||
g_object_unref (action);
|
||||
|
||||
plugin_menu = find_plugin_menu ();
|
||||
if (plugin_menu)
|
||||
@@ -231,14 +230,14 @@ enable_plugin (const gchar *name)
|
||||
GMenu *section;
|
||||
GMenuItem *item;
|
||||
gchar *label;
|
||||
gchar *action_name;
|
||||
gchar *action;
|
||||
|
||||
section = g_menu_new ();
|
||||
label = g_strdup_printf ("Turn text %s", name);
|
||||
action_name = g_strconcat ("app.", name, NULL);
|
||||
g_menu_insert (section, 0, label, action_name);
|
||||
action = g_strconcat ("app.", name, NULL);
|
||||
g_menu_insert (section, 0, label, action);
|
||||
g_free (label);
|
||||
g_free (action_name);
|
||||
g_free (action);
|
||||
item = g_menu_item_new_section (NULL, (GMenuModel*)section);
|
||||
g_menu_item_set_attribute (item, "id", "s", name);
|
||||
g_menu_append_item (G_MENU (plugin_menu), item);
|
||||
|
||||
@@ -362,7 +362,7 @@ parse_input (BroadwayInput *input)
|
||||
gsize len, payload_len;
|
||||
BroadwayWSOpCode code;
|
||||
gboolean is_mask, fin;
|
||||
guchar *buf, *data, *mask;
|
||||
guchar *buf, *data;
|
||||
|
||||
buf = input->buffer->data;
|
||||
len = input->buffer->len;
|
||||
@@ -391,16 +391,6 @@ parse_input (BroadwayInput *input)
|
||||
payload_len = GUINT64_FROM_BE( *(guint64 *) data );
|
||||
data += 8;
|
||||
}
|
||||
|
||||
mask = NULL;
|
||||
if (is_mask)
|
||||
{
|
||||
if (data - buf + 4 > len)
|
||||
return;
|
||||
mask = data;
|
||||
data += 4;
|
||||
}
|
||||
|
||||
if (data - buf + payload_len > len)
|
||||
return; /* wait to accumulate more */
|
||||
|
||||
@@ -408,7 +398,8 @@ parse_input (BroadwayInput *input)
|
||||
{
|
||||
gsize i;
|
||||
for (i = 0; i < payload_len; i++)
|
||||
data[i] ^= mask[i%4];
|
||||
data[i + 4] ^= data[i%4];
|
||||
data += 4;
|
||||
}
|
||||
|
||||
switch (code) {
|
||||
@@ -422,11 +413,7 @@ parse_input (BroadwayInput *input)
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
char *terminated = g_strndup((char *)data, payload_len);
|
||||
parse_input_message (input, terminated);
|
||||
g_free (terminated);
|
||||
}
|
||||
parse_input_message (input, (char *)data);
|
||||
break;
|
||||
case BROADWAY_WS_CNX_PING:
|
||||
broadway_output_pong (broadway_display->output);
|
||||
@@ -487,7 +474,7 @@ process_input_idle_cb (GdkBroadwayDisplay *display)
|
||||
{
|
||||
display->process_input_idle = 0;
|
||||
process_input_messages (display);
|
||||
return G_SOURCE_REMOVE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1016,7 +1003,7 @@ got_http_request_line (GInputStream *stream,
|
||||
/* Protect against overflow in request length */
|
||||
if (request->request->len > 1024 * 5)
|
||||
{
|
||||
send_error (request, 400, "Request too long");
|
||||
send_error (request, 400, "Request to long");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1226,7 +1213,8 @@ gdk_broadway_display_finalize (GObject *object)
|
||||
_gdk_broadway_cursor_display_finalize (GDK_DISPLAY_OBJECT(broadway_display));
|
||||
|
||||
/* input GdkDevice list */
|
||||
g_list_free_full (broadway_display->input_devices, g_object_unref);
|
||||
g_list_foreach (broadway_display->input_devices, (GFunc) g_object_unref, NULL);
|
||||
g_list_free (broadway_display->input_devices);
|
||||
/* Free all GdkScreens */
|
||||
g_object_unref (broadway_display->screens[0]);
|
||||
g_free (broadway_display->screens);
|
||||
|
||||
@@ -895,7 +895,7 @@ gdk_threads_add_idle (GSourceFunc function,
|
||||
*
|
||||
* self->timeout_id = 0;
|
||||
*
|
||||
* return G_SOURCE_REMOVE;
|
||||
* return FALSE;
|
||||
* }
|
||||
*
|
||||
* static void some_widget_do_stuff_later (SomeWidget *self)
|
||||
|
||||
@@ -38,7 +38,6 @@
|
||||
* screen or workspace.
|
||||
* <example>
|
||||
* <title>Launching an application</title>
|
||||
* <informalexample>
|
||||
* <programlisting>
|
||||
* GdkAppLaunchContext *context;
|
||||
*
|
||||
@@ -52,7 +51,6 @@
|
||||
*
|
||||
* g_object_unref (context);
|
||||
* </programlisting>
|
||||
* </informalexample>
|
||||
* </example>
|
||||
*/
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ typedef enum
|
||||
* of a stylus on a graphics tablet.
|
||||
* @GDK_SOURCE_CURSOR: the device is a graphics tablet "puck" or similar device.
|
||||
* @GDK_SOURCE_KEYBOARD: the device is a keyboard.
|
||||
* @GDK_SOURCE_TOUCH: the device is a touch capable device.
|
||||
*
|
||||
* An enumeration describing the type of an input device in general terms.
|
||||
*/
|
||||
@@ -70,7 +71,8 @@ typedef enum
|
||||
GDK_SOURCE_PEN,
|
||||
GDK_SOURCE_ERASER,
|
||||
GDK_SOURCE_CURSOR,
|
||||
GDK_SOURCE_KEYBOARD
|
||||
GDK_SOURCE_KEYBOARD,
|
||||
GDK_SOURCE_TOUCH
|
||||
} GdkInputSource;
|
||||
|
||||
/**
|
||||
|
||||
@@ -154,7 +154,8 @@ free_device_grabs_foreach (gpointer key,
|
||||
{
|
||||
GList *list = value;
|
||||
|
||||
g_list_free_full (list, (GDestroyNotify) free_device_grab);
|
||||
g_list_foreach (list, (GFunc) free_device_grab, NULL);
|
||||
g_list_free (list);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -210,7 +211,8 @@ gdk_display_dispose (GObject *object)
|
||||
|
||||
device_manager = gdk_display_get_device_manager (GDK_DISPLAY (object));
|
||||
|
||||
g_list_free_full (display->queued_events, (GDestroyNotify) gdk_event_free);
|
||||
g_list_foreach (display->queued_events, (GFunc)gdk_event_free, NULL);
|
||||
g_list_free (display->queued_events);
|
||||
display->queued_events = NULL;
|
||||
display->queued_tail = NULL;
|
||||
|
||||
@@ -897,15 +899,25 @@ switch_to_pointer_grab (GdkDisplay *display,
|
||||
|
||||
if (grab == NULL) /* Ungrabbed, send events */
|
||||
{
|
||||
pointer_window = NULL;
|
||||
if (new_toplevel)
|
||||
{
|
||||
/* Find (possibly virtual) child window */
|
||||
pointer_window =
|
||||
_gdk_window_find_descendant_at (new_toplevel,
|
||||
x, y,
|
||||
NULL, NULL);
|
||||
}
|
||||
/* If the source device is a touch device, do not
|
||||
* propagate any enter event yet, until one is
|
||||
* synthesized when needed.
|
||||
*/
|
||||
if (source_device &&
|
||||
gdk_device_get_source (source_device) == GDK_SOURCE_TOUCH)
|
||||
info->need_touch_press_enter = TRUE;
|
||||
|
||||
pointer_window = NULL;
|
||||
|
||||
if (new_toplevel &&
|
||||
!info->need_touch_press_enter)
|
||||
{
|
||||
/* Find (possibly virtual) child window */
|
||||
pointer_window =
|
||||
_gdk_window_find_descendant_at (new_toplevel,
|
||||
x, y,
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
if (pointer_window != last_grab->window)
|
||||
synthesize_crossing_events (display, device, source_device,
|
||||
@@ -1120,6 +1132,9 @@ _gdk_display_get_pointer_info (GdkDisplay *display,
|
||||
{
|
||||
GdkPointerWindowInfo *info;
|
||||
|
||||
if (device && gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
|
||||
device = gdk_device_get_associated_device (device);
|
||||
|
||||
if (G_UNLIKELY (!device))
|
||||
return NULL;
|
||||
|
||||
|
||||
@@ -75,6 +75,8 @@ typedef struct
|
||||
gdouble toplevel_x, toplevel_y;
|
||||
guint32 state;
|
||||
guint32 button;
|
||||
GdkDevice *last_slave;
|
||||
guint need_touch_press_enter : 1;
|
||||
} GdkPointerWindowInfo;
|
||||
|
||||
typedef struct
|
||||
|
||||
@@ -1460,7 +1460,7 @@ gdk_event_request_motions (const GdkEventMotion *event)
|
||||
* also trigger a context menu if this modifier is pressed.
|
||||
*
|
||||
* This function should always be used instead of simply checking for
|
||||
* event->button == %GDK_BUTTON_SECONDARY.
|
||||
* event->button == 3.
|
||||
*
|
||||
* Returns: %TRUE if the event should trigger a context menu.
|
||||
*
|
||||
@@ -1479,7 +1479,7 @@ gdk_event_triggers_context_menu (const GdkEvent *event)
|
||||
|
||||
g_return_val_if_fail (GDK_IS_WINDOW (bevent->window), FALSE);
|
||||
|
||||
if (bevent->button == GDK_BUTTON_SECONDARY &&
|
||||
if (bevent->button == 3 &&
|
||||
! (bevent->state & (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK)))
|
||||
return TRUE;
|
||||
|
||||
@@ -1489,7 +1489,7 @@ gdk_event_triggers_context_menu (const GdkEvent *event)
|
||||
GDK_MODIFIER_INTENT_CONTEXT_MENU);
|
||||
|
||||
if (modifier != 0 &&
|
||||
bevent->button == GDK_BUTTON_PRIMARY &&
|
||||
bevent->button == 1 &&
|
||||
! (bevent->state & (GDK_BUTTON2_MASK | GDK_BUTTON3_MASK)) &&
|
||||
(bevent->state & modifier))
|
||||
return TRUE;
|
||||
|
||||
@@ -94,37 +94,6 @@ G_BEGIN_DECLS
|
||||
*/
|
||||
#define GDK_EVENT_STOP (TRUE)
|
||||
|
||||
/**
|
||||
* GDK_BUTTON_PRIMARY:
|
||||
*
|
||||
* The primary button. This is typically the left mouse button, or the
|
||||
* right button in a left-handed setup.
|
||||
*
|
||||
* Since: 3.4
|
||||
*/
|
||||
#define GDK_BUTTON_PRIMARY (1)
|
||||
|
||||
/**
|
||||
* GDK_BUTTON_MIDDLE:
|
||||
*
|
||||
* The middle button.
|
||||
*
|
||||
* Since: 3.4
|
||||
*/
|
||||
#define GDK_BUTTON_MIDDLE (2)
|
||||
|
||||
/**
|
||||
* GDK_BUTTON_SECONDARY:
|
||||
*
|
||||
* The secondary button. This is typically the right mouse button, or the
|
||||
* left button in a left-handed setup.
|
||||
*
|
||||
* Since: 3.4
|
||||
*/
|
||||
#define GDK_BUTTON_SECONDARY (3)
|
||||
|
||||
|
||||
|
||||
typedef struct _GdkEventAny GdkEventAny;
|
||||
typedef struct _GdkEventExpose GdkEventExpose;
|
||||
typedef struct _GdkEventVisibility GdkEventVisibility;
|
||||
@@ -385,6 +354,15 @@ typedef enum
|
||||
* @GDK_CROSSING_GTK_UNGRAB: crossing because a GTK+ grab is deactivated.
|
||||
* @GDK_CROSSING_STATE_CHANGED: crossing because a GTK+ widget changed
|
||||
* state (e.g. sensitivity).
|
||||
* @GDK_CROSSING_STATE_CHANGED: crossing because a GTK+ widget changed
|
||||
* state (e.g. sensitivity).
|
||||
* @GDK_CROSSING_TOUCH_PRESS: crossing because a touch device was pressed,
|
||||
* this event is synthetic as the pointer might have not left the window.
|
||||
* @GDK_CROSSING_TOUCH_RELEASE: crossing because a touch device was released.
|
||||
* this event is synthetic as the pointer might have not left the window.
|
||||
* @GDK_CROSSING_DEVICE_SWITCH: crossing because of a device switch (i.e.
|
||||
* a mouse taking control of the pointer after a touch device), this event
|
||||
* is synthetic as the pointer didn't leave the window.
|
||||
*
|
||||
* Specifies the crossing mode for #GdkEventCrossing.
|
||||
*/
|
||||
@@ -395,7 +373,10 @@ typedef enum
|
||||
GDK_CROSSING_UNGRAB,
|
||||
GDK_CROSSING_GTK_GRAB,
|
||||
GDK_CROSSING_GTK_UNGRAB,
|
||||
GDK_CROSSING_STATE_CHANGED
|
||||
GDK_CROSSING_STATE_CHANGED,
|
||||
GDK_CROSSING_TOUCH_PRESS,
|
||||
GDK_CROSSING_TOUCH_RELEASE,
|
||||
GDK_CROSSING_DEVICE_SWITCH
|
||||
} GdkCrossingMode;
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,8 +27,6 @@
|
||||
#include "config.h"
|
||||
#include "gdkrgba.h"
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <math.h>
|
||||
|
||||
/**
|
||||
* SECTION:rgba_colors
|
||||
@@ -73,7 +71,15 @@ G_DEFINE_BOXED_TYPE (GdkRGBA, gdk_rgba,
|
||||
GdkRGBA *
|
||||
gdk_rgba_copy (const GdkRGBA *rgba)
|
||||
{
|
||||
return g_slice_dup (GdkRGBA, rgba);
|
||||
GdkRGBA *copy;
|
||||
|
||||
copy = g_slice_new (GdkRGBA);
|
||||
copy->red = rgba->red;
|
||||
copy->green = rgba->green;
|
||||
copy->blue = rgba->blue;
|
||||
copy->alpha = rgba->alpha;
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -103,17 +109,14 @@ gdk_rgba_free (GdkRGBA *rgba)
|
||||
* - We accept mixed percentages and non-percentages in a single
|
||||
* rgb() or rgba() specification.
|
||||
*/
|
||||
static gboolean
|
||||
parse_rgb_value (const gchar *str,
|
||||
gchar **endp,
|
||||
gdouble *number)
|
||||
static double
|
||||
parse_rgb_value (const char *str,
|
||||
char **endp)
|
||||
{
|
||||
double number;
|
||||
const char *p;
|
||||
|
||||
*number = g_ascii_strtod (str, endp);
|
||||
if (errno == ERANGE || *endp == str ||
|
||||
isinf (*number) || isnan (*number))
|
||||
return FALSE;
|
||||
number = g_ascii_strtod (str, endp);
|
||||
|
||||
p = *endp;
|
||||
|
||||
@@ -122,14 +125,12 @@ parse_rgb_value (const gchar *str,
|
||||
if (*p == '%')
|
||||
{
|
||||
*endp = (char *)(p + 1);
|
||||
*number = CLAMP(*number / 100., 0., 1.);
|
||||
return CLAMP(number / 100., 0., 1.);
|
||||
}
|
||||
else
|
||||
{
|
||||
*number = CLAMP(*number / 255., 0., 1.);
|
||||
return CLAMP(number / 255., 0., 1.);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -175,7 +176,6 @@ gdk_rgba_parse (GdkRGBA *rgba,
|
||||
gboolean has_alpha;
|
||||
gdouble r, g, b, a;
|
||||
gchar *str = (gchar *) spec;
|
||||
gchar *p;
|
||||
|
||||
if (strncmp (str, "rgba", 4) == 0)
|
||||
{
|
||||
@@ -220,8 +220,7 @@ gdk_rgba_parse (GdkRGBA *rgba,
|
||||
|
||||
/* Parse red */
|
||||
SKIP_WHITESPACES (str);
|
||||
if (!parse_rgb_value (str, &str, &r))
|
||||
return FALSE;
|
||||
r = parse_rgb_value (str, &str);
|
||||
SKIP_WHITESPACES (str);
|
||||
|
||||
if (*str != ',')
|
||||
@@ -231,8 +230,7 @@ gdk_rgba_parse (GdkRGBA *rgba,
|
||||
|
||||
/* Parse green */
|
||||
SKIP_WHITESPACES (str);
|
||||
if (!parse_rgb_value (str, &str, &g))
|
||||
return FALSE;
|
||||
g = parse_rgb_value (str, &str);
|
||||
SKIP_WHITESPACES (str);
|
||||
|
||||
if (*str != ',')
|
||||
@@ -242,8 +240,7 @@ gdk_rgba_parse (GdkRGBA *rgba,
|
||||
|
||||
/* Parse blue */
|
||||
SKIP_WHITESPACES (str);
|
||||
if (!parse_rgb_value (str, &str, &b))
|
||||
return FALSE;
|
||||
b = parse_rgb_value (str, &str);
|
||||
SKIP_WHITESPACES (str);
|
||||
|
||||
if (has_alpha)
|
||||
@@ -254,24 +251,13 @@ gdk_rgba_parse (GdkRGBA *rgba,
|
||||
str++;
|
||||
|
||||
SKIP_WHITESPACES (str);
|
||||
a = g_ascii_strtod (str, &p);
|
||||
if (errno == ERANGE || p == str ||
|
||||
isinf (a) || isnan (a))
|
||||
return FALSE;
|
||||
str = p;
|
||||
a = g_ascii_strtod (str, &str);
|
||||
SKIP_WHITESPACES (str);
|
||||
}
|
||||
|
||||
if (*str != ')')
|
||||
return FALSE;
|
||||
|
||||
str++;
|
||||
|
||||
SKIP_WHITESPACES (str);
|
||||
|
||||
if (*str != '\0')
|
||||
return FALSE;
|
||||
|
||||
if (rgba)
|
||||
{
|
||||
rgba->red = CLAMP (r, 0, 1);
|
||||
|
||||
@@ -824,7 +824,7 @@ gdk_window_update_visibility (GdkWindow *window)
|
||||
window->effective_visibility = new_visibility;
|
||||
|
||||
if (new_visibility != GDK_VISIBILITY_NOT_VIEWABLE &&
|
||||
window->event_mask & GDK_VISIBILITY_NOTIFY_MASK)
|
||||
window->event_mask & GDK_VISIBILITY_NOTIFY)
|
||||
{
|
||||
event = _gdk_make_event (window, GDK_VISIBILITY_NOTIFY,
|
||||
NULL, FALSE);
|
||||
@@ -2065,8 +2065,12 @@ _gdk_window_destroy_hierarchy (GdkWindow *window,
|
||||
window->clip_region_with_children = NULL;
|
||||
}
|
||||
|
||||
g_list_free_full (window->outstanding_moves, (GDestroyNotify) gdk_window_region_move_free);
|
||||
window->outstanding_moves = NULL;
|
||||
if (window->outstanding_moves)
|
||||
{
|
||||
g_list_foreach (window->outstanding_moves, (GFunc)gdk_window_region_move_free, NULL);
|
||||
g_list_free (window->outstanding_moves);
|
||||
window->outstanding_moves = NULL;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -3941,7 +3945,8 @@ _gdk_window_process_updates_recurse (GdkWindow *window,
|
||||
}
|
||||
}
|
||||
|
||||
g_list_free_full (children, g_object_unref);
|
||||
g_list_foreach (children, (GFunc)g_object_unref, NULL);
|
||||
g_list_free (children);
|
||||
|
||||
}
|
||||
|
||||
@@ -8335,9 +8340,11 @@ send_crossing_event (GdkDisplay *display,
|
||||
GdkEvent *event;
|
||||
guint32 window_event_mask, type_event_mask;
|
||||
GdkDeviceGrabInfo *grab;
|
||||
GdkPointerWindowInfo *pointer_info;
|
||||
gboolean block_event = FALSE;
|
||||
|
||||
grab = _gdk_display_has_device_grab (display, device, serial);
|
||||
pointer_info = _gdk_display_get_pointer_info (display, device);
|
||||
|
||||
if (grab != NULL &&
|
||||
!grab->owner_events)
|
||||
@@ -8350,7 +8357,13 @@ send_crossing_event (GdkDisplay *display,
|
||||
else
|
||||
window_event_mask = window->event_mask;
|
||||
|
||||
if (type == GDK_LEAVE_NOTIFY)
|
||||
if (pointer_info->need_touch_press_enter &&
|
||||
mode != GDK_CROSSING_TOUCH_PRESS &&
|
||||
mode != GDK_CROSSING_TOUCH_RELEASE)
|
||||
{
|
||||
block_event = TRUE;
|
||||
}
|
||||
else if (type == GDK_LEAVE_NOTIFY)
|
||||
{
|
||||
type_event_mask = GDK_LEAVE_NOTIFY_MASK;
|
||||
window->devices_inside = g_list_remove (window->devices_inside, device);
|
||||
@@ -9059,7 +9072,7 @@ do_synthesize_crossing_event (gpointer data)
|
||||
_gdk_synthesize_crossing_events (display,
|
||||
pointer_info->window_under_pointer,
|
||||
new_window_under_pointer,
|
||||
device, NULL,
|
||||
device, pointer_info->last_slave,
|
||||
GDK_CROSSING_NORMAL,
|
||||
pointer_info->toplevel_x,
|
||||
pointer_info->toplevel_y,
|
||||
@@ -9174,7 +9187,7 @@ proxy_pointer_event (GdkDisplay *display,
|
||||
guint state;
|
||||
gdouble toplevel_x, toplevel_y;
|
||||
guint32 time_;
|
||||
gboolean non_linear;
|
||||
gboolean non_linear, need_synthetic_enter = FALSE;
|
||||
|
||||
event_window = source_event->any.window;
|
||||
gdk_event_get_coords (source_event, &toplevel_x, &toplevel_y);
|
||||
@@ -9194,6 +9207,13 @@ proxy_pointer_event (GdkDisplay *display,
|
||||
source_event->crossing.detail == GDK_NOTIFY_NONLINEAR_VIRTUAL))
|
||||
non_linear = TRUE;
|
||||
|
||||
if (pointer_info->need_touch_press_enter &&
|
||||
gdk_device_get_source (pointer_info->last_slave) != GDK_SOURCE_TOUCH)
|
||||
{
|
||||
pointer_info->need_touch_press_enter = FALSE;
|
||||
need_synthetic_enter = TRUE;
|
||||
}
|
||||
|
||||
/* If we get crossing events with subwindow unexpectedly being NULL
|
||||
that means there is a native subwindow that gdk doesn't know about.
|
||||
We track these and forward them, with the correct virtual window
|
||||
@@ -9317,6 +9337,18 @@ proxy_pointer_event (GdkDisplay *display,
|
||||
gdk_window_get_device_events (event_win, device) == 0)
|
||||
return TRUE;
|
||||
|
||||
/* The last device to interact with the window was a touch device,
|
||||
* which synthesized a leave notify event, so synthesize another enter
|
||||
* notify to tell the pointer is on the window.
|
||||
*/
|
||||
if (need_synthetic_enter)
|
||||
_gdk_synthesize_crossing_events (display,
|
||||
NULL, pointer_window,
|
||||
device, source_device,
|
||||
GDK_CROSSING_DEVICE_SWITCH,
|
||||
toplevel_x, toplevel_y,
|
||||
state, time_, NULL,
|
||||
serial, FALSE);
|
||||
is_hint = FALSE;
|
||||
|
||||
if (event_win &&
|
||||
@@ -9375,6 +9407,7 @@ proxy_button_event (GdkEvent *source_event,
|
||||
GdkWindow *pointer_window;
|
||||
GdkWindow *parent;
|
||||
GdkEvent *event;
|
||||
GdkPointerWindowInfo *pointer_info;
|
||||
guint state;
|
||||
guint32 time_;
|
||||
GdkEventType type;
|
||||
@@ -9394,6 +9427,7 @@ proxy_button_event (GdkEvent *source_event,
|
||||
toplevel_window = convert_native_coords_to_toplevel (event_window,
|
||||
toplevel_x, toplevel_y,
|
||||
&toplevel_x, &toplevel_y);
|
||||
pointer_info = _gdk_display_get_pointer_info (display, device);
|
||||
|
||||
if (type == GDK_BUTTON_PRESS &&
|
||||
!source_event->any.send_event &&
|
||||
@@ -9446,6 +9480,30 @@ proxy_button_event (GdkEvent *source_event,
|
||||
gdk_window_get_device_events (event_win, device) == 0)
|
||||
return TRUE;
|
||||
|
||||
if (type == GDK_BUTTON_PRESS &&
|
||||
pointer_info->need_touch_press_enter)
|
||||
{
|
||||
GdkCrossingMode mode;
|
||||
|
||||
/* The last device to interact with the window was a touch device,
|
||||
* which synthesized a leave notify event, so synthesize another enter
|
||||
* notify to tell the pointer is on the window.
|
||||
*/
|
||||
if (gdk_device_get_source (source_device) == GDK_SOURCE_TOUCH)
|
||||
mode = GDK_CROSSING_TOUCH_PRESS;
|
||||
else
|
||||
mode = GDK_CROSSING_DEVICE_SWITCH;
|
||||
|
||||
pointer_info->need_touch_press_enter = FALSE;
|
||||
_gdk_synthesize_crossing_events (display,
|
||||
NULL,
|
||||
pointer_info->window_under_pointer,
|
||||
device, source_device, mode,
|
||||
toplevel_x, toplevel_y,
|
||||
state, time_, source_event,
|
||||
serial, FALSE);
|
||||
}
|
||||
|
||||
event = _gdk_make_event (event_win, type, source_event, FALSE);
|
||||
|
||||
switch (type)
|
||||
@@ -9466,7 +9524,23 @@ proxy_button_event (GdkEvent *source_event,
|
||||
gdk_event_set_source_device (event, source_device);
|
||||
|
||||
if (type == GDK_BUTTON_PRESS)
|
||||
_gdk_event_button_generate (display, event);
|
||||
_gdk_event_button_generate (display, event);
|
||||
else if (type == GDK_BUTTON_RELEASE &&
|
||||
pointer_window == pointer_info->window_under_pointer &&
|
||||
gdk_device_get_source (source_device) == GDK_SOURCE_TOUCH)
|
||||
{
|
||||
/* Synthesize a leave notify event
|
||||
* whenever a touch device is released
|
||||
*/
|
||||
pointer_info->need_touch_press_enter = TRUE;
|
||||
_gdk_synthesize_crossing_events (display,
|
||||
pointer_window, NULL,
|
||||
device, source_device,
|
||||
GDK_CROSSING_TOUCH_RELEASE,
|
||||
toplevel_x, toplevel_y,
|
||||
state, time_, NULL,
|
||||
serial, FALSE);
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
case GDK_SCROLL:
|
||||
@@ -9585,6 +9659,17 @@ _gdk_windowing_got_event (GdkDisplay *display,
|
||||
{
|
||||
GdkInputMode mode;
|
||||
|
||||
if (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD)
|
||||
{
|
||||
pointer_info = _gdk_display_get_pointer_info (display, device);
|
||||
|
||||
if (source_device != pointer_info->last_slave &&
|
||||
gdk_device_get_device_type (source_device) == GDK_DEVICE_TYPE_SLAVE)
|
||||
pointer_info->last_slave = source_device;
|
||||
else
|
||||
source_device = pointer_info->last_slave;
|
||||
}
|
||||
|
||||
g_object_get (device, "input-mode", &mode, NULL);
|
||||
_gdk_display_device_grab_update (display, device, source_device, serial);
|
||||
|
||||
@@ -9603,8 +9688,6 @@ _gdk_windowing_got_event (GdkDisplay *display,
|
||||
if (!event_window)
|
||||
return;
|
||||
|
||||
pointer_info = _gdk_display_get_pointer_info (display, device);
|
||||
|
||||
#ifdef DEBUG_WINDOW_PRINTING
|
||||
if (event->type == GDK_KEY_PRESS &&
|
||||
(event->key.keyval == 0xa7 ||
|
||||
@@ -9689,15 +9772,19 @@ _gdk_windowing_got_event (GdkDisplay *display,
|
||||
}
|
||||
}
|
||||
|
||||
/* Store last pointer window and position/state */
|
||||
old_state = pointer_info->state;
|
||||
old_button = pointer_info->button;
|
||||
if (pointer_info)
|
||||
{
|
||||
/* Store last pointer window and position/state */
|
||||
old_state = pointer_info->state;
|
||||
old_button = pointer_info->button;
|
||||
|
||||
gdk_event_get_coords (event, &x, &y);
|
||||
convert_native_coords_to_toplevel (event_window, x, y, &x, &y);
|
||||
pointer_info->toplevel_x = x;
|
||||
pointer_info->toplevel_y = y;
|
||||
gdk_event_get_state (event, &pointer_info->state);
|
||||
}
|
||||
|
||||
gdk_event_get_coords (event, &x, &y);
|
||||
convert_native_coords_to_toplevel (event_window, x, y, &x, &y);
|
||||
pointer_info->toplevel_x = x;
|
||||
pointer_info->toplevel_y = y;
|
||||
gdk_event_get_state (event, &pointer_info->state);
|
||||
if (event->type == GDK_BUTTON_PRESS ||
|
||||
event->type == GDK_BUTTON_RELEASE)
|
||||
pointer_info->button = event->button.button;
|
||||
|
||||
@@ -180,7 +180,7 @@ create_builtin_cursor (GdkCursorType cursor_type)
|
||||
|
||||
cursor = gdk_quartz_cursor_new_from_nscursor (nscursor, GDK_CURSOR_IS_PIXMAP);
|
||||
|
||||
cached_xcursors[cursor_type] = g_object_ref (cursor);
|
||||
cached_xcursors[cursor_type] = gdk_cursor_ref (cursor);
|
||||
|
||||
GDK_QUARTZ_RELEASE_POOL;
|
||||
|
||||
@@ -243,7 +243,7 @@ _gdk_quartz_display_get_cursor_for_type (GdkDisplay *display,
|
||||
case GDK_BLANK_CURSOR:
|
||||
return create_blank_cursor ();
|
||||
default:
|
||||
return g_object_ref (create_builtin_cursor (cursor_type));
|
||||
return gdk_cursor_ref (create_builtin_cursor (cursor_type));
|
||||
}
|
||||
|
||||
[nscursor retain];
|
||||
|
||||
@@ -308,7 +308,8 @@ gdk_quartz_display_finalize (GObject *object)
|
||||
{
|
||||
GdkQuartzDisplay *display_quartz = GDK_QUARTZ_DISPLAY (object);
|
||||
|
||||
g_list_free_full (display_quartz->input_devices, g_object_unref);
|
||||
g_list_foreach (display_quartz->input_devices, (GFunc) g_object_unref, NULL);
|
||||
g_list_free (display_quartz->input_devices);
|
||||
|
||||
G_OBJECT_CLASS (gdk_quartz_display_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
@@ -963,13 +963,6 @@ fill_key_event (GdkWindow *window,
|
||||
|
||||
event->key.state |= _gdk_quartz_events_get_current_mouse_modifiers ();
|
||||
|
||||
/* The X11 backend adds the first virtual modifier MOD2..MOD5 are
|
||||
* mapped to. Since we only have one virtual modifier in the quartz
|
||||
* backend, calling the standard function will do.
|
||||
*/
|
||||
gdk_keymap_add_virtual_modifiers (gdk_keymap_get_for_display (_gdk_display),
|
||||
&event->key.state);
|
||||
|
||||
event->key.string = NULL;
|
||||
|
||||
/* Fill in ->string since apps depend on it, taken from the x11 backend. */
|
||||
|
||||
@@ -1630,18 +1630,7 @@ gdk_window_quartz_restack_toplevel (GdkWindow *window,
|
||||
GdkWindow *sibling,
|
||||
gboolean above)
|
||||
{
|
||||
GdkWindowImplQuartz *impl;
|
||||
gint sibling_num;
|
||||
|
||||
impl = GDK_WINDOW_IMPL_QUARTZ (sibling->impl);
|
||||
sibling_num = [impl->toplevel windowNumber];
|
||||
|
||||
impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
|
||||
|
||||
if (above)
|
||||
[impl->toplevel orderWindow:NSWindowAbove relativeTo:sibling_num];
|
||||
else
|
||||
[impl->toplevel orderWindow:NSWindowBelow relativeTo:sibling_num];
|
||||
/* FIXME: Implement this */
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -19,9 +19,9 @@ progs_ldadd = \
|
||||
#check_gdk_cairo_SOURCES = check-gdk-cairo.c
|
||||
#check_gdk_cairo_LDADD = $(progs_ldadd)
|
||||
|
||||
TEST_PROGS += rgba
|
||||
rgba_SOURCES = rgba.c
|
||||
rgba_LDADD = $(progs_ldadd)
|
||||
TEST_PROGS += gdk-color
|
||||
gdk_color_SOURCES = gdk-color.c
|
||||
gdk_color_LDADD = $(progs_ldadd)
|
||||
|
||||
TEST_PROGS += encoding
|
||||
encoding_SOURCES = encoding.c
|
||||
|
||||
@@ -49,14 +49,6 @@ test_color_parse (void)
|
||||
res = gdk_rgba_parse (&color, "#0080ff");
|
||||
g_assert (res);
|
||||
g_assert (gdk_rgba_equal (&color, &expected));
|
||||
|
||||
expected.red = 0.0;
|
||||
expected.green = 0.0;
|
||||
expected.blue = 0.0;
|
||||
expected.alpha = 1.0;
|
||||
res = gdk_rgba_parse (&color, "rgb(0,0,0)");
|
||||
g_assert (res);
|
||||
g_assert (gdk_rgba_equal (&color, &expected));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -98,67 +90,13 @@ test_color_to_string (void)
|
||||
g_free (orig);
|
||||
}
|
||||
|
||||
static void
|
||||
test_color_copy (void)
|
||||
{
|
||||
GdkRGBA rgba;
|
||||
GdkRGBA *out;
|
||||
|
||||
rgba.red = 0.0;
|
||||
rgba.green = 0.1;
|
||||
rgba.blue = 0.6;
|
||||
rgba.alpha = 0.9;
|
||||
|
||||
out = gdk_rgba_copy (&rgba);
|
||||
g_assert (gdk_rgba_equal (&rgba, out));
|
||||
|
||||
gdk_rgba_free (out);
|
||||
}
|
||||
|
||||
static void
|
||||
test_color_parse_nonsense (void)
|
||||
{
|
||||
GdkRGBA color;
|
||||
gboolean res;
|
||||
|
||||
g_test_bug ("667485");
|
||||
|
||||
res = gdk_rgba_parse (&color, "rgb(,,)");
|
||||
g_assert (!res);
|
||||
|
||||
res = gdk_rgba_parse (&color, "rgb(%,%,%)");
|
||||
g_assert (!res);
|
||||
|
||||
res = gdk_rgba_parse (&color, "rgb(nan,nan,nan)");
|
||||
g_assert (!res);
|
||||
|
||||
res = gdk_rgba_parse (&color, "rgb(inf,inf,inf)");
|
||||
g_assert (!res);
|
||||
|
||||
res = gdk_rgba_parse (&color, "rgb(1p12,0,0)");
|
||||
g_assert (!res);
|
||||
|
||||
res = gdk_rgba_parse (&color, "rgb(5d1%,1,1)");
|
||||
g_assert (!res);
|
||||
|
||||
res = gdk_rgba_parse (&color, "rgb(0,0,0)moo");
|
||||
g_assert (!res);
|
||||
|
||||
res = gdk_rgba_parse (&color, "rgb(0,0,0) moo");
|
||||
g_assert (!res);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
|
||||
g_test_bug_base ("http://bugzilla.gnome.org");
|
||||
|
||||
g_test_add_func ("/rgba/parse", test_color_parse);
|
||||
g_test_add_func ("/rgba/parse/nonsense", test_color_parse_nonsense);
|
||||
g_test_add_func ("/rgba/to-string", test_color_to_string);
|
||||
g_test_add_func ("/rgba/copy", test_color_copy);
|
||||
g_test_add_func ("/color/parse", test_color_parse);
|
||||
g_test_add_func ("/color/to-string", test_color_to_string);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
@@ -227,7 +227,7 @@ create_cursor(GdkDisplayWayland *display, GdkPixbuf *pixbuf, int x, int y)
|
||||
fd,
|
||||
cursor->width,
|
||||
cursor->height,
|
||||
stride, WL_SHM_FORMAT_ARGB8888);
|
||||
stride, WL_SHM_FORMAT_ARGB32);
|
||||
|
||||
close(fd);
|
||||
|
||||
@@ -293,7 +293,7 @@ _gdk_wayland_display_get_cursor_for_type (GdkDisplay *display,
|
||||
{
|
||||
gchar *filename;
|
||||
filename = g_build_filename (directories[j],
|
||||
"weston",
|
||||
"wayland",
|
||||
cursor_definitions[i].filename,
|
||||
NULL);
|
||||
if (g_file_test (filename, G_FILE_TEST_EXISTS))
|
||||
|
||||
@@ -17,11 +17,6 @@
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <string.h>
|
||||
@@ -37,8 +32,6 @@
|
||||
#include <X11/extensions/XKBcommon.h>
|
||||
#include <X11/keysym.h>
|
||||
|
||||
#include <sys/time.h>
|
||||
|
||||
#define GDK_TYPE_DEVICE_CORE (gdk_device_core_get_type ())
|
||||
#define GDK_DEVICE_CORE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDK_TYPE_DEVICE_CORE, GdkDeviceCore))
|
||||
#define GDK_DEVICE_CORE_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), GDK_TYPE_DEVICE_CORE, GdkDeviceCoreClass))
|
||||
@@ -52,8 +45,6 @@ typedef struct _GdkWaylandDevice GdkWaylandDevice;
|
||||
|
||||
typedef struct _DataOffer DataOffer;
|
||||
|
||||
typedef struct _GdkWaylandSelectionOffer GdkWaylandSelectionOffer;
|
||||
|
||||
struct _GdkWaylandDevice
|
||||
{
|
||||
GdkDisplay *display;
|
||||
@@ -66,16 +57,9 @@ struct _GdkWaylandDevice
|
||||
struct wl_data_device *data_device;
|
||||
int32_t x, y, surface_x, surface_y;
|
||||
uint32_t time;
|
||||
GdkWindow *pointer_grab_window;
|
||||
uint32_t pointer_grab_time;
|
||||
guint32 repeat_timer;
|
||||
guint32 repeat_key;
|
||||
guint32 repeat_count;
|
||||
|
||||
DataOffer *drag_offer;
|
||||
DataOffer *selection_offer;
|
||||
|
||||
GdkWaylandSelectionOffer *selection_offer_out;
|
||||
};
|
||||
|
||||
struct _GdkDeviceCore
|
||||
@@ -155,20 +139,14 @@ gdk_device_core_set_window_cursor (GdkDevice *device,
|
||||
int x, y;
|
||||
|
||||
if (cursor)
|
||||
g_object_ref (cursor);
|
||||
|
||||
/* Setting the cursor to NULL means that we should use the default cursor */
|
||||
if (!cursor)
|
||||
{
|
||||
/* FIXME: Is this the best sensible default ? */
|
||||
cursor = _gdk_wayland_display_get_cursor_for_type (device->display,
|
||||
GDK_LEFT_PTR);
|
||||
buffer = _gdk_wayland_cursor_get_buffer(cursor, &x, &y);
|
||||
wl_input_device_attach(wd->device, wd->time, buffer, x, y);
|
||||
}
|
||||
else
|
||||
{
|
||||
wl_input_device_attach(wd->device, wd->time, NULL, 0, 0);
|
||||
}
|
||||
|
||||
buffer = _gdk_wayland_cursor_get_buffer(cursor, &x, &y);
|
||||
wl_input_device_attach(wd->device, wd->time, buffer, x, y);
|
||||
|
||||
g_object_unref (cursor);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -223,30 +201,6 @@ gdk_device_core_grab (GdkDevice *device,
|
||||
GdkCursor *cursor,
|
||||
guint32 time_)
|
||||
{
|
||||
GdkWaylandDevice *wayland_device = GDK_DEVICE_CORE (device)->device;
|
||||
|
||||
if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
|
||||
{
|
||||
/* Device is a keyboard */
|
||||
return GDK_GRAB_SUCCESS;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Device is a pointer */
|
||||
|
||||
if (wayland_device->pointer_grab_window != NULL &&
|
||||
time_ != 0 && wayland_device->pointer_grab_time > time_)
|
||||
{
|
||||
return GDK_GRAB_ALREADY_GRABBED;
|
||||
}
|
||||
|
||||
if (time_ == 0)
|
||||
time_ = wayland_device->time;
|
||||
|
||||
wayland_device->pointer_grab_window = window;
|
||||
wayland_device->pointer_grab_time = time_;
|
||||
}
|
||||
|
||||
return GDK_GRAB_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -254,23 +208,6 @@ static void
|
||||
gdk_device_core_ungrab (GdkDevice *device,
|
||||
guint32 time_)
|
||||
{
|
||||
GdkDisplay *display;
|
||||
GdkDeviceGrabInfo *grab;
|
||||
|
||||
display = gdk_device_get_display (device);
|
||||
|
||||
if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
|
||||
{
|
||||
/* Device is a keyboard */
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Device is a pointer */
|
||||
grab = _gdk_display_get_last_device_grab (display, device);
|
||||
|
||||
if (grab)
|
||||
grab->serial_end = grab->serial_start;
|
||||
}
|
||||
}
|
||||
|
||||
static GdkWindow *
|
||||
@@ -378,19 +315,6 @@ input_handle_button(void *data, struct wl_input_device *input_device,
|
||||
GdkDisplayWayland *display = GDK_DISPLAY_WAYLAND (device->display);
|
||||
GdkEvent *event;
|
||||
uint32_t modifier;
|
||||
int gdk_button;
|
||||
|
||||
switch (button) {
|
||||
case 273:
|
||||
gdk_button = 3;
|
||||
break;
|
||||
case 274:
|
||||
gdk_button = 2;
|
||||
break;
|
||||
default:
|
||||
gdk_button = button - 271;
|
||||
break;
|
||||
}
|
||||
|
||||
device->time = time;
|
||||
event = gdk_event_new (state ? GDK_BUTTON_PRESS : GDK_BUTTON_RELEASE);
|
||||
@@ -403,10 +327,10 @@ input_handle_button(void *data, struct wl_input_device *input_device,
|
||||
event->button.y_root = (gdouble) device->y;
|
||||
event->button.axes = NULL;
|
||||
event->button.state = device->modifiers;
|
||||
event->button.button = gdk_button;
|
||||
event->button.button = button - 271;
|
||||
gdk_event_set_screen (event, display->screen);
|
||||
|
||||
modifier = 1 << (8 + gdk_button - 1);
|
||||
modifier = 1 << (8 + button - 272);
|
||||
if (state)
|
||||
device->modifiers |= modifier;
|
||||
else
|
||||
@@ -484,13 +408,11 @@ translate_keyboard_string (GdkEventKey *event)
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
keyboard_repeat (gpointer data);
|
||||
|
||||
static gboolean
|
||||
deliver_key_event(GdkWaylandDevice *device,
|
||||
uint32_t time, uint32_t key, uint32_t state)
|
||||
static void
|
||||
input_handle_key(void *data, struct wl_input_device *input_device,
|
||||
uint32_t time, uint32_t key, uint32_t state)
|
||||
{
|
||||
GdkWaylandDevice *device = data;
|
||||
GdkEvent *event;
|
||||
uint32_t code, modifier, level;
|
||||
struct xkb_desc *xkb;
|
||||
@@ -533,60 +455,6 @@ deliver_key_event(GdkWaylandDevice *device,
|
||||
"string %s, mods 0x%x",
|
||||
code, event->key.keyval,
|
||||
event->key.string, event->key.state));
|
||||
|
||||
device->repeat_count++;
|
||||
device->repeat_key = key;
|
||||
|
||||
if (state == 0)
|
||||
{
|
||||
if (device->repeat_timer)
|
||||
{
|
||||
g_source_remove (device->repeat_timer);
|
||||
device->repeat_timer = 0;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
else if (modifier)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
else switch (device->repeat_count)
|
||||
{
|
||||
case 1:
|
||||
if (device->repeat_timer)
|
||||
{
|
||||
g_source_remove (device->repeat_timer);
|
||||
device->repeat_timer = 0;
|
||||
}
|
||||
|
||||
device->repeat_timer =
|
||||
gdk_threads_add_timeout (400, keyboard_repeat, device);
|
||||
return TRUE;
|
||||
case 2:
|
||||
device->repeat_timer =
|
||||
gdk_threads_add_timeout (80, keyboard_repeat, device);
|
||||
return FALSE;
|
||||
default:
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
keyboard_repeat (gpointer data)
|
||||
{
|
||||
GdkWaylandDevice *device = data;
|
||||
|
||||
return deliver_key_event (device, device->time, device->repeat_key, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
input_handle_key(void *data, struct wl_input_device *input_device,
|
||||
uint32_t time, uint32_t key, uint32_t state)
|
||||
{
|
||||
GdkWaylandDevice *device = data;
|
||||
|
||||
device->repeat_count = 0;
|
||||
deliver_key_event (data, time, key, state);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -688,7 +556,6 @@ input_handle_keyboard_focus(void *data,
|
||||
device->time = time;
|
||||
if (device->keyboard_focus)
|
||||
{
|
||||
_gdk_wayland_window_remove_focus (device->keyboard_focus);
|
||||
event = gdk_event_new (GDK_FOCUS_CHANGE);
|
||||
event->focus_change.window = g_object_ref (device->keyboard_focus);
|
||||
event->focus_change.send_event = FALSE;
|
||||
@@ -723,8 +590,6 @@ input_handle_keyboard_focus(void *data,
|
||||
device, device->keyboard_focus));
|
||||
|
||||
_gdk_wayland_display_deliver_event (device->display, event);
|
||||
|
||||
_gdk_wayland_window_add_focus (device->keyboard_focus);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -858,21 +723,14 @@ data_device_selection (void *data,
|
||||
struct wl_data_offer *offer)
|
||||
{
|
||||
GdkWaylandDevice *device = (GdkWaylandDevice *)data;
|
||||
GdkDeviceManager *device_manager =
|
||||
gdk_display_get_device_manager (device->display);
|
||||
GdkDeviceManagerCore *device_manager_core =
|
||||
GDK_DEVICE_MANAGER_CORE (device_manager);
|
||||
|
||||
g_debug (G_STRLOC ": %s wl_data_device = %p wl_data_offer = %p",
|
||||
G_STRFUNC, wl_data_device, offer);
|
||||
|
||||
if (!offer)
|
||||
{
|
||||
if (device->selection_offer)
|
||||
{
|
||||
data_offer_unref (device->selection_offer);
|
||||
device->selection_offer = NULL;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (device->selection_offer)
|
||||
{
|
||||
data_offer_unref (device->selection_offer);
|
||||
@@ -953,7 +811,7 @@ _gdk_wayland_device_manager_add_device (GdkDeviceManager *device_manager,
|
||||
}
|
||||
|
||||
static void
|
||||
free_device (gpointer data)
|
||||
free_device (void *data, void *user_data)
|
||||
{
|
||||
g_object_unref (data);
|
||||
}
|
||||
@@ -965,7 +823,8 @@ gdk_device_manager_core_finalize (GObject *object)
|
||||
|
||||
device_manager_core = GDK_DEVICE_MANAGER_CORE (object);
|
||||
|
||||
g_list_free_full (device_manager_core->devices, free_device);
|
||||
g_list_foreach (device_manager_core->devices, free_device, NULL);
|
||||
g_list_free (device_manager_core->devices);
|
||||
|
||||
G_OBJECT_CLASS (gdk_device_manager_core_parent_class)->finalize (object);
|
||||
}
|
||||
@@ -1018,290 +877,3 @@ _gdk_wayland_device_manager_new (GdkDisplay *display)
|
||||
"display", display,
|
||||
NULL);
|
||||
}
|
||||
|
||||
gint
|
||||
gdk_wayland_device_get_selection_type_atoms (GdkDevice *gdk_device,
|
||||
GdkAtom **atoms_out)
|
||||
{
|
||||
gint i;
|
||||
GdkAtom *atoms;
|
||||
GdkWaylandDevice *device;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_DEVICE_CORE (gdk_device), 0);
|
||||
g_return_val_if_fail (atoms_out != NULL, 0);
|
||||
|
||||
device = GDK_DEVICE_CORE (gdk_device)->device;
|
||||
|
||||
if (!device->selection_offer || device->selection_offer->types->len == 0)
|
||||
{
|
||||
*atoms_out = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
atoms = g_new0 (GdkAtom, device->selection_offer->types->len);
|
||||
|
||||
/* Convert list of targets to atoms */
|
||||
for (i = 0; i < device->selection_offer->types->len; i++)
|
||||
{
|
||||
atoms[i] = gdk_atom_intern (device->selection_offer->types->pdata[i],
|
||||
FALSE);
|
||||
GDK_NOTE (MISC,
|
||||
g_message (G_STRLOC ": Adding atom for %s",
|
||||
(char *)device->selection_offer->types->pdata[i]));
|
||||
}
|
||||
|
||||
*atoms_out = atoms;
|
||||
return device->selection_offer->types->len;
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GdkWaylandDevice *device;
|
||||
DataOffer *offer;
|
||||
GIOChannel *channel;
|
||||
GdkDeviceWaylandRequestContentCallback cb;
|
||||
gpointer userdata;
|
||||
} RequestContentClosure;
|
||||
|
||||
static gboolean
|
||||
_request_content_io_func (GIOChannel *channel,
|
||||
GIOCondition condition,
|
||||
gpointer userdata)
|
||||
{
|
||||
RequestContentClosure *closure = (RequestContentClosure *)userdata;
|
||||
gchar *data = NULL;
|
||||
gsize len = 0;
|
||||
GError *error = NULL;
|
||||
|
||||
/* FIXME: We probably want to do something better than this to avoid
|
||||
* blocking on the transfer of large pieces of data: call the callback
|
||||
* multiple times I should think.
|
||||
*/
|
||||
if (g_io_channel_read_to_end (channel,
|
||||
&data,
|
||||
&len,
|
||||
&error) != G_IO_STATUS_NORMAL)
|
||||
{
|
||||
g_warning (G_STRLOC ": Error reading content from pipe: %s", error->message);
|
||||
g_clear_error (&error);
|
||||
}
|
||||
|
||||
/* Since we use _read_to_end we've got a guaranteed EOF and thus can go
|
||||
* ahead and close the fd
|
||||
*/
|
||||
g_io_channel_shutdown (channel, TRUE, NULL);
|
||||
|
||||
closure->cb (closure->device->pointer, data, len, closure->userdata);
|
||||
|
||||
g_free (data);
|
||||
data_offer_unref (closure->offer);
|
||||
g_io_channel_unref (channel);
|
||||
g_free (closure);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_wayland_device_request_selection_content (GdkDevice *gdk_device,
|
||||
const gchar *requested_mime_type,
|
||||
GdkDeviceWaylandRequestContentCallback cb,
|
||||
gpointer userdata)
|
||||
{
|
||||
int pipe_fd[2];
|
||||
RequestContentClosure *closure;
|
||||
GdkWaylandDevice *device;
|
||||
GError *error = NULL;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_DEVICE_CORE (gdk_device), FALSE);
|
||||
g_return_val_if_fail (requested_mime_type != NULL, FALSE);
|
||||
g_return_val_if_fail (cb != NULL, FALSE);
|
||||
|
||||
device = GDK_DEVICE_CORE (gdk_device)->device;
|
||||
|
||||
if (!device->selection_offer)
|
||||
return FALSE;
|
||||
|
||||
/* TODO: Check mimetypes */
|
||||
|
||||
closure = g_new0 (RequestContentClosure, 1);
|
||||
|
||||
device->selection_offer->ref_count++;
|
||||
|
||||
pipe2 (pipe_fd, O_CLOEXEC);
|
||||
wl_data_offer_receive (device->selection_offer->offer,
|
||||
requested_mime_type,
|
||||
pipe_fd[1]);
|
||||
close (pipe_fd[1]);
|
||||
|
||||
closure->device = device;
|
||||
closure->offer = device->selection_offer;
|
||||
closure->channel = g_io_channel_unix_new (pipe_fd[0]);
|
||||
closure->cb = cb;
|
||||
closure->userdata = userdata;
|
||||
|
||||
if (!g_io_channel_set_encoding (closure->channel, NULL, &error))
|
||||
{
|
||||
g_warning (G_STRLOC ": Error setting encoding on channel: %s",
|
||||
error->message);
|
||||
g_clear_error (&error);
|
||||
goto error;
|
||||
}
|
||||
|
||||
g_io_add_watch (closure->channel,
|
||||
G_IO_IN,
|
||||
_request_content_io_func,
|
||||
closure);
|
||||
|
||||
return TRUE;
|
||||
|
||||
error:
|
||||
data_offer_unref (closure->offer);
|
||||
g_io_channel_unref (closure->channel);
|
||||
close (pipe_fd[1]);
|
||||
g_free (closure);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
struct _GdkWaylandSelectionOffer {
|
||||
GdkDeviceWaylandOfferContentCallback cb;
|
||||
gpointer userdata;
|
||||
struct wl_data_source *source;
|
||||
GdkWaylandDevice *device;
|
||||
};
|
||||
|
||||
static void
|
||||
data_source_target (void *data,
|
||||
struct wl_data_source *source,
|
||||
const char *mime_type)
|
||||
{
|
||||
g_debug (G_STRLOC ": %s source = %p, mime_type = %s",
|
||||
G_STRFUNC, source, mime_type);
|
||||
}
|
||||
|
||||
static void
|
||||
data_source_send (void *data,
|
||||
struct wl_data_source *source,
|
||||
const char *mime_type,
|
||||
int32_t fd)
|
||||
{
|
||||
GdkWaylandSelectionOffer *offer = (GdkWaylandSelectionOffer *)data;;
|
||||
gchar *buf;
|
||||
gssize len, bytes_written = 0;
|
||||
|
||||
g_debug (G_STRLOC ": %s source = %p, mime_type = %s fd = %d",
|
||||
G_STRFUNC, source, mime_type, fd);
|
||||
|
||||
buf = offer->cb (offer->device->pointer, mime_type, &len, offer->userdata);
|
||||
|
||||
while (len > 0)
|
||||
{
|
||||
bytes_written += write (fd, buf + bytes_written, len);
|
||||
if (bytes_written == -1)
|
||||
goto error;
|
||||
len -= bytes_written;
|
||||
}
|
||||
|
||||
close (fd);
|
||||
g_free (buf);
|
||||
|
||||
return;
|
||||
error:
|
||||
|
||||
g_warning (G_STRLOC ": Error writing data to client: %s",
|
||||
g_strerror (errno));
|
||||
|
||||
close (fd);
|
||||
g_free (buf);
|
||||
}
|
||||
|
||||
static void
|
||||
data_source_cancelled (void *data,
|
||||
struct wl_data_source *source)
|
||||
{
|
||||
g_debug (G_STRLOC ": %s source = %p",
|
||||
G_STRFUNC, source);
|
||||
}
|
||||
|
||||
static const struct wl_data_source_listener data_source_listener = {
|
||||
data_source_target,
|
||||
data_source_send,
|
||||
data_source_cancelled
|
||||
};
|
||||
|
||||
static guint32
|
||||
_wl_time_now (void)
|
||||
{
|
||||
struct timeval tv;
|
||||
|
||||
gettimeofday(&tv, NULL);
|
||||
|
||||
return tv.tv_sec * 1000 + tv.tv_usec / 1000;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_wayland_device_offer_selection_content (GdkDevice *gdk_device,
|
||||
const gchar **mime_types,
|
||||
gint nr_mime_types,
|
||||
GdkDeviceWaylandOfferContentCallback cb,
|
||||
gpointer userdata)
|
||||
{
|
||||
GdkDisplay *display;
|
||||
GdkDisplayWayland *display_wayland;
|
||||
GdkWaylandSelectionOffer *offer;
|
||||
GdkWaylandDevice *device;
|
||||
gint i;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_DEVICE_CORE (gdk_device), 0);
|
||||
device = GDK_DEVICE_CORE (gdk_device)->device;
|
||||
|
||||
display = device->display;
|
||||
display_wayland = GDK_DISPLAY_WAYLAND (display);
|
||||
|
||||
offer = g_new0 (GdkWaylandSelectionOffer, 1);
|
||||
offer->cb = cb;
|
||||
offer->userdata = userdata;
|
||||
offer->source =
|
||||
wl_data_device_manager_create_data_source (display_wayland->data_device_manager);
|
||||
offer->device = device;
|
||||
|
||||
for (i = 0; i < nr_mime_types; i++)
|
||||
{
|
||||
wl_data_source_offer (offer->source,
|
||||
mime_types[i]);
|
||||
}
|
||||
|
||||
wl_data_source_add_listener (offer->source,
|
||||
&data_source_listener,
|
||||
offer);
|
||||
|
||||
wl_data_device_set_selection (device->data_device,
|
||||
offer->source,
|
||||
_wl_time_now ());
|
||||
|
||||
device->selection_offer_out = offer;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_wayland_device_clear_selection_content (GdkDevice *gdk_device)
|
||||
{
|
||||
GdkWaylandDevice *device;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_DEVICE_CORE (gdk_device), 0);
|
||||
device = GDK_DEVICE_CORE (gdk_device)->device;
|
||||
|
||||
if (!device->selection_offer_out)
|
||||
return FALSE;
|
||||
|
||||
wl_data_device_set_selection (device->data_device,
|
||||
NULL,
|
||||
_wl_time_now ());
|
||||
|
||||
wl_data_source_destroy (device->selection_offer_out->source);
|
||||
g_free (device->selection_offer_out);
|
||||
device->selection_offer_out = NULL;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -274,7 +274,8 @@ gdk_wayland_display_finalize (GObject *object)
|
||||
g_object_unref (display_wayland->keymap);
|
||||
|
||||
/* input GdkDevice list */
|
||||
g_list_free_full (display_wayland->input_devices, g_object_unref);
|
||||
g_list_foreach (display_wayland->input_devices, (GFunc) g_object_unref, NULL);
|
||||
g_list_free (display_wayland->input_devices);
|
||||
|
||||
g_object_unref (display_wayland->screen);
|
||||
|
||||
@@ -425,8 +426,7 @@ gdk_wayland_display_after_process_all_updates (GdkDisplay *display)
|
||||
static gulong
|
||||
gdk_wayland_display_get_next_serial (GdkDisplay *display)
|
||||
{
|
||||
static gulong serial = 0;
|
||||
return ++serial;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -135,8 +135,8 @@ gdk_wayland_display_manager_get_atom_name (GdkDisplayManager *manager_in,
|
||||
|
||||
while (g_hash_table_iter_next (&iter, &key, &value))
|
||||
{
|
||||
if (GDK_POINTER_TO_ATOM (value) == atom)
|
||||
return g_strdup (key);
|
||||
if (GDK_POINTER_TO_ATOM (key) == atom)
|
||||
return g_strdup (value);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
||||
@@ -113,10 +113,10 @@ void
|
||||
_gdk_wayland_display_deliver_event (GdkDisplay *display, GdkEvent *event)
|
||||
{
|
||||
GList *node;
|
||||
static int serial;
|
||||
|
||||
node = _gdk_event_queue_append (display, event);
|
||||
_gdk_windowing_got_event (display, node, event,
|
||||
_gdk_display_get_next_serial (display));
|
||||
_gdk_windowing_got_event (display, node, event, serial++);
|
||||
}
|
||||
|
||||
GSource *
|
||||
|
||||
@@ -515,10 +515,12 @@ gdk_wayland_keymap_add_virtual_modifiers (GdkKeymap *keymap,
|
||||
|
||||
wayland_keymap = GDK_WAYLAND_KEYMAP (keymap);
|
||||
|
||||
for (i = 4; i < 8; i++)
|
||||
for (i = 3; i < 8; i++)
|
||||
{
|
||||
if ((1 << i) & *state)
|
||||
{
|
||||
if (wayland_keymap->modmap[i] & GDK_MOD1_MASK)
|
||||
*state |= GDK_MOD1_MASK;
|
||||
if (wayland_keymap->modmap[i] & GDK_SUPER_MASK)
|
||||
*state |= GDK_SUPER_MASK;
|
||||
if (wayland_keymap->modmap[i] & GDK_HYPER_MASK)
|
||||
@@ -538,7 +540,7 @@ gdk_wayland_keymap_map_virtual_modifiers (GdkKeymap *keymap,
|
||||
};
|
||||
int i, j;
|
||||
GdkWaylandKeymap *wayland_keymap;
|
||||
gboolean retval = TRUE;
|
||||
gboolean retval;
|
||||
|
||||
wayland_keymap = GDK_WAYLAND_KEYMAP (keymap);
|
||||
|
||||
@@ -546,7 +548,7 @@ gdk_wayland_keymap_map_virtual_modifiers (GdkKeymap *keymap,
|
||||
{
|
||||
if (*state & vmods[j])
|
||||
{
|
||||
for (i = 4; i < 8; i++)
|
||||
for (i = 3; i < 8; i++)
|
||||
{
|
||||
if (wayland_keymap->modmap[i] & vmods[j])
|
||||
{
|
||||
|
||||
@@ -45,8 +45,10 @@
|
||||
#define GDK_WINDOW_IS_WAYLAND(win) (GDK_IS_WINDOW_IMPL_WAYLAND (((GdkWindow *)win)->impl))
|
||||
|
||||
GType _gdk_wayland_window_get_type (void);
|
||||
void _gdk_wayland_window_add_focus (GdkWindow *window);
|
||||
void _gdk_wayland_window_remove_focus (GdkWindow *window);
|
||||
void _gdk_wayland_window_update_size (GdkWindow *window,
|
||||
int32_t width,
|
||||
int32_t height,
|
||||
uint32_t edges);
|
||||
|
||||
GdkKeymap *_gdk_wayland_keymap_new (GdkDisplay *display);
|
||||
struct xkb_desc *_gdk_wayland_keymap_get_xkb_desc (GdkKeymap *keymap);
|
||||
|
||||
@@ -33,36 +33,6 @@ G_BEGIN_DECLS
|
||||
|
||||
GType gdk_wayland_display_manager_get_type (void);
|
||||
|
||||
#if defined (GTK_COMPILATION) || defined (GDK_COMPILATION)
|
||||
#define gdk_wayland_device_get_selection_type_atoms gdk_wayland_device_get_selection_type_atoms_libgtk_only
|
||||
int
|
||||
gdk_wayland_device_get_selection_type_atoms (GdkDevice *device,
|
||||
GdkAtom **atoms_out);
|
||||
|
||||
typedef void (*GdkDeviceWaylandRequestContentCallback) (GdkDevice *device, const gchar *data, gsize len, gpointer userdata);
|
||||
|
||||
#define gdk_wayland_device_request_selection_content gdk_wayland_device_request_selection_content_libgtk_only
|
||||
gboolean
|
||||
gdk_wayland_device_request_selection_content (GdkDevice *device,
|
||||
const gchar *requested_mime_type,
|
||||
GdkDeviceWaylandRequestContentCallback cb,
|
||||
gpointer userdata);
|
||||
|
||||
typedef gchar *(*GdkDeviceWaylandOfferContentCallback) (GdkDevice *device, const gchar *mime_type, gssize *len, gpointer userdata);
|
||||
|
||||
#define gdk_wayland_device_offer_selection_content gdk_wayland_device_offer_selection_content_libgtk_only
|
||||
gboolean
|
||||
gdk_wayland_device_offer_selection_content (GdkDevice *gdk_device,
|
||||
const gchar **mime_types,
|
||||
gint nr_mime_types,
|
||||
GdkDeviceWaylandOfferContentCallback cb,
|
||||
gpointer userdata);
|
||||
|
||||
#define gdk_wayland_device_clear_selection_content gdk_wayland_device_clear_selection_content_libgtk_only
|
||||
gboolean
|
||||
gdk_wayland_device_clear_selection_content (GdkDevice *gdk_device);
|
||||
|
||||
#endif
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_WAYLAND_H__ */
|
||||
|
||||
@@ -102,14 +102,42 @@ struct _GdkWindowImplWayland
|
||||
struct wl_shell_surface *shell_surface;
|
||||
unsigned int mapped : 1;
|
||||
GdkWindow *transient_for;
|
||||
GdkWindowTypeHint hint;
|
||||
|
||||
cairo_surface_t *cairo_surface;
|
||||
cairo_surface_t *server_surface;
|
||||
GLuint texture;
|
||||
uint32_t resize_edges;
|
||||
|
||||
int focus_count;
|
||||
/* Set if the window, or any descendent of it, is the server's focus window
|
||||
*/
|
||||
guint has_focus_window : 1;
|
||||
|
||||
/* Set if window->has_focus_window and the focus isn't grabbed elsewhere.
|
||||
*/
|
||||
guint has_focus : 1;
|
||||
|
||||
/* Set if the pointer is inside this window. (This is needed for
|
||||
* for focus tracking)
|
||||
*/
|
||||
guint has_pointer : 1;
|
||||
|
||||
/* Set if the window is a descendent of the focus window and the pointer is
|
||||
* inside it. (This is the case where the window will receive keystroke
|
||||
* events even window->has_focus_window is FALSE)
|
||||
*/
|
||||
guint has_pointer_focus : 1;
|
||||
|
||||
/* Set if we are requesting these hints */
|
||||
guint skip_taskbar_hint : 1;
|
||||
guint skip_pager_hint : 1;
|
||||
guint urgency_hint : 1;
|
||||
|
||||
guint on_all_desktops : 1; /* _NET_WM_STICKY == 0xFFFFFFFF */
|
||||
|
||||
guint have_sticky : 1; /* _NET_WM_STATE_STICKY */
|
||||
guint have_maxvert : 1; /* _NET_WM_STATE_MAXIMIZED_VERT */
|
||||
guint have_maxhorz : 1; /* _NET_WM_STATE_MAXIMIZED_HORZ */
|
||||
guint have_fullscreen : 1; /* _NET_WM_STATE_FULLSCREEN */
|
||||
|
||||
gulong map_serial; /* Serial of last transition from unmapped */
|
||||
|
||||
@@ -118,9 +146,6 @@ struct _GdkWindowImplWayland
|
||||
|
||||
/* Time of most recent user interaction. */
|
||||
gulong user_time;
|
||||
|
||||
GdkGeometry geometry_hints;
|
||||
GdkWindowHints geometry_mask;
|
||||
};
|
||||
|
||||
struct _GdkWindowImplWaylandClass
|
||||
@@ -136,36 +161,16 @@ _gdk_window_impl_wayland_init (GdkWindowImplWayland *impl)
|
||||
impl->toplevel_window_type = -1;
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_wayland_window_add_focus (GdkWindow *window)
|
||||
{
|
||||
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
|
||||
|
||||
impl->focus_count++;
|
||||
if (impl->focus_count == 1)
|
||||
gdk_synthesize_window_state (window, 0, GDK_WINDOW_STATE_FOCUSED);
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_wayland_window_remove_focus (GdkWindow *window)
|
||||
{
|
||||
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
|
||||
|
||||
impl->focus_count--;
|
||||
if (impl->focus_count == 0)
|
||||
gdk_synthesize_window_state (window, GDK_WINDOW_STATE_FOCUSED, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_wayland_window_update_size:
|
||||
* _gdk_wayland_window_update_size:
|
||||
* @drawable: a #GdkDrawableImplWayland.
|
||||
*
|
||||
* Updates the state of the drawable (in particular the drawable's
|
||||
* cairo surface) when its size has changed.
|
||||
**/
|
||||
static void
|
||||
gdk_wayland_window_update_size (GdkWindow *window,
|
||||
int32_t width, int32_t height, uint32_t edges)
|
||||
void
|
||||
_gdk_wayland_window_update_size (GdkWindow *window,
|
||||
int32_t width, int32_t height, uint32_t edges)
|
||||
{
|
||||
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
|
||||
GdkRectangle area;
|
||||
@@ -436,33 +441,6 @@ gdk_wayland_window_ref_cairo_surface (GdkWindow *window)
|
||||
return impl->cairo_surface;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_window_configure (GdkWindow *window,
|
||||
int width, int height, int edges)
|
||||
{
|
||||
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
|
||||
GdkDisplay *display;
|
||||
GdkEvent *event;
|
||||
|
||||
display = gdk_window_get_display (window);
|
||||
|
||||
/* TODO: Only generate a configure event if width or height have actually
|
||||
* changed?
|
||||
*/
|
||||
event = gdk_event_new (GDK_CONFIGURE);
|
||||
event->configure.window = window;
|
||||
event->configure.send_event = FALSE;
|
||||
event->configure.width = width;
|
||||
event->configure.height = height;
|
||||
|
||||
_gdk_window_update_size (window);
|
||||
gdk_wayland_window_update_size (window, width, height, edges);
|
||||
|
||||
g_object_ref(window);
|
||||
|
||||
_gdk_wayland_display_deliver_event (display, event);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_window_set_user_time (GdkWindow *window, guint32 user_time)
|
||||
{
|
||||
@@ -503,16 +481,23 @@ shell_surface_handle_configure(void *data,
|
||||
int32_t height)
|
||||
{
|
||||
GdkWindow *window = GDK_WINDOW (data);
|
||||
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
|
||||
GdkDisplay *display;
|
||||
GdkEvent *event;
|
||||
|
||||
gdk_window_constrain_size (&impl->geometry_hints,
|
||||
impl->geometry_mask,
|
||||
width,
|
||||
height,
|
||||
&width,
|
||||
&height);
|
||||
display = gdk_window_get_display (window);
|
||||
|
||||
gdk_wayland_window_configure (window, width, height, edges);
|
||||
event = gdk_event_new (GDK_CONFIGURE);
|
||||
event->configure.window = window;
|
||||
event->configure.send_event = FALSE;
|
||||
event->configure.width = width;
|
||||
event->configure.height = height;
|
||||
|
||||
_gdk_window_update_size (window);
|
||||
_gdk_wayland_window_update_size (window, width, height, edges);
|
||||
|
||||
g_object_ref(window);
|
||||
|
||||
_gdk_wayland_display_deliver_event (display, event);
|
||||
}
|
||||
|
||||
static const struct wl_shell_surface_listener shell_surface_listener = {
|
||||
@@ -543,8 +528,6 @@ gdk_wayland_window_show (GdkWindow *window, gboolean already_mapped)
|
||||
wl_shell_surface_add_listener(impl->shell_surface,
|
||||
&shell_surface_listener, window);
|
||||
|
||||
gdk_window_set_type_hint (window, impl->hint);
|
||||
|
||||
_gdk_make_event (window, GDK_MAP, NULL, FALSE);
|
||||
event = _gdk_make_event (window, GDK_VISIBILITY_NOTIFY, NULL, FALSE);
|
||||
event->visibility.state = GDK_VISIBILITY_UNOBSCURED;
|
||||
@@ -646,11 +629,7 @@ gdk_window_wayland_move_resize (GdkWindow *window,
|
||||
window->x = x;
|
||||
window->y = y;
|
||||
|
||||
/* If this function is called with width and height = -1 then that means
|
||||
* just move the window - don't update its size
|
||||
*/
|
||||
if (width > 0 && height > 0)
|
||||
gdk_wayland_window_configure (window, width, height, 0);
|
||||
_gdk_wayland_window_update_size (window, width, height, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -819,7 +798,6 @@ gdk_wayland_window_destroy (GdkWindow *window,
|
||||
{
|
||||
if (GDK_WINDOW_IMPL_WAYLAND (window->impl)->surface)
|
||||
wl_surface_destroy(GDK_WINDOW_IMPL_WAYLAND (window->impl)->surface);
|
||||
wl_shell_surface_destroy(GDK_WINDOW_IMPL_WAYLAND (window->impl)->shell_surface);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -860,20 +838,16 @@ static void
|
||||
gdk_wayland_window_set_type_hint (GdkWindow *window,
|
||||
GdkWindowTypeHint hint)
|
||||
{
|
||||
GdkWindowImplWayland *impl;
|
||||
|
||||
impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
|
||||
|
||||
if (GDK_WINDOW_DESTROYED (window))
|
||||
return;
|
||||
|
||||
impl->hint = hint;
|
||||
|
||||
switch (hint)
|
||||
{
|
||||
case GDK_WINDOW_TYPE_HINT_DIALOG:
|
||||
case GDK_WINDOW_TYPE_HINT_MENU:
|
||||
case GDK_WINDOW_TYPE_HINT_TOOLBAR:
|
||||
case GDK_WINDOW_TYPE_HINT_UTILITY:
|
||||
case GDK_WINDOW_TYPE_HINT_SPLASHSCREEN:
|
||||
case GDK_WINDOW_TYPE_HINT_DOCK:
|
||||
case GDK_WINDOW_TYPE_HINT_DESKTOP:
|
||||
case GDK_WINDOW_TYPE_HINT_DROPDOWN_MENU:
|
||||
@@ -886,11 +860,7 @@ gdk_wayland_window_set_type_hint (GdkWindow *window,
|
||||
default:
|
||||
g_warning ("Unknown hint %d passed to gdk_window_set_type_hint", hint);
|
||||
/* Fall thru */
|
||||
case GDK_WINDOW_TYPE_HINT_DIALOG:
|
||||
case GDK_WINDOW_TYPE_HINT_NORMAL:
|
||||
case GDK_WINDOW_TYPE_HINT_SPLASHSCREEN:
|
||||
if (impl->shell_surface)
|
||||
wl_shell_surface_set_toplevel (impl->shell_surface);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -930,17 +900,10 @@ gdk_wayland_window_set_geometry_hints (GdkWindow *window,
|
||||
const GdkGeometry *geometry,
|
||||
GdkWindowHints geom_mask)
|
||||
{
|
||||
GdkWindowImplWayland *impl;
|
||||
|
||||
if (GDK_WINDOW_DESTROYED (window) ||
|
||||
!WINDOW_IS_TOPLEVEL_OR_FOREIGN (window))
|
||||
return;
|
||||
|
||||
impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
|
||||
|
||||
impl->geometry_hints = *geometry;
|
||||
impl->geometry_mask = geom_mask;
|
||||
|
||||
/*
|
||||
* GDK_HINT_POS
|
||||
* GDK_HINT_USER_POS
|
||||
@@ -1231,14 +1194,9 @@ gdk_wayland_window_begin_resize_drag (GdkWindow *window,
|
||||
|
||||
impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
|
||||
|
||||
wl_shell_surface_resize (impl->shell_surface,
|
||||
_gdk_wayland_device_get_device (device),
|
||||
timestamp, grab_type);
|
||||
|
||||
/* This is needed since Wayland will absorb all the pointer events after the
|
||||
* above function - FIXME: Is this always safe..?
|
||||
*/
|
||||
gdk_device_ungrab (device, timestamp);
|
||||
wl_shell_surface_resize(impl->shell_surface,
|
||||
_gdk_wayland_device_get_device (device),
|
||||
timestamp, grab_type);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1249,6 +1207,7 @@ gdk_wayland_window_begin_move_drag (GdkWindow *window,
|
||||
gint root_y,
|
||||
guint32 timestamp)
|
||||
{
|
||||
GdkDisplay *display = gdk_window_get_display (window);
|
||||
GdkWindowImplWayland *impl;
|
||||
|
||||
if (GDK_WINDOW_DESTROYED (window) ||
|
||||
@@ -1257,13 +1216,8 @@ gdk_wayland_window_begin_move_drag (GdkWindow *window,
|
||||
|
||||
impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
|
||||
|
||||
wl_shell_surface_move (impl->shell_surface,
|
||||
_gdk_wayland_device_get_device (device), timestamp);
|
||||
|
||||
/* This is needed since Wayland will absorb all the pointer events after the
|
||||
* above function - FIXME: Is this always safe..?
|
||||
*/
|
||||
gdk_device_ungrab (device, timestamp);
|
||||
wl_shell_surface_move(impl->shell_surface,
|
||||
_gdk_wayland_device_get_device (device), timestamp);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -1503,11 +1503,7 @@ gdk_win32_window_raise (GdkWindow *window)
|
||||
0, 0, 0, 0,
|
||||
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE));
|
||||
else if (window->accept_focus)
|
||||
/* Do not wrap this in an API_CALL macro as SetForegroundWindow might
|
||||
* fail when for example dragging a window belonging to a different
|
||||
* application at the time of a gtk_window_present() call due to focus
|
||||
* stealing prevention. */
|
||||
SetForegroundWindow (GDK_WINDOW_HWND (window));
|
||||
API_CALL (BringWindowToTop, (GDK_WINDOW_HWND (window)));
|
||||
else
|
||||
API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window), HWND_TOP,
|
||||
0, 0, 0, 0,
|
||||
|
||||
@@ -221,7 +221,7 @@ startup_timeout (void *data)
|
||||
std->timeout_id = g_timeout_add_seconds ((min_timeout + 500)/1000, startup_timeout, std);
|
||||
|
||||
/* always remove this one, but we may have reinstalled another one. */
|
||||
return G_SOURCE_REMOVE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -742,7 +742,7 @@ _gdk_x11_device_xi2_translate_state (XIModifierState *mods_state,
|
||||
{
|
||||
gint group;
|
||||
|
||||
group = group_state->base + group_state->latched + group_state->locked;
|
||||
group = group_state->base | group_state->latched | group_state->locked;
|
||||
|
||||
/* FIXME: do we need the XKB complications for this ? */
|
||||
group = CLAMP(group, 0, 3);
|
||||
|
||||
@@ -100,8 +100,6 @@ _gdk_x11_device_manager_new (GdkDisplay *display)
|
||||
*
|
||||
* Returns: (transfer none): (allow-none): The #GdkDevice wrapping the device ID,
|
||||
* or %NULL if the given ID doesn't currently represent a device.
|
||||
*
|
||||
* Since: 3.2
|
||||
**/
|
||||
GdkDevice *
|
||||
gdk_x11_device_manager_lookup (GdkDeviceManager *device_manager,
|
||||
@@ -147,8 +145,6 @@ gdk_x11_device_manager_lookup (GdkDeviceManager *device_manager,
|
||||
* </note>
|
||||
*
|
||||
* Returns: the XInput2 device ID.
|
||||
*
|
||||
* Since: 3.2
|
||||
**/
|
||||
gint
|
||||
gdk_x11_device_get_id (GdkDevice *device)
|
||||
|
||||
@@ -308,8 +308,8 @@ gdk_x11_device_manager_xi_dispose (GObject *object)
|
||||
GdkX11DeviceManagerXI *device_manager;
|
||||
|
||||
device_manager = GDK_X11_DEVICE_MANAGER_XI (object);
|
||||
|
||||
g_list_free_full (device_manager->devices, g_object_unref);
|
||||
g_list_foreach (device_manager->devices, (GFunc) g_object_unref, NULL);
|
||||
g_list_free (device_manager->devices);
|
||||
device_manager->devices = NULL;
|
||||
|
||||
if (device_manager->id_table != NULL)
|
||||
|
||||
@@ -254,6 +254,10 @@ create_device (GdkDeviceManager *device_manager,
|
||||
input_source = GDK_SOURCE_ERASER;
|
||||
else if (strstr (tmp_name, "cursor"))
|
||||
input_source = GDK_SOURCE_CURSOR;
|
||||
else if (strstr (tmp_name, "finger") ||
|
||||
(strstr (tmp_name, "touch") &&
|
||||
!strstr (tmp_name, "touchpad")))
|
||||
input_source = GDK_SOURCE_TOUCH;
|
||||
else if (strstr (tmp_name, "wacom") ||
|
||||
strstr (tmp_name, "pen"))
|
||||
input_source = GDK_SOURCE_PEN;
|
||||
|
||||
@@ -1579,9 +1579,12 @@ device_grab_update_callback (GdkDisplay *display,
|
||||
gpointer data,
|
||||
gulong serial)
|
||||
{
|
||||
GdkPointerWindowInfo *pointer_info;
|
||||
GdkDevice *device = data;
|
||||
|
||||
_gdk_display_device_grab_update (display, device, NULL, serial);
|
||||
pointer_info = _gdk_display_get_pointer_info (display, device);
|
||||
_gdk_display_device_grab_update (display, device,
|
||||
pointer_info->last_slave, serial);
|
||||
}
|
||||
|
||||
#define XSERVER_TIME_IS_LATER(time1, time2) \
|
||||
@@ -1767,10 +1770,12 @@ gdk_x11_display_finalize (GObject *object)
|
||||
g_slist_free (display_x11->event_types);
|
||||
|
||||
/* input GdkDevice list */
|
||||
g_list_free_full (display_x11->input_devices, g_object_unref);
|
||||
g_list_foreach (display_x11->input_devices, (GFunc) g_object_unref, NULL);
|
||||
g_list_free (display_x11->input_devices);
|
||||
|
||||
/* input GdkWindow list */
|
||||
g_list_free_full (display_x11->input_windows, g_free);
|
||||
g_list_foreach (display_x11->input_windows, (GFunc) g_free, NULL);
|
||||
g_list_free (display_x11->input_windows);
|
||||
|
||||
/* Free all GdkScreens */
|
||||
for (i = 0; i < ScreenCount (display_x11->xdisplay); i++)
|
||||
|
||||
@@ -1311,45 +1311,17 @@ cleanup_atoms(gpointer data)
|
||||
g_free (supported_atoms);
|
||||
}
|
||||
|
||||
static Window
|
||||
get_net_supporting_wm_check (GdkX11Screen *screen,
|
||||
Window window)
|
||||
static void
|
||||
fetch_net_wm_check_window (GdkScreen *screen)
|
||||
{
|
||||
GdkX11Screen *x11_screen;
|
||||
GdkDisplay *display;
|
||||
Atom type;
|
||||
gint format;
|
||||
gulong n_items;
|
||||
gulong bytes_after;
|
||||
guchar *data;
|
||||
Window value;
|
||||
|
||||
display = screen->display;
|
||||
type = None;
|
||||
data = NULL;
|
||||
value = None;
|
||||
|
||||
gdk_x11_display_error_trap_push (display);
|
||||
XGetWindowProperty (screen->xdisplay, window,
|
||||
gdk_x11_get_xatom_by_name_for_display (display, "_NET_SUPPORTING_WM_CHECK"),
|
||||
0, G_MAXLONG, False, XA_WINDOW, &type, &format,
|
||||
&n_items, &bytes_after, &data);
|
||||
gdk_x11_display_error_trap_pop_ignored (display);
|
||||
|
||||
if (type == XA_WINDOW)
|
||||
value = *(Window *)data;
|
||||
|
||||
if (data)
|
||||
XFree (data);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
static void
|
||||
fetch_net_wm_check_window (GdkScreen *screen)
|
||||
{
|
||||
GdkX11Screen *x11_screen;
|
||||
GdkDisplay *display;
|
||||
Window window;
|
||||
Window *xwindow;
|
||||
GTimeVal tv;
|
||||
gint error;
|
||||
|
||||
@@ -1357,46 +1329,57 @@ fetch_net_wm_check_window (GdkScreen *screen)
|
||||
display = x11_screen->display;
|
||||
|
||||
g_return_if_fail (GDK_X11_DISPLAY (display)->trusted_client);
|
||||
|
||||
if (x11_screen->wmspec_check_window != None)
|
||||
return; /* already have it */
|
||||
|
||||
|
||||
g_get_current_time (&tv);
|
||||
|
||||
if (ABS (tv.tv_sec - x11_screen->last_wmspec_check_time) < 15)
|
||||
return; /* we've checked recently */
|
||||
|
||||
window = get_net_supporting_wm_check (x11_screen, x11_screen->xroot_window);
|
||||
if (window == None)
|
||||
return;
|
||||
x11_screen->last_wmspec_check_time = tv.tv_sec;
|
||||
|
||||
if (window != get_net_supporting_wm_check (x11_screen, window))
|
||||
return;
|
||||
data = NULL;
|
||||
XGetWindowProperty (x11_screen->xdisplay, x11_screen->xroot_window,
|
||||
gdk_x11_get_xatom_by_name_for_display (display, "_NET_SUPPORTING_WM_CHECK"),
|
||||
0, G_MAXLONG, False, XA_WINDOW, &type, &format,
|
||||
&n_items, &bytes_after, &data);
|
||||
|
||||
if (type != XA_WINDOW)
|
||||
{
|
||||
if (data)
|
||||
XFree (data);
|
||||
return;
|
||||
}
|
||||
|
||||
xwindow = (Window *)data;
|
||||
|
||||
if (x11_screen->wmspec_check_window == *xwindow)
|
||||
{
|
||||
XFree (xwindow);
|
||||
return;
|
||||
}
|
||||
|
||||
gdk_x11_display_error_trap_push (display);
|
||||
|
||||
/* Find out if this WM goes away, so we can reset everything. */
|
||||
XSelectInput (x11_screen->xdisplay, window, StructureNotifyMask);
|
||||
XSelectInput (x11_screen->xdisplay, *xwindow, StructureNotifyMask);
|
||||
|
||||
error = gdk_x11_display_error_trap_pop (display);
|
||||
if (!error)
|
||||
{
|
||||
/* We check the window property again because after XGetWindowProperty()
|
||||
* and before XSelectInput() the window may have been recycled in such a
|
||||
* way that XSelectInput() doesn't fail but the window is no longer what
|
||||
* we want.
|
||||
*/
|
||||
if (window != get_net_supporting_wm_check (x11_screen, window))
|
||||
return;
|
||||
|
||||
x11_screen->wmspec_check_window = window;
|
||||
x11_screen->last_wmspec_check_time = tv.tv_sec;
|
||||
x11_screen->wmspec_check_window = *xwindow;
|
||||
x11_screen->need_refetch_net_supported = TRUE;
|
||||
x11_screen->need_refetch_wm_name = TRUE;
|
||||
|
||||
/* Careful, reentrancy */
|
||||
_gdk_x11_screen_window_manager_changed (screen);
|
||||
_gdk_x11_screen_window_manager_changed (GDK_SCREEN (x11_screen));
|
||||
}
|
||||
else if (error == BadWindow)
|
||||
{
|
||||
/* Leftover property, try again immediately, new wm may be starting up */
|
||||
x11_screen->last_wmspec_check_time = 0;
|
||||
}
|
||||
|
||||
XFree (xwindow);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3095,8 +3095,6 @@ gdk_x11_window_set_user_time (GdkWindow *window,
|
||||
* This function modifies or removes an arbitrary X11 window
|
||||
* property of type UTF8_STRING. If the given @window is
|
||||
* not a toplevel window, it is ignored.
|
||||
*
|
||||
* Since: 3.4
|
||||
*/
|
||||
void
|
||||
gdk_x11_window_set_utf8_property (GdkWindow *window,
|
||||
@@ -4368,7 +4366,7 @@ _gdk_x11_moveresize_handle_event (XEvent *event)
|
||||
finish_drag (mv_resize);
|
||||
break;
|
||||
|
||||
#if defined (HAVE_XGENERICEVENTS) && defined (XINPUT_2)
|
||||
#ifdef HAVE_XGENERICEVENTS
|
||||
case GenericEvent:
|
||||
{
|
||||
/* we just assume this is an XI2 event */
|
||||
|
||||
@@ -172,7 +172,6 @@ gtk_public_h_sources = \
|
||||
gtkaccellabel.h \
|
||||
gtkaccelmap.h \
|
||||
gtkaccessible.h \
|
||||
gtkactionable.h \
|
||||
gtkaction.h \
|
||||
gtkactiongroup.h \
|
||||
gtkactivatable.h \
|
||||
@@ -393,7 +392,6 @@ gtk_private_type_h_sources = \
|
||||
# GTK+ header files that don't get installed
|
||||
gtk_private_h_sources = \
|
||||
gactionmuxer.h \
|
||||
gsimpleactionobserver.h \
|
||||
gactionobserver.h \
|
||||
gactionobservable.h \
|
||||
gtkapplicationprivate.h \
|
||||
@@ -404,29 +402,18 @@ gtk_private_h_sources = \
|
||||
gtkappchoosermodule.h \
|
||||
gtkappchooseronline.h \
|
||||
gtkbindingsprivate.h \
|
||||
gtkbitmaskprivate.h \
|
||||
gtkborderimageprivate.h \
|
||||
gtkboxprivate.h \
|
||||
gtkbuilderprivate.h \
|
||||
gtkbuttonprivate.h \
|
||||
gtkcellareaboxcontextprivate.h \
|
||||
gtkcontainerprivate.h \
|
||||
gtkcsscomputedvaluesprivate.h \
|
||||
gtkcsscustompropertyprivate.h \
|
||||
gtkcssimagegradientprivate.h \
|
||||
gtkcssimagelinearprivate.h \
|
||||
gtkcssimageprivate.h \
|
||||
gtkcssimageurlprivate.h \
|
||||
gtkcssimagewin32private.h \
|
||||
gtkcsslookupprivate.h \
|
||||
gtkcssparserprivate.h \
|
||||
gtkcssproviderprivate.h \
|
||||
gtkcsssectionprivate.h \
|
||||
gtkcssselectorprivate.h \
|
||||
gtkcssshorthandpropertyprivate.h \
|
||||
gtkcssstylefuncsprivate.h \
|
||||
gtkcssstylepropertyprivate.h \
|
||||
gtkcustompaperunixdialog.h \
|
||||
gtkdndcursors.h \
|
||||
gtkentryprivate.h \
|
||||
gtkfilechooserdefault.h \
|
||||
gtkfilechooserembed.h \
|
||||
@@ -466,7 +453,6 @@ gtk_private_h_sources = \
|
||||
gtkrecentchooserdefault.h \
|
||||
gtkrecentchooserprivate.h \
|
||||
gtkrecentchooserutils.h \
|
||||
gtkresources.h \
|
||||
gtkroundedboxprivate.h \
|
||||
gtkscaleprivate.h \
|
||||
gtksearchengine.h \
|
||||
@@ -479,8 +465,6 @@ gtk_private_h_sources = \
|
||||
gtkstylecontextprivate.h \
|
||||
gtkstylepropertiesprivate.h \
|
||||
gtkstylepropertyprivate.h \
|
||||
gtkstyleproviderprivate.h \
|
||||
gtksymboliccolorprivate.h \
|
||||
gtktextbtree.h \
|
||||
gtktextbufferserialize.h \
|
||||
gtktextchildprivate.h \
|
||||
@@ -528,10 +512,8 @@ deprecated_c_sources = \
|
||||
gtk_base_c_sources = \
|
||||
$(deprecated_c_sources) \
|
||||
gactionmuxer.c \
|
||||
gsimpleactionobserver.c \
|
||||
gactionobserver.c \
|
||||
gactionobservable.c \
|
||||
gtkactionable.c \
|
||||
gtkquery.c \
|
||||
gtksearchengine.c \
|
||||
gtksearchenginesimple.c \
|
||||
@@ -561,14 +543,12 @@ gtk_base_c_sources = \
|
||||
gtkbbox.c \
|
||||
gtkbin.c \
|
||||
gtkbindings.c \
|
||||
gtkbitmask.c \
|
||||
gtkborder.c \
|
||||
gtkborderimage.c \
|
||||
gtkbox.c \
|
||||
gtkbuildable.c \
|
||||
gtkbuilder.c \
|
||||
gtkbuilderparser.c \
|
||||
gtkbuilder-menus.c \
|
||||
gtkbutton.c \
|
||||
gtkcalendar.c \
|
||||
gtkcellarea.c \
|
||||
@@ -595,23 +575,10 @@ gtk_base_c_sources = \
|
||||
gtkcombobox.c \
|
||||
gtkcomboboxtext.c \
|
||||
gtkcontainer.c \
|
||||
gtkcsscomputedvalues.c \
|
||||
gtkcsscustomproperty.c \
|
||||
gtkcssimage.c \
|
||||
gtkcssimagegradient.c \
|
||||
gtkcssimagelinear.c \
|
||||
gtkcssimageurl.c \
|
||||
gtkcssimagewin32.c \
|
||||
gtkcsslookup.c \
|
||||
gtkcssparser.c \
|
||||
gtkcssprovider.c \
|
||||
gtkcsssection.c \
|
||||
gtkcssselector.c \
|
||||
gtkcssshorthandproperty.c \
|
||||
gtkcssshorthandpropertyimpl.c \
|
||||
gtkcssstylefuncs.c \
|
||||
gtkcssstyleproperty.c \
|
||||
gtkcssstylepropertyimpl.c \
|
||||
gtkcsstypes.c \
|
||||
gtkdialog.c \
|
||||
gtkdrawingarea.c \
|
||||
@@ -710,7 +677,6 @@ gtk_base_c_sources = \
|
||||
gtkrecentchooser.c \
|
||||
gtkrecentfilter.c \
|
||||
gtkrecentmanager.c \
|
||||
gtkresources.c \
|
||||
gtkroundedbox.c \
|
||||
gtkscale.c \
|
||||
gtkscalebutton.c \
|
||||
@@ -735,7 +701,6 @@ gtk_base_c_sources = \
|
||||
gtkstyleproperties.c \
|
||||
gtkstyleproperty.c \
|
||||
gtkstyleprovider.c \
|
||||
gtkstyleproviderprivate.c \
|
||||
gtkswitch.c \
|
||||
gtksymboliccolor.c \
|
||||
gtktestutils.c \
|
||||
@@ -879,15 +844,8 @@ gtk_clipboard_dnd_c_sources = \
|
||||
gtkclipboard-quartz.c \
|
||||
gtkdnd-quartz.c
|
||||
else
|
||||
if USE_WAYLAND
|
||||
# No wayland gtkdnd-wayland.c yet
|
||||
gtk_clipboard_dnd_c_sources = \
|
||||
gtkclipboard-wayland.c \
|
||||
gtkdnd.c
|
||||
else
|
||||
gtk_clipboard_dnd_c_sources = gtkclipboard.c gtkdnd.c
|
||||
endif
|
||||
endif
|
||||
|
||||
# we use our own built_sources variable rules to avoid automake's
|
||||
# BUILT_SOURCES oddities
|
||||
@@ -901,13 +859,12 @@ gtk_built_public_sources = \
|
||||
|
||||
# built headers that don't get installed
|
||||
gtk_built_private_headers = \
|
||||
gtkresources.h \
|
||||
gtkmarshalers.h \
|
||||
gtkbuiltincache.h \
|
||||
gtkprivatetypebuiltins.h
|
||||
gtkprivatetypebuiltins.h \
|
||||
gtkwin32css.h
|
||||
|
||||
gtk_built_sources = \
|
||||
gtkresources.c \
|
||||
gtktypebuiltins.c \
|
||||
gtktypefuncs.c \
|
||||
gtkmarshalers.c \
|
||||
@@ -919,6 +876,7 @@ stamp_files = \
|
||||
stamp-gtkmarshalers.h \
|
||||
stamp-gtktypebuiltins.h \
|
||||
stamp-gtkprivatetypebuiltins.h \
|
||||
stamp-gtkwin32css.h \
|
||||
stamp-icons
|
||||
|
||||
# non-header sources (headers should be specified in the above variables)
|
||||
@@ -949,19 +907,6 @@ EXTRA_DIST += $(gtk_private_h_sources) $(gtk_extra_sources)
|
||||
EXTRA_DIST += $(gtk_built_sources)
|
||||
EXTRA_DIST += $(STOCK_ICONS)
|
||||
|
||||
|
||||
pkgdatadir=$(datadir)/gtk-$(GTK_API_VERSION)
|
||||
pkgdata_DATA = gtkbuilder.rng
|
||||
|
||||
EXTRA_DIST += gtkbuilder.rnc gtkbuilder.rng
|
||||
|
||||
DND_CURSORS = \
|
||||
cursor_dnd_ask.png \
|
||||
cursor_dnd_copy.png \
|
||||
cursor_dnd_link.png \
|
||||
cursor_dnd_move.png \
|
||||
cursor_dnd_none.png
|
||||
|
||||
#
|
||||
# rules to generate built sources
|
||||
#
|
||||
@@ -989,6 +934,14 @@ gtkmarshalers.c: @REBUILD@ gtkmarshalers.list
|
||||
&& cp xgen-gmlc gtkmarshalers.c \
|
||||
&& rm -f xgen-gmlc
|
||||
|
||||
gtkwin32css.h: stamp-gtkwin32css.h
|
||||
@true
|
||||
stamp-gtkwin32css.h: @REBUILD@ gtk-win32.css
|
||||
$(AWK) 'BEGIN { print "static const char *gtk_win32_default_css = " } { print " \"" $$0 "\\n\""} END { print ";" }' < $(srcdir)/gtk-win32.css >> xgen-gw3c\
|
||||
&& (cmp -s xgen-gw3c gtkwin32css.h || cp xgen-gw3c gtkwin32css.h) \
|
||||
&& rm -f xgen-gw3c \
|
||||
&& echo timestamp > $(@F)
|
||||
|
||||
gtktypebuiltins.h: stamp-gtktypebuiltins.h
|
||||
@true
|
||||
stamp-gtktypebuiltins.h: @REBUILD@ $(gtk_public_h_sources) $(deprecated_h_sources) gtktypebuiltins.h.template
|
||||
@@ -1003,12 +956,6 @@ gtktypebuiltins.c: @REBUILD@ $(gtk_public_h_sources) $(deprecated_h_sources) gtk
|
||||
&& cp xgen-gtbc gtktypebuiltins.c \
|
||||
&& rm -f xgen-gtbc
|
||||
|
||||
gtkresources.h: gtk.gresource.xml
|
||||
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $(srcdir)/gtk.gresource.xml \
|
||||
--target=$@ --sourcedir=$(srcdir) --c-name _gtk --generate-header --manual-register
|
||||
gtkresources.c: gtk.gresource.xml gtk-default.css gtk-win32.css $(DND_CURSORS)
|
||||
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $(srcdir)/gtk.gresource.xml \
|
||||
--target=$@ --sourcedir=$(srcdir) --c-name _gtk --generate-source --manual-register
|
||||
|
||||
gtkprivatetypebuiltins.h: stamp-gtkprivatetypebuiltins.h
|
||||
@true
|
||||
@@ -1540,7 +1487,6 @@ endif
|
||||
|
||||
EXTRA_DIST += \
|
||||
$(STOCK_ICONS) \
|
||||
$(DND_CURSORS) \
|
||||
$(GENERATED_ICONS) \
|
||||
gtk.def \
|
||||
gtk-win32.rc \
|
||||
@@ -1552,8 +1498,6 @@ EXTRA_DIST += \
|
||||
gtkprint-win32.c \
|
||||
gtksearchenginequartz.h \
|
||||
gtk.css.raleigh \
|
||||
gtk.gresource.xml \
|
||||
gtk-default.css \
|
||||
gtk-keys.css.default \
|
||||
gtk-keys.css.emacs \
|
||||
gtk-keys.css.mac \
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
static GHashTable *listener_list = NULL;
|
||||
static gint listener_idx = 1;
|
||||
static GSList *key_listener_list = NULL;
|
||||
static guint key_snooper_id = 0;
|
||||
|
||||
typedef struct _GailUtilListenerInfo GailUtilListenerInfo;
|
||||
typedef struct _GailKeyEventInfo GailKeyEventInfo;
|
||||
@@ -367,9 +368,10 @@ typedef struct {
|
||||
guint key;
|
||||
} KeyEventListener;
|
||||
|
||||
gboolean
|
||||
_gail_util_key_snooper (GtkWidget *the_widget,
|
||||
GdkEventKey *event)
|
||||
static gint
|
||||
gail_key_snooper (GtkWidget *the_widget,
|
||||
GdkEventKey *event,
|
||||
gpointer data)
|
||||
{
|
||||
GSList *l;
|
||||
AtkKeyEventStruct *atk_event;
|
||||
@@ -397,6 +399,9 @@ gail_util_add_key_event_listener (AtkKeySnoopFunc listener_func,
|
||||
static guint key = 0;
|
||||
KeyEventListener *listener;
|
||||
|
||||
if (key_snooper_id == 0)
|
||||
key_snooper_id = gtk_key_snooper_install (gail_key_snooper, NULL);
|
||||
|
||||
key++;
|
||||
|
||||
listener = g_slice_new0 (KeyEventListener);
|
||||
@@ -426,6 +431,12 @@ gail_util_remove_key_event_listener (guint listener_key)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (key_listener_list == NULL)
|
||||
{
|
||||
gtk_key_snooper_remove (key_snooper_id);
|
||||
key_snooper_id = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static AtkObject *
|
||||
|
||||
@@ -26,9 +26,6 @@ G_BEGIN_DECLS
|
||||
|
||||
void _gail_util_install (void);
|
||||
|
||||
gboolean _gail_util_key_snooper (GtkWidget *the_widget,
|
||||
GdkEventKey *event);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GAIL_UTIL_H__ */
|
||||
|
||||
@@ -31,9 +31,9 @@
|
||||
#include <glib/gstdio.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "gtktextviewaccessible.h"
|
||||
#include "gtk/gtkwidgetprivate.h"
|
||||
|
||||
|
||||
static void setup_buffer (GtkTextView *view,GtkTextViewAccessible *accessible);
|
||||
static void insert_text_cb (GtkTextBuffer *buffer,
|
||||
GtkTextIter *arg1,
|
||||
gchar *arg2,
|
||||
@@ -65,6 +65,8 @@ gtk_text_view_accessible_initialize (AtkObject *obj,
|
||||
{
|
||||
ATK_OBJECT_CLASS (_gtk_text_view_accessible_parent_class)->initialize (obj, data);
|
||||
|
||||
setup_buffer (GTK_TEXT_VIEW (data), GTK_TEXT_VIEW_ACCESSIBLE (obj));
|
||||
|
||||
obj->role = ATK_ROLE_TEXT;
|
||||
}
|
||||
|
||||
@@ -83,6 +85,10 @@ gtk_text_view_accessible_notify_gtk (GObject *obj,
|
||||
editable = gtk_text_view_get_editable (GTK_TEXT_VIEW (obj));
|
||||
atk_object_notify_state_change (atk_obj, ATK_STATE_EDITABLE, editable);
|
||||
}
|
||||
else if (!strcmp (pspec->name, "buffer"))
|
||||
{
|
||||
setup_buffer (GTK_TEXT_VIEW (obj), GTK_TEXT_VIEW_ACCESSIBLE (atk_obj));
|
||||
}
|
||||
else
|
||||
GTK_WIDGET_ACCESSIBLE_CLASS (_gtk_text_view_accessible_parent_class)->notify_gtk (obj, pspec);
|
||||
}
|
||||
@@ -106,50 +112,12 @@ gtk_text_view_accessible_ref_state_set (AtkObject *accessible)
|
||||
return state_set;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_text_view_accessible_change_buffer (GtkTextViewAccessible *accessible,
|
||||
GtkTextBuffer *old_buffer,
|
||||
GtkTextBuffer *new_buffer)
|
||||
{
|
||||
if (old_buffer)
|
||||
{
|
||||
g_signal_handlers_disconnect_matched (old_buffer, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, accessible);
|
||||
}
|
||||
|
||||
if (new_buffer)
|
||||
{
|
||||
g_signal_connect_after (new_buffer, "insert-text", G_CALLBACK (insert_text_cb), accessible);
|
||||
g_signal_connect (new_buffer, "delete-range", G_CALLBACK (delete_range_cb), accessible);
|
||||
g_signal_connect_after (new_buffer, "mark-set", G_CALLBACK (mark_set_cb), accessible);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_text_view_accessible_widget_set (GtkAccessible *accessible)
|
||||
{
|
||||
gtk_text_view_accessible_change_buffer (GTK_TEXT_VIEW_ACCESSIBLE (accessible),
|
||||
NULL,
|
||||
gtk_text_view_get_buffer (GTK_TEXT_VIEW (gtk_accessible_get_widget (accessible))));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_text_view_accessible_widget_unset (GtkAccessible *accessible)
|
||||
{
|
||||
gtk_text_view_accessible_change_buffer (GTK_TEXT_VIEW_ACCESSIBLE (accessible),
|
||||
gtk_text_view_get_buffer (GTK_TEXT_VIEW (gtk_accessible_get_widget (accessible))),
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
_gtk_text_view_accessible_class_init (GtkTextViewAccessibleClass *klass)
|
||||
{
|
||||
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
|
||||
GtkAccessibleClass *accessible_class = GTK_ACCESSIBLE_CLASS (klass);
|
||||
GtkWidgetAccessibleClass *widget_class = (GtkWidgetAccessibleClass*)klass;
|
||||
|
||||
accessible_class->widget_set = gtk_text_view_accessible_widget_set;
|
||||
accessible_class->widget_unset = gtk_text_view_accessible_widget_unset;
|
||||
|
||||
class->ref_state_set = gtk_text_view_accessible_ref_state_set;
|
||||
class->initialize = gtk_text_view_accessible_initialize;
|
||||
|
||||
@@ -161,6 +129,20 @@ _gtk_text_view_accessible_init (GtkTextViewAccessible *accessible)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
setup_buffer (GtkTextView *view,
|
||||
GtkTextViewAccessible *accessible)
|
||||
{
|
||||
GtkTextBuffer *buffer;
|
||||
|
||||
buffer = gtk_text_view_get_buffer (view);
|
||||
|
||||
/* Set up signal callbacks */
|
||||
g_signal_connect_after (buffer, "insert-text", G_CALLBACK (insert_text_cb), view);
|
||||
g_signal_connect (buffer, "delete-range", G_CALLBACK (delete_range_cb), view);
|
||||
g_signal_connect_after (buffer, "mark-set", G_CALLBACK (mark_set_cb), view);
|
||||
}
|
||||
|
||||
static gchar *
|
||||
gtk_text_view_accessible_get_text (AtkText *text,
|
||||
gint start_offset,
|
||||
@@ -1745,10 +1727,13 @@ insert_text_cb (GtkTextBuffer *buffer,
|
||||
gint len,
|
||||
gpointer data)
|
||||
{
|
||||
GtkTextViewAccessible *accessible = data;
|
||||
GtkTextView *view = data;
|
||||
GtkTextViewAccessible *accessible;
|
||||
gint position;
|
||||
gint length;
|
||||
|
||||
accessible = GTK_TEXT_VIEW_ACCESSIBLE (gtk_widget_get_accessible (GTK_WIDGET (view)));
|
||||
|
||||
position = gtk_text_iter_get_offset (iter);
|
||||
length = g_utf8_strlen (text, len);
|
||||
|
||||
@@ -1763,9 +1748,12 @@ delete_range_cb (GtkTextBuffer *buffer,
|
||||
GtkTextIter *end,
|
||||
gpointer data)
|
||||
{
|
||||
GtkTextViewAccessible *accessible = data;
|
||||
GtkTextView *view = data;
|
||||
GtkTextViewAccessible *accessible;
|
||||
gint offset, length;
|
||||
|
||||
accessible = GTK_TEXT_VIEW_ACCESSIBLE (gtk_widget_get_accessible (GTK_WIDGET (view)));
|
||||
|
||||
offset = gtk_text_iter_get_offset (start);
|
||||
length = gtk_text_iter_get_offset (end) - offset;
|
||||
|
||||
@@ -1783,7 +1771,10 @@ mark_set_cb (GtkTextBuffer *buffer,
|
||||
GtkTextMark *mark,
|
||||
gpointer data)
|
||||
{
|
||||
GtkTextViewAccessible *accessible = data;
|
||||
GtkTextView *text = data;
|
||||
GtkTextViewAccessible *accessible;
|
||||
|
||||
accessible = GTK_TEXT_VIEW_ACCESSIBLE (gtk_widget_get_accessible (GTK_WIDGET (text)));
|
||||
|
||||
/*
|
||||
* Only generate the signal for the "insert" mark, which
|
||||
@@ -1938,22 +1929,3 @@ atk_streamable_content_interface_init (AtkStreamableContentIface *iface)
|
||||
iface->get_mime_type = gail_streamable_content_get_mime_type;
|
||||
iface->get_stream = gail_streamable_content_get_stream;
|
||||
}
|
||||
|
||||
void
|
||||
_gtk_text_view_accessible_set_buffer (GtkTextView *textview,
|
||||
GtkTextBuffer *old_buffer)
|
||||
{
|
||||
GtkTextViewAccessible *accessible;
|
||||
|
||||
g_return_if_fail (GTK_IS_TEXT_VIEW (textview));
|
||||
g_return_if_fail (old_buffer == NULL || GTK_IS_TEXT_BUFFER (old_buffer));
|
||||
|
||||
accessible = GTK_TEXT_VIEW_ACCESSIBLE (_gtk_widget_peek_accessible (GTK_WIDGET (textview)));
|
||||
if (accessible == NULL)
|
||||
return;
|
||||
|
||||
gtk_text_view_accessible_change_buffer (accessible,
|
||||
old_buffer,
|
||||
gtk_text_view_get_buffer (textview));
|
||||
}
|
||||
|
||||
|
||||
@@ -47,11 +47,7 @@ struct _GtkTextViewAccessibleClass
|
||||
GtkContainerAccessibleClass parent_class;
|
||||
};
|
||||
|
||||
GType _gtk_text_view_accessible_get_type (void);
|
||||
|
||||
void _gtk_text_view_accessible_set_buffer (GtkTextView *textview,
|
||||
GtkTextBuffer *old_buffer);
|
||||
|
||||
GType _gtk_text_view_accessible_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -204,7 +204,7 @@ find_label (GtkWidget *widget)
|
||||
ptr = labels;
|
||||
while (ptr)
|
||||
{
|
||||
if (ptr->data)
|
||||
if (ptr->data && gtk_widget_get_visible (GTK_WIDGET (ptr->data)))
|
||||
{
|
||||
label = ptr->data;
|
||||
break;
|
||||
|
||||
|
Before Width: | Height: | Size: 201 B |
|
Before Width: | Height: | Size: 183 B |
|
Before Width: | Height: | Size: 216 B |
|
Before Width: | Height: | Size: 197 B |
|
Before Width: | Height: | Size: 144 B |
@@ -84,7 +84,7 @@ gtk_hbox_init (GtkHBox *hbox)
|
||||
* Returns: a new #GtkHBox.
|
||||
*
|
||||
* Deprecated: 3.2: You can use gtk_box_new() with %GTK_ORIENTATION_HORIZONTAL instead,
|
||||
* which is a quick and easy change. But the recommendation is to switch to
|
||||
* wich is a very quick and easy change. But the recommendation is to switch to
|
||||
* #GtkGrid, since #GtkBox is going to go away eventually.
|
||||
* See <xref linkend="gtk-migrating-GtkGrid"/>.
|
||||
*/
|
||||
|
||||
@@ -88,7 +88,7 @@ gtk_vbox_init (GtkVBox *vbox)
|
||||
* Returns: a new #GtkVBox.
|
||||
*
|
||||
* Deprecated: 3.2: You can use gtk_box_new() with %GTK_ORIENTATION_VERTICAL instead,
|
||||
* which is a quick and easy change. But the recommendation is to switch to
|
||||
* wich is a very quick and easy change. But the recommendation is to switch to
|
||||
* #GtkGrid, since #GtkBox is going to go away eventually.
|
||||
* See <xref linkend="gtk-migrating-GtkGrid"/>.
|
||||
*/
|
||||
|
||||
@@ -1,288 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2012 Canonical Limited
|
||||
*
|
||||
* This program 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
|
||||
* licence 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*
|
||||
* Authors: Ryan Lortie <desrt@desrt.ca>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gsimpleactionobserver.h"
|
||||
#include "gactionobservable.h"
|
||||
|
||||
typedef GObjectClass GSimpleActionObserverClass;
|
||||
struct _GSimpleActionObserver
|
||||
{
|
||||
GObject parent_instance;
|
||||
|
||||
GActionGroup *action_group;
|
||||
gchar *action_name;
|
||||
GVariant *target;
|
||||
|
||||
gboolean can_activate;
|
||||
gboolean active;
|
||||
gboolean enabled;
|
||||
|
||||
gint reporting;
|
||||
};
|
||||
|
||||
static void g_simple_action_observer_init_iface (GActionObserverInterface *iface);
|
||||
G_DEFINE_TYPE_WITH_CODE (GSimpleActionObserver, g_simple_action_observer, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (G_TYPE_ACTION_OBSERVER, g_simple_action_observer_init_iface));
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_ACTIVE,
|
||||
PROP_ENABLED,
|
||||
N_PROPS
|
||||
};
|
||||
|
||||
static GParamSpec *g_simple_action_observer_pspecs[N_PROPS];
|
||||
|
||||
static void
|
||||
g_simple_action_observer_action_added (GActionObserver *g_observer,
|
||||
GActionObservable *observable,
|
||||
const gchar *action_name,
|
||||
const GVariantType *parameter_type,
|
||||
gboolean enabled,
|
||||
GVariant *state)
|
||||
{
|
||||
GSimpleActionObserver *observer = G_SIMPLE_ACTION_OBSERVER (g_observer);
|
||||
gboolean active;
|
||||
|
||||
/* we can only activate if we have the correct type of parameter */
|
||||
observer->can_activate = (observer->target == NULL && parameter_type == NULL) ||
|
||||
(observer->target != NULL && parameter_type != NULL &&
|
||||
g_variant_is_of_type (observer->target, parameter_type));
|
||||
|
||||
if (observer->can_activate)
|
||||
{
|
||||
if (observer->target != NULL && state != NULL)
|
||||
active = g_variant_equal (state, observer->target);
|
||||
|
||||
else if (state != NULL && g_variant_is_of_type (state, G_VARIANT_TYPE_BOOLEAN))
|
||||
active = g_variant_get_boolean (state);
|
||||
|
||||
else
|
||||
active = FALSE;
|
||||
|
||||
if (active != observer->active)
|
||||
{
|
||||
observer->active = active;
|
||||
observer->reporting++;
|
||||
g_object_notify_by_pspec (G_OBJECT (observer), g_simple_action_observer_pspecs[PROP_ACTIVE]);
|
||||
observer->reporting--;
|
||||
}
|
||||
|
||||
if (enabled != observer->enabled)
|
||||
{
|
||||
observer->enabled = enabled;
|
||||
g_object_notify_by_pspec (G_OBJECT (observer), g_simple_action_observer_pspecs[PROP_ENABLED]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
g_simple_action_observer_action_enabled_changed (GActionObserver *g_observer,
|
||||
GActionObservable *observable,
|
||||
const gchar *action_name,
|
||||
gboolean enabled)
|
||||
{
|
||||
GSimpleActionObserver *observer = G_SIMPLE_ACTION_OBSERVER (g_observer);
|
||||
|
||||
if (!observer->can_activate)
|
||||
return;
|
||||
|
||||
if (enabled != observer->enabled)
|
||||
{
|
||||
observer->enabled = enabled;
|
||||
g_object_notify_by_pspec (G_OBJECT (observer), g_simple_action_observer_pspecs[PROP_ENABLED]);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
g_simple_action_observer_action_state_changed (GActionObserver *g_observer,
|
||||
GActionObservable *observable,
|
||||
const gchar *action_name,
|
||||
GVariant *state)
|
||||
{
|
||||
GSimpleActionObserver *observer = G_SIMPLE_ACTION_OBSERVER (g_observer);
|
||||
gboolean active = FALSE;
|
||||
|
||||
if (!observer->can_activate)
|
||||
return;
|
||||
|
||||
if (observer->target)
|
||||
active = g_variant_equal (state, observer->target);
|
||||
|
||||
else if (g_variant_is_of_type (state, G_VARIANT_TYPE_BOOLEAN))
|
||||
active = g_variant_get_boolean (state);
|
||||
|
||||
if (active != observer->active)
|
||||
{
|
||||
observer->active = active;
|
||||
observer->reporting++;
|
||||
g_object_notify_by_pspec (G_OBJECT (observer), g_simple_action_observer_pspecs[PROP_ACTIVE]);
|
||||
observer->reporting--;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
g_simple_action_observer_action_removed (GActionObserver *g_observer,
|
||||
GActionObservable *observable,
|
||||
const gchar *action_name)
|
||||
{
|
||||
GSimpleActionObserver *observer = G_SIMPLE_ACTION_OBSERVER (g_observer);
|
||||
|
||||
if (!observer->can_activate)
|
||||
return;
|
||||
|
||||
observer->can_activate = FALSE;
|
||||
|
||||
if (observer->active)
|
||||
{
|
||||
observer->active = FALSE;
|
||||
observer->reporting++;
|
||||
g_object_notify_by_pspec (G_OBJECT (observer), g_simple_action_observer_pspecs[PROP_ACTIVE]);
|
||||
observer->reporting--;
|
||||
}
|
||||
|
||||
if (observer->enabled)
|
||||
{
|
||||
observer->enabled = FALSE;
|
||||
g_object_notify_by_pspec (G_OBJECT (observer), g_simple_action_observer_pspecs[PROP_ENABLED]);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
g_simple_action_observer_get_property (GObject *object, guint prop_id,
|
||||
GValue *value, GParamSpec *pspec)
|
||||
{
|
||||
GSimpleActionObserver *observer = G_SIMPLE_ACTION_OBSERVER (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_ACTIVE:
|
||||
g_value_set_boolean (value, observer->active);
|
||||
break;
|
||||
|
||||
case PROP_ENABLED:
|
||||
g_value_set_boolean (value, observer->enabled);
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
g_simple_action_observer_finalize (GObject *object)
|
||||
{
|
||||
GSimpleActionObserver *observer = G_SIMPLE_ACTION_OBSERVER (object);
|
||||
|
||||
g_object_unref (observer->action_group);
|
||||
g_free (observer->action_name);
|
||||
|
||||
if (observer->target)
|
||||
g_variant_unref (observer->target);
|
||||
|
||||
G_OBJECT_CLASS (g_simple_action_observer_parent_class)
|
||||
->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
g_simple_action_observer_init (GSimpleActionObserver *observer)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
g_simple_action_observer_init_iface (GActionObserverInterface *iface)
|
||||
{
|
||||
iface->action_added = g_simple_action_observer_action_added;
|
||||
iface->action_enabled_changed = g_simple_action_observer_action_enabled_changed;
|
||||
iface->action_state_changed = g_simple_action_observer_action_state_changed;
|
||||
iface->action_removed = g_simple_action_observer_action_removed;
|
||||
}
|
||||
|
||||
static void
|
||||
g_simple_action_observer_class_init (GObjectClass *class)
|
||||
{
|
||||
class->get_property = g_simple_action_observer_get_property;
|
||||
class->finalize = g_simple_action_observer_finalize;
|
||||
|
||||
g_simple_action_observer_pspecs[PROP_ACTIVE] = g_param_spec_boolean ("active", "active", "active", FALSE,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
g_simple_action_observer_pspecs[PROP_ENABLED] = g_param_spec_boolean ("enabled", "enabled", "enabled", FALSE,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
g_object_class_install_properties (class, N_PROPS, g_simple_action_observer_pspecs);
|
||||
}
|
||||
|
||||
GSimpleActionObserver *
|
||||
g_simple_action_observer_new (GActionObservable *observable,
|
||||
const gchar *action_name,
|
||||
GVariant *target)
|
||||
{
|
||||
GSimpleActionObserver *observer;
|
||||
const GVariantType *type;
|
||||
gboolean enabled;
|
||||
GVariant *state;
|
||||
|
||||
observer = g_object_new (G_TYPE_SIMPLE_ACTION_OBSERVER, NULL);
|
||||
observer->action_group = g_object_ref (observable);
|
||||
observer->action_name = g_strdup (action_name);
|
||||
if (target)
|
||||
observer->target = g_variant_ref_sink (target);
|
||||
|
||||
g_action_observable_register_observer (observable, action_name, G_ACTION_OBSERVER (observer));
|
||||
|
||||
if (g_action_group_query_action (observer->action_group, action_name, &enabled, &type, NULL, NULL, &state))
|
||||
{
|
||||
g_simple_action_observer_action_added (G_ACTION_OBSERVER (observer), observable,
|
||||
action_name, type, enabled, state);
|
||||
if (state)
|
||||
g_variant_unref (state);
|
||||
}
|
||||
|
||||
return observer;
|
||||
}
|
||||
|
||||
void
|
||||
g_simple_action_observer_activate (GSimpleActionObserver *observer)
|
||||
{
|
||||
g_return_if_fail (G_IS_SIMPLE_ACTION_OBSERVER (observer));
|
||||
|
||||
if (observer->can_activate && !observer->reporting)
|
||||
g_action_group_activate_action (G_ACTION_GROUP (observer->action_group),
|
||||
observer->action_name, observer->target);
|
||||
}
|
||||
|
||||
gboolean
|
||||
g_simple_action_observer_get_active (GSimpleActionObserver *observer)
|
||||
{
|
||||
g_return_val_if_fail (G_IS_SIMPLE_ACTION_OBSERVER (observer), FALSE);
|
||||
|
||||
return observer->active;
|
||||
}
|
||||
|
||||
gboolean
|
||||
g_simple_action_observer_get_enabled (GSimpleActionObserver *observer)
|
||||
{
|
||||
g_return_val_if_fail (G_IS_SIMPLE_ACTION_OBSERVER (observer), FALSE);
|
||||
|
||||
return observer->enabled;
|
||||
}
|
||||