Compare commits

..

9 Commits

Author SHA1 Message Date
Tristan Van Berkom 78c0b1da9f Added <mime-types> and <patterns> parsing support to GtkFileFilter. 2011-01-27 16:30:15 +09:00
Tristan Van Berkom e2dfd6296d Fixed GtkCellLayout to parse <cell-packing> property text accumulatively. 2011-01-26 22:19:41 +09:00
Tristan Van Berkom 0ee8c43f8f Fixed GtkContainer to parse <packing> property text accumulatively. 2011-01-26 22:10:33 +09:00
Tristan Van Berkom db55f2e16d Changed GtkComboBoxText <items> builder parser to use g_string_append_len(). 2011-01-26 21:56:43 +09:00
Tristan Van Berkom 2f3d2128ea Changed GtkRecentFilter builder parsing to use g_string_append_len 2011-01-26 21:53:45 +09:00
Tristan Van Berkom 0054bb6936 Fix GtkRecentFilter GtkBuildable parsing to handle incomming text accumulatively 2011-01-26 21:51:01 +09:00
Tristan Van Berkom d10c862acd Fix GtkComboBoxText GtkBuildable <items> parsing to handle incomming text accumulatively 2011-01-26 21:51:01 +09:00
Tristan Van Berkom 0640d95a11 Added a line to the documentation example of GtkRecentFilter 2011-01-26 21:51:01 +09:00
Tristan Van Berkom 542533a2a5 Added GtkBuildable support for adding rules to GtkRecentFilter
Also added documentation section for this. Since the GtkRecentFilter
documentation was still living in sgml, as a side-effect I migrated these
docs to the gtkrecentfilter.[ch] sources.
2011-01-26 21:51:01 +09:00
201 changed files with 26454 additions and 18546 deletions
+8 -8
View File
@@ -1,9 +1,9 @@
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
- GNU autoconf 2.54
- GNU automake 1.7
- GNU libtool 1.4
- indent (GNU indent 1.9.1 is known good)
- GNU gettext 10.40
@@ -19,10 +19,10 @@ Information about using git with GNOME can be found here:
http://live.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+.
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:
@@ -37,7 +37,7 @@ 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
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:
+1 -139
View File
@@ -1,141 +1,3 @@
Overview of Changes in GTK+ 2.99.3
==================================
* This release adds some forgotten padding to class structs,
and thus breaks ABI for a last time before 3.0
* Many Introspection annotation improvements
* We no longer build the gtk-update-icon-cache utility, and
use a preexisting one, if --enable-gtk2-dependency is passed
to configure
* GtkBuilder can now fill GtkComboBoxText and GtkMenToolButton
widgets with data, as well as GtkFileFilters and GtkTextTagTables
* GtkImage now has a ::use-fallback property to allow generic
fallback with GIcons and icon-names (e.g. for symbolic icons)
* There's a new gtk_text_view_get_cursor_locations() to enable
popup-at-cursor functionality
* The application chooser widgets can now set a custom
dialog heading
* The file chooser and application chooser widgets have received
minor visual improvements
* gtk-auto-mnemonics is now backed by an XSetting
* Defaults for GtkSettings, as well as theme-specific settings,
are now read from key files
* Key themes are now supported again, their syntax has been changed
to be CSS-like
* More objects use GtkStyleContext directly now:
GtkTreeView
GtkIconView
GtkCellArea
GtkCellRendererText
GtkCellRendererPixbuf
GtkCellRendererAccel
GtkCellRendererProgress
* GtkPlug and GtkSocket have been reduced to X11-specific API, and
using them requires including the <gtk/gtkx.h> header, and uses
of GdkNativeWindow in their APIs have been replaced by the X11
Window type.
A number of other API changes were necessary in GDK to ensure
that multiple GDK backends can coexist:
- GdkNativeWindow has been dropped
- The GdkEventOwnerChange owner field is a GdkWindow now
- The GdkEventSelection requestor field is a GdkWindow now
- The GtkWidget::client_event vfunc is gone
- GdkEventClient is gone, together with related API:
gdk_add_client_message_filter
gdk_display_add_client_message_filter
gdk_screen_broadcast_client_message
gdk_event_send_client_message
gdk_event_send_client_message_for_display
gdk_event_send_clientmessage_toall
- gdk_drag_get_protocol_for_display has been changed to
gdk_window_get_drag_protocol
* Migration guide and tutorial and other documentation improvements
* Bug fixes
322926 FileChooser: Alt-Shift-Down should work like Alt-Down
351755 GTK_RANGE (range) -> round_digits should be exposed...
586635 gtk_info_bar_add_button() should return GtkButton*
590459 Text is sometimes not pasted at the right location
598952 Implement object attribute to expose toolkit/source
626336 Warning when activating GtkButton outside of an event...
634677 assertion in finalize assuring that buffer is NULL...
635287 Specify packages when generating GIR
636691 Rendering icons with prelight state doesn't...
638920 gail should provide toolkit as an AtkAttribute
639139 Subclassing GtkIconView broken lately in master
639186 gtk_paper_size_new fails to recognize valid name
639325 Generated introspection broken
639380 Critical warnings when detaching tab
639455 accel cell renderer critical warning
639520 Update docs about colormap to use visual instead.
639531 No error is given when attempting to save to "nonexistent...
639625 Crashes on dereferencing a NULL GtkBorder.
639750 Support css3 colors
639754 Must widget class names begin with uppercase letter?
639767 password not accepted in gnome-screensaver dialog
639792 Regional panel: "Add" dialog: combos not sorted
639822 Synthesized button2/button3 does not transfer source_device
639845 insensitive and separator items in comboboxes not working...
639931 gtk_application_add_window() docs should mention window destr...
639949 pygobject leaks references on GtkWindows
640005 removable media dialog should use app names
640006 choose app dialog shows other apps by default
640011 Selects application on cancel
640105 Crash showing a offscreen window with a textview inside
640161 GtkFileChooserWidget 0xbbf6c0 is mapped but visible=1...
640188 gdk_pixbuf_get_from_drawable missing from migration guide
640195 gdk_cairo_create gets cairo context with badly clipped...
640282 insensitive, active check button becomes sensitive
640313 BadDevice X error when ungrabbing a SLAVE device
640391 Display lines between rows when window is focused
640487 crash on gtk_statusbar_remove_all()
640698 Incompatibility in 'matched-selected' signal invocation
640712 GtkAssistant fonts are too big
640744 mount-operation: don't show the dialog until the tree...
640902 X11 headers included by default in public headers
640965 XCompose does not work with GTK+ 2.99.x
640983 GtkSettings: Fix theme not updating for dark theme
640999 GtkSpinner Class check macro is invalid
641023 assertion `hash_table != NULL' failed in gtkplug.c
641039 Cannot expand/collapse nodes by mouse
641042 assertion `G_IS_OBJECT (object) in gdkevents.c
641059 Fix several bugs handling GtkTrayIcon symbolic colors
641073 Please be consistent with GtkEntryCompletion
641176 Fix crash in gtk_fixed_remove()
* Translation updates
Arabic
Basque
Catalan
Chinese
Esperanto
Estonian
Galician
German
Greek
Hebrew
Italian
Kazakh
Norwegian bokmål
Persian
Punjabi
Spanish
Uighur
Overview of Changes in GTK+ 2.99.2
==================================
@@ -185,7 +47,7 @@ Overview of Changes from GTK+ 2.99.0 to 2.99.1
639105 Port GtkTextDisplay to StyleContext.
639106 New CSS style misses distinction between "selected focused"...
639127 Misc Win32 GDK building problems
639157 GtkOrientable should add/remove "horizontal" and "vertical"...
639157 GtkOrientable should add/ remove "horizontal" and "vertical"...
* Translation updates:
British English
+433
View File
@@ -25,3 +25,436 @@ Installation
============
See the file 'INSTALL'
Release notes for 2.20
======================
* GtkStatusbar now has a message area (see gtk_status_bar_get_message_area)
which makes it easy to place additional widgets inside the statusbar
frame or to replace the label widgets. Previously, this was only possible
by accessing the innards of the statusbar widget directly. Applications
which are doing so may need some adjustments, since the addition of the
message area changed the internal widget hierarchy.
* GtkBuilder no longer sets the "name" property of widgets to the ID
attribute of the <object>. Use gtk_buildable_get_name() instead of
gtk_widget_get_name() to obtain the ID.
* GTK+ now includes introspection data, as a consequence, it gained a
dependency on gobject-introspection. It is possible to build without
introspection by passing --disable-introspection to configure.
Release notes for 2.18
======================
* gtk_tooltip_set_custom now accept a NULL custom_widget to unset the
old custom_widget. Custom_widget does not get destroyed when the
tooltip goes away.
* JPEG2000 support is no longer enabled by default. It must be
explicitly turned on, by passing --with-libjasper to configure.
* GDK has been reworked to implement 'client-side windows'. This offers
exciting new possibilities, such as transformed, offscreen rendering,
but it breaks some long-standing assumptions that applications may
have about GDK windows. Setting the environment variable
GDK_NATIVE_WINDOWS makes GDK create a native X11 window for each
GDK window, which might make problematic applications work better.
* GTK+ calls signal (SIGPIPE, SIG_IGN) during initialization, to ignore
SIGPIPE signals, since these are almost never wanted in graphical
applications. If you do need to handle SIGPIPE for some reason, reset
the handler after gtk_init(), but notice that other libraries (e.g.
libdbus or gvfs) might do similar things.
Release notes for 2.16
======================
* Password entries now display a caps-lock warning. This can be turned off
with the caps-lock-warning property.
* Various orientation-related functions have been deprecated in favour
of the new GtkOrientable interface: gtk_scale_button_get_orientation,
gtk_scale_button_set_orientation, gtk_toolbar_set_orientation.
* The action-proxy interaction has been changed. Widgets that operate as
proxies have to implement the GtkActivatable interface now. GtkActivatable
implementation are responsible for syncing their appearance with the
action and for activating the action. All GTK+ widgets that are commonly
used as proxies implement the GtkActivatable interface.
* The handling of keyboard shortcuts has been changed, to help with a
longstanding complaint about the way GTK+ handles multiple layouts. GTK+
now only uses keys from groups other than the current group if they are
not present in the current group.
Release notes for 2.14
======================
* gtkitemfactory.h is now completely deprecated.
As gtkactiongroup.h and gtkstock.h no longer include the gtkitemfactory.h
header, this might break application using gtk_item_factory_* symbols
without including gtkitemfactory.h - even though this behaviour has never
been supported in the first place.
* The GtkFileSystem semi-private interface has been removed.
The GTK+ filechooser implementation now uses GIO directly, which has
rendered external filesystem implementations unnecessary. Consequently,
the GtkFileSystem interface is no longer available, nor the filechooser
will load any GtkFileSystem implementation.
* GtkComboBox now renders the popdown button insensitive when
the model is empty. Applications which want to populate the list
only before displaying it can set gtk_combo_box_set_button_sensitivity
to GTK_SENSITIVITY_ON, so that the button is always sensitive or
GTK_SENSITIVITY_OFF to make it insensitive respectively.
* GtkAdjustment now enforces that values are restricted to the
range [lower, upper - page_size]. This has always been the documented
behaviour, and the recommended practice is to set page_size to 0
when using adjustments for simple scalar values, like in a slider
or spin button.
* gdk-pixbuf will use GIO for mime type detection if possible. For
this to work, shared-mime-info needs to be installed and XDG_DATA_DIRS
set accordingly at configure time. Otherwise, gdk-pixbuf falls
back to its built-in sniffing implementation.
Release notes for 2.12
======================
* gtk_about_dialog_get/set_name() were deprecated in favour of
gtk_about_dialog_get/set_program_name(), the GtkAboutDialog now uses the
"program-name" property instead of the conflicting "name" property.
* The gdk-pixbuf tiff loader now requires libtiff 3.6.0 or later.
* Support for Windows 9x/ME has officially been removed. It hasn't worked
since 2.6 anyway.
* The GtkTextBufferTargetInfo enumeration values have been changed from
G_MAXUINT-0, G_MAXUINT-1, G_MAXUINT-2, etc, to -1, -2, -3 to stay within
ANSI C limits.
* A change in the handling of _NET_WM_USER_TIME properties on toplevel
windows can cause deadlock problems with window managers that are using
GDK for drawing decorations. In particular, metacity <= 2.18.0 is affected
by this. The problem has been fixed in metacity 2.18.1.
* Semi-private GtkTextLayout api has changed: new GtkTextLayout method
invalidate_cursors(), and new functions gtk_text_layout_invalidate_cursors()
and gtk_text_layout_cursors_changed(), which should be used in place of
gtk_text_layout_invalidate() and gtk_text_layout_changed() if invalidation
is due to marks moved or changed selection; new GtkTextLineDisplay structure
member. Source compatibility is preserved; binary compatibility may break
only if GtkTextLineDisplay structure was created on stack or as a part
of another structure (in particular GnomeCanvas and its clones do not need
recompiling).
* Another new signal has been added to GtkNotebook. The new signal
is called create-window, so this name can no longer be used for signals
in objects derived from GtkNotebook.
* The gtk_notebook_set/get_group_id() functions were found to be insufficient
and have been deprecated in favour of gtk_notebook_set/get_group().
* The move-focus signal has been moved to GtkWidget, to unify the
various implementations of this signal in specific widgets. Great care
has been taken to make sure that all code using this signal continues
to work.
* An unused and hardly visible GtkFrame has been removed from the menu
widget hierarchy when GtkComboBox::appears-as-list style property is
set. Any RC file applying a different style to any widget below the
widget path "gtk-combobox-popup-window.GtkFrame" should take into
account that the frame no longer exists.
* The external print preview application used by GtkPrintOperationPreview
is now passed the print settings on the command line with the
--print-settings parameter pointing to a temp file containing the
settings. The preview application assumes ownership of the file and
should delete it once it does not need it anymore. The --print-settings
commandline option is understood by Evince 0.9.0 and newer. To use a
different print preview application, change the gtk-print-preview-command
setting in your gtkrc file, e.g. gtk-print-preview-command = "ggv %f"
* GtkMenuShell is now defined as an abstract type. It was already
documented as an abstract class, and there is little reason to
instantiate it.
* The GtkTooltips struct (this is the old tooltips API) is now considered
private. Code that used to access this struct, in particular the
tips_data_list field, will need to change. All of the old tooltips
API has been deprecated in favour of a new implementation and
API. This affects all of the gtk_tooltips_ functions, and functions
which take a GtkTooltips argument, such as gtk_tool_item_set_tooltip()
and gtk_menu_tool_button_set_arrow_tooltip().
* The memory management of the GtkRecentManager object has been changed,
as using the screen didn't guarantee that the singleton instance was
correctly destroyed. The screen-related functions have been deprecated,
and should not be used anymore; the GtkRecentManager instance returned by
the gtk_recent_manager_get_default() function is guaranteed to be valid
for the entire lifetime of an application.
* A number of interfaces that have been superseded by newer interfaces for
a long time have finally been deprecated. This includes
gtk_widget_ref/unref(), gtk_rc_style_ref/unref() and the old file selector.
* The various coordinate systems in use in GtkTreeView widgets have
been clarified in the documentation, and in the cause of doing so,
the functions gtk_tree_view_widget_to_tree_coords() and
gtk_tree_view_tree_to_widget_coords() have been deprecated in
favour of a new family of gtk_tree_view_convert_ functions.
* gtk_menu_item_remove_submenu() has been deprecated in favour of
gtk_menu_item_set_submenu (..., NULL).
* gtk_default_draw_check() has been fixed to really decrease the
indicator size by one pixel to ensure an odd size instead of
accidentially increasing it.
Consequently, gtk_cell_renderer_toggle_render() could be fixed to
not subtract 1 from the size passed to gtk_paint_option(), which
was just a workaround for above off-by-two for even sizes (theme
engines now get the real indicator size passed).
The default toggle size of GtkCheckMenuItem and GtkCellRendererToggle
has been changed to 13 to be consistent with GtkCheckButton.
The only visible change with default settings is that the indicator in
GtkCellRendererToggle has changed its size from 11 to 13 and is now
consistent with menus and toggle buttons.
* GTK+ has always required that gtk_init() (or a variant thereof) is
called before any other GTK+ function. Some applications call functions
like gtk_clipboard_get() to check if they need to call gtk_init(),
anyway. A change in GLib 2.14 has recently broken this unsupported
practise. It is worth pointing out that calling gtk_init() twice
does no harm.
Release notes for 2.10
======================
* The hexadecimal Unicode input feature has been reworked. It no longer
blocks the use of the sixteen Ctrl-Shift-<hex digit> key sequences. Now
it only uses Ctrl-Shift-u.
* A memory leak in GtkStyle handling has been fixed. This may expose bugs
in third-party widgets which forget to call gtk_style_attach() in their
realize functions.
* Range widgets like GtkScrollbar now render their arrows insensitive
when the slider is at the end. Applications which react to arrow
clicks even if the slider is at the end may want to use the new
gtk_range_set_[upper/lower]_stepper_sensitivity() functions to
prevent the arrows from being rendered insensitive.
* GtkObject now uses the "floating reference" support in GObject.
GTK_OBJECT_IS_FLOATING() will still work, but direct checking
of the GTK_FLOATING flag will no longer detect the floating
reference. Details about floating references can be found in the docs:
http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#floating-ref
* Accelerators like (_F) are now stripped from labels when they are
displayed in toolbars. If this is not wanted, the feature can be
suppressed by inserting a Unicode control character, e.g ZWNJ.
* The pixbuf theme engine can now customize expanders (in GtkTreeView
and GtkExpander) and resize grips, using the new EXPANDER and
RESIZE_GRIP function values.
* Dialogs created by gtk_about_dialog_new() no longer hide automatically
when the user clicks close. It is the applications responsibility to
hide or destroy the dialog.
* Several new signals have been added to GtkNotebook. Care has been taken
to choose signal names which do not collide with signals added by well-known
derived classes. The names which can no longer be used for signals in
objects derived from GtkNotebook are page-reordered, page-removed and
page-added.
* Due to the interface changes in the file chooser backend interface,
the GTK+ ABI version has been bumped to 2.10.0. Third-party filesystem
backends have to be ported to the new interface, other modules, such as
theme engines, input method modules or pixbuf loaders have to be rebuilt
so that they are installed in the right place for GTK+ to find them.
Release notes for 2.8
=====================
* GTK+ 2.8 and Pango 1.10 require the cairo library.
* The default theme has been renamed to "Raleigh". Existing configurations
specifying the "Default" theme name should still work.
* The GtkTreeView::enable-search property has been changed to control
only typeahead search, not the C-f keybinding to start an interactive
search. To turn off interactive searching completely, you have to
set GtkTreeView::search-column to -1.
* The restriction on using the same cell renderer in multiple columns
of a GtkTreeView is now more strictly enforced.
* In GTK+ 2.8, GtkCalendar uses nl_langinfo() (if available) to determine
the first day of the week. Thus, it is possible to select the first day
of the week independently from the language, by setting LC_TIME.
* In GTK+ 2.8, the gtk-update-icon-cache utility includes image data
in the icon caches, which will make the icon cache files larger than
the one produced by GTK+ 2.6. This change will reduce the memory
overhead of icon themes at runtime, since all GTK+ applications can
share the image data in memory.
* In 2.8, GDK emits GdkEventGrabBroken events when a keyboard or pointer
grab is broken. On X11, this can happen if the same application grabs
again, or if the window used for the grab becomes unviewable. It happens
more often on Win32. Applications which use grabs should pay attention
to these events and do the necessary cleanups when the grab is lost.
* The GIOChannel code for sockets on win32 has been rewritten.
Applications who make non-trivial use of GIOChannels on win32 should
be watched for possible problems.
* GLib 2.8 uses atomic operations to implement reference counting, thus
g_object_ref/unref, g_closure_ref/sink/unref and g_iochannel_ref/unref
can be used without locking in multithreaded applications. Note that
other modifications, like concurrent setting of properties still require
locking.
* g_convert() and related character set conversion functions have been
fixed to emit pending shift states and to not cache iconv descriptors
across multiple calls, since that is problematic for some encodings.
Note that these functions are not suitable for streaming conversions;
use g_iconv() to do streaming conversion.
Release notes for 2.6
=====================
* GTK+ 2.6 supports clipboard persistency. To make use of this feature,
a clipboard manager following the specification at
http://www.freedesktop.org/wiki/Standards/clipboard-manager-spec
must be running. A sample implementation of such a clipboard manager
is available at
http://people.imendio.com/andersca/archives/clipboard-manager-0.3.tar.gz
Applications can use the function gdk_display_supports_clipboard_persistence()
to find out if clipboard persistence is available.
* Notification on clipboard ownership changes via GdkOwnerChange events
requires the XFIXES X extension. Applications can use the function
gdk_display_supports_selection_notification() to find out if ownerchip
change notification is available.
* The icon theme code in GTK+ 2.6 follows the freedesktop.org icon theme
specification. Setting the XDG_DATA_DIRS environtment variable may be
necessary if your icons aren't installed in the default location
/usr/share/icons.
* The icon theme code in GTK+ 2.6 can make use of mmap()able cache files
to avoid a lot of disk searching overhead. GTK+ includes a utility named
gtk-update-icon-cache to generate these cache files. For further details,
see the gtk-update-icon-cache man page or the GTK+ documentation.
* To reduce code size and improve efficiency, GTK+, when compiled
with the GNU toolchain, has separate internal and external entry
points for exported functions. The internal names, which begin with
IA__, may be seen when debugging a GTK+ program.
* The following functions have been deprecated in GTK+ 2.6:
gdk_pango_context_set_colormap
gtk_cell_renderer_editing_canceled
* The new GtkFileChooser widget emphasizes simplicity and thus does
not provide a navigation entry by default when opening files.
Experienced command line users will likely want to make heavy use of
the location dialog brought up by the Control-L key shortcut.
* The GTK+ libraries use an '_' prefix to indicate private symbols that
must not be used by applications. On some platforms, symbols beginning
with prefixes such as _gtk, _gdk, and _pango will be exported
from the library, on others not. In no case can applications
use these private symbols. In addition to that, GTK+ 2.6 makes several
symbols private which were not in any installed header files and
were never intended to be exported.
* The gdk_pixbuf_xlib library included in the contrib/ directory
and the framebuffer GDK backend included in the gdk/linux-fb directory
of GTK+ are provided on an as-is basis and have not been tested at all.
No guarantees about the degree of workingness or about future
compatibility are provided.
* On Unix, the assumption of GLib and GTK+ by default is that filenames on
the filesystem are encoded in UTF-8 rather than the encoding of the locale;
the GTK+ developers consider that having filenames whose interpretation
depends on the current locale is fundamentally a bad idea.
If you have filenames encoded in the encoding of your locale, then you
may want to set the G_FILENAME_ENCODING environment variable:
G_FILENAME_ENCODING=@locale
export G_FILENAME_ENCODING
(Earlier versions of GLib 2.x required a different environment variable
setting; G_BROKEN_FILENAMES=1 to achieve the same effect; this
is still supported, but G_FILENAME_ENCODING is preferred.)
Best integration of GTK+ 2.6 with the environment is achieved by
using a UTF-8 locale.
On Windows, filenames passed to GTK+ should always be in UTF-8, as
in GLib 2.6. This is different than in previous versions of GTK+
where the system codepage was used. As in GLib, for DLL ABI
stability, applications built against previous versions of GTK+ will
use entry points providing the old semantics.
When compiling against GTK+ 2.6, applications intended to be
portable to Windows must take the UTF-8 file name encoding into
consideration, and use the gstdio wrappers to access files whose
names have been constructed from strings returned from GTK+ or GLib.
How to report bugs
==================
Bugs should be reported to the GNOME bug tracking system.
(http://bugzilla.gnome.org, product gtk+.) 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
- What version of X
- 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 tests or demos built with GTK+,
such as demos/gtk-demo/gtk-demo, that would 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 occured.
* Further information such as stack traces may be useful, but is not
necessary. If you do send a stack trace, and the error is an X error,
it will be more useful if the stacktrace is produced running the test
program with the --sync command line option.
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.)
+3 -4
View File
@@ -326,6 +326,7 @@ if test "x$enable_win32_backend" == xyes; then
GDK_BACKENDS="$GDK_BACKENDS win32"
backend_immodules="$backend_immodules,ime"
GDK_WINDOWING="$GDK_WINDOWING
#define GDK_NATIVE_WINDOW_POINTER
#define GDK_WINDOWING_WIN32"
GDK_EXTRA_LIBS="$GDK_EXTRA_LIBS -lgdi32 -limm32 -lshell32 -lole32 -Wl,-luuid"
AM_CONDITIONAL(USE_WIN32, true)
@@ -1673,6 +1674,7 @@ gtk/Makefile
gtk/makefile.msc
gtk/gtkversion.h
gtk/gtk-win32.rc
gtk/theme-bits/Makefile
gtk/tests/Makefile
modules/Makefile
modules/other/Makefile
@@ -1700,10 +1702,7 @@ AC_OUTPUT
included_immodules=${included_immodules//,/ }
included_immodules=${included_immodules:-none}
echo ""
echo " GTK+ $GTK_VERSION"
echo " ==========="
echo ""
echo "configuration:"
echo " GDK backends: $GDK_BACKENDS"
if test "x$enable_x11_backend" = "xyes"; then
echo " X11 extensions: $X_EXTENSIONS"
+11 -3
View File
@@ -120,6 +120,7 @@ gdk_display_get_event
gdk_display_peek_event
gdk_display_put_event
gdk_display_has_pending
gdk_display_add_client_message_filter
gdk_display_set_double_click_time
gdk_display_set_double_click_distance
gdk_display_get_pointer
@@ -203,6 +204,7 @@ gdk_screen_get_monitor_at_window
gdk_screen_get_monitor_height_mm
gdk_screen_get_monitor_width_mm
gdk_screen_get_monitor_plug_name
gdk_screen_broadcast_client_message
gdk_screen_get_setting
gdk_screen_get_font_options
gdk_screen_set_font_options
@@ -775,6 +777,12 @@ gdk_events_get_distance
gdk_event_handler_set
GdkEventFunc
<SUBSECTION>
gdk_event_send_client_message
gdk_event_send_client_message_for_display
gdk_event_send_clientmessage_toall
gdk_add_client_message_filter
<SUBSECTION>
gdk_get_show_events
gdk_set_show_events
@@ -811,8 +819,10 @@ GdkEventFocus
GdkEventConfigure
GdkEventProperty
GdkEventSelection
GdkNativeWindow
GdkEventDND
GdkEventProximity
GdkEventClient
GdkEventWindowState
GdkEventSetting
GdkEventOwnerChange
@@ -881,11 +891,11 @@ gdk_drag_begin
gdk_drag_begin_for_device
gdk_drag_motion
gdk_drop_finish
gdk_drag_get_protocol_for_display
GdkDragProtocol
GdkDragAction
gdk_drag_status
gdk_drag_drop_succeeded
gdk_window_get_drag_protocol
gdk_drag_context_get_actions
gdk_drag_context_get_suggested_action
@@ -924,8 +934,6 @@ GDK_SCREEN_XNUMBER
GDK_SCREEN_XSCREEN
GDK_CURSOR_XCURSOR
GDK_CURSOR_XDISPLAY
GDK_POINTER_TO_XID
GDK_XID_TO_POINTER
gdk_x11_lookup_xdisplay
gdk_x11_get_server_time
gdk_x11_display_get_user_time
+2 -2
View File
@@ -186,9 +186,9 @@
</simplesect>
<simplesect>
<title>Building interfaces</title>
<title>Building UIs</title>
<para>When construcing a more complicated user interface, with dozens
<para>When construcing a more complicated interface, with dozens
or hundreds of widgets, doing all the setup work in C code is
cumbersome, and making changes becomes next to impossible.</para>
+4 -4
View File
@@ -8,11 +8,11 @@
]>
<book id="index" xmlns:xi="http://www.w3.org/2003/XInclude">
<bookinfo>
<title>GTK+ 3 Reference Manual</title>
<title>GTK+ Reference Manual</title>
<releaseinfo>
This document is for GTK+ 3 library; the latest version can be found online at
<ulink role="online-location" url="http://library.gnome.org/devel/gtk/unstable/">http://library.gnome.org/devel/gtk/unstable/</ulink>.
If you're looking for the older GTK+ 2 series of libraries, they can be found under their version numbers; for example, 2.22 is available at <ulink role="online-location" url="http://library.gnome.org/devel/gtk/2.22/">http://library.gnome.org/devel/gtk/2.22/</ulink>.
for GTK+ &version;
The latest version of this documentation can be found on-line at
<ulink role="online-location" url="http://library.gnome.org/devel/gtk/unstable/">http://library.gnome.org/devel/gtk/unstable/</ulink>.
</releaseinfo>
</bookinfo>
+2 -2
View File
@@ -4426,6 +4426,8 @@ gtk_cell_area_foreach
gtk_cell_area_foreach_alloc
gtk_cell_area_event
gtk_cell_area_render
gtk_cell_area_set_style_detail
gtk_cell_area_get_style_detail
gtk_cell_area_get_cell_allocation
gtk_cell_area_get_cell_at_position
gtk_cell_area_create_context
@@ -4555,7 +4557,6 @@ gtk_cell_renderer_get_alignment
gtk_cell_renderer_set_alignment
gtk_cell_renderer_get_padding
gtk_cell_renderer_set_padding
gtk_cell_renderer_get_state
gtk_cell_renderer_is_activatable
<SUBSECTION Width-for-height>
@@ -6009,7 +6010,6 @@ gtk_bindings_activate
gtk_bindings_activate_event
gtk_binding_set_activate
gtk_binding_entry_add_signal
gtk_binding_entry_add_signal_from_string
gtk_binding_entry_skip
gtk_binding_entry_remove
gtk_binding_set_add_path
+1 -1
View File
@@ -1,4 +1,4 @@
#include <gtk/gtkx.h>
#include <gtk/gtk.h>
#include <gtk/gtkunixprint.h>
gtk_about_dialog_get_type
+1 -18
View File
@@ -950,7 +950,7 @@ gtk_arrow_draw (GtkWidget *widget,
</section>
<section>
<title>Check your expand and fill flags</title>
<title>Check your expand flags</title>
<para>
The behaviour of expanding widgets has changed slightly in GTK+ 3,
@@ -961,11 +961,6 @@ gtk_arrow_draw (GtkWidget *widget,
expand flag of the child from being inherited. See
gtk_widget_set_hexpand() and gtk_widget_set_vexpand().
</para>
<para>
If you experience sizing problems with widgets in ported code,
carefully check the #GtkBox::expand and #GtkBox::fill flags of your
boxes.
</para>
</section>
<section>
@@ -1015,18 +1010,6 @@ gtk_arrow_draw (GtkWidget *widget,
</para>
</section>
<section>
<title>GtkEntryCompletion signal parameters</title>
<para>
The #GtkEntryCompletion::match-selected and
#GtkEntryCompletion::cursor-on-match signals were erroneously
given the internal filter model instead of the users model.
This oversight has been fixed in GTK+ 3; if you have handlers
for these signals, they will likely need slight adjustments.
</para>
</section>
<section>
<title>Resize grips</title>
@@ -27,21 +27,6 @@
with possible variants such as the dark theme being named
<filename>gtk-dark.css</filename> in the same directory.
</para>
<para>
If your theme RC file was providing values for #GtkSettings, you
can install a <filename>settings.ini</filename> keyfile along with
the <filename>gtk.css</filename> to provide theme-specific defaults
for settings.
</para>
<para>
Key themes have been converted to CSS syntax too. See the
<link linkend="css-binding-set">GtkCssProvider</link> documentation
information about the syntax. GTK+ looks for key themes in the file
<filename>$datadir/themes/<replaceable>theme</replaceable>/gtk-3.0/gtk-keys.css</filename>, where <replaceable>theme</replaceable> is the current
key theme name.
</para>
</section>
<section id="gtk-migrating-theme-GtkStyleContext-engines">
@@ -429,8 +414,8 @@
<orderedlist>
<listitem>
Replace #GtkWidget::style-set handlers with
#GtkWidget::style-updated handlers.
Replace <literal>style_set()</literal> calls with
<literal>style_updated()</literal>.
</listitem>
<listitem>
+5 -12
View File
@@ -248,7 +248,7 @@ additional environment variables.
<para>
Specifies an IM module to use in preference to the one determined
from the locale. If this isn't set and you are running on the system
from the locale. If this isn't set and you are running on the system
that enables <literal>XSETTINGS</literal> and has a value in
<literal>Gtk/IMModule</literal>, that will be used for the default
IM module.
@@ -260,14 +260,11 @@ additional environment variables.
<para>
Specifies the file listing the IM modules to load. This environment
variable the default value
variable overrides the <literal>im_module_file</literal> specified in
the RC files, which in turn overrides the default value
<filename><replaceable>libdir</replaceable>/gtk-3.0/3.0.0/immodules.cache</filename>
(<replaceable>libdir</replaceable> has the same meaning here as explained for <envar>GTK_PATH</envar>).
</para>
<para>
The <filename>immodules.cache</filename> file is generated by the
<command>gtk-query-immodules-3.0</command> utility.
</para>
</formalpara>
<formalpara>
@@ -300,13 +297,9 @@ nevertheless.
<para>
Specifies the file listing the GdkPixbuf loader modules to load.
This environment variable overrides the default value
<filename><replaceable>libdir</replaceable>/gtk-3.0/3.0.0/loaders.cache</filename>
<filename><replaceable>libdir</replaceable>/gtk-3.0/3.0.0/loaders.cache</filename>
(<replaceable>libdir</replaceable> is the sysconfdir specified when
GTK+ was configured, usually <filename>/usr/local/lib</filename>.)
</para>
<para>
The <filename>loaders.cache</filename> file is generated by the
<command>gdk-pixbuf-query-loaders</command> utility.
GTK+ was configured, usually <filename>/usr/local/lib</filename>.)
</para>
</formalpara>
-2
View File
@@ -3,7 +3,6 @@ gtkactiongroup.sgml
gtkaboutdialog.sgml
gtkadjustment.sgml
gtkbbox.sgml
gtkbindings.sgml
gtkbox.sgml
gtkbuilder.sgml
gtkbutton.sgml
@@ -50,7 +49,6 @@ gtkpaned.sgml
gtkpapersize.sgml
gtkprinter.sgml
gtkprintjob.sgml
gtkprintoperation.sgml
gtkprogressbar.sgml
gtkradioaction.sgml
gtkradiobutton.sgml
+296
View File
@@ -0,0 +1,296 @@
<!-- ##### SECTION Title ##### -->
Bindings
<!-- ##### SECTION Short_Description ##### -->
Key bindings for individual widgets
<!-- ##### SECTION Long_Description ##### -->
<para>
GtkBinding provides a mechanism for configuring GTK+ key bindings through
RC files. This eases key binding adjustments for application developers as
well as users and provides GTK+ users or administrators with high key
binding configurability which requires no application or toolkit side changes.
</para>
<refsect2>
<anchor id="gtk-bindings-install"/>
<title>Installing a key binding</title>
<para>
A resource file binding consists of a 'binding' definition and a match
statement to apply the binding to specific widget types. Details on the
matching mechanism are described under
<link linkend="gtkrc-pathnames-and-patterns">Pathnames and patterns</link>.
Inside the binding definition, key combinations are bound to specific signal
emissions on the target widget. Key combinations are strings consisting of
an optional #GdkModifierType name and
<link linkend="gdk-Keyboard-Handling">key names</link> such as those defined
in <filename>&lt;gdk/gdkkeysyms.h&gt;</filename> or returned from
gdk_keyval_name(), they have to be parsable by gtk_accelerator_parse().
Specifications of signal emissions consist of a string identifying the signal
name, and a list of signal specific arguments in parenthesis.
</para>
<para>
For example for binding Control and the left or right cursor keys of a
#GtkEntry widget to the #GtkEntry::move-cursor signal, so movement occurs
in 3 letter steps, the following binding can be used:
<informalexample><programlisting>
binding "MoveCursor3" {
bind "&lt;Control&gt;Right" {
"move-cursor" (visual-positions, 3, 0)
}
bind "&lt;Control&gt;Left" {
"move-cursor" (visual-positions, -3, 0)
}
}
class "GtkEntry" binding "MoveCursor3"
</programlisting></informalexample>
</para>
<anchor id="gtk-bindings-unbind"/>
<title>Unbinding existing key bindings</title>
<para>
GTK+ already defines a number of useful bindings for the widgets it provides.
Because custom bindings set up in RC files take precedence over the default
bindings shipped with GTK+, overriding existing bindings as demonstrated in
<link linkend="gtk-bindings-install">Installing a key binding</link>
works as expected. The same mechanism can not be used to "unbind" existing
bindings, however.
<informalexample><programlisting>
binding "MoveCursor3" {
bind "&lt;Control&gt;Right" { }
bind "&lt;Control&gt;Left" { }
}
class "GtkEntry" binding "MoveCursor3"
</programlisting></informalexample>
The above example will not have the desired effect of causing
"&lt;Control&gt;Right" and "&lt;Control&gt;Left" key presses to be ignored
by GTK+. Instead, it just causes any existing bindings from the bindings
set "MoveCursor3" to be deleted, so when "&lt;Control&gt;Right" or
"&lt;Control&gt;Left" are pressed, no binding for these keys is found in
binding set "MoveCursor3". GTK+ will thus continue to search for matching
key bindings, and will eventually lookup and find the default GTK+ bindings
for entries which implement word movement. To keep GTK+ from activating its
default bindings, the "unbind" keyword can be used like this:
<informalexample><programlisting>
binding "MoveCursor3" {
unbind "&lt;Control&gt;Right"
unbind "&lt;Control&gt;Left"
}
class "GtkEntry" binding "MoveCursor3"
</programlisting></informalexample>
Now, GTK+ will find a match when looking up "&lt;Control&gt;Right" and
"&lt;Control&gt;Left" key presses before it resorts to its default
bindings, and the match instructs it to abort ("unbind") the search, so
the key presses are not consumed by this widget. As usual, further processing
of the key presses, e.g. by an entry's parent widget, is now possible.
</para>
<para>
The "unbind" functionality has been introduced in GTK+ 2.12.
</para>
</refsect2>
<!-- ##### SECTION See_Also ##### -->
<para>
<variablelist>
<varlistentry>
<term><link linkend="gtk-keyboard-accelerators">Keyboard Accelerators</link>
</term>
<listitem><para>installing and using keyboard short-cuts.</para></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="Resource-Files">Resource Files</link>
</term>
<listitem><para>GTK+ Resource Files - behavior and style definitions.</para></listitem>
</varlistentry>
</variablelist>
</para>
<!-- ##### SECTION Stability_Level ##### -->
<!-- ##### SECTION Image ##### -->
<!-- ##### STRUCT GtkBindingSet ##### -->
<para>
A binding set maintains a list of activatable key bindings.
A single binding set can match multiple types of widgets.
Similar to styles, widgets can be mapped by widget name paths, widget
class paths or widget class types. When a binding within a set is
matched upon activation, an action signal is emitted on the target
widget to carry out the actual activation.
</para>
@set_name: unique binding set name
@priority: unused
@widget_path_pspecs: widgets matched by path that this binding set applies to
@widget_class_pspecs: widgets matched by class path that this binding set applies to
@class_branch_pspecs: widgets matched by class that this binding set applies to
@entries: the key binding entries in this binding set
@current: implementation detail
@parsed: whether this binding set stems from an RC file and is reset upon theme changes
<!-- ##### STRUCT GtkBindingEntry ##### -->
<para>
Each key binding element of a binding sets binding list is represented by
a #GtkBindingEntry.
</para>
@keyval: key value to match
@modifiers: key modifier to match
@binding_set: binding set this entry belongs to
@destroyed: implementation detail
@in_emission: implementation detail
@marks_unbound: implementation detail
@set_next: linked list of entries maintained by binding set
@hash_next: implementation detail
@signals: action signals of this entry
<!-- ##### STRUCT GtkBindingSignal ##### -->
<anchor id="keybinding-signals"/>
<para>
A #GtkBindingSignal stores the necessary information to activate a widget
in response to a key press via a signal emission.
</para>
@next: implementation detail
@signal_name: the action signal to be emitted
@n_args: number of arguments specified for the signal
@args: the arguments specified for the signal
<!-- ##### STRUCT GtkBindingArg ##### -->
<para>
A #GtkBindingArg holds the data associated with an argument for a
key binding signal emission as stored in #GtkBindingSignal.
</para>
@arg_type: implementation detail
<!-- ##### FUNCTION gtk_binding_entry_add_signall ##### -->
<para>
</para>
@binding_set:
@keyval:
@modifiers:
@signal_name:
@binding_args:
<!-- ##### FUNCTION gtk_binding_set_new ##### -->
<para>
</para>
@set_name:
@Returns:
<!-- ##### FUNCTION gtk_binding_set_by_class ##### -->
<para>
</para>
@object_class:
@Returns:
<!-- ##### FUNCTION gtk_binding_set_find ##### -->
<para>
</para>
@set_name:
@Returns:
<!-- ##### FUNCTION gtk_bindings_activate ##### -->
<para>
</para>
@object:
@keyval:
@modifiers:
@Returns:
<!-- ##### FUNCTION gtk_bindings_activate_event ##### -->
<para>
</para>
@object:
@event:
@Returns:
<!-- ##### FUNCTION gtk_binding_set_activate ##### -->
<para>
</para>
@binding_set:
@keyval:
@modifiers:
@object:
@Returns:
<!-- ##### FUNCTION gtk_binding_entry_add_signal ##### -->
<para>
</para>
@binding_set:
@keyval:
@modifiers:
@signal_name:
@n_args:
@Varargs:
<!-- ##### FUNCTION gtk_binding_entry_skip ##### -->
<para>
</para>
@binding_set:
@keyval:
@modifiers:
<!-- ##### FUNCTION gtk_binding_entry_remove ##### -->
<para>
</para>
@binding_set:
@keyval:
@modifiers:
<!-- ##### FUNCTION gtk_binding_set_add_path ##### -->
<para>
</para>
@binding_set:
@path_type:
@path_pattern:
@priority:
File diff suppressed because it is too large Load Diff
+265
View File
@@ -0,0 +1,265 @@
<!-- ##### SECTION Title ##### -->
GtkPreview
<!-- ##### SECTION Short_Description ##### -->
A widget to display RGB or grayscale data
<!-- ##### SECTION Long_Description ##### -->
<para>
The #GtkPreview widget provides a simple interface
used to display images as RGB or grayscale data.
It's deprecated; just use a #GdkPixbuf displayed by a #GtkImage, or
perhaps a #GtkDrawingArea. #GtkPreview has no advantage over those
approaches.
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
<variablelist>
<varlistentry>
<term>#GdkRGB</term>
<listitem><para>the backend used by #GtkPreview.</para></listitem>
</varlistentry>
</variablelist>
</para>
<!-- ##### SECTION Stability_Level ##### -->
<!-- ##### STRUCT GtkPreview ##### -->
<para>
The #GtkPreview-struct struct contains private data only, and
should be accessed using the functions below.
</para>
<!-- ##### ARG GtkPreview:expand ##### -->
<para>
</para>
<!-- ##### STRUCT GtkPreviewInfo ##### -->
<para>
Contains information about global properties
of preview widgets.
The #GtkPreviewInfo struct contains the following fields.
(These fields should be considered read-only. They should never be set by
an application.)
<informaltable pgwide="1" frame="none" role="struct">
<tgroup cols="2"><colspec colwidth="2*"/><colspec colwidth="8*"/>
<tbody>
<row>
<entry>#GdkVisual *visual;</entry>
<entry>the visual used by all previews.</entry>
</row>
<row>
<entry>#GdkColormap *cmap;</entry>
<entry>the colormap used by all previews.</entry>
</row>
<row>
<entry>gdouble gamma;</entry>
<entry>the gamma correction value used by all previews (See gtk_preview_set_gamma()).</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>
@lookup:
@gamma:
<!-- ##### UNION GtkDitherInfo ##### -->
<para>
This union not used in GTK+.
</para>
<!-- ##### FUNCTION gtk_preview_uninit ##### -->
<para>
This function is deprecated and does nothing.
</para>
<!-- ##### FUNCTION gtk_preview_new ##### -->
<para>
Create a new preview widget.
</para>
@type: the type data contained by the widget.
(Grayscale or RGB)
@Returns: a new #GtkPreview
<!-- ##### FUNCTION gtk_preview_size ##### -->
<para>
Set the size that the preview widget will request
in response to a "size_request" signal. The
drawing area may actually be allocated a size
larger than this depending on how it is packed
within the enclosing containers. The effect
of this is determined by whether the preview
is set to expand or not (see gtk_preview_expand())
</para>
@preview: a #GtkPreview.
@width: the new width.
@height: the new height.
<!-- ##### FUNCTION gtk_preview_put ##### -->
<para>
Takes a portion of the contents of a preview widget
and draws it onto the given drawable, @window.
</para>
@preview: a #GtkPreview.
@window: a window or pixmap.
@gc: The graphics context for the operation. Only the
clip mask for this GC matters.
@srcx: the x coordinate of the upper left corner in the source image.
@srcy: the y coordinate of the upper left corner in the source image.
@destx: the x coordinate of the upper left corner in the destination image.
@desty: the y coordinate of the upper left corner in the destination image.
@width: the width of the rectangular portion to draw.
@height: the height of the rectangular portion to draw.
<!-- ##### FUNCTION gtk_preview_draw_row ##### -->
<para>
Sets the data for a portion of a row.
</para>
@preview: a #GtkPreview.
@data: the new data for the portion. It should contain
@w bytes of data if the preview is of type
GTK_TYPE_GRAYSCALE, and 3*@w bytes of data
if the preview is of type GTK_TYPE_COLOR.
@x: the starting value on the row to set.
@y: the row to change.
@w: the number of pixels in the row to change.
<!-- ##### FUNCTION gtk_preview_set_expand ##### -->
<para>
Determines the way that the the preview widget behaves
when the size it is allocated is larger than the requested
size. If @expand is %FALSE, then the preview's window
and buffer will be no larger than the size set with
gtk_preview_size(), and the data set will be centered
in the allocation if it is larger. If @expand is %TRUE
then the window and buffer will expand with the allocation;
the application is responsible for catching
the "size_allocate" signal and providing the data
appropriate for this size.
</para>
@preview: a #GtkPreview.
@expand: whether the preview's window should expand or not.
<!-- ##### FUNCTION gtk_preview_set_gamma ##### -->
<para>
Set the gamma-correction value for all preview widgets.
(This function will eventually be replaced with a
function that sets a per-preview-widget gamma value).
The resulting intensity is given by:
<literal>destination_value * pow (source_value/255, 1/gamma)</literal>.
The gamma value is applied when the data is
set with gtk_preview_draw_row() so changing this
value will not affect existing data in preview
widgets.
</para>
@gamma_: the new gamma value.
<!-- ##### FUNCTION gtk_preview_set_color_cube ##### -->
<para>
This function is deprecated and does nothing. GdkRGB
automatically picks an optimium color cube for the
display.
</para>
@nred_shades: ignored
@ngreen_shades: ignored
@nblue_shades: ignored
@ngray_shades: ignored
<!-- ##### FUNCTION gtk_preview_set_install_cmap ##### -->
<para>
This function is deprecated
and does nothing. GdkRGB will automatically pick
a private colormap if it cannot allocate sufficient
colors.
</para>
@install_cmap: ignored.
<!-- ##### FUNCTION gtk_preview_set_reserved ##### -->
<para>
This function is deprecated and does nothing.
</para>
@nreserved: ignored.
<!-- ##### FUNCTION gtk_preview_set_dither ##### -->
<para>
Set the dithering mode for the display.
</para>
@preview: a #GtkPreview.
@dither: the dithering mode.
<!-- ##### FUNCTION gtk_preview_get_visual ##### -->
<para>
Returns the visual used by preview widgets. This
function is deprecated, and you should use
gdk_rgb_get_visual() instead.
</para>
@Returns: the visual for previews.
<!-- ##### FUNCTION gtk_preview_get_cmap ##### -->
<para>
Returns the colormap used by preview widgets. This
function is deprecated, and you should use
gdk_rgb_get_cmap() instead.
</para>
@Returns: the colormap for previews.
<!-- ##### FUNCTION gtk_preview_get_info ##### -->
<para>
Return a #GtkPreviewInfo structure containing
global information about preview widgets.
</para>
@Returns: a #GtkPreviewInfo structure. The return
value belongs to GTK+ and must not be modified
or freed.
<!-- ##### FUNCTION gtk_preview_reset ##### -->
<para>
This function is deprecated and does nothing. It was
once used for changing the colormap and visual on the fly.
</para>
@@ -0,0 +1,701 @@
<!-- ##### SECTION Title ##### -->
GtkPrintOperation
<!-- ##### SECTION Short_Description ##### -->
High-level Printing API
<!-- ##### SECTION Long_Description ##### -->
<para>
GtkPrintOperation is the high-level, portable printing API. It looks
a bit different than other GTK+ dialogs such as the #GtkFileChooser,
since some platforms don't expose enough infrastructure to implement
a good print dialog. On such platforms, GtkPrintOperation uses the
native print dialog. On platforms which do not provide a native
print dialog, GTK+ uses its own, see #GtkPrintUnixDialog.
</para>
<para>
The typical way to use the high-level printing API is to create a
#GtkPrintOperation object with gtk_print_operation_new() when the user
selects to print. Then you set some properties on it, e.g. the page size,
any #GtkPrintSettings from previous print operations, the number of pages,
the current page, etc.
</para>
<para>
Then you start the print operation by calling gtk_print_operation_run().
It will then show a dialog, let the user select a printer and options.
When the user finished the dialog various signals will be emitted on the
#GtkPrintOperation, the main one being ::draw-page, which you are supposed
to catch and render the page on the provided #GtkPrintContext using Cairo.
</para>
<example>
<title>The high-level printing API</title>
<programlisting>
static GtkPrintSettings *settings = NULL;
static void
do_print (void)
{
GtkPrintOperation *print;
GtkPrintOperationResult res;
print = gtk_print_operation_new (<!-- -->);
if (settings != NULL)
gtk_print_operation_set_print_settings (print, settings);
g_signal_connect (print, "begin_print", G_CALLBACK (begin_print), NULL);
g_signal_connect (print, "draw_page", G_CALLBACK (draw_page), NULL);
res = gtk_print_operation_run (print, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
GTK_WINDOW (main_window), NULL);
if (res == GTK_PRINT_OPERATION_RESULT_APPLY)
{
if (settings != NULL)
g_object_unref (settings);
settings = g_object_ref (gtk_print_operation_get_print_settings (print));
}
g_object_unref (print);
}
</programlisting>
</example>
<para>
By default GtkPrintOperation uses an external application to do
print preview. To implement a custom print preview, an application
must connect to the preview signal. The functions
gtk_print_operation_print_preview_render_page(),
gtk_print_operation_preview_end_preview() and
gtk_print_operation_preview_is_selected() are useful
when implementing a print preview.
</para>
<para>
Printing support was added in GTK+ 2.10.
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
#GtkPrintContext, #GtkPrintUnixDialog
</para>
<!-- ##### SECTION Stability_Level ##### -->
<!-- ##### SECTION Image ##### -->
<!-- ##### STRUCT GtkPrintOperation ##### -->
<para>
</para>
<!-- ##### SIGNAL GtkPrintOperation::begin-print ##### -->
<para>
</para>
@printoperation:
@context:
<!-- ##### SIGNAL GtkPrintOperation::create-custom-widget ##### -->
<para>
</para>
@printoperation:
@Returns:
<!-- ##### SIGNAL GtkPrintOperation::custom-widget-apply ##### -->
<para>
</para>
@printoperation:
@widget:
<!-- ##### SIGNAL GtkPrintOperation::done ##### -->
<para>
</para>
@printoperation: the object which received the signal.
@arg1:
<!-- ##### SIGNAL GtkPrintOperation::draw-page ##### -->
<para>
</para>
@printoperation: the object which received the signal.
@arg1:
@arg2:
<!-- ##### SIGNAL GtkPrintOperation::end-print ##### -->
<para>
</para>
@printoperation: the object which received the signal.
@arg1:
<!-- ##### SIGNAL GtkPrintOperation::paginate ##### -->
<para>
</para>
@printoperation: the object which received the signal.
@arg1:
@Returns:
<!-- ##### SIGNAL GtkPrintOperation::preview ##### -->
<para>
</para>
@printoperation: the object which received the signal.
@arg1:
@arg2:
@arg3:
@Returns:
<!-- ##### SIGNAL GtkPrintOperation::request-page-setup ##### -->
<para>
</para>
@printoperation: the object which received the signal.
@arg1:
@arg2:
@arg3:
<!-- ##### SIGNAL GtkPrintOperation::status-changed ##### -->
<para>
</para>
@printoperation: the object which received the signal.
<!-- ##### SIGNAL GtkPrintOperation::update-custom-widget ##### -->
<para>
</para>
@printoperation: the object which received the signal.
@widget:
@arg1:
@arg2:
<!-- ##### ARG GtkPrintOperation:allow-async ##### -->
<para>
</para>
<!-- ##### ARG GtkPrintOperation:current-page ##### -->
<para>
</para>
<!-- ##### ARG GtkPrintOperation:custom-tab-label ##### -->
<para>
</para>
<!-- ##### ARG GtkPrintOperation:default-page-setup ##### -->
<para>
</para>
<!-- ##### ARG GtkPrintOperation:embed-page-setup ##### -->
<para>
</para>
<!-- ##### ARG GtkPrintOperation:export-filename ##### -->
<para>
</para>
<!-- ##### ARG GtkPrintOperation:has-selection ##### -->
<para>
</para>
<!-- ##### ARG GtkPrintOperation:job-name ##### -->
<para>
</para>
<!-- ##### ARG GtkPrintOperation:n-pages ##### -->
<para>
</para>
<!-- ##### ARG GtkPrintOperation:n-pages-to-print ##### -->
<para>
</para>
<!-- ##### ARG GtkPrintOperation:print-settings ##### -->
<para>
</para>
<!-- ##### ARG GtkPrintOperation:show-progress ##### -->
<para>
</para>
<!-- ##### ARG GtkPrintOperation:status ##### -->
<para>
</para>
<!-- ##### ARG GtkPrintOperation:status-string ##### -->
<para>
</para>
<!-- ##### ARG GtkPrintOperation:support-selection ##### -->
<para>
</para>
<!-- ##### ARG GtkPrintOperation:track-print-status ##### -->
<para>
</para>
<!-- ##### ARG GtkPrintOperation:unit ##### -->
<para>
</para>
<!-- ##### ARG GtkPrintOperation:use-full-page ##### -->
<para>
</para>
<!-- ##### ENUM GtkPrintStatus ##### -->
<para>
The status gives a rough indication of the completion
of a running print operation.
</para>
@GTK_PRINT_STATUS_INITIAL: The printing has not started yet; this
status is set initially, and while the print dialog is shown.
@GTK_PRINT_STATUS_PREPARING: This status is set while the begin-print
signal is emitted and during pagination.
@GTK_PRINT_STATUS_GENERATING_DATA: This status is set while the
pages are being rendered.
@GTK_PRINT_STATUS_SENDING_DATA: The print job is being sent off to the
printer.
@GTK_PRINT_STATUS_PENDING: The print job has been sent to the printer,
but is not printed for some reason, e.g. the printer may be stopped.
@GTK_PRINT_STATUS_PENDING_ISSUE: Some problem has occurred during
printing, e.g. a paper jam.
@GTK_PRINT_STATUS_PRINTING: The printer is processing the print job.
@GTK_PRINT_STATUS_FINISHED: The printing has been completed successfully.
@GTK_PRINT_STATUS_FINISHED_ABORTED: The printing has been aborted.
<!-- ##### ENUM GtkPrintOperationAction ##### -->
<para>
The @action parameter to gtk_print_operation_run()
determines what action the print operation should perform.
</para>
@GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG: Show the print dialog.
@GTK_PRINT_OPERATION_ACTION_PRINT: Start to print without showing
the print dialog, based on the current print settings.
@GTK_PRINT_OPERATION_ACTION_PREVIEW: Show the print preview.
@GTK_PRINT_OPERATION_ACTION_EXPORT: Export to a file. This requires
the export-filename property to be set.
<!-- ##### ENUM GtkPrintOperationResult ##### -->
<para>
A value of this type is returned by gtk_print_operation_run().
</para>
@GTK_PRINT_OPERATION_RESULT_ERROR: An error has occured.
@GTK_PRINT_OPERATION_RESULT_APPLY: The print settings should be stored.
@GTK_PRINT_OPERATION_RESULT_CANCEL: The print operation has been canceled,
the print settings should not be stored.
@GTK_PRINT_OPERATION_RESULT_IN_PROGRESS: The print operation is not complete
yet. This value will only be returned when running asynchronously.
<!-- ##### ENUM GtkPrintError ##### -->
<para>
Error codes that identify various errors that can occur while
using the GTK+ printing support.
</para>
@GTK_PRINT_ERROR_GENERAL: An unspecified error occurred.
@GTK_PRINT_ERROR_INTERNAL_ERROR: An internal error occurred.
@GTK_PRINT_ERROR_NOMEM: A memory allocation failed.
@GTK_PRINT_ERROR_INVALID_FILE: An error occurred while loading a page setup
or paper size from a key file.
<!-- ##### MACRO GTK_PRINT_ERROR ##### -->
<para>
The #GQuark used for #GtkPrintError errors.
</para>
<!-- ##### FUNCTION gtk_print_operation_new ##### -->
<para>
</para>
@void:
@Returns:
<!-- ##### FUNCTION gtk_print_operation_set_allow_async ##### -->
<para>
</para>
@op:
@allow_async:
<!-- ##### FUNCTION gtk_print_operation_get_error ##### -->
<para>
</para>
@op:
@error:
<!-- ##### FUNCTION gtk_print_operation_set_default_page_setup ##### -->
<para>
</para>
@op:
@default_page_setup:
<!-- ##### FUNCTION gtk_print_operation_get_default_page_setup ##### -->
<para>
</para>
@op:
@Returns:
<!-- ##### FUNCTION gtk_print_operation_set_print_settings ##### -->
<para>
</para>
@op:
@print_settings:
<!-- ##### FUNCTION gtk_print_operation_get_print_settings ##### -->
<para>
</para>
@op:
@Returns:
<!-- ##### FUNCTION gtk_print_operation_set_job_name ##### -->
<para>
</para>
@op:
@job_name:
<!-- ##### FUNCTION gtk_print_operation_set_n_pages ##### -->
<para>
</para>
@op:
@n_pages:
<!-- ##### FUNCTION gtk_print_operation_get_n_pages_to_print ##### -->
<para>
</para>
@op:
@Returns:
<!-- ##### FUNCTION gtk_print_operation_set_current_page ##### -->
<para>
</para>
@op:
@current_page:
<!-- ##### FUNCTION gtk_print_operation_set_use_full_page ##### -->
<para>
</para>
@op:
@full_page:
<!-- ##### FUNCTION gtk_print_operation_set_unit ##### -->
<para>
</para>
@op:
@unit:
<!-- ##### FUNCTION gtk_print_operation_set_export_filename ##### -->
<para>
</para>
@op:
@filename:
<!-- ##### FUNCTION gtk_print_operation_set_show_progress ##### -->
<para>
</para>
@op:
@show_progress:
<!-- ##### FUNCTION gtk_print_operation_set_track_print_status ##### -->
<para>
</para>
@op:
@track_status:
<!-- ##### FUNCTION gtk_print_operation_set_custom_tab_label ##### -->
<para>
</para>
@op:
@label:
<!-- ##### FUNCTION gtk_print_operation_run ##### -->
<para>
</para>
@op:
@action:
@parent:
@error:
@Returns:
<!-- ##### FUNCTION gtk_print_operation_cancel ##### -->
<para>
</para>
@op:
<!-- ##### FUNCTION gtk_print_operation_draw_page_finish ##### -->
<para>
</para>
@op:
<!-- ##### FUNCTION gtk_print_operation_set_defer_drawing ##### -->
<para>
</para>
@op:
<!-- ##### FUNCTION gtk_print_operation_get_status ##### -->
<para>
</para>
@op:
@Returns:
<!-- ##### FUNCTION gtk_print_operation_get_status_string ##### -->
<para>
</para>
@op:
@Returns:
<!-- ##### FUNCTION gtk_print_operation_is_finished ##### -->
<para>
</para>
@op:
@Returns:
<!-- ##### FUNCTION gtk_print_operation_set_support_selection ##### -->
<para>
</para>
@op:
@support_selection:
<!-- ##### FUNCTION gtk_print_operation_get_support_selection ##### -->
<para>
</para>
@op:
@Returns:
<!-- ##### FUNCTION gtk_print_operation_set_has_selection ##### -->
<para>
</para>
@op:
@has_selection:
<!-- ##### FUNCTION gtk_print_operation_get_has_selection ##### -->
<para>
</para>
@op:
@Returns:
<!-- ##### FUNCTION gtk_print_operation_set_embed_page_setup ##### -->
<para>
</para>
@op:
@embed:
<!-- ##### FUNCTION gtk_print_operation_get_embed_page_setup ##### -->
<para>
</para>
@op:
@Returns:
<!-- ##### FUNCTION gtk_print_run_page_setup_dialog ##### -->
<para>
</para>
@parent:
@page_setup:
@settings:
@Returns:
<!-- ##### USER_FUNCTION GtkPageSetupDoneFunc ##### -->
<para>
</para>
@page_setup:
@data:
<!-- ##### FUNCTION gtk_print_run_page_setup_dialog_async ##### -->
<para>
</para>
@parent:
@page_setup:
@settings:
@done_cb:
@data:
<!-- ##### STRUCT GtkPrintOperationPreview ##### -->
<para>
</para>
<!-- ##### SIGNAL GtkPrintOperationPreview::got-page-size ##### -->
<para>
</para>
@printoperationpreview: the object which received the signal.
@arg1:
@arg2:
<!-- ##### SIGNAL GtkPrintOperationPreview::ready ##### -->
<para>
</para>
@printoperationpreview: the object which received the signal.
@arg1:
<!-- ##### FUNCTION gtk_print_operation_preview_end_preview ##### -->
<para>
</para>
@preview:
<!-- ##### FUNCTION gtk_print_operation_preview_is_selected ##### -->
<para>
</para>
@preview:
@page_nr:
@Returns:
<!-- ##### FUNCTION gtk_print_operation_preview_render_page ##### -->
<para>
</para>
@preview:
@page_nr:
+215
View File
@@ -0,0 +1,215 @@
<!-- ##### SECTION Title ##### -->
GtkProgress
<!-- ##### SECTION Short_Description ##### -->
Base class for GtkProgressBar
<!-- ##### SECTION Long_Description ##### -->
<para>
A #GtkProgress is the abstract base class used to derive
a #GtkProgressBar which provides a visual representation of
the progress of a long running operation.
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
</para>
<!-- ##### SECTION Stability_Level ##### -->
<!-- ##### SECTION Image ##### -->
<!-- ##### STRUCT GtkProgress ##### -->
<para>
The #GtkProgress-struct struct contains private data only.
and should be accessed using the functions below.
</para>
<!-- ##### ARG GtkProgress:activity-mode ##### -->
<para>
</para>
<!-- ##### ARG GtkProgress:show-text ##### -->
<para>
</para>
<!-- ##### ARG GtkProgress:text-xalign ##### -->
<para>
</para>
<!-- ##### ARG GtkProgress:text-yalign ##### -->
<para>
</para>
<!-- ##### FUNCTION gtk_progress_set_show_text ##### -->
<para>
Controls whether progress text is shown.
</para>
@progress: a #GtkProgress.
@show_text: a boolean indicating whether the progress text
is shown.
<!-- ##### FUNCTION gtk_progress_set_text_alignment ##### -->
<para>
Controls the alignment of the text within the progress bar area.
</para>
@progress: a #GtkProgress.
@x_align: a number between 0.0 and 1.0 indicating the horizontal
alignment of the progress text within the #GtkProgress.
@y_align: a number between 0.0 and 1.0 indicating the vertical
alignment of the progress text within the #GtkProgress.
<!-- ##### FUNCTION gtk_progress_set_format_string ##### -->
<para>
Sets a format string used to display text indicating the
current progress. The string can contain the following substitution characters:
<itemizedlist>
<listitem>
<para>
&percnt;v - the current progress value.
</para>
</listitem>
<listitem>
<para>
&percnt;l - the lower bound for the progress value.
</para>
</listitem>
<listitem>
<para>
&percnt;u - the upper bound for the progress value.
</para>
</listitem>
<listitem>
<para>
&percnt;p - the current progress percentage.
</para>
</listitem>
</itemizedlist>
</para>
@progress: a #GtkProgress.
@format: a string used to display progress text, or %NULL
to restore to the default format.
<!-- ##### FUNCTION gtk_progress_set_adjustment ##### -->
<para>
Associates a #GtkAdjustment with the #GtkProgress. A #GtkAdjustment
is used to represent the upper and lower bounds and the step interval
of the underlying value for which progress is shown.
</para>
@progress: a #GtkProgress.
@adjustment: the #GtkAdjustment to be associated with the #GtkProgress.
<!-- ##### FUNCTION gtk_progress_set_percentage ##### -->
<para>
Sets the current percentage completion for the #GtkProgress.
</para>
@progress: a #GtkProgress.
@percentage: the percentage complete which must be between 0.0
and 1.0.
<!-- ##### FUNCTION gtk_progress_set_value ##### -->
<para>
Sets the value within the #GtkProgress to an absolute value.
The value must be within the valid range of values for the
underlying #GtkAdjustment.
</para>
@progress: a #GtkProgress.
@value: the value indicating the current completed amount.
<!-- ##### FUNCTION gtk_progress_get_value ##### -->
<para>
Returns the current progress complete value.
</para>
@progress: a #GtkProgress.
@Returns: the current progress complete value.
<!-- ##### FUNCTION gtk_progress_set_activity_mode ##### -->
<para>
A #GtkProgress can be in one of two different modes: percentage
mode (the default) and activity mode. In activity mode, the
progress is simply indicated as activity rather than as a percentage
complete.
</para>
@progress: a #GtkProgress.
@activity_mode: a boolean, %TRUE for activity mode.
<!-- ##### FUNCTION gtk_progress_get_current_text ##### -->
<para>
Returns the current text associated with the #GtkProgress. This
text is the based on the underlying format string after any substitutions
are made.
</para>
@progress: a #GtkProgress.
@Returns: the text indicating the current progress.
<!-- ##### FUNCTION gtk_progress_get_text_from_value ##### -->
<para>
Returns the text indicating the progress based on the supplied value.
The current value for the #GtkProgress remains unchanged.
</para>
@progress: a #GtkProgress.
@value: an absolute progress value to use when formatting the progress text.
@Returns: a string indicating the progress.
<!-- ##### FUNCTION gtk_progress_get_current_percentage ##### -->
<para>
Returns the current progress as a percentage.
</para>
@progress: a #GtkProgress.
@Returns: a number between 0.0 and 1.0 indicating the percentage complete.
<!-- ##### FUNCTION gtk_progress_get_percentage_from_value ##### -->
<para>
Returns the progress as a percentage calculated from the supplied
absolute progress value.
</para>
@progress: a #GtkProgress.
@value: an absolute progress value.
@Returns: a number between 0.0 and 1.0 indicating the percentage complete
represented by @value.
<!-- ##### FUNCTION gtk_progress_configure ##### -->
<para>
Allows the configuration of the minimum, maximum, and current values for
the #GtkProgress.
</para>
@progress: a #GtkProgress.
@value: the current progress value.
@min: the minimum progress value.
@max: the maximum progress value.
+3 -3
View File
@@ -2,7 +2,7 @@
Resource Files
<!-- ##### SECTION Short_Description ##### -->
Deprecated routines for handling resource files
Routines for handling resource files
<!-- ##### SECTION Long_Description ##### -->
<para>
@@ -10,10 +10,10 @@ GTK+ provides resource file mechanism for configuring
various aspects of the operation of a GTK+ program
at runtime.
</para>
<warning>
<para>
In GTK+ 3.0, resource files have been deprecated and replaced
by CSS-like style sheets, which are understood by #GtkCssProvider.
</warning>
</para>
<refsect2><title>Default files</title>
<para>
+134
View File
@@ -0,0 +1,134 @@
<!-- ##### SECTION Title ##### -->
GtkRuler
<!-- ##### SECTION Short_Description ##### -->
Base class for horizontal or vertical rulers
<!-- ##### SECTION Long_Description ##### -->
<note>
<para>
This widget is considered too specialized/little-used for
GTK+, and will in the future be moved to some other package. If
your application needs this widget, feel free to use it, as the
widget does work and is useful in some applications; it's just not
of general interest. However, we are not accepting new features for
the widget, and it will eventually move out of the GTK+
distribution.
</para>
</note>
<para>
The GTKRuler widget is a base class for horizontal and vertical rulers. Rulers
are used to show the mouse pointer's location in a window. The ruler can either
be horizontal or vertical on the window. Within the ruler a small triangle
indicates the location of the mouse relative to the horizontal or vertical
ruler. See #GtkHRuler to learn how to create a new horizontal ruler. See
#GtkVRuler to learn how to create a new vertical ruler.
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
#GtkHRuler, #GtkVRuler
</para>
<!-- ##### SECTION Stability_Level ##### -->
<!-- ##### SECTION Image ##### -->
<!-- ##### STRUCT GtkRuler ##### -->
<para>
All distances are in 1/72nd's of an inch. (According to Adobe thats a point, but
points are really 1/72.27 in.)
</para>
<!-- ##### ARG GtkRuler:lower ##### -->
<para>
</para>
<!-- ##### ARG GtkRuler:max-size ##### -->
<para>
</para>
<!-- ##### ARG GtkRuler:metric ##### -->
<para>
</para>
<!-- ##### ARG GtkRuler:position ##### -->
<para>
</para>
<!-- ##### ARG GtkRuler:upper ##### -->
<para>
</para>
<!-- ##### STRUCT GtkRulerMetric ##### -->
<para>
This should be points_per_unit. This is the size of the unit in 1/72nd's of an inch and has nothing to do with screen pixels.
</para>
@metric_name:
@abbrev:
@pixels_per_unit:
@ruler_scale:
@subdivide:
<!-- ##### FUNCTION gtk_ruler_new ##### -->
<para>
</para>
@orientation:
@Returns:
<!-- ##### FUNCTION gtk_ruler_set_metric ##### -->
<para>
This calls the #GTKMetricType to set the ruler to units defined. Available units
are GTK_PIXELS, GTK_INCHES, or GTK_CENTIMETERS. The default unit of measurement
is GTK_PIXELS.
</para>
@ruler: the gtkruler
@metric: the unit of measurement
<!-- ##### FUNCTION gtk_ruler_set_range ##### -->
<para>
</para>
@ruler:
@lower:
@upper:
@position:
@max_size:
<!-- ##### FUNCTION gtk_ruler_get_metric ##### -->
<para>
</para>
@ruler:
@Returns:
<!-- ##### FUNCTION gtk_ruler_get_range ##### -->
<para>
</para>
@ruler:
@lower:
@upper:
@position:
@max_size:
+19
View File
@@ -0,0 +1,19 @@
<!-- ##### SECTION Title ##### -->
Themes
<!-- ##### SECTION Short_Description ##### -->
<!-- ##### SECTION Long_Description ##### -->
<para>
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
</para>
<!-- ##### SECTION Stability_Level ##### -->
+163
View File
@@ -0,0 +1,163 @@
<!-- ##### SECTION Title ##### -->
GtkTipsQuery
<!-- ##### SECTION Short_Description ##### -->
Displays help about widgets in the user interface
<!-- ##### SECTION Long_Description ##### -->
<para>
The #GtkTipsQuery widget is a subclass of #GtkLabel which is used to display
help about widgets in a user interface.
</para>
<para>
A query is started with a call to gtk_tips_query_start_query(), usually
when some kind of 'Help' button is pressed. The #GtkTipsQuery then grabs all
events, stopping the user interface from functioning normally.
Then as the user moves the mouse over the widgets, the #GtkTipsQuery displays
each widget's tooltip text.
</para>
<para>
By connecting to the "widget-entered" or "widget-selected" signals, it is
possible to customize the #GtkTipsQuery to perform other actions when widgets
are entered or selected. For example, a help browser could be opened with
documentation on the widget selected.
</para>
<para>
At some point a call to gtk_tips_query_stop_query() must be made in order to
stop the query and return the interface to its normal state.
The gtk_tips_query_set_caller() function can be used to specify a widget
which the user can select to stop the query (often the same button used to
start the query).
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
<variablelist>
<varlistentry>
<term>#GtkTooltips</term>
<listitem><para>the object which handles tooltips.</para></listitem>
</varlistentry>
</variablelist>
</para>
<!-- ##### SECTION Stability_Level ##### -->
<!-- ##### STRUCT GtkTipsQuery ##### -->
<para>
The #GtkTipsQuery-struct struct contains private data only, and
should be accessed using the functions below.
</para>
<!-- ##### SIGNAL GtkTipsQuery::start-query ##### -->
<para>
Emitted when the query is started.
</para>
@tipsquery: the object which received the signal.
<!-- ##### SIGNAL GtkTipsQuery::stop-query ##### -->
<para>
Emitted when the query is stopped.
</para>
@tipsquery: the object which received the signal.
<!-- ##### SIGNAL GtkTipsQuery::widget-entered ##### -->
<para>
Emitted when a widget is entered by the pointer while the query is in effect.
</para>
@tipsquery: the object which received the signal.
@widget: the widget that was entered by the pointer.
@tip_text: the widget's tooltip.
@tip_private: the widget's private tooltip (see gtk_tooltips_set_tip()).
<!-- ##### SIGNAL GtkTipsQuery::widget-selected ##### -->
<para>
Emitted when a widget is selected during a query.
</para>
@tipsquery: the object which received the signal.
@widget: the widget that was selected.
@tip_text: the widget's tooltip.
@tip_private: the widget's private tooltip (see gtk_tooltips_set_tip()).
@event: the button press or button release event.
@Returns: %TRUE if the query should be stopped.
<!-- ##### ARG GtkTipsQuery:caller ##### -->
<para>
The widget that starts the tips query, usually a button.
If it is selected while the query is in effect the query is automatically
stopped.
</para>
<!-- ##### ARG GtkTipsQuery:emit-always ##### -->
<para>
%TRUE if the widget-entered and widget-selected signals are emitted even when
the widget has no tooltip set.
</para>
<!-- ##### ARG GtkTipsQuery:label-inactive ##### -->
<para>
The text to display in the #GtkTipsQuery widget when the query is not in
effect.
</para>
<!-- ##### ARG GtkTipsQuery:label-no-tip ##### -->
<para>
The text to display in the #GtkTipsQuery widget when the query is running
and the widget that the pointer is over has no tooltip.
</para>
<!-- ##### FUNCTION gtk_tips_query_new ##### -->
<para>
Creates a new #GtkTipsQuery.
</para>
@Returns: a new #GtkTipsQuery.
<!-- ##### FUNCTION gtk_tips_query_start_query ##### -->
<para>
Starts a query.
The #GtkTipsQuery widget will take control of the mouse and as the mouse
moves it will display the tooltip of the widget beneath the mouse.
</para>
@tips_query: a #GtkTipsQuery.
<!-- ##### FUNCTION gtk_tips_query_stop_query ##### -->
<para>
Stops a query.
</para>
@tips_query: a #GtkTipsQuery.
<!-- ##### FUNCTION gtk_tips_query_set_caller ##### -->
<para>
Sets the widget which initiates the query, usually a button.
If the @caller is selected while the query is running, the query is
automatically stopped.
</para>
@tips_query: a #GtkTipsQuery.
@caller: the widget which initiates the query.
<!-- ##### FUNCTION gtk_tips_query_set_labels ##### -->
<para>
Sets the text to display when the query is not in effect,
and the text to display when the query is in effect but the widget beneath
the pointer has no tooltip.
</para>
@tips_query: a #GtkTipsQuery.
@label_inactive: the text to display when the query is not running.
@label_no_tip: the text to display when the query is running but the widget
beneath the pointer has no tooltip.
-7
View File
@@ -31,13 +31,6 @@ see <link linkend="gdk-X-Window-System-Interaction">GDK X Window
System interaction</link> in the GDK manual.
</para>
<para>
GTK+ includes an cross-process embedding facility in the form of
the #GtkSocket and #GtkPlug widgets. These are X11-specific, and
you have to include the <filename>gtk/gtkx.h</filename> header
to use them.
</para>
<refsect2 id="x11-cmdline">
<title>X11-specific commandline options</title>
+7 -1
View File
@@ -1,6 +1,7 @@
/* This file lists all exported symbols. It is used to generate
* the gdk.def file used to control exports on Windows.
*/
gdk_add_client_message_filter
gdk_add_option_entries_libgtk_only
gdk_app_launch_context_get_type G_GNUC_CONST
gdk_app_launch_context_new
@@ -78,6 +79,7 @@ gdk_device_type_get_type G_GNUC_CONST
gdk_device_ungrab
gdk_device_warp
gdk_disable_multidevice
gdk_display_add_client_message_filter
gdk_display_beep
gdk_display_close
gdk_display_device_is_grabbed
@@ -143,6 +145,7 @@ gdk_drag_context_set_device
gdk_drag_drop
gdk_drag_drop_succeeded
gdk_drag_find_window_for_screen
gdk_drag_get_protocol_for_display
gdk_drag_get_selection
gdk_drag_motion
gdk_drag_protocol_get_type G_GNUC_CONST
@@ -170,6 +173,9 @@ gdk_event_new
gdk_event_peek
gdk_event_put
gdk_event_request_motions
gdk_event_send_client_message
gdk_event_send_client_message_for_display
gdk_event_send_clientmessage_toall
gdk_event_set_device
gdk_event_set_screen
gdk_event_set_source_device
@@ -254,6 +260,7 @@ gdk_rgba_get_type
gdk_rgba_hash
gdk_rgba_parse
gdk_rgba_to_string
gdk_screen_broadcast_client_message
gdk_screen_get_active_window
gdk_screen_get_default
gdk_screen_get_display
@@ -389,7 +396,6 @@ gdk_window_get_device_cursor
gdk_window_get_device_events
gdk_window_get_device_position
gdk_window_get_display
gdk_window_get_drag_protocol
gdk_window_get_effective_parent
gdk_window_get_effective_toplevel
gdk_window_get_events
+2
View File
@@ -19,6 +19,8 @@ extern "C" {
# endif
#endif /* !GSEAL */
#define GDK_NATIVE_WINDOW_POINTER
#define GDK_WINDOWING_WIN32
#define GDK_HAVE_WCHAR_H 1
+134
View File
@@ -523,6 +523,48 @@ gdk_flush (void)
g_slist_free (list);
}
/**
* gdk_event_send_client_message:
* @event: the #GdkEvent to send, which should be a #GdkEventClient.
* @winid: the window to send the X ClientMessage event to.
*
* Sends an X ClientMessage event to a given window (which must be
* on the default #GdkDisplay.)
* This could be used for communicating between different applications,
* though the amount of data is limited to 20 bytes.
*
* Return value: non-zero on success.
**/
gboolean
gdk_event_send_client_message (GdkEvent *event,
GdkNativeWindow winid)
{
g_return_val_if_fail (event != NULL, FALSE);
return gdk_event_send_client_message_for_display (gdk_display_get_default (),
event, winid);
}
/**
* gdk_event_send_clientmessage_toall:
* @event: the #GdkEvent to send, which should be a #GdkEventClient.
*
* Sends an X ClientMessage event to all toplevel windows on the default
* #GdkScreen.
*
* Toplevel windows are determined by checking for the WM_STATE property, as
* described in the Inter-Client Communication Conventions Manual (ICCCM).
* If no windows are found with the WM_STATE property set, the message is sent
* to all children of the root window.
**/
void
gdk_event_send_clientmessage_toall (GdkEvent *event)
{
g_return_if_fail (event != NULL);
gdk_screen_broadcast_client_message (gdk_screen_get_default (), event);
}
void
_gdk_display_enable_motion_hints (GdkDisplay *display,
GdkDevice *device)
@@ -1633,6 +1675,76 @@ gdk_display_list_devices (GdkDisplay *display)
return GDK_DISPLAY_GET_CLASS(display)->list_devices (display);
}
/**
* gdk_event_send_client_message_for_display:
* @display: the #GdkDisplay for the window where the message is to be sent.
* @event: the #GdkEvent to send, which should be a #GdkEventClient.
* @winid: the window to send the client message to.
*
* On X11, sends an X ClientMessage event to a given window. On
* Windows, sends a message registered with the name
* GDK_WIN32_CLIENT_MESSAGE.
*
* This could be used for communicating between different
* applications, though the amount of data is limited to 20 bytes on
* X11, and to just four bytes on Windows.
*
* Returns: non-zero on success.
*
* Since: 2.2
*/
gboolean
gdk_event_send_client_message_for_display (GdkDisplay *display,
GdkEvent *event,
GdkNativeWindow winid)
{
return GDK_DISPLAY_GET_CLASS(display)->send_client_message (display, event, winid);
}
/**
* gdk_display_add_client_message_filter: (skip)
* @display: a #GdkDisplay for which this message filter applies
* @message_type: the type of ClientMessage events to receive.
* This will be checked against the @message_type field
* of the XClientMessage event struct.
* @func: the function to call to process the event.
* @data: user data to pass to @func.
*
* Adds a filter to be called when X ClientMessage events are received.
* See gdk_window_add_filter() if you are interested in filtering other
* types of events.
*
* Since: 2.2
**/
void
gdk_display_add_client_message_filter (GdkDisplay *display,
GdkAtom message_type,
GdkFilterFunc func,
gpointer data)
{
GDK_DISPLAY_GET_CLASS(display)->add_client_message_filter (display, message_type, func, data);
}
/**
* gdk_add_client_message_filter: (skip)
* @message_type: the type of ClientMessage events to receive. This will be
* checked against the <structfield>message_type</structfield> field of the
* XClientMessage event struct.
* @func: the function to call to process the event.
* @data: user data to pass to @func.
*
* Adds a filter to the default display to be called when X ClientMessage events
* are received. See gdk_display_add_client_message_filter().
**/
void
gdk_add_client_message_filter (GdkAtom message_type,
GdkFilterFunc func,
gpointer data)
{
gdk_display_add_client_message_filter (gdk_display_get_default (),
message_type, func, data);
}
static GdkAppLaunchContext *
gdk_display_real_get_app_launch_context (GdkDisplay *display)
{
@@ -1663,6 +1775,28 @@ gdk_display_get_app_launch_context (GdkDisplay *display)
return GDK_DISPLAY_GET_CLASS(display)->get_app_launch_context (display);
}
/**
* gdk_drag_get_protocol_for_display:
* @display: the #GdkDisplay where the destination window resides
* @xid: the windowing system id of the destination window.
* @protocol: (out): location where the supported DND protocol is returned.
*
* Finds out the DND protocol supported by a window.
*
* Return value: the windowing system id of the window where the drop
* should happen. This may be @xid or the id of a proxy window,
* or zero if @xid does not support Drag and Drop.
*
* Since: 2.2
*/
GdkNativeWindow
gdk_drag_get_protocol_for_display (GdkDisplay *display,
GdkNativeWindow xid,
GdkDragProtocol *protocol)
{
return GDK_DISPLAY_GET_CLASS (display)->get_drag_protocol (display, xid, protocol, NULL);
}
/**
* gdk_display_open:
* @display_name: the name of the display to open
+5
View File
@@ -80,6 +80,11 @@ void gdk_display_put_event (GdkDisplay *display,
const GdkEvent *event);
gboolean gdk_display_has_pending (GdkDisplay *display);
void gdk_display_add_client_message_filter (GdkDisplay *display,
GdkAtom message_type,
GdkFilterFunc func,
gpointer data);
void gdk_display_set_double_click_time (GdkDisplay *display,
guint msec);
void gdk_display_set_double_click_distance (GdkDisplay *display,
+12 -1
View File
@@ -163,7 +163,18 @@ struct _GdkDisplayClass
gint y);
GList * (*list_devices) (GdkDisplay *display);
gboolean (*send_client_message) (GdkDisplay *display,
GdkEvent *event,
GdkNativeWindow winid);
void (*add_client_message_filter) (GdkDisplay *display,
GdkAtom message_type,
GdkFilterFunc func,
gpointer data);
GdkAppLaunchContext * (*get_app_launch_context) (GdkDisplay *display);
GdkNativeWindow (*get_drag_protocol) (GdkDisplay *display,
GdkNativeWindow winid,
GdkDragProtocol *protocol,
guint *version);
void (*before_process_all_updates) (GdkDisplay *display);
void (*after_process_all_updates) (GdkDisplay *display);
@@ -198,7 +209,7 @@ struct _GdkDisplayClass
guint32 time,
gboolean send_event);
void (*send_selection_notify) (GdkDisplay *dispay,
GdkWindow *requestor,
GdkNativeWindow requestor,
GdkAtom selection,
GdkAtom target,
GdkAtom property,
+1 -1
View File
@@ -70,7 +70,7 @@ gdk_drag_context_list_targets (GdkDragContext *context)
* @context: a #GdkDragContext
*
* Determines the bitmask of actions proposed by the source if
* gdk_drag_context_get_suggested_action() returns GDK_ACTION_ASK.
* gdk_drag_context_suggested_action() returns GDK_ACTION_ASK.
*
* Return value: the #GdkDragAction flags
*
+6 -2
View File
@@ -67,11 +67,11 @@ typedef enum
/**
* GdkDragProtocol:
* @GDK_DRAG_PROTO_NONE: no protocol.
* @GDK_DRAG_PROTO_MOTIF: The Motif DND protocol.
* @GDK_DRAG_PROTO_XDND: The Xdnd protocol.
* @GDK_DRAG_PROTO_ROOTWIN: An extension to the Xdnd protocol for
* unclaimed root window drops.
* @GDK_DRAG_PROTO_NONE: no protocol.
* @GDK_DRAG_PROTO_WIN32_DROPFILES: The simple WM_DROPFILES protocol.
* @GDK_DRAG_PROTO_OLE2: The complex OLE2 DND protocol (not implemented).
* @GDK_DRAG_PROTO_LOCAL: Intra-application DND.
@@ -81,10 +81,10 @@ typedef enum
*/
typedef enum
{
GDK_DRAG_PROTO_NONE = 0,
GDK_DRAG_PROTO_MOTIF,
GDK_DRAG_PROTO_XDND,
GDK_DRAG_PROTO_ROOTWIN,
GDK_DRAG_PROTO_NONE,
GDK_DRAG_PROTO_WIN32_DROPFILES,
GDK_DRAG_PROTO_OLE2,
GDK_DRAG_PROTO_LOCAL
@@ -128,6 +128,10 @@ GdkDragContext * gdk_drag_begin_for_device (GdkWindow *window,
GdkDevice *device,
GList *targets);
GdkNativeWindow gdk_drag_get_protocol_for_display (GdkDisplay *display,
GdkNativeWindow xid,
GdkDragProtocol *protocol);
void gdk_drag_find_window_for_screen (GdkDragContext *context,
GdkWindow *drag_window,
GdkScreen *screen,
-26
View File
@@ -567,20 +567,6 @@ gdk_event_copy (const GdkEvent *event)
sizeof (gdouble) * gdk_device_get_n_axes (event->motion.device));
break;
case GDK_OWNER_CHANGE:
new_event->owner_change.owner = event->owner_change.owner;
if (new_event->owner_change.owner)
g_object_ref (new_event->owner_change.owner);
break;
case GDK_SELECTION_CLEAR:
case GDK_SELECTION_NOTIFY:
case GDK_SELECTION_REQUEST:
new_event->selection.requestor = event->selection.requestor;
if (new_event->selection.requestor)
g_object_unref (new_event->selection.requestor);
break;
default:
break;
}
@@ -650,18 +636,6 @@ gdk_event_free (GdkEvent *event)
g_free (event->setting.name);
break;
case GDK_OWNER_CHANGE:
if (event->owner_change.owner)
g_object_unref (event->owner_change.owner);
break;
case GDK_SELECTION_CLEAR:
case GDK_SELECTION_NOTIFY:
case GDK_SELECTION_REQUEST:
if (event->selection.requestor)
g_object_unref (event->selection.requestor);
break;
default:
break;
}
+51 -10
View File
@@ -89,6 +89,7 @@ typedef struct _GdkEventProperty GdkEventProperty;
typedef struct _GdkEventSelection GdkEventSelection;
typedef struct _GdkEventOwnerChange GdkEventOwnerChange;
typedef struct _GdkEventProximity GdkEventProximity;
typedef struct _GdkEventClient GdkEventClient;
typedef struct _GdkEventDND GdkEventDND;
typedef struct _GdkEventWindowState GdkEventWindowState;
typedef struct _GdkEventSetting GdkEventSetting;
@@ -798,7 +799,7 @@ struct _GdkEventProperty
* @target: the target to which the selection should be converted.
* @property: the property in which to place the result of the conversion.
* @time: the time of the event in milliseconds.
* @requestor: the window on which to place @property or %NULL if none.
* @requestor: the native window on which to place @property.
*
* Generated when a selection is requested or ownership of a selection
* is taken over by another client application.
@@ -812,21 +813,21 @@ struct _GdkEventSelection
GdkAtom target;
GdkAtom property;
guint32 time;
GdkWindow *requestor;
GdkNativeWindow requestor;
};
/**
* GdkEventOwnerChange:
* @type: the type of the event (%GDK_OWNER_CHANGE).
* @window: the window which received the event
* @window: the window which received the event.
* @send_event: %TRUE if the event was sent explicitly (e.g. using
* <function>XSendEvent</function>)
* @owner: the new owner of the selection, or %NULL if there is none
* @reason: the reason for the ownership change as a #GdkOwnerChange value
* @selection: the atom identifying the selection
* @time: the timestamp of the event
* <function>XSendEvent</function>).
* @owner: the new owner of the selection.
* @reason: the reason for the ownership change as a #GdkOwnerChange value.
* @selection: the atom identifying the selection.
* @time: the timestamp of the event.
* @selection_time: the time at which the selection ownership was taken
* over
* over.
*
* Generated when the owner of a selection changes. On X11, this
* information is only available if the X server supports the XFIXES
@@ -839,7 +840,7 @@ struct _GdkEventOwnerChange
GdkEventType type;
GdkWindow *window;
gint8 send_event;
GdkWindow *owner;
GdkNativeWindow owner;
GdkOwnerChange reason;
GdkAtom selection;
guint32 time;
@@ -873,6 +874,35 @@ struct _GdkEventProximity
GdkDevice *device;
};
/**
* GdkEventClient:
* @type: the type of the event (%GDK_CLIENT_EVENT).
* @window: the window which received the event.
* @send_event: %TRUE if the event was sent explicitly (e.g. using
* <function>XSendEvent</function>).
* @message_type: the type of the message, which can be defined by the
* application.
* @data_format: the format of the data, given as the number of bits in each
* data element, i.e. 8, 16, or 32. 8-bit data uses the b array of the
* data union, 16-bit data uses the s array, and 32-bit data uses the l
* array.
*
* An event sent by another client application.
*/
struct _GdkEventClient
{
GdkEventType type;
GdkWindow *window;
gint8 send_event;
GdkAtom message_type;
gushort data_format;
union {
char b[20];
short s[10];
long l[5];
} data;
};
/**
* GdkEventSetting:
* @type: the type of the event (%GDK_SETTING).
@@ -1030,6 +1060,7 @@ union _GdkEvent
GdkEventSelection selection;
GdkEventOwnerChange owner_change;
GdkEventProximity proximity;
GdkEventClient client;
GdkEventDND dnd;
GdkEventWindowState window_state;
GdkEventSetting setting;
@@ -1094,9 +1125,19 @@ gboolean gdk_get_show_events (void);
gboolean gdk_setting_get (const gchar *name,
GValue *value);
void gdk_add_client_message_filter (GdkAtom message_type,
GdkFilterFunc func,
gpointer data);
gboolean gdk_event_send_client_message (GdkEvent *event,
GdkNativeWindow winid);
void gdk_event_send_clientmessage_toall (GdkEvent *event);
#endif /* GDK_MULTIHEAD_SAFE */
gboolean gdk_event_send_client_message_for_display (GdkDisplay *display,
GdkEvent *event,
GdkNativeWindow winid);
G_END_DECLS
#endif /* __GDK_EVENTS_H__ */
+26
View File
@@ -934,6 +934,32 @@ gdk_screen_get_window_stack (GdkScreen *screen)
return GDK_SCREEN_GET_CLASS(screen)->get_window_stack (screen);
}
/**
* gdk_screen_broadcast_client_message:
* @screen: the #GdkScreen where the event will be broadcasted.
* @event: the #GdkEvent.
*
* On X11, sends an X ClientMessage event to all toplevel windows on
* @screen.
*
* Toplevel windows are determined by checking for the WM_STATE property,
* as described in the Inter-Client Communication Conventions Manual (ICCCM).
* If no windows are found with the WM_STATE property set, the message is
* sent to all children of the root window.
*
* On Windows, broadcasts a message registered with the name
* GDK_WIN32_CLIENT_MESSAGE to all top-level windows. The amount of
* data is limited to one long, i.e. four bytes.
*
* Since: 2.2
*/
void
gdk_screen_broadcast_client_message (GdkScreen *screen,
GdkEvent *event)
{
return GDK_SCREEN_GET_CLASS(screen)->broadcast_client_message (screen, event);
}
/**
* gdk_screen_get_setting:
* @screen: the #GdkScreen where the setting is located
+3
View File
@@ -74,6 +74,9 @@ gint gdk_screen_get_monitor_height_mm (GdkScreen *screen,
gchar * gdk_screen_get_monitor_plug_name (GdkScreen *screen,
gint monitor_num);
void gdk_screen_broadcast_client_message (GdkScreen *screen,
GdkEvent *event);
GdkScreen *gdk_screen_get_default (void);
gboolean gdk_screen_get_setting (GdkScreen *screen,
+3 -3
View File
@@ -126,13 +126,13 @@ gdk_selection_owner_get (GdkAtom selection)
* Sends a response to SelectionRequest event.
*/
void
gdk_selection_send_notify (GdkWindow *requestor,
gdk_selection_send_notify (GdkNativeWindow requestor,
GdkAtom selection,
GdkAtom target,
GdkAtom property,
guint32 time)
{
gdk_selection_send_notify_for_display (gdk_window_get_display (requestor),
gdk_selection_send_notify_for_display (gdk_display_get_default (),
requestor, selection,
target, property, time);
}
@@ -213,7 +213,7 @@ gdk_selection_owner_get_for_display (GdkDisplay *display,
*/
void
gdk_selection_send_notify_for_display (GdkDisplay *display,
GdkWindow *requestor,
GdkNativeWindow requestor,
GdkAtom selection,
GdkAtom target,
GdkAtom property,
+4 -2
View File
@@ -192,14 +192,16 @@ gint gdk_selection_property_get (GdkWindow *requestor,
GdkAtom *prop_type,
gint *prop_format);
void gdk_selection_send_notify (GdkWindow *requestor,
#ifndef GDK_MULTIHEAD_SAFE
void gdk_selection_send_notify (GdkNativeWindow requestor,
GdkAtom selection,
GdkAtom target,
GdkAtom property,
guint32 time_);
#endif /* GDK_MULTIHEAD_SAFE */
void gdk_selection_send_notify_for_display (GdkDisplay *display,
GdkWindow *requestor,
GdkNativeWindow requestor,
GdkAtom selection,
GdkAtom target,
GdkAtom property,
+18
View File
@@ -104,6 +104,12 @@ typedef struct _GdkAtom *GdkAtom;
*/
#define GDK_POINTER_TO_ATOM(ptr) ((GdkAtom)(ptr))
#ifdef GDK_NATIVE_WINDOW_POINTER
#define GDK_GPOINTER_TO_NATIVE_WINDOW(p) ((GdkNativeWindow) (p))
#else
#define GDK_GPOINTER_TO_NATIVE_WINDOW(p) GPOINTER_TO_UINT(p)
#endif
#define _GDK_MAKE_ATOM(val) ((GdkAtom)GUINT_TO_POINTER(val))
/**
@@ -114,6 +120,18 @@ typedef struct _GdkAtom *GdkAtom;
*/
#define GDK_NONE _GDK_MAKE_ATOM (0)
/**
* GdkNativeWindow:
*
* Used to represent native windows (<type>Window</type>s for the X11
* backend, <type>HWND</type>s for Win32).
*/
#ifdef GDK_NATIVE_WINDOW_POINTER
typedef gpointer GdkNativeWindow;
#else
typedef guint32 GdkNativeWindow;
#endif
/* Forward declarations of commonly used types */
typedef struct _GdkColor GdkColor;
typedef struct _GdkRGBA GdkRGBA;
-22
View File
@@ -10657,28 +10657,6 @@ gdk_window_register_dnd (GdkWindow *window)
GDK_WINDOW_IMPL_GET_CLASS (window->impl)->register_dnd (window);
}
/**
* gdk_window_get_drag_protocol:
* @window: the destination window
* @target: (out) (allow-none) (transfer full): location of the window
* where the drop should happen. This may be @window or a proxy window,
* or %NULL if @window does not support Drag and Drop.
*
* Finds out the DND protocol supported by a window.
*
* Returns: the supported DND protocol.
*
* Since: 3.0
*/
GdkDragProtocol
gdk_window_get_drag_protocol (GdkWindow *window,
GdkWindow **target)
{
g_return_val_if_fail (GDK_IS_WINDOW (window), GDK_DRAG_PROTO_NONE);
return GDK_WINDOW_IMPL_GET_CLASS (window->impl)->get_drag_protocol (window, target);
}
/**
* gdk_drag_begin:
* @window: the source window for this drag.
-4
View File
@@ -780,10 +780,6 @@ void gdk_window_set_opacity (GdkWindow *window,
gdouble opacity);
void gdk_window_register_dnd (GdkWindow *window);
GdkDragProtocol
gdk_window_get_drag_protocol(GdkWindow *window,
GdkWindow **target);
void gdk_window_begin_resize_drag (GdkWindow *window,
GdkWindowEdge edge,
gint button,
-2
View File
@@ -248,8 +248,6 @@ struct _GdkWindowImplClass
void (* set_composited) (GdkWindow *window,
gboolean composited);
void (* destroy_notify) (GdkWindow *window);
GdkDragProtocol (* get_drag_protocol) (GdkWindow *window,
GdkWindow **target);
void (* register_dnd) (GdkWindow *window);
GdkDragContext * (*drag_begin) (GdkWindow *window,
GdkDevice *device,
+1 -2
View File
@@ -213,8 +213,7 @@ gdk_quartz_device_core_query_state_helper (GdkWindow *window,
toplevel = gdk_window_get_effective_toplevel (window);
if (mask)
*mask = _gdk_quartz_events_get_current_event_mask ();
*mask = _gdk_quartz_events_get_current_event_mask ();
/* Get the y coordinate, needs to be flipped. */
if (window == _gdk_root)
+3 -3
View File
@@ -159,7 +159,7 @@ send_event_handler (Display *dpy,
else if (dpy->last_request_read == state->get_input_focus_req)
{
xGetInputFocusReply replbuf;
xGetInputFocusReply *repl G_GNUC_UNUSED;
xGetInputFocusReply *repl;
if (rep->generic.type != X_Error)
{
@@ -312,7 +312,7 @@ set_input_focus_handler (Display *dpy,
if (dpy->last_request_read == state->get_input_focus_req)
{
xGetInputFocusReply replbuf;
xGetInputFocusReply *repl G_GNUC_UNUSED;
xGetInputFocusReply *repl;
if (rep->generic.type != X_Error)
{
@@ -781,7 +781,7 @@ roundtrip_handler (Display *dpy,
if (dpy->last_request_read == state->get_input_focus_req)
{
xGetInputFocusReply replbuf;
xGetInputFocusReply *repl G_GNUC_UNUSED;
xGetInputFocusReply *repl;
if (rep->generic.type != X_Error)
{
+4 -5
View File
@@ -26,7 +26,6 @@
#include "gdkasync.h"
#include "gdkprivate-x11.h"
#include <stdlib.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/extensions/XInput2.h>
@@ -363,7 +362,7 @@ gdk_x11_device_xi2_query_state (GdkDevice *device,
if (mask)
*mask = _gdk_x11_device_xi2_translate_state (&mod_state, &button_state);
free (button_state.mask);
g_free (button_state.mask);
return TRUE;
}
@@ -532,7 +531,7 @@ gdk_x11_device_xi2_window_at_position (GdkDevice *device,
XSetWindowAttributes attributes;
Window w;
free (button_state.mask);
g_free (button_state.mask);
w = XCreateWindow (xdisplay, xwindow, (int)xwin_x, (int)xwin_y, 1, 1, 0,
CopyFromParent, InputOnly, CopyFromParent,
@@ -567,7 +566,7 @@ gdk_x11_device_xi2_window_at_position (GdkDevice *device,
while (xwindow)
{
last = xwindow;
free (button_state.mask);
g_free (button_state.mask);
gdk_x11_display_error_trap_push (display);
XIQueryPointer (xdisplay,
@@ -604,7 +603,7 @@ gdk_x11_device_xi2_window_at_position (GdkDevice *device,
if (mask)
*mask = _gdk_x11_device_xi2_translate_state (&mod_state, &button_state);
free (button_state.mask);
g_free (button_state.mask);
return window;
}
+1 -1
View File
@@ -272,7 +272,7 @@ set_user_time (GdkWindow *window,
{
g_return_if_fail (event != NULL);
window = gdk_window_get_toplevel (event->any.window);
window = gdk_window_get_toplevel (event->client.window);
g_return_if_fail (GDK_IS_WINDOW (window));
/* If an event doesn't have a valid timestamp, we shouldn't use it
+3 -27
View File
@@ -44,6 +44,8 @@ struct _GdkX11DeviceManagerXI2
GList *devices;
GdkDevice *client_pointer;
gint opcode;
};
@@ -82,7 +84,7 @@ static void gdk_x11_device_manager_xi2_select_window_events (GdkEventTra
GdkEventMask event_mask);
G_DEFINE_TYPE_WITH_CODE (GdkX11DeviceManagerXI2, gdk_x11_device_manager_xi2, GDK_TYPE_X11_DEVICE_MANAGER_CORE,
G_DEFINE_TYPE_WITH_CODE (GdkX11DeviceManagerXI2, gdk_x11_device_manager_xi2, GDK_TYPE_DEVICE_MANAGER,
G_IMPLEMENT_INTERFACE (GDK_TYPE_EVENT_TRANSLATOR,
gdk_x11_device_manager_xi2_event_translator_init))
@@ -991,7 +993,6 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
XEvent *xevent)
{
GdkX11DeviceManagerXI2 *device_manager;
GdkEventTranslatorIface *parent_iface;
XGenericEventCookie *cookie;
gboolean return_val = TRUE;
GdkWindow *window;
@@ -1002,31 +1003,6 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
device_manager = (GdkX11DeviceManagerXI2 *) translator;
cookie = &xevent->xcookie;
parent_iface = g_type_interface_peek_parent (GDK_EVENT_TRANSLATOR_GET_IFACE (translator));
/* The X input methods (when triggered via XFilterEvent) generate
* a core key press event with keycode 0 to signal the end of a
* key sequence. We use the core translate_event implementation
* to translate this event.
*
* This is just a bandaid fix to keep xim working with a single
* keyboard until XFilterEvent learns about XI2.
*/
if (xevent->type == KeyPress && xevent->xkey.keycode == 0 &&
parent_iface->translate_event (translator, display, event, xevent))
{
GdkDevice *device;
/* The core device manager sets a core device on the event.
* We need to override that with an XI2 device, since we are
* using XI2.
*/
device = gdk_x11_device_manager_xi2_get_client_pointer ((GdkDeviceManager *)device_manager);
gdk_event_set_device (event, gdk_device_get_associated_device (device));
return TRUE;
}
if (!XGetEventData (dpy, cookie))
return FALSE;
+117 -29
View File
@@ -814,11 +814,7 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
event->selection.selection = gdk_x11_xatom_to_atom_for_display (display, xevent->xselectionrequest.selection);
event->selection.target = gdk_x11_xatom_to_atom_for_display (display, xevent->xselectionrequest.target);
event->selection.property = gdk_x11_xatom_to_atom_for_display (display, xevent->xselectionrequest.property);
if (xevent->xselectionrequest.requestor != None)
event->selection.requestor = gdk_x11_window_foreign_new_for_display (display,
xevent->xselectionrequest.requestor);
else
event->selection.requestor = NULL;
event->selection.requestor = xevent->xselectionrequest.requestor;
event->selection.time = xevent->xselectionrequest.time;
break;
@@ -850,12 +846,56 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
break;
case ClientMessage:
GDK_NOTE (EVENTS,
g_message ("client message:\twindow: %ld",
xevent->xclient.window));
{
GList *tmp_list;
GdkFilterReturn result = GDK_FILTER_CONTINUE;
GdkAtom message_type = gdk_x11_xatom_to_atom_for_display (display, xevent->xclient.message_type);
GDK_NOTE (EVENTS,
g_message ("client message:\twindow: %ld",
xevent->xclient.window));
tmp_list = display_x11->client_filters;
while (tmp_list)
{
GdkClientFilter *filter = tmp_list->data;
tmp_list = tmp_list->next;
if (filter->type == message_type)
{
result = (*filter->function) (xevent, event, filter->data);
if (result != GDK_FILTER_CONTINUE)
break;
}
}
switch (result)
{
case GDK_FILTER_REMOVE:
return_val = FALSE;
break;
case GDK_FILTER_TRANSLATE:
return_val = TRUE;
break;
case GDK_FILTER_CONTINUE:
/* Send unknown ClientMessage's on to Gtk for it to use */
if (window == NULL)
{
return_val = FALSE;
}
else
{
event->client.type = GDK_CLIENT_EVENT;
event->client.window = window;
event->client.message_type = message_type;
event->client.data_format = xevent->xclient.format;
memcpy(&event->client.data, &xevent->xclient.data,
sizeof(event->client.data));
}
break;
}
}
/* Not currently handled */
return_val = FALSE;
break;
case MappingNotify:
@@ -879,11 +919,7 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
event->owner_change.type = GDK_OWNER_CHANGE;
event->owner_change.window = window;
if (selection_notify->owner != None)
event->owner_change.owner = gdk_x11_window_foreign_new_for_display (display,
selection_notify->owner);
else
event->owner_change.owner = NULL;
event->owner_change.owner = selection_notify->owner;
event->owner_change.reason = selection_notify->subtype;
event->owner_change.selection =
gdk_x11_xatom_to_atom_for_display (display,
@@ -976,28 +1012,21 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
return return_val;
}
GdkFilterReturn
_gdk_wm_protocols_filter (GdkXEvent *xev,
GdkEvent *event,
gpointer data)
static GdkFilterReturn
gdk_wm_protocols_filter (GdkXEvent *xev,
GdkEvent *event,
gpointer data)
{
XEvent *xevent = (XEvent *)xev;
GdkWindow *win = event->any.window;
GdkDisplay *display;
Atom atom;
if (!GDK_IS_X11_WINDOW (win))
return GDK_FILTER_CONTINUE;
if (xevent->type != ClientMessage)
return GDK_FILTER_CONTINUE;
if (!win)
return GDK_FILTER_REMOVE;
display = GDK_WINDOW_DISPLAY (win);
if (xevent->xclient.message_type != gdk_x11_get_xatom_by_name_for_display (display, "WM_PROTOCOLS"))
return GDK_FILTER_CONTINUE;
atom = (Atom) xevent->xclient.data.l[0];
atom = (Atom)xevent->xclient.data.l[0];
if (atom == gdk_x11_get_xatom_by_name_for_display (display, "WM_DELETE_WINDOW"))
{
@@ -1080,6 +1109,11 @@ gdk_event_init (GdkDisplay *display)
device_manager = gdk_display_get_device_manager (display);
gdk_x11_event_source_add_translator ((GdkEventSource *) display_x11->event_source,
GDK_EVENT_TRANSLATOR (device_manager));
gdk_display_add_client_message_filter (display,
gdk_atom_intern_static_string ("WM_PROTOCOLS"),
gdk_wm_protocols_filter,
NULL);
}
static void
@@ -1406,6 +1440,7 @@ _gdk_x11_display_open (const gchar *display_name)
#endif
gdk_x11_display_init_input (display);
_gdk_x11_display_init_dnd (display);
for (i = 0; i < ScreenCount (display_x11->xdisplay); i++)
_gdk_x11_screen_setup (display_x11->screens[i]);
@@ -1731,6 +1766,10 @@ gdk_x11_display_finalize (GObject *object)
/* Leader Window */
XDestroyWindow (display_x11->xdisplay, display_x11->leader_window);
/* list of filters for client messages */
g_list_foreach (display_x11->client_filters, (GFunc) g_free, NULL);
g_list_free (display_x11->client_filters);
/* List of event window extraction functions */
g_slist_foreach (display_x11->event_types, (GFunc)g_free, NULL);
g_slist_free (display_x11->event_types);
@@ -2267,6 +2306,45 @@ gdk_x11_display_list_devices (GdkDisplay *display)
return GDK_X11_DISPLAY (display)->input_devices;
}
static gboolean
gdk_x11_display_send_client_message (GdkDisplay *display,
GdkEvent *event,
GdkNativeWindow winid)
{
XEvent sev;
g_return_val_if_fail(event != NULL, FALSE);
/* Set up our event to send, with the exception of its target window */
sev.xclient.type = ClientMessage;
sev.xclient.display = GDK_DISPLAY_XDISPLAY (display);
sev.xclient.format = event->client.data_format;
sev.xclient.window = winid;
memcpy(&sev.xclient.data, &event->client.data, sizeof (sev.xclient.data));
sev.xclient.message_type = gdk_x11_atom_to_xatom_for_display (display, event->client.message_type);
return _gdk_x11_display_send_xevent (display, winid, False, NoEventMask, &sev);
}
static void
gdk_x11_display_add_client_message_filter (GdkDisplay *display,
GdkAtom message_type,
GdkFilterFunc func,
gpointer data)
{
GdkClientFilter *filter;
g_return_if_fail (GDK_IS_DISPLAY (display));
filter = g_new (GdkClientFilter, 1);
filter->type = message_type;
filter->function = func;
filter->data = data;
GDK_X11_DISPLAY(display)->client_filters =
g_list_append (GDK_X11_DISPLAY (display)->client_filters,
filter);
}
/**
* gdk_x11_register_standard_event_type:
* @display: a #GdkDisplay
@@ -2556,6 +2634,13 @@ gdk_x11_display_error_trap_pop_ignored (GdkDisplay *display)
gdk_x11_display_error_trap_pop_internal (display, FALSE);
}
extern GdkAppLaunchContext *_gdk_x11_display_get_app_launch_context (GdkDisplay *display);
extern GdkNativeWindow _gdk_x11_display_get_drag_protocol (GdkDisplay *display,
GdkNativeWindow xid,
GdkDragProtocol *protocol,
guint *version);
/**
* gdk_x11_set_sm_client_id:
* @sm_client_id: the client id assigned by the session manager when the
@@ -2657,7 +2742,10 @@ gdk_x11_display_class_init (GdkX11DisplayClass * class)
display_class->supports_input_shapes = gdk_x11_display_supports_input_shapes;
display_class->supports_composite = gdk_x11_display_supports_composite;
display_class->list_devices = gdk_x11_display_list_devices;
display_class->send_client_message = gdk_x11_display_send_client_message;
display_class->add_client_message_filter = gdk_x11_display_add_client_message_filter;
display_class->get_app_launch_context = _gdk_x11_display_get_app_launch_context;
display_class->get_drag_protocol = _gdk_x11_display_get_drag_protocol;
display_class->get_cursor_for_type = _gdk_x11_display_get_cursor_for_type;
display_class->get_cursor_for_name = _gdk_x11_display_get_cursor_for_name;
display_class->get_cursor_for_pixbuf = _gdk_x11_display_get_cursor_for_pixbuf;
+3 -4
View File
@@ -95,6 +95,9 @@ struct _GdkX11Display
GdkWindow *leader_gdk_window;
gboolean leader_window_title_set;
/* list of filters for client messages */
GList *client_filters;
/* List of functions to go from extension event => X window */
GSList *event_types;
@@ -143,10 +146,6 @@ GdkScreen *_gdk_x11_display_screen_for_xrootwin (GdkDisplay *display,
void _gdk_x11_display_error_event (GdkDisplay *display,
XErrorEvent *error);
GdkFilterReturn _gdk_wm_protocols_filter (GdkXEvent *xev,
GdkEvent *event,
gpointer data);
G_END_DECLS
#endif /* __GDK_X11_DISPLAY__ */
+59 -48
View File
@@ -146,14 +146,12 @@ static const struct {
const char *atom_name;
GdkFilterFunc func;
} xdnd_filters[] = {
{ "_MOTIF_DRAG_AND_DROP_MESSAGE", motif_dnd_filter },
{ "XdndEnter", xdnd_enter_filter },
{ "XdndLeave", xdnd_leave_filter },
{ "XdndPosition", xdnd_position_filter },
{ "XdndStatus", xdnd_status_filter },
{ "XdndFinished", xdnd_finished_filter },
{ "XdndDrop", xdnd_drop_filter },
{ "XdndEnter", xdnd_enter_filter },
{ "XdndLeave", xdnd_leave_filter },
{ "XdndPosition", xdnd_position_filter },
{ "XdndStatus", xdnd_status_filter },
{ "XdndFinished", xdnd_finished_filter },
{ "XdndDrop", xdnd_drop_filter },
};
@@ -846,11 +844,7 @@ enum {
/* Byte swapping routines. The motif specification leaves it
* up to us to save a few bytes in the client messages
*/
#if G_BYTE_ORDER == G_BIG_ENDIAN
static gchar local_byte_order = 'B';
#else
static gchar local_byte_order = 'l';
#endif
static gchar local_byte_order = '\0';
#ifdef G_ENABLE_DEBUG
static void
@@ -866,6 +860,13 @@ print_target_list (GList *targets)
}
#endif /* G_ENABLE_DEBUG */
static void
init_byte_order (void)
{
guint32 myint = 0x01020304;
local_byte_order = (*(gchar *)&myint == 1) ? 'B' : 'l';
}
static guint16
card16_to_host (guint16 x, gchar byte_order)
{
@@ -1729,11 +1730,17 @@ motif_drag_context_new (GdkWindow *dest_window,
context->protocol = GDK_DRAG_PROTO_MOTIF;
context->is_source = FALSE;
context->source_window = gdk_x11_window_foreign_new_for_display (display, source_window);
if (!context->source_window)
context->source_window = gdk_x11_window_lookup_for_display (display, source_window);
if (context->source_window)
g_object_ref (context->source_window);
else
{
g_object_unref (context_x11);
return NULL;
context->source_window = gdk_x11_window_foreign_new_for_display (display, source_window);
if (!context->source_window)
{
g_object_unref (context_x11);
return NULL;
}
}
context->dest_window = dest_window;
@@ -2893,11 +2900,17 @@ xdnd_enter_filter (GdkXEvent *xev,
device_manager = gdk_display_get_device_manager (display);
gdk_drag_context_set_device (context, gdk_device_manager_get_client_pointer (device_manager));
context->source_window = gdk_x11_window_foreign_new_for_display (display, source_window);
if (!context->source_window)
context->source_window = gdk_x11_window_lookup_for_display (display, source_window);
if (context->source_window)
g_object_ref (context->source_window);
else
{
g_object_unref (context);
return GDK_FILTER_REMOVE;
context->source_window = gdk_x11_window_foreign_new_for_display (display, source_window);
if (!context->source_window)
{
g_object_unref (context);
return GDK_FILTER_REMOVE;
}
}
context->dest_window = event->any.window;
g_object_ref (context->dest_window);
@@ -3113,32 +3126,24 @@ xdnd_drop_filter (GdkXEvent *xev,
return GDK_FILTER_REMOVE;
}
GdkFilterReturn
_gdk_x11_dnd_filter (GdkXEvent *xev,
GdkEvent *event,
gpointer data)
void
_gdk_x11_display_init_dnd (GdkDisplay *display)
{
XEvent *xevent = (XEvent *) xev;
GdkDisplay *display;
int i;
init_byte_order ();
if (!GDK_IS_X11_WINDOW (event->any.window))
return GDK_FILTER_CONTINUE;
if (xevent->type != ClientMessage)
return GDK_FILTER_CONTINUE;
display = GDK_WINDOW_DISPLAY (event->any.window);
gdk_display_add_client_message_filter (
display,
gdk_atom_intern_static_string ("_MOTIF_DRAG_AND_DROP_MESSAGE"),
motif_dnd_filter, NULL);
for (i = 0; i < G_N_ELEMENTS (xdnd_filters); i++)
{
if (xevent->xclient.message_type != gdk_x11_get_xatom_by_name_for_display (display, xdnd_filters[i].atom_name))
continue;
return xdnd_filters[i].func (xev, event, data);
gdk_display_add_client_message_filter (
display,
gdk_atom_intern_static_string (xdnd_filters[i].atom_name),
xdnd_filters[i].func, NULL);
}
return GDK_FILTER_CONTINUE;
}
/* Source side */
@@ -3193,15 +3198,15 @@ _gdk_x11_window_drag_begin (GdkWindow *window,
return context;
}
Window
GdkNativeWindow
_gdk_x11_display_get_drag_protocol (GdkDisplay *display,
Window xid,
GdkNativeWindow xid,
GdkDragProtocol *protocol,
guint *version)
{
GdkWindow *window;
Window retval;
GdkNativeWindow retval;
base_precache_atoms (display);
@@ -3214,10 +3219,10 @@ _gdk_x11_display_get_drag_protocol (GdkDisplay *display,
*protocol = GDK_DRAG_PROTO_XDND;
*version = 5;
xdnd_precache_atoms (display);
GDK_NOTE (DND, g_message ("Entering local Xdnd window %#x\n", (guint) xid));
GDK_NOTE (DND, g_message ("Entering local Xdnd window %#x\n", xid));
return xid;
}
else if (_gdk_x11_display_is_root_window (display, xid))
else if (_gdk_x11_display_is_root_window (display, (Window) xid))
{
*protocol = GDK_DRAG_PROTO_ROOTWIN;
GDK_NOTE (DND, g_message ("Entering root window\n"));
@@ -3228,13 +3233,13 @@ _gdk_x11_display_get_drag_protocol (GdkDisplay *display,
{
*protocol = GDK_DRAG_PROTO_XDND;
xdnd_precache_atoms (display);
GDK_NOTE (DND, g_message ("Entering Xdnd window %#x\n", (guint) xid));
GDK_NOTE (DND, g_message ("Entering Xdnd window %#x\n", xid));
return retval;
}
else if ((retval = motif_check_dest (display, xid)))
{
*protocol = GDK_DRAG_PROTO_MOTIF;
GDK_NOTE (DND, g_message ("Entering motif window %#x\n", (guint) xid));
GDK_NOTE (DND, g_message ("Entering motif window %#x\n", xid));
return retval;
}
else
@@ -3320,7 +3325,13 @@ gdk_x11_drag_context_find_window (GdkDragContext *context,
&context_x11->version);
if (recipient != None)
dest_window = gdk_x11_window_foreign_new_for_display (display, recipient);
{
dest_window = gdk_x11_window_lookup_for_display (display, recipient);
if (dest_window)
g_object_ref (dest_window);
else
dest_window = gdk_x11_window_foreign_new_for_display (display, recipient);
}
else
dest_window = NULL;
}
+4 -4
View File
@@ -155,10 +155,6 @@ gdk_event_source_translate_event (GdkEventSource *event_source,
GdkFilterReturn result;
GdkWindow *filter_window;
filter_window = gdk_event_source_get_filter_window (event_source, xevent);
if (filter_window)
event->any.window = g_object_ref (filter_window);
/* Run default filters */
if (_gdk_default_filters)
{
@@ -175,11 +171,15 @@ gdk_event_source_translate_event (GdkEventSource *event_source,
return event;
}
filter_window = gdk_event_source_get_filter_window (event_source, xevent);
if (filter_window)
{
/* Apply per-window filters */
GdkFilterReturn result;
event->any.window = g_object_ref (filter_window);
if (filter_window->filters)
{
result = gdk_event_apply_filters (xevent, event,
-7
View File
@@ -116,13 +116,6 @@ _gdk_x11_windowing_init (void)
{
XSetErrorHandler (gdk_x_error);
XSetIOErrorHandler (gdk_x_io_error);
gdk_window_add_filter (NULL,
_gdk_wm_protocols_filter,
NULL);
gdk_window_add_filter (NULL,
_gdk_x11_dnd_filter,
NULL);
}
GdkGrabStatus
+2 -11
View File
@@ -182,12 +182,6 @@ void _gdk_x11_display_update_grab_info_ungrab (GdkDisplay *display,
void _gdk_x11_display_queue_events (GdkDisplay *display);
GdkAppLaunchContext *_gdk_x11_display_get_app_launch_context (GdkDisplay *display);
Window _gdk_x11_display_get_drag_protocol (GdkDisplay *display,
Window xid,
GdkDragProtocol *protocol,
guint *version);
gboolean _gdk_x11_display_set_selection_owner (GdkDisplay *display,
GdkWindow *owner,
GdkAtom selection,
@@ -196,7 +190,7 @@ gboolean _gdk_x11_display_set_selection_owner (GdkDisplay *display,
GdkWindow * _gdk_x11_display_get_selection_owner (GdkDisplay *display,
GdkAtom selection);
void _gdk_x11_display_send_selection_notify (GdkDisplay *display,
GdkWindow *requestor,
GdkNativeWindow requestor,
GdkAtom selection,
GdkAtom target,
GdkAtom property,
@@ -292,10 +286,7 @@ void _gdk_x11_precache_atoms (GdkDisplay *display,
const gchar * const *atom_names,
gint n_atoms);
GdkFilterReturn
_gdk_x11_dnd_filter (GdkXEvent *xev,
GdkEvent *event,
gpointer data);
void _gdk_x11_display_init_dnd (GdkDisplay *display);
void _gdk_x11_screen_init_root_window (GdkScreen *screen);
void _gdk_x11_screen_init_visuals (GdkScreen *screen);
+89 -2
View File
@@ -1019,12 +1019,12 @@ gdk_x11_screen_get_active_window (GdkScreen *screen)
{
if ((type_return == XA_WINDOW) && (format_return == 32) && (data))
{
Window window = *(Window *) data;
GdkNativeWindow window = *(GdkNativeWindow *) data;
if (window != None)
{
ret = gdk_x11_window_foreign_new_for_display (x11_screen->display,
window);
*(Window *) data);
}
}
}
@@ -1086,6 +1086,92 @@ gdk_x11_screen_get_window_stack (GdkScreen *screen)
return ret;
}
/* Sends a ClientMessage to all toplevel client windows */
static gboolean
gdk_event_send_client_message_to_all_recurse (GdkDisplay *display,
XEvent *xev,
guint32 xid,
guint level)
{
Atom type = None;
int format;
unsigned long nitems, after;
unsigned char *data;
Window *ret_children, ret_root, ret_parent;
unsigned int ret_nchildren;
gboolean send = FALSE;
gboolean found = FALSE;
gboolean result = FALSE;
int i;
gdk_x11_display_error_trap_push (display);
if (XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), xid,
gdk_x11_get_xatom_by_name_for_display (display, "WM_STATE"),
0, 0, False, AnyPropertyType,
&type, &format, &nitems, &after, &data) != Success)
goto out;
if (type)
{
send = TRUE;
XFree (data);
}
else
{
/* OK, we're all set, now let's find some windows to send this to */
if (!XQueryTree (GDK_DISPLAY_XDISPLAY (display), xid,
&ret_root, &ret_parent,
&ret_children, &ret_nchildren))
goto out;
for(i = 0; i < ret_nchildren; i++)
if (gdk_event_send_client_message_to_all_recurse (display, xev, ret_children[i], level + 1))
found = TRUE;
XFree (ret_children);
}
if (send || (!found && (level == 1)))
{
xev->xclient.window = xid;
_gdk_x11_display_send_xevent (display, xid, False, NoEventMask, xev);
}
result = send || found;
out:
gdk_x11_display_error_trap_pop_ignored (display);
return result;
}
static void
gdk_x11_screen_broadcast_client_message (GdkScreen *screen,
GdkEvent *event)
{
XEvent sev;
GdkWindow *root_window;
g_return_if_fail (event != NULL);
root_window = gdk_screen_get_root_window (screen);
/* Set up our event to send, with the exception of its target window */
sev.xclient.type = ClientMessage;
sev.xclient.display = GDK_WINDOW_XDISPLAY (root_window);
sev.xclient.format = event->client.data_format;
memcpy(&sev.xclient.data, &event->client.data, sizeof (sev.xclient.data));
sev.xclient.message_type =
gdk_x11_atom_to_xatom_for_display (GDK_WINDOW_DISPLAY (root_window),
event->client.message_type);
gdk_event_send_client_message_to_all_recurse (gdk_screen_get_display (screen),
&sev,
GDK_WINDOW_XID (root_window),
0);
}
static gboolean
check_transform (const gchar *xsettings_name,
GType src_type,
@@ -1605,6 +1691,7 @@ gdk_x11_screen_class_init (GdkX11ScreenClass *klass)
screen_class->make_display_name = gdk_x11_screen_make_display_name;
screen_class->get_active_window = gdk_x11_screen_get_active_window;
screen_class->get_window_stack = gdk_x11_screen_get_window_stack;
screen_class->broadcast_client_message = gdk_x11_screen_broadcast_client_message;
screen_class->get_setting = gdk_x11_screen_get_setting;
screen_class->visual_get_best_depth = _gdk_x11_screen_visual_get_best_depth;
screen_class->visual_get_best_type = _gdk_x11_screen_visual_get_best_type;
+3 -3
View File
@@ -308,7 +308,7 @@ _gdk_x11_display_get_selection_property (GdkDisplay *display,
void
_gdk_x11_display_send_selection_notify (GdkDisplay *display,
GdkWindow *requestor,
GdkNativeWindow requestor,
GdkAtom selection,
GdkAtom target,
GdkAtom property,
@@ -319,7 +319,7 @@ _gdk_x11_display_send_selection_notify (GdkDisplay *display,
xevent.type = SelectionNotify;
xevent.serial = 0;
xevent.send_event = True;
xevent.requestor = GDK_WINDOW_XID (requestor);
xevent.requestor = requestor;
xevent.selection = gdk_x11_atom_to_xatom_for_display (display, selection);
xevent.target = gdk_x11_atom_to_xatom_for_display (display, target);
if (property == GDK_NONE)
@@ -328,7 +328,7 @@ _gdk_x11_display_send_selection_notify (GdkDisplay *display,
xevent.property = gdk_x11_atom_to_xatom_for_display (display, property);
xevent.time = time;
_gdk_x11_display_send_xevent (display, xevent.requestor, False, NoEventMask, (XEvent*) & xevent);
_gdk_x11_display_send_xevent (display, requestor, False, NoEventMask, (XEvent*) & xevent);
}
/**
+1 -30
View File
@@ -876,9 +876,7 @@ x_event_mask_to_gdk_event_mask (long mask)
* @display: the #GdkDisplay where the window handle comes from.
* @window: an XLib <type>Window</type>
*
* Wraps a native window in a #GdkWindow. The function will try to
* look up the window using gdk_x11_window_lookup_for_display() first.
* If it does not find it there, it will create a new window.
* Wraps a native window in a #GdkWindow.
*
* This may fail if the window has been destroyed. If the window
* was already known to GDK, a new reference to the existing
@@ -1108,32 +1106,6 @@ gdk_x11_window_destroy_notify (GdkWindow *window)
g_object_unref (window);
}
static GdkDragProtocol
gdk_x11_window_get_drag_protocol (GdkWindow *window,
GdkWindow **target)
{
GdkDragProtocol protocol;
GdkDisplay *display;
guint version;
Window xid;
display = gdk_window_get_display (window);
xid = _gdk_x11_display_get_drag_protocol (display,
GDK_WINDOW_XID (window->impl_window),
&protocol,
&version);
if (target)
{
if (xid != None)
*target = gdk_x11_window_foreign_new_for_display (display, xid);
else
*target = NULL;
}
return protocol;
}
static void
update_wm_hints (GdkWindow *window,
gboolean force)
@@ -4805,7 +4777,6 @@ gdk_window_impl_x11_class_init (GdkWindowImplX11Class *klass)
impl_class->set_opacity = gdk_x11_window_set_opacity;
impl_class->set_composited = gdk_x11_window_set_composited;
impl_class->destroy_notify = gdk_x11_window_destroy_notify;
impl_class->get_drag_protocol = gdk_x11_window_get_drag_protocol;
impl_class->register_dnd = _gdk_x11_window_register_dnd;
impl_class->drag_begin = _gdk_x11_window_drag_begin;
impl_class->process_updates_recurse = gdk_x11_window_process_updates_recurse;
-17
View File
@@ -52,23 +52,6 @@ Display *gdk_x11_get_default_xdisplay (void);
#define GDK_ROOT_WINDOW() (gdk_x11_get_default_root_xwindow ())
#endif
/**
* GDK_XID_TO_POINTER:
*
* Converts an XID into a @gpointer. This is useful with data structures
* that use pointer arguments such as #GHashTable. Use GDK_POINTER_TO_XID()
* to convert the argument back to an XID.
*/
#define GDK_XID_TO_POINTER(pointer) GUINT_TO_POINTER(pointer)
/**
* GDK_POINTER_TO_XID:
*
* Converts a @gpointer back to an XID that was previously converted
* using GDK_XID_TO_POINTER().
*/
#define GDK_POINTER_TO_XID(pointer) GPOINTER_TO_UINT(pointer)
#ifndef GDK_MULTIHEAD_SAFE
void gdk_x11_grab_server (void);
void gdk_x11_ungrab_server (void);
+36 -25
View File
@@ -16,7 +16,8 @@ else
GTK_PRINT_PREVIEW_COMMAND="evince --unlink-tempfile --preview --print-settings %s %f"
endif
SUBDIRS = . tests
SUBDIRS = theme-bits . tests
DIST_SUBDIRS = theme-bits tests
if HAVE_PAPI_CUPS
GTK_PRINT_BACKENDS=file,papi,cups
@@ -143,7 +144,6 @@ endif
# by configure)
gtk_public_h_sources = \
gtk.h \
gtkx.h \
gtkaboutdialog.h \
gtkaccelgroup.h \
gtkaccellabel.h \
@@ -380,11 +380,9 @@ gtk_private_h_sources = \
gtkappchooserprivate.h \
gtkappchoosermodule.h \
gtkappchooseronline.h \
gtkbindingsprivate.h \
gtkbuilderprivate.h \
gtkbuttonprivate.h \
gtkcellareaboxcontextprivate.h \
gtkcssproviderprivate.h \
gtkcustompaperunixdialog.h \
gtkdndcursors.h \
gtkentryprivate.h \
@@ -407,9 +405,9 @@ gtk_private_h_sources = \
gtkmodifierstyle.h \
gtkmountoperationprivate.h \
gtknumerableiconprivate.h \
gtkorientableprivate.h \
gtkpango.h \
gtkpathbar.h \
gtkplugprivate.h \
gtkprintoperation-private.h \
gtkprintutils.h \
gtkprivate.h \
@@ -418,7 +416,6 @@ gtk_private_h_sources = \
gtkrecentchooserdefault.h \
gtkrecentchooserprivate.h \
gtkrecentchooserutils.h \
gtkscaleprivate.h \
gtksearchengine.h \
gtksearchenginesimple.h \
gtkselectionprivate.h \
@@ -581,6 +578,7 @@ gtk_base_c_sources = \
gtkpango.c \
gtkpapersize.c \
gtkpathbar.c \
gtkplug.c \
gtkprintcontext.c \
gtkprintoperation.c \
gtkprintoperationpreview.c \
@@ -616,6 +614,7 @@ gtk_base_c_sources = \
gtksizegroup.c \
gtksizerequest.c \
gtkshow.c \
gtksocket.c \
gtkspinbutton.c \
gtkspinner.c \
gtkstatusbar.c \
@@ -725,19 +724,25 @@ gtk_c_sources += $(gtk_os_win32_c_sources)
endif
gtk_use_x11_c_sources = \
gtkplug.c \
gtksocket.c \
gtkplug-x11.c \
gtksocket-x11.c \
gtkxembed.c \
gtktrayicon-x11.c \
gtkmountoperation-x11.c
gtk_use_win32_c_sources = \
gtkplug-win32.c \
gtksocket-win32.c \
gtkwin32embed.c \
gtkwin32embedwidget.c \
gtkmountoperation-stub.c
gtk_use_quartz_c_sources = \
gtksearchenginequartz.c \
gtkplug-stub.c \
gtksocket-stub.c \
gtkmountoperation-stub.c
gtk_use_stub_c_sources = \
gtkplug-stub.c \
gtksocket-stub.c \
gtkmountoperation-stub.c
gtk_all_c_sources += $(gtk_use_x11_c_sources) $(gtk_use_win32_c_sources) $(gtk_use_quartz_c_sources) $(gtk_use_stub_c_sources)
if USE_X11
@@ -869,7 +874,7 @@ gtktypebuiltins.c: @REBUILD@ $(gtk_public_h_sources) gtktypebuiltins.c.template
&& rm -f xgen-gtbc
gtktypefuncs.c: @REBUILD@ stamp-gtktypebuiltins.h $(top_srcdir)/gtk/*.h $(top_srcdir)/gdk/*.h Makefile
$(AM_V_GEN) echo '#include <gtk/gtkx.h>' > xgen-gtfsrc.c && \
$(AM_V_GEN) echo '#include <gtk/gtk.h>' > xgen-gtfsrc.c && \
${CPP} $(DEFS) $(INCLUDES) -DGTK_ENABLE_BROKEN $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) xgen-gtfsrc.c | \
$(GREP) -o '\bg[td]k_[a-zA-Z0-9_]*_get_type\b' | \
sort | uniq | \
@@ -906,10 +911,10 @@ endif
if USE_QUARTZ
install-mac-key-theme:
$(mkdir_p) $(DESTDIR)$(datadir)/themes/Mac/gtk-3.0
$(INSTALL_DATA) $(srcdir)/gtk-keys.css.mac $(DESTDIR)$(datadir)/themes/Mac/gtk-3.0/gtk-keys.css
$(mkdir_p) $(DESTDIR)$(datadir)/themes/Mac/gtk-3.0-key
$(INSTALL_DATA) $(srcdir)/gtkrc.key.mac $(DESTDIR)$(datadir)/themes/Mac/gtk-3.0-key/gtkrc
uninstall-mac-key-theme:
rm -f $(DESTDIR)$(datadir)/themes/Mac/gtk-3.0/gtk-keys.css
rm -f $(DESTDIR)$(datadir)/themes/Mac/gtk-3.0-key/gtkrc
else
install-mac-key-theme:
uninstall-mac-key-theme:
@@ -930,16 +935,16 @@ dist-hook: ../build/win32/vs9/gtk.vcproj
# Install a RC file for the default GTK+ theme, and key themes
install-data-local: install-ms-lib install-def-file install-mac-key-theme
$(mkdir_p) $(DESTDIR)$(datadir)/themes/Raleigh/gtk-3.0
$(INSTALL_DATA) $(srcdir)/gtk.css.raleigh $(DESTDIR)$(datadir)/themes/Raleigh/gtk-3.0/gtk.css
$(mkdir_p) $(DESTDIR)$(datadir)/themes/Default/gtk-3.0
$(INSTALL_DATA) $(srcdir)/gtk-keys.css.default $(DESTDIR)$(datadir)/themes/Default/gtk-3.0/gtk-keys.css
$(mkdir_p) $(DESTDIR)$(datadir)/themes/Emacs/gtk-3.0
$(INSTALL_DATA) $(srcdir)/gtk-keys.css.emacs $(DESTDIR)$(datadir)/themes/Emacs/gtk-3.0/gtk-keys.css
$(INSTALL_DATA) $(srcdir)/gtkrc.default $(DESTDIR)$(datadir)/themes/Raleigh/gtk-3.0/gtkrc
$(mkdir_p) $(DESTDIR)$(datadir)/themes/Default/gtk-3.0-key
$(INSTALL_DATA) $(srcdir)/gtkrc.key.default $(DESTDIR)$(datadir)/themes/Default/gtk-3.0-key/gtkrc
$(mkdir_p) $(DESTDIR)$(datadir)/themes/Emacs/gtk-3.0-key
$(INSTALL_DATA) $(srcdir)/gtkrc.key.emacs $(DESTDIR)$(datadir)/themes/Emacs/gtk-3.0-key/gtkrc
uninstall-local: uninstall-ms-lib uninstall-def-file uninstall-mac-key-theme
rm -f $(DESTDIR)$(datadir)/themes/Raleigh/gtk-3.0/gtk.css
rm -f $(DESTDIR)$(datadir)/themes/Default/gtk-3.0/gtk-keys.css
rm -f $(DESTDIR)$(datadir)/themes/Emacs/gtk-3.0/gtk-keys.css
rm -f $(DESTDIR)$(datadir)/themes/Raleigh/gtk-3.0/gtkrc
rm -f $(DESTDIR)$(datadir)/themes/Default/gtk-3.0-key/gtkrc
rm -f $(DESTDIR)$(datadir)/themes/Emacs/gtk-3.0-key/gtkrc
# if srcdir!=builddir, clean out maintainer-clean files from builddir
# this allows dist to pass.
@@ -972,7 +977,7 @@ Gtk_3_0_gir_SCANNERFLAGS = \
if USE_X11
Gtk_3_0_gir_SCANNERFLAGS += --add-include-path=$(top_builddir)/gdk/x11
endif
Gtk_3_0_gir_SCANNERFLAGS += --c-include="gtk/gtkx.h"
Gtk_3_0_gir_SCANNERFLAGS += --c-include="gtk/gtk.h"
Gtk_3_0_gir_INCLUDES = Atk-1.0 Gdk-3.0
Gtk_3_0_gir_CFLAGS = \
$(INCLUDES) \
@@ -1350,6 +1355,12 @@ gtkbuiltincache.h: @REBUILD@ stamp-icons
EXTRA_DIST += \
$(STOCK_ICONS) \
$(GENERATED_ICONS) \
line-arrow.xbm \
line-wrap.xbm \
tree_plus.xbm \
tree_minus.xbm \
tree_minus.xpm \
tree_plus.xpm \
gtk.def \
gtk-win32.rc \
gtk-win32.rc.in \
@@ -1359,10 +1370,10 @@ EXTRA_DIST += \
gtkprint-win32.h \
gtkprint-win32.c \
gtksearchenginequartz.h \
gtk.css.raleigh \
gtk-keys.css.default \
gtk-keys.css.emacs \
gtk-keys.css.mac \
gtkrc.default \
gtkrc.key.default \
gtkrc.key.emacs \
gtkrc.key.mac \
makefile.msc \
makefile.msc.in \
abicheck.sh \
+46
View File
@@ -0,0 +1,46 @@
#define circles_width 64
#define circles_height 64
static unsigned char circles_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0x00, 0x00, 0x00,
0x00, 0x00, 0xfc, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff,
0xff, 0x1f, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00,
0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff,
0xff, 0xff, 0x01, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00,
0x00, 0xfe, 0xff, 0x01, 0xf0, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x3f, 0x00,
0x80, 0xff, 0x1f, 0x00, 0x80, 0xff, 0x0f, 0x00, 0x00, 0xfe, 0x3f, 0x00,
0x80, 0xff, 0x03, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0xc0, 0xff, 0x01, 0x00,
0x00, 0xf0, 0x7f, 0x00, 0xe0, 0x7f, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x00,
0xf0, 0x3f, 0x00, 0x00, 0x00, 0x80, 0xff, 0x01, 0xf0, 0x1f, 0x00, 0x00,
0x00, 0x00, 0xff, 0x01, 0xf8, 0x1f, 0x00, 0x20, 0x00, 0x00, 0xff, 0x03,
0xf8, 0x0f, 0x00, 0xff, 0x07, 0x00, 0xfe, 0x03, 0xfc, 0x07, 0xc0, 0xff,
0x1f, 0x00, 0xfc, 0x07, 0xfc, 0x07, 0xf0, 0xff, 0x7f, 0x00, 0xfc, 0x07,
0xfc, 0x03, 0xf8, 0xff, 0xff, 0x00, 0xf8, 0x07, 0xfe, 0x03, 0xfc, 0xff,
0xff, 0x01, 0xf8, 0x0f, 0xfe, 0x01, 0xfe, 0x8f, 0xff, 0x03, 0xf0, 0x0f,
0xfe, 0x01, 0xfe, 0x01, 0xfc, 0x03, 0xf0, 0x0f, 0xff, 0x01, 0xff, 0x00,
0xf8, 0x07, 0xf0, 0x1f, 0xff, 0x00, 0x7f, 0x00, 0xf0, 0x07, 0xe0, 0x1f,
0xff, 0x80, 0x3f, 0x00, 0xe0, 0x0f, 0xe0, 0x1f, 0xff, 0x80, 0x1f, 0x00,
0xc0, 0x0f, 0xe0, 0x1f, 0xff, 0x80, 0x1f, 0x00, 0xc0, 0x0f, 0xe0, 0x1f,
0xff, 0x80, 0x1f, 0x00, 0xc0, 0x0f, 0xe0, 0x1f, 0xff, 0x80, 0x0f, 0x00,
0x80, 0x0f, 0xe0, 0x1f, 0xff, 0xc0, 0x0f, 0x00, 0x80, 0x1f, 0xe0, 0x1f,
0xff, 0x80, 0x0f, 0x00, 0x80, 0x0f, 0xe0, 0x1f, 0xff, 0x80, 0x1f, 0x00,
0xc0, 0x0f, 0xe0, 0x1f, 0xff, 0x80, 0x1f, 0x00, 0xc0, 0x0f, 0xe0, 0x1f,
0xff, 0x80, 0x1f, 0x00, 0xc0, 0x0f, 0xe0, 0x1f, 0xff, 0x81, 0x3f, 0x00,
0xe0, 0x0f, 0xf0, 0x1f, 0xfe, 0x01, 0x7f, 0x00, 0xf0, 0x07, 0xf0, 0x0f,
0xfe, 0x01, 0xff, 0x00, 0xf8, 0x07, 0xf0, 0x0f, 0xfe, 0x03, 0xfe, 0x01,
0xfc, 0x03, 0xf8, 0x0f, 0xfc, 0x03, 0xfe, 0x8f, 0xff, 0x03, 0xf8, 0x07,
0xfc, 0x07, 0xfc, 0xff, 0xff, 0x01, 0xfc, 0x07, 0xfc, 0x07, 0xf8, 0xff,
0xff, 0x00, 0xfc, 0x07, 0xf8, 0x0f, 0xf0, 0xff, 0x7f, 0x00, 0xfe, 0x03,
0xf8, 0x1f, 0xc0, 0xff, 0x1f, 0x00, 0xff, 0x03, 0xf0, 0x1f, 0x00, 0xff,
0x07, 0x00, 0xff, 0x01, 0xf0, 0x3f, 0x00, 0x20, 0x00, 0x80, 0xff, 0x01,
0xe0, 0x7f, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x00, 0xc0, 0xff, 0x01, 0x00,
0x00, 0xf0, 0x7f, 0x00, 0x80, 0xff, 0x03, 0x00, 0x00, 0xf8, 0x3f, 0x00,
0x80, 0xff, 0x0f, 0x00, 0x00, 0xfe, 0x3f, 0x00, 0x00, 0xff, 0x3f, 0x00,
0x80, 0xff, 0x1f, 0x00, 0x00, 0xfe, 0xff, 0x01, 0xf0, 0xff, 0x0f, 0x00,
0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0xf0, 0xff, 0xff,
0xff, 0xff, 0x01, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00,
0x00, 0xc0, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff,
0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x07, 0x00, 0x00,
0x00, 0x00, 0xe0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
-3
View File
@@ -1,3 +0,0 @@
/*
* Default keybinding set. Empty because it is implemented inline in the code.
*/
-123
View File
@@ -1,123 +0,0 @@
/*
* GTK - The GIMP Toolkit
* Copyright (C) 2002 Owen Taylor
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
/*
* A keybinding set implementing Emacs-like keybindings
*/
/*
* Bindings for GtkTextView and GtkEntry
*/
@binding-set gtk-emacs-text-entry
{
bind "<ctrl>b" { "move-cursor" (logical-positions, -1, 0) };
bind "<shift><ctrl>b" { "move-cursor" (logical-positions, -1, 1) };
bind "<ctrl>f" { "move-cursor" (logical-positions, 1, 0) };
bind "<shift><ctrl>f" { "move-cursor" (logical-positions, 1, 1) };
bind "<alt>b" { "move-cursor" (words, -1, 0) };
bind "<shift><alt>b" { "move-cursor" (words, -1, 1) };
bind "<alt>f" { "move-cursor" (words, 1, 0) };
bind "<shift><alt>f" { "move-cursor" (words, 1, 1) };
bind "<ctrl>a" { "move-cursor" (paragraph-ends, -1, 0) };
bind "<shift><ctrl>a" { "move-cursor" (paragraph-ends, -1, 1) };
bind "<ctrl>e" { "move-cursor" (paragraph-ends, 1, 0) };
bind "<shift><ctrl>e" { "move-cursor" (paragraph-ends, 1, 1) };
bind "<ctrl>w" { "cut-clipboard" () };
bind "<ctrl>y" { "paste-clipboard" () };
bind "<ctrl>d" { "delete-from-cursor" (chars, 1) };
bind "<alt>d" { "delete-from-cursor" (word-ends, 1) };
bind "<ctrl>k" { "delete-from-cursor" (paragraph-ends, 1) };
bind "<alt>backslash" { "delete-from-cursor" (whitespace, 1) };
bind "<alt>space" { "delete-from-cursor" (whitespace, 1)
"insert-at-cursor" (" ") };
bind "<alt>KP_Space" { "delete-from-cursor" (whitespace, 1)
"insert-at-cursor" (" ") };
/*
* Some non-Emacs keybindings people are attached to
*/
bind "<ctrl>u" { "move-cursor" (paragraph-ends, -1, 0)
"delete-from-cursor" (paragraph-ends, 1) };
bind "<ctrl>h" { "delete-from-cursor" (chars, -1) };
bind "<ctrl>w" { "delete-from-cursor" (word-ends, -1) };
};
/*
* Bindings for GtkTextView
*/
@binding-set gtk-emacs-text-view
{
bind "<ctrl>p" { "move-cursor" (display-lines, -1, 0) };
bind "<shift><ctrl>p" { "move-cursor" (display-lines, -1, 1) };
bind "<ctrl>n" { "move-cursor" (display-lines, 1, 0) };
bind "<shift><ctrl>n" { "move-cursor" (display-lines, 1, 1) };
bind "<ctrl>space" { "set-anchor" () };
bind "<ctrl>KP_Space" { "set-anchor" () };
};
/*
* Bindings for GtkTreeView
*/
@binding-set gtk-emacs-tree-view
{
bind "<ctrl>s" { "start-interactive-search" () };
bind "<ctrl>f" { "move-cursor" (logical-positions, 1) };
bind "<ctrl>b" { "move-cursor" (logical-positions, -1) };
};
/*
* Bindings for menus
*/
@binding-set gtk-emacs-menu
{
bind "<ctrl>n" { "move-current" (next) };
bind "<ctrl>p" { "move-current" (prev) };
bind "<ctrl>f" { "move-current" (child) };
bind "<ctrl>b" { "move-current" (parent) };
};
GtkEntry {
gtk-key-bindings: gtk-emacs-text-entry;
}
GtkTextView {
gtk-key-bindings: gtk-emacs-text-entry, gtk-emacs-text-view;
}
GtkTreeView {
gtk-key-bindings: gtk-emacs-tree-view;
}
GtkMenuShell {
gtk-key-bindings: gtk-emacs-menu;
}
-205
View File
@@ -1,205 +0,0 @@
@binding-set gtk-mac-alt-arrows
{
bind "<alt>Right" { "move-cursor" (words, 1, 0) };
bind "<alt>KP_Right" { "move-cursor" (words, 1, 0) };
bind "<alt>Left" { "move-cursor" (words, -1, 0) };
bind "<alt>KP_Left" { "move-cursor" (words, -1, 0) };
bind "<shift><alt>Right" { "move-cursor" (words, 1, 1) };
bind "<shift><alt>KP_Right" { "move-cursor" (words, 1, 1) };
bind "<shift><alt>Left" { "move-cursor" (words, -1, 1) };
bind "<shift><alt>KP_Left" { "move-cursor" (words, -1, 1) };
};
@binding-set gtk-mac-alt-delete
{
bind "<alt>Delete" { "delete-from-cursor" (word-ends, 1) };
bind "<alt>KP_Delete" { "delete-from-cursor" (word-ends, 1) };
bind "<alt>BackSpace" { "delete-from-cursor" (word-ends, -1) };
};
@binding-set gtk-mac-cmd-c
{
bind "<meta>x" { "cut-clipboard" () };
bind "<meta>c" { "copy-clipboard" () };
bind "<meta>v" { "paste-clipboard" () };
unbind "<ctrl>x";
unbind "<ctrl>c";
unbind "<ctrl>v";
};
@binding-set gtk-mac-text-view
{
bind "<shift><meta>a" { "select-all" (0) };
bind "<meta>a" { "select-all" (1) };
unbind "<shift><ctrl>a";
unbind "<ctrl>a";
};
@binding-set gtk-mac-label
{
bind "<meta>a" {
"move-cursor" (paragraph-ends, -1, 0)
"move-cursor" (paragraph-ends, 1, 1)
};
bind "<shift><meta>a" { "move-cursor" (paragraph-ends, 0, 0) };
bind "<meta>c" { "copy-clipboard" () };
unbind "<ctrl>a";
unbind "<shift><ctrl>a";
unbind "<ctrl>c";
};
@binding-set gtk-mac-entry
{
bind "<meta>a" {
"move-cursor" (buffer-ends, -1, 0)
"move-cursor" (buffer-ends, 1, 1)
};
bind "<shift><meta>a" { "move-cursor" (visual-positions, 0, 0) };
unbind "<ctrl>a";
unbind "<shift><ctrl>a";
};
@binding-set gtk-mac-file-chooser
{
bind "<meta>v" { "location-popup-on-paste" () };
unbind "<ctrl>v";
bind "<meta><shift>G" { "location-popup" () };
bind "<meta><shift>H" { "home-folder" () };
bind "<meta>Up" { "up-folder" () };
};
@binding-set gtk-mac-tree-view
{
bind "<meta>a" { "select-all" () };
bind "<shift><meta>a" { "unselect-all" () };
bind "<meta>f" { "start-interactive-search" () };
bind "<meta>F" { "start-interactive-search" () }
unbind "<ctrl>a";
unbind "<shift><ctrl>a";
unbind "<ctrl>f";
unbind "<ctrl>F";
};
@binding-set gtk-mac-icon-view
{
bind "<meta>a" { "select-all" () };
bind "<shift><meta>a" { "unselect-all" () };
unbind "<ctrl>a";
unbind "<shift><ctrl>a";
};
@binding-set gtk-mac-alt-arrows
{
bind "<alt>Right" { "move-cursor" (words, 1, 0) };
bind "<alt>KP_Right" { "move-cursor" (words, 1, 0) };
bind "<alt>Left" { "move-cursor" (words, -1, 0) };
bind "<alt>KP_Left" { "move-cursor" (words, -1, 0) };
bind "<shift><alt>Right" { "move-cursor" (words, 1, 1) };
bind "<shift><alt>KP_Right" { "move-cursor" (words, 1, 1) };
bind "<shift><alt>Left" { "move-cursor" (words, -1, 1) };
bind "<shift><alt>KP_Left" { "move-cursor" (words, -1, 1) };
};
@binding-set gtk-mac-alt-delete
{
bind "<alt>Delete" { "delete-from-cursor" (word-ends, 1) };
bind "<alt>KP_Delete" { "delete-from-cursor" (word-ends, 1) };
bind "<alt>BackSpace" { "delete-from-cursor" (word-ends, -1) };
};
@binding-set gtk-mac-cmd-c
{
bind "<meta>x" { "cut-clipboard" () };
bind "<meta>c" { "copy-clipboard" () };
bind "<meta>v" { "paste-clipboard" () };
unbind "<ctrl>x";
unbind "<ctrl>c";
unbind "<ctrl>v";
};
@binding-set gtk-mac-text-view
{
bind "<shift><meta>a" { "select-all" (0) };
bind "<meta>a" { "select-all" (1) };
unbind "<shift><ctrl>a";
unbind "<ctrl>a";
};
@binding-set gtk-mac-label
{
bind "<meta>a" {
"move-cursor" (paragraph-ends, -1, 0)
"move-cursor" (paragraph-ends, 1, 1)
};
bind "<shift><meta>a" { "move-cursor" (paragraph-ends, 0, 0) };
bind "<meta>c" { "copy-clipboard" () };
unbind "<ctrl>a";
unbind "<shift><ctrl>a";
unbind "<ctrl>c";
};
@binding-set gtk-mac-entry
{
bind "<meta>a" {
"move-cursor" (buffer-ends, -1, 0)
"move-cursor" (buffer-ends, 1, 1)
};
bind "<shift><meta>a" { "move-cursor" (visual-positions, 0, 0) };
unbind "<ctrl>a";
unbind "<shift><ctrl>a";
};
@binding-set gtk-mac-file-chooser
{
bind "<meta>v" { "location-popup-on-paste" () };
unbind "<ctrl>v";
bind "<meta><shift>G" { "location-popup" () };
bind "<meta><shift>H" { "home-folder" () };
bind "<meta>Up" { "up-folder" () };
};
@binding-set gtk-mac-tree-view
{
bind "<meta>a" { "select-all" () };
bind "<shift><meta>a" { "unselect-all" () };
bind "<meta>f" { "start-interactive-search" () };
bind "<meta>F" { "start-interactive-search" () };
unbind "<ctrl>a";
unbind "<shift><ctrl>a";
unbind "<ctrl>f";
unbind "<ctrl>F";
};
@binding-set gtk-mac-icon-view
{
bind "<meta>a" { "select-all" () };
bind "<shift><meta>a" { "unselect-all" () };
unbind "<ctrl>a";
unbind "<shift><ctrl>a";
};
GtkIconView {
gtk-key-bindings: gtk-mac-icon-view;
}
GtkTextView {
gtk-key-bindings: gtk-mac-alt-arrows, gtk-mac-alt-delete, gtk-mac-cmd-c, gtk-mac-text-view;
}
GtkEntry {
gtk-key-bindings: gtk-mac-alt-arrows, gtk-mac-alt-delete, gtk-mac-cmd-c, gtk-mac-entry;
}
GtkLabel {
gtk-key-bindings: gtk-mac-alt-arrows, gtk-mac-label;
}
GtkFileChooserDefault {
gtk-key-bindings: gtk-mac-file-chooser;
}
GtkTreeView {
gtk-key-bindings: gtk-mac-tree-view;
}
-3
View File
@@ -1,3 +0,0 @@
/*
* This theme is the default theme if no other theme is selected.
*/
+2
View File
@@ -143,6 +143,7 @@
#include <gtk/gtkpagesetup.h>
#include <gtk/gtkpapersize.h>
#include <gtk/gtkpaned.h>
#include <gtk/gtkplug.h>
#include <gtk/gtkprintcontext.h>
#include <gtk/gtkprintoperation.h>
#include <gtk/gtkprintoperationpreview.h>
@@ -174,6 +175,7 @@
#include <gtk/gtkshow.h>
#include <gtk/gtksizegroup.h>
#include <gtk/gtksizerequest.h>
#include <gtk/gtksocket.h>
#include <gtk/gtkspinbutton.h>
#include <gtk/gtkspinner.h>
#include <gtk/gtkstatusbar.h>
+5 -2
View File
@@ -254,7 +254,6 @@ gtk_assistant_update_buttons_state
gtk_attach_options_get_type G_GNUC_CONST
gtk_binding_entry_add_signal
gtk_binding_entry_add_signall
gtk_binding_entry_add_signal_from_string
gtk_binding_entry_remove
gtk_binding_entry_skip
gtk_bindings_activate
@@ -418,6 +417,7 @@ gtk_cell_area_get_preferred_height_for_width
gtk_cell_area_get_preferred_width
gtk_cell_area_get_preferred_width_for_height
gtk_cell_area_get_request_mode
gtk_cell_area_get_style_detail
gtk_cell_area_get_type G_GNUC_CONST
gtk_cell_area_has_renderer
gtk_cell_area_inner_cell_area
@@ -428,6 +428,7 @@ gtk_cell_area_remove_focus_sibling
gtk_cell_area_render
gtk_cell_area_request_renderer
gtk_cell_area_set_focus_cell
gtk_cell_area_set_style_detail
gtk_cell_area_stop_editing
gtk_cell_editable_editing_done
gtk_cell_editable_get_type G_GNUC_CONST
@@ -462,7 +463,6 @@ gtk_cell_renderer_get_preferred_width_for_height
gtk_cell_renderer_get_request_mode
gtk_cell_renderer_get_sensitive
gtk_cell_renderer_get_size
gtk_cell_renderer_get_state
gtk_cell_renderer_get_type G_GNUC_CONST
gtk_cell_renderer_get_visible
gtk_cell_renderer_is_activatable
@@ -596,6 +596,7 @@ gtk_color_selection_set_has_palette
gtk_color_selection_set_previous_alpha
gtk_color_selection_set_previous_color
gtk_color_selection_set_previous_rgba
gtk_combo_box_cell_layout_get_area
gtk_combo_box_get_active
gtk_combo_box_get_active_id
gtk_combo_box_get_active_iter
@@ -3678,6 +3679,7 @@ gtk_window_activate_default
gtk_window_activate_focus
gtk_window_activate_key
gtk_window_add_accel_group
gtk_window_add_embedded_xid
gtk_window_add_mnemonic
gtk_window_begin_move_drag
gtk_window_begin_resize_drag
@@ -3740,6 +3742,7 @@ gtk_window_present
gtk_window_present_with_time
gtk_window_propagate_key_event
gtk_window_remove_accel_group
gtk_window_remove_embedded_xid
gtk_window_remove_mnemonic
gtk_window_reshow_with_initial_size
gtk_window_resize
+1 -3
View File
@@ -1103,8 +1103,6 @@ set_title_font (GtkWidget *assistant,
GtkStyleContext *context;
gint size;
gtk_widget_override_font (title_label, NULL);
desc = pango_font_description_new ();
context = gtk_widget_get_style_context (title_label);
size = pango_font_description_get_size (gtk_style_context_get_font (context, 0));
@@ -1112,7 +1110,7 @@ set_title_font (GtkWidget *assistant,
pango_font_description_set_weight (desc, PANGO_WEIGHT_ULTRABOLD);
pango_font_description_set_size (desc, size * PANGO_SCALE_XX_LARGE);
gtk_widget_override_font (title_label, desc);
gtk_widget_modify_font (title_label, desc);
pango_font_description_free (desc);
}
+215 -586
View File
File diff suppressed because it is too large Load Diff
+79 -122
View File
@@ -11,7 +11,7 @@
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
@@ -40,152 +40,109 @@
G_BEGIN_DECLS
typedef struct _GtkBindingSet GtkBindingSet;
typedef struct _GtkBindingEntry GtkBindingEntry;
typedef struct _GtkBindingSignal GtkBindingSignal;
typedef struct _GtkBindingArg GtkBindingArg;
/**
* GtkBindingSet:
* @set_name: unique name of this binding set
* @priority: unused
* @widget_path_pspecs: unused
* @widget_class_pspecs: unused
* @class_branch_pspecs: unused
* @entries: the key binding entries in this binding set
* @current: implementation detail
* @parsed: whether this binding set stems from a CSS file and is reset upon theme changes
*
* A binding set maintains a list of activatable key bindings.
* A single binding set can match multiple types of widgets.
* Similar to style contexts, can be matched by any information contained
* in a widgets #GtkWidgetPath. When a binding within a set is matched upon
* activation, an action signal is emitted on the target widget to carry out
* the actual activation.
/* Binding sets
*/
typedef struct _GtkBindingSet GtkBindingSet;
typedef struct _GtkBindingEntry GtkBindingEntry;
typedef struct _GtkBindingSignal GtkBindingSignal;
typedef struct _GtkBindingArg GtkBindingArg;
struct _GtkBindingSet
{
gchar *set_name;
gint priority;
GSList *widget_path_pspecs;
GSList *widget_class_pspecs;
GSList *class_branch_pspecs;
GtkBindingEntry *entries;
GtkBindingEntry *current;
guint parsed : 1;
gchar *set_name;
gint priority;
GSList *widget_path_pspecs;
GSList *widget_class_pspecs;
GSList *class_branch_pspecs;
GtkBindingEntry *entries;
GtkBindingEntry *current;
guint parsed : 1; /* From RC content */
};
/**
* GtkBindingEntry:
* @keyval: key value to match
* @modifiers: key modifiers to match
* @binding_set: binding set this entry belongs to
* @destroyed: implementation detail
* @in_emission: implementation detail
* @marks_unbound: implementation detail
* @set_next: linked list of entries maintained by binding set
* @hash_next: implementation detail
* @signals: action signals of this entry
*
* Each key binding element of a binding sets binding list is
* represented by a GtkBindingEntry.
*/
struct _GtkBindingEntry
{
/* key portion */
guint keyval;
GdkModifierType modifiers;
GtkBindingSet *binding_set;
guint destroyed : 1;
guint in_emission : 1;
guint marks_unbound : 1;
GtkBindingEntry *set_next;
GtkBindingEntry *hash_next;
GtkBindingSignal *signals;
/* key portion
*/
guint keyval;
GdkModifierType modifiers;
GtkBindingSet *binding_set;
guint destroyed : 1;
guint in_emission : 1;
guint marks_unbound : 1;
GtkBindingEntry *set_next;
GtkBindingEntry *hash_next;
GtkBindingSignal *signals;
};
/**
* GtkBindingArg:
* @arg_type: implementation detail
*
* A #GtkBindingArg holds the data associated with
* an argument for a key binding signal emission as
* stored in #GtkBindingSignal.
*/
struct _GtkBindingArg
{
GType arg_type;
GType arg_type;
union {
glong long_data;
gdouble double_data;
gchar *string_data;
glong long_data;
gdouble double_data;
gchar *string_data;
} d;
};
/**
* GtkBindingSignal:
* @next: implementation detail
* @signal_name: the action signal to be emitted
* @n_args: number of arguments specified for the signal
* @args: the arguments specified for the signal
*
* <anchor id="keybinding-signals"/>
* A GtkBindingSignal stores the necessary information to
* activate a widget in response to a key press via a signal
* emission.
*/
struct _GtkBindingSignal
{
GtkBindingSignal *next;
gchar *signal_name;
guint n_args;
GtkBindingArg *args;
GtkBindingSignal *next;
gchar *signal_name;
guint n_args;
GtkBindingArg *args;
};
GtkBindingSet *gtk_binding_set_new (const gchar *set_name);
GtkBindingSet *gtk_binding_set_by_class (gpointer object_class);
GtkBindingSet *gtk_binding_set_find (const gchar *set_name);
/* Application-level methods */
gboolean gtk_bindings_activate (GObject *object,
guint keyval,
GdkModifierType modifiers);
gboolean gtk_bindings_activate_event (GObject *object,
GdkEventKey *event);
gboolean gtk_binding_set_activate (GtkBindingSet *binding_set,
guint keyval,
GdkModifierType modifiers,
GObject *object);
GtkBindingSet* gtk_binding_set_new (const gchar *set_name);
GtkBindingSet* gtk_binding_set_by_class(gpointer object_class);
GtkBindingSet* gtk_binding_set_find (const gchar *set_name);
gboolean gtk_bindings_activate (GObject *object,
guint keyval,
GdkModifierType modifiers);
gboolean gtk_bindings_activate_event (GObject *object,
GdkEventKey *event);
gboolean gtk_binding_set_activate (GtkBindingSet *binding_set,
guint keyval,
GdkModifierType modifiers,
GObject *object);
void gtk_binding_entry_skip (GtkBindingSet *binding_set,
guint keyval,
GdkModifierType modifiers);
void gtk_binding_entry_add_signal (GtkBindingSet *binding_set,
guint keyval,
GdkModifierType modifiers,
const gchar *signal_name,
guint n_args,
...);
void gtk_binding_entry_add_signall (GtkBindingSet *binding_set,
guint keyval,
GdkModifierType modifiers,
const gchar *signal_name,
GSList *binding_args);
void gtk_binding_entry_skip (GtkBindingSet *binding_set,
guint keyval,
GdkModifierType modifiers);
void gtk_binding_entry_add_signal (GtkBindingSet *binding_set,
guint keyval,
GdkModifierType modifiers,
const gchar *signal_name,
guint n_args,
...);
void gtk_binding_entry_add_signall (GtkBindingSet *binding_set,
guint keyval,
GdkModifierType modifiers,
const gchar *signal_name,
GSList *binding_args);
void gtk_binding_entry_remove (GtkBindingSet *binding_set,
guint keyval,
GdkModifierType modifiers);
GTokenType gtk_binding_entry_add_signal_from_string
(GtkBindingSet *binding_set,
const gchar *signal_desc);
void gtk_binding_set_add_path (GtkBindingSet *binding_set,
GtkPathType path_type,
const gchar *path_pattern,
GtkPathPriorityType priority);
void gtk_binding_entry_remove (GtkBindingSet *binding_set,
guint keyval,
GdkModifierType modifiers);
#ifndef GTK_DISABLE_DEPRECATED
void gtk_binding_set_add_path (GtkBindingSet *binding_set,
GtkPathType path_type,
const gchar *path_pattern,
GtkPathPriorityType priority);
#endif
/* Non-public methods */
guint _gtk_binding_parse_binding (GScanner *scanner);
void _gtk_binding_reset_parsed (void);
void _gtk_binding_entry_add_signall (GtkBindingSet *binding_set,
guint keyval,
GdkModifierType modifiers,
const gchar *signal_name,
GSList *binding_args);
G_END_DECLS
-37
View File
@@ -1,37 +0,0 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 2011 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GTK_BINDINGS_PRIVATE_H__
#define __GTK_BINDINGS_PRIVATE_H__
#include "gtkbindings.h"
G_BEGIN_DECLS
guint _gtk_binding_parse_binding (GScanner *scanner);
void _gtk_binding_reset_parsed (void);
void _gtk_binding_entry_add_signall (GtkBindingSet *binding_set,
guint keyval,
GdkModifierType modifiers,
const gchar *signal_name,
GSList *binding_args);
G_END_DECLS
#endif /* __GTK_BINDINGS_PRIVATE_H__ */
-8
View File
@@ -261,10 +261,6 @@ gtk_box_class_init (GtkBoxClass *class)
* Note that the default value for this property is %FALSE for GtkBox,
* but #GtkHBox, #GtkVBox and other subclasses use the old default
* of %TRUE.
*
* Note that the #GtkWidget:halign, #GtkWidget:valign, #GtkWidget:hexpand
* and #GtkWidget:vexpand properties are the preferred way to influence
* child size allocation in containers.
*/
gtk_container_class_install_child_property (container_class,
CHILD_PROP_EXPAND,
@@ -278,10 +274,6 @@ gtk_box_class_init (GtkBoxClass *class)
* GtkBox:fill:
*
* Whether the child should receive extra space when the parent grows.
*
* Note that the #GtkWidget:halign, #GtkWidget:valign, #GtkWidget:hexpand
* and #GtkWidget:vexpand properties are the preferred way to influence
* child size allocation in containers.
*/
gtk_container_class_install_child_property (container_class,
CHILD_PROP_FILL,
-1
View File
@@ -231,7 +231,6 @@
* <link linkend="GtkUIManager-BUILDER-UI">GtkUIManager</link>,
* <link linkend="GtkActionGroup-BUILDER-UI">GtkActionGroup</link>.
* <link linkend="GtkMenuItem-BUILDER-UI">GtkMenuItem</link>,
* <link linkend="GtkMenuToolButton-BUILDER-UI">GtkMenuToolButton</link>,
* <link linkend="GtkAssistant-BUILDER-UI">GtkAssistant</link>,
* <link linkend="GtkScale-BUILDER-UI">GtkScale</link>,
* <link linkend="GtkComboBoxText-BUILDER-UI">GtkComboBoxText</link>,
+65 -12
View File
@@ -560,6 +560,9 @@ struct _GtkCellAreaPrivate
/* Tracking which cells are focus siblings of focusable cells */
GHashTable *focus_siblings;
/* Detail string to pass to gtk_paint_*() functions */
gchar *style_detail;
};
enum {
@@ -902,6 +905,7 @@ gtk_cell_area_finalize (GObject *object)
g_hash_table_destroy (priv->focus_siblings);
g_free (priv->current_path);
g_free (priv->style_detail);
G_OBJECT_CLASS (gtk_cell_area_parent_class)->finalize (object);
}
@@ -1099,6 +1103,8 @@ render_cell (GtkCellRenderer *renderer,
gdk_rectangle_union (&data->focus_rect, &cell_focus, &data->focus_rect);
}
}
else
flags &= ~GTK_CELL_RENDERER_FOCUSED;
gtk_cell_renderer_render (renderer, data->cr, data->widget,
cell_background, &inner_area, flags);
@@ -1146,25 +1152,22 @@ gtk_cell_area_real_render (GtkCellArea *area,
render_data.focus_rect.width != 0 &&
render_data.focus_rect.height != 0)
{
GtkStyleContext *style_context;
GtkStateFlags renderer_state = 0;
style_context = gtk_widget_get_style_context (widget);
gtk_style_context_save (style_context);
renderer_state = gtk_cell_renderer_get_state (NULL, widget, flags);
gtk_style_context_set_state (style_context, renderer_state);
GtkStateType renderer_state =
flags & GTK_CELL_RENDERER_SELECTED ? GTK_STATE_SELECTED :
(flags & GTK_CELL_RENDERER_PRELIT ? GTK_STATE_PRELIGHT :
(flags & GTK_CELL_RENDERER_INSENSITIVE ? GTK_STATE_INSENSITIVE : GTK_STATE_NORMAL));
cairo_save (cr);
gdk_cairo_rectangle (cr, background_area);
cairo_clip (cr);
gtk_render_focus (style_context, cr,
render_data.focus_rect.x, render_data.focus_rect.y,
render_data.focus_rect.width, render_data.focus_rect.height);
gtk_paint_focus (gtk_widget_get_style (widget), cr,
renderer_state, widget,
gtk_cell_area_get_style_detail (area),
render_data.focus_rect.x, render_data.focus_rect.y,
render_data.focus_rect.width, render_data.focus_rect.height);
gtk_style_context_restore (style_context);
cairo_restore (cr);
}
}
@@ -1773,6 +1776,56 @@ gtk_cell_area_render (GtkCellArea *area,
g_type_name (G_TYPE_FROM_INSTANCE (area)));
}
/**
* gtk_cell_area_set_style_detail:
* @area: a #GtkCellArea
* @detail: the #GtkStyle detail string to set
*
* Sets the detail string used in any gtk_paint_*() functions
* used by @area.
*
* Since: 3.0
*/
void
gtk_cell_area_set_style_detail (GtkCellArea *area,
const gchar *detail)
{
GtkCellAreaPrivate *priv;
g_return_if_fail (GTK_IS_CELL_AREA (area));
priv = area->priv;
if (g_strcmp0 (priv->style_detail, detail) != 0)
{
g_free (priv->style_detail);
priv->style_detail = g_strdup (detail);
}
}
/**
* gtk_cell_area_get_style_detail:
* @area: a #GtkCellArea
*
* Gets the detail string used in any gtk_paint_*() functions
* used by @area.
*
* Return value: the detail string, the string belongs to the area and should not be freed.
*
* Since: 3.0
*/
G_CONST_RETURN gchar *
gtk_cell_area_get_style_detail (GtkCellArea *area)
{
GtkCellAreaPrivate *priv;
g_return_val_if_fail (GTK_IS_CELL_AREA (area), NULL);
priv = area->priv;
return priv->style_detail;
}
static gboolean
get_cell_allocation (GtkCellRenderer *renderer,
const GdkRectangle *cell_area,
+4
View File
@@ -311,6 +311,10 @@ void gtk_cell_area_render (GtkCellArea
const GdkRectangle *cell_area,
GtkCellRendererState flags,
gboolean paint_focus);
void gtk_cell_area_set_style_detail (GtkCellArea *area,
const gchar *detail);
G_CONST_RETURN gchar *gtk_cell_area_get_style_detail (GtkCellArea *area);
void gtk_cell_area_get_cell_allocation (GtkCellArea *area,
GtkCellAreaContext *context,
-49
View File
@@ -83,55 +83,6 @@
* </example>
* </para>
* </refsect2>
*
* <refsect2>
* <title>Subclassing GtkCellLayout implementations</title>
* <para>
* When subclassing a widget that implements #GtkCellLayout like
* #GtkIconView or #GtkComboBox, there are some considerations related
* to the fact that these widgets internally use a #GtkCellArea.
* The cell area is exposed as a construct-only property by these
* widgets. This means that it is possible to e.g. do
* <informalexample><programlisting>
* combo = g_object_new (GTK_TYPE_COMBO_BOX, "cell-area", my_cell_area, NULL);
* </programlisting></informalexample>
* to use a custom cell area with a combo box. But construct properties
* are only initialized <emphasis>after</emphasis> instance init()
* functions have run, which means that using functions which rely on
* the existence of the cell area in your subclass' init() function will
* cause the default cell area to be instantiated. In this case, a provided
* construct property value will be ignored (with a warning, to alert
* you to the problem).
* <informalexample><programlisting>
* static void
* my_combo_box_init (MyComboBox *b)
* {
* GtkCellRenderer *cell;
*
* cell = gtk_cell_renderer_pixbuf_new ();
* /&ast; The following call causes the default cell area for combo boxes,
* &ast; a GtkCellAreaBox, to be instantiated
* &ast;/
* gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (b), cell, FALSE);
* ...
* }
*
* GtkWidget *
* my_combo_box_new (GtkCellArea *area)
* {
* /&ast; This call is going to cause a warning
* &ast; about area being ignored
* &ast;/
* return g_object_new (MY_TYPE_COMBO_BOX, "cell-area", area, NULL);
* }
* </programlisting></informalexample>
* If supporting alternative cell areas with your derived widget is
* not important, then this does not have to concern you. If you want
* to support alternative cell areas, you can do so by moving the
* problematic calls out of init() and into a constructor()
* for your class.
* </para>
* </refsect2>
*/
#include "config.h"
+1 -56
View File
@@ -683,8 +683,6 @@ gtk_cell_renderer_render (GtkCellRenderer *cell,
{
gboolean selected = FALSE;
GtkCellRendererPrivate *priv = cell->priv;
GtkStyleContext *context;
GtkStateFlags state;
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
g_return_if_fail (GTK_CELL_RENDERER_GET_CLASS (cell)->render != NULL);
@@ -704,21 +702,13 @@ gtk_cell_renderer_render (GtkCellRenderer *cell,
gdk_cairo_rectangle (cr, background_area);
cairo_clip (cr);
context = gtk_widget_get_style_context (widget);
gtk_style_context_save (context);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_CELL);
state = gtk_cell_renderer_get_state (cell, widget, flags);
gtk_style_context_set_state (context, state);
GTK_CELL_RENDERER_GET_CLASS (cell)->render (cell,
cr,
widget,
background_area,
cell_area,
flags);
gtk_style_context_restore (context);
cairo_restore (cr);
}
@@ -1673,48 +1663,3 @@ gtk_cell_renderer_get_aligned_area (GtkCellRenderer *cell,
g_assert ((aligned_area->x - cell_area->x) + aligned_area->width <= cell_area->width);
g_assert ((aligned_area->y - cell_area->y) + aligned_area->height <= cell_area->height);
}
/**
* gtk_cell_renderer_get_state:
* @cell: a #GtkCellRenderer, or %NULL
* @widget: a #GtkWidget, or %NULL
* @cell_state: cell renderer state
*
* Translates the cell renderer state to #GtkStateFlags,
* based on the cell renderer and widget sensitivity, and
* the given #GtkCellRendererState.
*
* Returns: the widget state flags applying to @cell
*
* Since: 3.0
**/
GtkStateFlags
gtk_cell_renderer_get_state (GtkCellRenderer *cell,
GtkWidget *widget,
GtkCellRendererState cell_state)
{
GtkStateFlags state = 0;
g_return_val_if_fail (!cell || GTK_IS_CELL_RENDERER (cell), 0);
g_return_val_if_fail (!widget || GTK_IS_WIDGET (widget), 0);
if ((widget && !gtk_widget_get_sensitive (widget)) ||
(cell && !gtk_cell_renderer_get_sensitive (cell)))
state |= GTK_STATE_FLAG_INSENSITIVE;
else
{
if ((cell_state & GTK_CELL_RENDERER_SELECTED) != 0)
{
state |= GTK_STATE_FLAG_SELECTED;
if ((widget && gtk_widget_has_focus (widget)) &&
(cell_state & GTK_CELL_RENDERER_FOCUSED) != 0)
state |= GTK_STATE_FLAG_FOCUSED;
}
if ((cell_state & GTK_CELL_RENDERER_PRELIT) != 0)
state |= GTK_STATE_FLAG_PRELIGHT;
}
return state;
}
-4
View File
@@ -262,10 +262,6 @@ void _gtk_cell_renderer_calc_offset (GtkCellRenderer *cell,
gint *x_offset,
gint *y_offset);
GtkStateFlags gtk_cell_renderer_get_state (GtkCellRenderer *cell,
GtkWidget *widget,
GtkCellRendererState cell_state);
G_END_DECLS
#endif /* __GTK_CELL_RENDERER_H__ */
+8 -7
View File
@@ -641,8 +641,7 @@ gtk_cell_renderer_accel_start_editing (GtkCellRenderer *cell,
GtkCellRendererAccelPrivate *priv;
GtkCellRendererText *celltext;
GtkCellRendererAccel *accel;
GtkStyleContext *context;
GdkRGBA color;
GtkStyle *style;
GtkWidget *label;
GtkWidget *eventbox;
GdkDevice *device, *keyb, *pointer;
@@ -660,7 +659,7 @@ gtk_cell_renderer_accel_start_editing (GtkCellRenderer *cell,
return NULL;
window = gtk_widget_get_window (widget);
context = gtk_widget_get_style_context (widget);
style = gtk_widget_get_style (widget);
g_return_val_if_fail (window != NULL, NULL);
@@ -716,11 +715,13 @@ gtk_cell_renderer_accel_start_editing (GtkCellRenderer *cell,
label = gtk_label_new (NULL);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_style_context_get_background_color (context, GTK_STATE_FLAG_SELECTED, &color);
gtk_widget_override_background_color (label, 0, &color);
gtk_style_context_get_color (context, GTK_STATE_FLAG_SELECTED, &color);
gtk_widget_override_color (label, 0, &color);
gtk_widget_modify_bg (eventbox, GTK_STATE_NORMAL,
&style->bg[GTK_STATE_SELECTED]);
gtk_widget_modify_fg (label, GTK_STATE_NORMAL,
&style->fg[GTK_STATE_SELECTED]);
/* This label is displayed in a treeview cell displaying
* an accelerator when the cell is clicked to change the
+39 -37
View File
@@ -548,7 +548,7 @@ gtk_cell_renderer_pixbuf_create_themed_pixbuf (GtkCellRendererPixbuf *cellpixbuf
static GdkPixbuf *
create_symbolic_pixbuf (GtkCellRendererPixbuf *cellpixbuf,
GtkWidget *widget,
GtkStateFlags state)
GtkStateType state)
{
GtkCellRendererPixbufPrivate *priv = cellpixbuf->priv;
GdkScreen *screen;
@@ -604,17 +604,11 @@ create_symbolic_pixbuf (GtkCellRendererPixbuf *cellpixbuf,
GtkStyleContext *context;
context = gtk_widget_get_style_context (GTK_WIDGET (widget));
gtk_style_context_save (context);
gtk_style_context_set_state (context, state);
pixbuf = gtk_icon_info_load_symbolic_for_context (info,
context,
NULL,
NULL);
gtk_style_context_restore (context);
gtk_icon_info_free (info);
return pixbuf;
}
@@ -622,8 +616,8 @@ create_symbolic_pixbuf (GtkCellRendererPixbuf *cellpixbuf,
}
static GdkPixbuf *
create_colorized_pixbuf (GdkPixbuf *src,
GdkRGBA *new_color)
create_colorized_pixbuf (GdkPixbuf *src,
GdkColor *new_color)
{
gint i, j;
gint width, height, has_alpha, src_row_stride, dst_row_stride;
@@ -633,11 +627,11 @@ create_colorized_pixbuf (GdkPixbuf *src,
guchar *pixsrc;
guchar *pixdest;
GdkPixbuf *dest;
red_value = (new_color->red * 65535.0) / 255.0;
green_value = (new_color->green * 65535.0) / 255.0;
blue_value = (new_color->blue * 65535.0) / 255.0;
red_value = new_color->red / 255.0;
green_value = new_color->green / 255.0;
blue_value = new_color->blue / 255.0;
dest = gdk_pixbuf_new (gdk_pixbuf_get_colorspace (src),
gdk_pixbuf_get_has_alpha (src),
gdk_pixbuf_get_bits_per_sample (src),
@@ -756,7 +750,6 @@ gtk_cell_renderer_pixbuf_render (GtkCellRenderer *cell,
{
GtkCellRendererPixbuf *cellpixbuf = (GtkCellRendererPixbuf *) cell;
GtkCellRendererPixbufPrivate *priv = cellpixbuf->priv;
GtkStyleContext *context;
GdkPixbuf *pixbuf;
GdkPixbuf *invisible = NULL;
GdkPixbuf *colorized = NULL;
@@ -801,9 +794,7 @@ gtk_cell_renderer_pixbuf_render (GtkCellRenderer *cell,
if (!pixbuf)
return;
context = gtk_widget_get_style_context (widget);
if (!gtk_widget_get_sensitive (widget) ||
if (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE ||
!gtk_cell_renderer_get_sensitive (cell))
{
GtkIconSource *source;
@@ -817,32 +808,43 @@ gtk_cell_renderer_pixbuf_render (GtkCellRenderer *cell,
gtk_icon_source_set_size (source, GTK_ICON_SIZE_SMALL_TOOLBAR);
gtk_icon_source_set_size_wildcarded (source, FALSE);
gtk_style_context_save (context);
gtk_style_context_set_state (context, GTK_STATE_FLAG_INSENSITIVE);
pixbuf = invisible = gtk_render_icon_pixbuf (context, source,
(GtkIconSize) -1);
gtk_style_context_restore (context);
gtk_icon_source_free (source);
invisible = gtk_style_render_icon (gtk_widget_get_style (widget),
source,
gtk_widget_get_direction (widget),
GTK_STATE_INSENSITIVE,
/* arbitrary */
(GtkIconSize)-1,
widget,
"gtkcellrendererpixbuf");
gtk_icon_source_free (source);
pixbuf = invisible;
}
else if (priv->follow_state &&
(flags & (GTK_CELL_RENDERER_SELECTED|GTK_CELL_RENDERER_PRELIT)) != 0)
{
GtkStateFlags state;
GtkStateType state;
state = gtk_cell_renderer_get_state (cell, widget, flags);
symbolic = create_symbolic_pixbuf (cellpixbuf, widget, state);
if (!symbolic)
{
GdkRGBA color;
gtk_style_context_get_background_color (context, state, &color);
pixbuf = colorized = create_colorized_pixbuf (pixbuf, &color);
}
if ((flags & GTK_CELL_RENDERER_SELECTED) != 0)
{
if (gtk_widget_has_focus (widget))
state = GTK_STATE_SELECTED;
else
state = GTK_STATE_ACTIVE;
}
else
state = GTK_STATE_PRELIGHT;
symbolic = create_symbolic_pixbuf (cellpixbuf, widget, state);
if (!symbolic) {
colorized = create_colorized_pixbuf (pixbuf,
&gtk_widget_get_style (widget)->base[state]);
pixbuf = colorized;
} else {
pixbuf = symbolic;
}
}
gdk_cairo_set_source_pixbuf (cr, pixbuf, pix_rect.x, pix_rect.y);
+39 -49
View File
@@ -534,9 +534,8 @@ gtk_cell_renderer_progress_render (GtkCellRenderer *cell,
GtkCellRendererState flags)
{
GtkCellRendererProgress *cellprogress = GTK_CELL_RENDERER_PROGRESS (cell);
GtkCellRendererProgressPrivate *priv= cellprogress->priv;
GtkStyleContext *context;
GtkBorder padding, border;
GtkCellRendererProgressPrivate *priv= cellprogress->priv;
GtkStyle *style;
PangoLayout *layout;
PangoRectangle logical_rect;
gint x, y, w, h, x_pos, y_pos, bar_position, bar_size, start, full_size;
@@ -544,7 +543,8 @@ gtk_cell_renderer_progress_render (GtkCellRenderer *cell,
GdkRectangle clip;
gboolean is_rtl;
context = gtk_widget_get_style_context (widget);
style = gtk_widget_get_style (widget);
is_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
@@ -553,21 +553,15 @@ gtk_cell_renderer_progress_render (GtkCellRenderer *cell,
w = cell_area->width - xpad * 2;
h = cell_area->height - ypad * 2;
gtk_style_context_save (context);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_TROUGH);
gtk_render_background (context, cr, x, y, w, h);
gtk_render_frame (context, cr, x, y, w, h);
gtk_style_context_get_border (context, GTK_STATE_FLAG_NORMAL, &border);
gtk_style_context_get_padding (context, GTK_STATE_FLAG_NORMAL, &padding);
x += border.left + padding.left;
y += border.top + padding.top;
w -= border.left + border.right + padding.left + padding.right;
h -= border.top + border.bottom + padding.top + padding.bottom;
gtk_style_context_restore (context);
/* FIXME: GtkProgressBar draws the box with "trough" detail,
* but some engines don't paint anything with that detail for
* non-GtkProgressBar widgets.
*/
gtk_paint_box (style,
cr,
GTK_STATE_NORMAL, GTK_SHADOW_IN,
widget, NULL,
x, y, w, h);
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
@@ -610,15 +604,13 @@ gtk_cell_renderer_progress_render (GtkCellRenderer *cell,
clip.y = bar_position;
}
gtk_style_context_save (context);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_PROGRESSBAR);
if (bar_size > 0)
gtk_render_activity (context, cr,
clip.x, clip.y,
clip.width, clip.height);
gtk_style_context_restore (context);
gtk_paint_box (style,
cr,
GTK_STATE_SELECTED, GTK_SHADOW_OUT,
widget, "bar",
clip.x, clip.y,
clip.width, clip.height);
if (priv->label)
{
@@ -632,29 +624,24 @@ gtk_cell_renderer_progress_render (GtkCellRenderer *cell,
else
text_xalign = priv->text_xalign;
x_pos = x + padding.left + text_xalign *
(w - padding.left - padding.right - logical_rect.width);
x_pos = x + style->xthickness + text_xalign *
(w - 2 * style->xthickness - logical_rect.width);
y_pos = y + padding.top + priv->text_yalign *
(h - padding.top - padding.bottom - logical_rect.height);
y_pos = y + style->ythickness + priv->text_yalign *
(h - 2 * style->ythickness - logical_rect.height);
cairo_save (cr);
gdk_cairo_rectangle (cr, &clip);
cairo_clip (cr);
gtk_style_context_save (context);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_PROGRESSBAR);
gtk_paint_layout (style, cr,
GTK_STATE_SELECTED,
FALSE, widget, "progressbar",
x_pos, y_pos,
layout);
gtk_render_layout (context, cr,
x_pos, y_pos,
layout);
gtk_style_context_restore (context);
cairo_restore (cr);
gtk_style_context_save (context);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_TROUGH);
if (bar_position > start)
{
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
@@ -672,9 +659,11 @@ gtk_cell_renderer_progress_render (GtkCellRenderer *cell,
gdk_cairo_rectangle (cr, &clip);
cairo_clip (cr);
gtk_render_layout (context, cr,
x_pos, y_pos,
layout);
gtk_paint_layout (style, cr,
GTK_STATE_NORMAL,
FALSE, widget, "progressbar",
x_pos, y_pos,
layout);
cairo_restore (cr);
}
@@ -696,14 +685,15 @@ gtk_cell_renderer_progress_render (GtkCellRenderer *cell,
gdk_cairo_rectangle (cr, &clip);
cairo_clip (cr);
gtk_render_layout (context, cr,
x_pos, y_pos,
layout);
gtk_paint_layout (style, cr,
GTK_STATE_NORMAL,
FALSE, widget, "progressbar",
x_pos, y_pos,
layout);
cairo_restore (cr);
}
gtk_style_context_restore (context);
g_object_unref (layout);
}
}
+38 -17
View File
@@ -1690,17 +1690,12 @@ get_size (GtkCellRenderer *cell,
if (priv->calc_fixed_height)
{
GtkStyleContext *style_context;
GtkStateFlags state;
PangoContext *context;
PangoFontMetrics *metrics;
PangoFontDescription *font_desc;
gint row_height;
style_context = gtk_widget_get_style_context (widget);
state = gtk_widget_get_state_flags (widget);
font_desc = pango_font_description_copy_static (gtk_style_context_get_font (style_context, state));
font_desc = pango_font_description_copy_static (gtk_widget_get_style (widget)->font_desc);
pango_font_description_merge_static (font_desc, priv->font, TRUE);
if (priv->scale_set)
@@ -1792,8 +1787,8 @@ gtk_cell_renderer_text_render (GtkCellRenderer *cell,
{
GtkCellRendererText *celltext = GTK_CELL_RENDERER_TEXT (cell);
GtkCellRendererTextPrivate *priv = celltext->priv;
GtkStyleContext *context;
PangoLayout *layout;
GtkStateType state;
gint x_offset = 0;
gint y_offset = 0;
gint xpad, ypad;
@@ -1801,7 +1796,30 @@ gtk_cell_renderer_text_render (GtkCellRenderer *cell,
layout = get_layout (celltext, widget, cell_area, flags);
get_size (cell, widget, cell_area, layout, &x_offset, &y_offset, NULL, NULL);
context = gtk_widget_get_style_context (widget);
if (!gtk_cell_renderer_get_sensitive (cell))
{
state = GTK_STATE_INSENSITIVE;
}
else if ((flags & GTK_CELL_RENDERER_SELECTED) == GTK_CELL_RENDERER_SELECTED)
{
if (gtk_widget_has_focus (widget))
state = GTK_STATE_SELECTED;
else
state = GTK_STATE_ACTIVE;
}
else if ((flags & GTK_CELL_RENDERER_PRELIT) == GTK_CELL_RENDERER_PRELIT &&
gtk_widget_get_state (widget) == GTK_STATE_PRELIGHT)
{
state = GTK_STATE_PRELIGHT;
}
else
{
if (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE)
state = GTK_STATE_INSENSITIVE;
else
state = GTK_STATE_NORMAL;
}
if (priv->background_set && (flags & GTK_CELL_RENDERER_SELECTED) == 0)
{
@@ -1826,10 +1844,15 @@ gtk_cell_renderer_text_render (GtkCellRenderer *cell,
gdk_cairo_rectangle (cr, cell_area);
cairo_clip (cr);
gtk_render_layout (context, cr,
cell_area->x + x_offset + xpad,
cell_area->y + y_offset + ypad,
layout);
gtk_paint_layout (gtk_widget_get_style (widget),
cr,
state,
TRUE,
widget,
"cellrenderertext",
cell_area->x + x_offset + xpad,
cell_area->y + y_offset + ypad,
layout);
cairo_restore (cr);
@@ -2088,8 +2111,7 @@ gtk_cell_renderer_text_get_preferred_width (GtkCellRenderer *cell,
{
GtkCellRendererTextPrivate *priv;
GtkCellRendererText *celltext;
GtkStyleContext *style_context;
const PangoFontDescription *font_desc;
GtkStyle *style;
PangoLayout *layout;
PangoContext *context;
PangoFontMetrics *metrics;
@@ -2109,7 +2131,7 @@ gtk_cell_renderer_text_get_preferred_width (GtkCellRenderer *cell,
celltext = GTK_CELL_RENDERER_TEXT (cell);
priv = celltext->priv;
style_context = gtk_widget_get_style_context (widget);
style = gtk_widget_get_style (widget);
gtk_cell_renderer_get_padding (cell, &xpad, NULL);
@@ -2122,8 +2144,7 @@ gtk_cell_renderer_text_get_preferred_width (GtkCellRenderer *cell,
/* Fetch the average size of a charachter */
context = pango_layout_get_context (layout);
font_desc = gtk_style_context_get_font (style_context, 0);
metrics = pango_context_get_metrics (context, font_desc,
metrics = pango_context_get_metrics (context, style->font_desc,
pango_context_get_language (context));
char_width = pango_font_metrics_get_approximate_char_width (metrics);
+39 -25
View File
@@ -331,13 +331,12 @@ gtk_cell_renderer_toggle_render (GtkCellRenderer *cell,
{
GtkCellRendererToggle *celltoggle = GTK_CELL_RENDERER_TOGGLE (cell);
GtkCellRendererTogglePrivate *priv = celltoggle->priv;
GtkStyleContext *context;
gint width, height;
gint x_offset, y_offset;
gint xpad, ypad;
GtkStateFlags state;
GtkShadowType shadow;
GtkStateType state = 0;
context = gtk_widget_get_style_context (widget);
gtk_cell_renderer_toggle_get_size (cell, widget, cell_area,
&x_offset, &y_offset,
&width, &height);
@@ -348,42 +347,57 @@ gtk_cell_renderer_toggle_render (GtkCellRenderer *cell,
if (width <= 0 || height <= 0)
return;
if (!priv->activatable)
state = GTK_STATE_FLAG_INSENSITIVE;
else
state = gtk_cell_renderer_get_state (cell, widget, flags);
if (priv->inconsistent)
state |= GTK_STATE_FLAG_INCONSISTENT;
else if (priv->active)
state |= GTK_STATE_FLAG_ACTIVE;
shadow = GTK_SHADOW_ETCHED_IN;
else
shadow = priv->active ? GTK_SHADOW_IN : GTK_SHADOW_OUT;
if (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE ||
!gtk_cell_renderer_get_sensitive (cell))
{
state = GTK_STATE_INSENSITIVE;
}
else if ((flags & GTK_CELL_RENDERER_SELECTED) == GTK_CELL_RENDERER_SELECTED)
{
if (gtk_widget_has_focus (widget))
state = GTK_STATE_SELECTED;
else
state = GTK_STATE_ACTIVE;
}
else
{
if (priv->activatable)
state = GTK_STATE_NORMAL;
else
state = GTK_STATE_INSENSITIVE;
}
cairo_save (cr);
gdk_cairo_rectangle (cr, cell_area);
cairo_clip (cr);
gtk_style_context_save (context);
gtk_style_context_set_state (context, state);
if (priv->radio)
{
gtk_style_context_add_class (context, GTK_STYLE_CLASS_RADIO);
gtk_render_option (context, cr,
cell_area->x + x_offset + xpad,
cell_area->y + y_offset + ypad,
width, height);
gtk_paint_option (gtk_widget_get_style (widget),
cr,
state, shadow,
widget, "cellradio",
cell_area->x + x_offset + xpad,
cell_area->y + y_offset + ypad,
width, height);
}
else
{
gtk_style_context_add_class (context, GTK_STYLE_CLASS_CHECK);
gtk_render_check (context, cr,
cell_area->x + x_offset + xpad,
cell_area->y + y_offset + ypad,
width, height);
gtk_paint_check (gtk_widget_get_style (widget),
cr,
state, shadow,
widget, "cellcheck",
cell_area->x + x_offset + xpad,
cell_area->y + y_offset + ypad,
width, height);
}
gtk_style_context_restore (context);
cairo_restore (cr);
}
+16 -40
View File
@@ -26,7 +26,7 @@
#include "gtkcellrenderertext.h"
#include "gtkcellrendererpixbuf.h"
#include "gtkprivate.h"
#include "gtkorientableprivate.h"
#include "gtkorientable.h"
#include <gobject/gmarshal.h>
#include "gtkbuildable.h"
@@ -347,14 +347,15 @@ gtk_cell_view_constructor (GType type,
if (!priv->area)
{
priv->area = gtk_cell_area_box_new ();
g_object_ref_sink (priv->area);
GtkCellArea *area = gtk_cell_area_box_new ();
priv->area = g_object_ref_sink (area);
}
if (!priv->context)
priv->context = gtk_cell_area_create_context (priv->area);
priv->size_changed_id =
priv->size_changed_id =
g_signal_connect (priv->context, "notify",
G_CALLBACK (context_size_changed_cb), view);
@@ -420,16 +421,15 @@ gtk_cell_view_set_property (GObject *object,
GParamSpec *pspec)
{
GtkCellView *view = GTK_CELL_VIEW (object);
GtkCellViewPrivate *priv = view->priv;
GtkCellArea *area;
GtkCellAreaContext *context;
switch (param_id)
{
case PROP_ORIENTATION:
priv->orientation = g_value_get_enum (value);
if (priv->context)
gtk_cell_area_context_reset (priv->context);
view->priv->orientation = g_value_get_enum (value);
if (view->priv->context)
gtk_cell_area_context_reset (view->priv->context);
_gtk_orientable_set_style_classes (GTK_ORIENTABLE (object));
break;
@@ -462,34 +462,16 @@ gtk_cell_view_set_property (GObject *object,
case PROP_CELL_AREA:
/* Construct-only, can only be assigned once */
area = g_value_get_object (value);
if (area)
{
if (priv->area != NULL)
{
g_warning ("cell-area has already been set, ignoring construct property");
g_object_ref_sink (area);
g_object_unref (area);
}
else
priv->area = g_object_ref_sink (area);
}
view->priv->area = g_object_ref_sink (area);
break;
case PROP_CELL_AREA_CONTEXT:
/* Construct-only, can only be assigned once */
context = g_value_get_object (value);
if (context)
{
if (priv->context != NULL)
{
g_warning ("cell-area-context has already been set, ignoring construct property");
g_object_ref_sink (context);
g_object_unref (context);
}
else
priv->context = g_object_ref (context);
}
view->priv->context = g_object_ref (context);
break;
case PROP_DRAW_SENSITIVE:
@@ -827,15 +809,8 @@ static GtkCellArea *
gtk_cell_view_cell_layout_get_area (GtkCellLayout *layout)
{
GtkCellView *cellview = GTK_CELL_VIEW (layout);
GtkCellViewPrivate *priv = cellview->priv;
if (G_UNLIKELY (!priv->area))
{
priv->area = gtk_cell_area_box_new ();
g_object_ref_sink (priv->area);
}
return priv->area;
return cellview->priv->area;
}
/* GtkBuildable implementation */
@@ -1109,6 +1084,7 @@ gtk_cell_view_set_model (GtkCellView *cell_view,
cell_view->priv->displayed_row = NULL;
g_object_unref (cell_view->priv->model);
cell_view->priv->model = NULL;
}
cell_view->priv->model = model;
@@ -1416,8 +1392,8 @@ gtk_cell_view_get_fit_model (GtkCellView *cell_view)
* Since: 3.0
*/
void
gtk_cell_view_set_fit_model (GtkCellView *cell_view,
gboolean fit_model)
gtk_cell_view_set_fit_model (GtkCellView *cell_view,
gboolean fit_model)
{
GtkCellViewPrivate *priv;
+3 -3
View File
@@ -65,7 +65,7 @@ struct _GtkCellViewClass
GType gtk_cell_view_get_type (void) G_GNUC_CONST;
GtkWidget *gtk_cell_view_new (void);
GtkWidget *gtk_cell_view_new_with_context (GtkCellArea *area,
GtkCellAreaContext *context);
GtkCellAreaContext *context);
GtkWidget *gtk_cell_view_new_with_text (const gchar *text);
GtkWidget *gtk_cell_view_new_with_markup (const gchar *markup);
GtkWidget *gtk_cell_view_new_with_pixbuf (GdkPixbuf *pixbuf);
@@ -81,10 +81,10 @@ void gtk_cell_view_set_background_rgba (GtkCellView *cell_v
const GdkRGBA *rgba);
gboolean gtk_cell_view_get_draw_sensitive (GtkCellView *cell_view);
void gtk_cell_view_set_draw_sensitive (GtkCellView *cell_view,
gboolean draw_sensitive);
gboolean draw_sensitive);
gboolean gtk_cell_view_get_fit_model (GtkCellView *cell_view);
void gtk_cell_view_set_fit_model (GtkCellView *cell_view,
gboolean fit_model);
gboolean fit_model);
#ifndef GTK_DISABLE_DEPRECATED
gboolean gtk_cell_view_get_size_of_row (GtkCellView *cell_view,
+15 -31
View File
@@ -406,7 +406,7 @@ static void gtk_combo_box_menu_popup (GtkComboBox *combo_box,
guint32 activate_time);
/* cell layout */
static GtkCellArea *gtk_combo_box_cell_layout_get_area (GtkCellLayout *cell_layout);
GtkCellArea *gtk_combo_box_cell_layout_get_area (GtkCellLayout *cell_layout);
static gboolean gtk_combo_box_mnemonic_activate (GtkWidget *widget,
gboolean group_cycling);
@@ -1049,7 +1049,6 @@ gtk_combo_box_set_property (GObject *object,
GParamSpec *pspec)
{
GtkComboBox *combo_box = GTK_COMBO_BOX (object);
GtkComboBoxPrivate *priv = combo_box->priv;
GtkCellArea *area;
switch (prop_id)
@@ -1079,15 +1078,16 @@ gtk_combo_box_set_property (GObject *object,
break;
case PROP_HAS_FRAME:
priv->has_frame = g_value_get_boolean (value);
combo_box->priv->has_frame = g_value_get_boolean (value);
if (priv->has_entry)
if (combo_box->priv->has_entry)
{
GtkWidget *child;
child = gtk_bin_get_child (GTK_BIN (combo_box));
gtk_entry_set_has_frame (GTK_ENTRY (child), priv->has_frame);
gtk_entry_set_has_frame (GTK_ENTRY (child),
combo_box->priv->has_frame);
}
break;
@@ -1119,11 +1119,11 @@ gtk_combo_box_set_property (GObject *object,
break;
case PROP_EDITING_CANCELED:
priv->editing_canceled = g_value_get_boolean (value);
combo_box->priv->editing_canceled = g_value_get_boolean (value);
break;
case PROP_HAS_ENTRY:
priv->has_entry = g_value_get_boolean (value);
combo_box->priv->has_entry = g_value_get_boolean (value);
break;
case PROP_ENTRY_TEXT_COLUMN:
@@ -1141,17 +1141,9 @@ gtk_combo_box_set_property (GObject *object,
case PROP_CELL_AREA:
/* Construct-only, can only be assigned once */
area = g_value_get_object (value);
if (area)
{
if (priv->area != NULL)
{
g_warning ("cell-area has already been set, ignoring construct property");
g_object_ref_sink (area);
g_object_unref (area);
}
else
priv->area = g_object_ref_sink (area);
}
combo_box->priv->area = g_object_ref_sink (area);
break;
default:
@@ -3765,19 +3757,10 @@ gtk_combo_box_list_row_changed (GtkTreeModel *model,
/*
* GtkCellLayout implementation
*/
static GtkCellArea *
gtk_combo_box_cell_layout_get_area (GtkCellLayout *cell_layout)
GtkCellArea *
gtk_combo_box_cell_layout_get_area (GtkCellLayout *cell_layout)
{
GtkComboBox *combo = GTK_COMBO_BOX (cell_layout);
GtkComboBoxPrivate *priv = combo->priv;
if (G_UNLIKELY (!priv->area))
{
priv->area = gtk_cell_area_box_new ();
g_object_ref_sink (priv->area);
}
return priv->area;
return GTK_COMBO_BOX (cell_layout)->priv->area;
}
/*
@@ -4569,8 +4552,9 @@ gtk_combo_box_constructor (GType type,
if (!priv->area)
{
priv->area = gtk_cell_area_box_new ();
g_object_ref_sink (priv->area);
GtkCellArea *area = gtk_cell_area_box_new ();
priv->area = g_object_ref_sink (area);
}
priv->cell_view = gtk_cell_view_new_with_context (priv->area, NULL);
+29 -234
View File
@@ -25,15 +25,13 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <cairo-gobject.h>
#include "gtkcssproviderprivate.h"
#include "gtkanimationdescription.h"
#include "gtk9slice.h"
#include "gtkgradient.h"
#include "gtkthemingengine.h"
#include "gtkstyleprovider.h"
#include "gtkcssprovider.h"
#include "gtkstylecontextprivate.h"
#include "gtkbindings.h"
#include "gtkprivate.h"
/**
@@ -290,38 +288,6 @@
* &commat;import url ("path/to/common.css");
* </programlisting>
* </example>
* <para id="css-binding-set">
* In order to extend key bindings affecting different widgets, GTK+
* supports the &commat;binding-set rule to parse a set of bind/unbind
* directives, see #GtkBindingSet for the supported syntax. Note that
* the binding sets defined in this way must be associated with rule sets
* by setting the gtk-key-bindings style property.
* </para>
* <para>
* Customized key bindings are typically defined in a separate
* <filename>gtk-keys.css</filename> CSS file and GTK+ loads this file
* according to the current key theme, which is defined by the
* #GtkSettings:gtk-key-theme-name setting.
* </para>
* <example>
* <title>Using the &commat;binding rule</title>
* <programlisting language="text">
* &commat;binding-set binding-set1 {
* bind "&lt;alt&gt;Left" { "move-cursor" (visual-positions, -3, 0) };
* unbind "End";
* };
*
* &commat;binding-set binding-set2 {
* bind "&lt;alt&gt;Right" { "move-cursor" (visual-positions, 3, 0) };
* bind "&lt;alt&gt;KP_space" { "delete-from-cursor" (whitespace, 1)
* "insert-at-cursor" (" ") };
* };
*
* GtkEntry {
* gtk-key-bindings: binding-set1, binding-set2;
* }
* </programlisting>
* </example>
* <para>
* GTK+ also supports an additional &commat;define-color rule, in order
* to define a color name which may be used instead of color numeric
@@ -698,13 +664,6 @@
* transition: 1s linear loop;</literallayout>
* </entry>
* </row>
* <row>
* <entry>gtk-key-bindings</entry>
* <entry>binding set name list</entry>
* <entry>internal use only</entry>
* <entry><literallayout>gtk-bindings: binding1, binding2, ...;</literallayout>
* </entry>
* </row>
* </tbody>
* </tgroup>
* </informaltable>
@@ -809,8 +768,7 @@ enum ParserScope {
SCOPE_PSEUDO_CLASS,
SCOPE_NTH_CHILD,
SCOPE_DECLARATION,
SCOPE_VALUE,
SCOPE_BINDING_SET
SCOPE_VALUE
};
/* Extend GtkStateType, since these
@@ -1519,12 +1477,6 @@ scanner_apply_scope (GScanner *scanner,
scanner->config->cset_identifier_nth = G_CSET_a_2_z G_CSET_A_2_Z G_CSET_DIGITS "@#-_ +(),.%\t\n'/\"";
scanner->config->scan_identifier_1char = TRUE;
}
else if (scope == SCOPE_BINDING_SET)
{
scanner->config->cset_identifier_first = G_CSET_a_2_z G_CSET_A_2_Z G_CSET_DIGITS "@#-_";
scanner->config->cset_identifier_nth = G_CSET_a_2_z G_CSET_A_2_Z G_CSET_DIGITS "@#-_ +(){}<>,.%\t\n'/\"";
scanner->config->scan_identifier_1char = TRUE;
}
else if (scope == SCOPE_SELECTOR)
{
scanner->config->cset_identifier_first = G_CSET_a_2_z G_CSET_A_2_Z "*@";
@@ -2808,32 +2760,6 @@ border_parse_str (const gchar *str,
return border;
}
static void
resolve_binding_sets (const gchar *value_str,
GValue *value)
{
GPtrArray *array;
gchar **bindings, **str;
bindings = g_strsplit (value_str, ",", -1);
array = g_ptr_array_new ();
for (str = bindings; *str; str++)
{
GtkBindingSet *binding_set;
binding_set = gtk_binding_set_find (g_strstrip (*str));
if (!binding_set)
continue;
g_ptr_array_add (array, binding_set);
}
g_value_take_boxed (value, array);
g_strfreev (bindings);
}
static gboolean
css_provider_parse_value (GtkCssProvider *css_provider,
const gchar *value_str,
@@ -3306,68 +3232,6 @@ parse_rule (GtkCssProvider *css_provider,
else
return G_TOKEN_NONE;
}
else if (strcmp (directive, "binding-set") == 0)
{
GtkBindingSet *binding_set;
gchar *binding_set_name;
g_scanner_get_next_token (scanner);
if (scanner->token != G_TOKEN_IDENTIFIER)
{
scanner->user_data = "Binding name";
return G_TOKEN_IDENTIFIER;
}
binding_set_name = scanner->value.v_identifier;
binding_set = gtk_binding_set_find (binding_set_name);
if (!binding_set)
{
binding_set = gtk_binding_set_new (binding_set_name);
binding_set->parsed = TRUE;
}
g_scanner_get_next_token (scanner);
if (scanner->token != G_TOKEN_LEFT_CURLY)
return G_TOKEN_LEFT_CURLY;
css_provider_push_scope (css_provider, SCOPE_BINDING_SET);
g_scanner_get_next_token (scanner);
do
{
GTokenType ret;
if (scanner->token != G_TOKEN_IDENTIFIER)
{
scanner->user_data = "Binding definition";
return G_TOKEN_IDENTIFIER;
}
ret = gtk_binding_entry_add_signal_from_string (binding_set,
scanner->value.v_identifier);
if (ret != G_TOKEN_NONE)
{
scanner->user_data = "Binding definition";
return ret;
}
g_scanner_get_next_token (scanner);
if (scanner->token != ';')
return ';';
g_scanner_get_next_token (scanner);
}
while (scanner->token != G_TOKEN_RIGHT_CURLY);
css_provider_pop_scope (css_provider);
g_scanner_get_next_token (scanner);
return G_TOKEN_NONE;
}
else
{
scanner->user_data = "Directive";
@@ -3458,12 +3322,6 @@ parse_rule (GtkCssProvider *css_provider,
g_param_value_set_default (pspec, val);
g_hash_table_insert (priv->cur_properties, prop, val);
}
else if (strcmp (prop, "gtk-key-bindings") == 0)
{
/* Private property holding the binding sets */
resolve_binding_sets (value_str, val);
g_hash_table_insert (priv->cur_properties, prop, val);
}
else if (pspec->value_type == G_TYPE_STRING)
{
g_value_set_string (val, value_str);
@@ -3771,7 +3629,8 @@ gtk_css_provider_get_default (void)
"@define-color error_fg_color rgb (166, 38, 38);\n"
"@define-color error_bg_color rgb (237, 54, 54);\n"
"\n"
"* {\n"
"*,\n"
"GtkTreeView > GtkButton {\n"
" background-color: @bg_color;\n"
" color: @fg_color;\n"
" border-color: shade (@bg_color, 0.6);\n"
@@ -3789,7 +3648,7 @@ gtk_css_provider_get_default (void)
" color: @selected_fg_color;\n"
"}\n"
"\n"
".expander, GtkTreeView.view.expander {\n"
".expander, .view.expander {\n"
" color: #fff;\n"
"}\n"
"\n"
@@ -3798,7 +3657,7 @@ gtk_css_provider_get_default (void)
"}\n"
"\n"
".expander:active {\n"
" transition: 200ms linear;\n"
" transition: 300ms linear;\n"
"}\n"
"\n"
"*:insensitive {\n"
@@ -3807,9 +3666,12 @@ gtk_css_provider_get_default (void)
" color: shade (@bg_color, 0.7);\n"
"}\n"
"\n"
"GtkTreeView, GtkIconView {\n"
" background-color: @base_color;\n"
" color: @text_color;\n"
"}\n"
"\n"
".view {\n"
" border-width: 0;\n"
" border-radius: 0;\n"
" background-color: @base_color;\n"
" color: @text_color;\n"
"}\n"
@@ -3823,59 +3685,16 @@ gtk_css_provider_get_default (void)
" color: @selected_fg_color;\n"
"}\n"
"\n"
".view column:sorted row,\n"
".view column:sorted row:prelight {\n"
" background-color: shade (@bg_color, 0.85);\n"
"}\n"
"\n"
".view column:sorted row:nth-child(odd),\n"
".view column:sorted row:nth-child(odd):prelight {\n"
" background-color: shade (@bg_color, 0.8);\n"
"}\n"
"\n"
".view row,\n"
".view row:prelight {\n"
"GtkTreeView > row {\n"
" background-color: @base_color;\n"
" color: @text_color;\n"
" border-width: 0;\n"
"}\n"
"\n"
".view row:nth-child(odd),\n"
".view row:nth-child(odd):prelight {\n"
"GtkTreeView > row:nth-child(odd) { \n"
" background-color: shade (@base_color, 0.93); \n"
"}\n"
"\n"
".view row:selected:focused {\n"
" background-color: @selected_bg_color;\n"
"}\n"
"\n"
".view row:selected {\n"
" background-color: darker (@bg_color);\n"
" color: @selected_fg_color;\n"
"}\n"
"\n"
".view.cell.trough,\n"
".view.cell.trough:hover,\n"
".view.cell.trough:selected,\n"
".view.cell.trough:selected:focused {\n"
" background-color: @bg_color;\n"
" color: @fg_color;\n"
"}\n"
"\n"
".view.cell.progressbar,\n"
".view.cell.progressbar:hover,\n"
".view.cell.progressbar:selected,\n"
".view.cell.progressbar:selected:focused {\n"
" background-color: @selected_bg_color;\n"
" color: @selected_fg_color;\n"
"}\n"
"\n"
".rubberband {\n"
" background-color: alpha (@fg_color, 0.25);\n"
" border-color: @fg_color;\n"
" border-style: solid;\n"
" border-width: 1;\n"
"}\n"
"\n"
".tooltip {\n"
" background-color: @tooltip_bg_color; \n"
" color: @tooltip_fg_color; \n"
@@ -3925,8 +3744,7 @@ gtk_css_provider_get_default (void)
"}\n"
"\n"
".progressbar,\n"
".entry.progressbar, \n"
".cell.progressbar {\n"
".entry.progressbar {\n"
" background-color: @selected_bg_color;\n"
" border-color: shade (@selected_bg_color, 0.7);\n"
" color: @selected_fg_color;\n"
@@ -3941,9 +3759,7 @@ gtk_css_provider_get_default (void)
" background-color: shade (@bg_color, 1.05);\n"
"}\n"
"\n"
".check, .radio,"
".cell.check, .cell.radio,\n"
".cell.check:hover, .cell.radio:hover {\n"
".check, .radio {\n"
" border-style: solid;\n"
" border-width: 1;\n"
" background-color: @base_color;\n"
@@ -3958,13 +3774,8 @@ gtk_css_provider_get_default (void)
"}\n"
"\n"
".check:selected, .radio:selected {\n"
" background-color: darker (@bg_color);\n"
" color: @selected_fg_color;\n"
" border-color: @selected_fg_color;\n"
"}\n"
"\n"
".check:selected:focused, .radio:selected:focused {\n"
" background-color: @selected_bg_color;\n"
" color: @selected_fg_color;\n"
"}\n"
"\n"
".menu.check, .menu.radio {\n"
@@ -4022,11 +3833,6 @@ gtk_css_provider_get_default (void)
" border-color: shade (@bg_color, 0.8);\n"
"}\n"
"\n"
"GtkSwitch.trough:active {\n"
" background-color: @selected_bg_color;\n"
" color: @selected_fg_color;\n"
"}\n"
"\n"
"GtkToggleButton.button:inconsistent {\n"
" border-style: outset;\n"
" border-width: 1px;\n"
@@ -4130,8 +3936,8 @@ gtk_css_provider_get_default (void)
return provider;
}
gchar *
_gtk_css_provider_get_theme_dir (void)
static gchar *
css_provider_get_theme_dir (void)
{
const gchar *var;
gchar *path;
@@ -4149,31 +3955,24 @@ _gtk_css_provider_get_theme_dir (void)
/**
* gtk_css_provider_get_named:
* @name: A theme name
* @variant: (allow-none): variant to load, for example, "dark", or
* %NULL for the default
* @variant: variant to load, for example, "dark", or %NULL for the default
*
* Loads a theme from the usual theme paths
*
* Returns: (transfer none): a #GtkCssProvider with the theme loaded.
* This memory is owned by GTK+, and you must not free it.
*/
* This memory is owned by GTK+, and you must not free it.
**/
GtkCssProvider *
gtk_css_provider_get_named (const gchar *name,
const gchar *variant)
{
static GHashTable *themes = NULL;
GtkCssProvider *provider;
gchar *key;
if (G_UNLIKELY (!themes))
themes = g_hash_table_new (g_str_hash, g_str_equal);
if (variant == NULL)
key = (gchar *)name;
else
key = g_strconcat (name, "-", variant, NULL);
provider = g_hash_table_lookup (themes, key);
provider = g_hash_table_lookup (themes, name);
if (!provider)
{
@@ -4201,9 +4000,7 @@ gtk_css_provider_get_named (const gchar *name,
if (!path)
{
gchar *theme_dir;
theme_dir = _gtk_css_provider_get_theme_dir ();
gchar *theme_dir = css_provider_get_theme_dir ();
path = g_build_filename (theme_dir, name, subpath, NULL);
g_free (theme_dir);
@@ -4218,11 +4015,12 @@ gtk_css_provider_get_named (const gchar *name,
if (path)
{
GError *error;
GError *error = NULL;
provider = gtk_css_provider_new ();
error = NULL;
if (!gtk_css_provider_load_from_path (provider, path, &error))
gtk_css_provider_load_from_path (provider, path, &error);
if (error)
{
g_warning ("Could not load named theme \"%s\": %s", name, error->message);
g_error_free (error);
@@ -4231,12 +4029,9 @@ gtk_css_provider_get_named (const gchar *name,
provider = NULL;
}
else
g_hash_table_insert (themes, g_strdup (key), provider);
g_hash_table_insert (themes, g_strdup (name), provider);
}
}
if (key != name)
g_free (key);
return provider;
}
-31
View File
@@ -1,31 +0,0 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 2011 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GTK_CSS_PROVIDER_PRIVATE_H__
#define __GTK_CSS_PROVIDER_PRIVATE_H__
#include "gtkcssprovider.h"
G_BEGIN_DECLS
gchar *_gtk_css_provider_get_theme_dir (void);
G_END_DECLS
#endif /* __GTK_CSS_PROVIDER_PRIVATE_H__ */
+3 -3
View File
@@ -122,11 +122,11 @@
*
* To receive mouse events on a drawing area, you will need to enable
* them with gtk_widget_add_events(). To receive keyboard events, you
* will need to set the "can-focus" property on the drawing area, and you
* will need to set the #GTK_CAN_FOCUS flag on the drawing area, and
* should probably draw some user-visible indication that the drawing
* area is focused. Use gtk_widget_has_focus() in your expose event
* area is focused. Use the GTK_HAS_FOCUS() macro in your expose event
* handler to decide whether to draw the focus indicator. See
* gtk_render_focus() for one way to draw focus.
* gtk_paint_focus() for one way to draw focus.
*/
static void gtk_drawing_area_realize (GtkWidget *widget);
+7 -12
View File
@@ -66,7 +66,7 @@
#include "gtkiconfactory.h"
#include "gtkicontheme.h"
#include "gtkwidgetprivate.h"
#include "gtkstylecontextprivate.h"
/**
* SECTION:gtkentry
@@ -5805,8 +5805,7 @@ gtk_entry_draw_cursor (GtkEntry *entry,
}
else /* overwrite_mode */
{
GtkStyleContext *context;
GdkRGBA cursor_color;
GdkColor cursor_color;
GdkRectangle rect;
gint x, y;
@@ -5819,18 +5818,18 @@ gtk_entry_draw_cursor (GtkEntry *entry,
rect.width = PANGO_PIXELS (cursor_rect.width);
rect.height = PANGO_PIXELS (cursor_rect.height);
context = gtk_widget_get_style_context (widget);
_gtk_style_context_get_cursor_color (context, &cursor_color, NULL);
gdk_cairo_set_source_rgba (cr, &cursor_color);
_gtk_widget_get_cursor_color (widget, &cursor_color);
gdk_cairo_set_source_color (cr, &cursor_color);
gdk_cairo_rectangle (cr, &rect);
cairo_fill (cr);
if (!block_at_line_end)
{
GtkStyleContext *context;
GtkStateFlags state;
GdkRGBA color;
context = gtk_widget_get_style_context (widget);
state = gtk_widget_get_state_flags (widget);
gtk_style_context_get_background_color (context, state, &color);
@@ -9586,8 +9585,6 @@ keypress_completion_out:
{
GtkTreeIter iter;
GtkTreeModel *model = NULL;
GtkTreeModel *child_model;
GtkTreeIter child_iter;
GtkTreeSelection *sel;
gboolean retval = TRUE;
@@ -9601,11 +9598,9 @@ keypress_completion_out:
sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (completion->priv->tree_view));
if (gtk_tree_selection_get_selected (sel, &model, &iter))
{
gtk_tree_model_filter_convert_iter_to_child_iter (GTK_TREE_MODEL_FILTER (model), &child_iter, &iter);
child_model = gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER (model));
g_signal_handler_block (widget, completion->priv->changed_id);
g_signal_emit_by_name (completion, "match-selected",
child_model, &child_iter, &entry_set);
model, &iter, &entry_set);
g_signal_handler_unblock (widget, completion->priv->changed_id);
if (!entry_set)
+5 -38
View File
@@ -49,19 +49,6 @@
* "actions" in the popup window. Their appearance is similar to menuitems,
* to differentiate them clearly from completion strings. When an action is
* selected, the #GtkEntryCompletion::action-activated signal is emitted.
*
* GtkEntryCompletion uses a #GtkTreeModelFilter model to represent the
* subset of the entire model that is currently matching. While the
* GtkEntryCompletion signals #GtkEntryCompletion::match-selected and
* #GtkEntryCompletion::cursor-on-match take the original model and an
* iter pointing to that model as arguments, other callbacks and signals
* (such as #GtkCellLayoutDataFuncs or #GtkCellArea::apply-attributes)
* will generally take the filter model as argument. As long as you are
* only calling gtk_tree_model_get(), this will make no difference to
* you. If for some reason, you need the original model, use
* gtk_tree_model_filter_get_model(). Don't forget to use
* gtk_tree_model_filter_convert_iter_to_child_iter() to obtain a
* matching iter.
*/
#include "config.h"
@@ -248,9 +235,6 @@ gtk_entry_completion_class_init (GtkEntryCompletionClass *klass)
* entry with the contents of the text column in the row
* pointed to by @iter.
*
* Note that @model is the model that was passed to
* gtk_entry_completion_set_model().
*
* Return value: %TRUE if the signal has been handled
*
* Since: 2.4
@@ -277,9 +261,6 @@ gtk_entry_completion_class_init (GtkEntryCompletionClass *klass)
* of the entry with the contents of the text column in the row
* pointed to by @iter.
*
* Note that @model is the model that was passed to
* gtk_entry_completion_set_model().
*
* Return value: %TRUE if the signal has been handled
*
* Since: 2.12
@@ -500,9 +481,9 @@ gtk_entry_completion_init (GtkEntryCompletion *completion)
}
static GObject *
gtk_entry_completion_constructor (GType type,
guint n_construct_properties,
GObjectConstructParam *construct_properties)
gtk_entry_completion_constructor (GType type,
guint n_construct_properties,
GObjectConstructParam *construct_properties)
{
GtkEntryCompletion *completion;
GtkEntryCompletionPrivate *priv;
@@ -676,17 +657,9 @@ gtk_entry_completion_set_property (GObject *object,
case PROP_CELL_AREA:
/* Construct-only, can only be assigned once */
area = g_value_get_object (value);
if (area)
{
if (priv->cell_area != NULL)
{
g_warning ("cell-area has already been set, ignoring construct property");
g_object_ref_sink (area);
g_object_unref (area);
}
else
priv->cell_area = g_object_ref_sink (area);
}
priv->cell_area = g_object_ref_sink (area);
break;
default:
@@ -813,12 +786,6 @@ gtk_entry_completion_get_area (GtkCellLayout *cell_layout)
priv = GTK_ENTRY_COMPLETION (cell_layout)->priv;
if (G_UNLIKELY (!priv->cell_area))
{
priv->cell_area = gtk_cell_area_box_new ();
g_object_ref_sink (priv->cell_area);
}
return priv->cell_area;
}
+4 -11
View File
@@ -222,25 +222,18 @@
* <row>
* <entry>up-folder</entry>
* <entry>
* <keycombo><keycap>Alt</keycap><keycap>Up</keycap></keycombo>;
* <keycombo><keycap>Alt</keycap><keycap>Shift</keycap><keycap>Up</keycap></keycombo>
* <keycombo><keycap>Alt</keycap><keycap>Up</keycap></keycombo>
* <footnote>
* Both the individual Up key and the numeric
* keypad's Up key are supported.
* </footnote>;
* </footnote>
* ;
* <keycap>Backspace</keycap>
* </entry>
* </row>
* <row>
* <entry>down-folder</entry>
* <entry>
* <keycombo><keycap>Alt</keycap><keycap>Down</keycap></keycombo>;
* <keycombo><keycap>Alt</keycap><keycap>Shift</keycap><keycap>Down</keycap></keycombo>
* <footnote>
* Both the individual Down key and the numeric
* keypad's Down key are supported.
* </footnote>
* </entry>
* <entry><keycombo><keycap>Alt</keycap><keycap>Down</keycap></keycombo></entry>
* </row>
* <row>
* <entry>home-folder</entry>
+57 -88
View File
@@ -63,8 +63,6 @@
#include "gtksizerequest.h"
#include "gtkstock.h"
#include "gtktable.h"
#include "gtktoolbar.h"
#include "gtktoolbutton.h"
#include "gtktooltip.h"
#include "gtktreednd.h"
#include "gtktreeprivate.h"
@@ -465,22 +463,6 @@ G_DEFINE_TYPE_WITH_CODE (GtkFileChooserDefault, _gtk_file_chooser_default, GTK_T
G_IMPLEMENT_INTERFACE (GTK_TYPE_FILE_CHOOSER_EMBED,
gtk_file_chooser_embed_default_iface_init));
static void
add_normal_and_shifted_binding (GtkBindingSet *binding_set,
guint keyval,
GdkModifierType modifiers,
const gchar *signal_name)
{
gtk_binding_entry_add_signal (binding_set,
keyval, modifiers,
signal_name, 0);
gtk_binding_entry_add_signal (binding_set,
keyval, modifiers | GDK_SHIFT_MASK,
signal_name, 0);
}
static void
_gtk_file_chooser_default_class_init (GtkFileChooserDefaultClass *class)
{
@@ -633,25 +615,27 @@ _gtk_file_chooser_default_class_init (GtkFileChooserDefaultClass *class)
GDK_KEY_v, GDK_CONTROL_MASK,
"location-popup-on-paste",
0);
gtk_binding_entry_add_signal (binding_set,
GDK_KEY_Up, GDK_MOD1_MASK,
"up-folder",
0);
gtk_binding_entry_add_signal (binding_set,
GDK_KEY_BackSpace, 0,
"up-folder",
0);
gtk_binding_entry_add_signal (binding_set,
GDK_KEY_KP_Up, GDK_MOD1_MASK,
"up-folder",
0);
add_normal_and_shifted_binding (binding_set,
GDK_KEY_Up, GDK_MOD1_MASK,
"up-folder");
add_normal_and_shifted_binding (binding_set,
GDK_KEY_KP_Up, GDK_MOD1_MASK,
"up-folder");
add_normal_and_shifted_binding (binding_set,
GDK_KEY_Down, GDK_MOD1_MASK,
"down-folder");
add_normal_and_shifted_binding (binding_set,
GDK_KEY_KP_Down, GDK_MOD1_MASK,
"down-folder");
gtk_binding_entry_add_signal (binding_set,
GDK_KEY_Down, GDK_MOD1_MASK,
"down-folder",
0);
gtk_binding_entry_add_signal (binding_set,
GDK_KEY_KP_Down, GDK_MOD1_MASK,
"down-folder",
0);
gtk_binding_entry_add_signal (binding_set,
GDK_KEY_Home, GDK_MOD1_MASK,
@@ -2467,27 +2451,27 @@ filter_create (GtkFileChooserDefault *impl)
}
static GtkWidget *
toolbutton_new (GtkFileChooserDefault *impl,
GIcon *icon,
gboolean sensitive,
gboolean show,
GCallback callback)
button_new (GtkFileChooserDefault *impl,
const char *text,
const char *stock_id,
gboolean sensitive,
gboolean show,
GCallback callback)
{
GtkToolItem *item;
GtkWidget *button;
GtkWidget *image;
item = gtk_tool_button_new (NULL, NULL);
image = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_SMALL_TOOLBAR);
gtk_widget_show (image);
gtk_tool_button_set_icon_widget (GTK_TOOL_BUTTON (item), image);
button = gtk_button_new_with_mnemonic (text);
image = gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_BUTTON);
gtk_button_set_image (GTK_BUTTON (button), image);
gtk_widget_set_sensitive (GTK_WIDGET (item), sensitive);
g_signal_connect (item, "clicked", callback, impl);
gtk_widget_set_sensitive (button, sensitive);
g_signal_connect (button, "clicked", callback, impl);
if (show)
gtk_widget_show (GTK_WIDGET (item));
gtk_widget_show (button);
return GTK_WIDGET (item);
return button;
}
/* Looks for a path among the shortcuts; returns its index or -1 if it doesn't exist */
@@ -3715,13 +3699,10 @@ shortcuts_list_create (GtkFileChooserDefault *impl)
NULL);
renderer = gtk_cell_renderer_text_new ();
g_object_set (renderer,
"width-chars", 12,
"ellipsize", PANGO_ELLIPSIZE_END,
NULL);
g_signal_connect (renderer, "edited",
g_object_set (renderer, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
g_signal_connect (renderer, "edited",
G_CALLBACK (shortcuts_edited), impl);
g_signal_connect (renderer, "editing-canceled",
g_signal_connect (renderer, "editing-canceled",
G_CALLBACK (shortcuts_editing_canceled), impl);
gtk_tree_view_column_pack_start (column, renderer, TRUE);
gtk_tree_view_column_set_attributes (column, renderer,
@@ -3743,57 +3724,46 @@ shortcuts_pane_create (GtkFileChooserDefault *impl,
GtkSizeGroup *size_group)
{
GtkWidget *vbox;
GtkWidget *toolbar;
GtkWidget *hbox;
GtkWidget *widget;
GtkStyleContext *context;
GIcon *icon;
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_widget_show (vbox);
/* Shortcuts tree */
widget = shortcuts_list_create (impl);
gtk_size_group_add_widget (size_group, widget);
context = gtk_widget_get_style_context (widget);
gtk_style_context_set_junction_sides (context, GTK_JUNCTION_BOTTOM);
gtk_box_pack_start (GTK_BOX (vbox), widget, TRUE, TRUE, 0);
/* Box for buttons */
toolbar = gtk_toolbar_new ();
gtk_toolbar_set_icon_size (GTK_TOOLBAR (toolbar), GTK_ICON_SIZE_MENU);
gtk_box_pack_start (GTK_BOX (vbox), toolbar, FALSE, FALSE, 0);
gtk_widget_show (toolbar);
context = gtk_widget_get_style_context (toolbar);
gtk_style_context_set_junction_sides (context, GTK_JUNCTION_TOP);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_box_set_homogeneous (GTK_BOX (hbox), TRUE);
gtk_size_group_add_widget (size_group, hbox);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
/* Add bookmark button */
icon = g_themed_icon_new_with_default_fallbacks ("list-add-symbolic");
impl->browse_shortcuts_add_button = toolbutton_new (impl,
icon,
FALSE,
TRUE,
G_CALLBACK (add_bookmark_button_clicked_cb));
g_object_unref (icon);
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), GTK_TOOL_ITEM (impl->browse_shortcuts_add_button), 0);
impl->browse_shortcuts_add_button = button_new (impl,
_("_Add"),
GTK_STOCK_ADD,
FALSE,
TRUE,
G_CALLBACK (add_bookmark_button_clicked_cb));
gtk_box_pack_start (GTK_BOX (hbox), impl->browse_shortcuts_add_button, TRUE, TRUE, 0);
gtk_widget_set_tooltip_text (impl->browse_shortcuts_add_button,
_("Add the selected folder to the Bookmarks"));
/* Remove bookmark button */
icon = g_themed_icon_new_with_default_fallbacks ("list-remove-symbolic");
impl->browse_shortcuts_remove_button = toolbutton_new (impl,
icon,
FALSE,
TRUE,
G_CALLBACK (remove_bookmark_button_clicked_cb));
g_object_unref (icon);
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), GTK_TOOL_ITEM (impl->browse_shortcuts_remove_button), 1);
impl->browse_shortcuts_remove_button = button_new (impl,
_("_Remove"),
GTK_STOCK_REMOVE,
FALSE,
TRUE,
G_CALLBACK (remove_bookmark_button_clicked_cb));
gtk_box_pack_start (GTK_BOX (hbox), impl->browse_shortcuts_remove_button, TRUE, TRUE, 0);
gtk_widget_set_tooltip_text (impl->browse_shortcuts_remove_button,
_("Remove the selected bookmark"));
@@ -4484,7 +4454,6 @@ file_pane_create (GtkFileChooserDefault *impl,
widget = create_file_list (impl);
gtk_box_pack_start (GTK_BOX (hbox), widget, TRUE, TRUE, 0);
gtk_size_group_add_widget (size_group, widget);
/* Preview */
@@ -4501,6 +4470,7 @@ file_pane_create (GtkFileChooserDefault *impl,
gtk_widget_show (widget);
gtk_box_pack_end (GTK_BOX (impl->filter_combo_hbox), widget, FALSE, FALSE, 0);
gtk_size_group_add_widget (size_group, impl->filter_combo_hbox);
gtk_box_pack_end (GTK_BOX (vbox), impl->filter_combo_hbox, FALSE, FALSE, 0);
return vbox;
@@ -5019,7 +4989,7 @@ browse_widgets_create (GtkFileChooserDefault *impl)
GtkWidget *widget;
GtkSizeGroup *size_group;
/* size group is used by the scrolled windows of the panes */
/* size group is used by the [+][-] buttons and the filter combo */
size_group = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
@@ -5062,7 +5032,6 @@ browse_widgets_create (GtkFileChooserDefault *impl)
gtk_box_pack_start (GTK_BOX (impl->location_entry_box), impl->location_label, FALSE, FALSE, 0);
/* Paned widget */
hpaned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
gtk_widget_show (hpaned);
gtk_box_pack_start (GTK_BOX (vbox), hpaned, TRUE, TRUE, 0);
+2 -2
View File
@@ -33,7 +33,7 @@
* types; e.g. a filter for text/plain also matches a file with mime
* type application/rtf, since application/rtf is a subclass of
* text/plain. Note that #GtkFileFilter allows wildcards for the
* subtype of a mime type, so you can e.g. filter for image/&ast;.
* subtype of a mime type, so you can e.g. filter for image/<!---->*.
*
* Normally, filters are used by adding them to a #GtkFileChooser,
* see gtk_file_chooser_add_filter(), but it is also possible
@@ -54,7 +54,7 @@
* <object class="GtkFileFilter">
* <mime-types>
* <mime-type>text/plain</mime-type>
* <mime-type>image/&ast;</mime-type>
* <mime-type>image/*</mime-type>
* </mime-types>
* <patterns>
* <pattern>*.txt</pattern>
+2
View File
@@ -526,6 +526,8 @@ gtk_fixed_remove (GtkContainer *container,
break;
}
children = children->next;
}
}
+1 -1
View File
@@ -22,7 +22,7 @@
#include "gtkgrid.h"
#include "gtkorientableprivate.h"
#include "gtkorientable.h"
#include "gtksizerequest.h"
#include "gtkprivate.h"
#include "gtkintl.h"
+17
View File
@@ -1209,6 +1209,23 @@ ensure_valid_themes (GtkIconTheme *icon_theme)
if (was_valid)
{
g_signal_emit (icon_theme, signal_changed, 0);
if (!priv->check_reload && priv->screen)
{
static GdkAtom atom_iconthemes = GDK_NONE;
GdkEvent *event = gdk_event_new (GDK_CLIENT_EVENT);
int i;
if (!atom_iconthemes)
atom_iconthemes = gdk_atom_intern_static_string ("_GTK_LOAD_ICONTHEMES");
for (i = 0; i < 5; i++)
event->client.data.l[i] = 0;
event->client.data_format = 32;
event->client.message_type = atom_iconthemes;
gdk_screen_broadcast_client_message (priv->screen, event);
}
}
}
+130 -157
View File
@@ -250,9 +250,10 @@ static void gtk_icon_view_get_property (GObject
static void gtk_icon_view_destroy (GtkWidget *widget);
static void gtk_icon_view_realize (GtkWidget *widget);
static void gtk_icon_view_unrealize (GtkWidget *widget);
static void gtk_icon_view_style_updated (GtkWidget *widget);
static void gtk_icon_view_state_flags_changed (GtkWidget *widget,
GtkStateFlags previous_state);
static void gtk_icon_view_style_set (GtkWidget *widget,
GtkStyle *previous_style);
static void gtk_icon_view_state_changed (GtkWidget *widget,
GtkStateType previous_state);
static void gtk_icon_view_get_preferred_width (GtkWidget *widget,
gint *minimum,
gint *natural);
@@ -370,9 +371,6 @@ static GtkIconViewItem * gtk_icon_view_get_item_at_coords (GtkIco
static void gtk_icon_view_set_cell_data (GtkIconView *icon_view,
GtkIconViewItem *item);
static void gtk_icon_view_ensure_cell_area (GtkIconView *icon_view,
GtkCellArea *cell_area);
static GtkCellArea *gtk_icon_view_cell_layout_get_area (GtkCellLayout *layout);
static void gtk_icon_view_item_selected_changed (GtkIconView *icon_view,
@@ -479,7 +477,7 @@ gtk_icon_view_class_init (GtkIconViewClass *klass)
widget_class->destroy = gtk_icon_view_destroy;
widget_class->realize = gtk_icon_view_realize;
widget_class->unrealize = gtk_icon_view_unrealize;
widget_class->style_updated = gtk_icon_view_style_updated;
widget_class->style_set = gtk_icon_view_style_set;
widget_class->get_accessible = gtk_icon_view_get_accessible;
widget_class->get_preferred_width = gtk_icon_view_get_preferred_width;
widget_class->get_preferred_height = gtk_icon_view_get_preferred_height;
@@ -498,7 +496,7 @@ gtk_icon_view_class_init (GtkIconViewClass *klass)
widget_class->drag_motion = gtk_icon_view_drag_motion;
widget_class->drag_drop = gtk_icon_view_drag_drop;
widget_class->drag_data_received = gtk_icon_view_drag_data_received;
widget_class->state_flags_changed = gtk_icon_view_state_flags_changed;
widget_class->state_changed = gtk_icon_view_state_changed;
container_class->remove = gtk_icon_view_remove;
container_class->forall = gtk_icon_view_forall;
@@ -1103,14 +1101,37 @@ gtk_icon_view_constructor (GType type,
GObjectConstructParam *construct_properties)
{
GtkIconView *icon_view;
GtkIconViewPrivate *priv;
GObject *object;
object = G_OBJECT_CLASS (gtk_icon_view_parent_class)->constructor
(type, n_construct_properties, construct_properties);
icon_view = (GtkIconView *) object;
priv = icon_view->priv;
gtk_icon_view_ensure_cell_area (icon_view, NULL);
if (!priv->cell_area)
{
priv->cell_area = gtk_cell_area_box_new ();
g_object_ref_sink (priv->cell_area);
}
if (GTK_IS_ORIENTABLE (priv->cell_area))
gtk_orientable_set_orientation (GTK_ORIENTABLE (priv->cell_area), priv->item_orientation);
gtk_cell_area_set_style_detail (priv->cell_area, "icon_view");
priv->cell_area_context = gtk_cell_area_create_context (priv->cell_area);
priv->add_editable_id =
g_signal_connect (priv->cell_area, "add-editable",
G_CALLBACK (gtk_icon_view_add_editable), icon_view);
priv->remove_editable_id =
g_signal_connect (priv->cell_area, "remove-editable",
G_CALLBACK (gtk_icon_view_remove_editable), icon_view);
priv->context_changed_id =
g_signal_connect (priv->cell_area_context, "notify",
G_CALLBACK (gtk_icon_view_context_changed), icon_view);
return object;
}
@@ -1219,17 +1240,9 @@ gtk_icon_view_set_property (GObject *object,
case PROP_CELL_AREA:
/* Construct-only, can only be assigned once */
area = g_value_get_object (value);
if (area)
{
if (icon_view->priv->cell_area != NULL)
{
g_warning ("cell-area has already been set, ignoring construct property");
g_object_ref_sink (area);
g_object_unref (area);
}
else
gtk_icon_view_ensure_cell_area (icon_view, area);
}
icon_view->priv->cell_area = g_object_ref_sink (area);
break;
case PROP_HADJUSTMENT:
@@ -1380,7 +1393,6 @@ gtk_icon_view_realize (GtkWidget *widget)
GdkWindow *window;
GdkWindowAttr attributes;
gint attributes_mask;
GtkStyleContext *context;
gtk_widget_set_realized (widget, TRUE);
@@ -1423,12 +1435,9 @@ gtk_icon_view_realize (GtkWidget *widget)
&attributes, attributes_mask);
gdk_window_set_user_data (icon_view->priv->bin_window, widget);
context = gtk_widget_get_style_context (widget);
gtk_style_context_save (context);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_VIEW);
gtk_style_context_set_background (context, icon_view->priv->bin_window);
gtk_style_context_restore (context);
gtk_widget_style_attach (widget);
gdk_window_set_background (icon_view->priv->bin_window,
&gtk_widget_get_style (widget)->base[gtk_widget_get_state (widget)]);
gdk_window_show (icon_view->priv->bin_window);
}
@@ -1448,38 +1457,42 @@ gtk_icon_view_unrealize (GtkWidget *widget)
}
static void
_gtk_icon_view_update_background (GtkIconView *icon_view)
gtk_icon_view_state_changed (GtkWidget *widget,
GtkStateType previous_state)
{
GtkWidget *widget = GTK_WIDGET (icon_view);
GtkIconView *icon_view = GTK_ICON_VIEW (widget);
GtkStateType state;
GtkStyle *style;
if (gtk_widget_get_realized (widget))
{
GtkStyleContext *context;
style = gtk_widget_get_style (widget);
state = gtk_widget_get_state (widget);
context = gtk_widget_get_style_context (widget);
gtk_style_context_save (context);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_VIEW);
gtk_style_context_set_background (context, gtk_widget_get_window (widget));
gtk_style_context_set_background (context, icon_view->priv->bin_window);
gtk_style_context_restore (context);
gdk_window_set_background (gtk_widget_get_window (widget), &style->base[state]);
gdk_window_set_background (icon_view->priv->bin_window, &style->base[state]);
}
}
static void
gtk_icon_view_state_flags_changed (GtkWidget *widget,
GtkStateFlags previous_state)
{
_gtk_icon_view_update_background (GTK_ICON_VIEW (widget));
gtk_widget_queue_draw (widget);
}
static void
gtk_icon_view_style_updated (GtkWidget *widget)
gtk_icon_view_style_set (GtkWidget *widget,
GtkStyle *previous_style)
{
_gtk_icon_view_update_background (GTK_ICON_VIEW (widget));
GtkIconView *icon_view = GTK_ICON_VIEW (widget);
GtkStateType state;
GtkStyle *style;
if (gtk_widget_get_realized (widget))
{
style = gtk_widget_get_style (widget);
state = gtk_widget_get_state (widget);
gdk_window_set_background (gtk_widget_get_window (widget), &style->base[state]);
gdk_window_set_background (icon_view->priv->bin_window, &style->base[state]);
}
gtk_widget_queue_resize (widget);
}
@@ -1622,52 +1635,50 @@ gtk_icon_view_draw (GtkWidget *widget,
cairo_restore (cr);
}
if (dest_item &&
dest_pos != GTK_ICON_VIEW_NO_DROP)
if (dest_item)
{
GtkStyleContext *context;
GtkStateFlags state;
GdkRectangle rect = { 0 };
GtkStateType state;
GtkStyle *style;
context = gtk_widget_get_style_context (widget);
state = gtk_widget_get_state_flags (widget);
style = gtk_widget_get_style (widget);
state = gtk_widget_get_state (widget);
switch (dest_pos)
{
case GTK_ICON_VIEW_DROP_INTO:
rect = dest_item->cell_area;
gtk_paint_focus (style, cr, state, widget,
"iconview-drop-indicator",
dest_item->cell_area.x, dest_item->cell_area.y,
dest_item->cell_area.width, dest_item->cell_area.height);
break;
case GTK_ICON_VIEW_DROP_ABOVE:
rect.x = dest_item->cell_area.x;
rect.y = dest_item->cell_area.y - 1;
rect.width = dest_item->cell_area.width;
rect.height = 2;
gtk_paint_focus (style, cr, state, widget,
"iconview-drop-indicator",
dest_item->cell_area.x, dest_item->cell_area.y - 1,
dest_item->cell_area.width, 2);
break;
case GTK_ICON_VIEW_DROP_LEFT:
rect.x = dest_item->cell_area.x - 1;
rect.y = dest_item->cell_area.y;
rect.width = 2;
rect.height = dest_item->cell_area.height;
gtk_paint_focus (style, cr, state, widget,
"iconview-drop-indicator",
dest_item->cell_area.x - 1, dest_item->cell_area.y,
2, dest_item->cell_area.height);
break;
case GTK_ICON_VIEW_DROP_BELOW:
rect.x = dest_item->cell_area.x;
rect.y = dest_item->cell_area.y + dest_item->cell_area.height - 1;
rect.width = dest_item->cell_area.width;
rect.height = 2;
gtk_paint_focus (style, cr, state, widget,
"iconview-drop-indicator",
dest_item->cell_area.x,
dest_item->cell_area.y + dest_item->cell_area.height - 1,
dest_item->cell_area.width, 2);
break;
case GTK_ICON_VIEW_DROP_RIGHT:
rect.x = dest_item->cell_area.x + dest_item->cell_area.width - 1;
rect.y = dest_item->cell_area.y;
rect.width = 2;
rect.height = dest_item->cell_area.height;
gtk_paint_focus (style, cr, state, widget,
"iconview-drop-indicator",
dest_item->cell_area.x + dest_item->cell_area.width - 1,
dest_item->cell_area.y,
2, dest_item->cell_area.height);
case GTK_ICON_VIEW_NO_DROP: ;
break;
}
gtk_style_context_set_state (context, state);
gtk_render_focus (context, cr,
rect.x, rect.y,
rect.width, rect.height);
}
}
if (icon_view->priv->doing_rubberband)
@@ -2907,42 +2918,30 @@ gtk_icon_view_paint_item (GtkIconView *icon_view,
gboolean draw_focus)
{
GdkRectangle cell_area;
GtkStateFlags state = 0;
GtkCellRendererState flags = 0;
GtkStyleContext *style_context;
GtkCellRendererState flags;
GtkWidget *widget = GTK_WIDGET (icon_view);
GtkIconViewPrivate *priv = icon_view->priv;
GtkStyle *style;
GtkCellAreaContext *context;
if (priv->model == NULL)
return;
style = gtk_widget_get_style (widget);
gtk_icon_view_set_cell_data (icon_view, item);
style_context = gtk_widget_get_style_context (widget);
gtk_style_context_save (style_context);
gtk_style_context_add_class (style_context, GTK_STYLE_CLASS_VIEW);
gtk_style_context_add_class (style_context, GTK_STYLE_CLASS_CELL);
if (item->selected)
{
if (gtk_widget_has_focus (widget) &&
item == icon_view->priv->cursor_item)
{
state |= GTK_STATE_FLAG_FOCUSED;
flags |= GTK_CELL_RENDERER_FOCUSED;
}
state |= GTK_STATE_FLAG_SELECTED;
flags |= GTK_CELL_RENDERER_SELECTED;
gtk_style_context_set_state (style_context, state);
gtk_render_background (style_context, cr,
x - icon_view->priv->item_padding,
y - icon_view->priv->item_padding,
item->cell_area.width + icon_view->priv->item_padding * 2,
item->cell_area.height + icon_view->priv->item_padding * 2);
gtk_paint_flat_box (style,
cr,
GTK_STATE_SELECTED,
GTK_SHADOW_NONE,
GTK_WIDGET (icon_view),
"icon_view_item",
x - icon_view->priv->item_padding,
y - icon_view->priv->item_padding,
item->cell_area.width + icon_view->priv->item_padding * 2,
item->cell_area.height + icon_view->priv->item_padding * 2);
}
cell_area.x = x;
@@ -2950,20 +2949,26 @@ gtk_icon_view_paint_item (GtkIconView *icon_view,
cell_area.width = item->cell_area.width;
cell_area.height = item->cell_area.height;
flags = 0;
if (item->selected)
flags |= GTK_CELL_RENDERER_SELECTED;
if (gtk_widget_has_focus (widget) && item == icon_view->priv->cursor_item)
flags |= GTK_CELL_RENDERER_FOCUSED;
context = g_ptr_array_index (priv->row_contexts, item->row);
gtk_cell_area_render (priv->cell_area, context,
widget, cr, &cell_area, &cell_area, flags,
draw_focus);
gtk_style_context_restore (style_context);
}
static void
gtk_icon_view_paint_rubberband (GtkIconView *icon_view,
cairo_t *cr)
{
GtkStyleContext *context;
GdkRectangle rect;
GdkColor *fill_color_gdk;
guchar fill_color_alpha;
cairo_save (cr);
@@ -2972,22 +2977,28 @@ gtk_icon_view_paint_rubberband (GtkIconView *icon_view,
rect.width = ABS (icon_view->priv->rubberband_x1 - icon_view->priv->rubberband_x2) + 1;
rect.height = ABS (icon_view->priv->rubberband_y1 - icon_view->priv->rubberband_y2) + 1;
context = gtk_widget_get_style_context (GTK_WIDGET (icon_view));
gtk_widget_style_get (GTK_WIDGET (icon_view),
"selection-box-color", &fill_color_gdk,
"selection-box-alpha", &fill_color_alpha,
NULL);
gtk_style_context_save (context);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_RUBBERBAND);
if (!fill_color_gdk)
fill_color_gdk = gdk_color_copy (&gtk_widget_get_style (GTK_WIDGET (icon_view))->base[GTK_STATE_SELECTED]);
gdk_cairo_set_source_color (cr, fill_color_gdk);
gdk_cairo_rectangle (cr, &rect);
cairo_clip (cr);
gtk_render_background (context, cr,
rect.x, rect.y,
rect.width, rect.height);
gtk_render_frame (context, cr,
rect.x, rect.y,
rect.width, rect.height);
cairo_paint_with_alpha (cr, fill_color_alpha / 255.);
cairo_rectangle (cr,
rect.x + 0.5, rect.y + 0.5,
rect.width - 1, rect.height - 1);
cairo_stroke (cr);
gdk_color_free (fill_color_gdk);
gtk_style_context_restore (context);
cairo_restore (cr);
}
@@ -4087,58 +4098,21 @@ gtk_icon_view_scroll_to_item (GtkIconView *icon_view,
}
/* GtkCellLayout implementation */
static void
gtk_icon_view_ensure_cell_area (GtkIconView *icon_view,
GtkCellArea *cell_area)
{
GtkIconViewPrivate *priv = icon_view->priv;
if (priv->cell_area)
return;
if (cell_area)
priv->cell_area = cell_area;
else
priv->cell_area = gtk_cell_area_box_new ();
g_object_ref_sink (priv->cell_area);
if (GTK_IS_ORIENTABLE (priv->cell_area))
gtk_orientable_set_orientation (GTK_ORIENTABLE (priv->cell_area), priv->item_orientation);
priv->cell_area_context = gtk_cell_area_create_context (priv->cell_area);
priv->add_editable_id =
g_signal_connect (priv->cell_area, "add-editable",
G_CALLBACK (gtk_icon_view_add_editable), icon_view);
priv->remove_editable_id =
g_signal_connect (priv->cell_area, "remove-editable",
G_CALLBACK (gtk_icon_view_remove_editable), icon_view);
priv->context_changed_id =
g_signal_connect (priv->cell_area_context, "notify",
G_CALLBACK (gtk_icon_view_context_changed), icon_view);
}
static GtkCellArea *
gtk_icon_view_cell_layout_get_area (GtkCellLayout *cell_layout)
{
GtkIconView *icon_view = GTK_ICON_VIEW (cell_layout);
GtkIconViewPrivate *priv = icon_view->priv;
if (G_UNLIKELY (!priv->cell_area))
gtk_icon_view_ensure_cell_area (icon_view, NULL);
return icon_view->priv->cell_area;
}
static void
gtk_icon_view_set_cell_data (GtkIconView *icon_view,
gtk_icon_view_set_cell_data (GtkIconView *icon_view,
GtkIconViewItem *item)
{
gboolean iters_persist;
GtkTreeIter iter;
iters_persist = gtk_tree_model_get_flags (icon_view->priv->model) & GTK_TREE_MODEL_ITERS_PERSIST;
if (!iters_persist)
@@ -6842,7 +6816,6 @@ gtk_icon_view_create_drag_icon (GtkIconView *icon_view,
GtkTreePath *path)
{
GtkWidget *widget;
GtkStyleContext *context;
cairo_t *cr;
cairo_surface_t *surface;
GList *l;
@@ -6852,7 +6825,6 @@ gtk_icon_view_create_drag_icon (GtkIconView *icon_view,
g_return_val_if_fail (path != NULL, NULL);
widget = GTK_WIDGET (icon_view);
context = gtk_widget_get_style_context (widget);
if (!gtk_widget_get_realized (widget))
return NULL;
@@ -6880,8 +6852,9 @@ gtk_icon_view_create_drag_icon (GtkIconView *icon_view,
cr = cairo_create (surface);
cairo_set_line_width (cr, 1.);
gtk_render_background (context, cr, 0, 0,
rect.width + 2, rect.height + 2);
gdk_cairo_set_source_color (cr, &gtk_widget_get_style (widget)->base[gtk_widget_get_state (widget)]);
cairo_rectangle (cr, 0, 0, rect.width + 2, rect.height + 2);
cairo_fill (cr);
cairo_save (cr);
+4 -10
View File
@@ -1182,7 +1182,7 @@ on_button_press_event_for_process_tree_view (GtkWidget *widget,
return ret;
}
static GtkWidget *
static void
create_show_processes_dialog (GMountOperation *op,
const char *message,
const char *choices[])
@@ -1309,9 +1309,9 @@ create_show_processes_dialog (GMountOperation *op,
g_object_add_weak_pointer (G_OBJECT (tree_view), (gpointer *) &priv->process_tree_view);
g_object_unref (list_store);
g_object_ref (op);
return dialog;
gtk_widget_show_all (dialog);
g_object_ref (op);
}
static void
@@ -1321,7 +1321,6 @@ gtk_mount_operation_show_processes (GMountOperation *op,
const char *choices[])
{
GtkMountOperationPrivate *priv;
GtkWidget *dialog = NULL;
g_return_if_fail (GTK_IS_MOUNT_OPERATION (op));
g_return_if_fail (message != NULL);
@@ -1333,7 +1332,7 @@ gtk_mount_operation_show_processes (GMountOperation *op,
if (priv->process_list_store == NULL)
{
/* need to create the dialog */
dialog = create_show_processes_dialog (op, message, choices);
create_show_processes_dialog (op, message, choices);
}
/* otherwise, we're showing the dialog, assume messages+choices hasn't changed */
@@ -1341,11 +1340,6 @@ gtk_mount_operation_show_processes (GMountOperation *op,
update_process_list_store (GTK_MOUNT_OPERATION (op),
priv->process_list_store,
processes);
if (dialog != NULL)
{
gtk_widget_show_all (dialog);
}
}
static void
+1 -1
View File
@@ -23,7 +23,7 @@
#include "config.h"
#include "gtkorientableprivate.h"
#include "gtkorientable.h"
#include "gtkprivate.h"
#include "gtktypebuiltins.h"
#include "gtkintl.h"
+3
View File
@@ -55,6 +55,9 @@ void gtk_orientable_set_orientation (GtkOrientable *orientable,
GtkOrientation orientation);
GtkOrientation gtk_orientable_get_orientation (GtkOrientable *orientable);
/* Private */
void _gtk_orientable_set_style_classes (GtkOrientable *orientable);
G_END_DECLS
#endif /* __GTK_ORIENTABLE_H__ */
-31
View File
@@ -1,31 +0,0 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 2011 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GTK_ORIENTABLE_PRIVATE_H__
#define __GTK_ORIENTABLE_PRIVATE_H__
#include "gtkorientable.h"
G_BEGIN_DECLS
void _gtk_orientable_set_style_classes (GtkOrientable *orientable);
G_END_DECLS
#endif /* __GTK_ORIENTABLE_H__ */
+83
View File
@@ -0,0 +1,83 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* Stub implementation of backend-specific GtkPlug functions. */
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include "gtkplug.h"
#include "gtkplugprivate.h"
GdkNativeWindow
_gtk_plug_windowing_get_id (GtkPlug *plug)
{
return 0;
}
void
_gtk_plug_windowing_realize_toplevel (GtkPlug *plug)
{
}
void
_gtk_plug_windowing_map_toplevel (GtkPlug *plug)
{
}
void
_gtk_plug_windowing_unmap_toplevel (GtkPlug *plug)
{
}
void
_gtk_plug_windowing_set_focus (GtkPlug *plug)
{
}
void
_gtk_plug_windowing_add_grabbed_key (GtkPlug *plug,
guint accelerator_key,
GdkModifierType accelerator_mods)
{
}
void
_gtk_plug_windowing_remove_grabbed_key (GtkPlug *plug,
guint accelerator_key,
GdkModifierType accelerator_mods)
{
}
void
_gtk_plug_windowing_focus_to_parent (GtkPlug *plug,
GtkDirectionType direction)
{
}
GdkFilterReturn
_gtk_plug_windowing_filter_func (GdkXEvent *gdk_xevent,
GdkEvent *event,
gpointer data)
{
return GDK_FILTER_CONTINUE;
}
+322
View File
@@ -0,0 +1,322 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
* Copyright (C) 2005 Novell, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* By Tor Lillqvist <tml@novell.com> 2005 */
/*
* Modified by the GTK+ Team and others 1997-2005. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include "gtkmarshalers.h"
#include "gtkplug.h"
#include "gtkplugprivate.h"
#include "gtkwindowprivate.h"
#include "gtkdebug.h"
#include "win32/gdkwin32.h"
#include "gtkwin32embed.h"
#if defined(_MSC_VER) && (WINVER < 0x0500)
#ifndef GA_PARENT
#define GA_PARENT 1
#endif
WINUSERAPI HWND WINAPI GetAncestor(HWND,UINT);
#endif
GdkNativeWindow
_gtk_plug_windowing_get_id (GtkPlug *plug)
{
return (GdkNativeWindow) GDK_WINDOW_HWND (gtk_widget_get_window (GTK_WIDGET (plug)));
}
void
_gtk_plug_windowing_realize_toplevel (GtkPlug *plug)
{
GtkPlugPrivate *priv = plug->priv;
if (priv->socket_window)
{
_gtk_win32_embed_send (priv->socket_window,
GTK_WIN32_EMBED_PARENT_NOTIFY,
(WPARAM) GDK_WINDOW_HWND (gtk_widget_get_window (GTK_WIDGET (plug))),
GTK_WIN32_EMBED_PROTOCOL_VERSION);
_gtk_win32_embed_send (priv->socket_window,
GTK_WIN32_EMBED_EVENT_PLUG_MAPPED, 0, 0);
}
}
void
_gtk_plug_windowing_map_toplevel (GtkPlug *plug)
{
GtkPlugPrivate *priv = plug->priv;
if (priv->socket_window)
_gtk_win32_embed_send (priv->socket_window,
GTK_WIN32_EMBED_EVENT_PLUG_MAPPED,
1, 0);
}
void
_gtk_plug_windowing_unmap_toplevel (GtkPlug *plug)
{
GtkPlugPrivate *priv = plug->priv;
if (priv->socket_window)
_gtk_win32_embed_send (priv->socket_window,
GTK_WIN32_EMBED_EVENT_PLUG_MAPPED,
0, 0);
}
void
_gtk_plug_windowing_set_focus (GtkPlug *plug)
{
GtkPlugPrivate *priv = plug->priv;
if (priv->socket_window)
_gtk_win32_embed_send (priv->socket_window,
GTK_WIN32_EMBED_REQUEST_FOCUS,
0, 0);
}
void
_gtk_plug_windowing_add_grabbed_key (GtkPlug *plug,
guint accelerator_key,
GdkModifierType accelerator_mods)
{
GtkPlugPrivate *priv = plug->priv;
if (priv->socket_window)
_gtk_win32_embed_send (priv->socket_window,
GTK_WIN32_EMBED_GRAB_KEY,
accelerator_key, accelerator_mods);
}
void
_gtk_plug_windowing_remove_grabbed_key (GtkPlug *plug,
guint accelerator_key,
GdkModifierType accelerator_mods)
{
GtkPlugPrivate *priv = plug->priv;
if (priv->socket_window)
_gtk_win32_embed_send (priv->socket_window,
GTK_WIN32_EMBED_UNGRAB_KEY,
accelerator_key, accelerator_mods);
}
void
_gtk_plug_windowing_focus_to_parent (GtkPlug *plug,
GtkDirectionType direction)
{
GtkPlugPrivate *priv = plug->priv;
GtkWin32EmbedMessageType message = GTK_WIN32_EMBED_FOCUS_PREV;
switch (direction)
{
case GTK_DIR_UP:
case GTK_DIR_LEFT:
case GTK_DIR_TAB_BACKWARD:
message = GTK_WIN32_EMBED_FOCUS_PREV;
break;
case GTK_DIR_DOWN:
case GTK_DIR_RIGHT:
case GTK_DIR_TAB_FORWARD:
message = GTK_WIN32_EMBED_FOCUS_NEXT;
break;
}
_gtk_win32_embed_send_focus_message (priv->socket_window, message, 0);
}
GdkFilterReturn
_gtk_plug_windowing_filter_func (GdkXEvent *gdk_xevent,
GdkEvent *event,
gpointer data)
{
GtkPlug *plug = GTK_PLUG (data);
GtkPlugPrivate *priv = plug->priv;
MSG *msg = (MSG *) gdk_xevent;
GdkFilterReturn return_val = GDK_FILTER_CONTINUE;
switch (msg->message)
{
/* What message should we look for to notice the reparenting?
* Maybe WM_WINDOWPOSCHANGED will work? This is handled in the
* X11 implementation by handling ReparentNotify. Handle this
* only for cross-process embedding, otherwise we get odd
* crashes in testsocket.
*/
case WM_WINDOWPOSCHANGED:
if (!priv->same_app)
{
HWND parent = GetAncestor (msg->hwnd, GA_PARENT);
gboolean was_embedded = priv->socket_window != NULL;
GdkScreen *screen = gdk_window_get_screen (event->any.window);
GdkDisplay *display = gdk_screen_get_display (screen);
GTK_NOTE (PLUGSOCKET, g_printerr ("WM_WINDOWPOSCHANGED: hwnd=%p GA_PARENT=%p socket_window=%p\n", msg->hwnd, parent, priv->socket_window));
g_object_ref (plug);
if (was_embedded)
{
/* End of embedding protocol for previous socket */
if (parent != GDK_WINDOW_HWND (priv->socket_window))
{
GtkWidget *widget = GTK_WIDGET (plug);
GTK_NOTE (PLUGSOCKET, g_printerr ("was_embedded, current parent != socket_window\n"));
gdk_window_set_user_data (priv->socket_window, NULL);
g_object_unref (priv->socket_window);
priv->socket_window = NULL;
/* Emit a delete window, as if the user attempted to
* close the toplevel. Only do this if we are being
* reparented to the desktop window. Moving from one
* embedder to another should be invisible to the app.
*/
if (parent == GetDesktopWindow ())
{
GTK_NOTE (PLUGSOCKET, g_printerr ("current parent is root window\n"));
_gtk_plug_send_delete_event (widget);
return_val = GDK_FILTER_REMOVE;
}
}
else
{
GTK_NOTE (PLUGSOCKET, g_printerr ("still same parent\n"));
goto done;
}
}
if (parent != GetDesktopWindow ())
{
/* Start of embedding protocol */
GTK_NOTE (PLUGSOCKET, g_printerr ("start of embedding\n"));
priv->socket_window = gdk_win32_window_lookup_for_display (display, (GdkNativeWindow) parent);
if (priv->socket_window)
{
gpointer user_data = NULL;
GTK_NOTE (PLUGSOCKET, g_printerr ("already had socket_window\n"));
gdk_window_get_user_data (priv->socket_window, &user_data);
if (user_data)
{
g_warning (G_STRLOC "Plug reparented unexpectedly into window in the same process");
priv->socket_window = NULL;
break;
}
g_object_ref (priv->socket_window);
}
else
{
priv->socket_window = gdk_win32_window_foreign_new_for_display (display, (GdkNativeWindow) parent);
if (!priv->socket_window) /* Already gone */
break;
}
_gtk_plug_add_all_grabbed_keys (plug);
if (!was_embedded)
g_signal_emit_by_name (plug, "embedded");
}
done:
g_object_unref (plug);
}
break;
case WM_SIZE:
if (!priv->same_app && priv->socket_window)
{
_gtk_win32_embed_send (priv->socket_window,
GTK_WIN32_EMBED_PLUG_RESIZED,
0, 0);
}
break;
default:
if (msg->message == _gtk_win32_embed_message_type (GTK_WIN32_EMBED_WINDOW_ACTIVATE))
{
GTK_NOTE (PLUGSOCKET, g_printerr ("GtkPlug: WINDOW_ACTIVATE received\n"));
_gtk_win32_embed_push_message (msg);
_gtk_window_set_is_active (GTK_WINDOW (plug), TRUE);
_gtk_win32_embed_pop_message ();
return_val = GDK_FILTER_REMOVE;
}
else if (msg->message == _gtk_win32_embed_message_type (GTK_WIN32_EMBED_WINDOW_DEACTIVATE))
{
GTK_NOTE (PLUGSOCKET, g_printerr ("GtkPlug: WINDOW_DEACTIVATE received\n"));
_gtk_win32_embed_push_message (msg);
_gtk_window_set_is_active (GTK_WINDOW (plug), FALSE);
_gtk_win32_embed_pop_message ();
return_val = GDK_FILTER_REMOVE;
}
else if (msg->message == _gtk_win32_embed_message_type (GTK_WIN32_EMBED_FOCUS_IN))
{
GTK_NOTE (PLUGSOCKET, g_printerr ("GtkPlug: FOCUS_IN received\n"));
_gtk_win32_embed_push_message (msg);
_gtk_window_set_has_toplevel_focus (GTK_WINDOW (plug), TRUE);
switch (msg->wParam)
{
case GTK_WIN32_EMBED_FOCUS_CURRENT:
break;
case GTK_WIN32_EMBED_FOCUS_FIRST:
_gtk_plug_focus_first_last (plug, GTK_DIR_TAB_FORWARD);
break;
case GTK_WIN32_EMBED_FOCUS_LAST:
_gtk_plug_focus_first_last (plug, GTK_DIR_TAB_BACKWARD);
break;
}
_gtk_win32_embed_pop_message ();
return_val = GDK_FILTER_REMOVE;
}
else if (msg->message == _gtk_win32_embed_message_type (GTK_WIN32_EMBED_FOCUS_OUT))
{
GTK_NOTE (PLUGSOCKET, g_printerr ("GtkPlug: FOCUS_OUT received\n"));
_gtk_win32_embed_push_message (msg);
_gtk_window_set_has_toplevel_focus (GTK_WINDOW (plug), FALSE);
_gtk_win32_embed_pop_message ();
return_val = GDK_FILTER_REMOVE;
}
else if (msg->message == _gtk_win32_embed_message_type (GTK_WIN32_EMBED_MODALITY_ON))
{
GTK_NOTE (PLUGSOCKET, g_printerr ("GtkPlug: MODALITY_ON received\n"));
_gtk_win32_embed_push_message (msg);
_gtk_plug_handle_modality_on (plug);
_gtk_win32_embed_pop_message ();
return_val = GDK_FILTER_REMOVE;
}
else if (msg->message == _gtk_win32_embed_message_type (GTK_WIN32_EMBED_MODALITY_OFF))
{
GTK_NOTE (PLUGSOCKET, g_printerr ("GtkPlug: MODALITY_OFF received\n"));
_gtk_win32_embed_push_message (msg);
_gtk_plug_handle_modality_off (plug);
_gtk_win32_embed_pop_message ();
return_val = GDK_FILTER_REMOVE;
}
break;
}
return return_val;
}

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