Compare commits

..

7 Commits

Author SHA1 Message Date
Matthias Clasen
ab08566844 Drop the shape window example in testgtk for now
Not sure this can be rescued without root window coordinates.
It is also somewhat inherently X11-specific.
2017-08-08 21:05:19 -04:00
Matthias Clasen
b7c09e6abb Remove root window getters from public API
These are now just used internally in GDK.
2017-08-08 20:31:44 -04:00
Matthias Clasen
26cf06da8d Make the xim module build without root getters
This is X specific code anyway, so no need to use
generic GDK api for this.
2017-08-08 20:31:44 -04:00
Matthias Clasen
89cfc027f2 Stop passing root window to gdk_device_query_state
The backends do the right thing now.
2017-08-08 19:56:25 -04:00
Matthias Clasen
3fbd86aaae Allow passing a NULL window to gdk_device_query_state
Interpret NULL as "root window" here - we only have one
screen nowadays, so there is no choice involved, and this
will let us avoid dealing with the root window in the
fontend code.
2017-08-08 19:56:17 -04:00
Matthias Clasen
44ec2fd543 Drop root windows from some internal apis
_gdk_device_query_state was needlessly shuffling
root windows around.
2017-08-08 19:56:10 -04:00
Matthias Clasen
8621943552 Drop keynav for dnd
This is very much an easter egg, and it is the last place where
we use the root window in libgtk.
2017-08-08 19:56:04 -04:00
1418 changed files with 140870 additions and 191877 deletions

View File

@@ -1,40 +0,0 @@
If you want to hack on the GTK+ project, you'll need to have the development
tools appropriate for your operating system, including:
- Python (2.7 or 3.x)
- Meson
- Ninja
- Gettext (19.7 or newer)
- a C99 compatible compiler
Up-to-date instructions about developing GNOME applications and libraries
can be found here:
https://developer.gnome.org
Information about using git with GNOME can be found here:
https://wiki.gnome.org/Git
In order to get Git GTK+ installed on your system, you need to have the
required versions of all the GTK+ dependencies; typically, this means a
recent version of GLib, Cairo, Pango, and ATK.
**Note**: if you plan to push changes to back to the master repository and
have a GNOME account, you want to use the following instead:
```sh
$ git clone ssh://<username>@git.gnome.org/git/gtk+
```
To compile the Git version of GTK+ on your system, you will need to
configure your build using Meson:
```sh
$ meson _builddir .
```
For information about submitting patches and pushing changes to Git, see the
`README.md` and `README.commits` files. In particular, don't, under any
circumstances, push anything to Git before reading and understanding
`README.commmits`.

64
HACKING Normal file
View File

@@ -0,0 +1,64 @@
If you want to hack on the GTK+ project, you'll need to have
the following packages installed:
- GNU autoconf 2.62
- GNU automake 1.11
- GNU libtool 2.2
- indent (GNU indent 1.9.1 is known good)
- GNU gettext 10.40
These should be available by ftp from ftp.gnu.org or any of the
fine GNU mirrors. Beta software can be found at alpha.gnu.org.
Up-to-date instructions about developing GNOME applications and libraries
can be found here:
http://library.gnome.org/devel/
Information about using git with GNOME can be found here:
https://wiki.gnome.org/Git
In order to get GIT GTK+ installed on your system, you need to have
the most recent GIT versions of GLib, Pango, and ATK installed as well.
The installation process of these libraries is similar to that of GTK+,
but needs to be fulfilled prior to installation of GTK+.
If at all possible, please use GIT to get the latest development version of
gtk+ and glib. You can do the following to get glib and gtk+ from GIT:
$ git clone git://git.gnome.org/glib
$ git clone git://git.gnome.org/pango
$ git clone git://git.gnome.org/atk
$ git clone git://git.gnome.org/gtk+
Note: if you plan to push changes to back to the master repository and
have a gnome account, you want to use the following instead:
$ git clone ssh://<username>@git.gnome.org/git/gtk+
To compile the GIT version of GTK+ on your system, you will need to take
several steps to setup the tree for compilation. You can do all these
steps at once by running:
gtk+$ ./autogen.sh
Basically this does the following for you:
gtk+$ aclocal; automake; autoconf
The above commands create the `configure' script. Now you
run the `configure' script in `gtk+/' to create all Makefiles.
More information about that in `INSTALL'.
Before running `autogen.sh' or `configure', make sure you have libtool
in your path.
Note that autogen.sh runs configure for you. If you wish to pass
options like `--prefix=/usr' to `configure' you can give those options
to `autogen.sh' and they will be passed on to `configure'.
For information about submitting patches and pushing changes
to GIT, see the `README' and `README.commits' files. In particular,
don't, under any circumstances, push anything to GIT before
reading and understanding `README.commmits'.

42
INSTALL.in Normal file
View File

@@ -0,0 +1,42 @@
Prerequisites
=============
GTK+ requires the following packages:
- The GLib, Pango, GdkPixbuf, ATK and cairo libraries, available at
the same location as GTK+. GTK+ @GTK_VERSION@ requires at least
GLib @GLIB_REQUIRED_VERSION@, Pango @PANGO_REQUIRED_VERSION@,
GdkPixbuf @GDK_PIXBUF_REQUIRED_VERSION@, ATK @ATK_REQUIRED_VERSION@
and cairo @CAIRO_REQUIRED_VERSION@.
- libepoxy, for cross-platform OpenGL support.
It can be found here: https://github.com/anholt/libepoxy
- Each GDK backend has its own backend-specific requirements. For
the X11 backend, X11 R6 and XInput version 2 (as well as a number
of other extensions) are required. The Wayland backend requires
(obviously) the Wayland libraries.
- gobject-introspection @INTROSPECTION_REQUIRED_VERSION@ or newer.
Simple install procedure
========================
% tar xf gtk+-@GTK_VERSION@.tar.xz # unpack the sources
% cd gtk+-@GTK_VERSION@ # change to the toplevel directory
% ./configure # run the `configure' script
% make # build GTK+
[ Become root if necessary ]
% make install # install GTK+
The Details
===========
Complete information about installing GTK+ and related libraries
can be found in the file:
docs/reference/gtk/html/gtk-building.html
Or online at:
http://library.gnome.org/devel/gtk/stable/gtk-building.html

12
MAINTAINERS Normal file
View File

@@ -0,0 +1,12 @@
Matthias Clasen
E-mail: mclasen@redhat.com
Userid: matthiasc
Tim Janik
E-mail: timj@gtk.org
Userid: timj
Note that a lot of people are contributing to GTK+, and some parts of it
are technically maintained by other people. The people listed above are
meant as contacts for administrative questions such as cvs accounts. Other
questions are best directed to the mailing list gtk-devel-list@gnome.org.

112
Makefile.am Normal file
View File

@@ -0,0 +1,112 @@
## Makefile.am for GTK+
include $(top_srcdir)/Makefile.decl
SRC_SUBDIRS = gdk gsk gtk modules demos tests testsuite examples
SUBDIRS = po po-properties $(SRC_SUBDIRS) docs win32
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
meson_build_files = $(shell find . -type f -name '*meson.*' -print 2>/dev/null)
meson_files = \
$(meson_build_files) \
meson_options.txt \
subprojects/graphene.wrap \
gdk/gen-gdk-gresources-xml.py \
gsk/gen-gsk-gresources-xml.py \
gtk/gen-gtk-gresources-xml.py \
gtk/gentypefuncs.py \
demos/gtk-demo/geninclude.py \
gdk/wayland/genprotocolfiles.py \
build-aux/meson/post-install.sh \
$()
EXTRA_DIST += \
autogen.sh \
HACKING \
README \
README.in \
INSTALL \
INSTALL.in \
NEWS.pre-1-0 \
README.commits \
README.win32 \
config.h.win32 \
makefile.msc \
gtk-zip.sh.in \
sanitize-la.sh \
po/README.translators \
po/po2tbl.sed.in \
make-pot \
$(meson_files)
MAINTAINERCLEANFILES = \
$(GITIGNORE_MAINTAINERCLEANFILES_TOPLEVEL) \
$(GITIGNORE_MAINTAINERCLEANFILES_M4_LIBTOOL) \
$(GITIGNORE_MAINTAINERCLEANFILES_MAKEFILE_IN) \
$(srcdir)/m4/gtk-doc.m4 \
$(srcdir)/INSTALL \
$(srcdir)/README \
$(srcdir)/gtk-doc.make \
$(srcdir)/ChangeLog
## Copy .pc files to target-specific names
gtk+-x11-4.0.pc gtk+-win32-4.0.pc gtk+-quartz-4.0.pc gtk+-broadway-4.0.pc gtk+-wayland-4.0.pc gtk+-mir-4.0.pc: gtk+-4.0.pc
rm -f $@ && \
cp gtk+-4.0.pc $@
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = gtk+-4.0.pc gail-4.0.pc
pkgconfig_DATA += ${GDK_BACKENDS:%=gtk+-%-4.0.pc}
if OS_UNIX
pkgconfig_DATA += gtk+-unix-print-4.0.pc
endif
DISTCLEANFILES = \
gtk+-unix-print-4.0.pc \
gtk+-4.0.pc \
gtk+-x11-4.0.pc \
gtk+-win32-4.0.pc \
gtk+-quartz-4.0.pc \
gtk+-broadway-4.0.pc \
gtk+-wayland-4.0.pc \
gtk+-mir-4.0.pc \
gail-4.0.pc \
config.lt
distclean-local:
if test "$(srcdir)" = "."; then :; else \
rm -f ChangeLog; \
fi
ChangeLog:
$(AM_V_GEN) if test -d "$(srcdir)/.git"; then \
(GIT_DIR=$(top_srcdir)/.git $(top_builddir)/build-aux/missing git log GTK_2_16_0^^.. --stat) | fmt --split-only > $@.tmp \
&& mv -f $@.tmp $@ \
|| ($(RM) $@.tmp; \
echo Failed to generate ChangeLog, your ChangeLog may be outdated >&2; \
(test -f $@ || echo git-log is required to generate this file >> $@)); \
else \
test -f $@ || \
(echo A git checkout and git-log is required to generate ChangeLog >&2 && \
echo A git checkout and git-log is required to generate this file >> $@); \
fi
.PHONY: ChangeLog
uninstall-local:
rm -f $(DESTDIR)$(pkgconfigdir)/gtk+-4.0.pc
AM_DISTCHECK_CONFIGURE_FLAGS = \
--enable-gtk-doc \
--disable-doc-cross-references \
--enable-man \
--disable-maintainer-mode \
--enable-introspection \
--enable-installed-tests
GITIGNORE_TRANSLATION_DIRS = po-properties
GITIGNOREFILES = po-properties/gtk40-properties.pot
-include $(top_srcdir)/git.mk

96
Makefile.decl Normal file
View File

@@ -0,0 +1,96 @@
# GTK+ - The GIMP Toolkit
GTESTER = gtester -k # in $PATH for non-GLIB packages
GTESTER_REPORT = gtester-report # in $PATH for non-GLIB packages
# initialize variables for unconditional += appending
EXTRA_DIST =
TEST_PROGS =
### testing rules
# Xvfb based test rules
XVFB = Xvfb -ac -noreset -screen 0 1024x768x16
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 \
1008 1009 4703 4721 4723 4729 4733 4751 9973 9974 9975 9976 9977 9978 9979 \
9980 9981 9982 9983 9984 9985 9986 9987 9988 9989 9990 9991 9992 9993 9994 \
9995 9996 9997 9998 9999
if USE_X11
SKIP_GDKTARGET = \
false
else
SKIP_GDKTARGET = \
echo "Gtk+Tests:INFO: Skipping GUI tests for non-X11 target."
endif
if PLATFORM_WIN32
no_undefined = -no-undefined
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 & \
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
# call as: $(XVFB_START) && someprogram
# test: run all tests in cwd and subdirs
test: test-cwd test-recurse
# test-cwd: run tests in cwd
test-cwd: ${TEST_PROGS}
@$(SKIP_GDKTARGET) || test -z "${TEST_PROGS}" || { \
$(XVFB_START) && { set -e; $(TESTS_ENVIRONMENT) G_TEST_SRCDIR="${abs_srcdir}" G_TEST_BUILDDIR="${abs_builddir}" ${GTESTER} --verbose ${TEST_PROGS}; }; \
}
# test-recurse: run tests in subdirs
test-recurse:
@ for subdir in $(SUBDIRS) ; do \
test "$$subdir" = "." -o "$$subdir" = "po" -o "$$subdir" = "po-properties" || \
( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) test ) || exit $? ; \
done
# test-report: run tests in subdirs and generate report
# perf-report: run tests in subdirs with -m perf and generate report
# full-report: like test-report: with -m perf and -m slow
test-report perf-report full-report: ${TEST_PROGS}
@ ignore_logdir=true ; \
if test -z "$$GTESTER_LOGDIR" ; then \
GTESTER_LOGDIR=`mktemp -d "\`pwd\`/.testlogs-XXXXXX"`; export GTESTER_LOGDIR ; \
ignore_logdir=false ; \
fi ; \
for subdir in $(SUBDIRS) ; do \
test "$$subdir" = "." -o "$$subdir" = "po" -o "$$subdir" = "po-properties" || \
( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \
done ; \
$(SKIP_GDKTARGET) || test -z "${TEST_PROGS}" || { \
case $@ in \
test-report) test_options="-k";; \
perf-report) test_options="-k -m=perf";; \
full-report) test_options="-k -m=perf -m=slow";; \
esac ; \
$(XVFB_START) && { \
set -e; \
if test -z "$$GTESTER_LOGDIR" ; then \
G_TEST_SRCDIR="${abs_srcdir}" G_TEST_BUILDDIR="${abs_builddir}" ${GTESTER} --verbose $$test_options -o test-report.xml ${TEST_PROGS} ; \
elif test -n "${TEST_PROGS}" ; then \
G_TEST_SRCDIR="${abs_srcdir}" G_TEST_BUILDDIR="${abs_builddir}" ${GTESTER} --verbose $$test_options -o `mktemp "$$GTESTER_LOGDIR/log-XXXXXX"` ${TEST_PROGS} ; \
fi ; \
}; \
}; \
$$ignore_logdir || { \
echo '<?xml version="1.0"?>' > $@.xml ; \
echo '<report-collection>' >> $@.xml ; \
for lf in `ls -L "$$GTESTER_LOGDIR"/.` ; do \
sed '1,1s/^<?xml\b[^>?]*?>//' <"$$GTESTER_LOGDIR"/"$$lf" >> $@.xml ; \
done ; \
echo >> $@.xml ; \
echo '</report-collection>' >> $@.xml ; \
rm -rf "$$GTESTER_LOGDIR"/ ; \
${GTESTER_REPORT} --version 2>/dev/null 1>&2 ; test "$$?" != 0 || ${GTESTER_REPORT} $@.xml >$@.html ; \
}
.PHONY: test test-cwd test-recurse test-report perf-report full-report
# run make test-cwd as part of make check
check-local: test-cwd

163
NEWS
View File

@@ -1,166 +1,3 @@
Overview of Changes in GTK+ 3.92.1, 重庆市
==========================================
The bulk of the preparation for this release was done during
and after the fantastic GNOME.Asia Summit 2017 in Chongqing, China.
* Drop autotools support. Meson 0.42.1 is now required
* Implement most of CSS3 font-variant
* Add an Emoji chooser to GtkEntry
* Add new input hints for Emoji input
* Remaining widgets have been ported to GtkSnapshot
* GtkLabel and GtkEntry have been ported to use GSK
* Add a way for GtkOverlay to blur behind children. This is has a
demo in gtk4-demo
* Add support for native file choosers on older OS X versions
* Add support for libcloudproviders in GtkPlacesSidebar
* Non-windowed widgets are now allowed to have a size of 0x0
* Allow tiled windows to be resized. Under wayland, this uses version 2
of the gtk-shell protocol. Under X, it uses the _GTK_EDGE_CONSTRAINTS
property
* Input handling changes
- GdkEvent has new accessors for fields
- Traditional event signals (eg ::key-press-event) are now emitted from
an event controller
- Most widgets inside gtk have stopped using traditional event signals
- GDK_SEAT_CAPABILITY_ALL_POINTING now includes touch events
* Scrollbars allow middle-click to jump to a position again
* GSK changes:
- Add gsk_text_node_new
- Add a glyph cache for the Vulkan backend
- Add gsk_blur_node_new
- Add gsk_cross_fade_node_new
- Implement blur for Vulkan
- Implement repeat nodes for Vulkan
- Add gsk_blend_mode_new
- the vulkan backend now uses multiple render passes, avoiding many
fallbacks to cairo rendering
- The profiling output for vulkan is now more useful, showing how many
pixels of fallback rendering and intermediate textures we consume
* Inspector:
- The recorder shows more useful information about render nodes
- The general tab shows gsk and vulkan information
* Removed apis
- gdk_window_new_input
- gtk_widget_set_redraw_on_alloc
- gtk_widget_get_{border,content,margin}_allocation
- gtk_container_propagate_draw
- deprecated CSS properties and syntaxes
* Bugs fixed:
639931 gtk_application_add_window() docs should mention window destruction
644248 stylecontext: add a raised style class
705640 GtkWindow incorrectly requires a default screen
766909 Tooltip of the eject button is a bit confusing - or just missing
773299 Ensure GTK+-4.x builds and works on Windows (MSVC in particular)
775074 GtkScrolledWindow does not disconnect all GtkAdjustment signal handl...
775126 memory leak in gdk_wayland_window_ensure_cairo_surface
778382 gtk_css_static_style_get_default doesn't check for a null setting
778811 Enter submenus when activating their parent item
780750 Shift + click in GtkEntry doesn't select
780758 flowbox: bind_model passes wrong reference to create_widget_func in...
781757 gdk_seat_grab() not working for touchscreen events
782981 meson fixes
783649 negative content width warning in GtkLevelbar
783669 Allow resizing tiled windows
784016 Crash in gnome-terminal due to calling a GdkDisplayClass vfunc on a...
784421 Tooltips: Fix docs/theming for custom tooltip windows
785210 meson: Support build on Windows (using Visual Studio at least)
785306 FileChooserNativeQuartz: two fixes
785736 textview: fix bug on DnD displaced limits of selection
786144 GtkInfoBar Example - Wrong at developer.gnome.org (looks like typo/...
786209 X11: GtkPopover positioning doesn't "avoid" CSD window shadows
786400 "Art pen" named "Grip pen" in the Gnome Control Center
786469 gdkwindow: Avoid re-setting the opaque region if it doesn't change
786485 Image upload broken on vulkan
786492 Incorrect scaling factor with Vulkan on Wayland
786553 Wrong example number in Gtk Tutorial
786613 Adwaita: provide a generic sidebar icon and label styling
786673 Wayland: Crash in GtkEntryCompletion
786885 Add explanatory tooltip to emoji icon
786931 rnc/rng files specify "class" as mandatory for objects, but the par...
786932 Let the "type-func" override the object's "class" attribute when ge...
786938 Emoji picker wrongly opens when clicking on primary icon too
786940 ::icon-pressed handler stays connected when setting :show-emoji-ico...
786956 EmojiChooser: Fix theming on Adwaita:dark, HighContrast, etc.
786960 Emoji chooser: don't show 'insert Emoji' item in emoji chooser cont...
786964 Emoji Chooser: Can't scroll clicking on the scroll bar
786966 Emoji chooser: unnecessary spacing b/w some rows in search result
787021 GtkFlowBox: the orthogonal orientation always requests the most siz...
787103 gtk3-widget-factory crashes on exit after inserting an emote on page3
787172 EmojiChooser: Improve selection of section buttons
787279 EmojiChooser: Hovered emoji become impossible to see in HighContras...
787302 gtk+-3.22.20/gtk/gtkmountoperation-x11.c:669:sanity check after use ?
787303 gtk+-3.22.20/gtk/gtknotebook.c: 2 * redundant conditions ?
787410 entry: fix memory leak
787416 build: Improve subproject support for builds
787444 The color-selection dialog which is opened by a GtkColorButton shou...
787531 The tick button is not/barely visible on light colors with Dark theme
787600 PlacesSidebar/SidebarRow: CloudProvider singleton/accounts are neve...
787757 Focus outline easily disappears around color chooser swatches
788230 Bump GLib version to 2.53.7
788458 (style) Array index 'i' is used before limits check.
701296 gtkfixed accepts toplevel windows into its children list after gtk_...
728452 gtk_tree_view_column_create_button creates button which is leaked
763517 Selected then unselected Label in ListBox gets wrong colour until h...
786794 Print dialogue has a printer called "printer"
787669 Middle mouse click on scrollbar is ignored
787866 Untranslated key labels in the Keyboard panel of Settings
788534 cairo-node-serialization: Adjust bytes when width bytes != stride
788573 HighContrast: titlebar separator is too wide and joined to buttons,...
788614 Trying to reuse a TreeViewColumn causes criticals and a segfault (e...
788787 gtktextview: Add a missing g_assert_not_reached() for switch defaul...
788905 GtkRange horizontal scrolling causes movement in the wrong direction
* Translation updates:
Basque
Brazilian Portuguese
Catalan
Chinese (Taiwan)
Croatian
Czech
Danish
French
Friulian
Galician
German
Hungarian
Indonesian
Italian
Kazakh
Korean
Latvian
Lithuanian
Malayalam
Nepali
Persian
Polish
Romanian
Russian
Serbian
Serbian Latin
Slovak
Slovenian
Spanish
Swedish
Turkish
Overview of Changes in GTK+ 3.91.2
==================================

82
README.in Normal file
View File

@@ -0,0 +1,82 @@
General Information
===================
This is GTK+ version @GTK_VERSION@. GTK+ is a multi-platform toolkit for
creating graphical user interfaces. Offering a complete set of widgets,
GTK+ is suitable for projects ranging from small one-off projects to
complete application suites.
GTK+ is free software and part of the GNU Project. However, the
licensing terms for GTK+, the GNU LGPL, allow it to be used by all
developers, including those developing proprietary software, without any
license fees or royalties.
The official download locations are:
ftp://ftp.gtk.org/pub/gtk
http://download.gnome.org/sources/gtk+
The official web site is:
http://www.gtk.org/
Information about mailing lists can be found at
http://www.gtk.org/mailing-lists.php
Installation
============
See the file 'INSTALL'
How to report bugs
==================
Bugs should be reported to the GNOME bug tracking system.
(http://bugzilla.gnome.org, product glib.) You will need
to create an account for yourself.
In the bug report please include:
* Information about your system. For instance:
- What operating system and version
- For Linux, what version of the C library
And anything else you think is relevant.
* How to reproduce the bug.
If you can reproduce it with one of the test programs that are built
in the tests/ subdirectory, that will be most convenient. Otherwise,
please include a short test program that exhibits the behavior.
As a last resort, you can also provide a pointer to a larger piece
of software that can be downloaded.
* If the bug was a crash, the exact text that was printed out
when the crash occurred.
* Further information such as stack traces may be useful, but
is not necessary.
Patches
=======
Patches should also be submitted to bugzilla.gnome.org. If the
patch fixes an existing bug, add the patch as an attachment
to that bug report.
Otherwise, enter a new bug report that describes the patch,
and attach the patch to that bug report.
Patches should be in unified diff form. (The -up option to GNU diff)
Even better are git-formatted patches. (Use git format-patch)
Release notes
=============
Release notes for releases of GTK+ 3.x are part of the migration
guide in the GTK+ documentation. See
https://developer.gnome.org/gtk3/unstable/gtk-migrating-2-to-3.html

170
README.md
View File

@@ -1,170 +0,0 @@
GTK+ — The GTK toolkit
======================
General information
-------------------
GTK+ is a multi-platform toolkit for creating graphical user interfaces.
Offering a complete set of widgets, GTK+ is suitable for projects ranging
from small one-off projects to complete application suites.
GTK+ is free software and part of the GNU Project. However, the
licensing terms for GTK+, the GNU LGPL, allow it to be used by all
developers, including those developing proprietary software, without any
license fees or royalties.
The official download location
- https://download.gnome.org/sources/gtk+
The official web site
- https://www.gtk.org
The official developers blog
- https://blog.gtk.org
Information about mailing lists can be found at
- http://www.gtk.org/mailing-lists.php
Building and installing
-----------------------
In order to build GTK+ you will need:
- a C99 compatible compiler
- Python 3
- [Meson](http://mesonbuild.com)
- [Ninja](https://ninja-build.org)
You will also need various dependencies, based on the platform you are
building for:
- [GLib](https://download.gnome.org/sources/glib)
- [GdkPixbuf](https://download.gnome.org/sources/gdk-pixbuf)
- [GObject-Introspection](https://download.gnome.org/sources/gobject-introspection)
- [Cairo](https://www.cairographics.org)
- [Pango](https://download.gnome.org/sources/pango)
- [Epoxy](https://github.com/anholt/libepoxy)
- [Graphene](https://github.com/ebassi/graphene)
- [ATK](https://download.gnome.org/sources/atk)
- [Xkb-common](https://github.com/xkbcommon/libxkbcommon)
If you are building the X11 backend, you will also need:
- Xlib, and the following X extensions:
- xrandr
- xrender
- xi
- xext
- xfixes (optional)
- xcursor (optional)
- xdamage (optional)
- xcomposite (optional)
- [atk-bridge-2.0](https://download.gnome.org/sources/at-spi2-atk)
If you are building the Wayland backend, you will also need:
- Wayland-client
- Wayland-protocols
- Wayland-cursor
- Wayland-EGL
Once you have all the necessary dependencies, you can build GTK+ by using
Meson:
```sh
$ meson _build .
$ cd _build
$ ninja
```
You can run the test suite using:
```sh
$ meson test
```
And, finally, you can install GTK+ using:
```
$ sudo ninja install
```
Complete information about installing GTK+ and related libraries
can be found in the file:
```
docs/reference/gtk/html/gtk-building.html
```
Or [online](https://developer.gnome.org/gtk4/stable/gtk-building.html)
How to report bugs
------------------
Bugs should be reported to the GNOME [bug tracking system](https://bugzilla.gnome.org/enter_bug.cgi?product=gtk%2b).
You will need an account for yourself.
In the bug report please include:
* Information about your system. For instance:
- which version of GTK+ you are using
- what operating system and version
- for Linux, which distribution
- if you built GTK+, the list of options used to configure the build
And anything else you think is relevant.
* How to reproduce the bug.
If you can reproduce it with one of the test programs that are built
in the tests/ subdirectory, that will be most convenient. Otherwise,
please include a short test program that exhibits the behavior.
As a last resort, you can also provide a pointer to a larger piece
of software that can be downloaded.
* If the bug was a crash, the exact text that was printed out
when the crash occurred.
* Further information such as stack traces may be useful, but
is not necessary.
Contributing
------------
Patches should also be submitted to the bug tracking system. If the patch
fixes an existing bug, add the patch as an attachment to that bug report;
otherwise, enter a new bug report that describes the patch, and attach the
patch to that bug report.
Patches should be in Git-formatted form. You should use `git format-patch`
to generate them. We recommend using [git-bz](http://git.fishsoup.net/man/git-bz.html).
For more information on the recommended workflow, please read
[this wiki page](https://wiki.gnome.org/Git/WorkingWithPatches).
Please, follow the `CODING_STYLE` document in order to conform to GTK+'s
coding style when submitting a code contribution.
Release notes
-------------
The release notes for GTK+ are part of the migration guide in the API
reference. See:
- [3.x release notes](https://developer.gnome.org/gtk3/unstable/gtk-migrating-2-to-3.html)
- [4.x release notes](https://developer.gnome.org/gtk4/unstable/gtk-migrating-3-to-4.html)
Licensing terms
---------------
GTK+ is released under the terms of the GNU Lesser General Public License,
version 2.1 or, at your option, any later version, as published by the Free
Software Foundation.
Please, see the `COPYING` file for further information.

206
README.win32 Normal file
View File

@@ -0,0 +1,206 @@
The Win32 backend in GTK+ is not as stable or correct as the X11 one.
For prebuilt runtime and developer packages see
http://ftp.gnome.org/pub/gnome/binaries/win32/
Building GTK+ on Win32
======================
First you obviously need developer packages for the compile-time
dependencies: GDK-Pixbuf, Pango, atk, glib, gettext-runtime, libiconv at least.
See http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies .
For people compiling GTK+ with Visual C++ 2005 or later, it is
recommended that the same compiler is used for at least GDK-Pixbuf,
Pango, atk and glib so that crashes and errors caused by different CRTs
can be avoided. The VS 2008 project files and/or VS Makefiles are
either already available or will be available in the next stable release.
Unfortunately compiling with Microsoft's compilers versions 2003 or earlier
is not supported as compiling the latest stable GLib (which *is* required for
building this GTK+ release) requires features from newer compilers
and/or Platform SDKs
After installing the dependencies, there are two ways to build GTK+
for win32.
1) GNU tools, ./configure && make install
-----------------------------------------
This requires you have mingw and MSYS.
Use the configure script, and the resulting Makefiles (which use
libtool and gcc to do the compilation). I use this myself, but it can
be hard to setup correctly.
The full script I run to build GTK+ 2.16 unpacked from a source
distribution is as below. This is from bulding GTK+ 2.16.5. I don't
use any script like this to build the development branch, as I don't
distribute any binaries from development branches.
# This is a shell script that calls functions and scripts from
# tml@iki.fi's personal work env<6E>ronment. It is not expected to be
# usable unmodified by others, and is included only for reference.
MOD=gtk+
VER=2.16.5
REV=1
ARCH=win32
THIS=${MOD}_${VER}-${REV}_${ARCH}
RUNZIP=${MOD}_${VER}-${REV}_${ARCH}.zip
DEVZIP=${MOD}-dev_${VER}-${REV}_${ARCH}.zip
HEX=`echo $THIS | md5sum | cut -d' ' -f1`
TARGET=c:/devel/target/$HEX
usedev
usemsvs6
(
set -x
DEPS=`latest --arch=${ARCH} glib atk cairo pango libpng zlib libtiff jpeg`
PROXY_LIBINTL=`latest --arch=${ARCH} proxy-libintl`
PKG_CONFIG_PATH=
for D in $DEPS; do
PATH=/devel/dist/${ARCH}/$D/bin:$PATH
[ -d /devel/dist/${ARCH}/$D/lib/pkgconfig ] && PKG_CONFIG_PATH=/devel/dist/${ARCH}/$D/lib/pkgconfig:$PKG_CONFIG_PATH
done
LIBPNG=`latest --arch=${ARCH} libpng`
ZLIB=`latest --arch=${ARCH} zlib`
LIBTIFF=`latest --arch=${ARCH} libtiff`
JPEG=`latest --arch=${ARCH} jpeg`
patch -p0 <<'EOF'
EOF
lt_cv_deplibs_check_method='pass_all' \
CC='gcc -mtune=pentium3 -mthreads' \
CPPFLAGS="-I/devel/dist/${ARCH}/${LIBPNG}/include \
-I/devel/dist/${ARCH}/${ZLIB}/include \
-I/devel/dist/${ARCH}/${LIBTIFF}/include \
-I/devel/dist/${ARCH}/${JPEG}/include \
-I/devel/dist/${ARCH}/${PROXY_LIBINTL}/include" \
LDFLAGS="-L/devel/dist/${ARCH}/${LIBPNG}/lib \
-L/devel/dist/${ARCH}/${ZLIB}/lib \
-L/devel/dist/${ARCH}/${LIBTIFF}/lib \
-L/devel/dist/${ARCH}/${JPEG}/lib \
-L/devel/dist/${ARCH}/${PROXY_LIBINTL}/lib -Wl,--exclude-libs=libintl.a \
-Wl,--enable-auto-image-base" \
LIBS=-lintl \
CFLAGS=-O2 \
./configure \
--enable-win32-backend \
--disable-gdiplus \
--with-included-immodules \
--without-libjasper \
--enable-debug=yes \
--enable-explicit-deps=no \
--disable-gtk-doc \
--disable-static \
--prefix=$TARGET &&
libtoolcacheize &&
rm gtk/gtk.def &&
(PATH="$PWD/gdk-pixbuf/.libs:/devel/target/$HEX/bin:$PATH" make -j3 install || (rm .libtool-cache* && PATH="/devel/target/$HEX/bin:$PATH" make -j3 install)) &&
PATH="/devel/target/$HEX/bin:$PATH" gdk-pixbuf-query-loaders >/devel/target/$HEX/etc/gtk-2.0/gdk-pixbuf.loaders &&
grep -v -E 'Automatically generated|Created by|LoaderDir =' <$TARGET/etc/gtk-2.0/gdk-pixbuf.loaders >$TARGET/etc/gtk-2.0/gdk-pixbuf.loaders.temp &&
mv $TARGET/etc/gtk-2.0/gdk-pixbuf.loaders.temp $TARGET/etc/gtk-2.0/gdk-pixbuf.loaders &&
grep -v -E 'Automatically generated|Created by|ModulesPath =' <$TARGET/etc/gtk-2.0/gtk.immodules >$TARGET/etc/gtk-2.0/gtk.immodules.temp &&
mv $TARGET/etc/gtk-2.0/gtk.immodules.temp $TARGET/etc/gtk-2.0/gtk.immodules &&
./gtk-zip.sh &&
mv /tmp/${MOD}-${VER}.zip /tmp/$RUNZIP &&
mv /tmp/${MOD}-dev-${VER}.zip /tmp/$DEVZIP
) 2>&1 | tee /devel/src/tml/packaging/$THIS.log
(cd /devel && zip /tmp/$DEVZIP src/tml/packaging/$THIS.{sh,log}) &&
manifestify /tmp/$RUNZIP /tmp/$DEVZIP
You should not just copy the above blindly. There are some things in
the script that are very specific to *my* build setup on *my* current
machine. For instance the "latest" command, the "usedev" and
"usemsvs6" shell functions, the /devel/dist folder. The above script
is really just meant for reference, to give an idea. You really need
to understand what things like PKG_CONFIG_PATH are and set them up
properly after installing the dependencies before building GTK+.
As you see above, after running configure, one can just say "make
install", like on Unix. A post-build fix is needed, running
gdk-pixbuf-query-loaders once more to get a correct gdk-pixbuf.loaders
file.
For a 64-bit build you need to remove the gtk/gtk.def file and let it
be regenerated by the makefilery. This is because the 64-bit GTK dll
has a slightly different list of exported function names. This is on
purpose and not a bug. The API is the same at the source level, and
the same #defines of some function names to actually have a _utf8
suffix is used (just to keep the header simpler). But the
corresponding non-suffixed function to maintain ABI stability are not
needed in the 64-bit case (because there are no older EXEs around that
would require such for ABI stability).
2) Microsoft's tools
--------------------
Use the Microsoft compiler, cl and Make, nmake. Say nmake -f
makefile.msc in gdk and gtk. Be prepared to manually edit various
makefile.msc files, and the makefile snippets in build/win32.
There are also VS 2008/2010 solution and project files to build GTK+, which
are maintained by Chun-wei Fan. They should build GTK+ out of the box,
provided that the afore-mentioned dependencies are installed. They will
build GDK with the Win32 backend, GTK+ itself (with GAIL/a11y built in),
the GAIL-Util library and the gtk-demo program.
Please refer to the following GNOME Live! page for a more detailed ouline
on the process of building the GTK+ stack and its dependencies with Visual
C++:
https://wiki.gnome.org/Projects/GTK+/Win32/MSVCCompilationOfGTKStack
Alternative 1 also generates Microsoft import libraries (.lib), if you
have lib.exe available. It might also work for cross-compilation from
Unix.
I (Tor) use method 1 myself. Hans Breuer has been taking care of the MSVC
makefiles. At times, we disagree a bit about various issues, and for
instance the makefile.msc files might not produce identically named
DLLs and import libraries as the "autoconfiscated" makefiles and
libtool do. If this bothers you, you will have to fix the makefiles.
Using GTK+ on Win32
===================
To use GTK+ on Win32, you also need either one of the above mentioned
compilers. Other compilers might work, but don't count on it. Look for
prebuilt developer packages (DLLs, import libraries, headers) on the
above website.
Multi-threaded use of GTK+ on Win32
===================================
Multi-threaded GTK+ programs might work on Windows in special simple
cases, but not in general. Sorry. If you have all GTK+ and GDK calls
in the same thread, it might work. Otherwise, probably not at
all. Possible ways to fix this are being investigated.
Wintab
======
The tablet support uses the Wintab API. The Wintab development kit is
no longer required. The wintab.h header file is bundled with GTK+
sources. Unfortunately it seems that only Wacom tablets come with
support for the Wintab API nowadays.
--Tor Lillqvist <tml@iki.fi>, <tml@novell.com>
--Updated by Fan, Chun-wei <fanc999@yahoo.com.tw>

79
acinclude.m4 Normal file
View File

@@ -0,0 +1,79 @@
# autoconf 2.13 / 2.50 compatibility macro
# GLIB_AC_DIVERT_BEFORE_HELP(STUFF)
# ---------------------------------
# Put STUFF early enough so that they are available for $ac_help expansion.
# Handle both classic (<= v2.13) and modern autoconf
AC_DEFUN([GLIB_AC_DIVERT_BEFORE_HELP],
[ifdef([m4_divert_text], [m4_divert_text([NOTICE],[$1])],
[ifdef([AC_DIVERT], [AC_DIVERT([NOTICE],[$1])],
[AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl
$1
AC_DIVERT_POP()])])])
# GTK_ADD_LIB(VAR,LIBNAME)
# ---------------------------------
# Helper macro to add a -lBlah to a variable, avoiding repeats
# Note that this needs to be quoted when used in an enclosing macro
AC_DEFUN([GTK_ADD_LIB],
[ case "$$1 " in
*-l$2[[\ \ ]]*) ;;
*) $1="-l$2 $$1" ;;
esac
])
# Checks the location of the XML Catalog
# Usage:
# JH_PATH_XML_CATALOG([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
# Defines XMLCATALOG and XML_CATALOG_FILE substitutions
AC_DEFUN([JH_PATH_XML_CATALOG],
[
# check for the presence of the XML catalog
AC_ARG_WITH([xml-catalog],
AC_HELP_STRING([--with-xml-catalog=CATALOG],
[path to xml catalog to use]),,
[with_xml_catalog=/etc/xml/catalog])
jh_found_xmlcatalog=true
XML_CATALOG_FILE="$with_xml_catalog"
AC_SUBST([XML_CATALOG_FILE])
AC_MSG_CHECKING([for XML catalog ($XML_CATALOG_FILE)])
if test -f "$XML_CATALOG_FILE"; then
AC_MSG_RESULT([found])
else
jh_found_xmlcatalog=false
AC_MSG_RESULT([not found])
fi
# check for the xmlcatalog program
AC_PATH_PROG(XMLCATALOG, xmlcatalog, no)
if test "x$XMLCATALOG" = xno; then
jh_found_xmlcatalog=false
fi
if $jh_found_xmlcatalog; then
ifelse([$1],,[:],[$1])
else
ifelse([$2],,[AC_MSG_ERROR([could not find XML catalog])],[$2])
fi
])
# Checks if a particular URI appears in the XML catalog
# Usage:
# JH_CHECK_XML_CATALOG(URI, [FRIENDLY-NAME], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
AC_DEFUN([JH_CHECK_XML_CATALOG],
[
AC_REQUIRE([JH_PATH_XML_CATALOG],[JH_PATH_XML_CATALOG(,[:])])dnl
AC_MSG_CHECKING([for ifelse([$2],,[$1],[$2]) in XML catalog])
if $jh_found_xmlcatalog && \
AC_RUN_LOG([$XMLCATALOG --noout "$XML_CATALOG_FILE" "$1" >&2]); then
AC_MSG_RESULT([found])
ifelse([$3],,,[$3
])dnl
else
AC_MSG_RESULT([not found])
ifelse([$4],,
[AC_MSG_ERROR([could not find ifelse([$2],,[$1],[$2]) in XML catalog])],
[$4])
fi
])

46
autogen.sh Executable file
View File

@@ -0,0 +1,46 @@
#!/bin/sh
# Run this to generate all the initial makefiles, etc.
test -n "$srcdir" || srcdir=`dirname "$0"`
test -n "$srcdir" || srcdir=.
olddir=`pwd`
cd "$srcdir"
mkdir -p m4
GTKDOCIZE=`which gtkdocize`
if test -z $GTKDOCIZE; then
echo "*** No GTK-Doc found, please install it ***"
exit 1
else
gtkdocize || exit $?
fi
PKGCONFIG=`which pkg-config`
if test -z "$PKGCONFIG"; then
echo "*** pkg-config not found, please install it ***"
exit 1
fi
pkg-config --print-errors gobject-introspection-1.0
if [ $? != 0 ]; then
echo "You probably need to install 'libgirepository1.0-dev'"
exit 1
fi
# README and INSTALL are required by automake, but may be deleted by clean
# up rules. to get automake to work, simply touch these here, they will be
# regenerated from their corresponding *.in files by ./configure anyway.
touch README INSTALL
AUTORECONF=`which autoreconf`
if test -z $AUTORECONF; then
echo "*** No autoreconf found, please install it ***"
exit 1
else
autoreconf --force --install --verbose || exit $?
fi
cd "$olddir"
test -n "$NOCONFIGURE" || "$srcdir/configure" "$@"

View File

@@ -1,6 +1,6 @@
#!/bin/sh
gtk_api_version=$1
gtk_version=$1
gtk_abi_version=$2
gtk_libdir=$3
gtk_datadir=$4
@@ -17,5 +17,5 @@ if [ -z "$DESTDIR" ]; then
gtk-update-icon-cache -q -t -f ${gtk_datadir}/icons/hicolor
echo Updating input method modules cache...
gtk4-query-immodules > ${gtk_libdir}/gtk-${gtk_api_version}/${gtk_abi_version}/immodules.cache
gtk4-query-immodules > ${gtk_libdir}/gtk-${version}/${gtk_abi_version}/immodules.cache
fi

View File

@@ -1,7 +1,7 @@
/* config.h.in. Generated from configure.ac by autoheader. */
/* always defined to indicate that i18n is enabled */
#define ENABLE_NLS 1
#mesondefine ENABLE_NLS
/* The prefix for our gettext translation domains. */
#mesondefine GETTEXT_PACKAGE
@@ -15,9 +15,6 @@
/* Define to 1 if you have the `bind_textdomain_codeset' function. */
#mesondefine HAVE_BIND_TEXTDOMAIN_CODESET
/* Have the cloudproviders library */
#mesondefine HAVE_CLOUDPROVIDERS
/* define if we have colord */
#mesondefine HAVE_COLORD

337
config.h.win32.in Normal file
View File

@@ -0,0 +1,337 @@
/* config.h.win32.in. Merged from two versions generated by configure for gcc and MSVC. */
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.in by autoheader. */
/* always defined to indicate that i18n is enabled */
#define ENABLE_NLS 1
/* define to enable packagekit */
/* #undef ENABLE_PACKAGEKIT */
/* The prefix for our gettext translation domains. */
#define GETTEXT_PACKAGE "@GETTEXT_PACKAGE@"
/* Disable deprecation warnings from glib */
/* #undef GLIB_DISABLE_DEPRECATION_WARNINGS */
/* Define if debugging is enabled */
#define GTK_COMPILED_WITH_DEBUGGING "yes"
/* Define the location where the catalogs will be installed */
#define GTK_LOCALEDIR "NONE/share/locale"
/* Define to 1 if you have the `bind_textdomain_codeset' function. */
#define HAVE_BIND_TEXTDOMAIN_CODESET 1
/* define if we have colord */
/* #undef HAVE_COLORD */
/* Define to 1 if you have the <crt_externs.h> header file. */
/* #undef HAVE_CRT_EXTERNS_H */
/* Define to 1 if CUPS 1.2 API is available */
/* #undef HAVE_CUPS_API_1_2 */
/* Define to 1 if you have the `dcgettext' function. */
#define HAVE_DCGETTEXT 1
/* Define to 1 if you have the declaration of `isinf', and to 0 if you don't.
*/
#if !defined (_MSC_VER) || (_MSC_VER >= 1800)
#define HAVE_DECL_ISINF 1
#endif
/* Define to 1 if you have the declaration of `isnan', and to 0 if you don't.
*/
#if !defined (_MSC_VER) || (_MSC_VER >= 1800)
#define HAVE_DECL_ISNAN 1
#endif
/* Define to 1 if you have the <dlfcn.h> header file. */
/* #undef HAVE_DLFCN_H */
/* Define to 1 if you have the `exp2' function. */
#if !defined (_MSC_VER) || (_MSC_VER >= 1800)
#define HAVE_EXP2 1
#endif
/* Define to 1 if you have the `flockfile' function. */
#undef HAVE_FLOCKFILE
/* Define to 1 if you have the <ftw.h> header file. */
/* #undef HAVE_FTW_H */
/* Define to 1 if you have the `getpagesize' function. */
#ifndef _MSC_VER
#define HAVE_GETPAGESIZE 1
#else
/* #undef HAVE_GETPAGESIZE */
#endif
/* Define to 1 if you have the `getresuid' function. */
/* #undef HAVE_GETRESUID */
/* Define if the GNU gettext() function is already present or preinstalled. */
#define HAVE_GETTEXT 1
/* Define if gio-unix is available */
/* #undef HAVE_GIO_UNIX */
/* Have GNU ftw */
/* #undef HAVE_GNU_FTW */
/* Define to 1 if you have the `httpGetAuthString' function. */
/* #undef HAVE_HTTPGETAUTHSTRING */
/* Define if cups http_t authstring field is accessible */
/* #undef HAVE_HTTP_AUTHSTRING */
/* Define to 1 if you have the <inttypes.h> header file. */
#if !defined (_MSC_VER) || (_MSC_VER >= 1800)
#define HAVE_INTTYPES_H 1
#else
/* #undef HAVE_INTTYPES_H */
#endif
/* Define to 1 if the system has the type `IPrintDialogCallback'. */
#define HAVE_IPRINTDIALOGCALLBACK 1
/* Define if your <locale.h> file defines LC_MESSAGES. */
/* #undef HAVE_LC_MESSAGES */
/* Define to 1 if you have the `m' library (-lm). */
#ifndef _MSC_VER
#define HAVE_LIBM 1
#endif
/* Define to 1 if you have the <locale.h> header file. */
#define HAVE_LOCALE_H 1
/* Define to 1 if you have the `localtime_r' function. */
/* #undef HAVE_LOCALTIME_R */
/* Define to 1 if you have the `log2' function. */
#if !defined (_MSC_VER) || (_MSC_VER >= 1800)
#define HAVE_LOG2 1
#endif
/* Define to 1 if you have the `lstat' function. */
/* #undef HAVE_LSTAT */
/* Define to 1 if you have the `mallinfo' function. */
/* #undef HAVE_MALLINFO */
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the `mkstemp' function. */
/* #undef HAVE_MKSTEMP */
/* Define to 1 if you have a working `mmap' system call. */
/* #undef HAVE_MMAP */
/* Define to 1 if nearbyint() is available */
#if !defined (_MSC_VER) || (_MSC_VER >= 1800)
#define HAVE_NEARBYINT 1
#endif
/* Define to 1 if libpapi available */
/* #undef HAVE_PAPI */
/* Define to 1 if you have the <pwd.h> header file. */
/* #undef HAVE_PWD_H */
/* Have the Xrandr extension library */
/* #undef HAVE_RANDR */
/* Define to 1 if rint() is available */
#if !defined (_MSC_VER) || (_MSC_VER >= 1800)
#define HAVE_RINT 1
#endif
/* Define to 1 if round() is available */
#if !defined (_MSC_VER) || (_MSC_VER >= 1800)
#define HAVE_ROUND 1
#endif
/* Define to 1 if sincos() is available */
/* #undef HAVE_SINCOS */
/* Have the sockaddr_un.sun_len member */
/* #undef HAVE_SOCKADDR_UN_SUN_LEN */
/* Define to 1 if solaris xinerama is available */
/* #undef HAVE_SOLARIS_XINERAMA */
/* Define to 1 if you have the <stdint.h> header file. */
#ifndef _MSC_VER
#define HAVE_STDINT_H 1
#else
#if (_MSC_VER >= 1600) /* VS 2010+ ships with stdint.h */
#define HAVE_STDINT_H 1
#endif
/* #undef HAVE_STDINT_H */
#endif
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the <strings.h> header file. */
#ifndef _MSC_VER
#define HAVE_STRINGS_H 1
#endif
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the <sys/mman.h> header file. */
/* #undef HAVE_SYS_MMAN_H */
/* Define to 1 if you have the <sys/param.h> header file. */
/* #undef HAVE_SYS_PARAM_H */
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if sys/sysinfo.h is available */
/* #undef HAVE_SYS_SYSINFO_H */
/* Define to 1 if sys/systeminfo.h is available */
/* #undef HAVE_SYS_SYSTEMINFO_H */
/* Define to 1 if you have the <sys/time.h> header file. */
#ifndef _MSC_VER
#define HAVE_SYS_TIME_H 1
#else /* _MSC_VER */
/* #undef HAVE_SYS_TIME_H */
#endif
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#ifndef _MSC_VER
#define HAVE_UNISTD_H 1
#else
/* #undef HAVE_UNISTD_H */
#endif
/* Have the XCOMPOSITE X extension */
/* #undef HAVE_XCOMPOSITE */
/* Have the Xcursor library */
/* #undef HAVE_XCURSOR */
/* Have the XDAMAGE X extension */
/* #undef HAVE_XDAMAGE */
/* Have the XFIXES X extension */
/* #undef HAVE_XFIXES */
/* Define to 1 if XFree Xinerama is available */
/* #undef HAVE_XFREE_XINERAMA */
/* Have XGenericEvent */
/* #undef HAVE_XGENERICEVENTS */
/* Define to 1 if xinerama is available */
/* #undef HAVE_XINERAMA */
/* Define to use XKB extension */
/* #undef HAVE_XKB */
/* Have the SYNC extension library */
/* #undef HAVE_XSYNC */
/* Define to 1 if you have the `_lock_file' function. */
#define HAVE__LOCK_FILE
/* Define if _NL_MEASUREMENT_MEASUREMENT is available */
/* #undef HAVE__NL_MEASUREMENT_MEASUREMENT */
/* Define if _NL_PAPER_HEIGHT is available */
/* #undef HAVE__NL_PAPER_HEIGHT */
/* Define if _NL_PAPER_WIDTH is available */
/* #undef HAVE__NL_PAPER_WIDTH */
/* Define if _NL_TIME_FIRST_WEEKDAY is available */
/* #undef HAVE__NL_TIME_FIRST_WEEKDAY */
/* Define to 1 if you have the `_NSGetEnviron' function. */
/* #undef HAVE__NSGETENVIRON */
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#define LT_OBJDIR ".libs/"
/* Define if <X11/extensions/XIproto.h> needed for xReply */
/* #undef NEED_XIPROTO_H_FOR_XREPLY */
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
#ifndef _MSC_VER
/* #undef NO_MINUS_C_MINUS_O */
#else
#define NO_MINUS_C_MINUS_O 1
#endif
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "http://bugzilla.gnome.org/enter_bug.cgi?product=gtk%2B"
/* Define to the full name of this package. */
#define PACKAGE_NAME "gtk+"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "gtk+ @GTK_MAJOR_VERSION@.@GTK_MINOR_VERSION@.@GTK_MICRO_VERSION@"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "gtk+"
/* Define to the home page for this package. */
#define PACKAGE_URL ""
/* Define to the version of this package. */
#define PACKAGE_VERSION "@GTK_MAJOR_VERSION@.@GTK_MINOR_VERSION@.@GTK_MICRO_VERSION@"
/* Use NSBundle functions to determine load paths for libraries, translations,
etc. */
/* #undef QUARTZ_RELOCATION */
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Define to 1 if gmodule works and should be used */
#define USE_GMODULE 1
/* Define to 1 if XInput 2.0 is available */
/* #undef XINPUT_2 */
/* Define to 1 if XInput 2.2 is available */
/* #undef XINPUT_2_2 */
/* Define to 1 if the X Window System is missing or not being used. */
/* #undef X_DISPLAY_MISSING */
/* Enable large inode numbers on Mac OS X 10.5. */
#ifndef _DARWIN_USE_64_BIT_INODE
/* # define _DARWIN_USE_64_BIT_INODE 1 */
#endif
/* Number of bits in a file offset, on hosts where this is settable. */
/* #undef _FILE_OFFSET_BITS */
/* defines how to decorate public symbols while building */
#ifdef _MSC_VER
#define _GDK_EXTERN __declspec (dllexport) extern
#else
#define _GDK_EXTERN __attribute__((visibility("default"))) __declspec (dllexport) extern
#endif
/* Define for large files, on AIX-style hosts. */
/* #undef _LARGE_FILES */
/* Define to `int' if <sys/types.h> doesn't define. */
#define gid_t int
/* Define to `int' if <sys/types.h> doesn't define. */
#define uid_t int

2090
configure.ac Normal file

File diff suppressed because it is too large Load Diff

6
demos/Makefile.am Normal file
View File

@@ -0,0 +1,6 @@
## Makefile.am for gtk+/demos
include $(top_srcdir)/Makefile.decl
SUBDIRS = gtk-demo widget-factory icon-browser
-include $(top_srcdir)/git.mk

206
demos/gtk-demo/Makefile.am Normal file
View File

@@ -0,0 +1,206 @@
## Makefile.am for gtk+/demos
include $(top_srcdir)/Makefile.decl
## These should be in the order you want them to appear in the
## demo app, which means alphabetized by demo title, not filename
demos_base = \
application_demo.c \
assistant.c \
builder.c \
button_box.c \
changedisplay.c \
clipboard.c \
colorsel.c \
combobox.c \
css_accordion.c \
css_basics.c \
css_blendmodes.c \
css_multiplebgs.c \
css_pixbufs.c \
css_shadows.c \
cursors.c \
dialog.c \
drawingarea.c \
editable_cells.c \
entry_buffer.c \
entry_completion.c \
event_axes.c \
expander.c \
filtermodel.c \
fishbowl.c \
widgetbowl.c \
foreigndrawing.c \
gestures.c \
glarea.c \
headerbar.c \
hypertext.c \
iconview.c \
iconview_edit.c \
images.c \
infobar.c \
links.c \
listbox.c \
flowbox.c \
list_store.c \
markup.c \
menus.c \
modelbutton.c \
overlay.c \
overlay2.c \
panes.c \
pickers.c \
pixbufs.c \
popover.c \
printing.c \
revealer.c \
rotated_text.c \
scale.c \
search_entry.c \
search_entry2.c \
shortcuts.c \
sidebar.c \
sizegroup.c \
spinbutton.c \
spinner.c \
stack.c \
tabs.c \
textmask.c \
textview.c \
textscroll.c \
theming_style_classes.c \
toolpalette.c \
transparent.c \
tree_store.c
demos_opt =
if BUILD_FONT_DEMO
demos_opt += font_features.c
endif
if OS_UNIX
demos_opt += pagesetup.c
endif
demos = $(demos_base) $(demos_opt)
AM_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_builddir)/gdk \
-DGDK_DISABLE_DEPRECATED \
-DGTK_DISABLE_DEPRECATED \
$(GTK_DEBUG_FLAGS) \
$(GTK_DEP_CFLAGS)
DEPS = \
$(top_builddir)/gtk/libgtk-4.la
LDADDS = \
$(top_builddir)/gtk/libgtk-4.la \
$(GTK_DEP_LIBS) \
$(GDK_DEP_LIBS) \
-lm
if BUILD_FONT_DEMO
AM_CPPFLAGS += $(FONTDEMO_CFLAGS)
LDADDS += $(FONTDEMO_LIBS)
endif
bin_PROGRAMS = gtk4-demo gtk4-demo-application
desktopdir = $(datadir)/applications
dist_desktop_DATA = gtk4-demo.desktop
BUILT_SOURCES = demos.h demo_resources.c
EXTRA_DIST += \
data/source.svg \
data/symbolic-source.svg \
demo.gresource.xml \
$(resource_files) \
org.gtk.Demo.gschema.xml \
demos.h.win32
gsettings_SCHEMAS = \
org.gtk.Demo.gschema.xml
@GSETTINGS_RULES@
demos.h: $(demos) geninclude.pl
$(AM_V_GEN) (here=`pwd` ; cd $(srcdir) && $(PERL) $$here/geninclude.pl $(demos)) > demos.h
demos.h.win32: $(demos_base) geninclude.pl
$(AM_V_GEN) (here=`pwd` ; cd $(srcdir) && $(PERL) $$here/geninclude.pl $(demos_base)) > demos.h.win32
nodist_gtk4_demo_SOURCES = demos.h
gtk4_demo_SOURCES = \
$(demos) \
gtkfishbowl.c \
gtkfishbowl.h \
demo_resources.c \
main.c
gtk4_demo_DEPENDENCIES = $(DEPS)
gtk4_demo_LDADD = $(LDADDS)
gtk4_demo_LDFLAGS = -export-dynamic
gtk4_demo_application_SOURCES = \
application.c \
demo_resources.c
gtk4_demo_application_LDADD = $(LDADDS)
resource_files = $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(builddir)/demo.gresource.xml)
demo_resources.c: demo.gresource.xml $(resource_files)
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate-source $(srcdir)/demo.gresource.xml
iconthemedir = $(datadir)/icons/hicolor
appsicon16dir = $(iconthemedir)/16x16/apps
appsicon22dir = $(iconthemedir)/22x22/apps
appsicon24dir = $(iconthemedir)/24x24/apps
appsicon32dir = $(iconthemedir)/32x32/apps
appsicon48dir = $(iconthemedir)/48x48/apps
appsicon256dir = $(iconthemedir)/256x256/apps
appsiconscalabledir = $(iconthemedir)/scalable/apps
dist_appsicon16_DATA = data/16x16/gtk4-demo.png data/16x16/gtk4-demo-symbolic.symbolic.png
dist_appsicon22_DATA = data/22x22/gtk4-demo.png data/22x22/gtk4-demo-symbolic.symbolic.png
dist_appsicon24_DATA = data/24x24/gtk4-demo.png data/24x24/gtk4-demo-symbolic.symbolic.png
dist_appsicon32_DATA = data/32x32/gtk4-demo.png data/32x32/gtk4-demo-symbolic.symbolic.png
dist_appsicon48_DATA = data/48x48/gtk4-demo.png data/48x48/gtk4-demo-symbolic.symbolic.png
dist_appsicon256_DATA = data/256x256/gtk4-demo.png data/256x256/gtk4-demo-symbolic.symbolic.png
update_icon_cache = $(top_builddir)/gtk/gtk4-update-icon-cache$(EXEEXT) --ignore-theme-index --force
install-data-hook: install-update-icon-cache
uninstall-hook: uninstall-update-icon-cache
install-update-icon-cache:
$(AM_V_at)$(POST_INSTALL)
test -n "$(DESTDIR)" || $(update_icon_cache) "$(iconthemedir)"
uninstall-update-icon-cache:
$(AM_V_at)$(POST_UNINSTALL)
test -n "$(DESTDIR)" || $(update_icon_cache) "$(iconthemedir)"
# ------------------- MSVC Build Items ----------------
MSVCPROJS = gtk4-demo gtk4-demo-application
gtk4_demo_FILES = $(gtk4_demo_SOURCES)
gtk4_demo_EXCLUDES = font_features.c|pagesetup.c
gtk4_demo_application_FILES = $(gtk4_demo_application_SOURCES)
gtk4_demo_application_EXCLUDES = dummy
include $(top_srcdir)/win32/Makefile.msvcproj
dist-hook: \
$(top_builddir)/win32/vs12/gtk4-demo.vcxproj \
$(top_builddir)/win32/vs12/gtk4-demo-application.vcxproj
DISTCLEANFILES = demos.h demos.h.win32
-include $(top_srcdir)/git.mk

View File

@@ -475,14 +475,12 @@ demo_application_window_state_event (GtkWidget *widget,
{
DemoApplicationWindow *window = (DemoApplicationWindow *)widget;
gboolean res = GDK_EVENT_PROPAGATE;
GdkWindowState changed, new_state;
if (GTK_WIDGET_CLASS (demo_application_window_parent_class)->window_state_event)
res = GTK_WIDGET_CLASS (demo_application_window_parent_class)->window_state_event (widget, event);
gdk_event_get_window_state ((GdkEvent *)event, &changed, &new_state);
window->maximized = (new_state & GDK_WINDOW_STATE_MAXIMIZED) != 0;
window->fullscreen = (new_state & GDK_WINDOW_STATE_FULLSCREEN) != 0;
window->maximized = (event->new_window_state & GDK_WINDOW_STATE_MAXIMIZED) != 0;
window->fullscreen = (event->new_window_state & GDK_WINDOW_STATE_FULLSCREEN) != 0;
return res;
}

View File

@@ -144,11 +144,8 @@ static void
create_page4 (GtkWidget *assistant)
{
progress_bar = gtk_progress_bar_new ();
gtk_widget_set_halign (progress_bar, GTK_ALIGN_FILL);
gtk_widget_set_halign (progress_bar, GTK_ALIGN_CENTER);
gtk_widget_set_valign (progress_bar, GTK_ALIGN_CENTER);
gtk_widget_set_hexpand (progress_bar, TRUE);
gtk_widget_set_margin_start (progress_bar, 40);
gtk_widget_set_margin_end (progress_bar, 40);
gtk_widget_show (progress_bar);
gtk_assistant_append_page (GTK_ASSISTANT (assistant), progress_bar);
@@ -170,8 +167,8 @@ do_assistant (GtkWidget *do_widget)
gtk_window_set_default_size (GTK_WINDOW (assistant), -1, 300);
gtk_window_set_display (GTK_WINDOW (assistant),
gtk_widget_get_display (do_widget));
gtk_window_set_screen (GTK_WINDOW (assistant),
gtk_widget_get_screen (do_widget));
create_page1 (assistant);
create_page2 (assistant);

View File

@@ -61,8 +61,8 @@ do_builder (GtkWidget *do_widget)
gtk_builder_connect_signals (builder, NULL);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
toolbar = GTK_WIDGET (gtk_builder_get_object (builder, "toolbar1"));

View File

@@ -55,8 +55,8 @@ do_button_box (GtkWidget *do_widget)
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Button Boxes");
g_signal_connect (window, "destroy",

View File

@@ -101,16 +101,17 @@ button_release_event_cb (GtkWidget *widget,
* window under the pointer, or NULL, if there is none.
*/
static GtkWidget *
query_for_toplevel (GdkDisplay *display,
query_for_toplevel (GdkScreen *screen,
const char *prompt)
{
GdkDisplay *display = gdk_screen_get_display (screen);
GtkWidget *popup, *label, *frame;
GdkCursor *cursor;
GtkWidget *toplevel = NULL;
GdkDevice *device;
popup = gtk_window_new (GTK_WINDOW_POPUP);
gtk_window_set_display (GTK_WINDOW (popup), display);
gtk_window_set_screen (GTK_WINDOW (popup), screen);
gtk_window_set_modal (GTK_WINDOW (popup), TRUE);
gtk_window_set_position (GTK_WINDOW (popup), GTK_WIN_POS_CENTER);
@@ -123,7 +124,7 @@ query_for_toplevel (GdkDisplay *display,
gtk_container_add (GTK_CONTAINER (frame), label);
gtk_widget_show (popup);
cursor = gdk_cursor_new_from_name ("crosshair", NULL);
cursor = gdk_cursor_new_from_name (display, "crosshair");
device = gtk_get_current_event_device ();
if (gdk_seat_grab (gdk_device_get_seat (device),
@@ -143,13 +144,14 @@ query_for_toplevel (GdkDisplay *display,
while (!clicked)
g_main_context_iteration (NULL, TRUE);
toplevel = find_toplevel_at_pointer (display);
toplevel = find_toplevel_at_pointer (gdk_screen_get_display (screen));
if (toplevel == popup)
toplevel = NULL;
}
g_object_unref (cursor);
gtk_widget_destroy (popup);
gdk_flush (); /* Really release the grab */
return toplevel;
}
@@ -160,17 +162,17 @@ query_for_toplevel (GdkDisplay *display,
static void
query_change_display (ChangeDisplayInfo *info)
{
GdkDisplay *display = gtk_widget_get_display (info->window);
GdkScreen *screen = gtk_widget_get_screen (info->window);
GtkWidget *toplevel;
toplevel = query_for_toplevel (display,
toplevel = query_for_toplevel (screen,
"Please select the toplevel\n"
"to move to the new display");
"to move to the new screen");
if (toplevel)
gtk_window_set_display (GTK_WINDOW (toplevel), info->current_display);
gtk_window_set_screen (GTK_WINDOW (toplevel), gdk_display_get_default_screen (info->current_display));
else
gdk_display_beep (display);
gdk_display_beep (gdk_screen_get_display (screen));
}
/* Called when the user clicks on a button in our dialog or

View File

@@ -1,6 +1,6 @@
/* Clipboard
*
* GdkClipboard is used for clipboard handling. This demo shows how to
* GtkClipboard is used for clipboard handling. This demo shows how to
* copy and paste text to and from the clipboard.
*
* It also shows how to transfer images via the clipboard or via
@@ -13,104 +13,78 @@
#include <gtk/gtk.h>
#include <string.h>
static GtkWidget *window = NULL;
void
copy_button_clicked (GtkWidget *button,
gpointer user_data)
{
GtkWidget *entry;
GdkClipboard *clipboard;
GtkClipboard *clipboard;
entry = GTK_WIDGET (user_data);
/* Get the clipboard object */
clipboard = gtk_widget_get_clipboard (entry);
clipboard = gtk_widget_get_clipboard (entry,
GDK_SELECTION_CLIPBOARD);
/* Set clipboard text */
gdk_clipboard_set_text (clipboard, gtk_entry_get_text (GTK_ENTRY (entry)));
gtk_clipboard_set_text (clipboard, gtk_entry_get_text (GTK_ENTRY (entry)), -1);
}
void
paste_received (GObject *source_object,
GAsyncResult *result,
paste_received (GtkClipboard *clipboard,
const gchar *text,
gpointer user_data)
{
GdkClipboard *clipboard;
GtkWidget *entry;
char *text;
GError *error = NULL;
clipboard = GDK_CLIPBOARD (source_object);
entry = GTK_WIDGET (user_data);
/* Get the resulting text of the read operation */
text = gdk_clipboard_read_text_finish (clipboard, result, &error);
if (text)
{
/* Set the entry text */
gtk_entry_set_text (GTK_ENTRY (entry), text);
g_free (text);
}
else
{
GtkWidget *dialog;
/* Show an error about why pasting failed.
* Usually you probably want to ignore such failures,
* but for demonstration purposes, we show the error.
*/
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Could not paste text: %s",
error->message);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_widget_destroy), NULL);
gtk_widget_show (dialog);
g_error_free (error);
}
/* Set the entry text */
if(text)
gtk_entry_set_text (GTK_ENTRY (entry), text);
}
void
paste_button_clicked (GtkWidget *button,
gpointer user_data)
gpointer user_data)
{
GtkWidget *entry;
GdkClipboard *clipboard;
GtkClipboard *clipboard;
entry = GTK_WIDGET (user_data);
/* Get the clipboard object */
clipboard = gtk_widget_get_clipboard (entry);
clipboard = gtk_widget_get_clipboard (entry,
GDK_SELECTION_CLIPBOARD);
/* Request the contents of the clipboard, contents_received will be
called when we do get the contents.
*/
gdk_clipboard_read_text_async (clipboard, NULL, paste_received, entry);
gtk_clipboard_request_text (clipboard,
paste_received, entry);
}
static GdkTexture *
get_image_texture (GtkImage *image)
static GdkPixbuf *
get_image_pixbuf (GtkImage *image)
{
const gchar *icon_name;
GtkIconSize size;
GtkIconTheme *icon_theme;
GtkIconInfo *icon_info;
int width;
switch (gtk_image_get_storage_type (image))
{
case GTK_IMAGE_TEXTURE:
return g_object_ref (gtk_image_get_texture (image));
case GTK_IMAGE_PIXBUF:
return g_object_ref (gtk_image_get_pixbuf (image));
case GTK_IMAGE_ICON_NAME:
icon_name = gtk_image_get_icon_name (image);
icon_theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (GTK_WIDGET (image)));
icon_info = gtk_icon_theme_lookup_icon (icon_theme, icon_name, 48, GTK_ICON_LOOKUP_GENERIC_FALLBACK);
if (icon_info == NULL)
return NULL;
return gtk_icon_info_load_texture (icon_info);
gtk_image_get_icon_name (image, &icon_name, &size);
icon_theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (image)));
gtk_icon_size_lookup (size, &width, NULL);
return gtk_icon_theme_load_icon (icon_theme,
icon_name,
width,
GTK_ICON_LOOKUP_GENERIC_FALLBACK,
NULL);
default:
g_warning ("Image storage type %d not handled",
gtk_image_get_storage_type (image));
@@ -123,11 +97,11 @@ drag_begin (GtkWidget *widget,
GdkDragContext *context,
gpointer data)
{
GdkTexture *texture;
GdkPixbuf *pixbuf;
texture = get_image_texture (GTK_IMAGE (widget));
if (texture)
gtk_drag_set_icon_texture (context, texture, -2, -2);
pixbuf = get_image_pixbuf (GTK_IMAGE (data));
gtk_drag_set_icon_pixbuf (context, pixbuf, -2, -2);
g_object_unref (pixbuf);
}
void
@@ -138,27 +112,30 @@ drag_data_get (GtkWidget *widget,
guint time,
gpointer data)
{
GdkTexture *texture;
GdkPixbuf *pixbuf;
texture = get_image_texture (GTK_IMAGE (widget));
if (texture)
gtk_selection_data_set_texture (selection_data, texture);
pixbuf = get_image_pixbuf (GTK_IMAGE (data));
gtk_selection_data_set_pixbuf (selection_data, pixbuf);
g_object_unref (pixbuf);
}
static void
drag_data_received (GtkWidget *widget,
GdkDragContext *context,
gint x,
gint y,
GtkSelectionData *selection_data,
guint info,
guint32 time,
gpointer data)
{
GdkPixbuf *pixbuf;
if (gtk_selection_data_get_length (selection_data) > 0)
{
GdkTexture *texture;
texture = gtk_selection_data_get_texture (selection_data);
gtk_image_set_from_texture (GTK_IMAGE (data), texture);
g_object_unref (texture);
pixbuf = gtk_selection_data_get_pixbuf (selection_data);
gtk_image_set_from_pixbuf (GTK_IMAGE (data), pixbuf);
g_object_unref (pixbuf);
}
}
@@ -166,59 +143,42 @@ static void
copy_image (GtkMenuItem *item,
gpointer data)
{
GdkClipboard *clipboard;
GdkTexture *texture;
GtkClipboard *clipboard;
GdkPixbuf *pixbuf;
clipboard = gtk_widget_get_clipboard (GTK_WIDGET (data));
texture = get_image_texture (GTK_IMAGE (data));
clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
pixbuf = get_image_pixbuf (GTK_IMAGE (data));
if (texture)
{
gdk_clipboard_set_texture (clipboard, texture);
g_object_unref (texture);
}
}
static void
paste_image_received (GObject *source,
GAsyncResult *result,
gpointer data)
{
GdkTexture *texture;
texture = gdk_clipboard_read_texture_finish (GDK_CLIPBOARD (source), result, NULL);
if (texture == NULL)
return;
gtk_image_set_from_texture (GTK_IMAGE (data), texture);
g_object_unref (texture);
gtk_clipboard_set_image (clipboard, pixbuf);
g_object_unref (pixbuf);
}
static void
paste_image (GtkMenuItem *item,
gpointer data)
{
GdkClipboard *clipboard;
GtkClipboard *clipboard;
GdkPixbuf *pixbuf;
clipboard = gtk_widget_get_clipboard (GTK_WIDGET (data));
gdk_clipboard_read_texture_async (clipboard,
NULL,
paste_image_received,
data);
clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
pixbuf = gtk_clipboard_wait_for_image (clipboard);
if (pixbuf)
{
gtk_image_set_from_pixbuf (GTK_IMAGE (data), pixbuf);
g_object_unref (pixbuf);
}
}
static gboolean
button_press (GtkWidget *widget,
GdkEventButton *event,
GdkEventButton *button,
gpointer data)
{
GtkWidget *menu;
GtkWidget *item;
guint button;
gdk_event_get_button ((GdkEvent *)event, &button);
if (button != GDK_BUTTON_SECONDARY)
if (button->button != GDK_BUTTON_SECONDARY)
return FALSE;
menu = gtk_menu_new ();
@@ -233,23 +193,26 @@ button_press (GtkWidget *widget,
gtk_widget_show (item);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
gtk_menu_popup_at_pointer (GTK_MENU (menu), (GdkEvent *) event);
gtk_menu_popup_at_pointer (GTK_MENU (menu), (GdkEvent *) button);
return TRUE;
}
GtkWidget *
do_clipboard (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
if (!window)
{
GtkWidget *vbox, *hbox;
GtkWidget *label;
GtkWidget *entry, *button;
GtkWidget *image;
GtkClipboard *clipboard;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Clipboard");
g_signal_connect (window, "destroy",
@@ -303,11 +266,12 @@ do_clipboard (GtkWidget *do_widget)
gtk_box_pack_start (GTK_BOX (vbox), hbox);
/* Create the first image */
image = gtk_image_new_from_icon_name ("dialog-warning");
image = gtk_image_new_from_icon_name ("dialog-warning",
GTK_ICON_SIZE_BUTTON);
gtk_container_add (GTK_CONTAINER (hbox), image);
/* make image a drag source */
gtk_drag_source_set (image, GDK_BUTTON1_MASK, NULL, GDK_ACTION_COPY);
gtk_drag_source_set (image, GDK_BUTTON1_MASK, NULL, 0, GDK_ACTION_COPY);
gtk_drag_source_add_image_targets (image);
g_signal_connect (image, "drag-begin",
G_CALLBACK (drag_begin), image);
@@ -316,7 +280,7 @@ do_clipboard (GtkWidget *do_widget)
/* accept drops on image */
gtk_drag_dest_set (image, GTK_DEST_DEFAULT_ALL,
NULL, GDK_ACTION_COPY);
NULL, 0, GDK_ACTION_COPY);
gtk_drag_dest_add_image_targets (image);
g_signal_connect (image, "drag-data-received",
G_CALLBACK (drag_data_received), image);
@@ -326,11 +290,12 @@ do_clipboard (GtkWidget *do_widget)
G_CALLBACK (button_press), image);
/* Create the second image */
image = gtk_image_new_from_icon_name ("process-stop");
image = gtk_image_new_from_icon_name ("process-stop",
GTK_ICON_SIZE_BUTTON);
gtk_container_add (GTK_CONTAINER (hbox), image);
/* make image a drag source */
gtk_drag_source_set (image, GDK_BUTTON1_MASK, NULL, GDK_ACTION_COPY);
gtk_drag_source_set (image, GDK_BUTTON1_MASK, NULL, 0, GDK_ACTION_COPY);
gtk_drag_source_add_image_targets (image);
g_signal_connect (image, "drag-begin",
G_CALLBACK (drag_begin), image);
@@ -339,7 +304,7 @@ do_clipboard (GtkWidget *do_widget)
/* accept drops on image */
gtk_drag_dest_set (image, GTK_DEST_DEFAULT_ALL,
NULL, GDK_ACTION_COPY);
NULL, 0, GDK_ACTION_COPY);
gtk_drag_dest_add_image_targets (image);
g_signal_connect (image, "drag-data-received",
G_CALLBACK (drag_data_received), image);
@@ -347,6 +312,10 @@ do_clipboard (GtkWidget *do_widget)
/* context menu on image */
g_signal_connect (image, "button-press-event",
G_CALLBACK (button_press), image);
/* tell the clipboard manager to make the data persistent */
clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
gtk_clipboard_set_can_store (clipboard, NULL, 0);
}
if (!gtk_widget_get_visible (window))

View File

@@ -70,10 +70,9 @@ do_colorsel (GtkWidget *do_widget)
color.alpha = 1;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Color Chooser");
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);

View File

@@ -311,8 +311,8 @@ do_combobox (GtkWidget *do_widget)
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Combo Boxes");
g_signal_connect (window, "destroy",

View File

@@ -47,6 +47,8 @@ css_text_changed (GtkTextBuffer *buffer,
text = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
gtk_css_provider_load_from_data (provider, text, -1);
g_free (text);
gtk_style_context_reset_widgets (gdk_screen_get_default ());
}
static void

View File

@@ -28,7 +28,7 @@ struct {
{ "Multiply", "multiply" },
{ "Normal", "normal" },
{ "Overlay", "overlay" },
{ "Saturate", "saturation" },
{ "Saturate", "saturate" },
{ "Screen", "screen" },
{ "Soft Light", "soft-light" },
{ NULL }
@@ -130,9 +130,9 @@ do_css_blendmodes (GtkWidget *do_widget)
/* Setup the CSS provider for window */
provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
provider,
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
provider,
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
setup_listbox (builder, provider);
}

View File

@@ -47,6 +47,8 @@ css_text_changed (GtkTextBuffer *buffer,
text = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
gtk_css_provider_load_from_data (provider, text, -1);
g_free (text);
gtk_style_context_reset_widgets (gdk_screen_get_default ());
}
static void

View File

@@ -46,6 +46,8 @@ css_text_changed (GtkTextBuffer *buffer,
text = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
gtk_css_provider_load_from_data (provider, text, -1);
g_free (text);
gtk_style_context_reset_widgets (gdk_screen_get_default ());
}
static void

View File

@@ -45,6 +45,8 @@ css_text_changed (GtkTextBuffer *buffer,
text = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
gtk_css_provider_load_from_data (provider, text, -1);
g_free (text);
gtk_style_context_reset_widgets (gdk_screen_get_default ());
}
static void

View File

@@ -1,44 +1,161 @@
/* Cursors
*
* Demonstrates a useful set of available cursors. The cursors shown here are the ones
* defined by CSS, which we assume to be available.
*
* The example shows creating cursors by name or from an image, with or without a fallback.
* Demonstrates a useful set of available cursors.
*/
#include <gtk/gtk.h>
static GtkWidget *window = NULL;
static void
set_cursor (GtkWidget *button, gpointer data)
{
GtkWidget *toplevel;
GdkCursor *cursor = data;
GdkWindow *window;
toplevel = gtk_widget_get_toplevel (button);
window = gtk_widget_get_window (toplevel);
gdk_window_set_cursor (window, cursor);
}
static GtkWidget *
add_section (GtkWidget *box,
const gchar *heading)
{
GtkWidget *label;
GtkWidget *section;
label = gtk_label_new (heading);
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
gtk_widget_set_margin_top (label, 10);
gtk_widget_set_margin_bottom (label, 10);
gtk_box_pack_start (GTK_BOX (box), label);
section = gtk_flow_box_new ();
gtk_widget_set_halign (section, GTK_ALIGN_START);
gtk_flow_box_set_selection_mode (GTK_FLOW_BOX (section), GTK_SELECTION_NONE);
gtk_flow_box_set_min_children_per_line (GTK_FLOW_BOX (section), 2);
gtk_flow_box_set_max_children_per_line (GTK_FLOW_BOX (section), 20);
gtk_box_pack_start (GTK_BOX (box), section);
return section;
}
static void
on_destroy (gpointer data)
add_button (GtkWidget *section,
const gchar *css_name)
{
window = NULL;
GtkWidget *image, *button;
GdkDisplay *display;
GdkCursor *cursor;
display = gtk_widget_get_display (section);
cursor = gdk_cursor_new_from_name (display, css_name);
if (cursor == NULL)
image = gtk_image_new_from_icon_name ("image-missing", GTK_ICON_SIZE_MENU);
else
{
gchar *path;
path = g_strdup_printf ("/cursors/%s_cursor.png", css_name);
g_strdelimit (path, "-", '_');
image = gtk_image_new_from_resource (path);
g_free (path);
}
gtk_widget_set_size_request (image, 32, 32);
button = gtk_button_new ();
gtk_container_add (GTK_CONTAINER (button), image);
gtk_style_context_add_class (gtk_widget_get_style_context (button), "image-button");
g_signal_connect (button, "clicked", G_CALLBACK (set_cursor), cursor);
gtk_widget_set_tooltip_text (button, css_name);
gtk_container_add (GTK_CONTAINER (section), button);
}
GtkWidget *
do_cursors (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
if (!window)
{
GtkBuilder *builder;
GtkWidget *sw;
GtkWidget *box;
GtkWidget *section;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Cursors");
gtk_window_set_default_size (GTK_WINDOW (window), 500, 500);
builder = gtk_builder_new_from_resource ("/cursors/cursors.ui");
gtk_builder_connect_signals (builder, NULL);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
g_signal_connect (window, "destroy",
G_CALLBACK (on_destroy), NULL);
g_object_set_data_full (G_OBJECT (window), "builder", builder, g_object_unref);
G_CALLBACK (gtk_widget_destroyed),
&window);
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (window), sw);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
g_object_set (box,
"margin-start", 20,
"margin-end", 20,
"margin-bottom", 10,
NULL);
gtk_container_add (GTK_CONTAINER (sw), box);
section = add_section (box, "General");
add_button (section, "default");
add_button (section, "none");
section = add_section (box, "Link & Status");
add_button (section, "context-menu");
add_button (section, "help");
add_button (section, "pointer");
add_button (section, "progress");
add_button (section, "wait");
section = add_section (box, "Selection");
add_button (section, "cell");
add_button (section, "crosshair");
add_button (section, "text");
add_button (section, "vertical-text");
section = add_section (box, "Drag & Drop");
add_button (section, "alias");
add_button (section, "copy");
add_button (section, "move");
add_button (section, "no-drop");
add_button (section, "not-allowed");
add_button (section, "grab");
add_button (section, "grabbing");
section = add_section (box, "Resize & Scrolling");
add_button (section, "all-scroll");
add_button (section, "col-resize");
add_button (section, "row-resize");
add_button (section, "n-resize");
add_button (section, "e-resize");
add_button (section, "s-resize");
add_button (section, "w-resize");
add_button (section, "ne-resize");
add_button (section, "nw-resize");
add_button (section, "se-resize");
add_button (section, "sw-resize");
add_button (section, "ew-resize");
add_button (section, "ns-resize");
add_button (section, "nesw-resize");
add_button (section, "nwse-resize");
section = add_section (box, "Zoom");
add_button (section, "zoom-in");
add_button (section, "zoom-out");
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
{
gtk_widget_destroy (window);
}
gtk_widget_destroy (window);
return window;
}

File diff suppressed because it is too large Load Diff

View File

@@ -57,7 +57,6 @@
<file>reset.css</file>
</gresource>
<gresource prefix="/cursors">
<file>cursors.ui</file>
<file>alias_cursor.png</file>
<file>all_scroll_cursor.png</file>
<file>cell_cursor.png</file>
@@ -68,7 +67,6 @@
<file>default_cursor.png</file>
<file>e_resize_cursor.png</file>
<file>ew_resize_cursor.png</file>
<file>gtk_logo_cursor.png</file>
<file>grabbing_cursor.png</file>
<file>grab_cursor.png</file>
<file>hand_cursor.png</file>
@@ -102,8 +100,8 @@
<file>gtkfishbowl.h</file>
</gresource>
<gresource prefix="/iconview">
<file>gnome-fs-directory.png</file>
<file>gnome-fs-regular.png</file>
<file preprocess="to-pixdata">gnome-fs-directory.png</file>
<file preprocess="to-pixdata">gnome-fs-regular.png</file>
</gresource>
<gresource prefix="/stack">
<file>stack.ui</file>
@@ -151,7 +149,6 @@
<file>cursors.c</file>
<file>dialog.c</file>
<file>drawingarea.c</file>
<file>dnd.c</file>
<file>editable_cells.c</file>
<file>entry_buffer.c</file>
<file>entry_completion.c</file>
@@ -235,9 +232,6 @@
<file>decor1.png</file>
<file>decor2.png</file>
</gresource>
<gresource prefix="/transparent">
<file>portland-rose.jpg</file>
</gresource>
<gresource prefix="/markup">
<file>markup.txt</file>
</gresource>
@@ -247,7 +241,4 @@
<gresource prefix="/modelbutton">
<file>modelbutton.ui</file>
</gresource>
<gresource prefix="/dnd">
<file>dnd.css</file>
</gresource>
</gresources>

View File

@@ -58,8 +58,7 @@ interactive_dialog_clicked (GtkButton *button,
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
gtk_box_pack_start (GTK_BOX (content_area), hbox);
image = gtk_image_new_from_icon_name ("dialog-question");
gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_LARGE);
image = gtk_image_new_from_icon_name ("dialog-question", GTK_ICON_SIZE_DIALOG);
gtk_box_pack_start (GTK_BOX (hbox), image);
table = gtk_grid_new ();
@@ -106,8 +105,8 @@ do_dialog (GtkWidget *do_widget)
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Dialogs and Message Boxes");
g_signal_connect (window, "destroy",

View File

@@ -1,377 +0,0 @@
/* Drag-and-Drop
*
* I can't believe its not glade!
*/
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <string.h>
typedef struct _GtkDemoWidget GtkDemoWidget;
struct _GtkDemoWidget
{
GType type;
union {
char *text;
gboolean active;
};
};
static gpointer
copy_demo_widget (gpointer data)
{
GtkDemoWidget *demo = g_memdup (data, sizeof (GtkDemoWidget));
if (demo->type == GTK_TYPE_LABEL)
demo->text = g_strdup (demo->text);
return demo;
}
static void
free_demo_widget (gpointer data)
{
GtkDemoWidget *demo = data;
if (demo->type == GTK_TYPE_LABEL)
g_free (demo->text);
g_free (demo);
}
#define GTK_TYPE_DEMO_WIDGET (gtk_demo_widget_get_type ())
G_DEFINE_BOXED_TYPE (GtkDemoWidget, gtk_demo_widget, copy_demo_widget, free_demo_widget)
static GtkDemoWidget *
serialize_widget (GtkWidget *widget)
{
GtkDemoWidget *demo;
demo = g_new0 (GtkDemoWidget, 1);
demo->type = G_OBJECT_TYPE (widget);
if (GTK_IS_LABEL (widget))
{
demo->text = g_strdup (gtk_label_get_text (GTK_LABEL (widget)));
}
else if (GTK_IS_SPINNER (widget))
{
g_object_get (widget, "active", &demo->active, NULL);
}
else
{
g_print ("Type %s not supported\n", g_type_name (demo->type));
}
return demo;
}
static GtkWidget *
deserialize_widget (GtkDemoWidget *demo)
{
GtkWidget *widget = NULL;
if (demo->type == GTK_TYPE_LABEL)
{
widget = gtk_label_new (demo->text);
}
else if (demo->type == GTK_TYPE_SPINNER)
{
widget = g_object_new (demo->type, "active", demo->active, NULL);
gtk_style_context_add_class (gtk_widget_get_style_context (widget), "demo");
}
else
{
g_print ("Type %s not supported\n", g_type_name (demo->type));
}
return widget;
}
static double pos_x, pos_y;
static void
new_label_cb (GtkMenuItem *item,
gpointer data)
{
GtkFixed *fixed = data;
GtkWidget *widget;
widget = gtk_label_new ("Label");
gtk_fixed_put (fixed, widget, pos_x, pos_y);
}
static void
new_spinner_cb (GtkMenuItem *item,
gpointer data)
{
GtkFixed *fixed = data;
GtkWidget *widget;
widget = gtk_spinner_new ();
gtk_style_context_add_class (gtk_widget_get_style_context (widget), "demo");
gtk_spinner_start (GTK_SPINNER (widget));
gtk_fixed_put (fixed, widget, pos_x, pos_y);
}
static void
copy_cb (GtkWidget *child)
{
GdkClipboard *clipboard;
GtkDemoWidget *demo;
g_print ("Copy %s\n", G_OBJECT_TYPE_NAME (child));
demo = serialize_widget (child);
clipboard = gdk_display_get_clipboard (gdk_display_get_default ());
gdk_clipboard_set (clipboard, GTK_TYPE_DEMO_WIDGET, demo);
}
static void
delete_cb (GtkWidget *child)
{
gtk_widget_destroy (child);
}
static void
cut_cb (GtkWidget *child)
{
copy_cb (child);
delete_cb (child);
}
static void
value_read (GObject *source,
GAsyncResult *res,
gpointer data)
{
GdkClipboard *clipboard = GDK_CLIPBOARD (source);
GError *error = NULL;
const GValue *value;
GtkDemoWidget *demo;
GtkWidget *widget = NULL;
value = gdk_clipboard_read_value_finish (clipboard, res, &error);
if (value == NULL)
{
g_print ("error: %s\n", error->message);
g_error_free (error);
return;
}
if (!G_VALUE_HOLDS (value, GTK_TYPE_DEMO_WIDGET))
{
g_print ("can't handle clipboard contents\n");
return;
}
demo = g_value_get_boxed (value);
widget = deserialize_widget (demo);
gtk_fixed_put (GTK_FIXED (data), widget, pos_x, pos_y);
}
static void
paste_cb (GtkWidget *fixed)
{
GdkClipboard *clipboard;
clipboard = gdk_display_get_clipboard (gdk_display_get_default ());
if (gdk_content_formats_contain_gtype (gdk_clipboard_get_formats (clipboard), GTK_TYPE_DEMO_WIDGET))
{
g_print ("Paste %s\n", g_type_name (GTK_TYPE_DEMO_WIDGET));
gdk_clipboard_read_value_async (clipboard, GTK_TYPE_DEMO_WIDGET, 0, NULL, value_read, fixed);
}
else
g_print ("Don't know how to handle clipboard contents\n");
}
static void
edit_label_done (GtkWidget *entry, gpointer data)
{
GtkWidget *fixed = gtk_widget_get_parent (entry);
GtkWidget *label;
int x, y;
gtk_container_child_get (GTK_CONTAINER (fixed), entry, "x", &x, "y", &y, NULL);
label = GTK_WIDGET (g_object_get_data (G_OBJECT (entry), "label"));
gtk_label_set_text (GTK_LABEL (label), gtk_entry_get_text (GTK_ENTRY (entry)));
gtk_widget_destroy (entry);
}
static void
edit_cb (GtkWidget *child)
{
GtkWidget *fixed = gtk_widget_get_parent (child);
int x, y;
gtk_container_child_get (GTK_CONTAINER (fixed), child, "x", &x, "y", &y, NULL);
if (GTK_IS_LABEL (child))
{
GtkWidget *entry = gtk_entry_new ();
g_object_set_data (G_OBJECT (entry), "label", child);
gtk_entry_set_text (GTK_ENTRY (entry), gtk_label_get_text (GTK_LABEL (child)));
g_signal_connect (entry, "activate", G_CALLBACK (edit_label_done), NULL);
gtk_fixed_put (GTK_FIXED (fixed), entry, x, y);
gtk_widget_grab_focus (entry);
}
else if (GTK_IS_SPINNER (child))
{
gboolean active;
g_object_get (child, "active", &active, NULL);
g_object_set (child, "active", !active, NULL);
}
}
static void
pressed_cb (GtkGesture *gesture,
int n_press,
double x,
double y,
gpointer data)
{
GtkWidget *widget;
GtkWidget *child;
widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture));
child = gtk_widget_pick (widget, x, y);
if (gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture)) == GDK_BUTTON_SECONDARY)
{
GdkRectangle rect;
GtkWidget *menu;
GtkWidget *item;
GdkClipboard *clipboard;
pos_x = x;
pos_y = y;
menu = gtk_menu_new ();
item = gtk_menu_item_new_with_label ("New Label");
g_signal_connect (item, "activate", G_CALLBACK (new_label_cb), widget);
gtk_container_add (GTK_CONTAINER (menu), item);
item = gtk_menu_item_new_with_label ("New Spinner");
g_signal_connect (item, "activate", G_CALLBACK (new_spinner_cb), widget);
gtk_container_add (GTK_CONTAINER (menu), item);
item = gtk_separator_menu_item_new ();
gtk_container_add (GTK_CONTAINER (menu), item);
item = gtk_menu_item_new_with_label ("Edit");
gtk_widget_set_sensitive (item, child != NULL && child != widget);
g_signal_connect_swapped (item, "activate", G_CALLBACK (edit_cb), child);
gtk_container_add (GTK_CONTAINER (menu), item);
item = gtk_separator_menu_item_new ();
gtk_container_add (GTK_CONTAINER (menu), item);
item = gtk_menu_item_new_with_label ("Cut");
gtk_widget_set_sensitive (item, child != NULL && child != widget);
g_signal_connect_swapped (item, "activate", G_CALLBACK (cut_cb), child);
gtk_container_add (GTK_CONTAINER (menu), item);
item = gtk_menu_item_new_with_label ("Copy");
gtk_widget_set_sensitive (item, child != NULL && child != widget);
g_signal_connect_swapped (item, "activate", G_CALLBACK (copy_cb), child);
gtk_container_add (GTK_CONTAINER (menu), item);
item = gtk_menu_item_new_with_label ("Paste");
clipboard = gdk_display_get_clipboard (gdk_display_get_default ());
gtk_widget_set_sensitive (item,
gdk_content_formats_contain_gtype (gdk_clipboard_get_formats (clipboard), GTK_TYPE_DEMO_WIDGET));
g_signal_connect_swapped (item, "activate", G_CALLBACK (paste_cb), widget);
gtk_container_add (GTK_CONTAINER (menu), item);
item = gtk_menu_item_new_with_label ("Delete");
gtk_widget_set_sensitive (item, child != NULL && child != widget);
g_signal_connect_swapped (item, "activate", G_CALLBACK (delete_cb), child);
gtk_container_add (GTK_CONTAINER (menu), item);
rect.x = x;
rect.y = y;
rect.width = 0;
rect.height = 0;
gtk_menu_popup_at_rect (GTK_MENU (menu),
gtk_widget_get_window (widget),
&rect,
GDK_GRAVITY_NORTH_WEST,
GDK_GRAVITY_NORTH_WEST,
NULL);
return;
}
}
static void
released_cb (GtkGesture *gesture,
int n_press,
double x,
double y,
gpointer data)
{
GtkWidget *widget;
GtkWidget *child;
widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture));
child = gtk_widget_pick (widget, x, y);
if (gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture)) == GDK_BUTTON_PRIMARY)
{
if (child != NULL && child != widget)
edit_cb (child);
}
}
static GtkWidget *window = NULL;
GtkWidget *
do_dnd (GtkWidget *do_widget)
{
if (!window)
{
GtkWidget *vbox, *fixed;
GtkGesture *multipress;
GtkCssProvider *provider;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Drag-and-drop");
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (window), vbox);
fixed = gtk_fixed_new ();
gtk_box_pack_start (GTK_BOX (vbox), fixed);
gtk_widget_set_hexpand (fixed, TRUE);
gtk_widget_set_vexpand (fixed, TRUE);
multipress = gtk_gesture_multi_press_new (fixed);
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (multipress), 0);
g_signal_connect (multipress, "pressed", G_CALLBACK (pressed_cb), NULL);
g_signal_connect (multipress, "released", G_CALLBACK (released_cb), NULL);
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_resource (provider, "/dnd/dnd.css");
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
GTK_STYLE_PROVIDER (provider),
800);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
return window;
}

View File

@@ -1,3 +0,0 @@
spinner.demo {
opacity: 1;
}

View File

@@ -20,17 +20,22 @@ static GtkWidget *window = NULL;
static cairo_surface_t *surface = NULL;
/* Create a new surface of the appropriate size to store our scribbles */
static void
create_surface (GtkWidget *widget)
static gboolean
scribble_configure_event (GtkWidget *widget,
GdkEventConfigure *event,
gpointer data)
{
GtkAllocation allocation;
cairo_t *cr;
if (surface)
cairo_surface_destroy (surface);
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
gtk_widget_get_width (widget),
gtk_widget_get_height (widget));
gtk_widget_get_allocation (widget, &allocation);
surface = gdk_window_create_similar_surface (gtk_widget_get_window (widget),
CAIRO_CONTENT_COLOR,
allocation.width,
allocation.height);
/* Initialize the surface to white */
cr = cairo_create (surface);
@@ -39,12 +44,9 @@ create_surface (GtkWidget *widget)
cairo_paint (cr);
cairo_destroy (cr);
}
static void
scribble_size_allocate (GtkWidget *widget)
{
create_surface (widget);
/* We've handled the configure event, no need for further processing. */
return TRUE;
}
/* Redraw the screen from the surface */
@@ -68,11 +70,6 @@ draw_brush (GtkWidget *widget,
GdkRectangle update_rect;
cairo_t *cr;
if (surface == NULL ||
cairo_image_surface_get_width (surface) != gtk_widget_get_width (widget) ||
cairo_image_surface_get_height (surface) != gtk_widget_get_height (widget))
create_surface (widget);
update_rect.x = x - 3;
update_rect.y = y - 3;
update_rect.width = 6;
@@ -86,7 +83,10 @@ draw_brush (GtkWidget *widget,
cairo_destroy (cr);
gtk_widget_queue_draw_area (widget, update_rect.x, update_rect.y, update_rect.width, update_rect.height);
/* Now invalidate the affected region of the drawing area. */
gdk_window_invalidate_rect (gtk_widget_get_window (widget),
&update_rect,
FALSE);
}
static gboolean
@@ -94,14 +94,11 @@ scribble_button_press_event (GtkWidget *widget,
GdkEventButton *event,
gpointer data)
{
double x, y;
guint button;
if (surface == NULL)
return FALSE; /* paranoia check, in case we haven't gotten a configure event */
gdk_event_get_button ((GdkEvent *)event, &button);
gdk_event_get_coords ((GdkEvent *)event, &x, &y);
if (button == GDK_BUTTON_PRIMARY)
draw_brush (widget, x, y);
if (event->button == GDK_BUTTON_PRIMARY)
draw_brush (widget, event->x, event->y);
/* We've handled the event, stop processing */
return TRUE;
@@ -112,11 +109,24 @@ scribble_motion_notify_event (GtkWidget *widget,
GdkEventMotion *event,
gpointer data)
{
double x, y;
int x, y;
GdkModifierType state;
gdk_event_get_state ((GdkEvent *)event, &state);
gdk_event_get_coords ((GdkEvent *)event, &x, &y);
if (surface == NULL)
return FALSE; /* paranoia check, in case we haven't gotten a configure event */
/* This call is very important; it requests the next motion event.
* If you don't call gdk_window_get_pointer() you'll only get
* a single motion event. The reason is that we specified
* GDK_POINTER_MOTION_HINT_MASK to gtk_widget_set_events().
* If we hadn't specified that, we could just use event->x, event->y
* as the pointer location. But we'd also get deluged in events.
* By requesting the next event as we handle the current one,
* we avoid getting a huge number of events faster than we
* can cope.
*/
gdk_window_get_device_position (event->window, event->device, &x, &y, &state);
if (state & GDK_BUTTON1_MASK)
draw_brush (widget, x, y);
@@ -193,8 +203,8 @@ do_drawingarea (GtkWidget *do_widget)
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Drawing Area");
g_signal_connect (window, "destroy",
@@ -215,7 +225,6 @@ do_drawingarea (GtkWidget *do_widget)
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_widget_set_vexpand (frame, TRUE);
gtk_box_pack_start (GTK_BOX (vbox), frame);
da = gtk_drawing_area_new ();
@@ -234,7 +243,6 @@ do_drawingarea (GtkWidget *do_widget)
gtk_box_pack_start (GTK_BOX (vbox), label);
frame = gtk_frame_new (NULL);
gtk_widget_set_vexpand (frame, TRUE);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_box_pack_start (GTK_BOX (vbox), frame);
@@ -244,10 +252,13 @@ do_drawingarea (GtkWidget *do_widget)
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (da), scribble_draw, NULL, NULL);
gtk_container_add (GTK_CONTAINER (frame), da);
g_signal_connect (da, "size-allocate",
G_CALLBACK (scribble_size_allocate), NULL);
/* Signals used to handle backing surface */
g_signal_connect (da,"configure-event",
G_CALLBACK (scribble_configure_event), NULL);
/* Event signals */
g_signal_connect (da, "motion-notify-event",
G_CALLBACK (scribble_motion_notify_event), NULL);
g_signal_connect (da, "button-press-event",

View File

@@ -346,8 +346,8 @@ do_editable_cells (GtkWidget *do_widget)
GtkTreeModel *numbers_model;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Editable Cells");
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
@@ -373,7 +373,6 @@ do_editable_cells (GtkWidget *do_widget)
/* create tree view */
treeview = gtk_tree_view_new_with_model (items_model);
gtk_widget_set_vexpand (treeview, TRUE);
gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview)),
GTK_SELECTION_SINGLE);

View File

@@ -20,8 +20,8 @@ do_entry_buffer (GtkWidget *do_widget)
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Entry Buffer");
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
g_signal_connect (window, "destroy",

View File

@@ -46,8 +46,8 @@ do_entry_completion (GtkWidget *do_widget)
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Entry Completion");
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);

View File

@@ -120,7 +120,6 @@ update_axes_from_event (GdkEvent *event,
GdkDevice *device, *source_device;
GdkEventSequence *sequence;
GdkDeviceTool *tool;
GdkEventType type;
gdouble x, y;
AxesInfo *info;
@@ -128,15 +127,14 @@ update_axes_from_event (GdkEvent *event,
source_device = gdk_event_get_source_device (event);
sequence = gdk_event_get_event_sequence (event);
tool = gdk_event_get_device_tool (event);
type = gdk_event_get_event_type (event);
if (type == GDK_TOUCH_END ||
type == GDK_TOUCH_CANCEL)
if (event->type == GDK_TOUCH_END ||
event->type == GDK_TOUCH_CANCEL)
{
g_hash_table_remove (data->touch_info, sequence);
return;
}
else if (type == GDK_LEAVE_NOTIFY)
else if (event->type == GDK_LEAVE_NOTIFY)
{
g_hash_table_remove (data->pointer_info, device);
return;
@@ -174,24 +172,24 @@ update_axes_from_event (GdkEvent *event,
g_clear_pointer (&info->axes, g_free);
if (type == GDK_TOUCH_BEGIN ||
type == GDK_TOUCH_UPDATE)
if (event->type == GDK_TOUCH_BEGIN ||
event->type == GDK_TOUCH_UPDATE)
{
gboolean emulating_pointer;
gdk_event_get_touch_emulating_pointer (event, &emulating_pointer);
if (sequence && emulating_pointer)
if (sequence && event->touch.emulating_pointer)
g_hash_table_remove (data->pointer_info, device);
}
if (type == GDK_MOTION_NOTIFY ||
type == GDK_BUTTON_PRESS ||
type == GDK_BUTTON_RELEASE)
if (event->type == GDK_MOTION_NOTIFY)
{
gdouble *axes;
guint n_axes;
gdk_event_get_axes (event, &axes, &n_axes);
info->axes = g_memdup (axes, sizeof (double) * n_axes);
info->axes =
g_memdup (event->motion.axes,
sizeof (gdouble) * gdk_device_get_n_axes (source_device));
}
else if (event->type == GDK_BUTTON_PRESS ||
event->type == GDK_BUTTON_RELEASE)
{
info->axes =
g_memdup (event->button.axes,
sizeof (gdouble) * gdk_device_get_n_axes (source_device));
}
if (gdk_event_get_coords (event, &x, &y))
@@ -234,8 +232,7 @@ render_arrow (cairo_t *cr,
static void
draw_axes_info (cairo_t *cr,
AxesInfo *info,
int width,
int height)
GtkAllocation *allocation)
{
gdouble pressure, tilt_x, tilt_y, distance, wheel, rotation, slider;
GdkAxisFlags axes = gdk_device_get_axes (info->last_source);
@@ -246,9 +243,9 @@ draw_axes_info (cairo_t *cr,
gdk_cairo_set_source_rgba (cr, &info->color);
cairo_move_to (cr, 0, info->y);
cairo_line_to (cr, width, info->y);
cairo_line_to (cr, allocation->width, info->y);
cairo_move_to (cr, info->x, 0);
cairo_line_to (cr, info->x, height);
cairo_line_to (cr, info->x, allocation->height);
cairo_stroke (cr);
cairo_translate (cr, info->x, info->y);
@@ -468,27 +465,27 @@ draw_device_info (GtkWidget *widget,
g_string_free (string, TRUE);
}
static void
draw_cb (GtkDrawingArea *da,
cairo_t *cr,
int width,
int height,
gpointer user_data)
static gboolean
draw_cb (GtkWidget *widget,
cairo_t *cr,
gpointer user_data)
{
GtkWidget *widget = GTK_WIDGET (da);
EventData *data = user_data;
GtkAllocation allocation;
AxesInfo *info;
GHashTableIter iter;
gpointer key, value;
gint y = 0;
gtk_widget_get_allocation (widget, &allocation);
/* Draw Abs info */
g_hash_table_iter_init (&iter, data->pointer_info);
while (g_hash_table_iter_next (&iter, NULL, &value))
{
info = value;
draw_axes_info (cr, info, width, height);
draw_axes_info (cr, info, &allocation);
}
g_hash_table_iter_init (&iter, data->touch_info);
@@ -496,7 +493,7 @@ draw_cb (GtkDrawingArea *da,
while (g_hash_table_iter_next (&iter, NULL, &value))
{
info = value;
draw_axes_info (cr, info, width, height);
draw_axes_info (cr, info, &allocation);
}
/* Draw name, color legend and misc data */
@@ -515,6 +512,8 @@ draw_cb (GtkDrawingArea *da,
info = value;
draw_device_info (widget, cr, key, &y, info);
}
return FALSE;
}
static void
@@ -619,13 +618,12 @@ do_event_axes (GtkWidget *toplevel)
static GtkWidget *window = NULL;
EventData *event_data;
GtkWidget *label;
GtkWidget *overlay;
GtkWidget *da;
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Touch and Drawing Tablets");
gtk_window_set_title (GTK_WINDOW (window), "Event Axes");
gtk_window_set_default_size (GTK_WINDOW (window), 400, 400);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
@@ -636,27 +634,16 @@ do_event_axes (GtkWidget *toplevel)
g_object_set_data_full (G_OBJECT (window), "gtk-demo-event-data",
event_data, (GDestroyNotify) event_data_free);
da = gtk_drawing_area_new ();
gtk_drawing_area_set_content_width (GTK_DRAWING_AREA (da), 400);
gtk_drawing_area_set_content_height (GTK_DRAWING_AREA (da), 400);
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (da), draw_cb, event_data, NULL);
gtk_widget_set_can_focus (da, TRUE);
gtk_widget_grab_focus (da);
g_signal_connect (da, "event",
g_signal_connect (window, "event",
G_CALLBACK (event_cb), event_data);
g_signal_connect (window, "draw",
G_CALLBACK (draw_cb), event_data);
label = gtk_label_new ("");
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_START);
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
gtk_container_add (GTK_CONTAINER (window), label);
overlay = gtk_overlay_new ();
gtk_container_add (GTK_CONTAINER (window), overlay);
gtk_container_add (GTK_CONTAINER (overlay), da);
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), label);
init_pad_controller (da, label);
init_pad_controller (window, label);
}
if (!gtk_widget_get_visible (window))

View File

@@ -124,8 +124,8 @@ do_filtermodel (GtkWidget *do_widget)
builder = gtk_builder_new_from_resource ("/filtermodel/filtermodel.ui");
gtk_builder_connect_signals (builder, NULL);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);

View File

@@ -160,8 +160,8 @@ do_fishbowl (GtkWidget *do_widget)
gtk_fishbowl_set_use_icons (GTK_FISHBOWL (bowl), TRUE);
info_label = GTK_WIDGET (gtk_builder_get_object (builder, "info_label"));
allow_changes = GTK_WIDGET (gtk_builder_get_object (builder, "changes_allow"));
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);

View File

@@ -6,7 +6,7 @@
<child type="titlebar">
<object class="GtkHeaderBar" id="">
<property name="visible">True</property>
<property name="show-title-buttons">True</property>
<property name="show-close-button">True</property>
<child>
<object class="GtkLabel" id="info_label">
<property name="visible">True</property>

View File

@@ -720,8 +720,8 @@ do_flowbox (GtkWidget *do_widget)
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Flow Box");
gtk_window_set_default_size (GTK_WINDOW (window), 400, 600);

View File

@@ -84,6 +84,7 @@
<object class="GtkImage" id="kern_pres">
<property name="visible">1</property>
<property name="icon-name">object-select-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
<child>
@@ -136,6 +137,7 @@
<object class="GtkImage" id="liga_pres">
<property name="visible">1</property>
<property name="icon-name">object-select-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
<child>
@@ -167,6 +169,7 @@
<object class="GtkImage" id="dlig_pres">
<property name="visible">1</property>
<property name="icon-name">object-select-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
<child>
@@ -198,6 +201,7 @@
<object class="GtkImage" id="hlig_pres">
<property name="visible">1</property>
<property name="icon-name">object-select-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
<child>
@@ -229,6 +233,7 @@
<object class="GtkImage" id="clig_pres">
<property name="visible">1</property>
<property name="icon-name">object-select-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
<child>
@@ -281,6 +286,7 @@
<object class="GtkImage" id="smcp_pres">
<property name="visible">1</property>
<property name="icon-name">object-select-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
<child>
@@ -312,6 +318,7 @@
<object class="GtkImage" id="c2sc_pres">
<property name="visible">1</property>
<property name="icon-name">object-select-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
<child>
@@ -343,6 +350,7 @@
<object class="GtkImage" id="pcap_pres">
<property name="visible">1</property>
<property name="icon-name">object-select-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
<child>
@@ -374,6 +382,7 @@
<object class="GtkImage" id="c2pc_pres">
<property name="visible">1</property>
<property name="icon-name">object-select-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
<child>
@@ -405,6 +414,7 @@
<object class="GtkImage" id="unic_pres">
<property name="visible">1</property>
<property name="icon-name">object-select-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
<child>
@@ -436,6 +446,7 @@
<object class="GtkImage" id="cpsp_pres">
<property name="visible">1</property>
<property name="icon-name">object-select-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
<child>
@@ -467,6 +478,7 @@
<object class="GtkImage" id="case_pres">
<property name="visible">1</property>
<property name="icon-name">object-select-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
<child>
@@ -520,6 +532,7 @@
<property name="visible">1</property>
<property name="opacity">0</property>
<property name="icon-name">object-select-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
<child>
@@ -542,6 +555,7 @@
<object class="GtkImage" id="lnum_pres">
<property name="visible">1</property>
<property name="icon-name">object-select-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
<child>
@@ -565,6 +579,7 @@
<object class="GtkImage" id="onum_pres">
<property name="visible">1</property>
<property name="icon-name">object-select-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
<child>
@@ -610,6 +625,7 @@
<property name="visible">1</property>
<property name="opacity">0</property>
<property name="icon-name">object-select-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
<child>
@@ -632,6 +648,7 @@
<object class="GtkImage" id="pnum_pres">
<property name="visible">1</property>
<property name="icon-name">object-select-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
<child>
@@ -655,6 +672,7 @@
<object class="GtkImage" id="tnum_pres">
<property name="visible">1</property>
<property name="icon-name">object-select-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
<child>
@@ -700,6 +718,7 @@
<property name="visible">1</property>
<property name="opacity">0</property>
<property name="icon-name">object-select-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
<child>
@@ -722,6 +741,7 @@
<object class="GtkImage" id="frac_pres">
<property name="visible">1</property>
<property name="icon-name">object-select-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
<child>
@@ -745,6 +765,7 @@
<object class="GtkImage" id="afrc_pres">
<property name="visible">1</property>
<property name="icon-name">object-select-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
<child>
@@ -789,6 +810,7 @@
<object class="GtkImage" id="zero_pres">
<property name="visible">1</property>
<property name="icon-name">object-select-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
<child>
@@ -820,6 +842,7 @@
<object class="GtkImage" id="nalt_pres">
<property name="visible">1</property>
<property name="icon-name">object-select-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
<child>
@@ -851,6 +874,7 @@
<object class="GtkImage" id="sinf_pres">
<property name="visible">1</property>
<property name="icon-name">object-select-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
<child>
@@ -903,6 +927,7 @@
<object class="GtkImage" id="swsh_pres">
<property name="visible">1</property>
<property name="icon-name">object-select-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
<child>
@@ -934,6 +959,7 @@
<object class="GtkImage" id="cswh_pres">
<property name="visible">1</property>
<property name="icon-name">object-select-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
<child>
@@ -965,6 +991,7 @@
<object class="GtkImage" id="locl_pres">
<property name="visible">1</property>
<property name="icon-name">object-select-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
<child>
@@ -996,6 +1023,7 @@
<object class="GtkImage" id="calt_pres">
<property name="visible">1</property>
<property name="icon-name">object-select-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
<child>
@@ -1027,6 +1055,7 @@
<object class="GtkImage" id="hist_pres">
<property name="visible">1</property>
<property name="icon-name">object-select-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
<child>
@@ -1058,6 +1087,7 @@
<object class="GtkImage" id="salt_pres">
<property name="visible">1</property>
<property name="icon-name">object-select-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
<child>
@@ -1089,6 +1119,7 @@
<object class="GtkImage" id="titl_pres">
<property name="visible">1</property>
<property name="icon-name">object-select-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
<child>
@@ -1120,6 +1151,7 @@
<object class="GtkImage" id="rand_pres">
<property name="visible">1</property>
<property name="icon-name">object-select-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
<child>
@@ -1151,6 +1183,7 @@
<object class="GtkImage" id="subs_pres">
<property name="visible">1</property>
<property name="icon-name">object-select-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
<child>
@@ -1182,6 +1215,7 @@
<object class="GtkImage" id="sups_pres">
<property name="visible">1</property>
<property name="icon-name">object-select-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
<child>
@@ -1234,6 +1268,7 @@
<object class="GtkImage" id="init_pres">
<property name="visible">1</property>
<property name="icon-name">object-select-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
<child>
@@ -1265,6 +1300,7 @@
<object class="GtkImage" id="medi_pres">
<property name="visible">1</property>
<property name="icon-name">object-select-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
<child>
@@ -1296,6 +1332,7 @@
<object class="GtkImage" id="fina_pres">
<property name="visible">1</property>
<property name="icon-name">object-select-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
<child>
@@ -1327,6 +1364,7 @@
<object class="GtkImage" id="isol_pres">
<property name="visible">1</property>
<property name="icon-name">object-select-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
<child>
@@ -1379,6 +1417,7 @@
<object class="GtkImage" id="ss01_pres">
<property name="visible">1</property>
<property name="icon-name">object-select-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
<child>
@@ -1410,6 +1449,7 @@
<object class="GtkImage" id="ss02_pres">
<property name="visible">1</property>
<property name="icon-name">object-select-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
<child>
@@ -1441,6 +1481,7 @@
<object class="GtkImage" id="ss03_pres">
<property name="visible">1</property>
<property name="icon-name">object-select-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
<child>
@@ -1472,6 +1513,7 @@
<object class="GtkImage" id="ss04_pres">
<property name="visible">1</property>
<property name="icon-name">object-select-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
<child>
@@ -1503,6 +1545,7 @@
<object class="GtkImage" id="ss05_pres">
<property name="visible">1</property>
<property name="icon-name">object-select-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
<child>

View File

@@ -456,11 +456,7 @@ switch_to_label (void)
static gboolean
entry_key_press (GtkEntry *entry, GdkEventKey *event)
{
guint keyval;
gdk_event_get_keyval ((GdkEvent *)event, &keyval);
if (keyval == GDK_KEY_Escape)
if (event->keyval == GDK_KEY_Escape)
{
gtk_entry_set_text (GTK_ENTRY (entry), text);
switch_to_label ();

View File

@@ -830,7 +830,6 @@ draw_spinbutton (GtkWidget *widget,
GtkIconTheme *icon_theme;
GtkIconInfo *icon_info;
GdkPixbuf *pixbuf;
GdkTexture *texture;
gint icon_width, icon_height, icon_size;
gint button_width;
gint contents_x, contents_y, contents_width, contents_height;
@@ -851,33 +850,30 @@ draw_spinbutton (GtkWidget *widget,
draw_style_common (spin_context, cr, x, y, width, *height, NULL, NULL, NULL, NULL);
draw_style_common (entry_context, cr, x, y, width, *height, NULL, NULL, NULL, NULL);
icon_theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (widget));
icon_theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (widget));
gtk_style_context_get (up_context,
"min-width", &icon_width, "min-height", &icon_height, NULL);
icon_size = MIN (icon_width, icon_height);
icon_info = gtk_icon_theme_lookup_icon (icon_theme, "list-add-symbolic", icon_size, 0);
pixbuf = gtk_icon_info_load_symbolic_for_context (icon_info, up_context, NULL, NULL);
texture = gdk_texture_new_for_pixbuf (pixbuf);
g_object_unref (icon_info);
draw_style_common (up_context, cr, x + width - button_width, y, button_width, *height,
&contents_x, &contents_y, &contents_width, &contents_height);
gtk_render_icon (up_context, cr, texture, contents_x, contents_y + (contents_height - icon_size) / 2);
gtk_render_icon (up_context, cr, pixbuf, contents_x, contents_y + (contents_height - icon_size) / 2);
g_object_unref (pixbuf);
g_object_unref (texture);
gtk_style_context_get (down_context,
"min-width", &icon_width, "min-height", &icon_height, NULL);
icon_size = MIN (icon_width, icon_height);
icon_info = gtk_icon_theme_lookup_icon (icon_theme, "list-remove-symbolic", icon_size, 0);
pixbuf = gtk_icon_info_load_symbolic_for_context (icon_info, down_context, NULL, NULL);
texture = gdk_texture_new_for_pixbuf (pixbuf);
g_object_unref (icon_info);
draw_style_common (down_context, cr, x + width - 2 * button_width, y, button_width, *height,
&contents_x, &contents_y, &contents_width, &contents_height);
gtk_render_icon (down_context, cr, texture, contents_x, contents_y + (contents_height - icon_size) / 2);
gtk_render_icon (down_context, cr, pixbuf, contents_x, contents_y + (contents_height - icon_size) / 2);
g_object_unref (pixbuf);
g_object_unref (texture);
g_object_unref (down_context);
g_object_unref (up_context);
@@ -964,8 +960,8 @@ do_foreigndrawing (GtkWidget *do_widget)
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Foreign drawing");
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);

164
demos/gtk-demo/geninclude.pl.in Executable file
View File

@@ -0,0 +1,164 @@
#!@PERL@ -w
print <<EOT;
typedef GtkWidget *(*GDoDemoFunc) (GtkWidget *do_widget);
typedef struct _Demo Demo;
struct _Demo
{
gchar *name;
gchar *title;
gchar *filename;
GDoDemoFunc func;
Demo *children;
};
EOT
for $file (@ARGV) {
my %demo;
($basename = $file) =~ s/\.c$//;
open INFO_FILE, $file or die "Cannot open '$file'\n";
$title = <INFO_FILE>;
$title =~ s@^\s*/\*\s*@@;
$title =~ s@\s*$@@;
close INFO_FILE;
print "GtkWidget *do_$basename (GtkWidget *do_widget);\n";
push @demos, {"name" => $basename, "title" => $title, "file" => $file,
"func" => "do_$basename"};
}
# generate a list of 'parent names'
foreach $href (@demos) {
if ($href->{"title"} =~ m|^([-\w\s]+)/[-\w\s]+$|) {
my $parent_name = $1;
my $do_next = 0;
# parent detected
if (@parents) {
foreach $foo (@parents) {
if ($foo eq $parent_name) {
$do_next = 1;
}
}
if ($do_next) {
next;
}
}
push @parents, $parent_name;
$tmp = (@child_arrays)?($#child_arrays + 1):0;
push @child_arrays, "child$tmp";
push @demos, {"name" => "NULL", "title" => $parent_name, "file" => "NULL",
"func" => "NULL"};
}
}
if (@parents) {
$i = 0;
for ($i = 0; $i <= $#parents; $i++) {
$first = 1;
print "\nDemo ", $child_arrays[$i], "[] = {\n";
$j = 0;
for ($j = 0; $j <= $#demos; $j++) {
$href = $demos[$j];
if (!$demos[$j]) {
next;
}
if ($demos[$j]{"title"} =~ m|^$parents[$i]/([-\w\s]+)$|) {
if ($first) {
$first = 0;
} else {
print ",\n";
}
print qq ( { "$demos[$j]{name}", "$1", "$demos[$j]{file}", $demos[$j]{func}, NULL });
# hack ... ugly
$demos[$j]{"title"} = "foo";
}
}
print ",\n";
print qq ( { NULL } );
print "\n};\n";
}
}
# sort @demos
@demos_old = @demos;
@demos = sort {
$a->{"title"} cmp $b->{"title"};
} @demos_old;
# sort the child arrays
if (@child_arrays) {
for ($i = 0; $i <= $#child_arrays; $i++) {
@foo_old = @{$child_arrays[$i]};
@{$child_arrays[$i]} = sort {
$a->{"title"} cmp $b->{"title"};
} @foo_old;
}
}
# toplevel
print "\nDemo gtk_demos[] = {\n";
$first = 1;
foreach $href (@demos) {
$handled = 0;
# ugly evil hack
if ($href->{title} eq "foo") {
next;
}
if ($first) {
$first = 0;
} else {
print ", \n";
}
if (@parents) {
for ($i = 0; $i <= $#parents; $i++) {
if ($parents[$i] eq $href->{title}) {
if ($href->{file} eq 'NULL') {
print qq ( { NULL, "$href->{title}", NULL, $href->{func}, $child_arrays[$i] });
} else {
print qq ( { "$href->{name}", "$href->{title}", "$href->{file}", $href->{func}, $child_arrays[$i] });
}
$handled = 1;
last;
}
}
}
if ($handled) {
next;
}
print qq ( { "$href->{name}", "$href->{title}", "$href->{file}", $href->{func}, NULL });
}
print ",\n";
print qq ( { NULL } );
print "\n};\n";
exit 0;

View File

@@ -390,7 +390,7 @@ create_glarea_window (GtkWidget *do_widget)
int i;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget));
gtk_window_set_screen (GTK_WINDOW (window), gtk_widget_get_screen (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "OpenGL Area");
gtk_window_set_default_size (GTK_WINDOW (window), 400, 600);
g_signal_connect (window, "destroy", G_CALLBACK (close_window), NULL);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -106,18 +106,7 @@ gtk_fishbowl_measure (GtkWidget *widget,
if (!gtk_widget_get_visible (child->widget))
continue;
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
gtk_widget_measure (child->widget, orientation, -1, &child_min, &child_nat, NULL, NULL);
}
else
{
int min_width;
gtk_widget_measure (child->widget, GTK_ORIENTATION_HORIZONTAL, -1, &min_width, NULL, NULL, NULL);
gtk_widget_measure (child->widget, orientation, min_width, &child_min, &child_nat, NULL, NULL);
}
gtk_widget_measure (child->widget, orientation, -1, &child_min, &child_nat, NULL, NULL);
*minimum = MAX (*minimum, child_min);
*natural = MAX (*natural, child_nat);
@@ -422,10 +411,8 @@ gtk_fishbowl_set_count (GtkFishbowl *fishbowl,
GtkWidget *new_widget;
if (priv->use_icons)
{
new_widget = gtk_image_new_from_icon_name (get_random_icon_name (gtk_icon_theme_get_default ()));
gtk_image_set_icon_size (GTK_IMAGE (new_widget), GTK_ICON_SIZE_LARGE);
}
new_widget = gtk_image_new_from_icon_name (get_random_icon_name (gtk_icon_theme_get_default ()),
GTK_ICON_SIZE_DIALOG);
else
new_widget = g_object_new (get_random_widget_type (), NULL);

View File

@@ -24,19 +24,19 @@ do_headerbar (GtkWidget *do_widget)
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget));
gtk_window_set_screen (GTK_WINDOW (window), gtk_widget_get_screen (do_widget));
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
header = gtk_header_bar_new ();
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), TRUE);
gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (header), TRUE);
gtk_header_bar_set_title (GTK_HEADER_BAR (header), "Welcome to Facebook - Log in, sign up or learn more");
gtk_header_bar_set_has_subtitle (GTK_HEADER_BAR (header), FALSE);
button = gtk_button_new ();
icon = g_themed_icon_new ("mail-send-receive-symbolic");
image = gtk_image_new_from_gicon (icon);
image = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_BUTTON);
g_object_unref (icon);
gtk_container_add (GTK_CONTAINER (button), image);
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button);
@@ -44,10 +44,10 @@ do_headerbar (GtkWidget *do_widget)
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_style_context_add_class (gtk_widget_get_style_context (box), "linked");
button = gtk_button_new ();
gtk_container_add (GTK_CONTAINER (button), gtk_image_new_from_icon_name ("pan-start-symbolic"));
gtk_container_add (GTK_CONTAINER (button), gtk_image_new_from_icon_name ("pan-start-symbolic", GTK_ICON_SIZE_BUTTON));
gtk_container_add (GTK_CONTAINER (box), button);
button = gtk_button_new ();
gtk_container_add (GTK_CONTAINER (button), gtk_image_new_from_icon_name ("pan-end-symbolic"));
gtk_container_add (GTK_CONTAINER (button), gtk_image_new_from_icon_name ("pan-end-symbolic", GTK_ICON_SIZE_BUTTON));
gtk_container_add (GTK_CONTAINER (box), button);
gtk_header_bar_pack_start (GTK_HEADER_BAR (header), box);

View File

@@ -110,11 +110,8 @@ key_press_event (GtkWidget *text_view,
{
GtkTextIter iter;
GtkTextBuffer *buffer;
guint keyval;
gdk_event_get_keyval ((GdkEvent *)event, &keyval);
switch (keyval)
switch (event->keyval)
{
case GDK_KEY_Return:
case GDK_KEY_KP_Enter:
@@ -140,27 +137,31 @@ event_after (GtkWidget *text_view,
GtkTextIter start, end, iter;
GtkTextBuffer *buffer;
gdouble ex, ey;
int x, y;
GdkEventType type;
gint x, y;
type = gdk_event_get_event_type (ev);
if (type == GDK_BUTTON_RELEASE)
if (ev->type == GDK_BUTTON_RELEASE)
{
guint button;
GdkEventButton *event;
gdk_event_get_button (ev, &button);
if (button != GDK_BUTTON_PRIMARY)
event = (GdkEventButton *)ev;
if (event->button != GDK_BUTTON_PRIMARY)
return FALSE;
ex = event->x;
ey = event->y;
}
else if (type == GDK_TOUCH_END)
else if (ev->type == GDK_TOUCH_END)
{
GdkEventTouch *event;
event = (GdkEventTouch *)ev;
ex = event->x;
ey = event->y;
}
else
return FALSE;
gdk_event_get_coords (ev, &ex, &ey);
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view));
/* we shouldn't follow a link if the user has selected something */
@@ -179,6 +180,8 @@ event_after (GtkWidget *text_view,
}
static gboolean hovering_over_link = FALSE;
static GdkCursor *hand_cursor = NULL;
static GdkCursor *regular_cursor = NULL;
/* Looks at all tags covering the position (x, y) in the text view,
* and if one of them is a link, change the cursor to the "hands" cursor
@@ -214,9 +217,9 @@ set_cursor_if_appropriate (GtkTextView *text_view,
hovering_over_link = hovering;
if (hovering_over_link)
gtk_widget_set_cursor_from_name (GTK_WIDGET (text_view), "pointer");
gdk_window_set_cursor (gtk_text_view_get_window (text_view, GTK_TEXT_WINDOW_TEXT), hand_cursor);
else
gtk_widget_set_cursor_from_name (GTK_WIDGET (text_view), "text");
gdk_window_set_cursor (gtk_text_view_get_window (text_view, GTK_TEXT_WINDOW_TEXT), regular_cursor);
}
if (tags)
@@ -229,13 +232,11 @@ static gboolean
motion_notify_event (GtkWidget *text_view,
GdkEventMotion *event)
{
gdouble ex, ey;
gint x, y;
gdk_event_get_coords ((GdkEvent *)event, &ex, &ey);
gtk_text_view_window_to_buffer_coords (GTK_TEXT_VIEW (text_view),
GTK_TEXT_WINDOW_WIDGET,
ex, ey, &x, &y);
event->x, event->y, &x, &y);
set_cursor_if_appropriate (GTK_TEXT_VIEW (text_view), x, y);
@@ -252,11 +253,16 @@ do_hypertext (GtkWidget *do_widget)
GtkWidget *view;
GtkWidget *sw;
GtkTextBuffer *buffer;
GdkDisplay *display;
display = gtk_widget_get_display (do_widget);
hand_cursor = gdk_cursor_new_from_name (display, "pointer");
regular_cursor = gdk_cursor_new_from_name (display, "text");
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Hypertext");
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
gtk_window_set_default_size (GTK_WINDOW (window), 450, 450);
g_signal_connect (window, "destroy",

View File

@@ -253,8 +253,8 @@ do_iconview (GtkWidget *do_widget)
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size (GTK_WINDOW (window), 650, 400);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Icon View Basics");
g_signal_connect (window, "destroy",

View File

@@ -108,8 +108,8 @@ do_iconview_edit (GtkWidget *do_widget)
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Editing and Drag-and-Drop");
g_signal_connect (window, "destroy",

View File

@@ -54,8 +54,17 @@ progressive_updated_callback (GdkPixbufLoader *loader,
image = GTK_WIDGET (data);
pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
/* We know the pixbuf inside the GtkImage has changed, but the image
* itself doesn't know this; so give it a hint by setting the pixbuf
* again. Queuing a redraw used to be sufficient, but nowadays GtkImage
* uses GtkIconHelper which caches the pixbuf state and will just redraw
* from the cache.
*/
pixbuf = gtk_image_get_pixbuf (GTK_IMAGE (image));
g_object_ref (pixbuf);
gtk_image_set_from_pixbuf (GTK_IMAGE (image), pixbuf);
g_object_unref (pixbuf);
}
static gint
@@ -329,8 +338,8 @@ do_images (GtkWidget *do_widget)
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Images");
g_signal_connect (window, "destroy",
@@ -353,8 +362,7 @@ do_images (GtkWidget *do_widget)
gtk_widget_set_valign (frame, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (vbox), frame);
image = gtk_image_new_from_icon_name ("gtk3-demo");
gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_LARGE);
image = gtk_image_new_from_icon_name ("gtk3-demo", GTK_ICON_SIZE_DIALOG);
gtk_container_add (GTK_CONTAINER (frame), image);
@@ -390,8 +398,7 @@ do_images (GtkWidget *do_widget)
gtk_box_pack_start (GTK_BOX (vbox), frame);
gicon = g_themed_icon_new_with_default_fallbacks ("battery-caution-charging-symbolic");
image = gtk_image_new_from_gicon (gicon);
gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_LARGE);
image = gtk_image_new_from_gicon (gicon, GTK_ICON_SIZE_DIALOG);
gtk_container_add (GTK_CONTAINER (frame), image);

View File

@@ -54,8 +54,8 @@ do_infobar (GtkWidget *do_widget)
actions = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Info Bars");
g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window);

View File

@@ -53,8 +53,8 @@ do_links (GtkWidget *do_widget)
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Links");
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);

View File

@@ -256,8 +256,8 @@ do_list_store (GtkWidget *do_widget)
/* create window, etc */
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "List Store");
g_signal_connect (window, "destroy",
@@ -283,7 +283,6 @@ do_list_store (GtkWidget *do_widget)
/* create tree view */
treeview = gtk_tree_view_new_with_model (model);
gtk_widget_set_vexpand (treeview, TRUE);
gtk_tree_view_set_search_column (GTK_TREE_VIEW (treeview),
COLUMN_DESCRIPTION);

View File

@@ -197,10 +197,7 @@ gtk_message_row_update (GtkMessageRow *row)
gtk_button_set_label (GTK_BUTTON (priv->resent_by_button), priv->message->resent_by);
if (strcmp (priv->message->sender_nick, "@GTKtoolkit") == 0)
{
gtk_image_set_from_icon_name (priv->avatar_image, "gtk3-demo");
gtk_image_set_icon_size (priv->avatar_image, GTK_ICON_SIZE_LARGE);
}
gtk_image_set_from_icon_name (priv->avatar_image, "gtk3-demo", GTK_ICON_SIZE_DND);
else
gtk_image_set_from_pixbuf (priv->avatar_image, avatar_pixbuf_other);
@@ -348,8 +345,8 @@ do_listbox (GtkWidget *do_widget)
avatar_pixbuf_other = gdk_pixbuf_new_from_resource_at_scale ("/listbox/apple-red.png", 32, 32, FALSE, NULL);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "List Box");
gtk_window_set_default_size (GTK_WINDOW (window),
400, 600);

View File

@@ -256,7 +256,7 @@ static gchar *types[] =
"GtkTreeIter ",
"GtkTreeViewColumn ",
"GdkDisplayManager ",
"GdkClipboard ",
"GtkClipboard ",
"GtkIconSize ",
"GtkImage ",
"GdkDragContext ",
@@ -300,6 +300,7 @@ static gchar *types[] =
"GdkEvent ",
"GdkEventKey ",
"GtkTextView ",
"GdkEventVisibility ",
"GdkBitmap ",
"GtkTextChildAnchor ",
"GArray ",
@@ -555,7 +556,8 @@ add_data_tab (const gchar *demoname)
resource_name = g_strconcat (resource_dir, "/", resources[i], NULL);
widget = gtk_image_new_from_resource (resource_name);
if (gtk_image_get_surface (GTK_IMAGE (widget)) == NULL)
if (gtk_image_get_pixbuf (GTK_IMAGE (widget)) == NULL &&
gtk_image_get_animation (GTK_IMAGE (widget)) == NULL)
{
GBytes *bytes;
@@ -590,17 +592,6 @@ add_data_tab (const gchar *demoname)
g_bytes_unref (bytes);
}
if (GTK_IS_IMAGE (widget))
{
GtkWidget *sw;
gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_container_add (GTK_CONTAINER (sw), widget);
widget = sw;
}
label = gtk_label_new (resources[i]);
gtk_widget_show (label);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), widget, label);
@@ -956,7 +947,7 @@ start_cb (GtkMenuItem *item, GtkWidget *scrollbar)
{
GtkAdjustment *adj;
adj = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (scrollbar));
adj = gtk_range_get_adjustment (GTK_RANGE (scrollbar));
gtk_adjustment_set_value (adj, gtk_adjustment_get_lower (adj));
}
@@ -965,7 +956,7 @@ end_cb (GtkMenuItem *item, GtkWidget *scrollbar)
{
GtkAdjustment *adj;
adj = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (scrollbar));
adj = gtk_range_get_adjustment (GTK_RANGE (scrollbar));
gtk_adjustment_set_value (adj, gtk_adjustment_get_upper (adj) - gtk_adjustment_get_page_size (adj));
}

View File

@@ -24,7 +24,7 @@
<child type="titlebar">
<object class="GtkHeaderBar" id="headerbar">
<property name="visible">1</property>
<property name="show-title-buttons">1</property>
<property name="show-close-button">1</property>
<child>
<object class="GtkButton">
<property name="visible">1</property>

View File

@@ -0,0 +1,91 @@
## Makefile for building the gtk test apps with Microsoft C
## Use: nmake -f makefile.msc
## There is no install target, you have to decide where and
## how to install for yourself.
TOP = ..\..\..
!INCLUDE $(TOP)/glib/build/win32/make.msc
!IFNDEF PERL
PERL = perl
!ENDIF
################################################################
# Possibly override versions from build/win32/module.defs
GTK_VER = 2.0
GDK_PIXBUF_VER = 2.0
GDK_LIBS = ../../gdk/gdk-win32-$(GTK_VER).lib
GTK_LIBS = ../../gtk/gtk-win32-$(GTK_VER).lib
GDK_PIXBUF_LIBS = ../../gdk-pixbuf/gdk_pixbuf-$(GDK_PIXBUF_VER).lib
INCLUDES = -FImsvc_recommended_pragmas.h -I . -I ../.. -I ../../gdk -I ../../gdk-pixbuf -I ../../gtk
DEPCFLAGS = $(PANGO_CFLAGS) $(GLIB_CFLAGS) $(LIBICONV_CFLAGS) $(INTL_CFLAGS) $(ATK_CFLAGS) $(CAIRO_CFLAGS)
LDFLAGS = /link /machine:ix86 $(LINKDEBUG)
DEFINES = -DG_LOG_DOMAIN=\"GtkDemo\" -DGTK_VERSION=\"$(GTK_VER)\" \
-DDEMOCODEDIR=\".\"
TOUCH = copy makefile.msc+nul
all : \
demos.h \
gtk-demo.exe
## These should be in the order you want them to appear in the
## demo app, which means alphabetized by demo title, not filename
DEMOS = \
button_box.c \
clipboard.c \
colorsel.c \
dialog.c \
drawingarea.c \
editable_cells.c \
entry_completion.c \
expander.c \
hypertext.c \
iconview.c \
images.c \
list_store.c \
menus.c \
panes.c \
pixbufs.c \
rotated_text.c \
sizegroup.c \
textview.c \
tree_store.c \
ui_manager.c \
demos.h: $(DEMOS) geninclude.pl
$(PERL) geninclude.pl $(DEMOS) > demos.h
OBJECTS = \
button_box.obj \
changedisplay.obj \
clipboard.obj \
colorsel.obj \
dialog.obj \
drawingarea.obj \
editable_cells.obj \
entry_completion.obj \
expander.obj \
hypertext.obj \
iconview.obj \
images.obj \
list_store.obj \
menus.obj \
panes.obj \
pixbufs.obj \
rotated_text.obj \
sizegroup.obj \
textview.obj \
tree_store.obj \
ui_manager.obj \
main.obj \
gtk-demo.exe : demos.h $(OBJECTS)
$(CC) $(CFLAGS) -Fegtk-demo.exe $(OBJECTS) $(GTK_LIBS) $(GDK_LIBS) $(GDK_PIXBUF_LIBS) \
$(CAIRO_LIBS) $(PANGOCAIRO_LIBS) $(PANGO_LIBS) $(GLIB_LIBS) $(LDFLAGS)

View File

@@ -53,8 +53,8 @@ do_markup (GtkWidget *do_widget)
GtkWidget *show_source;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
gtk_window_set_default_size (GTK_WINDOW (window), 450, 450);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
@@ -68,7 +68,7 @@ do_markup (GtkWidget *do_widget)
g_signal_connect (show_source, "toggled", G_CALLBACK (source_toggled), stack);
header = gtk_header_bar_new ();
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), TRUE);
gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (header), TRUE);
gtk_header_bar_pack_start (GTK_HEADER_BAR (header), show_source);
gtk_window_set_titlebar (GTK_WINDOW (window), header);

View File

@@ -96,8 +96,8 @@ do_menus (GtkWidget *do_widget)
GtkAccelGroup *accel_group;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Menus");
g_signal_connect (window, "destroy",
G_CALLBACK(gtk_widget_destroyed), &window);

View File

@@ -18,7 +18,6 @@ demos = files([
'cursors.c',
'dialog.c',
'drawingarea.c',
'dnd.c',
'editable_cells.c',
'entry_buffer.c',
'entry_completion.c',

View File

@@ -43,8 +43,8 @@ do_modelbutton (GtkWidget *do_widget)
gtk_builder_add_callback_symbol (builder, "tool_clicked", G_CALLBACK (tool_clicked));
gtk_builder_connect_signals (builder, NULL);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);

View File

@@ -5,7 +5,7 @@
<child type="titlebar">
<object class="GtkHeaderBar">
<property name="visible">1</property>
<property name="show-title-buttons">1</property>
<property name="show-close-button">1</property>
<property name="title" translatable="yes">Model Button</property>
</object>
</child>

View File

@@ -64,15 +64,11 @@ do_overlay (GtkWidget *do_widget)
label = gtk_label_new ("<span foreground='blue' weight='ultrabold' font='40'>Numbers</span>");
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
gtk_widget_set_margin_top (label, 8);
gtk_widget_set_margin_bottom (label, 50);
gtk_widget_set_margin_bottom (label, 8);
gtk_box_pack_start (GTK_BOX (vbox), label);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), vbox);
gtk_widget_set_halign (vbox, GTK_ALIGN_CENTER);
gtk_widget_set_valign (vbox, GTK_ALIGN_CENTER);
gtk_entry_set_placeholder_text (GTK_ENTRY (entry), "Your Lucky Number");
gtk_widget_set_margin_top (entry, 50);
gtk_widget_set_margin_top (entry, 8);
gtk_widget_set_margin_bottom (entry, 8);
gtk_box_pack_start (GTK_BOX (vbox), entry);

View File

@@ -135,8 +135,8 @@ do_panes (GtkWidget *do_widget)
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);

View File

@@ -15,8 +15,8 @@ do_pickers (GtkWidget *do_widget)
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Pickers");
g_signal_connect (window, "destroy",

View File

@@ -175,8 +175,8 @@ do_pixbufs (GtkWidget *do_widget)
GError *error;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Pixbufs");
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);

View File

@@ -97,20 +97,21 @@ day_selected_cb (GtkCalendar *calendar,
gpointer user_data)
{
cairo_rectangle_int_t rect;
GtkAllocation allocation;
GtkWidget *popover;
GdkEvent *event;
gdouble x, y;
event = gtk_get_current_event ();
if (gdk_event_get_event_type (event) != GDK_BUTTON_PRESS)
if (event->type != GDK_BUTTON_PRESS)
return;
gdk_event_get_coords (event, &x, &y);
gtk_widget_translate_coordinates (gtk_get_event_widget (event),
GTK_WIDGET (calendar),
x, y,
&rect.x, &rect.y);
gdk_window_coords_to_parent (event->button.window,
event->button.x, event->button.y,
&event->button.x, &event->button.y);
gtk_widget_get_allocation (GTK_WIDGET (calendar), &allocation);
rect.x = event->button.x - allocation.x;
rect.y = event->button.y - allocation.y;
rect.width = rect.height = 1;
popover = create_popover (GTK_WIDGET (calendar),
@@ -132,7 +133,6 @@ do_popover (GtkWidget *do_widget)
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Popovers");
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 24);
g_object_set (box, "margin", 24, NULL);
gtk_container_add (GTK_CONTAINER (window), box);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 459 KiB

View File

@@ -71,8 +71,8 @@ do_revealer (GtkWidget *do_widget)
builder = gtk_builder_new_from_resource ("/revealer/revealer.ui");
gtk_builder_connect_signals (builder, NULL);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
g_signal_connect (window, "destroy",
G_CALLBACK (on_destroy), NULL);
g_object_set_data_full (G_OBJECT (window), "builder", builder, g_object_unref);

View File

@@ -19,7 +19,7 @@
<object class="GtkImage">
<property name="visible">1</property>
<property name="icon-name">face-cool-symbolic</property>
<property name="icon-size">large</property>
<property name="icon-size">6</property>
</object>
</child>
</object>
@@ -37,7 +37,7 @@
<object class="GtkImage">
<property name="visible">1</property>
<property name="icon-name">face-cool-symbolic</property>
<property name="icon-size">large</property>
<property name="icon-size">6</property>
</object>
</child>
</object>
@@ -55,7 +55,7 @@
<object class="GtkImage">
<property name="visible">1</property>
<property name="icon-name">face-cool-symbolic</property>
<property name="icon-size">large</property>
<property name="icon-size">6</property>
</object>
</child>
</object>
@@ -72,7 +72,7 @@
<object class="GtkImage">
<property name="visible">1</property>
<property name="icon-name">face-cool-symbolic</property>
<property name="icon-size">large</property>
<property name="icon-size">6</property>
</object>
</child>
</object>
@@ -90,7 +90,7 @@
<object class="GtkImage">
<property name="visible">1</property>
<property name="icon-name">face-cool-symbolic</property>
<property name="icon-size">large</property>
<property name="icon-size">6</property>
</object>
</child>
</object>
@@ -108,7 +108,7 @@
<object class="GtkImage">
<property name="visible">1</property>
<property name="icon-name">face-cool-symbolic</property>
<property name="icon-size">large</property>
<property name="icon-size">6</property>
</object>
</child>
</object>
@@ -126,7 +126,7 @@
<object class="GtkImage">
<property name="visible">1</property>
<property name="icon-name">face-cool-symbolic</property>
<property name="icon-size">large</property>
<property name="icon-size">6</property>
</object>
</child>
</object>
@@ -143,7 +143,7 @@
<object class="GtkImage">
<property name="visible">1</property>
<property name="icon-name">face-cool-symbolic</property>
<property name="icon-size">large</property>
<property name="icon-size">6</property>
</object>
</child>
</object>
@@ -161,7 +161,7 @@
<object class="GtkImage">
<property name="visible">1</property>
<property name="icon-name">face-cool-symbolic</property>
<property name="icon-size">large</property>
<property name="icon-size">6</property>
</object>
</child>
</object>

View File

@@ -179,8 +179,8 @@ do_rotated_text (GtkWidget *do_widget)
PangoAttrList *attrs;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Rotated Text");
gtk_window_set_default_size (GTK_WINDOW (window), 4 * RADIUS, 2 * RADIUS);
g_signal_connect (window, "destroy",

View File

@@ -20,8 +20,8 @@ do_scale (GtkWidget *do_widget)
builder = gtk_builder_new_from_resource ("/scale/scale.ui");
gtk_builder_connect_signals (builder, NULL);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);

View File

@@ -229,7 +229,7 @@ do_search_entry (GtkWidget *do_widget)
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget));
gtk_window_set_screen (GTK_WINDOW (window), gtk_widget_get_screen (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Search Entry");
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
g_signal_connect (window, "destroy",

View File

@@ -97,8 +97,8 @@ do_shortcuts (GtkWidget *do_widget)
NULL);
gtk_builder_connect_signals (builder, NULL);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);

View File

@@ -40,7 +40,7 @@ do_sidebar (GtkWidget *do_widget)
gtk_widget_set_size_request (window, 500, 350);
header = gtk_header_bar_new ();
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR(header), TRUE);
gtk_header_bar_set_show_close_button (GTK_HEADER_BAR(header), TRUE);
gtk_window_set_titlebar (GTK_WINDOW(window), header);
gtk_window_set_title (GTK_WINDOW(window), "Stack Sidebar");
@@ -65,7 +65,7 @@ do_sidebar (GtkWidget *do_widget)
{
if (i == 0)
{
widget = gtk_image_new_from_icon_name ("help-about");
widget = gtk_image_new_from_icon_name ("help-about", GTK_ICON_SIZE_MENU);
gtk_image_set_pixel_size (GTK_IMAGE (widget), 256);
}
else

View File

@@ -101,7 +101,7 @@ do_sizegroup (GtkWidget *do_widget)
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget));
gtk_window_set_screen (GTK_WINDOW (window), gtk_widget_get_screen (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Size Groups");
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
g_signal_connect (window, "destroy",

View File

@@ -201,8 +201,8 @@ do_spinbutton (GtkWidget *do_widget)
NULL);
gtk_builder_connect_signals (builder, NULL);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Spin Buttons");
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
g_signal_connect (window, "destroy",

View File

@@ -20,8 +20,8 @@ do_stack (GtkWidget *do_widget)
builder = gtk_builder_new_from_resource ("/stack/stack.ui");
gtk_builder_connect_signals (builder, NULL);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);

View File

@@ -20,8 +20,8 @@ do_tabs (GtkWidget *do_widget)
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Tabs");
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
gtk_window_set_default_size (GTK_WINDOW (window), 450, 450);
g_signal_connect (window, "destroy",

View File

@@ -129,7 +129,6 @@ insert_text (GtkTextBuffer *buffer)
GtkTextIter iter;
GtkTextIter start, end;
GdkPixbuf *pixbuf;
GdkTexture *texture;
GtkIconTheme *icon_theme;
icon_theme = gtk_icon_theme_get_default ();
@@ -139,7 +138,6 @@ insert_text (GtkTextBuffer *buffer)
GTK_ICON_LOOKUP_GENERIC_FALLBACK,
NULL);
g_assert (pixbuf);
texture = gdk_texture_new_for_pixbuf (pixbuf);
/* get start of buffer; each insertion will revalidate the
* iterator to point to just after the inserted text.
@@ -234,9 +232,9 @@ insert_text (GtkTextBuffer *buffer)
"heading", NULL);
gtk_text_buffer_insert (buffer, &iter, "The buffer can have images in it: ", -1);
gtk_text_buffer_insert_texture (buffer, &iter, texture);
gtk_text_buffer_insert_texture (buffer, &iter, texture);
gtk_text_buffer_insert_texture (buffer, &iter, texture);
gtk_text_buffer_insert_pixbuf (buffer, &iter, pixbuf);
gtk_text_buffer_insert_pixbuf (buffer, &iter, pixbuf);
gtk_text_buffer_insert_pixbuf (buffer, &iter, pixbuf);
gtk_text_buffer_insert (buffer, &iter, " for example.\n\n", -1);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, "Spacing. ", -1,
@@ -365,6 +363,8 @@ insert_text (GtkTextBuffer *buffer)
gtk_text_buffer_create_child_anchor (buffer, &iter);
gtk_text_buffer_insert (buffer, &iter, " and a scale: ", -1);
gtk_text_buffer_create_child_anchor (buffer, &iter);
gtk_text_buffer_insert (buffer, &iter, " and an animation: ", -1);
gtk_text_buffer_create_child_anchor (buffer, &iter);
gtk_text_buffer_insert (buffer, &iter, " finally a text entry: ", -1);
gtk_text_buffer_create_child_anchor (buffer, &iter);
gtk_text_buffer_insert (buffer, &iter, ".\n", -1);
@@ -380,7 +380,6 @@ insert_text (GtkTextBuffer *buffer)
gtk_text_buffer_apply_tag_by_name (buffer, "word_wrap", &start, &end);
g_object_unref (pixbuf);
g_object_unref (texture);
}
static gboolean
@@ -436,6 +435,10 @@ attach_widgets (GtkTextView *text_view)
gtk_widget_set_size_request (widget, 70, -1);
}
else if (i == 3)
{
widget = gtk_image_new_from_resource ("/textview/floppybuddy.gif");
}
else if (i == 4)
{
widget = gtk_entry_new ();
}
@@ -467,8 +470,8 @@ do_textview (GtkWidget *do_widget)
GtkTextBuffer *buffer;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
gtk_window_set_default_size (GTK_WINDOW (window),
450, 450);

View File

@@ -55,7 +55,7 @@
<property name="label" translatable="yes">Raised</property>
<property name="use_underline">1</property>
<property name="is_important">1</property>
<property name="icon_name">edit-find</property>
<property name="icon_name">edit-find-symbolic</property>
<style>
<class name="raised"/>
</style>
@@ -70,7 +70,7 @@
<property name="label" translatable="yes">Raised Active</property>
<property name="use_underline">1</property>
<property name="is_important">1</property>
<property name="icon_name">edit-find</property>
<property name="icon_name">edit-find-symbolic</property>
<property name="active">1</property>
<style>
<class name="raised"/>

View File

@@ -21,8 +21,8 @@ do_theming_style_classes (GtkWidget *do_widget)
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Style Classes");
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
g_signal_connect (window, "destroy",

View File

@@ -39,12 +39,14 @@ canvas_item_new (GtkWidget *widget,
const gchar *icon_name;
GdkPixbuf *pixbuf;
GtkIconTheme *icon_theme;
int width;
icon_name = gtk_tool_button_get_icon_name (button);
icon_theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (widget));
icon_theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (widget));
gtk_icon_size_lookup (GTK_ICON_SIZE_DIALOG, &width, NULL);
pixbuf = gtk_icon_theme_load_icon (icon_theme,
icon_name,
48,
width,
GTK_ICON_LOOKUP_GENERIC_FALLBACK,
NULL);
@@ -166,6 +168,7 @@ palette_drag_data_received (GtkWidget *widget,
gint x,
gint y,
GtkSelectionData *selection,
guint info,
guint time,
gpointer data)
{
@@ -209,6 +212,7 @@ passive_canvas_drag_data_received (GtkWidget *widget,
gint x,
gint y,
GtkSelectionData *selection,
guint info,
guint time,
gpointer data)
{
@@ -283,6 +287,7 @@ interactive_canvas_drag_data_received (GtkWidget *widget,
gint x,
gint y,
GtkSelectionData *selection,
guint info,
guint time,
gpointer data)
@@ -322,7 +327,7 @@ interactive_canvas_drag_data_received (GtkWidget *widget,
canvas_items = g_list_append (canvas_items, item);
drop_item = NULL;
gtk_drag_finish (context, TRUE, time);
gtk_drag_finish (context, TRUE, FALSE, time);
} else
{
drop_item = item;
@@ -431,8 +436,8 @@ do_toolpalette (GtkWidget *do_widget)
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Tool Palette");
gtk_window_set_default_size (GTK_WINDOW (window), 200, 600);
@@ -563,8 +568,8 @@ do_toolpalette (GtkWidget *do_widget)
contents = gtk_drawing_area_new ();
g_object_connect (contents,
"draw", canvas_draw, NULL,
"drag-data-received", passive_canvas_drag_data_received, NULL,
"signal::draw", canvas_draw, NULL,
"signal::drag-data-received", passive_canvas_drag_data_received, NULL,
NULL);
gtk_tool_palette_add_drag_dest (GTK_TOOL_PALETTE (palette),
@@ -589,11 +594,11 @@ do_toolpalette (GtkWidget *do_widget)
contents = gtk_drawing_area_new ();
g_object_connect (contents,
"draw", canvas_draw, NULL,
"drag-motion", interactive_canvas_drag_motion, NULL,
"drag-data-received", interactive_canvas_drag_data_received, NULL,
"drag-leave", interactive_canvas_drag_leave, contents,
"drag-drop", interactive_canvas_drag_drop, NULL,
"signal::draw", canvas_draw, NULL,
"signal::drag-motion", interactive_canvas_drag_motion, NULL,
"signal::drag-data-received", interactive_canvas_drag_data_received, NULL,
"signal::drag-leave", interactive_canvas_drag_leave, contents,
"signal::drag-drop", interactive_canvas_drag_drop, NULL,
NULL);
gtk_tool_palette_add_drag_dest (GTK_TOOL_PALETTE (palette),
@@ -633,7 +638,7 @@ load_icon_items (GtkToolPalette *palette)
GList *l;
GtkIconTheme *icon_theme;
icon_theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (GTK_WIDGET (palette)));
icon_theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (palette)));
contexts = gtk_icon_theme_list_contexts (icon_theme);
for (l = contexts; l; l = l->next)

View File

@@ -1,10 +1,184 @@
/* Overlay/Transparency
*
* Blur the background behind an overlay.
* Use transparent background on GdkWindows to create a shadow effect on a GtkOverlay widget.
*/
#include <gtk/gtk.h>
#define SHADOW_OFFSET_X 7
#define SHADOW_OFFSET_Y 7
#define SHADOW_RADIUS 5
static void
draw_shadow_box (cairo_t *cr,
GdkRectangle rect,
double radius,
double transparency)
{
cairo_pattern_t *pattern;
double x0, x1, x2, x3;
double y0, y1, y2, y3;
x0 = rect.x;
x1 = rect.x + radius;
x2 = rect.x + rect.width - radius;
x3 = rect.x + rect.width;
y0 = rect.y;
y1 = rect.y + radius;
y2 = rect.y + rect.height - radius;
y3 = rect.y + rect.height;
/* Fill non-border part */
cairo_set_source_rgba (cr, 0, 0, 0, transparency);
cairo_rectangle (cr,
x1, y1, x2 - x1, y2 - y1);
cairo_fill (cr);
/* Upper border */
pattern = cairo_pattern_create_linear (0, y0, 0, y1);
cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, 0.0);
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, transparency);
cairo_set_source (cr, pattern);
cairo_pattern_destroy (pattern);
cairo_rectangle (cr,
x1, y0,
x2 - x1, y1 - y0);
cairo_fill (cr);
/* Bottom border */
pattern = cairo_pattern_create_linear (0, y2, 0, y3);
cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, transparency);
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0);
cairo_set_source (cr, pattern);
cairo_pattern_destroy (pattern);
cairo_rectangle (cr,
x1, y2,
x2 - x1, y3 - y2);
cairo_fill (cr);
/* Left border */
pattern = cairo_pattern_create_linear (x0, 0, x1, 0);
cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, 0.0);
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, transparency);
cairo_set_source (cr, pattern);
cairo_pattern_destroy (pattern);
cairo_rectangle (cr,
x0, y1,
x1 - x0, y2 - y1);
cairo_fill (cr);
/* Right border */
pattern = cairo_pattern_create_linear (x2, 0, x3, 0);
cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, transparency);
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0);
cairo_set_source (cr, pattern);
cairo_pattern_destroy (pattern);
cairo_rectangle (cr,
x2, y1,
x3 - x2, y2 - y1);
cairo_fill (cr);
/* NW corner */
pattern = cairo_pattern_create_radial (x1, y1, 0,
x1, y1, radius);
cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, transparency);
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0);
cairo_set_source (cr, pattern);
cairo_pattern_destroy (pattern);
cairo_rectangle (cr,
x0, y0,
x1 - x0, y1 - y0);
cairo_fill (cr);
/* NE corner */
pattern = cairo_pattern_create_radial (x2, y1, 0,
x2, y1, radius);
cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, transparency);
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0);
cairo_set_source (cr, pattern);
cairo_pattern_destroy (pattern);
cairo_rectangle (cr,
x2, y0,
x3 - x2, y1 - y0);
cairo_fill (cr);
/* SW corner */
pattern = cairo_pattern_create_radial (x1, y2, 0,
x1, y2, radius);
cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, transparency);
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0);
cairo_set_source (cr, pattern);
cairo_pattern_destroy (pattern);
cairo_rectangle (cr,
x0, y2,
x1 - x0, y3 - y2);
cairo_fill (cr);
/* SE corner */
pattern = cairo_pattern_create_radial (x2, y2, 0,
x2, y2, radius);
cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, transparency);
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0);
cairo_set_source (cr, pattern);
cairo_pattern_destroy (pattern);
cairo_rectangle (cr,
x2, y2,
x3 - x2, y3 - y2);
cairo_fill (cr);
}
static gboolean
draw_callback (GtkWidget *widget,
cairo_t *cr,
gpointer data)
{
GdkRectangle rect;
gtk_widget_get_allocation (widget, &rect);
rect.x += SHADOW_OFFSET_X;
rect.y += SHADOW_OFFSET_Y;
rect.width -= SHADOW_OFFSET_X;
rect.height -= SHADOW_OFFSET_Y;
draw_shadow_box (cr,
rect, SHADOW_RADIUS, 0.4);
return FALSE;
}
GtkWidget *
do_transparent (GtkWidget *do_widget)
{
@@ -12,16 +186,16 @@ do_transparent (GtkWidget *do_widget)
if (!window)
{
GtkWidget *view;
GtkWidget *sw;
GtkWidget *overlay;
GtkWidget *button;
GtkWidget *label;
GtkWidget *box;
GtkWidget *image;
GtkWidget *entry;
GtkCssProvider *provider;
gchar *css;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
gtk_window_set_default_size (GTK_WINDOW (window), 450, 450);
g_signal_connect (window, "destroy",
@@ -29,42 +203,33 @@ do_transparent (GtkWidget *do_widget)
gtk_window_set_title (GTK_WINDOW (window), "Transparency");
overlay = gtk_overlay_new ();
gtk_container_add (GTK_CONTAINER (window), overlay);
button = gtk_button_new_with_label ("Don't click this button!");
label = gtk_bin_get_child (GTK_BIN (button));
g_object_set (label, "margin", 50, NULL);
gtk_widget_set_opacity (button, 0.7);
gtk_widget_set_halign (button, GTK_ALIGN_FILL);
gtk_widget_set_valign (button, GTK_ALIGN_START);
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), button);
gtk_container_child_set (GTK_CONTAINER (overlay), button, "blur", 5.0, NULL);
button = gtk_button_new_with_label ("Maybe this one?");
label = gtk_bin_get_child (GTK_BIN (button));
g_object_set (label, "margin", 50, NULL);
gtk_widget_set_opacity (button, 0.7);
gtk_widget_set_halign (button, GTK_ALIGN_FILL);
gtk_widget_set_valign (button, GTK_ALIGN_END);
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), button);
gtk_container_child_set (GTK_CONTAINER (overlay), button, "blur", 5.0, NULL);
view = gtk_text_view_new ();
sw = gtk_scrolled_window_new (NULL, NULL);
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_container_add (GTK_CONTAINER (overlay), sw);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (sw), box);
image = gtk_image_new_from_resource ("/transparent/portland-rose.jpg");
gtk_container_add (GTK_CONTAINER (sw), view);
gtk_container_add (GTK_CONTAINER (box), image);
overlay = gtk_overlay_new ();
gtk_container_add (GTK_CONTAINER (overlay), sw);
gtk_container_add (GTK_CONTAINER (window), overlay);
entry = gtk_entry_new ();
provider = gtk_css_provider_new ();
css = g_strdup_printf ("* { border-width: 0px %dpx %dpx 0px; }",
SHADOW_OFFSET_X, SHADOW_OFFSET_Y);
gtk_css_provider_load_from_data (provider, css, -1);
g_free (css);
gtk_style_context_add_provider (gtk_widget_get_style_context (entry),
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
g_signal_connect (entry, "draw", G_CALLBACK (draw_callback), NULL);
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), entry);
gtk_widget_set_halign (entry, GTK_ALIGN_CENTER);
gtk_widget_set_valign (entry, GTK_ALIGN_START);
gtk_widget_show (overlay);
}
if (!gtk_widget_get_visible (window))

View File

@@ -391,8 +391,8 @@ do_tree_store (GtkWidget *do_widget)
/* create window, etc */
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Tree Store");
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
@@ -417,7 +417,6 @@ do_tree_store (GtkWidget *do_widget)
/* create tree view */
treeview = gtk_tree_view_new_with_model (model);
gtk_widget_set_vexpand (treeview, TRUE);
g_object_unref (model);
gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview)),
GTK_SELECTION_MULTIPLE);

View File

@@ -9,106 +9,12 @@
#include "gtkfishbowl.h"
GtkWidget *fishbowl;
static GtkWidget *
create_button (void)
{
return gtk_button_new_with_label ("Button");;
}
static GtkWidget *
create_font_button (void)
{
return gtk_font_button_new ();
}
static GtkWidget *
create_level_bar (void)
{
GtkWidget *w = gtk_level_bar_new_for_interval (0, 100);
gtk_level_bar_set_value (GTK_LEVEL_BAR (w), 50);
/* Force them to be a bit larger */
gtk_widget_set_size_request (w, 200, -1);
return w;
}
static GtkWidget *
create_spinner (void)
{
GtkWidget *w = gtk_spinner_new ();
gtk_spinner_start (GTK_SPINNER (w));
return w;
}
static GtkWidget *
create_spinbutton (void)
{
GtkWidget *w = gtk_spin_button_new_with_range (0, 10, 1);
return w;
}
static GtkWidget *
create_label (void)
{
GtkWidget *w = gtk_label_new ("pLorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.");
gtk_label_set_line_wrap (GTK_LABEL (w), TRUE);
gtk_label_set_max_width_chars (GTK_LABEL (w), 100);
return w;
}
static const struct {
const char *name;
GtkWidget * (*create_func) (void);
} widget_types[] = {
{ "Button", create_button },
{ "Fontbutton", create_font_button },
{ "Levelbar" , create_level_bar },
{ "Label" , create_label },
{ "Spinner" , create_spinner },
{ "Spinbutton", create_spinbutton },
};
static int selected_widget_type = -1;
static const int N_WIDGET_TYPES = G_N_ELEMENTS (widget_types);
GtkWidget *allow_changes;
#define N_STATS 5
#define STATS_UPDATE_TIME G_USEC_PER_SEC
static void
set_widget_type (GtkWidget *headerbar,
int widget_type_index)
{
GList *children, *l;
if (widget_type_index == selected_widget_type)
return;
/* Remove everything */
children = gtk_container_get_children (GTK_CONTAINER (fishbowl));
for (l = children; l; l = l->next)
{
gtk_container_remove (GTK_CONTAINER (fishbowl), (GtkWidget*)l->data);
}
g_list_free (children);
selected_widget_type = widget_type_index;
gtk_header_bar_set_title (GTK_HEADER_BAR (headerbar),
widget_types[selected_widget_type].name);
}
typedef struct _Stats Stats;
struct _Stats {
gint64 last_stats;
@@ -163,7 +69,7 @@ do_stats (GtkWidget *widget,
{
n_frames += stats->frame_counter[i];
}
new_label = g_strdup_printf ("widgets - %.1f fps",
(double) G_USEC_PER_SEC * n_frames
/ (N_STATS * STATS_UPDATE_TIME));
@@ -190,7 +96,7 @@ do_stats (GtkWidget *widget,
stats->frame_counter[stats->stats_index] = 0;
stats->item_counter[stats->stats_index] = stats->item_counter[(stats->stats_index + N_STATS - 1) % N_STATS];
stats->last_stats = frame_time;
if (suggested_change)
*suggested_change = stats->last_suggestion;
else
@@ -223,74 +129,18 @@ move_fish (GtkWidget *bowl,
gpointer info_label)
{
gint suggested_change = 0;
do_stats (bowl,
info_label,
!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (allow_changes)) ? &suggested_change : NULL);
do_stats (bowl, info_label, &suggested_change);
if (suggested_change > 0)
{
int i;
for (i = 0; i < suggested_change; i ++)
{
GtkWidget *new_widget = widget_types[selected_widget_type].create_func ();
gtk_container_add (GTK_CONTAINER (fishbowl), new_widget);
}
}
else if (suggested_change < 0)
{
GList *children, *l;
int n_removed = 0;
children = gtk_container_get_children (GTK_CONTAINER (fishbowl));
for (l = children; l; l = l->next)
{
gtk_container_remove (GTK_CONTAINER (fishbowl), (GtkWidget *)l->data);
n_removed ++;
if (n_removed >= (-suggested_change))
break;
}
g_list_free (children);
}
gtk_fishbowl_set_count (GTK_FISHBOWL (bowl),
gtk_fishbowl_get_count (GTK_FISHBOWL (bowl)) + suggested_change);
stats_update (bowl);
return G_SOURCE_CONTINUE;
}
static void
next_button_clicked_cb (GtkButton *source,
gpointer user_data)
{
GtkWidget *headerbar = user_data;
int new_index;
if (selected_widget_type + 1 >= N_WIDGET_TYPES)
new_index = 0;
else
new_index = selected_widget_type + 1;
set_widget_type (headerbar, new_index);
}
static void
prev_button_clicked_cb (GtkButton *source,
gpointer user_data)
{
GtkWidget *headerbar = user_data;
int new_index;
if (selected_widget_type - 1 < 0)
new_index = N_WIDGET_TYPES - 1;
else
new_index = selected_widget_type - 1;
set_widget_type (headerbar, new_index);
}
GtkWidget *
do_widgetbowl (GtkWidget *do_widget)
{
@@ -298,55 +148,25 @@ do_widgetbowl (GtkWidget *do_widget)
if (!window)
{
GtkWidget *info_label;
GtkWidget *count_label;
GtkWidget *titlebar;
GtkWidget *title_box;
GtkWidget *left_box;
GtkWidget *next_button;
GtkWidget *prev_button;
GtkBuilder *builder;
GtkWidget *bowl, *info_label;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
titlebar = gtk_header_bar_new ();
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (titlebar), TRUE);
info_label = gtk_label_new ("widget - 00.0 fps");
count_label = gtk_label_new ("0");
fishbowl = gtk_fishbowl_new ();
title_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
prev_button = gtk_button_new_from_icon_name ("pan-start-symbolic");
next_button = gtk_button_new_from_icon_name ("pan-end-symbolic");
left_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
g_type_ensure (GTK_TYPE_FISHBOWL);
g_object_bind_property (fishbowl, "count", count_label, "label", 0);
g_signal_connect (next_button, "clicked", G_CALLBACK (next_button_clicked_cb), titlebar);
g_signal_connect (prev_button, "clicked", G_CALLBACK (prev_button_clicked_cb), titlebar);
gtk_fishbowl_set_animating (GTK_FISHBOWL (fishbowl), TRUE);
gtk_widget_set_hexpand (title_box, TRUE);
gtk_widget_set_halign (title_box, GTK_ALIGN_END);
gtk_window_set_titlebar (GTK_WINDOW (window), titlebar);
gtk_container_add (GTK_CONTAINER (title_box), count_label);
gtk_container_add (GTK_CONTAINER (title_box), info_label);
gtk_header_bar_pack_end (GTK_HEADER_BAR (titlebar), title_box);
gtk_container_add (GTK_CONTAINER (window), fishbowl);
gtk_style_context_add_class (gtk_widget_get_style_context (left_box), "linked");
gtk_container_add (GTK_CONTAINER (left_box), prev_button);
gtk_container_add (GTK_CONTAINER (left_box), next_button);
gtk_header_bar_pack_start (GTK_HEADER_BAR (titlebar), left_box);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
builder = gtk_builder_new_from_resource ("/fishbowl/fishbowl.ui");
gtk_builder_connect_signals (builder, NULL);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
bowl = GTK_WIDGET (gtk_builder_get_object (builder, "bowl"));
gtk_fishbowl_set_use_icons (GTK_FISHBOWL (bowl), FALSE);
info_label = GTK_WIDGET (gtk_builder_get_object (builder, "info_label"));
allow_changes = GTK_WIDGET (gtk_builder_get_object (builder, "changes_allow"));
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
gtk_widget_realize (window);
gtk_widget_add_tick_callback (fishbowl, move_fish, info_label, NULL);
set_widget_type (titlebar, 0);
gtk_widget_add_tick_callback (bowl, move_fish, info_label, NULL);
}
if (!gtk_widget_get_visible (window))

View File

@@ -0,0 +1,48 @@
AM_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_srcdir)/gdk \
-I$(top_builddir)/gdk \
$(GTK_DEBUG_FLAGS) \
$(GTK_DEP_CFLAGS)
LDADD = \
$(top_builddir)/gtk/libgtk-4.la \
$(GTK_DEP_LIBS)
bin_PROGRAMS = gtk4-icon-browser
desktopdir = $(datadir)/applications
dist_desktop_DATA = gtk4-icon-browser.desktop
gtk4_icon_browser_SOURCES = \
main.c \
iconbrowserapp.c iconbrowserapp.h \
iconbrowserwin.c iconbrowserwin.h \
iconstore.c iconstore.h \
resources.c
BUILT_SOURCES = \
resources.c
resources.c: iconbrowser.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/iconbrowser.gresource.xml)
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $(srcdir)/iconbrowser.gresource.xml \
--target=$@ --sourcedir=$(srcdir) --generate-source
EXTRA_DIST = \
menus.ui \
iconbrowser.gresource.xml \
window.ui \
icon.list
# ------------------- MSVC Build Items ----------------
MSVCPROJS = gtk4-icon-browser
gtk4_icon_browser_FILES = $(gtk4_icon_browser_SOURCES)
gtk4_icon_browser_EXCLUDES = dummy
include $(top_srcdir)/win32/Makefile.msvcproj
dist-hook: $(top_builddir)/win32/vs12/gtk4-icon-browser.vcxproj
-include $(top_srcdir)/git.mk

View File

@@ -287,6 +287,7 @@ emblem-system=The icon used as an emblem for directories that contain system lib
avatar-default=The generic avatar icon, which is used to represent a user that doesn't have a personalized avatar
emblem-synchronizing=The icon used as an emblem to indicate that a a synchronizing operation is in process
emblem-shared=The icon used as an emblem for files and directories that are shared to other users
folder-download=The icon representing the location in the file system where downloaded files are stored
help-browser=The icon used for the desktop's help browsing application
[other]
@@ -428,9 +429,10 @@ emblem-urgent=
emblem-videos=
emblem-web=
folder-documents=
folder-download=The icon representing the location in the file system where downloaded files are stored
folder-download=
folder-music=
folder-pictures=
folder-documents=
folder-publicshare=
folder-remote=The icon used for normal directories on a remote filesystem
folder-saved-search=

View File

@@ -4,11 +4,6 @@
#include "iconstore.h"
#include <gtk/gtk.h>
/* Drag 'n Drop */
static const char *target_table[] = {
"text/uri-list"
};
typedef struct
{
gchar *id;
@@ -51,8 +46,6 @@ struct _IconBrowserWindow
GtkWidget *image3;
GtkWidget *image4;
GtkWidget *image5;
GtkWidget *image6;
GtkWidget *label6;
GtkWidget *description;
};
@@ -94,9 +87,13 @@ get_icon (GtkWidget *image, const gchar *name, gint size)
static void
set_image (GtkWidget *image, const gchar *name, gint size)
{
gtk_image_set_from_icon_name (GTK_IMAGE (image), name);
GdkPixbuf *pixbuf;
gtk_image_set_from_icon_name (GTK_IMAGE (image), name, 1);
gtk_image_set_pixel_size (GTK_IMAGE (image), size);
gtk_drag_source_set_icon_name (image, name);
pixbuf = get_icon (image, name, size);
gtk_drag_source_set_icon_pixbuf (image, pixbuf);
g_object_unref (pixbuf);
}
static void
@@ -130,17 +127,6 @@ item_activated (GtkIconView *icon_view, GtkTreePath *path, IconBrowserWindow *wi
set_image (win->image3, name, 32);
set_image (win->image4, name, 48);
set_image (win->image5, name, 64);
if (win->symbolic)
{
gtk_widget_show (win->image6);
gtk_widget_show (win->label6);
set_image (win->image6, name, 64);
}
else
{
gtk_widget_hide (win->image6);
gtk_widget_hide (win->label6);
}
if (description && description[0])
{
gtk_label_set_text (GTK_LABEL (win->description), description);
@@ -299,10 +285,10 @@ static void
copy_to_clipboard (GtkButton *button,
IconBrowserWindow *win)
{
GdkClipboard *clipboard;
GtkClipboard *clipboard;
clipboard = gtk_widget_get_clipboard (GTK_WIDGET (win));
gdk_clipboard_set_text (clipboard, gtk_window_get_title (GTK_WINDOW (win->details)));
clipboard = gtk_clipboard_get_default (gdk_display_get_default ());
gtk_clipboard_set_text (clipboard, gtk_window_get_title (GTK_WINDOW (win->details)), -1);
}
static gboolean
@@ -386,7 +372,7 @@ get_image_data (GtkWidget *widget,
image = gtk_bin_get_child (GTK_BIN (widget));
name = gtk_image_get_icon_name (GTK_IMAGE (image));
gtk_image_get_icon_name (GTK_IMAGE (image), &name, NULL);
size = gtk_image_get_pixel_size (GTK_IMAGE (image));
pixbuf = get_icon (image, name, size);
@@ -394,80 +380,40 @@ get_image_data (GtkWidget *widget,
g_object_unref (pixbuf);
}
static void
get_scalable_image_data (GtkWidget *widget,
GdkDragContext *context,
GtkSelectionData *selection,
guint target_info,
guint time,
gpointer data)
{
gchar *uris[2];
GtkIconInfo *info;
GtkWidget *image;
GFile *file;
const gchar *name;
image = gtk_bin_get_child (GTK_BIN (widget));
name = gtk_image_get_icon_name (GTK_IMAGE (image));
info = gtk_icon_theme_lookup_icon (gtk_icon_theme_get_default (), name, -1, 0);
file = g_file_new_for_path (gtk_icon_info_get_filename (info));
uris[0] = g_file_get_uri (file);
uris[1] = NULL;
gtk_selection_data_set_uris (selection, uris);
g_free (uris[0]);
g_object_unref (info);
g_object_unref (file);
}
static void
setup_image_dnd (GtkWidget *image)
{
gtk_drag_source_set (image, GDK_BUTTON1_MASK, NULL, GDK_ACTION_COPY);
gtk_drag_source_set (image, GDK_BUTTON1_MASK, NULL, 0, GDK_ACTION_COPY);
gtk_drag_source_add_image_targets (image);
g_signal_connect (image, "drag-data-get", G_CALLBACK (get_image_data), NULL);
}
static void
setup_scalable_image_dnd (GtkWidget *image)
{
GtkWidget *parent;
GdkContentFormats *targets;
parent = gtk_widget_get_parent (image);
targets = gdk_content_formats_new (target_table, G_N_ELEMENTS (target_table));
gtk_drag_source_set (parent, GDK_BUTTON1_MASK,
targets,
GDK_ACTION_COPY);
gdk_content_formats_unref (targets);
g_signal_connect (parent, "drag-data-get", G_CALLBACK (get_scalable_image_data), NULL);
}
static void
icon_browser_window_init (IconBrowserWindow *win)
{
GdkContentFormats *list;
GtkTargetList *list;
GtkTargetEntry *targets;
gint n_targets;
gtk_widget_init_template (GTK_WIDGET (win));
list = gdk_content_formats_new (NULL, 0);
list = gtk_content_formats_add_text_targets (list);
list = gtk_target_list_new (NULL, 0);
gtk_target_list_add_text_targets (list, 0);
targets = gtk_target_table_new_from_list (list, &n_targets);
gtk_target_list_unref (list);
gtk_icon_view_enable_model_drag_source (GTK_ICON_VIEW (win->list),
GDK_BUTTON1_MASK,
list,
targets, n_targets,
GDK_ACTION_COPY);
gdk_content_formats_unref (list);
gtk_target_table_free (targets, n_targets);
setup_image_dnd (win->image1);
setup_image_dnd (win->image2);
setup_image_dnd (win->image3);
setup_image_dnd (win->image4);
setup_image_dnd (win->image5);
setup_scalable_image_dnd (win->image6);
win->contexts = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, context_free);
@@ -507,8 +453,6 @@ icon_browser_window_class_init (IconBrowserWindowClass *class)
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, image3);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, image4);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, image5);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, image6);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, label6);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, description);
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), search_text_changed);

View File

@@ -15,7 +15,7 @@
<object class="GtkHeaderBar" id="header">
<property name="visible">True</property>
<property name="title" translatable="yes">Icon Browser</property>
<property name="show-title-buttons">True</property>
<property name="show-close-button">True</property>
<child type="title">
<object class="GtkBox">
<property name="visible">True</property>
@@ -50,6 +50,7 @@
<object class="GtkImage" id="search-icon">
<property name="visible">True</property>
<property name="icon-name">edit-find-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
</object>
@@ -149,7 +150,6 @@
<property name="margin">10</property>
<property name="row-spacing">18</property>
<property name="column-spacing">18</property>
<property name="halign">center</property>
<child>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
@@ -205,17 +205,6 @@
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkImage" id="image6">
<property name="visible">True</property>
<property name="halign">center</property>
<property name="valign">end</property>
</object>
<packing>
<property name="left-attach">5</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label1">
@@ -293,39 +282,34 @@
</packing>
</child>
<child>
<object class="GtkLabel" id="label6">
<object class="GtkLabel" id="description">
<property name="visible">True</property>
<property name="halign">center</property>
<property name="valign">baseline</property>
<property name="label">scalable</property>
<style>
<class name="dim-label"/>
</style>
<property name="wrap">True</property>
<property name="max-width-chars">60</property>
<property name="xalign">0</property>
<property name="valign">start</property>
</object>
<packing>
<property name="left-attach">5</property>
<property name="top-attach">2</property>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
<property name="width">5</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="visible">True</property>
<property name="label" translatable="yes">Copy to Clipboard</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="margin">20</property>
<signal name="clicked" handler="copy_to_clipboard"/>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">4</property>
<property name="width">5</property>
</packing>
</child>
</object>
</child>
<child>
<object class="GtkButton">
<property name="visible">True</property>
<property name="label" translatable="yes">Copy to Clipboard</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="margin">20</property>
<signal name="clicked" handler="copy_to_clipboard"/>
</object>
</child>
<child>
<object class="GtkLabel" id="description">
<property name="margin">10</property>
<property name="visible">True</property>
<property name="wrap">True</property>
<property name="max-width-chars">60</property>
<property name="valign">start</property>
</object>
</child>
</object>

View File

@@ -0,0 +1,71 @@
include $(top_srcdir)/Makefile.decl
bin_PROGRAMS = gtk4-widget-factory
desktopdir = $(datadir)/applications
dist_desktop_DATA = gtk4-widget-factory.desktop
gtk4_widget_factory_SOURCES = \
widget-factory.c \
widget_factory_resources.c
BUILT_SOURCES = \
widget_factory_resources.c
gtk4_widget_factory_DEPENDENCIES = \
$(top_builddir)/gtk/libgtk-4.la
gtk4_widget_factory_CPPFLAGS = \
-I$(top_srcdir) \
$(GTK_DEBUG_FLAGS) \
$(GTK_DEP_CFLAGS) \
$(NULL)
gtk4_widget_factory_LDADD = \
$(top_builddir)/gtk/libgtk-4.la \
$(GTK_DEP_LIBS) \
$(NULL)
widget_factory_resources.c: widget-factory.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/widget-factory.gresource.xml)
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate-source $<
iconthemedir = $(datadir)/icons/hicolor
appsicon16dir = $(iconthemedir)/16x16/apps
appsicon22dir = $(iconthemedir)/22x22/apps
appsicon24dir = $(iconthemedir)/24x24/apps
appsicon32dir = $(iconthemedir)/32x32/apps
appsicon48dir = $(iconthemedir)/48x48/apps
appsicon256dir = $(iconthemedir)/256x256/apps
dist_appsicon16_DATA = data/16x16/gtk4-widget-factory.png data/16x16/gtk4-widget-factory-symbolic.symbolic.png
dist_appsicon22_DATA = data/22x22/gtk4-widget-factory.png data/22x22/gtk4-widget-factory-symbolic.symbolic.png
dist_appsicon24_DATA = data/24x24/gtk4-widget-factory.png data/24x24/gtk4-widget-factory-symbolic.symbolic.png
dist_appsicon32_DATA = data/32x32/gtk4-widget-factory.png data/32x32/gtk4-widget-factory-symbolic.symbolic.png
dist_appsicon48_DATA = data/48x48/gtk4-widget-factory.png data/48x48/gtk4-widget-factory-symbolic.symbolic.png
dist_appsicon256_DATA = data/256x256/gtk4-widget-factory.png data/256x256/gtk4-widget-factory-symbolic.symbolic.png
update_icon_cache = $(top_builddir)/gtk/gtk4-update-icon-cache$(EXEEXT) --ignore-theme-index --force
install-data-hook: install-update-icon-cache
uninstall-hook: uninstall-update-icon-cache
install-update-icon-cache:
$(AM_V_at)$(POST_INSTALL)
test -n "$(DESTDIR)" || $(update_icon_cache) "$(iconthemedir)"
uninstall-update-icon-cache:
$(AM_V_at)$(POST_UNINSTALL)
test -n "$(DESTDIR)" || $(update_icon_cache) "$(iconthemedir)"
EXTRA_DIST += \
widget-factory.ui \
widget-factory.css \
menus.ui \
help-overlay.ui \
widget-factory.gresource.xml \
data/source.svg \
data/symbolic-source.svg
-include $(top_srcdir)/git.mk

View File

@@ -80,7 +80,7 @@ get_busy (GSimpleAction *action,
GtkApplication *app = gtk_window_get_application (GTK_WINDOW (window));
g_application_mark_busy (G_APPLICATION (app));
cursor = gdk_cursor_new_from_name ("wait", NULL);
cursor = gdk_cursor_new_from_name (gtk_widget_get_display (window), "wait");
gdk_window_set_cursor (gtk_widget_get_window (window), cursor);
g_object_unref (cursor);
g_timeout_add (5000, get_idle, window);
@@ -1232,10 +1232,10 @@ static void
handle_cutcopypaste (GtkWidget *button, GtkWidget *textview)
{
GtkTextBuffer *buffer;
GdkClipboard *clipboard;
GtkClipboard *clipboard;
const gchar *id;
clipboard = gtk_widget_get_clipboard (textview);
clipboard = gtk_widget_get_clipboard (textview, GDK_SELECTION_CLIPBOARD);
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (textview));
id = gtk_buildable_get_name (GTK_BUILDABLE (button));
@@ -1250,13 +1250,13 @@ handle_cutcopypaste (GtkWidget *button, GtkWidget *textview)
}
static void
clipboard_formats_notify (GdkClipboard *clipboard, GdkEvent *event, GtkWidget *button)
clipboard_owner_change (GtkClipboard *clipboard, GdkEvent *event, GtkWidget *button)
{
const gchar *id;
gboolean has_text;
id = gtk_buildable_get_name (GTK_BUILDABLE (button));
has_text = gdk_content_formats_contain_gtype (gdk_clipboard_get_formats (clipboard), GTK_TYPE_TEXT_BUFFER);
has_text = gtk_clipboard_wait_is_text_available (clipboard);
if (strcmp (id, "pastebutton") == 0)
gtk_widget_set_sensitive (button, has_text);
@@ -1278,13 +1278,8 @@ textbuffer_notify_selection (GObject *object, GParamSpec *pspec, GtkWidget *butt
}
static gboolean
osd_frame_pressed (GtkGestureMultiPress *gesture,
int press,
double x,
double y,
gpointer data)
osd_frame_button_press (GtkWidget *frame, GdkEventButton *event, gpointer data)
{
GtkWidget *frame = data;
GtkWidget *osd;
gboolean visible;
@@ -1528,17 +1523,17 @@ g_test_permission_class_init (GTestPermissionClass *class)
permission_class->release_finish = release_finish;
}
static int icon_sizes[] = {0, 1, 2, 3, 4, 5, 6};
static void
update_buttons (GtkWidget *iv, GtkIconSize size)
update_buttons (GtkWidget *iv, int pos)
{
GtkWidget *button;
button = GTK_WIDGET (g_object_get_data (G_OBJECT (iv), "increase_button"));
gtk_widget_set_sensitive (button, size != GTK_ICON_SIZE_LARGE);
gtk_widget_set_sensitive (button, pos + 1 < G_N_ELEMENTS (icon_sizes));
button = GTK_WIDGET (g_object_get_data (G_OBJECT (iv), "decrease_button"));
gtk_widget_set_sensitive (button, size != GTK_ICON_SIZE_NORMAL);
button = GTK_WIDGET (g_object_get_data (G_OBJECT (iv), "reset_button"));
gtk_widget_set_sensitive (button, size != GTK_ICON_SIZE_INHERIT);
gtk_widget_set_sensitive (button, pos > 0);
}
static void
@@ -1546,14 +1541,17 @@ increase_icon_size (GtkWidget *iv)
{
GList *cells;
GtkCellRendererPixbuf *cell;
GtkIconSize size;
cells = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (iv));
cell = cells->data;
g_list_free (cells);
g_object_set (cell, "icon-size", GTK_ICON_SIZE_LARGE, NULL);
g_object_get (cell, "stock-size", &size, NULL);
size = MIN (size + 1, G_N_ELEMENTS (icon_sizes) - 1);
g_object_set (cell, "stock-size", size, NULL);
update_buttons (iv, GTK_ICON_SIZE_LARGE);
update_buttons (iv, size);
gtk_widget_queue_resize (iv);
}
@@ -1563,14 +1561,17 @@ decrease_icon_size (GtkWidget *iv)
{
GList *cells;
GtkCellRendererPixbuf *cell;
GtkIconSize size;
cells = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (iv));
cell = cells->data;
g_list_free (cells);
g_object_set (cell, "icon-size", GTK_ICON_SIZE_NORMAL, NULL);
g_object_get (cell, "stock-size", &size, NULL);
size = MAX (size - 1, 1);
g_object_set (cell, "stock-size", size, NULL);
update_buttons (iv, GTK_ICON_SIZE_NORMAL);
update_buttons (iv, size);
gtk_widget_queue_resize (iv);
}
@@ -1585,9 +1586,9 @@ reset_icon_size (GtkWidget *iv)
cell = cells->data;
g_list_free (cells);
g_object_set (cell, "icon-size", GTK_ICON_SIZE_INHERIT, NULL);
g_object_set (cell, "stock-size", 2, NULL);
update_buttons (iv, GTK_ICON_SIZE_INHERIT);
update_buttons (iv, 2);
gtk_widget_queue_resize (iv);
}
@@ -1655,15 +1656,14 @@ activate (GApplication *app)
gint i;
GPermission *permission;
GAction *action;
GtkGesture *gesture;
g_type_ensure (my_text_view_get_type ());
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_resource (provider, "/org/gtk/WidgetFactory/widget-factory.css");
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_USER);
gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_USER);
g_object_unref (provider);
builder = gtk_builder_new_from_resource ("/org/gtk/WidgetFactory/widget-factory.ui");
@@ -1674,6 +1674,7 @@ activate (GApplication *app)
gtk_builder_add_callback_symbol (builder, "on_page_combo_changed", (GCallback)on_page_combo_changed);
gtk_builder_add_callback_symbol (builder, "on_range_from_changed", (GCallback)on_range_from_changed);
gtk_builder_add_callback_symbol (builder, "on_range_to_changed", (GCallback)on_range_to_changed);
gtk_builder_add_callback_symbol (builder, "osd_frame_button_press", (GCallback)osd_frame_button_press);
gtk_builder_add_callback_symbol (builder, "tab_close_cb", (GCallback)tab_close_cb);
gtk_builder_add_callback_symbol (builder, "increase_icon_size", (GCallback)increase_icon_size);
gtk_builder_add_callback_symbol (builder, "decrease_icon_size", (GCallback)decrease_icon_size);
@@ -1694,14 +1695,12 @@ activate (GApplication *app)
widget = (GtkWidget *)gtk_builder_get_object (builder, "statusbar");
gtk_statusbar_push (GTK_STATUSBAR (widget), 0, "All systems are operating normally.");
action = G_ACTION (g_property_action_new ("statusbar", widget, "visible"));
g_action_map_add_action (G_ACTION_MAP (window), action);
g_object_unref (G_OBJECT (action));
g_action_map_add_action (G_ACTION_MAP (window),
G_ACTION (g_property_action_new ("statusbar", widget, "visible")));
widget = (GtkWidget *)gtk_builder_get_object (builder, "toolbar");
action = G_ACTION (g_property_action_new ("toolbar", widget, "visible"));
g_action_map_add_action (G_ACTION_MAP (window), action);
g_object_unref (G_OBJECT (action));
g_action_map_add_action (G_ACTION_MAP (window),
G_ACTION (g_property_action_new ("toolbar", widget, "visible")));
adj = (GtkAdjustment *)gtk_builder_get_object (builder, "adjustment1");
@@ -1842,8 +1841,8 @@ activate (GApplication *app)
G_CALLBACK (textbuffer_notify_selection), widget);
widget = (GtkWidget *)gtk_builder_get_object (builder, "pastebutton");
g_signal_connect (widget, "clicked", G_CALLBACK (handle_cutcopypaste), widget2);
g_signal_connect_object (gtk_widget_get_clipboard (widget2), "notify::formats",
G_CALLBACK (clipboard_formats_notify), widget, 0);
g_signal_connect_object (gtk_widget_get_clipboard (widget2, GDK_SELECTION_CLIPBOARD), "owner-change",
G_CALLBACK (clipboard_owner_change), widget, 0);
widget = (GtkWidget *)gtk_builder_get_object (builder, "osd_frame");
widget2 = (GtkWidget *)gtk_builder_get_object (builder, "totem_like_osd");
@@ -1887,9 +1886,6 @@ activate (GApplication *app)
g_object_set_data (G_OBJECT (widget), "increase_button", widget2);
widget2 = (GtkWidget *)gtk_builder_get_object (builder, "decrease_button");
g_object_set_data (G_OBJECT (widget), "decrease_button", widget2);
widget2 = (GtkWidget *)gtk_builder_get_object (builder, "reset_button");
g_object_set_data (G_OBJECT (widget), "reset_button", widget2);
reset_icon_size (widget);
adj = (GtkAdjustment *)gtk_builder_get_object (builder, "adjustment3");
widget = (GtkWidget *)gtk_builder_get_object (builder, "progressbar1");
@@ -1897,10 +1893,6 @@ activate (GApplication *app)
g_signal_connect (adj, "value-changed", G_CALLBACK (adjustment3_value_changed), widget);
g_signal_connect (adj, "value-changed", G_CALLBACK (adjustment3_value_changed), widget2);
widget = (GtkWidget *)gtk_builder_get_object (builder, "osd_frame");
gesture = gtk_gesture_multi_press_new (widget);
g_signal_connect (gesture, "pressed", G_CALLBACK (osd_frame_pressed), widget);
gtk_widget_show (GTK_WIDGET (window));
g_object_unref (builder);

Some files were not shown because too many files have changed in this diff Show More