Compare commits

...

153 Commits

Author SHA1 Message Date
Matthias Clasen 11140f8ba9 Queue an expand recompute if scrollbar visibility changes 2010-10-11 22:35:28 -04:00
Matthias Clasen ffd079a411 Queue an expand recompute if scrollbar visibility changes 2010-10-11 19:46:48 -04:00
Matthias Clasen 175f361d33 Unify handling of GtkWindow::resizable property 2010-10-11 17:23:01 -04:00
Matthias Clasen 406d1981be Support GtkWidget expand properties in GtkScrolledWindow
Always expand if a scrollbar is visible, otherwise inherit
the contents expand flag.
2010-10-11 15:39:47 -04:00
Matthias Clasen f0e7c9fc64 Support GtkWidget expand properties in GtkNotebook
We expand a tab if either tab-expand is set, or the generic widget
expand property in the correct direction is set. And we do not
propagate expand flags from tab labels to the notebook, only
the expand flags from the pages.
2010-10-11 15:23:03 -04:00
Matthias Clasen 8017a12b46 Remove expand child properties from GtkWrapBox
Instead, use generic widget expand properties.
2010-10-11 14:44:43 -04:00
Matthias Clasen 1f7966c143 Support GtkWidget expand properties in GtkTable
We expand a child when it either has the table-specific expand flag
or the generic expand property set. Override compute_expand so that
it also takes the table-specific expand flags of children into
account.

https://bugzilla.gnome.org/show_bug.cgi?id=628902
2010-10-11 13:59:44 -04:00
Matthias Clasen a0950f0f54 Set fill options on all children 2010-10-11 13:56:36 -04:00
Matthias Clasen f618f781b9 Add a GtkTable testcase 2010-10-11 13:26:11 -04:00
Havoc Pennington 5a11341c19 add tests/testexpand.c used to test the expand props on GtkWidget
There are two colored boxes with toggle buttons nested
inside several GtkBox. Toggling these to expand mode
should automatically propagate expansion up through
the several GtkBox such that resizing the window
results in resizing the colored boxes.

https://bugzilla.gnome.org/show_bug.cgi?id=628902
2010-09-25 11:53:12 -04:00
Havoc Pennington 9c2dde1c27 Support GtkWidget expand properties in GtkBox
This consists of:
* expand a child if either child->expand || gtk_widget_get_expand(child)
* override compute_expand so that child->expand will cause us to
  return TRUE for gtk_widget_get_expand()

https://bugzilla.gnome.org/show_bug.cgi?id=628902
2010-09-25 11:53:07 -04:00
Havoc Pennington 23715e121a Add horizontal and vertical expand flags, compute_expand() to GtkWidget
GtkWidget now has flags for horizontal and vertical expand, and
a compute_expand() method. compute_expand() is used by containers
to set a default expand flag. (If a widget has expand set explicitly,
it always overrides the results of compute_expand.)

GtkContainer has a default implementation of compute_expand which
simply walks over all child widgets and sets expand=TRUE
if any child is expanding.

The overall effect is that you only have to set expand on
leaf nodes in the widget tree, while previously you had to
set expand all the way up the tree as you packed every
container. Also, now containers need not have their own child
properties for expand.

For old containers which do have "expand" child properties,
they should override compute_expand and include the child
properties in whether the container is expand=TRUE.
Also, the old container should use
"child_prop_expand || gtk_widget_compute_expand()" everywhere
it previously used simply "child_prop_expand"

https://bugzilla.gnome.org/show_bug.cgi?id=628902
2010-09-25 11:52:58 -04:00
Matthias Clasen 5aad25aa42 Nuke the 'Types' section from the docs 2010-09-24 23:03:51 -04:00
Matthias Clasen 3fd767c92d Remove mention of input dialog from the docs 2010-09-24 22:16:53 -04:00
Matthias Clasen 8b5bc9669b GtkOffscreenWindow: shorten doc title 2010-09-24 22:13:42 -04:00
Matthias Clasen a98127fc12 GtkScale: Remove links from doc section title 2010-09-24 21:52:58 -04:00
Matthias Clasen 92ededc9b4 GtkMenu: Add a destroy notify to gtk_menu_popup_for_device
This is necessary so language bindings can use gtk_menu_popup_for_device()
as a 'full' variant of gtk_menu_popup().

http://bugzilla.gnome.org/show_bug.cgi?id=623664
2010-09-24 13:52:49 -04:00
Matthias Clasen cc9ac5b7ea Update docs of GtkAboutDialog and GtkLinkButton
Remove references to global hooks from the docs. Also move remaining
docs inline, and remove the templates.
2010-09-24 13:41:29 -04:00
Matthias Clasen bc6a3f8cd8 DND: don't use uninitialized memory
The dest_x/y members of GtkDragDestInfo were not initialized.
At the same time, switch some of the small temporary structs
to g_slice allocation.

https://bugzilla.gnome.org/show_bug.cgi?id=630532
2010-09-24 13:23:47 -04:00
Matthias Clasen 1773b6d50a GtkAboutDialog: correct a since tag 2010-09-24 12:43:55 -04:00
Christian Dywan 7dde4d93ad gtkeditable: move documentation to inline comments
Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=617316
2010-09-24 18:42:44 +02:00
Florian Müllner 93fd2b44c3 introspection: Fix typo in annotation 2010-09-24 18:26:34 +02:00
Tomeu Vizoso 41f4fd94df Don't try to unref event->dnd.context unconditionally.
As it's not set in gdk_event_new but eventually later.

https://bugzilla.gnome.org/show_bug.cgi?id=630520
2010-09-24 18:20:41 +02:00
Matthias Clasen 26c93dc04b GtkAboutDialog: escape mail addresses
This got lost when converting to the ::activate-link signal.
2010-09-24 12:02:37 -04:00
Matthias Clasen 8578ff4b38 Remove gtk_notebook_set_window_creation_hook in testnotebookdnd.c 2010-09-24 11:53:20 -04:00
Matthias Clasen 94e9a35a16 Another since tag 2010-09-24 11:31:23 -04:00
Matthias Clasen 50971f704c Correct since tags 2010-09-24 11:29:17 -04:00
Matthias Clasen 3c19eea34b GtkNotebook: replace group by group_name
Dealing with bare pointers is problematic for language bindings,
using interned strings is much more straightforward and more than
good enough for what is needed here.

http://bugzilla.gnome.org/show_bug.cgi?id=630521
2010-09-24 11:13:30 -04:00
Matthias Clasen b47b1428b8 GtkNotebook: remove gtk_notebook_set_window_creation_hook
http://bugzilla.gnome.org/show_bug.cgi?id=630521
2010-09-24 11:10:51 -04:00
Matthias Clasen 3557761fb3 docs: Add a CODING-STYLE document
This document mostly codifies the existing GTK+ coding style
conventions; it is strongly based on the clutter document of
the same name.
2010-09-23 22:28:02 -04:00
Matthias Clasen 65db1100ec docs: remove defsformat.txt
We should not ship documentation for file formats we are no longer
using.
2010-09-23 22:28:01 -04:00
Matthias Clasen c45985ae01 docs: remove gtk-config.txt
Considering that gtk-config has been obsoleted by pkg-config
a decade ago, we should stop shipping docs for it...
2010-09-23 22:28:01 -04:00
Matthias Clasen 8026cd386b Bump gobject-introspection dep in INSTALL.in 2010-09-23 22:28:01 -04:00
Johan Dahlin 8736d31a04 Fix a couple of broken annotations 2010-09-23 17:57:16 -03:00
Matthias Clasen 76d7331578 Fix the annotation of gtk_tree_view_create_row_drag_icon 2010-09-23 13:17:52 -04:00
Matthias Clasen 84bae92928 fix a typo in the gtk_widget_render_icon annotations 2010-09-23 13:17:52 -04:00
Takayuki KUSANO 381c14f1e2 Updated Japanese translation 2010-09-24 02:16:55 +09:00
Javier Jardón 61e9f570d9 INSTALL.in: Automate the versions of the dependencies 2010-09-23 19:05:13 +02:00
Kenneth Nielsen e56a209077 Updated Danish translation 2010-09-22 22:58:04 +02:00
Tristan Van Berkom aad77642be Fixed GtkWrapBox base requests for ALIGNED and FREE mode
Problems were; in FREE mode there was a simple typo where we were
repeatedly checking the size of the same item in get_largest_line_length(),
and in ALIGNED mode we were assuming something like HOMOGENEOUS which
was incorrect; added get_largest_aligned_line_length() which properly
adds up the collective max sizes of every index in the line.
2010-09-22 16:06:42 +09:00
Tristan Van Berkom c9ca4beb35 Fixed gtk_distribute_natural_allocation() to place the g_newa *after* g_return_if_fail() guards. 2010-09-22 16:06:42 +09:00
Matthias Clasen b0713fb3bb Remove url hooks from GtkAboutDialog and GtkLinkButton
With gtk_show_uri, global configurability of link activation has
moved to GIO/gvfs. For local overrides, GtkLinkButton has the ::clicked
signal, and GtkAboutDialog gets an ::activate-link signal.

Bug 339745
2010-09-22 00:36:13 -04:00
Tristan Van Berkom 0e1bba6ef5 Fixed GtkViewport to set adjustments properly for width-for-height widgets
Make GtkViewport calculate widget-for-height as well as height-for-width
cases when setting the scroll adjustment values, also base the scrolling
on the minimum size instead of the natural size in the interest of showing
as much content as possible when the viewport is smaller than the natural
size.
2010-09-22 12:50:06 +09:00
Javier Jardón bb90394147 Do not disable GDK deprecation guards 2010-09-22 04:28:53 +02:00
Javier Jardón fb62d6105f Do not disable deprecation guards 2010-09-22 04:21:13 +02:00
Javier Jardón 9ef738c4ab Add deprecation guards for gdk_device_get_core_pointer() 2010-09-22 03:53:23 +02:00
Javier Jardón 9c3d1080d6 Do not use deprecated gdk_display_get_core_pointer()
Use gdk_device_manager_get_client_pointer() instead
2010-09-22 03:42:15 +02:00
Matthias Clasen 59bc9e8860 Fix an off-by-one error in serial range handling
trap->end_sequence is the first serial for which we don't
ignore errors anymore, so we know the trap is dead if
end_sequence <= processed_serial.

Bug 629608
2010-09-21 21:10:15 -04:00
Matthias Clasen 0f88b6808c GtkScrolledWindow: change default policy to 'automatic'
This change was proposed in bug 468672.
2010-09-21 20:14:46 -04:00
Cody Russell 27bc88f7c2 Merge branch 'notebooks-without-mouse-scrolling' 2010-09-21 16:19:10 -05:00
Cody Russell ad48f4d52b Remove mouse scrolling from GtkNotebook tabs. Bug #630226. 2010-09-21 16:18:22 -05:00
Matthias Clasen eba2d6cf61 autogen.sh: run gtkdocize before aclocal 2010-09-21 12:45:51 -04:00
Tristan Van Berkom e976abe825 Split up GtkWrapBox:spreading property into two orientation specific properties.
Now GtkWrapBox has "horizontal-spreading" and "vertical-spreading" options,
before GtkWrapBox never spread out children across the opposing orientation
(i.e. it never grew "lines" larger then their natural width, they would
act as if set to GTK_WRAP_BOX_SPREAD_START, now they are completely configurable).
2010-09-21 22:00:54 +09:00
Michael Natterer 9e2996decd configure.ac: remove check for sigsetjmp(), it belonged to gdk-pixbuf 2010-09-21 12:35:37 +02:00
Owen W. Taylor 93e203e067 Use g_warning() for X errors and X IO errors
Currently fprintf(stderr, ...) is used for X error and X IO errors
(unless compiled with debugging, in which case g_error() is used for
X errors.)

But if an application is redirecting log messages, we really want
X errors to appear in that same log, so it's better to use a g_logv()
variant.

Though g_warning() isn't really appropriate for "lost connection to the
server", G_LOG_LEVEL_INFO isn't part of the "prefixed log levels"
so will produce output without the application name and PID.

https://bugzilla.gnome.org/show_bug.cgi?id=630216
2010-09-21 00:30:46 -04:00
Matthias Clasen e0aa12eb0a Tons of transfer annotations 2010-09-21 00:18:11 -04:00
Tristan Van Berkom ca251cf1d4 Reduced overall SizeRequestCache size
This patch changes the 'age' counting previous approach taken
verbatim from clutter and changes it for a counter of validated
caches and an index to the last cached value which we use to
round-robin through the cache if ever a widget is requested
for more than 3 contextual sizes (cache is reduced by 3 * sizeof (int)
per widget private data).
2010-09-21 12:57:27 +09:00
Johan Dahlin 6ba904486c Add a couple of missing transfer annotations 2010-09-20 23:45:01 -03:00
Johan Dahlin 330bc154ed Fixup gtk-doc comment syntax 2010-09-20 23:40:21 -03:00
Matthias Clasen 2ddfaeddad More error trap cleanups
Remove syncs in front of gdk_error_trap_pop() calls, and convert
gdk_error_trap_pop() calls to gdk_error_trap_pop_ignored() in gdk.
2010-09-20 16:40:14 -04:00
Owen W. Taylor 14e38da150 Only store error codes in inner-most X error trap
When an error occurs with nested traps in place, only the innermost
trap should have the error code stored in it; outer traps are
shielded by the inner trap.

https://bugzilla.gnome.org/show_bug.cgi?id=629608
2010-09-20 16:35:41 -04:00
Aron Xu 1592738d2f Add a ug.po for po-properties, re-enable ug in LINGUAS. 2010-09-20 20:16:29 +00:00
Emmanuele Bassi 1aea318d0f po: Disable ug localization
The ug.po file is missing from the po-properties directory and it's
breaking the build.
2010-09-20 13:51:38 +01:00
Takayuki KUSANO bb7ffddff2 Updated Japanese translation 2010-09-20 18:50:58 +09:00
Sweta Kothari e8a60e6123 Updated Gujarati Translations 2010-09-20 12:50:44 +05:30
Aron Xu d14687ef4b Add ug to LINGUAS. 2010-09-20 05:17:10 +00:00
Matthias Clasen def95d1319 Add new error trap api to gdk.symbols and gdk3-sections.txt 2010-09-19 22:45:02 -04:00
Javier Jardón 743202261a Add deprecation guards for gtk_cell_renderer_get_size() 2010-09-19 17:47:09 +02:00
Kenneth Nielsen ae3be469b3 Updated Danish translation 2010-09-19 17:40:56 +02:00
Wouter Bolsterlee bc7654826f Updated Dutch translation by Vincent van Adrighem 2010-09-19 16:39:54 +02:00
Matthias Clasen 1dcd209cdd Fix a few dubious return values in return_if_fail calls
These were pointed out in bug 623958.
2010-09-19 01:58:46 -04:00
Matthias Clasen 8e117b6f3a Add a rename-to annotation for gtk_tree_path_get_indices_with_depth
https://bugzilla.gnome.org/show_bug.cgi?id=621590
2010-09-19 01:15:17 -04:00
Matthias Clasen 6b4992d647 Point to the new GtkWidget align and margin properties 2010-09-19 01:01:09 -04:00
Matthias Clasen 35e0ad72e4 Another fix for the initial focus heuristic
We were trying to avoid selecting a label initially, but the code
was sometimes leaving labels selected when the focus eventually
ended up on a button instead.
2010-09-19 00:54:50 -04:00
Matthias Clasen 92411d2c84 Fix an annotation 2010-09-19 00:22:37 -04:00
Matthias Clasen 1243b4861c Use gdk_error_trap_pop_ignore() where appropriate 2010-09-18 23:17:31 -04:00
Havoc Pennington e32ab82069 Improve tests for X error traps, fix two bugs
* don't lose track of previous X error handler
  if nested traps are pushed
* free any remaining traps when display
  is finalized

Test will fail unless bug 630032 is closed so
gdk_display_close() works.

https://bugzilla.gnome.org/show_bug.cgi?id=630033
2010-09-18 23:03:31 -04:00
Havoc Pennington c7d73ee587 Fix bugs that crashed gdk_display_close() on x11
* _gdk_device_set_associated_device() did not allow NULL device
* GdkDisplay should dispose device manager to avoid devices
  trying to touch the display in finalize
* GdkDeviceManagerXI did not ref devices in id hash
* GdkDisplayX11 did not ref devices in ->input_devices
2010-09-18 22:57:36 -04:00
Havoc Pennington b837ef5a6d Revamp and modernize X error traps
* add per-display gdk_x11_display_error_trap_push()
  (X11-specific because gdk_error_trap_push() probably
  should have been)
* make gdk_error_trap_push() handle only GDK displays
  not displays opened without a GDK wrapper
* make gdk_error_trap_pop() and gdk_x11_display_error_trap_pop()
  automatically sync only if needed, so manual gdk_flush() is not
  required
* add gdk_error_trap_pop_ignored() which just asynchronously
  ignores errors, so never needs to sync
* add G_GNUC_WARN_UNUSED_RESULT to plain pop(), because
  if you use plain pop() and don't need the return value,
  the async gdk_error_trap_pop_ignored() should be used
  instead. This results in lots of warnings to clean
  up in a later patch.

The main objective here was to avoid the need to sync just
to ignore an error. Now, syncing is automatic, and only
happens when we need to know the error code.

https://bugzilla.gnome.org/show_bug.cgi?id=629608
2010-09-18 18:19:27 -04:00
Matthias Clasen 4f3e5e6ebc Add some minimal test for X error traps 2010-09-18 18:18:36 -04:00
Havoc Pennington 8d5b4e9f6e Replace crufty old code for gdk error traps with GQueue and GSlice
No need to do a manual free list these days.

https://bugzilla.gnome.org/show_bug.cgi?id=629608
2010-09-18 16:44:25 -04:00
Havoc Pennington de3512dbba Remove trailing whitespace and obsolete doc comments from gdk_error_trap code
(there are actual docs in the template file, these were some kind of
pre-gtk-doc comments without useful info)

https://bugzilla.gnome.org/show_bug.cgi?id=629608
2010-09-18 16:39:56 -04:00
Johan Dahlin 19cab17c22 Add a couple of missing annotations 2010-09-18 13:43:06 -03:00
Johan Dahlin 60c920f228 [introspection] Do not parse private sources
Private sources include private headers which we may not be able
to parse properly since some of them use unsupported syntax such
as objective-c.
2010-09-18 13:43:00 -03:00
Johan Dahlin 8c3900f420 [introspection] Do not include internal api
GtkTextLayout is internal and unsupported, do not include
it in the gir
2010-09-18 13:28:52 -03:00
Ryan Lortie ac051a7b2c depend on GLib 2.27.0 2010-09-17 20:49:30 -04:00
Javier Jardón 809dbe9f99 gail: Do not use deprecated gtk_cell_renderer_get_size()
Use gtk_cell_size_request_get_size() instead

https://bugzilla.gnome.org/show_bug.cgi?id=629785
2010-09-17 20:00:25 +02:00
Javier Jardón 15a5a231fc Do not use deprecated gtk_cell_renderer_get_size()
Use gtk_cell_size_request_get_size() instead

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=629785
2010-09-17 19:59:56 +02:00
Javier Jardón efbf04236e Change GtkEditable typedef from GtkEditableClass to GtkEditabeInterface
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=323904
2010-09-17 19:57:09 +02:00
Matthias Clasen 6e9349d858 Fix a trivial typo in a doc comment
https://bugzilla.gnome.org/show_bug.cgi?id=629733
2010-09-17 10:30:37 -04:00
Matthias Clasen 54077d61e2 Add some element-type annotations to gtk apis 2010-09-17 09:26:39 -04:00
Matthias Clasen 28c66ed9b0 Fix a doc comment 2010-09-17 09:25:49 -04:00
Matthias Clasen bf19aa46e9 Scan gdk/x11 sources for Gdk-3.0.gir
The doc comments (with annotations) for some of the gdk api are down
in x11/ sources, so we need to scan those too, when building Gdk-3.0.gir.
2010-09-17 09:23:30 -04:00
Matthias Clasen 6aa8941b84 Add annotations
The goi scanner warns about these nowadays.
2010-09-17 00:18:20 -04:00
Aron Xu ab0e68e586 Update Simplified Chinese translation of po-properties. 2010-09-16 17:34:27 +00:00
Matthias Clasen 2f78aa3024 Rename h/v-align to h/valign
And adjust the getters and setters to match. Also include some
documentation by Havoc Pennington about adjustment of size requests
and allocations.
2010-09-15 20:14:56 -04:00
Colin Walters bf2a7ee1b6 introspection: Only use 0.9.3 API 2010-09-15 15:07:58 -04:00
Petr Kovar 8e72e9a7a0 Update Czech translation 2010-09-15 20:31:29 +02:00
Petr Kovar 67e6ac5af9 Update Czech translation 2010-09-15 20:01:47 +02:00
Matthias Clasen b9f66d9197 Add docs for new API 2010-09-15 13:52:52 -04:00
Matthias Clasen 3e91238071 Add new api to gtk.symbols 2010-09-15 13:49:00 -04:00
Matthias Clasen 38e09dcbb1 Use gint instead of in for local consistency 2010-09-15 13:22:51 -04:00
Tristan Van Berkom 896e249e8f Added a default size of a magic number to testwrapbox.c
This was added to the test only for the sake of making it
easier to reproduce a bug with scrolled windows (bug 629778).

Expected behaviour: The vertical scrollbar should dissapear as soon
as the required height for the full allocation width (without any
vertical scrollbar) is small enough to not need a scrollbar.
2010-09-16 01:41:53 +09:00
Sebastian Dröge 560ca1eaad gdk: Only use XComposite if it is available
Fixes build if it isn't available. Bug #629748.
2010-09-15 16:42:57 +02:00
Tor Lillqvist 57e0b9a979 Fix build on Windows
No idea of the widget embedding crack has worked in recent versions,
even less now. But at least it now compiles.
2010-09-15 14:19:40 +03:00
Tristan Van Berkom 1110375f24 spinner: Dont inherit from GtkDrawingArea part 2.
Seems commit 7b42d4feda makes
GtkSpinner a direct subclass of GtkWidget but forgets to
update the header file to include gtkwidget.h instead and
declare the instance and class structures properly (assuming
this was just a missed file in the commit).
2010-09-15 16:52:29 +09:00
Javier Jardón f5a06df3dc spinner: timeout should add/remove in map/unmap, not realize/unrealize.
Otherwise hiding the spinner won't stop it
2010-09-15 04:00:55 +02:00
Javier Jardón 8345760fdb gtkentry: remove unnneded check in map/unmap functions 2010-09-15 03:28:24 +02:00
Javier Jardón e3a8e29a6c Add deprecation guards for gtk_widget_size_request() 2010-09-15 03:14:34 +02:00
Javier Jardón 15d46dd866 demos: Use gtk_size_request_get_size() instead gtk_widget_size_request() 2010-09-15 03:14:34 +02:00
Javier Jardón b140884fec Use gtk_size_request_get_size() instead deprecated gtk_widget_size_request()
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=629598

Signed-off-by: Javier Jardón <jjardon@gnome.org>
Signed-off-by: Tristan Van Berkom <tristanvb@openismus.com>
2010-09-15 03:02:58 +02:00
Christian Kirbach a18e2370bf [l10n] Updated German translation 2010-09-14 23:38:07 +02:00
Tristan Van Berkom 2ee532645f Adjusted new documentation for GtkSizeGroup. 2010-09-15 04:51:36 +09:00
Tristan Van Berkom 266476d32b Added documentation to gtksizegroup.sgml explaining what happens with height-for-width widgets.
When grouping height-for-width trading widgets (wrapping labels for instance)
vertically; the height for the minimum width will always be used for the entire
group... this patch warns about this in the docs.
2010-09-15 04:04:02 +09:00
Tristan Van Berkom 8bfb1e0ab8 Fixed GtkSizeGroups to adjust both minimum and natural requisitions
Originally the GtkSizeRequestIface patches left GtkSizeGroup working
only by bumping the minimum sizes - this commit fixes size groups to take
both minimum and natural requests into account.
2010-09-15 04:04:02 +09:00
Javier Jardón ab4ba69cc8 Add deprecation guards for gtk_cell_view_get_size_of_row() 2010-09-14 20:40:34 +02:00
Benjamin Otte 7b42d4feda spinner: Don't inherit from drawing area
A drawing area is not meant to be subclassed from. It also doesn't
provide any feature a spinner would need either.
2010-09-14 01:28:01 +02:00
Benjamin Otte 032d3f0ada spinner: Implement the size request interface
Doing size requests in expose is broken.
2010-09-14 01:25:07 +02:00
Benjamin Otte c22b80949d spinner: Move G_DEFINE_TYPE() below function definitions
Also remove redundant double definition.
2010-09-14 01:19:48 +02:00
Benjamin Otte 419e1548ab wrapbox: Lookie, an unused variable 2010-09-14 01:17:17 +02:00
Benjamin Otte 5ba6295a10 spinner: Define desired size at top of file
No magic numbers in the code please
2010-09-14 01:09:53 +02:00
Matthias Clasen ff29972a48 GtkWrapBox: let GtkContainer handle border width 2010-09-13 18:47:59 -04:00
Matthias Clasen b64e91adf0 Remove fill options from GtkWrapBox
GtkWidget alignment properties make this unnecessary in new containers.
2010-09-13 18:47:59 -04:00
Matthias Clasen 0e484a83d1 Remove padding from GtkWrapBox
GtkWidget margins make this unnecessary in new containers.
2010-09-13 18:47:58 -04:00
Matthias Clasen 8204fe6036 GtkBox: let GtkContainer handle border width 2010-09-13 18:47:58 -04:00
Javier Jardón 97ffc36540 Add deprecation guards for gtk_widget_get_child_requisition() 2010-09-13 22:37:11 +02:00
Javier Jardón 450beef2a2 demos: Do not use deprecated gtk_widget_get_child_requisition()
Use gtk_size_request_get_size() instead
2010-09-13 22:37:11 +02:00
Milan Bouchet-Valat e02252cdd6 bgo#486839 - Fix path bar size group in the file chooser
Since the location button is hidden in save mode, we need to add the
path bar to the size group too. The location button still has to be in
the group though, because it's larger than the path bar (when
shown). Instead of using the recent/search icons, add their hboxes so
that themed widget spacings don't introduce variations.
2010-09-13 14:57:23 -05:00
Javier Jardón 9e81022bf6 Use gtk_size_request_get_size() instead deprecated gtk_widget_get_child_requisition()
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=629177
2010-09-13 21:26:01 +02:00
Tristan Van Berkom 153bfacde0 Fixed GtkWrapBox to allocate variable row AND column heights when in ALIGNED mode
With this new approach at request and allocate time, the average child size
is used to determine a good guess at how many columns will fit the box
width; afterwards extra columns are appended and checked to fit.
Then the row heights are calculated based on height-for-width of each
child in the row which now may have individual widths.
2010-09-14 02:32:36 +09:00
Tristan Van Berkom 96c3858b21 Make testwrapbox scrolled window scrollbars automatic.
Did this in the hope to reproduce infinite recursion bugs
with height-for-width in scrolled windows (see complex bgo #611740
for reference for now).
2010-09-14 02:32:36 +09:00
Tristan Van Berkom a79637f081 Changed GtkWrapBox code to avoid a growing GArray of a known size. 2010-09-14 02:32:36 +09:00
Adel Gadllah 85ae875dcb [GdkWindowCache] Don't ignore the CompositeOverlayWindow
Add the composite overlay window to the cache, as this can be a reasonable Xdnd proxy as well.

This is only done when the screen is composited in order to avoid mapping
the COW. We assume that the CM is using the COW (which is true for pretty
much any CM currently in use).

https://bugzilla.gnome.org/show_bug.cgi?id=601731
2010-09-13 18:20:22 +02:00
Kristian Rietveld a79d6676ac Update gtkstyle.c to account for removal of row-ending-details
The detail strings now have more "detail" by default, so gtkstyle.c
needed to be updated to properly handle this.  Tests like testtreeview,
testtreesort now have proper background drawing again.

This strncmp trick was the best I could think of so quickly, if anybody
has an idea to do this in a better way, let me know.
2010-09-13 17:13:21 +02:00
Kristian Rietveld ecaa37529c Mark declaration of symbol _gtk_text_unknown_char_utf8 as extern
So that the symbol is not re-created each time the header is included.
The symbol is defined in gtktexttypes.c already.
2010-09-13 16:47:14 +02:00
Kristian Rietveld 31cd439385 Use accessor functions to access GtkWidget 2010-09-13 16:39:55 +02:00
Kristian Rietveld 0fc5433753 Update for GDK key name changes 2010-09-13 16:27:08 +02:00
Kristian Rietveld 234d750bb3 Update Quartz backend for GDK key name changes 2010-09-13 16:26:02 +02:00
Takayuki KUSANO d93ab58829 Updated Japanese translation. 2010-09-13 22:19:59 +09:00
Havoc Pennington 1dc9451b57 Add padding and alignment tests to testadjustsize.c 2010-09-12 21:47:10 -04:00
Havoc Pennington 474f80442a Add margin and alignment properties to GtkWidget
h-align = START,END,CENTER,FILL
v-align = START,END,CENTER,FILL
margin-left,right,top,bottom
margin

These should obsolete all such similar properties on
layout containers, GtkMisc, GtkAlignment, GtkContainer::border-width

Margin is outside the size request.
If margin were not outside the set_size_request() it would not work the
same way as container-supplied (child property) padding.

Conceptually set_size_request() forces the value from the subclass
(the original unadjusted request) and then we go on to adjust
the request further by adding the margin.
2010-09-12 21:47:10 -04:00
Havoc Pennington 85735112d7 GtkButton: let GtkContainer handle border width 2010-09-12 21:47:10 -04:00
Havoc Pennington daebca19da add gtk_container_class_handle_border_width() so subclasses can ignore border_width
A subclass calls gtk_container_class_handle_border_width()
in its class_init

This marks the subclass as expecting GtkContainer to deal with
border width automatically, which GtkContainer then does.
2010-09-12 21:47:10 -04:00
Havoc Pennington dc1940e99e Add testadjustsize test, to test new adjust size methods and related features
This will test size adjust, and interactions with other padding and border
2010-09-12 21:47:10 -04:00
Havoc Pennington cd2a19a68d GtkWidget: add adjust_size_request adjust_size_allocation virtual funcs
Use these new methods to handle set_size_request (aka aux_info)
inside gtkwidget.c, instead of having external code mess with it.

The virtual functions can be used for other purposes in the
future. For example, GtkContainer::border_width could be
automatically implemented for all container subclasses.
2010-09-12 21:47:10 -04:00
Havoc Pennington 9debfe243f Use _gtk_widget_get_aux_info_or_defaults() when possible in gtkwidget.c
Did not update uses in other files because the plan is to
get rid of those other uses anyhow. So don't want to make
this function available in the header.
2010-09-12 21:47:10 -04:00
Havoc Pennington cf68c2636a add _gtk_widget_get_aux_info_or_defaults()
This is better than peeking aux info then testing != NULL
in several ways:
- it returns const aux info so if we don't create we can't write
- it ensures that the default we assume if aux_info is NULL is
  the same as the default we set if we've created the aux info
- it avoids typing in != NULL checks
2010-09-12 21:47:10 -04:00
Havoc Pennington c29f0a1392 Fix more SizeRequest implementations to avoid recursive calls to wrapper API
GtkFrame, GtkComboBox, GtkExpander, GtkMenu, GtkWrapBox

These are all the examples I could find so far.

https://bugzilla.gnome.org/show_bug.cgi?id=628829
2010-09-12 21:47:10 -04:00
Havoc Pennington 8960d64cc6 Warn about recursively calling size req wrappers on the same object and orientation
We are not re-entrant and there is no reason for widgets to
do this, most likely they'll just get unexpected bugs because
the wrappers may modify the request.

Computing the request should logically rely only on the
widget itself, not on any adjustments caused by set_size_request,
size groups, and so forth.

https://bugzilla.gnome.org/show_bug.cgi?id=628829
2010-09-12 21:47:09 -04:00
Havoc Pennington cf6eb47758 default impls of width_for_height,hfw should chain directly not use wrapper API
In GtkBin and GtkWidget we tried to provide handy defaults that
call get_width if there's no get_width_for_height and
get_height for get_height_for_width.

However, they used the wrapper API on GtkSizeRequest instead of
chaining directly to the other method implementation.

This could result in all kinds of surprising behavior, for example,
get_width_for_height() would now already include the effects of set_size_request().

If nothing else it's inefficient. But it's just conceptually wrong,
because to chain to another implementation, we should call the other
implementation, not call a wrapper around the other implementation
(when we're already inside a previous invocation of the wrapper,
i.e. compute_size_for_orientation() ends up reinvoking itself
in the same orientation on the same object which it pretty
likely isn't intending to do)

https://bugzilla.gnome.org/show_bug.cgi?id=628829
2010-09-12 21:47:09 -04:00
Havoc Pennington b3079c0d18 Use gint16 for GtkBorder
32K of border ought to be enough for any pixel dimensions. At least
until screens are so huge we start using doubles.

This saves a nice 64 bits of space when we have a GtkBorder
stored somewhere.

Signed integers are used to avoid surprising unsigned math
issues. Just search GTK's whole git log from inception
for "unsigned" if you want to find any number of commits
fixing signed/unsigned bugs.

https://bugzilla.gnome.org/show_bug.cgi?id=629387
2010-09-12 21:47:09 -04:00
Javier Jardón 7e520d908a Fix some compilation warnings
GScanner token field is declared as GTokenType instead a guint
See Glib bug: https://bugzilla.gnome.org/show_bug.cgi?id=627890

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=627962
2010-09-13 03:28:36 +02:00
Javier Jardón e3fafd7512 docs: Fix gdk_display_get_core_pointer() docs
Point to gdk_device_manager_get_client_pointer(),
not gdk_display_get_client_pointer().
2010-09-13 02:48:21 +02:00
227 changed files with 30719 additions and 20234 deletions
+4 -2
View File
@@ -5,9 +5,11 @@ GTK+ requires the following packages:
- The GLib, Pango, GdkPixbuf, ATK and cairo libraries, available at
the same location as GTK+. GTK+ @GTK_VERSION@ requires at least
GLib 2.23.6, Pango 1.20, GdkPixbuf 2.21.0 ATK 1.29.2 and cairo 1.6.0.
GLib @GLIB_REQUIRED_VERSION@, Pango @PANGO_REQUIRED_VERSION@,
GdkPixbuf @GDK_PIXBUF_REQUIRED_VERSION@, ATK @ATK_REQUIRED_VERSION@
and cairo @CAIRO_REQUIRED_VERSION@.
- gobject-introspection 0.6.7 or newer.
- gobject-introspection 0.9.3 or newer.
Simple install procedure
========================
+2 -1
View File
@@ -110,10 +110,11 @@ rm -rf autom4te.cache
# regenerated from their corresponding *.in files by ./configure anyway.
touch README INSTALL
gtkdocize || exit $?
$ACLOCAL -I m4 $ACLOCAL_FLAGS || exit $?
libtoolize --force || exit $?
gtkdocize || exit $?
autoheader || exit $?
+12 -14
View File
@@ -31,11 +31,21 @@ m4_define([gtk_api_version], [3.0])
m4_define([gtk_binary_version], [3.0.0])
# required versions of other packages
m4_define([glib_required_version], [2.25.15])
m4_define([glib_required_version], [2.27.0])
m4_define([pango_required_version], [1.20])
m4_define([atk_required_version], [1.29.2])
m4_define([cairo_required_version], [1.9.10])
m4_define([gdk_pixbuf_required_version], [2.21.0])
GLIB_REQUIRED_VERSION=glib_required_version
PANGO_REQUIRED_VERSION=pango_required_version
ATK_REQUIRED_VERSION=atk_required_version
CAIRO_REQUIRED_VERSION=cairo_required_version
GDK_PIXBUF_REQUIRED_VERSION=gdk_pixbuf_required_version
AC_SUBST(GLIB_REQUIRED_VERSION)
AC_SUBST(PANGO_REQUIRED_VERSION)
AC_SUBST(ATK_REQUIRED_VERSION)
AC_SUBST(CAIRO_REQUIRED_VERSION)
AC_SUBST(GDK_PIXBUF_REQUIRED_VERSION)
AC_INIT([gtk+], [gtk_version],
@@ -477,18 +487,6 @@ if test "$gtk_ok" = "yes"; then
[Define if _NL_PAPER_WIDTH is available])
fi
# sigsetjmp is a macro on some platforms, so AC_CHECK_FUNCS is not reliable
AC_MSG_CHECKING(for sigsetjmp)
AC_TRY_LINK([#include <setjmp.h>], [
sigjmp_buf env;
sigsetjmp(env, 0);
], gtk_ok=yes, gtk_ok=no)
AC_MSG_RESULT($gtk_ok)
if test "$gtk_ok" = "yes"; then
AC_DEFINE(HAVE_SIGSETJMP, 1,
[Define to 1 if sigsetjmp is available])
fi
# i18n stuff
ALL_LINGUAS="`grep -v '^#' "$srcdir/po/LINGUAS" | tr '\n' ' '`"
AM_GLIB_GNU_GETTEXT
@@ -1534,7 +1532,7 @@ fi
# GObject introspection
##################################################
GOBJECT_INTROSPECTION_CHECK([0.9.5])
GOBJECT_INTROSPECTION_CHECK([0.9.3])
##################################################
# Checks for gtk-doc and docbook-tools
-21
View File
@@ -67,25 +67,6 @@ activate_radio_action (GtkAction *action, GtkRadioAction *current)
}
}
static void
activate_email (GtkAboutDialog *about,
const gchar *link,
gpointer data)
{
gchar *text;
text = g_strdup_printf ("send mail to %s", link);
g_print ("%s\n", text);
g_free (text);
}
static void
activate_url (GtkAboutDialog *about,
const gchar *link,
gpointer data)
{
g_print ("show url %s\n", link);
}
static void
about_cb (GtkAction *action,
GtkWidget *window)
@@ -120,8 +101,6 @@ about_cb (GtkAction *action,
g_object_unref (pixbuf);
}
gtk_about_dialog_set_email_hook (activate_email, NULL, NULL);
gtk_about_dialog_set_url_hook (activate_url, NULL, NULL);
gtk_show_about_dialog (GTK_WINDOW (window),
"program-name", "GTK+ Code Demos",
"version", g_strdup_printf ("%s,\nRunning against GTK+ %d.%d.%d",
+2 -2
View File
@@ -271,7 +271,7 @@ struct _MaskEntryClass
};
static void mask_entry_editable_init (GtkEditableClass *iface);
static void mask_entry_editable_init (GtkEditableInterface *iface);
G_DEFINE_TYPE_WITH_CODE (MaskEntry, mask_entry, GTK_TYPE_ENTRY,
G_IMPLEMENT_INTERFACE (GTK_TYPE_EDITABLE,
@@ -316,7 +316,7 @@ mask_entry_class_init (MaskEntryClass *klass)
static void
mask_entry_editable_init (GtkEditableClass *iface)
mask_entry_editable_init (GtkEditableInterface *iface)
{
iface->changed = mask_entry_changed;
}
+1 -1
View File
@@ -279,7 +279,7 @@ static gchar *types[] =
"GtkTreeStore ",
"GtkEntry ",
"GtkEditable ",
"GtkEditableClass ",
"GtkEditableInterface ",
"GdkPixmap ",
"GdkEventConfigure ",
"GdkEventMotion ",
+4 -2
View File
@@ -392,7 +392,8 @@ gtk_rotated_bin_size_request (GtkWidget *widget,
child_requisition.height = 0;
if (bin->child && gtk_widget_get_visible (bin->child))
gtk_widget_size_request (bin->child, &child_requisition);
gtk_size_request_get_size (GTK_SIZE_REQUEST (bin->child),
&child_requisition, NULL);
s = sin (bin->angle);
c = cos (bin->angle);
@@ -434,7 +435,8 @@ gtk_rotated_bin_size_allocate (GtkWidget *widget,
s = sin (bin->angle);
c = cos (bin->angle);
gtk_widget_get_child_requisition (bin->child, &child_requisition);
gtk_size_request_get_size (GTK_SIZE_REQUEST (bin->child),
&child_requisition, NULL);
child_allocation.x = 0;
child_allocation.y = 0;
child_allocation.height = child_requisition.height;
+4 -2
View File
@@ -316,7 +316,8 @@ gtk_mirror_bin_size_request (GtkWidget *widget,
child_requisition.height = 0;
if (bin->child && gtk_widget_get_visible (bin->child))
gtk_widget_size_request (bin->child, &child_requisition);
gtk_size_request_get_size (GTK_SIZE_REQUEST (bin->child),
&child_requisition, NULL);
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
requisition->width = border_width * 2 + child_requisition.width + 10;
@@ -349,7 +350,8 @@ gtk_mirror_bin_size_allocate (GtkWidget *widget,
GtkRequisition child_requisition;
GtkAllocation child_allocation;
gtk_widget_get_child_requisition (bin->child, &child_requisition);
gtk_size_request_get_size (GTK_SIZE_REQUEST (bin->child),
&child_requisition, NULL);
child_allocation.x = 0;
child_allocation.y = 0;
child_allocation.height = child_requisition.height;
+2 -1
View File
@@ -141,7 +141,8 @@ main(int argc, char **argv)
gtk_widget_show_all (vbox);
/* Compute the size without the drawing area, so we know how big to make the default size */
gtk_widget_size_request (vbox, &scratch_requisition);
gtk_size_request_get_size (GTK_SIZE_REQUEST (vbox),
&scratch_requisition, NULL);
darea = gtk_drawing_area_new ();
gtk_box_pack_start (GTK_BOX (vbox), darea, TRUE, TRUE, 0);
+635
View File
@@ -0,0 +1,635 @@
GTK+ Coding Style
-------------------------------------------------------------------------------
This document is intended to be a short description of the preferred
coding style to be used for the GTK+ source code. It was strongly
inspired by Clutter's CODING_STYLE.
Coding style is a matter of consistency, readability and maintainance;
coding style is also completely arbitrary and a matter of taste. This
document will use examples at the very least to provide authoritative
and consistent answers to common questions regarding the coding style,
and will also try to identify the allowed exceptions.
The examples will show the preferred coding style; the negative examples
will be clearly identified. Please, don't submit code to GTK+ that
looks like any of these.
Part of the rationales for these coding style rules are available either
in the kernel CodingStyle document or in Cairo's CODING_STYLE one.
When in doubt, check the surrounding code and try to imitate it.
+ Line width
The maximum line width for source files is 80 characters, whenever possible.
Longer lines are usually an indication that you either need a function
or a pre-processor macro.
+ Indentation
Each new level is indented 2 or more spaces than the previous level:
if (condition)
single_statement ();
This can only be achieved using space characters. It may not be achieved
using tab characters alone, or using a combination of spaces and tabs.
Do not change the editor's configuration to change the meaning of a
tab character (see below); code using tabs to indent will not be accepted
into GTK+.
Even if two spaces for each indentation level allows deeper nesting than
8 spaces, GTK+ favours self-documenting function names that can take
quite some space. For this reason you should avoid deeply nested code.
+ Tab characters
The tab character must always be expanded to spaces. If a literal
tab must be used inside the source, the tab must always be interpreted
according to its traditional meaning:
Advance to the next column which is a multiple of 8.
[ these two lines should be aligned ]
+ Braces
Curly braces should not be used for single statement blocks:
if (condition)
single_statement ();
else
another_single_statement (arg1);
In case of multiple statements, curly braces should be put on another
indentation level:
if (condition)
{
statement_1 ();
statement_2 ();
statement_3 ();
}
The "no block for single statements" rule has only four exceptions:
① if the single statement covers multiple lines, e.g. for functions with
many arguments, and it is followed by else or else if:
/* valid */
if (condition)
{
a_single_statement_with_many_arguments (some_lengthy_argument,
another_lengthy_argument,
and_another_one,
plus_one);
}
else
another_single_statement (arg1, arg2);
② if the condition is composed of many lines:
/* valid */
if (condition1 ||
(condition2 && condition3) ||
condition4 ||
(condition5 && (condition6 || condition7)))
{
a_single_statement ();
}
③ Nested if's, in which case the block should be placed on the
outermost if:
/* valid */
if (condition)
{
if (another_condition)
single_statement ();
else
another_single_statement ();
}
/* invalid */
if (condition)
if (another_condition)
single_statement ();
else if (yet_another_condition)
another_single_statement ();
④ If either side of an if-else statement has braces, both sides
should, to match up indentation:
/* valid */
if (condition)
{
foo ();
bar ();
}
else
{
baz ();
}
/* invalid */
if (condition)
{
foo ();
bar ();
}
else
baz ();
In general, new blocks should be placed on a new indentation level,
like:
int retval = 0;
statement_1 ();
statement_2 ();
{
int var1 = 42;
gboolean res = FALSE;
res = statement_3 (var1);
retval = res ? -1 : 1;
}
While curly braces for function definitions should rest on a new line
they should not add an indentation level:
/* valid */
static void
my_function (int argument)
{
do_my_things ();
}
/* invalid */
static void
my_function (int argument) {
do_my_things ();
}
/* invalid */
static void
my_function (int argument)
{
do_my_things ();
}
Curly braces must not be placed on the same line as a condition:
/* invalid */
if (condition) {
statement_1 ();
statement_2 ();
}
+ Conditions
Do not check boolean values for equality:
/* invalid */
if (condition == TRUE)
do_foo ();
/* valid */
if (another_condition)
do_bar ();
Even if C handles NULL equality like a boolean, be explicit:
/* valid */
if (some_pointer == NULL)
do_blah ();
/* invalid */
if (some_other_pointer)
do_blurp ();
In case of conditions split over multiple lines, the logical operators should
always go at the end of the line:
/* invalid */
if (condition1
|| condition2
|| condition3)
{
do_foo ();
}
/* valid */
if (condition1 &&
condition2 &&
(condition3 || (condition4 && condition5)))
{
do_blah ();
}
+ Functions
Functions should be declared by placing the returned value on a separate
line from the function name:
void
my_function (void)
{
}
The arguments list must be broken into a new line for each argument,
with the argument names right aligned, taking into account pointers:
void
my_function (some_type_t type,
another_type_t *a_pointer,
final_type_t another_type)
{
}
The alignment also holds when invoking a function without breaking the
80 characters limit:
align_function_arguments (first_argument,
second_argument,
third_argument);
To respect the 80 characters limit do not break the function name from
the arguments:
/* invalid */
a_very_long_function_name_with_long_parameters
(argument_the_first, argument_the_second);
/* valid */
first_a = argument_the_first;
second_a = argument_the_second;
a_very_long_function_name_with_long_parameters (first_a, second_a);
+ Whitespace
Always put a space before a parenthesis but never after:
/* valid */
if (condition)
do_my_things ();
/* valid */
switch (condition)
{
}
/* invalid */
if(condition)
do_my_things();
/* invalid */
if ( condition )
do_my_things ( );
A switch() should open a block on a new indentation level, and each case
should start on the same indentation level as the curly braces, with the
case block on a new indentation level:
/* valid */
switch (condition)
{
case FOO:
do_foo ();
break;
case BAR:
do_bar ();
break;
}
/* invalid */
switch (condition) {
case FOO: do_foo (); break;
case BAR: do_bar (); break;
}
/* invalid */
switch (condition)
{
case FOO: do_foo ();
break;
case BAR: do_bar ();
break;
}
/* invalid */
switch (condition)
{
case FOO:
do_foo ();
break;
case BAR:
do_bar ();
break;
}
It is preferable, though not mandatory, to separate the various cases with
a newline:
switch (condition)
{
case FOO:
do_foo ();
break;
case BAR:
do_bar ();
break;
default:
do_default ();
}
The 'break' statement for the default: case is not mandatory.
If a case block needs to declare new variables, the same rules as the
inner blocks (see above) apply; the break statement should be placed
outside of the inner block:
switch (condition)
{
case FOO:
{
int foo;
foo = do_foo ();
}
break;
...
}
When declaring a structure type use newlines to separate logical sections
of the structure:
struct _GtkWrapBoxPrivate
{
GtkOrientation orientation;
GtkWrapAllocationMode mode;
GtkWrapBoxSpreading horizontal_spreading;
GtkWrapBoxSpreading vertical_spreading;
guint16 vertical_spacing;
guint16 horizontal_spacing;
guint16 minimum_line_children;
guint16 natural_line_children;
GList *children;
};
Do not eliminate whitespace and newlines just because something would
fit on 80 characters:
/* invalid */
if (condition) foo (); else bar ();
Do eliminate trailing whitespace on any line, preferably as a separate
patch or commit. Never use empty lines at the beginning or at the end of
a file.
Do enable the default git pre-commit hook that detect trailing
whitespace for you and help you to avoid corrupting GTK+'s tree with
it. Do that as follows:
chmod a+x .git/hooks/pre-commit
You might also find the git-stripspace utility helpful which acts as a
filter to remove trailing whitespace as well as initial, final, and
duplicate blank lines.
+ Headers
Headers are special, for GTK+, in that they don't have to obey the
80 characters limit. The only major rule for headers is that the function
definitions should be vertically aligned in three columns:
return value function_name (type argument,
type argument,
type argument);
The maximum width of each column is given by the longest element in the
column:
void gtk_type_set_property (GtkType *type,
const gchar *value,
GError **error);
G_CONST_RETURN gchar *gtk_type_get_property (GtkType *type);
It is also possible to align the columns to the next tab:
void gtk_type_set_prop (GtkType *type,
gfloat value);
gfloat gtk_type_get_prop (GtkType *type);
gint gtk_type_update_foobar (GtkType *type);
Public headers should never be included directly:
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gtk/gtk.h> can be included directly."
#endif
All headers should have inclusion guards (for internal usage)
and C++ guards:
#ifndef __GTK_FOO_H__
#define __GTK_FOO_H__
#include <gtk/gtk-bar.h>
G_BEGIN_DECLS
...
G_END_DECLS
#endif /* __GTK_FOO_H__ */
+ Includes
GTK+ source files should never include the global gtk.h header, but
instead include the individual headers that are needed. Every file must
include config.h first, then its own header, then other GTK+ headers
that it needs, then system and third-party headers that it needs.
/* valid */
#include "config.h"
#include "gtkfoo.h"
#include "gtkwidget.h"
#include "gtkbutton.h"
...
#include <string.h>
+ GObject
GObject classes definition and implementation require some additional
coding style notices.
Typedef declarations should be placed at the beginning of the file:
typedef struct _GtkFoo GtkFoo;
typedef struct _GtkFooClass GtkFooClass;
typedef struct _GtkFooPrivate GtkFooPrivate;
This includes enumeration types:
typedef enum
{
GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT,
GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH
} GtkSizeRequestMode;
And callback types:
typedef void (* GtkCallback) (GtkWidget *widget,
gpointer user_data);
Instance structures should only contain the parent type and a pointer to a
private data structure, and they should be annotated as "private":
struct _GtkFoo
{
/*< private >*/
GtkWidget parent_instance;
GtkFooPrivate *priv;
};
All the properties should be stored inside the private data structure, which
is defined inside the source file - or, if needed, inside a private header
file; the private header filename must end with "private.h" and must not be
installed.
The private data structure should only be accessed internally using the
pointer inside the instance structure, and never using the
G_TYPE_INSTANCE_GET_PRIVATE() macro or the g_type_instance_get_private()
function.
Always use the G_DEFINE_TYPE(), G_DEFINE_TYPE_WITH_CODE() macros, or
their abstract variants G_DEFINE_ABSTRACT_TYPE() and
G_DEFINE_ABSTRACT_TYPE_WITH_CODE(), and the similar macros for defining
interfaces.
Interface types should always have the dummy typedef for cast purposes:
typedef struct _GtkFoo GtkFoo;
The interface structure should have "Interface" postfixed to the dummy typedef:
typedef struct _GtkFooInterface GtkFooInterface;
Interfaces must have the following macros:
- Macro: - Expands to:
• GTK_TYPE_<iface_name> <iface_name>_get_type
• GTK_<iface_name> G_TYPE_CHECK_INSTANCE_CAST
• GTK_IS_<iface_name> G_TYPE_CHECK_INSTANCE_TYPE
• GTK_<iface_name>_GET_IFACE G_TYPE_INSTANCE_GET_INTERFACE
+ Memory allocation
When dynamically allocating data on the heap either use g_new() or,
if allocating multiple small data structures, g_slice_new().
Public structure types should always be returned after being zero-ed,
either explicitly for each member, or by using g_new0() or g_slice_new0().
+ Macros
Try to avoid private macros unless strictly necessary. Remember to #undef
them at the end of a block or a series of functions needing them.
Inline functions are usually preferable to private macros.
Public macros should not be used unless they evaluate to a constant.
+ Public API
Avoid exporting variables as public API, since this is cumbersome on some
platforms. It is always preferable to add getters and setters instead.
All public functions must be listed in the gtk.symbols file.
+ Private API
Non-exported functions that are needed in more than one source file
should be named "_gtk_...", and declared in a private header file.
Underscore-prefixed functions are never exported.
Non-exported functions that are only needed in one source file
should be declared static.
+ Documentation
All public APIs must have gtk-doc comments. For functions, these should
be placed in the source file, directly above the function.
/* valid */
/**
* gtk_get_flow:
* @widget: a #GtkWidget
*
* Gets the flow of a widget.
*
* Note that flows may be laminar or turbulent...
*
* Returns: (transfer none): the flow of @widget
*/
GtkFlow *
gtk_get_flow (GtkWidget *widget)
{
...
}
Doc comments for macros, function types, class structs, etc should be
placed next to the definitions, typically in headers.
Section introductions should be placed in the source file they describe,
after the license header:
/* valid */
/**
* SECTION:gtksizerequest
* @Short_Description: Height-for-width geometry management
* @Title: GtkSizeRequest
*
* The GtkSizeRequest interface is GTK+'s height-for-width (and
* width-for-height) geometry management system.
* ...
*/
To properly document a new function, macro, function type or struct,
it needs to be listed in the gtk3-sections.txt file.
To properly document a new class, it needs to be given its own section
in gtk3-sections.txt, needs to be included in gtk-docs.sgml, and the
get_type function needs to listed in gtk3.types.
+ Old code
New code that is being added to GTK+ should adhere to the style
explained above. Existing GTK+ code does largely follow these
conventions, but there are some differences, e.g. occurrences
of tabs, etc.
It is ok to update the style of a code block or function when you
are touching it anyway, but sweeping whitespace changes obscure the
git history and should be avoided.
-338
View File
@@ -1,338 +0,0 @@
The overall syntax is:
(type-of-thing-being-defined name-used-to-refer-to-this-thing
(attribute-name attribute-value-depending-on-the-attribute)
(attribute-name attribute-value-depending-on-the-attribute)
(attribute-name attribute-value-depending-on-the-attribute))
Some definitions can have a c-declaration field that gives the C code
we parsed to arrive at the definition. The c-declaration is a quoted
string because it can contain parentheses and such.
Defined types and their attributes:
===
(module module-name
(submodule-of module-name)) ;; submodule is optional
Ex: (module Gtk)
Ex: (module Rgb
(submodule-of Gdk))
modules are later referred to with a list of module names, like
(Gdk Rgb) or (Gtk)
Object and boxed type definitions automatically create a submodule.
For example, GtkCList creates the module (module CList (submodule-of
(Gtk))) which is referred to as module (Gtk CList).
===
(type
(alias some-unique-identifier)
(in-module module-name) ;; optional, gchar* is not in a module
(gtk-type-id gtk-type-system-id) ;; optional, absent if this is not
;; in the type system
(is-parametric boolean) ;; optional default to #f
(in-c-name name-of-symbol-in-C)
(out-c-name name-of-symbol-in-C)
(inout-c-name name-of-symbol-in-C))
Ex: (type
(alias string)
(gtk-type-id GTK_TYPE_STRING)
(in-c-name "const gchar*")
(out-c-name "gchar**") ;; actually I'm not sure how strings work out/inout
(inout-c-name "gchar*"))
(type
(alias list)
(gtk-type-id GTK_TYPE_POINTER)
(is-parametric #t)
(in-c-name "GList*")
(out-c-name "GList**")
(inout-c-name "GList**"))
;; This one would be implied by the (object) def for GtkWidget I
;; think - (type) is only required for types that are not implied
;; by other definitions, such as int/boolean/etc.
(type
(alias GtkWidget)
(in-module (Gtk))
(gtk-type-id GTK_TYPE_WIDGET)
(in-c-name "GtkWidget*")
(inout-c-name "GtkWidget*")
(out-c-name "GtkWidget**"))
"Type" bindings are automatically assumed for objects, boxed types,
etc. as defined below.
The alias field is used to refer to the type later on.
Whenever a type alias can be used, it is also possible to use the
keyword "native", which implies that the type in question is too
C-specific to represent. Then a c-declaration will typically be
available for use.
C types containing [] or () are function pointers or arrays. For
arrays that don't specify a size, we just treat them as pointers. For
function pointers, we need special (type) syntax/attributes of some
kind, but since there basically aren't any of these right now in the
libs we care about we can just ignore them. For arrays that specify a
size ditto, you would handle them by adding an (array-size) attribute
or something or using the "native" keyword and skipping the (type)
stuff.
===
(object object-name
(in-module module-name-list)
(parent object-name optional-module-name-if-different)
(abstract boolean-is-abstract-class) ;; omit for default of #f
(c-name name-of-the-object-in-C)
(field (type-and-name type-alias-of-struct-field name-of-struct-field)
(access read-or-write-or-readwrite)))
Ex: (object Widget
(in-module (Gtk))
(parent Object) ;; could say (parent Object (Gtk))
(abstract #t)
(c-name GtkWidget)
(field (type-and-name GdkWindow* window) (access read)))
An "object" declaration automatically implies the type definition:
(type
(alias concat-module-elements-and-object-name)
(in-c-name pointer-to-c-name)
(out-c-name pointer-to-pointer-to-c-name)
(inout-c-name pointer-to-c-name))
Ex:
(type (alias GtkWidget)
(in-c-name GtkWidget*)
(out-c-name GtkWidget**)
(inout-c-name GtkWidget*))
It also implies a module that is the name broken into parts:
(module CTree
(submodule-of Gtk))
===
(function function-name
(in-module module-name-list) ;; "static methods" go in their
;; object's module
(is-constructor-of object-type-alias) ;; optional, marks a constructor
(c-name function-name)
(return-type return-value-type) ;; defaults to void
(caller-owns-return boolean-value) ;; defaults to #f
(can-return-null boolean-value) ;; defaults to #t
(parameter in-or-out-or-inout
(type-and-name parameter-type-alias parameter-name)
(type-parameter name-of-contained-type) ;; optional, requires parametric type
(c-declaration "c-type-and-name")) ;; c-declaration only required
;; if the type alias is "native"
(varargs #t) ;; has varargs at the end
)
Ex:
(function init
(in-module (Gdk Rgb)
(c-name gdk_rgb_init)))
Ex:
(function new
(in-module (Gdk Rgb Cmap))
(is-constructor-of GdkRgbCmap)
(c-name gdk_rgb_cmap_new)
(return-type GdkRgbCmap)
(caller-owns-return #t) ;; perhaps this could be implied by is-constructor-of
(parameter in (type-and-name array-of-guint32 colors))
(parameter in (type-and-name gint n_colors)))
Ex:
(function config_set_set_handler
(in-module (Gnome))
(c-name gnome_config_set_set_handler)
(parameter in (type-and-name native func)
(c-declaration "void (*func)(void*)"))
(parameter in (type-and-name gpointer data)))
===
(method method-name
(of-object object-name module-name)
;; retval/arg attributes as for (function), but with first parameter
;; omitted for non-constructors
)
Ex:
(method set_text
(of-object Label (Gtk))
(parameter (type-and-name const-gchar* str)))
===
(object-argument arg-name
(of-object object-we-are-an-argument-of optional-objects-module)
(type-id argument-type) ;; GTK_TYPE_OBJECT etc.
;; flags all default to #f
(readable bool-value)
(writeable bool-value)
(construct-only bool-value))
Ex:
(object-argument label
(of-object Label (Gtk))
(type GTK_TYPE_STRING)
(readable #t)
(writeable #t))
===
(signal signal-name
(run-action bool-value)
(run-first bool-value)
(run-last bool-value)
(of-object object-we-are-a-signal-of optional-objects-module)
;; return value and parameters as for a function, omitting the object
;; and user data parameters
;; what other properties matter for a signal?
)
Ex:
(signal select_row
(of-object CList (Gtk))
(run-first #t)
;; return type defaults to void
(parameter in (type-and-name gint row))
(parameter in (type-and-name gint column))
(parameter in (type-and-name GdkEvent* event)))
===
(enum enum-name
(in-module modname)
(c-name name-in-c)
(value (nick value-name-noprefixes-hyphen-lowercase) (c-name value-c-name)))
Ex:
(enum DirectionType
(in-module Gtk)
(c-name GtkDirectionType)
(value (nick tab-forward) (c-name GTK_DIR_TAB_FORWARD))
(value (nick tab-backward) (c-name GTK_DIR_TAB_BACKWARD))
(value (nick up) (c-name GTK_DIR_UP))
(value (nick down) (c-name GTK_DIR_DOWN))
(value (nick left) (c-name GTK_DIR_LEFT))
(value (nick right) (c-name GTK_DIR_RIGHT)))
(enum Pos
(in-module (Gtk CTree))
(c-name GtkCTreePos)
(value (nick before) (c-name GTK_CTREE_POS_BEFORE))
(value (nick as-child) (c-name GTK_CTREE_POS_AS_CHILD))
(value (nick after) (c-name GTK_CTREE_POS_AFTER)))
===
(flags) is just like enum, but some bindings may wrap enums and flags differently.
===
(boxed boxed-name
(in-module modname)
(c-name c-name)
(ref-func func-to-increase-refcount)
(copy-func func-to-copy)
(release-func func-to-destroy-or-decrement-refcount)
(field (type-and-name type-alias-of-struct-field name-of-struct-field) (access access-rule)))
It is never OK to use memcpy() to copy a boxed type, or use
malloc()/free() to alloc/free one.
Ex:
(boxed Pixmap
(in-module (Gdk))
(c-name GdkPixmap)
(ref-func pixmap_ref)
(release-func pixmap_unref))
An "object" declaration automatically implies the type definition:
(type
(alias concat-module-elements-and-boxed-name)
(in-c-name pointer-to-c-name)
(out-c-name pointer-to-pointer-to-c-name)
(inout-c-name pointer-to-c-name))
Ex:
(type (alias GdkPixmap)
(in-c-name GdkPixmap*)
(out-c-name GdkPixmap**)
(inout-c-name GdkPixmap*))
===
(struct struct-name
(in-module modname)
(c-name c-name)
(field (type-and-name type-alias-of-struct-field name-of-struct-field) (access access-rule)))
Unlike a boxed type, a struct type can be copied with memcpy() and
allocated on the stack or with g_malloc().
Ex:
(struct Rectangle
(in-module (Gdk))
(c-name GdkRectangle)
(field (type-and-name gint16 x) (access readwrite))
(field (type-and-name gint16 y) (access readwrite))
(field (type-and-name guint16 width) (access readwrite))
(field (type-and-name guint16 height) (access readwrite)))
Implies GdkRectangle type alias:
(type (alias GdkRectangle)
(in-c-name GdkRectangle*)
(out-c-name GdkRectangle*) ;; note - not the same as boxed types
(inout-c-name GdkRectangle*))
===
(user-function name
(in-module module)
(c-name c-typedef-name)
;; return-type and parameters as for (function)
)
Ex:
(user-function PrintFunc
(in-module (Gtk))
(parameter in (type-and-name gpointer func_data))
(parameter in (type-and-name gchar* str)))
===
(typedef new-name
(in-module module)
(c-name c-full-name)
(orig-type alias-of-orig-type))
Ex:
(typedef Type
(in-module (Gtk))
(c-name GtkType)
(orig-type guint))
-236
View File
@@ -1,236 +0,0 @@
CONFIGURING PACKAGES TO WORK WITH GTK
-------------------------------------
Compiling a program successfully against the GTK, GDK, and GLIB
libraries can require a large number of command line options
to your compiler and linker that are hard to guess correctly.
The additional libraries required may, for example, depend on the
manner which GTK was configured
Several tools are included in this package to make process
easier.
First, there is the shell script 'gtk-config' (installed in
$exec_prefix/bin):
Invoking gtk-config
-------------------
gtk-config takes the following flags:
--version
Prints out the version of GTK installed
--cflags
Prints '-I' flags pointing to the installed header files.
--libs
Prints out the linker flags necessary to link a program against GTK
--prefix[=PREFIX]
If PREFIX is specified, overrides the configured value of $prefix.
(And of exec-prefix, unless --exec-prefix is also specified)
Otherwise, prints out the configured value of $prefix
--exec-prefix[=PREFIX]
If PREFIX is specified, overrides the configured value of $exec_prefix.
Otherwise, prints out the configured value of $exec_prefix
You may also add to the command line a list of additional
libraries that gtk-config should supply the CFLAGS and LIBS
for. The only currently supported library is 'gthread'.
As an example of this latter usage, you can get the
appropriate cflags for a threaded program with:
gtk-config --cflags gthread
Example of using gtk-config
---------------------------
Typically, gtk-config will be used within a configure script,
as described below. It, however, can also be used directly
from the command line to compile a simple program. For example:
cc -o simple `gtk-config --cflags` simple.c `gtk-config --libs`
This command line might expand to (for example):
cc -o simple -I/usr/local/lib/glib/include -I/usr/local/include \
-I/usr/X11R6/include simple.c -L/usr/local/lib -L/usr/X11R6/lib \
-lgtk -lgdk -lglib -lXi -lXext -lX11 -lm
Not only is the form using gtk-config easier to type, it will
work on any system, no matter how GTK was configured.
AM_PATH_GTK
-----------
For packages configured using GNU automake, GTK also provides
a macro to automate the process of running GTK.
AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
This macro:
* Determines the location of GTK using gtk-config, which is either
found in the user's path, or from the environment variable
GTK_CONFIG
* Tests the installed libraries to make sure that there version
is later than MINIMUM-VERSION. (A default version will be used
if not specified)
* If the required version was found, sets the GTK_CFLAGS variable to
the output of `gtk-config --cflags` and the GTK_LIBS variable to
the output of `gtk-config --libs`, and calls AC_SUBST() for these
variables so they can be used in generated makefiles, and then
executes ACTION-IF-FOUND.
* If the required version was not found, sets GTK_CFLAGS and GTK_LIBS
to empty strings, and executes ACTION-IF-NOT-FOUND.
This macro is in file 'gtk.m4' which is installed in $datadir/aclocal.
Note that if automake was installed with a different --prefix than
GTK, you will either have to manually move gtk.m4 to automake's
$datadir/aclocal, or give aclocal the -I option when running it.
Configuring a package that uses AM_PATH_GTK
-------------------------------------------
Simply make sure that gtk-config is in your path, and run
the configure script.
Notes:
* The directory where the GTK libraries are installed needs
to be found by your system's dynamic linker.
This is generally done by
editing /etc/ld.so.conf and running ldconfig
Or by:
setting the environment variable LD_LIBRARY_PATH,
or, as a last resort,
Giving a -R or -rpath flag (depending on your linker) when
running configure, for instance:
LDFLAGS=-R/usr/home/owen/lib ./configure
* You can also specify a gtk-config not in your path by
setting the GTK_CONFIG environment variable to the
name of the executable
* If you move the GTK package from its installed location,
you will need either need to modify gtk-config script
manually to point to the new location or rebuild GTK.
Advanced note:
* configure flags
--with-gtk-prefix=PREFIX
--with-gtk-exec-prefix=PREFIX
are provided to override the prefix and exec-prefix that were stored
in the gtk-config shell script by GTK's configure. You are generally
better off configuring GTK with the right path to begin with.
Example of a package using AM_PATH_GTK
--------------------------------------
The following shows how to build a simple package using automake
and the AM_PATH_GTK macro. The program used here is the testinput.c
You should first read the introductory portions of the automake
Manual, if you are not already familiar with it.
Two files are needed, 'configure.ac', which is used to build the
configure script:
==configure.ac===
dnl Process this file with autoconf to produce a configure script.
AC_INIT(testinput.c)
AM_INIT_AUTOMAKE(testinput.c, 1.0.0)
AC_PROG_CC
AM_PROG_CC_STDC
AC_PROG_INSTALL
AM_PATH_GTK(0.99.5,
[LIBS="$LIBS $GTK_LIBS"
CFLAGS="$CFLAGS $GTK_CFLAGS"],
AC_MSG_ERROR(Cannot find GTK: Is gtk-config in path?))
AC_OUTPUT(Makefile)
=================
The only command in this which is not standard for automake
is the AM_PATH_GTK() macro.
That command does the following:
If a GTK version greater than 0.99.5 is found, adds $GTK_LIBS to
$LIBS and $GTK_CFLAGS to $CFLAGS. Otherwise, dies with the error
message "Cannot find GTK: Is gtk-config in path?"
And the 'Makefile.am', which will be used to build the Makefile.
== Makefile.am ==
bin_PROGRAMS = testinput
testinput_SOURCES = testinput.c
=================
This Makefile.am, says that we are building a single executable,
from a single sourcefile 'testinput.c'. Since every program
we are building uses GTK we simply added the GTK options
to $LIBS and $CFLAGS, but in other circumstances, we might
want to specify them on a per-program basis: for instance by
adding the lines:
testinput_LDADD = $(GTK_LIBS)
INCLUDES = $(GTK_CFLAGS)
to the Makefile.am.
To try this example out, create a new directory, add the two
files above two it, and copy the testinput.c file from
the gtk/ subdirectory to the new directory. Edit the line:
#include "gtk.h"
in testgtk.c, to read:
#include <gtk/gtk.h>
Now execute the following commands:
automake --add-missing
aclocal
autoconf
You now have a package that can be built in the normal fashion
./configure
make
make install
Notes:
* If you are converting a package that used a pre-1.0 version of
GTK, you should remove the autoconf tests for X. The results
of these tests are included in gtk-config and will be added
to GTK_LIBS and GTK_CFLAGS by the AM_PATH_GTK macro.
Owen Taylor
14 Mar 1997
+4
View File
@@ -47,6 +47,7 @@ gdk_beep
<SUBSECTION>
gdk_error_trap_push
gdk_error_trap_pop
gdk_error_trap_pop_ignored
<SUBSECTION>
GDK_WINDOWING_X11
@@ -1054,6 +1055,9 @@ gdk_x11_display_get_startup_notification_id
gdk_x11_display_get_xdisplay
gdk_x11_display_grab
gdk_x11_display_ungrab
gdk_x11_display_error_trap_push
gdk_x11_display_error_trap_pop
gdk_x11_display_error_trap_pop_ignored
gdk_x11_display_set_cursor_theme
gdk_x11_register_standard_event_type
gdk_x11_drawable_get_xdisplay
-36
View File
@@ -326,42 +326,6 @@ available.
@void:
<!-- ##### FUNCTION gdk_error_trap_push ##### -->
<para>
This function allows X errors to be trapped instead of the normal behavior
of exiting the application. It should only be used if it is not possible to
avoid the X error in any other way.
</para>
<example>
<title>Trapping an X error</title>
<programlisting>
gdk_error_trap_push (<!-- -->);
/* ... Call the X function which may cause an error here ... */
/* Flush the X queue to catch errors now. */
gdk_flush (<!-- -->);
if (gdk_error_trap_pop (<!-- -->))
{
/* ... Handle the error here ... */
}
</programlisting>
</example>
@void:
<!-- ##### FUNCTION gdk_error_trap_pop ##### -->
<para>
Removes the X error trap installed with gdk_error_trap_push().
</para>
@void:
@Returns: the X error code, or 0 if no error occurred.
<!-- ##### MACRO GDK_WINDOWING_X11 ##### -->
<para>
This macro is defined if GDK is configured to use the X11 backend.
+1 -3
View File
@@ -4,7 +4,6 @@
<!ENTITY % local.common.attrib "xmlns:xi CDATA #FIXED 'http://www.w3.org/2003/XInclude'">
<!ENTITY version SYSTEM "version.xml">
]>
<!--ENTITY index-Objects-Grouped SYSTEM "objects_grouped.sgml"-->
<book id="index" xmlns:xi="http://www.w3.org/2003/XInclude">
<bookinfo>
<title>GTK+ Reference Manual</title>
@@ -142,7 +141,6 @@ that is, GUI components such as #GtkButton or #GtkTextView.
<xi:include href="xml/gtkstyle.xml" />
<xi:include href="xml/gtkselection.xml" />
<xi:include href="xml/gtkfeatures.xml" />
<xi:include href="xml/gtktypeutils.xml" />
<xi:include href="xml/gtktesting.xml" />
<xi:include href="xml/filesystem.xml" />
</part>
@@ -282,7 +280,7 @@ that is, GUI components such as #GtkButton or #GtkTextView.
</chapter>
<chapter id="SelectorWidgets">
<title>Selectors (File/Font/Color/Input Devices)</title>
<title>Selectors (Color/File/Font)</title>
<xi:include href="xml/gtkcolorbutton.xml" />
<xi:include href="xml/gtkcolorseldlg.xml" />
<xi:include href="xml/gtkcolorsel.xml" />
+20 -17
View File
@@ -1925,8 +1925,6 @@ gtk_link_button_new
gtk_link_button_new_with_label
gtk_link_button_get_uri
gtk_link_button_set_uri
GtkLinkButtonUriFunc
gtk_link_button_set_uri_hook
gtk_link_button_get_visited
gtk_link_button_set_visited
@@ -2224,12 +2222,10 @@ gtk_notebook_get_tab_detachable
gtk_notebook_get_tab_hborder
gtk_notebook_get_tab_vborder
gtk_notebook_set_current_page
gtk_notebook_set_group
gtk_notebook_get_group
gtk_notebook_set_group_name
gtk_notebook_get_group_name
gtk_notebook_set_action_widget
gtk_notebook_get_action_widget
GtkNotebookWindowCreationFunc
gtk_notebook_set_window_creation_hook
<SUBSECTION Standard>
GTK_NOTEBOOK
GTK_IS_NOTEBOOK
@@ -4943,6 +4939,21 @@ gtk_requisition_new
gtk_requisition_copy
gtk_requisition_free
<SUBSECTION>
GtkAlign
gtk_widget_get_halign
gtk_widget_set_halign
gtk_widget_get_valign
gtk_widget_set_valign
gtk_widget_get_margin_left
gtk_widget_set_margin_left
gtk_widget_get_margin_right
gtk_widget_set_margin_right
gtk_widget_get_margin_top
gtk_widget_set_margin_top
gtk_widget_get_margin_bottom
gtk_widget_set_margin_bottom
<SUBSECTION Standard>
GTK_WIDGET
GTK_IS_WIDGET
@@ -5136,9 +5147,12 @@ gtk_device_grab_add
gtk_device_grab_remove
<SUBSECTION>
GtkFunction
gtk_init_add
gtk_quit_add_destroy
gtk_quit_add
GtkCallbackMarshal
GtkArg
gtk_quit_add_full
gtk_quit_remove
gtk_quit_remove_by_data
@@ -5443,17 +5457,6 @@ gtk_drag_source_add_image_targets
gtk_drag_source_add_uri_targets
</SECTION>
<SECTION>
<FILE>gtktypeutils</FILE>
<TITLE>Types</TITLE>
GtkFunction
GtkCallbackMarshal
GtkArg
<SUBSECTION Private>
GTK_TYPE_IDENTIFIER
gtk_identifier_get_type
</SECTION>
<SECTION>
<FILE>gtkbindings</FILE>
<TITLE>Bindings</TITLE>
+3
View File
@@ -1,14 +1,17 @@
gtkactiongroup.sgml
gtkaboutdialog.sgml
gtkbbox.sgml
gtkbox.sgml
gtkbuilder.sgml
gtkbutton.sgml
gtkcalendar.sgml
gtkcelleditable.sgml
gtkeditable.sgml
gtkhbox.sgml
gtkiconview.sgml
gtkimcontextsimple.sgml
gtkimmulticontext.sgml
gtklinkbutton.sgml
gtkmessagedialog.sgml
gtkobject.sgml
gtkorientable.sgml
+1 -1
View File
@@ -58,7 +58,7 @@ of their children.
<para>
The size requisition phase of the widget layout process operates top-down.
It starts at a top-level widget, typically a #GtkWindow. The top-level widget
asks its child for its size requisition by calling gtk_widget_size_request().
asks its child for its size requisition by calling gtk_size_request_get_size().
To determine its requisition, the child asks its own children for their
requisitions and so on. Finally, the top-level widget will get a requisition
back from its child.
+3 -4
View File
@@ -221,12 +221,11 @@ drops.
<!-- ##### FUNCTION gtk_drag_get_source_widget ##### -->
<para>
Determines the source widget for a drag.
</para>
@context: a (destination side) drag context.
@Returns: if the drag is occurring within a single application,
a pointer to the source widget. Otherwise, %NULL.
@context:
@Returns:
<!-- ##### FUNCTION gtk_drag_highlight ##### -->
-214
View File
@@ -1,214 +0,0 @@
<!-- ##### SECTION Title ##### -->
GtkEditable
<!-- ##### SECTION Short_Description ##### -->
Interface for text-editing widgets
<!-- ##### SECTION Long_Description ##### -->
<para>
The #GtkEditable interface is an interface which should be implemented by
text editing widgets, such as #GtkEntry and #GtkText. It contains functions
for generically manipulating an editable widget, a large number of action
signals used for key bindings, and several signals that an application can
connect to to modify the behavior of a widget.
</para>
<para>
As an example of the latter usage, by connecting
the following handler to "insert_text", an application
can convert all entry into a widget into uppercase.
<example>
<title>Forcing entry to uppercase.</title>
<programlisting>
#include &lt;ctype.h&gt;
void
insert_text_handler (GtkEditable *editable,
const gchar *text,
gint length,
gint *position,
gpointer data)
{
int i;
gchar *result = g_utf8_strup (text, length);
g_signal_handlers_block_by_func (editable,
(gpointer) insert_text_handler, data);
gtk_editable_insert_text (editable, result, length, position);
g_signal_handlers_unblock_by_func (editable,
(gpointer) insert_text_handler, data);
g_signal_stop_emission_by_name (editable, "insert_text");
g_free (result);
}
</programlisting>
</example>
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
</para>
<!-- ##### SECTION Stability_Level ##### -->
<!-- ##### SECTION Image ##### -->
<!-- ##### STRUCT GtkEditable ##### -->
<para>
The #GtkEditable structure is an opaque structure whose members
cannot be directly accessed.
</para>
<!-- ##### SIGNAL GtkEditable::changed ##### -->
<para>
</para>
@editable: the object which received the signal.
<!-- ##### SIGNAL GtkEditable::delete-text ##### -->
<para>
</para>
@editable:
@start_pos:
@end_pos:
<!-- ##### SIGNAL GtkEditable::insert-text ##### -->
<para>
</para>
@editable:
@new_text:
@new_text_length:
@position:
<!-- ##### FUNCTION gtk_editable_select_region ##### -->
<para>
</para>
@editable:
@start_pos:
@end_pos:
<!-- ##### FUNCTION gtk_editable_get_selection_bounds ##### -->
<para>
</para>
@editable:
@start_pos:
@end_pos:
@Returns:
<!-- ##### FUNCTION gtk_editable_insert_text ##### -->
<para>
</para>
@editable:
@new_text:
@new_text_length:
@position:
<!-- ##### FUNCTION gtk_editable_delete_text ##### -->
<para>
</para>
@editable:
@start_pos:
@end_pos:
<!-- ##### FUNCTION gtk_editable_get_chars ##### -->
<para>
</para>
@editable:
@start_pos:
@end_pos:
@Returns:
<!-- ##### FUNCTION gtk_editable_cut_clipboard ##### -->
<para>
</para>
@editable:
<!-- ##### FUNCTION gtk_editable_copy_clipboard ##### -->
<para>
</para>
@editable:
<!-- ##### FUNCTION gtk_editable_paste_clipboard ##### -->
<para>
</para>
@editable:
<!-- ##### FUNCTION gtk_editable_delete_selection ##### -->
<para>
</para>
@editable:
<!-- ##### FUNCTION gtk_editable_set_position ##### -->
<para>
</para>
@editable:
@position:
<!-- ##### FUNCTION gtk_editable_get_position ##### -->
<para>
</para>
@editable:
@Returns:
<!-- ##### FUNCTION gtk_editable_set_editable ##### -->
<para>
</para>
@editable:
@is_editable:
<!-- ##### FUNCTION gtk_editable_get_editable ##### -->
<para>
</para>
@editable:
@Returns:
@@ -37,7 +37,7 @@ The #GtkFileChooserButton supports the #GtkFileChooserAction<!--
<para>
The #GtkFileChooserButton will ellipsize the label,
and thus will thus request little horizontal space. To give the button
more space, you should call gtk_widget_size_request(),
more space, you should call gtk_size_request_get_size(),
gtk_file_chooser_button_set_width_chars(), or pack the button in
such a way that other interface elements give space to the widget.
</para>
-139
View File
@@ -1,139 +0,0 @@
<!-- ##### SECTION Title ##### -->
GtkLinkButton
<!-- ##### SECTION Short_Description ##### -->
Create buttons bound to a URL
<!-- ##### SECTION Long_Description ##### -->
<para>
A #GtkLinkButton is a #GtkButton with a hyperlink, similar to the one
used by web browsers, which triggers an action when clicked. It is useful
to show quick links to resources.
</para>
<para>
A link button is created by calling either gtk_link_button_new() or
gtk_link_button_new_with_label(). If using the former, the URI you pass
to the constructor is used as a label for the widget.
</para>
<para>
The URI bound to a #GtkLinkButton can be set specifically using
gtk_link_button_set_uri(), and retrieved using gtk_link_button_get_uri().
</para>
<para>
#GtkLinkButton offers a global hook, which is called when the used clicks
on it: see gtk_link_button_set_uri_hook().
</para>
<para>
#GtkLinkButton was added in GTK+ 2.10.
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
#GtkButton
</para>
<!-- ##### SECTION Stability_Level ##### -->
<!-- ##### SECTION Image ##### -->
<!-- ##### STRUCT GtkLinkButton ##### -->
<para>
The #GtkLinkButton struct contains private data only, and should be
manipulated using the functions below.
</para>
<!-- ##### ARG GtkLinkButton:uri ##### -->
<para>
</para>
<!-- ##### ARG GtkLinkButton:visited ##### -->
<para>
</para>
<!-- ##### FUNCTION gtk_link_button_new ##### -->
<para>
</para>
@uri:
@Returns:
<!-- ##### FUNCTION gtk_link_button_new_with_label ##### -->
<para>
</para>
@uri:
@label:
@Returns:
<!-- ##### FUNCTION gtk_link_button_get_uri ##### -->
<para>
</para>
@link_button:
@Returns:
<!-- ##### FUNCTION gtk_link_button_set_uri ##### -->
<para>
</para>
@link_button:
@uri:
<!-- ##### USER_FUNCTION GtkLinkButtonUriFunc ##### -->
<para>
The type of a function which is called when the #GtkLinkButton is
clicked.
</para>
@button: the #GtkLinkButton which was clicked
@link_: the URI to which the clicked #GtkLinkButton points
@user_data: user data that was passed when the function was registered
with gtk_link_button_set_uri_hook()
<!-- ##### FUNCTION gtk_link_button_set_uri_hook ##### -->
<para>
</para>
@func:
@data:
@destroy:
@Returns:
<!-- ##### FUNCTION gtk_link_button_get_visited ##### -->
<para>
</para>
@link_button:
@Returns:
<!-- ##### FUNCTION gtk_link_button_set_visited ##### -->
<para>
</para>
@link_button:
@visited:
+3 -3
View File
@@ -392,11 +392,11 @@ widget and this function does nothing.
<!-- ##### FUNCTION gtk_grab_get_current ##### -->
<para>
Queries the current grab of the default window group.
</para>
@void:
@Returns: The widget which currently has the grab or %NULL if no grab is active.
@void:
@Returns:
<!-- ##### FUNCTION gtk_grab_remove ##### -->
+5
View File
@@ -19,6 +19,11 @@ positioned within its allocated area. Note that if the widget is added to
a container in such a way that it expands automatically to fill its
allocated area, the alignment settings will not alter the widgets position.
</para>
<para>
Note that the desired effect can in most cases be achieved by using the
#GtkWidget:halign, #GtkWidget:valign and #GtkWidget:margin properties
on the child widget.
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
@@ -140,11 +140,10 @@ Sets the group of a radio menu item, or changes it.
<!-- ##### FUNCTION gtk_radio_menu_item_get_group ##### -->
<para>
Returns the group to which the radio menu item belongs, as a #GList of
#GtkRadioMenuItem. The list belongs to GTK+ and should not be freed.
</para>
@radio_menu_item: a #GtkRadioMenuItem.
@Returns: the group of @radio_menu_item.
@radio_menu_item:
@Returns:
+15
View File
@@ -44,6 +44,21 @@ vertical size from the vertical requisition of all widgets that can be
reached from the widget by a chain of size groups of type
%GTK_SIZE_GROUP_VERTICAL or %GTK_SIZE_GROUP_BOTH.
</para>
<para>
Note that only non-contextual sizes of every widget are ever consulted
by size groups (since size groups have no knowledge of what size a widget
will be allocated in one dimension, it cannot derive how much height
a widget will receive for a given width). When grouping widgets that
trade height for width in mode %GTK_SIZE_GROUP_VERTICAL or %GTK_SIZE_GROUP_BOTH:
the height for the minimum width will be the requested height for all
widgets in the group. The same is of course true when horizontally grouping
width for height widgets.
</para>
<para>
Widgets that trade height-for-width should set a reasonably large minimum width
by way of GtkLabel:width-chars for instance. Widgets with static sizes as well
as widgets that grow (such as ellipsizing text) need no such considerations.
</para>
<refsect2 id="GtkSizeGroup-BUILDER-UI">
<title>GtkSizeGroup as GtkBuildable</title>
<para>
+4 -1
View File
@@ -226,12 +226,15 @@ x11_introspection_files = \
x11/gdkx.h
GdkX11-3.0.gir: $(gdktargetlib) Gdk-3.0.gir Makefile
GdkX11_3_0_gir_SCANNERFLAGS = --warn-all --identifier-prefix=Gdk --symbol-prefix=gdk
GdkX11_3_0_gir_SCANNERFLAGS = --warn-all --strip-prefix=Gdk
GdkX11_3_0_gir_INCLUDES = Gio-2.0 Gdk-3.0 GdkPixbuf-2.0 Pango-1.0 xlib-2.0
GdkX11_3_0_gir_LIBS = $(gdktargetlib)
GdkX11_3_0_gir_FILES = $(x11_introspection_files)
GdkX11_3_0_gir_CFLAGS = $(INCLUDES) -L$(top_builddir)/gdk
INTROSPECTION_GIRS += GdkX11-3.0.gir
introspection_files += $(filter-out x11/gdkx.h, $(x11_introspection_files))
endif # USE_X11
girdir = $(datadir)/gir-1.0
+5 -2
View File
@@ -81,8 +81,11 @@ void gdk_set_program_class (const char *program_class);
/* Push and pop error handlers for X errors
*/
void gdk_error_trap_push (void);
gint gdk_error_trap_pop (void);
void gdk_error_trap_push (void);
/* warn unused because you could use pop_ignored otherwise */
G_GNUC_WARN_UNUSED_RESULT gint gdk_error_trap_pop (void);
void gdk_error_trap_pop_ignored (void);
gchar* gdk_get_display (void);
G_CONST_RETURN gchar* gdk_get_display_arg_name (void);
+5 -1
View File
@@ -109,8 +109,9 @@ gdk_device_manager_xi_get_type
#if IN_HEADER(__GDK_H__)
#if IN_FILE(__GDK_MAIN_X11_C__)
gdk_error_trap_pop
gdk_error_trap_push
gdk_error_trap_pop
gdk_error_trap_pop_ignored
gdk_get_display
#endif
#endif
@@ -1028,6 +1029,9 @@ gdk_x11_lookup_xdisplay
gdk_x11_display_broadcast_startup_message
gdk_x11_display_get_startup_notification_id
gdk_x11_register_standard_event_type
gdk_x11_display_error_trap_push
gdk_x11_display_error_trap_pop
gdk_x11_display_error_trap_pop_ignored
#endif
#if IN_FILE(__GDK_DRAWABLE_X11_C__)
+3 -2
View File
@@ -766,7 +766,7 @@ _gdk_device_set_associated_device (GdkDevice *device,
GdkDevicePrivate *priv;
g_return_if_fail (GDK_IS_DEVICE (device));
g_return_if_fail (GDK_IS_DEVICE (associated));
g_return_if_fail (associated == NULL || GDK_IS_DEVICE (associated));
priv = device->priv;
@@ -830,7 +830,8 @@ gdk_device_get_n_axes (GdkDevice *device)
* Returns a #GList of #GdkAtom<!-- -->s, containing the labels for
* the axes that @device currently has.
*
* Returns: A #GList of #GdkAtom<!-- -->s, free with g_list_free().
* Returns: (transfer container) (element-type GdkAtom):
* A #GList of #GdkAtom<!-- -->s, free with g_list_free().
*
* Since: 3.0
**/
+10 -4
View File
@@ -278,7 +278,7 @@ gdk_display_dispose (GObject *object)
_gdk_displays = g_slist_remove (_gdk_displays, object);
if (gdk_display_get_default() == display)
if (gdk_display_get_default () == display)
{
if (_gdk_displays)
gdk_display_manager_set_default_display (gdk_display_manager_get(),
@@ -289,7 +289,13 @@ gdk_display_dispose (GObject *object)
}
if (device_manager)
g_signal_handlers_disconnect_by_func (device_manager, device_removed_cb, object);
{
/* this is to make it drop devices which may require using the X
* display and therefore can't be cleaned up in finalize.
* It will also disconnect device_removed_cb
*/
g_object_run_dispose (G_OBJECT (display->device_manager));
}
G_OBJECT_CLASS (gdk_display_parent_class)->dispose (object);
}
@@ -623,7 +629,7 @@ gdk_event_send_clientmessage_toall (GdkEvent *event)
* Return value: the core pointer device; this is owned by the
* display and should not be freed.
*
* Deprecated: 3.0: Use gdk_display_get_client_pointer() instead, or
* Deprecated: 3.0: Use gdk_device_manager_get_client_pointer() instead, or
* gdk_event_get_device() if a #GdkEvent with pointer device
* information is available.
**/
@@ -644,7 +650,7 @@ gdk_device_get_core_pointer (void)
*
* Since: 2.2
*
* Deprecated: 3.0: Use gdk_display_get_client_pointer() instead, or
* Deprecated: 3.0: Use gdk_device_manager_get_client_pointer() instead, or
* gdk_event_get_device() if a #GdkEvent with device
* information is available.
**/
+1 -1
View File
@@ -99,7 +99,7 @@ gdk_drag_get_protocol (GdkNativeWindow xid,
*
* Retrieves the list of targets of the context.
*
* Return value: a #GList of targets
* Return value: (transfer none) (element-type GdkAtom): a #GList of targets
*
* Since: 2.22
**/
+6 -3
View File
@@ -540,7 +540,8 @@ gdk_event_free (GdkEvent *event)
case GDK_DRAG_STATUS:
case GDK_DROP_START:
case GDK_DROP_FINISHED:
g_object_unref (event->dnd.context);
if (event->dnd.context != NULL)
g_object_unref (event->dnd.context);
break;
case GDK_BUTTON_PRESS:
@@ -972,7 +973,7 @@ gdk_event_set_device (GdkEvent *event,
* If the event contains a "device" field, this function will return
* it, else it will return %NULL.
*
* Returns: a #GdkDevice, or %NULL.
* Returns: (transfer none): a #GdkDevice, or %NULL.
*
* Since: 3.0
**/
@@ -1033,13 +1034,15 @@ gdk_event_get_device (const GdkEvent *event)
{
GdkDisplay *display;
GdkDevice *core_pointer;
GdkDeviceManager *device_manager;
g_warning ("Event with type %d not holding a GdkDevice. "
"It is most likely synthesized outside Gdk/GTK+\n",
event->type);
display = gdk_drawable_get_display (event->any.window);
core_pointer = gdk_display_get_core_pointer (display);
device_manager = gdk_display_get_device_manager (display);
core_pointer = gdk_device_manager_get_client_pointer (device_manager);
if (event->type == GDK_KEY_PRESS ||
event->type == GDK_KEY_RELEASE)
-2
View File
@@ -33,8 +33,6 @@
guint _gdk_debug_flags = 0;
gint _gdk_error_code = 0;
gint _gdk_error_warnings = TRUE;
GList *_gdk_default_filters = NULL;
gchar *_gdk_display_name = NULL;
gint _gdk_screen_number = -1;
+2
View File
@@ -43,7 +43,9 @@ G_BEGIN_DECLS
/* Returns a list of GdkDevice * */
GList * gdk_devices_list (void);
#ifndef GTK_DISABLE_DEPRECATED
GdkDevice *gdk_device_get_core_pointer (void);
#endif
#endif /* GDK_MULTIHEAD_SAFE */
-2
View File
@@ -88,8 +88,6 @@ typedef enum {
extern GList *_gdk_default_filters;
extern GdkWindow *_gdk_parent_root;
extern gint _gdk_error_code;
extern gint _gdk_error_warnings;
extern guint _gdk_debug_flags;
extern gboolean _gdk_native_windows;
+2 -1
View File
@@ -37,7 +37,8 @@
*
* Call g_list_free() on the return value when you're finished with it.
*
* Return value: a list of visuals; the list must be freed, but not its contents
* Return value: (transfer container) (element-type GdkVisual):
* a list of visuals; the list must be freed, but not its contents
**/
GList*
gdk_list_visuals (void)
+10 -7
View File
@@ -2352,7 +2352,7 @@ gdk_window_get_position (GdkWindow *window,
* gdk_window_get_parent() will most likely not do what you expect if
* there are offscreen windows in the hierarchy.
*
* Return value: parent of @window
* Return value: (transfer none): parent of @window
**/
GdkWindow*
gdk_window_get_parent (GdkWindow *window)
@@ -2372,7 +2372,7 @@ gdk_window_get_parent (GdkWindow *window)
*
* See also: gdk_offscreen_window_get_embedder()
*
* Return value: effective parent of @window
* Return value: (transfer none): effective parent of @window
*
* Since: 2.22
**/
@@ -2406,7 +2406,7 @@ gdk_window_get_effective_parent (GdkWindow *window)
* gdk_window_get_toplevel() will most likely not do what you expect
* if there are offscreen windows in the hierarchy.
*
* Return value: the toplevel window containing @window
* Return value: (transfer none): the toplevel window containing @window
**/
GdkWindow *
gdk_window_get_toplevel (GdkWindow *window)
@@ -2438,7 +2438,7 @@ gdk_window_get_toplevel (GdkWindow *window)
*
* See also: gdk_offscreen_window_get_embedder()
*
* Return value: the effective toplevel window containing @window
* Return value: (transfer none): the effective toplevel window containing @window
*
* Since: 2.22
**/
@@ -2468,7 +2468,8 @@ gdk_window_get_effective_toplevel (GdkWindow *window)
* The returned list must be freed, but the elements in the
* list need not be.
*
* Return value: list of child windows inside @window
* Return value: (transfer container) (element-type GdkWindow):
* list of child windows inside @window
**/
GList*
gdk_window_get_children (GdkWindow *window)
@@ -2488,7 +2489,8 @@ gdk_window_get_children (GdkWindow *window)
* Like gdk_window_get_children(), but does not copy the list of
* children, so the list does not need to be freed.
*
* Return value: a reference to the list of child windows in @window
* Return value: (transfer none) (element-type GdkWindow):
* a reference to the list of child windows in @window
**/
GList *
gdk_window_peek_children (GdkWindow *window)
@@ -2617,7 +2619,8 @@ gdk_window_remove_filter (GdkWindow *window,
* The returned list should be freed with g_list_free(), but
* its elements need not be freed.
*
* Return value: list of toplevel windows, free with g_list_free()
* Return value: (transfer container) (element-type GdkWindow):
* list of toplevel windows, free with g_list_free()
*
* Since: 2.2
**/
+3 -1
View File
@@ -454,6 +454,7 @@ update_context_from_dragging_info (id <NSDraggingInfo> sender)
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
{
GdkDeviceManager device_manager;
GdkEvent *event;
GdkWindow *window;
@@ -465,8 +466,9 @@ update_context_from_dragging_info (id <NSDraggingInfo> sender)
window = [[self contentView] gdkWindow];
device_manager = gdk_display_get_device_manager (gdk_display_get_default ());
gdk_drag_context_set_device (current_context,
gdk_display_get_core_pointer (gdk_display_get_default ()));
gdk_device_manager_get_client_pointer (device_manager));
event = gdk_event_new (GDK_DRAG_ENTER);
event->dnd.window = g_object_ref (window);
+5 -2
View File
@@ -149,15 +149,18 @@ GdkDragContext *
gdk_drag_begin (GdkWindow *window,
GList *targets)
{
GdkDeviceManager *device_manager;
g_assert (_gdk_quartz_drag_source_context == NULL);
/* Create fake context */
_gdk_quartz_drag_source_context = gdk_drag_context_new ();
_gdk_quartz_drag_source_context->is_source = TRUE;
device_manager = gdk_display_get_device_manager (gdk_display_get_default ());
gdk_drag_context_set_device (_gdk_quartz_drag_source_context,
gdk_display_get_core_pointer (gdk_display_get_default ()));
gdk_device_manager_get_client_pointer (device_manager));
return _gdk_quartz_drag_source_context;
}
+14 -14
View File
@@ -952,7 +952,7 @@ fill_key_event (GdkWindow *window,
event->key.state = get_keyboard_modifiers_from_ns_event (nsevent);
event->key.hardware_keycode = [nsevent keyCode];
event->key.group = ([nsevent modifierFlags] & NSAlternateKeyMask) ? 1 : 0;
event->key.keyval = GDK_VoidSymbol;
event->key.keyval = GDK_KEY_VoidSymbol;
device_manager = GDK_DEVICE_MANAGER_CORE (_gdk_display->device_manager);
gdk_event_set_device (event, device_manager->core_keyboard);
@@ -976,23 +976,23 @@ fill_key_event (GdkWindow *window,
switch (event->key.keyval)
{
case GDK_Meta_R:
case GDK_Meta_L:
case GDK_KEY_Meta_R:
case GDK_KEY_Meta_L:
mask = GDK_MOD1_MASK;
break;
case GDK_Shift_R:
case GDK_Shift_L:
case GDK_KEY_Shift_R:
case GDK_KEY_Shift_L:
mask = GDK_SHIFT_MASK;
break;
case GDK_Caps_Lock:
case GDK_KEY_Caps_Lock:
mask = GDK_LOCK_MASK;
break;
case GDK_Alt_R:
case GDK_Alt_L:
case GDK_KEY_Alt_R:
case GDK_KEY_Alt_L:
mask = GDK_MOD5_MASK;
break;
case GDK_Control_R:
case GDK_Control_L:
case GDK_KEY_Control_R:
case GDK_KEY_Control_L:
mask = GDK_CONTROL_MASK;
break;
default:
@@ -1010,7 +1010,7 @@ fill_key_event (GdkWindow *window,
event->key.string = NULL;
/* Fill in ->string since apps depend on it, taken from the x11 backend. */
if (event->key.keyval != GDK_VoidSymbol)
if (event->key.keyval != GDK_KEY_VoidSymbol)
c = gdk_keyval_to_unicode (event->key.keyval);
if (c)
@@ -1027,13 +1027,13 @@ fill_key_event (GdkWindow *window,
if (event->key.string)
event->key.length = bytes_written;
}
else if (event->key.keyval == GDK_Escape)
else if (event->key.keyval == GDK_KEY_Escape)
{
event->key.length = 1;
event->key.string = g_strdup ("\033");
}
else if (event->key.keyval == GDK_Return ||
event->key.keyval == GDK_KP_Enter)
else if (event->key.keyval == GDK_KEY_Return ||
event->key.keyval == GDK_KEY_KP_Enter)
{
event->key.length = 1;
event->key.string = g_strdup ("\r");
+58 -58
View File
@@ -114,54 +114,54 @@ const static struct {
guint keyval;
unsigned int modmask; /* So we can tell when a mod key is pressed/released */
} known_keys[] = {
{ 54, GDK_Meta_R, NSCommandKeyMask },
{ 55, GDK_Meta_L, NSCommandKeyMask },
{ 56, GDK_Shift_L, NSShiftKeyMask },
{ 57, GDK_Caps_Lock, NSAlphaShiftKeyMask },
{ 58, GDK_Alt_L, NSAlternateKeyMask },
{ 59, GDK_Control_L, NSControlKeyMask },
{ 60, GDK_Shift_R, NSShiftKeyMask },
{ 61, GDK_Alt_R, NSAlternateKeyMask },
{ 62, GDK_Control_R, NSControlKeyMask },
{ 122, GDK_F1, 0 },
{ 120, GDK_F2, 0 },
{ 99, GDK_F3, 0 },
{ 118, GDK_F4, 0 },
{ 96, GDK_F5, 0 },
{ 97, GDK_F6, 0 },
{ 98, GDK_F7, 0 },
{ 100, GDK_F8, 0 },
{ 101, GDK_F9, 0 },
{ 109, GDK_F10, 0 },
{ 103, GDK_F11, 0 },
{ 111, GDK_F12, 0 },
{ 105, GDK_F13, 0 },
{ 107, GDK_F14, 0 },
{ 113, GDK_F15, 0 },
{ 106, GDK_F16, 0 }
{ 54, GDK_KEY_Meta_R, NSCommandKeyMask },
{ 55, GDK_KEY_Meta_L, NSCommandKeyMask },
{ 56, GDK_KEY_Shift_L, NSShiftKeyMask },
{ 57, GDK_KEY_Caps_Lock, NSAlphaShiftKeyMask },
{ 58, GDK_KEY_Alt_L, NSAlternateKeyMask },
{ 59, GDK_KEY_Control_L, NSControlKeyMask },
{ 60, GDK_KEY_Shift_R, NSShiftKeyMask },
{ 61, GDK_KEY_Alt_R, NSAlternateKeyMask },
{ 62, GDK_KEY_Control_R, NSControlKeyMask },
{ 122, GDK_KEY_F1, 0 },
{ 120, GDK_KEY_F2, 0 },
{ 99, GDK_KEY_F3, 0 },
{ 118, GDK_KEY_F4, 0 },
{ 96, GDK_KEY_F5, 0 },
{ 97, GDK_KEY_F6, 0 },
{ 98, GDK_KEY_F7, 0 },
{ 100, GDK_KEY_F8, 0 },
{ 101, GDK_KEY_F9, 0 },
{ 109, GDK_KEY_F10, 0 },
{ 103, GDK_KEY_F11, 0 },
{ 111, GDK_KEY_F12, 0 },
{ 105, GDK_KEY_F13, 0 },
{ 107, GDK_KEY_F14, 0 },
{ 113, GDK_KEY_F15, 0 },
{ 106, GDK_KEY_F16, 0 }
};
const static struct {
guint keycode;
guint normal_keyval, keypad_keyval;
} known_numeric_keys[] = {
{ 65, GDK_period, GDK_KP_Decimal },
{ 67, GDK_asterisk, GDK_KP_Multiply },
{ 69, GDK_plus, GDK_KP_Add },
{ 75, GDK_slash, GDK_KP_Divide },
{ 76, 0x01000003, GDK_KP_Enter },
{ 78, GDK_minus, GDK_KP_Subtract },
{ 81, GDK_equal, GDK_KP_Equal },
{ 82, GDK_0, GDK_KP_0 },
{ 83, GDK_1, GDK_KP_1 },
{ 84, GDK_2, GDK_KP_2 },
{ 85, GDK_3, GDK_KP_3 },
{ 86, GDK_4, GDK_KP_4 },
{ 87, GDK_5, GDK_KP_5 },
{ 88, GDK_6, GDK_KP_6 },
{ 89, GDK_7, GDK_KP_7 },
{ 91, GDK_8, GDK_KP_8 },
{ 92, GDK_9, GDK_KP_9 }
{ 65, GDK_KEY_period, GDK_KEY_KP_Decimal },
{ 67, GDK_KEY_asterisk, GDK_KEY_KP_Multiply },
{ 69, GDK_KEY_plus, GDK_KEY_KP_Add },
{ 75, GDK_KEY_slash, GDK_KEY_KP_Divide },
{ 76, 0x01000003, GDK_KEY_KP_Enter },
{ 78, GDK_KEY_minus, GDK_KEY_KP_Subtract },
{ 81, GDK_KEY_equal, GDK_KEY_KP_Equal },
{ 82, GDK_KEY_0, GDK_KEY_KP_0 },
{ 83, GDK_KEY_1, GDK_KEY_KP_1 },
{ 84, GDK_KEY_2, GDK_KEY_KP_2 },
{ 85, GDK_KEY_3, GDK_KEY_KP_3 },
{ 86, GDK_KEY_4, GDK_KEY_KP_4 },
{ 87, GDK_KEY_5, GDK_KEY_KP_5 },
{ 88, GDK_KEY_6, GDK_KEY_KP_6 },
{ 89, GDK_KEY_7, GDK_KEY_KP_7 },
{ 91, GDK_KEY_8, GDK_KEY_KP_8 },
{ 92, GDK_KEY_9, GDK_KEY_KP_9 }
};
/* These values aren't covered by gdk_unicode_to_keyval */
@@ -169,20 +169,20 @@ const static struct {
gunichar ucs_value;
guint keyval;
} special_ucs_table [] = {
{ 0x0001, GDK_Home },
{ 0x0003, GDK_Return },
{ 0x0004, GDK_End },
{ 0x0008, GDK_BackSpace },
{ 0x0009, GDK_Tab },
{ 0x000b, GDK_Page_Up },
{ 0x000c, GDK_Page_Down },
{ 0x000d, GDK_Return },
{ 0x001b, GDK_Escape },
{ 0x001c, GDK_Left },
{ 0x001d, GDK_Right },
{ 0x001e, GDK_Up },
{ 0x001f, GDK_Down },
{ 0x007f, GDK_Delete }
{ 0x0001, GDK_KEY_Home },
{ 0x0003, GDK_KEY_Return },
{ 0x0004, GDK_KEY_End },
{ 0x0008, GDK_KEY_BackSpace },
{ 0x0009, GDK_KEY_Tab },
{ 0x000b, GDK_KEY_Page_Up },
{ 0x000c, GDK_KEY_Page_Down },
{ 0x000d, GDK_KEY_Return },
{ 0x001b, GDK_KEY_Escape },
{ 0x001c, GDK_KEY_Left },
{ 0x001d, GDK_KEY_Right },
{ 0x001e, GDK_KEY_Up },
{ 0x001f, GDK_KEY_Down },
{ 0x007f, GDK_KEY_Delete }
};
static void
@@ -361,8 +361,8 @@ maybe_update_keymap (void)
/* Special-case shift-tab since GTK+ expects
* GDK_ISO_Left_Tab for that.
*/
if (found && p[j] == GDK_Tab && modifiers[j] == shiftKey)
p[j] = GDK_ISO_Left_Tab;
if (found && p[j] == GDK_KEY_Tab && modifiers[j] == shiftKey)
p[j] = GDK_KEY_ISO_Left_Tab;
if (!found)
{
+5
View File
@@ -56,6 +56,11 @@ gdk_error_trap_pop (void)
return 0;
}
void
gdk_error_trap_pop_ignored (void)
{
}
gchar *
gdk_get_display (void)
{
+14 -5
View File
@@ -1212,6 +1212,7 @@ target_context_new (GdkWindow *window)
target_drag_context *result;
GdkDragContextPrivateWin32 *private;
GdkDevice *device;
GdkDeviceManager device_manager;
result = g_new0 (target_drag_context, 1);
@@ -1221,7 +1222,8 @@ target_context_new (GdkWindow *window)
result->context->protocol = GDK_DRAG_PROTO_OLE2;
result->context->is_source = FALSE;
device = gdk_display_get_core_pointer (_gdk_display);
device_manager = gdk_display_get_device_manager (_gtk_display);
device = gdk_device_manager_get_client_pointer (device_manager);
gdk_drag_context_set_device (result->context, device);
result->context->source_window = NULL;
@@ -1260,7 +1262,8 @@ source_context_new (GdkWindow *window,
result->context->protocol = GDK_DRAG_PROTO_OLE2;
result->context->is_source = TRUE;
device = gdk_display_get_core_pointer (_gdk_display);
device_manager = gdk_display_get_device_manager (_gtk_display);
device = gdk_device_manager_get_client_pointer (device_manager);
gdk_drag_context_set_device (result->context, device);
result->context->source_window = window;
@@ -1475,6 +1478,7 @@ gdk_dropfiles_filter (GdkXEvent *xev,
gint nfiles, i;
gchar *fileName, *linkedFile;
GdkDevice *device;
GdkDeviceManager *device_manager;
if (msg->message == WM_DROPFILES)
{
@@ -1484,7 +1488,8 @@ gdk_dropfiles_filter (GdkXEvent *xev,
context->protocol = GDK_DRAG_PROTO_WIN32_DROPFILES;
context->is_source = FALSE;
device = gdk_display_get_core_pointer (_gdk_display);
device_manager = gdk_display_get_device_manager (_gtk_display);
device = gdk_device_manager_get_client_pointer (device_manager);
gdk_drag_context_set_device (context, device);
context->source_window = _gdk_root;
@@ -1701,6 +1706,7 @@ local_send_enter (GdkDragContext *context,
GdkDragContextPrivateWin32 *private;
GdkDragContext *new_context;
GdkDevice *device;
GdkDeviceManager *device_manager;
GDK_NOTE (DND, g_print ("local_send_enter: context=%p current_dest_drag=%p\n",
context,
@@ -1718,7 +1724,8 @@ local_send_enter (GdkDragContext *context,
new_context->protocol = GDK_DRAG_PROTO_LOCAL;
new_context->is_source = FALSE;
device = gdk_display_get_core_pointer (_gdk_display);
device_manager = gdk_display_get_device_manager (_gtk_display);
device = gdk_device_manager_get_client_pointer (device_manager);
gdk_drag_context_set_device (new_context, device);
new_context->source_window = context->source_window;
@@ -1852,12 +1859,14 @@ gdk_drag_begin (GdkWindow *window,
{
GdkDragContext *new_context;
GdkDevice *device;
GdkDeviceManager device_manager;
g_return_val_if_fail (window != NULL, NULL);
new_context = gdk_drag_context_new ();
device = gdk_display_get_core_pointer (_gdk_display);
device_manager = gdk_display_get_device_manager (_gtk_display);
device = gdk_device_manager_get_client_pointer (device_manager);
gdk_drag_context_set_device (new_context, device);
new_context->is_source = TRUE;
+5
View File
@@ -214,6 +214,11 @@ gdk_error_trap_pop (void)
return 0;
}
void
gdk_error_trap_pop_ignored (void)
{
}
void
gdk_notify_startup_complete (void)
{
+1 -1
View File
@@ -655,7 +655,7 @@ _gdk_x11_get_window_child_info (GdkDisplay *display,
win_has_wm_state ? wm_state_atom : None,
&has_wm_state,
&state.children, &state.nchildren);
gdk_error_trap_pop ();
gdk_error_trap_pop_ignored ();
if (!result)
{
g_free (state.children);
+12 -4
View File
@@ -53,6 +53,8 @@ _gdk_device_manager_new (GdkDisplay *display)
{
GdkDeviceManagerXI2 *device_manager_xi2;
GDK_NOTE (INPUT, g_print ("Creating XI2 device manager\n"));
device_manager_xi2 = g_object_new (GDK_TYPE_DEVICE_MANAGER_XI2,
"display", display,
NULL);
@@ -62,14 +64,20 @@ _gdk_device_manager_new (GdkDisplay *display)
}
else
#endif /* XINPUT_2 */
return g_object_new (GDK_TYPE_DEVICE_MANAGER_XI,
"display", display,
"event-base", firstevent,
NULL);
{
GDK_NOTE (INPUT, g_print ("Creating XI device manager\n"));
return g_object_new (GDK_TYPE_DEVICE_MANAGER_XI,
"display", display,
"event-base", firstevent,
NULL);
}
}
#endif /* XINPUT_2 || XINPUT_XFREE */
}
GDK_NOTE (INPUT, g_print ("Creating core device manager\n"));
return g_object_new (GDK_TYPE_DEVICE_MANAGER_CORE,
"display", display,
NULL);
+11 -6
View File
@@ -37,7 +37,7 @@ struct _GdkDeviceManagerXIPrivate
};
static void gdk_device_manager_xi_constructed (GObject *object);
static void gdk_device_manager_xi_finalize (GObject *object);
static void gdk_device_manager_xi_dispose (GObject *object);
static void gdk_device_manager_xi_set_property (GObject *object,
guint prop_id,
const GValue *value,
@@ -72,7 +72,7 @@ gdk_device_manager_xi_class_init (GdkDeviceManagerXIClass *klass)
GdkDeviceManagerClass *device_manager_class = GDK_DEVICE_MANAGER_CLASS (klass);
object_class->constructed = gdk_device_manager_xi_constructed;
object_class->finalize = gdk_device_manager_xi_finalize;
object_class->dispose = gdk_device_manager_xi_dispose;
object_class->set_property = gdk_device_manager_xi_set_property;
object_class->get_property = gdk_device_manager_xi_get_property;
@@ -279,7 +279,7 @@ gdk_device_manager_xi_constructed (GObject *object)
priv->devices = g_list_prepend (priv->devices, device);
g_hash_table_insert (priv->id_table,
GINT_TO_POINTER (devices[i].id),
device);
g_object_ref (device));
}
}
@@ -294,7 +294,7 @@ gdk_device_manager_xi_constructed (GObject *object)
}
static void
gdk_device_manager_xi_finalize (GObject *object)
gdk_device_manager_xi_dispose (GObject *object)
{
GdkDeviceManagerXIPrivate *priv;
@@ -302,12 +302,17 @@ gdk_device_manager_xi_finalize (GObject *object)
g_list_foreach (priv->devices, (GFunc) g_object_unref, NULL);
g_list_free (priv->devices);
priv->devices = NULL;
g_hash_table_destroy (priv->id_table);
if (priv->id_table != NULL)
{
g_hash_table_destroy (priv->id_table);
priv->id_table = NULL;
}
gdk_window_remove_filter (NULL, window_input_info_filter, object);
G_OBJECT_CLASS (gdk_device_manager_xi_parent_class)->finalize (object);
G_OBJECT_CLASS (gdk_device_manager_xi_parent_class)->dispose (object);
}
static void
+13 -6
View File
@@ -33,7 +33,7 @@
static void gdk_device_manager_xi2_constructed (GObject *object);
static void gdk_device_manager_xi2_finalize (GObject *object);
static void gdk_device_manager_xi2_dispose (GObject *object);
static GList * gdk_device_manager_xi2_list_devices (GdkDeviceManager *device_manager,
GdkDeviceType type);
@@ -63,7 +63,7 @@ gdk_device_manager_xi2_class_init (GdkDeviceManagerXI2Class *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->constructed = gdk_device_manager_xi2_constructed;
object_class->finalize = gdk_device_manager_xi2_finalize;
object_class->dispose = gdk_device_manager_xi2_dispose;
device_manager_class->list_devices = gdk_device_manager_xi2_list_devices;
device_manager_class->get_client_pointer = gdk_device_manager_xi2_get_client_pointer;
@@ -258,7 +258,7 @@ add_device (GdkDeviceManagerXI2 *device_manager,
g_hash_table_replace (device_manager->id_table,
GINT_TO_POINTER (dev->deviceid),
device);
g_object_ref (device));
if (dev->use == XIMasterPointer || dev->use == XIMasterKeyboard)
device_manager->master_devices = g_list_append (device_manager->master_devices, device);
@@ -373,7 +373,7 @@ gdk_device_manager_xi2_constructed (GObject *object)
}
static void
gdk_device_manager_xi2_finalize (GObject *object)
gdk_device_manager_xi2_dispose (GObject *object)
{
GdkDeviceManagerXI2 *device_manager_xi2;
@@ -381,16 +381,23 @@ gdk_device_manager_xi2_finalize (GObject *object)
g_list_foreach (device_manager_xi2->master_devices, (GFunc) g_object_unref, NULL);
g_list_free (device_manager_xi2->master_devices);
device_manager_xi2->master_devices = NULL;
g_list_foreach (device_manager_xi2->slave_devices, (GFunc) g_object_unref, NULL);
g_list_free (device_manager_xi2->slave_devices);
device_manager_xi2->slave_devices = NULL;
g_list_foreach (device_manager_xi2->floating_devices, (GFunc) g_object_unref, NULL);
g_list_free (device_manager_xi2->floating_devices);
device_manager_xi2->floating_devices = NULL;
g_hash_table_destroy (device_manager_xi2->id_table);
if (device_manager_xi2->id_table)
{
g_hash_table_destroy (device_manager_xi2->id_table);
device_manager_xi2->id_table = NULL;
}
G_OBJECT_CLASS (gdk_device_manager_xi2_parent_class)->finalize (object);
G_OBJECT_CLASS (gdk_device_manager_xi2_parent_class)->dispose (object);
}
static GList *
+292 -10
View File
@@ -24,6 +24,7 @@
#include "config.h"
#include <glib/gprintf.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
@@ -67,6 +68,23 @@
#include <X11/extensions/Xrandr.h>
#endif
typedef struct _GdkErrorTrap GdkErrorTrap;
struct _GdkErrorTrap
{
/* Next sequence when trap was pushed, i.e. first sequence to
* ignore
*/
gulong start_sequence;
/* Next sequence when trap was popped, i.e. first sequence
* to not ignore. 0 if trap is still active.
*/
gulong end_sequence;
/* Most recent error code within the sequence */
int error_code;
};
static void gdk_display_x11_dispose (GObject *object);
static void gdk_display_x11_finalize (GObject *object);
@@ -247,7 +265,7 @@ gdk_check_wm_desktop_changed (GdkWindow *window)
0, G_MAXLONG, False, XA_CARDINAL, &type,
&format, &nitems,
&bytes_after, &data);
gdk_error_trap_pop ();
gdk_error_trap_pop_ignored ();
if (type != None)
{
@@ -288,7 +306,7 @@ gdk_check_wm_state_changed (GdkWindow *window)
gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE"),
0, G_MAXLONG, False, XA_ATOM, &type, &format, &nitems,
&bytes_after, &data);
gdk_error_trap_pop ();
gdk_error_trap_pop_ignored ();
if (type != None)
{
@@ -717,7 +735,7 @@ gdk_display_x11_translate_event (GdkEventTranslator *translator,
event->configure.x = tx;
event->configure.y = ty;
}
gdk_error_trap_pop ();
gdk_error_trap_pop_ignored ();
}
else
{
@@ -1136,7 +1154,8 @@ _gdk_input_init (GdkDisplay *display)
if (device->source == GDK_SOURCE_KEYBOARD)
continue;
display_x11->input_devices = g_list_prepend (display_x11->input_devices, l->data);
display_x11->input_devices = g_list_prepend (display_x11->input_devices,
g_object_ref (l->data));
}
g_list_free (list);
@@ -1158,7 +1177,8 @@ _gdk_input_init (GdkDisplay *display)
}
/* Add the core pointer to the devices list */
display_x11->input_devices = g_list_prepend (display_x11->input_devices, display->core_pointer);
display_x11->input_devices = g_list_prepend (display_x11->input_devices,
g_object_ref (display->core_pointer));
g_list_free (list);
}
@@ -1327,7 +1347,6 @@ gdk_display_open (const gchar *display_name)
XQueryPointer (display_x11->xdisplay,
GDK_SCREEN_X11 (display_x11->default_screen)->xroot_window,
&root, &child, &rootx, &rooty, &winx, &winy, &xmask);
gdk_flush ();
if (G_UNLIKELY (gdk_error_trap_pop () == BadWindow))
{
g_warning ("Connection to display %s appears to be untrusted. Pointer and keyboard grabs and inter-client communication may not work as expected.", gdk_display_get_name (display));
@@ -1431,8 +1450,7 @@ gdk_display_open (const gchar *display_name)
_gdk_x11_screen_setup (display_x11->screens[i]);
g_signal_emit_by_name (display, "opened");
g_signal_emit_by_name (gdk_display_manager_get(),
"display_opened", display);
g_signal_emit_by_name (gdk_display_manager_get (), "display-opened", display);
return display;
}
@@ -1892,6 +1910,21 @@ gdk_display_x11_finalize (GObject *object)
XCloseDisplay (display_x11->xdisplay);
/* error traps */
while (display_x11->error_traps != NULL)
{
GdkErrorTrap *trap = display_x11->error_traps->data;
display_x11->error_traps =
g_slist_delete_link (display_x11->error_traps,
display_x11->error_traps);
if (trap->end_sequence == 0)
g_warning ("Display finalized with an unpopped error trap");
g_slice_free (GdkErrorTrap, trap);
}
G_OBJECT_CLASS (_gdk_display_x11_parent_class)->finalize (object);
}
@@ -2379,7 +2412,7 @@ gdk_display_store_clipboard (GdkDisplay *display,
GDK_WINDOW_XID (clipboard_window), time_);
}
gdk_error_trap_pop ();
gdk_error_trap_pop_ignored ();
}
@@ -2484,7 +2517,8 @@ gdk_display_supports_composite (GdkDisplay *display)
* Returns the list of available input devices attached to @display.
* The list is statically allocated and should not be freed.
*
* Return value: a list of #GdkDevice
* Return value: (transfer none) (element-type GdkDevice):
* a list of #GdkDevice
*
* Since: 2.2
*
@@ -2656,3 +2690,251 @@ gdk_x11_register_standard_event_type (GdkDisplay *display,
display_x11->event_types = g_slist_prepend (display_x11->event_types, event_type);
}
/* compare X sequence numbers handling wraparound */
#define SEQUENCE_COMPARE(a,op,b) (((long) (a) - (long) (b)) op 0)
/* delivers an error event from the error handler in gdkmain-x11.c */
void
_gdk_x11_display_error_event (GdkDisplay *display,
XErrorEvent *error)
{
GdkDisplayX11 *display_x11;
GSList *tmp_list;
gboolean ignore;
display_x11 = GDK_DISPLAY_X11 (display);
ignore = FALSE;
for (tmp_list = display_x11->error_traps;
tmp_list != NULL;
tmp_list = tmp_list->next)
{
GdkErrorTrap *trap;
trap = tmp_list->data;
if (SEQUENCE_COMPARE (trap->start_sequence, <=, error->serial) &&
(trap->end_sequence == 0 ||
SEQUENCE_COMPARE (trap->end_sequence, >, error->serial)))
{
ignore = TRUE;
trap->error_code = error->error_code;
break; /* only innermost trap gets the error code */
}
}
if (!ignore)
{
gchar buf[64];
gchar *msg;
XGetErrorText (display_x11->xdisplay, error->error_code, buf, 63);
msg =
g_strdup_printf ("The program '%s' received an X Window System error.\n"
"This probably reflects a bug in the program.\n"
"The error was '%s'.\n"
" (Details: serial %ld error_code %d request_code %d minor_code %d)\n"
" (Note to programmers: normally, X errors are reported asynchronously;\n"
" that is, you will receive the error a while after causing it.\n"
" To debug your program, run it with the --sync command line\n"
" option to change this behavior. You can then get a meaningful\n"
" backtrace from your debugger if you break on the gdk_x_error() function.)",
g_get_prgname (),
buf,
error->serial,
error->error_code,
error->request_code,
error->minor_code);
#ifdef G_ENABLE_DEBUG
g_error ("%s", msg);
#else /* !G_ENABLE_DEBUG */
g_warning ("%s\n", msg);
exit (1);
#endif /* G_ENABLE_DEBUG */
}
}
static void
delete_outdated_error_traps (GdkDisplayX11 *display_x11)
{
GSList *tmp_list;
gulong processed_sequence;
processed_sequence = XLastKnownRequestProcessed (display_x11->xdisplay);
tmp_list = display_x11->error_traps;
while (tmp_list != NULL)
{
GdkErrorTrap *trap = tmp_list->data;
if (trap->end_sequence != 0 &&
SEQUENCE_COMPARE (trap->end_sequence, <=, processed_sequence))
{
GSList *free_me = tmp_list;
tmp_list = tmp_list->next;
display_x11->error_traps =
g_slist_delete_link (display_x11->error_traps, free_me);
g_slice_free (GdkErrorTrap, trap);
}
else
{
tmp_list = tmp_list->next;
}
}
}
/**
* gdk_x11_display_error_trap_push:
*
* Begins a range of X requests for which X error events will be
* ignored. Unignored errors (when no trap is pushed) will abort the
* application.
*
* See also gdk_error_trap_push() to push a trap on all displays.
*
* Since: 3.0
*/
void
gdk_x11_display_error_trap_push (GdkDisplay *display)
{
GdkDisplayX11 *display_x11;
GdkErrorTrap *trap;
display_x11 = GDK_DISPLAY_X11 (display);
delete_outdated_error_traps (display_x11);
/* set up the Xlib callback to tell us about errors */
_gdk_x11_error_handler_push ();
trap = g_slice_new0 (GdkErrorTrap);
trap->start_sequence = XNextRequest (display_x11->xdisplay);
trap->error_code = Success;
display_x11->error_traps =
g_slist_prepend (display_x11->error_traps, trap);
}
static gint
gdk_x11_display_error_trap_pop_internal (GdkDisplay *display,
gboolean need_code)
{
GdkDisplayX11 *display_x11;
GdkErrorTrap *trap;
GSList *tmp_list;
int result;
display_x11 = GDK_DISPLAY_X11 (display);
g_return_val_if_fail (display_x11->error_traps != NULL, Success);
/* Find the first trap that hasn't been popped already */
trap = NULL; /* quiet gcc */
for (tmp_list = display_x11->error_traps;
tmp_list != NULL;
tmp_list = tmp_list->next)
{
trap = tmp_list->data;
if (trap->end_sequence == 0)
break;
}
g_return_val_if_fail (trap != NULL, Success);
g_assert (trap->end_sequence == 0);
/* May need to sync to fill in trap->error_code if we care about
* getting an error code.
*/
if (need_code)
{
gulong processed_sequence;
gulong next_sequence;
next_sequence = XNextRequest (display_x11->xdisplay);
processed_sequence = XLastKnownRequestProcessed (display_x11->xdisplay);
/* If our last request was already processed, there is no point
* in syncing. i.e. if last request was a round trip (or even if
* we got an event with the serial of a non-round-trip)
*/
if ((next_sequence - 1) != processed_sequence)
{
XSync (display_x11->xdisplay, False);
}
result = trap->error_code;
}
else
{
result = Success;
}
/* record end of trap, giving us a range of
* error sequences we'll ignore.
*/
trap->end_sequence = XNextRequest (display_x11->xdisplay);
/* remove the Xlib callback */
_gdk_x11_error_handler_pop ();
/* we may already be outdated */
delete_outdated_error_traps (display_x11);
return result;
}
/**
* gdk_x11_display_error_trap_pop:
* @display: the display
*
* Pops the error trap pushed by gdk_x11_display_error_trap_push().
* Will XSync() if necessary and will always block until
* the error is known to have occurred or not occurred,
* so the error code can be returned.
*
* If you don't need to use the return value,
* gdk_x11_display_error_trap_pop_ignored() would be more efficient.
*
* See gdk_error_trap_pop() for the all-displays-at-once
* equivalent.
*
* Since: 3.0
*
* Return value: X error code or 0 on success
*/
gint
gdk_x11_display_error_trap_pop (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY_X11 (display), Success);
return gdk_x11_display_error_trap_pop_internal (display, TRUE);
}
/**
* gdk_x11_display_error_trap_pop_ignored:
* @display: the display
*
* Pops the error trap pushed by gdk_x11_display_error_trap_push().
* Does not block to see if an error occurred; merely records the
* range of requests to ignore errors for, and ignores those errors
* if they arrive asynchronously.
*
* See gdk_error_trap_pop_ignored() for the all-displays-at-once
* equivalent.
*
* Since: 3.0
*/
void
gdk_x11_display_error_trap_pop_ignored (GdkDisplay *display)
{
g_return_if_fail (GDK_IS_DISPLAY_X11 (display));
gdk_x11_display_error_trap_pop_internal (display, FALSE);
}
+6 -2
View File
@@ -141,6 +141,8 @@ struct _GdkDisplayX11
/* The offscreen window that has the pointer in it (if any) */
GdkWindow *active_offscreen_window;
GSList *error_traps;
};
struct _GdkDisplayX11Class
@@ -149,8 +151,10 @@ struct _GdkDisplayX11Class
};
GType _gdk_display_x11_get_type (void);
GdkScreen *_gdk_x11_display_screen_for_xrootwin (GdkDisplay *display,
Window xrootwin);
GdkScreen *_gdk_x11_display_screen_for_xrootwin (GdkDisplay *display,
Window xrootwin);
void _gdk_x11_display_error_event (GdkDisplay *display,
XErrorEvent *error);
G_END_DECLS
+33 -12
View File
@@ -30,6 +30,7 @@
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <X11/extensions/shape.h>
#include <X11/extensions/Xcomposite.h>
#include <string.h>
@@ -537,6 +538,7 @@ gdk_window_cache_new (GdkScreen *screen)
GdkWindow *root_window = gdk_screen_get_root_window (screen);
GdkChildInfoX11 *children;
guint nchildren, i;
Window cow;
GdkWindowCache *result = g_new (GdkWindowCache, 1);
@@ -585,6 +587,22 @@ gdk_window_cache_new (GdkScreen *screen)
g_free (children);
#ifdef HAVE_XCOMPOSITE
/*
* Add the composite overlay window to the cache, as this can be a reasonable
* Xdnd proxy as well.
* This is only done when the screen is composited in order to avoid mapping
* the COW. We assume that the CM is using the COW (which is true for pretty
* much any CM currently in use).
*/
if (gdk_screen_is_composited (screen))
{
cow = XCompositeGetOverlayWindow (xdisplay, GDK_WINDOW_XWINDOW (root_window));
gdk_window_cache_add (result, cow, 0, 0, gdk_screen_get_width (screen), gdk_screen_get_height (screen), TRUE);
XCompositeReleaseOverlayWindow (xdisplay, GDK_WINDOW_XWINDOW (root_window));
}
#endif
return result;
}
@@ -604,8 +622,7 @@ gdk_window_cache_destroy (GdkWindowCache *cache)
g_list_foreach (cache->children, (GFunc)free_cache_child,
gdk_screen_get_display (cache->screen));
gdk_flush ();
gdk_error_trap_pop ();
gdk_error_trap_pop_ignored ();
g_list_free (cache->children);
g_hash_table_destroy (cache->child_hash);
@@ -751,7 +768,7 @@ get_client_window_at_coords (GdkWindowCache *cache,
tmp_list = tmp_list->next;
}
gdk_error_trap_pop ();
gdk_error_trap_pop_ignored ();
if (retval)
return retval;
@@ -2608,7 +2625,7 @@ xdnd_check_dest (GdkDisplay *display,
}
}
gdk_error_trap_pop ();
gdk_error_trap_pop_ignored ();
return retval ? (proxy ? proxy : win) : None;
}
@@ -2675,7 +2692,7 @@ xdnd_read_actions (GdkDragContext *context)
if (data)
XFree (data);
gdk_error_trap_pop ();
gdk_error_trap_pop_ignored ();
}
else
{
@@ -2749,8 +2766,7 @@ xdnd_manage_source_filter (GdkDragContext *context,
*/
}
gdk_display_sync (gdk_drawable_get_display (window));
gdk_error_trap_pop ();
gdk_error_trap_pop_ignored ();
}
}
@@ -2812,6 +2828,7 @@ xdnd_enter_filter (GdkXEvent *xev,
GdkEvent *event,
gpointer cb_data)
{
GdkDeviceManager *device_manager;
GdkDisplay *display;
GdkDisplayX11 *display_x11;
XEvent *xevent = (XEvent *)xev;
@@ -2863,7 +2880,8 @@ xdnd_enter_filter (GdkXEvent *xev,
PRIVATE_DATA(new_context)->version = version;
/* FIXME: Should extend DnD protocol to have device info */
gdk_drag_context_set_device (new_context, gdk_display_get_core_pointer (display));
device_manager = gdk_display_get_device_manager (display);
gdk_drag_context_set_device (new_context, gdk_device_manager_get_client_pointer (device_manager));
new_context->source_window = gdk_window_lookup_for_display (display, source_window);
if (new_context->source_window)
@@ -3136,7 +3154,8 @@ gdk_drag_do_leave (GdkDragContext *context, guint32 time)
/**
* gdk_drag_begin:
* @window: the source window for this drag.
* @targets: the offered targets, as list of #GdkAtom<!-- -->s
* @targets: (transfer none) (element-type GdkAtom): the offered targets,
* as list of #GdkAtom<!-- -->s
*
* Starts a drag and creates a new drag context for it.
*
@@ -3151,7 +3170,8 @@ gdk_drag_begin (GdkWindow *window,
GdkDragContext *new_context;
GdkDisplay *display;
GdkDevice *device;
GdkDeviceManager *device_manager;
g_return_val_if_fail (window != NULL, NULL);
g_return_val_if_fail (GDK_WINDOW_IS_X11 (window), NULL);
@@ -3166,7 +3186,8 @@ gdk_drag_begin (GdkWindow *window,
new_context->actions = 0;
display = gdk_drawable_get_display (GDK_DRAWABLE (window));
device = gdk_display_get_core_pointer (display);
device_manager = gdk_display_get_device_manager (display);
device = gdk_device_manager_get_client_pointer (device_manager);
gdk_drag_context_set_device (new_context, device);
return new_context;
@@ -3266,7 +3287,7 @@ _gdk_drag_get_protocol_for_display (GdkDisplay *display,
}
#endif
gdk_error_trap_pop ();
gdk_error_trap_pop_ignored ();
if (rootwin)
{
+5
View File
@@ -312,6 +312,11 @@ gdk_event_source_dispatch (GSource *source,
static void
gdk_event_source_finalize (GSource *source)
{
GdkEventSource *event_source = (GdkEventSource *)source;
g_list_free (event_source->translators);
event_source->translators = NULL;
event_sources = g_list_remove (event_sources, source);
}
+1 -1
View File
@@ -51,7 +51,7 @@ struct _GdkInputWindow
* Returns the list of available input devices for the default display.
* The list is statically allocated and should not be freed.
*
* Return value: a list of #GdkDevice
* Return value: (transfer none) (element-type GdkDevice): a list of #GdkDevice
*
* Deprecated: 3.0: Use gdk_device_manager_list_devices() instead.
**/
+216 -140
View File
@@ -52,8 +52,8 @@
#include <gdk/gdkdeviceprivate.h>
typedef struct _GdkPredicate GdkPredicate;
typedef struct _GdkErrorTrap GdkErrorTrap;
typedef struct _GdkPredicate GdkPredicate;
typedef struct _GdkGlobalErrorTrap GdkGlobalErrorTrap;
struct _GdkPredicate
{
@@ -61,11 +61,15 @@ struct _GdkPredicate
gpointer data;
};
struct _GdkErrorTrap
/* non-GDK previous error handler */
typedef int (*GdkXErrorHandler) (Display *, XErrorEvent *);
static GdkXErrorHandler _gdk_old_error_handler;
/* number of times we've pushed the GDK error handler */
static int _gdk_error_handler_push_count = 0;
struct _GdkGlobalErrorTrap
{
int (*old_handler) (Display *, XErrorEvent *);
gint error_warnings;
gint error_code;
GSList *displays;
};
/*
@@ -85,8 +89,7 @@ static int gdk_x_io_error (Display *display);
/* Private variable declarations
*/
static GSList *gdk_error_traps = NULL; /* List of error traps */
static GSList *gdk_error_trap_free_list = NULL; /* Free list */
static GQueue gdk_error_traps;
const GOptionEntry _gdk_windowing_args[] = {
{ "sync", 0, 0, G_OPTION_ARG_NONE, &_gdk_synchronize,
@@ -98,7 +101,8 @@ void
_gdk_windowing_init (void)
{
_gdk_x11_initialize_locale ();
g_queue_init (&gdk_error_traps);
XSetErrorHandler (gdk_x_error);
XSetIOErrorHandler (gdk_x_io_error);
@@ -284,72 +288,6 @@ _gdk_windowing_exit (void)
}
}
/*
*--------------------------------------------------------------
* gdk_x_error
*
* The X error handling routine.
*
* Arguments:
* "display" is the X display the error orignated from.
* "error" is the XErrorEvent that we are handling.
*
* Results:
* Either we were expecting some sort of error to occur,
* in which case we set the "_gdk_error_code" flag, or this
* error was unexpected, in which case we will print an
* error message and exit. (Since trying to continue will
* most likely simply lead to more errors).
*
* Side effects:
*
*--------------------------------------------------------------
*/
static int
gdk_x_error (Display *display,
XErrorEvent *error)
{
if (error->error_code)
{
if (_gdk_error_warnings)
{
gchar buf[64];
gchar *msg;
XGetErrorText (display, error->error_code, buf, 63);
msg =
g_strdup_printf ("The program '%s' received an X Window System error.\n"
"This probably reflects a bug in the program.\n"
"The error was '%s'.\n"
" (Details: serial %ld error_code %d request_code %d minor_code %d)\n"
" (Note to programmers: normally, X errors are reported asynchronously;\n"
" that is, you will receive the error a while after causing it.\n"
" To debug your program, run it with the --sync command line\n"
" option to change this behavior. You can then get a meaningful\n"
" backtrace from your debugger if you break on the gdk_x_error() function.)",
g_get_prgname (),
buf,
error->serial,
error->error_code,
error->request_code,
error->minor_code);
#ifdef G_ENABLE_DEBUG
g_error ("%s", msg);
#else /* !G_ENABLE_DEBUG */
g_fprintf (stderr, "%s\n", msg);
exit (1);
#endif /* G_ENABLE_DEBUG */
}
_gdk_error_code = error->error_code;
}
return 0;
}
/*
*--------------------------------------------------------------
* gdk_x_io_error
@@ -380,95 +318,233 @@ gdk_x_io_error (Display *display)
*/
if (errno == EPIPE)
{
g_fprintf (stderr,
"The application '%s' lost its connection to the display %s;\n"
"most likely the X server was shut down or you killed/destroyed\n"
"the application.\n",
g_get_prgname (),
display ? DisplayString (display) : gdk_get_display_arg_name ());
g_warning ("The application '%s' lost its connection to the display %s;\n"
"most likely the X server was shut down or you killed/destroyed\n"
"the application.\n",
g_get_prgname (),
display ? DisplayString (display) : gdk_get_display_arg_name ());
}
else
{
g_fprintf (stderr, "%s: Fatal IO error %d (%s) on X server %s.\n",
g_get_prgname (),
errno, g_strerror (errno),
display ? DisplayString (display) : gdk_get_display_arg_name ());
g_warning ("%s: Fatal IO error %d (%s) on X server %s.\n",
g_get_prgname (),
errno, g_strerror (errno),
display ? DisplayString (display) : gdk_get_display_arg_name ());
}
exit(1);
}
/*************************************************************
* gdk_error_trap_push:
* Push an error trap. X errors will be trapped until
* the corresponding gdk_error_pop(), which will return
* the error code, if any.
* arguments:
*
* results:
*************************************************************/
/* X error handler. Keep the name the same because people are used to
* breaking on it in the debugger.
*/
static int
gdk_x_error (Display *xdisplay,
XErrorEvent *error)
{
if (error->error_code)
{
GdkDisplay *error_display;
GdkDisplayManager *manager;
GSList *displays;
/* Figure out which GdkDisplay if any got the error. */
error_display = NULL;
manager = gdk_display_manager_get ();
displays = gdk_display_manager_list_displays (manager);
while (displays != NULL)
{
GdkDisplayX11 *gdk_display = displays->data;
if (xdisplay == gdk_display->xdisplay)
{
error_display = GDK_DISPLAY_OBJECT (gdk_display);
g_slist_free (displays);
displays = NULL;
}
else
{
displays = g_slist_delete_link (displays, displays);
}
}
if (error_display == NULL)
{
/* Error on an X display not opened by GDK. Ignore. */
return 0;
}
else
{
_gdk_x11_display_error_event (error_display, error);
}
}
return 0;
}
void
gdk_error_trap_push (void)
_gdk_x11_error_handler_push (void)
{
GSList *node;
GdkErrorTrap *trap;
GdkXErrorHandler previous;
if (gdk_error_trap_free_list)
previous = XSetErrorHandler (gdk_x_error);
if (_gdk_error_handler_push_count > 0)
{
node = gdk_error_trap_free_list;
gdk_error_trap_free_list = gdk_error_trap_free_list->next;
if (previous != gdk_x_error)
g_warning ("XSetErrorHandler() called with a GDK error trap pushed. Don't do that.");
}
else
{
node = g_slist_alloc ();
node->data = g_new (GdkErrorTrap, 1);
_gdk_old_error_handler = previous;
}
node->next = gdk_error_traps;
gdk_error_traps = node;
trap = node->data;
trap->old_handler = XSetErrorHandler (gdk_x_error);
trap->error_code = _gdk_error_code;
trap->error_warnings = _gdk_error_warnings;
_gdk_error_code = 0;
_gdk_error_warnings = 0;
_gdk_error_handler_push_count += 1;
}
/*************************************************************
* gdk_error_trap_pop:
* Pop an error trap added with gdk_error_push()
* arguments:
*
* results:
* 0, if no error occured, otherwise the error code.
*************************************************************/
void
_gdk_x11_error_handler_pop (void)
{
g_return_if_fail (_gdk_error_handler_push_count > 0);
_gdk_error_handler_push_count -= 1;
if (_gdk_error_handler_push_count == 0)
{
XSetErrorHandler (_gdk_old_error_handler);
_gdk_old_error_handler = NULL;
}
}
/**
* gdk_error_trap_push:
*
* This function allows X errors to be trapped instead of the normal
* behavior of exiting the application. It should only be used if it
* is not possible to avoid the X error in any other way. Errors are
* ignored on all #GdkDisplay currently known to the
* #GdkDisplayManager. If you don't care which error happens and just
* want to ignore everything, pop with gdk_error_trap_pop_ignored().
* If you need the error code, use gdk_error_trap_pop() which may have
* to block and wait for the error to arrive from the X server.
*
* This API exists on all platforms but only does anything on X.
*
* You can use gdk_x11_display_error_trap_push() to ignore errors
* on only a single display.
*
* <example>
* <title>Trapping an X error</title>
* <programlisting>
* gdk_error_trap_push (<!-- -->);
*
* // ... Call the X function which may cause an error here ...
*
*
* if (gdk_error_trap_pop (<!-- -->))
* {
* // ... Handle the error here ...
* }
* </programlisting>
* </example>
*
*/
void
gdk_error_trap_push (void)
{
GdkGlobalErrorTrap *trap;
GdkDisplayManager *manager;
GSList *tmp_list;
trap = g_slice_new (GdkGlobalErrorTrap);
manager = gdk_display_manager_get ();
trap->displays = gdk_display_manager_list_displays (manager);
g_slist_foreach (trap->displays, (GFunc) g_object_ref, NULL);
for (tmp_list = trap->displays;
tmp_list != NULL;
tmp_list = tmp_list->next)
{
gdk_x11_display_error_trap_push (tmp_list->data);
}
g_queue_push_head (&gdk_error_traps, trap);
}
static gint
gdk_error_trap_pop_internal (gboolean need_code)
{
GdkGlobalErrorTrap *trap;
gint result;
GSList *tmp_list;
trap = g_queue_pop_head (&gdk_error_traps);
g_return_val_if_fail (trap != NULL, Success);
result = Success;
for (tmp_list = trap->displays;
tmp_list != NULL;
tmp_list = tmp_list->next)
{
gint code = Success;
if (need_code)
code = gdk_x11_display_error_trap_pop (tmp_list->data);
else
gdk_x11_display_error_trap_pop_ignored (tmp_list->data);
/* we use the error on the last display listed, why not. */
if (code != Success)
result = code;
}
g_slist_foreach (trap->displays, (GFunc) g_object_unref, NULL);
g_slist_free (trap->displays);
g_slice_free (GdkGlobalErrorTrap, trap);
return result;
}
/**
* gdk_error_trap_pop_ignored:
*
* Removes an error trap pushed with gdk_error_trap_push(), but
* without bothering to wait and see whether an error occurred. If an
* error arrives later asynchronously that was triggered while the
* trap was pushed, that error will be ignored.
*
* Since: 3.0
*/
void
gdk_error_trap_pop_ignored (void)
{
gdk_error_trap_pop_internal (FALSE);
}
/**
* gdk_error_trap_pop:
*
* Removes an error trap pushed with gdk_error_trap_push().
* May block until an error has been definitively received
* or not received from the X server. gdk_error_trap_pop_ignored()
* is preferred if you don't need to know whether an error
* occurred, because it never has to block. If you don't
* need the return value of gdk_error_trap_pop(), use
* gdk_error_trap_pop_ignored().
*
* Prior to GDK 3.0, this function would not automatically
* sync for you, so you had to gdk_flush() if your last
* call to Xlib was not a blocking round trip.
*
* Return value: X error code or 0 on success
*/
gint
gdk_error_trap_pop (void)
{
GSList *node;
GdkErrorTrap *trap;
gint result;
g_return_val_if_fail (gdk_error_traps != NULL, 0);
node = gdk_error_traps;
gdk_error_traps = gdk_error_traps->next;
node->next = gdk_error_trap_free_list;
gdk_error_trap_free_list = node;
result = _gdk_error_code;
trap = node->data;
_gdk_error_code = trap->error_code;
_gdk_error_warnings = trap->error_warnings;
XSetErrorHandler (trap->old_handler);
return result;
return gdk_error_trap_pop_internal (TRUE);
}
gchar *
+2
View File
@@ -60,6 +60,8 @@ struct _GdkVisualPrivate
GdkScreen *screen;
};
void _gdk_x11_error_handler_push (void);
void _gdk_x11_error_handler_pop (void);
void _gdk_xid_table_insert (GdkDisplay *display,
XID *xid,
+13 -15
View File
@@ -510,9 +510,9 @@ gdk_x11_screen_get_monitor_output (GdkScreen *screen,
/**
* gdk_screen_get_monitor_geometry:
* @screen : a #GdkScreen
* @screen: a #GdkScreen
* @monitor_num: the monitor number, between 0 and gdk_screen_get_n_monitors (screen)
* @dest : a #GdkRectangle to be filled with the monitor geometry
* @dest: a #GdkRectangle to be filled with the monitor geometry
*
* Retrieves the #GdkRectangle representing the size and position of
* the individual monitor within the entire screen area.
@@ -1261,12 +1261,12 @@ _gdk_x11_screen_process_owner_change (GdkScreen *screen,
/**
* _gdk_windowing_substitute_screen_number:
* @display_name : The name of a display, in the form used by
* gdk_display_open (). If %NULL a default value
* will be used. On X11, this is derived from the DISPLAY
* environment variable.
* @screen_number : The number of a screen within the display
* referred to by @display_name.
* @display_name: The name of a display, in the form used by
* gdk_display_open (). If %NULL a default value
* will be used. On X11, this is derived from the DISPLAY
* environment variable.
* @screen_number: The number of a screen within the display
* referred to by @display_name.
*
* Modifies a @display_name to make @screen_number the default
* screen when the display is opened.
@@ -1391,7 +1391,7 @@ gdk_screen_get_active_window (GdkScreen *screen)
}
/**
* gdk_screen_get_window_stack
* gdk_screen_get_window_stack:
* @screen: a #GdkScreen
*
* Returns a #GList of #GdkWindow<!-- -->s representing the current
@@ -1410,7 +1410,8 @@ gdk_screen_get_active_window (GdkScreen *screen)
* windows it contains, so it should be freed using g_list_free() and
* its windows unrefed using g_object_unref() when no longer needed.
*
* Return value: a list of #GdkWindow<!-- -->s for the current window stack,
* Return value: (transfer full) (element-type GdkWindow):
* a list of #GdkWindow<!-- -->s for the current window stack,
* or %NULL.
*
* Since: 2.10
@@ -1521,7 +1522,7 @@ gdk_event_send_client_message_to_all_recurse (GdkDisplay *display,
result = send || found;
out:
gdk_error_trap_pop ();
gdk_error_trap_pop_ignored ();
return result;
}
@@ -1754,7 +1755,6 @@ fetch_net_wm_check_window (GdkScreen *screen)
/* Find out if this WM goes away, so we can reset everything. */
XSelectInput (screen_x11->xdisplay, *xwindow, StructureNotifyMask);
gdk_display_sync (display);
error = gdk_error_trap_pop ();
if (!error)
@@ -2082,9 +2082,7 @@ gdk_x11_screen_get_window_manager_name (GdkScreen *screen)
&n_items, &bytes_after,
(guchar **)&name);
gdk_display_sync (screen_x11->display);
gdk_error_trap_pop ();
gdk_error_trap_pop_ignored ();
if (name != NULL)
{
+2 -2
View File
@@ -521,8 +521,8 @@ gdk_query_visual_types (GdkVisualType **visual_types,
*
* Call g_list_free() on the return value when you're finished with it.
*
* Return value: a list of visuals; the list must be freed, but not its
* contents
* Return value: (transfer container) (element-type GdkVisual):
* a list of visuals; the list must be freed, but not its contents
*
* Since: 2.2
**/
+5 -7
View File
@@ -1092,8 +1092,7 @@ _gdk_windowing_window_destroy_foreign (GdkWindow *window)
XSendEvent (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window),
False, 0, (XEvent *)&xclient);
gdk_display_sync (GDK_WINDOW_DISPLAY (window));
gdk_error_trap_pop ();
gdk_error_trap_pop_ignored ();
}
static GdkWindow *
@@ -2955,7 +2954,7 @@ gdk_window_get_frame_extents (GdkWindow *window,
if (vroots)
XFree (vroots);
gdk_error_trap_pop ();
gdk_error_trap_pop_ignored ();
}
void
@@ -3191,7 +3190,6 @@ _gdk_windowing_window_at_device_position (GdkDisplay *display,
gdk_error_trap_push ();
XQueryPointer (xdisplay, xwindow,
&root, &child, &rootx, &rooty, &winx, &winy, &xmask);
gdk_flush ();
if (gdk_error_trap_pop ())
continue;
if (child != None)
@@ -3232,7 +3230,6 @@ _gdk_windowing_window_at_device_position (GdkDisplay *display,
gdk_error_trap_push ();
XQueryPointer (xdisplay, xwindow,
&root, &xwindow, &rootx, &rooty, &winx, &winy, &xmask);
gdk_flush ();
if (gdk_error_trap_pop ())
break;
if (get_toplevel && xwindow_last != root &&
@@ -3614,7 +3611,8 @@ gdk_x11_window_set_user_time (GdkWindow *window,
/**
* gdk_window_set_icon_list:
* @window: The #GdkWindow toplevel window to set the icon of.
* @pixbufs: A list of pixbufs, of different sizes.
* @pixbufs: (transfer none) (element-type GdkPixbuf):
* A list of pixbufs, of different sizes.
*
* Sets a list of icons for the window. One of these will be used
* to represent the window when it has been iconified. The icon is
@@ -4240,7 +4238,7 @@ gdk_window_set_keep_below (GdkWindow *window, gboolean setting)
*
* Returns the group leader window for @window. See gdk_window_set_group().
*
* Return value: the group leader window for @window
* Return value: (transfer none): the group leader window for @window
*
* Since: 2.4
**/
+6
View File
@@ -164,6 +164,12 @@ G_CONST_RETURN gchar *gdk_x11_get_xatom_name (Atom xatom);
void gdk_x11_display_grab (GdkDisplay *display);
void gdk_x11_display_ungrab (GdkDisplay *display);
void gdk_x11_display_error_trap_push (GdkDisplay *display);
/* warn unused because you could use pop_ignored otherwise */
G_GNUC_WARN_UNUSED_RESULT gint gdk_x11_display_error_trap_pop (GdkDisplay *display);
void gdk_x11_display_error_trap_pop_ignored (GdkDisplay *display);
void gdk_x11_register_standard_event_type (GdkDisplay *display,
gint event_base,
gint n_events);
+2 -2
View File
@@ -900,8 +900,8 @@ LDADDS = \
if HAVE_INTROSPECTION
introspection_files = \
$(gtkinclude_HEADERS) \
$(gtk_all_c_sources) \
$(filter-out gtktextlayout.h, $(gtkinclude_HEADERS)) \
$(gtk_base_c_sources) \
gtktypebuiltins.h \
gtktypebuiltins.c
+23 -8
View File
@@ -48,13 +48,11 @@ gtk_about_dialog_set_authors
gtk_about_dialog_set_comments
gtk_about_dialog_set_copyright
gtk_about_dialog_set_documenters
gtk_about_dialog_set_email_hook
gtk_about_dialog_set_license
gtk_about_dialog_set_license_type
gtk_about_dialog_set_logo
gtk_about_dialog_set_logo_icon_name
gtk_about_dialog_set_translator_credits
gtk_about_dialog_set_url_hook
gtk_about_dialog_set_version
gtk_about_dialog_set_website
gtk_about_dialog_set_website_label
@@ -589,7 +587,9 @@ gtk_cell_renderer_get_alignment
gtk_cell_renderer_get_fixed_size
gtk_cell_renderer_get_padding
gtk_cell_renderer_get_sensitive
#ifndef GTK_DISABLE_DEPRECATED
gtk_cell_renderer_get_size
#endif
gtk_cell_renderer_get_type G_GNUC_CONST
gtk_cell_renderer_get_visible
gtk_cell_renderer_render
@@ -684,7 +684,9 @@ gtk_cell_view_get_desired_height_for_width_of_row
gtk_cell_view_get_desired_width_of_row
gtk_cell_view_get_displayed_row
gtk_cell_view_get_model
#ifndef GTK_DISABLE_DEPRECATED
gtk_cell_view_get_size_of_row
#endif
gtk_cell_view_get_type G_GNUC_CONST
gtk_cell_view_new
gtk_cell_view_new_with_markup
@@ -1805,7 +1807,6 @@ gtk_link_button_new
gtk_link_button_new_with_label
gtk_link_button_get_uri
gtk_link_button_set_uri
gtk_link_button_set_uri_hook
gtk_link_button_get_visited
gtk_link_button_set_visited
#endif
@@ -2065,9 +2066,8 @@ gtk_notebook_set_tab_label_text
gtk_notebook_set_tab_pos
gtk_notebook_get_tab_hborder
gtk_notebook_get_tab_vborder
gtk_notebook_set_window_creation_hook
gtk_notebook_get_group
gtk_notebook_set_group
gtk_notebook_get_group_name
gtk_notebook_set_group_name
gtk_notebook_get_tab_reorderable
gtk_notebook_set_tab_reorderable
gtk_notebook_get_tab_detachable
@@ -4211,7 +4211,9 @@ gtk_widget_get_accessible
gtk_widget_get_allocation
gtk_widget_get_ancestor
gtk_widget_get_app_paintable
#ifndef GTK_DISABLE_DEPRECATED
gtk_widget_get_child_requisition
#endif
gtk_widget_get_child_visible
gtk_widget_get_clipboard
gtk_widget_get_colormap
@@ -4336,7 +4338,9 @@ gtk_widget_show
gtk_widget_show_all
gtk_widget_show_now
gtk_widget_size_allocate
#ifndef GTK_DISABLE_DEPRECATED
gtk_widget_size_request
#endif
gtk_widget_style_attach
gtk_widget_style_get G_GNUC_NULL_TERMINATED
gtk_widget_style_get_property
@@ -4361,6 +4365,18 @@ gtk_widget_get_mapped
gtk_widget_get_support_multidevice
gtk_widget_set_support_multidevice
gtk_widget_device_is_shadowed
gtk_widget_get_halign
gtk_widget_set_halign
gtk_widget_get_valign
gtk_widget_set_valign
gtk_widget_get_margin_left
gtk_widget_set_margin_left
gtk_widget_get_margin_right
gtk_widget_set_margin_right
gtk_widget_get_margin_top
gtk_widget_set_margin_top
gtk_widget_get_margin_bottom
gtk_widget_set_margin_bottom
#endif
#endif
@@ -4492,9 +4508,8 @@ gtk_wrap_box_get_natural_line_children
gtk_wrap_box_get_spreading
gtk_wrap_box_get_type G_GNUC_CONST
gtk_wrap_box_get_vertical_spacing
gtk_wrap_box_insert_child_with_padding
gtk_wrap_box_insert_child
gtk_wrap_box_new
gtk_wrap_box_packing_get_type
gtk_wrap_box_reorder_child
gtk_wrap_box_set_allocation_mode
gtk_wrap_box_set_horizontal_spacing
+119 -249
View File
@@ -60,41 +60,21 @@
* SECTION:gtkaboutdialog
* @Short_description: Display information about an application
* @Title: GtkAboutDialog
* @See_also:#GTK_STOCK_ABOUT
* @See_also: #GTK_STOCK_ABOUT
*
* The #GtkAboutDialog offers a simple way to display information about
* The GtkAboutDialog offers a simple way to display information about
* a program like its logo, name, copyright, website and license. It is
* also possible to give credits to the authors, documenters, translators
* and artists who have worked on the program. An about dialog is typically
* opened when the user selects the <literal>About</literal> option from
* the <literal>Help</literal> menu. All parts of the dialog are optional.
*
* About dialog often contain links and email addresses. #GtkAboutDialog
* supports this by offering global hooks, which are called when the user
* clicks on a link or email address, see gtk_about_dialog_set_email_hook()
* and gtk_about_dialog_set_url_hook(). Email addresses in the
* authors, documenters and artists properties are recognized by looking for
* <literal>&lt;user@<!-- -->host&gt;</literal>, URLs are
* recognized by looking for <literal>http://url</literal>, with
* <literal>url</literal> extending to the next space, tab or line break.
* About dialog often contain links and email addresses. GtkAboutDialog
* displays these as clickable links. By default, it calls gtk_show_uri()
* when a user clicks one. The behaviour can be overridden with the
* #GtkAboutDialog::activate-link signal.
*
* <para id="gtk-about-dialog-hook-setup">
* Since 2.18 #GtkAboutDialog provides default website and email hooks that
* use gtk_show_uri().
* </para>
*
* If you want provide your own hooks overriding the default ones, it is
* important to do so before setting the website and email URL properties,
* like this:
* <informalexample><programlisting>
* gtk_about_dialog_set_url_hook (GTK_ABOUT_DIALOG (dialog), launch_url, NULL, NULL);
* gtk_about_dialog_set_website (GTK_ABOUT_DIALOG (dialog), app_url);
* </programlisting></informalexample>
* To disable the default hooks, you can pass %NULL as the hook func. Then,
* the #GtkAboutDialog widget will not display the website or the
* email addresses as clickable.
*
* To make constructing a #GtkAboutDialog as convenient as possible, you can
* To make constructing a GtkAboutDialog as convenient as possible, you can
* use the function gtk_show_about_dialog() which constructs and shows a dialog
* and keeps it around so that it can be shown again.
*
@@ -102,7 +82,7 @@
* on the dialog window (where &percnt;s is replaced by the name of the
* application, but in order to ensure proper translation of the title,
* applications should set the title property explicitly when constructing
* a #GtkAboutDialog, as shown in the following example:
* a GtkAboutDialog, as shown in the following example:
* <informalexample><programlisting>
* gtk_show_about_dialog (NULL,
* "program-name", "ExampleCode",
@@ -110,9 +90,6 @@
* "title" _("About ExampleCode"),
* NULL);
* </programlisting></informalexample>
* Note that prior to GTK+ 2.12, the #GtkAboutDialog:program-name property
* was called "name". This was changed to avoid the conflict with the
* #GtkWidget:name property.
*/
static GdkColor default_link_color = { 0, 0, 0, 0xeeee };
@@ -216,80 +193,28 @@ static void follow_if_link (GtkAboutDialog
GtkTextView *text_view,
GtkTextIter *iter);
static void set_cursor_if_appropriate (GtkAboutDialog *about,
GtkTextView *text_view,
GtkTextView *text_view,
GdkDevice *device,
gint x,
gint y);
gint x,
gint y);
static void display_credits_dialog (GtkWidget *button,
gpointer data);
static void display_license_dialog (GtkWidget *button,
gpointer data);
static void close_cb (GtkAboutDialog *about);
static void default_url_hook (GtkAboutDialog *about,
const gchar *uri,
gpointer user_data);
static void default_email_hook (GtkAboutDialog *about,
const gchar *email_address,
gpointer user_data);
static gboolean gtk_about_dialog_activate_link (GtkAboutDialog *about,
const gchar *uri);
static gboolean activate_email_hook_set = FALSE;
static GtkAboutDialogActivateLinkFunc activate_email_hook = NULL;
static gpointer activate_email_hook_data = NULL;
static GDestroyNotify activate_email_hook_destroy = NULL;
enum {
ACTIVATE_LINK,
LAST_SIGNAL
};
static gboolean activate_url_hook_set = FALSE;
static GtkAboutDialogActivateLinkFunc activate_url_hook = NULL;
static gpointer activate_url_hook_data = NULL;
static GDestroyNotify activate_url_hook_destroy = NULL;
static void
default_url_hook (GtkAboutDialog *about,
const gchar *uri,
gpointer user_data)
{
GdkScreen *screen;
GError *error = NULL;
screen = gtk_widget_get_screen (GTK_WIDGET (about));
if (!gtk_show_uri (screen, uri, gtk_get_current_event_time (), &error))
{
GtkWidget *dialog;
dialog = gtk_message_dialog_new (GTK_WINDOW (about),
GTK_DIALOG_DESTROY_WITH_PARENT |
GTK_DIALOG_MODAL,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"%s", _("Could not show link"));
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
"%s", error->message);
g_error_free (error);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_widget_destroy), NULL);
gtk_window_present (GTK_WINDOW (dialog));
}
}
static void
default_email_hook (GtkAboutDialog *about,
const gchar *email_address,
gpointer user_data)
{
char *escaped, *uri;
escaped = g_uri_escape_string (email_address, NULL, FALSE);
uri = g_strdup_printf ("mailto:%s", escaped);
g_free (escaped);
default_url_hook (about, uri, user_data);
g_free (uri);
}
static guint signals[LAST_SIGNAL] = { 0 };
G_DEFINE_TYPE (GtkAboutDialog, gtk_about_dialog, GTK_TYPE_DIALOG)
static void
gtk_about_dialog_class_init (GtkAboutDialogClass *klass)
{
@@ -306,6 +231,30 @@ gtk_about_dialog_class_init (GtkAboutDialogClass *klass)
widget_class->show = gtk_about_dialog_show;
klass->activate_link = gtk_about_dialog_activate_link;
/**
* GtkAboutDialog::activate-link:
* @label: The object on which the signal was emitted
* @uri: the URI that is activated
*
* The signal which gets emitted to activate a URI.
* Applications may connect to it to override the default behaviour,
* which is to call gtk_show_uri().
*
* Returns: %TRUE if the link has been activated
*
* Since: 2.24
*/
signals[ACTIVATE_LINK] =
g_signal_new ("activate-link",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GtkAboutDialogClass, activate_link),
_gtk_boolean_handled_accumulator, NULL,
_gtk_marshal_BOOLEAN__STRING,
G_TYPE_BOOLEAN, 1, G_TYPE_STRING);
/**
* GtkAboutDialog:program-name:
*
@@ -574,25 +523,12 @@ gtk_about_dialog_class_init (GtkAboutDialogClass *klass)
}
static gboolean
website_clicked (GtkLabel *label,
const gchar *uri,
GtkAboutDialog *about)
emit_activate_link (GtkAboutDialog *about,
const gchar *uri)
{
GtkAboutDialogActivateLinkFunc url_hook;
gpointer url_hook_data;
gboolean handled = FALSE;
if (activate_url_hook_set)
{
url_hook = activate_url_hook;
url_hook_data = activate_url_hook_data;
}
else
{
url_hook = default_url_hook;
url_hook_data = NULL;
}
url_hook (about, uri, url_hook_data);
g_signal_emit (about, signals[ACTIVATE_LINK], 0, uri, &handled);
return TRUE;
}
@@ -668,8 +604,8 @@ gtk_about_dialog_init (GtkAboutDialog *about)
gtk_widget_set_no_show_all (button, TRUE);
gtk_label_set_selectable (GTK_LABEL (button), TRUE);
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
g_signal_connect (button, "activate-link",
G_CALLBACK (website_clicked), about);
g_signal_connect_swapped (button, "activate-link",
G_CALLBACK (emit_activate_link), about);
gtk_widget_show (vbox);
gtk_widget_show (priv->logo_image);
@@ -688,7 +624,7 @@ gtk_about_dialog_init (GtkAboutDialog *about)
gtk_button_set_image (GTK_BUTTON (button), image);
gtk_widget_set_no_show_all (button, TRUE);
gtk_box_pack_end (GTK_BOX (action_area),
button, FALSE, TRUE, 0);
button, FALSE, TRUE, 0);
gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (action_area), button, TRUE);
g_signal_connect (button, "clicked",
G_CALLBACK (display_credits_dialog), about);
@@ -700,7 +636,7 @@ gtk_about_dialog_init (GtkAboutDialog *about)
gtk_widget_set_can_default (button, TRUE);
gtk_widget_set_no_show_all (button, TRUE);
gtk_box_pack_end (GTK_BOX (action_area),
button, FALSE, TRUE, 0);
button, FALSE, TRUE, 0);
gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (action_area), button, TRUE);
g_signal_connect (button, "clicked",
G_CALLBACK (display_license_dialog), about);
@@ -817,7 +753,7 @@ gtk_about_dialog_get_property (GObject *object,
{
GtkAboutDialog *about = GTK_ABOUT_DIALOG (object);
GtkAboutDialogPrivate *priv = about->priv;
switch (prop_id)
{
case PROP_NAME:
@@ -882,6 +818,38 @@ gtk_about_dialog_get_property (GObject *object,
}
}
static gboolean
gtk_about_dialog_activate_link (GtkAboutDialog *about,
const gchar *uri)
{
GdkScreen *screen;
GError *error = NULL;
screen = gtk_widget_get_screen (GTK_WIDGET (about));
if (!gtk_show_uri (screen, uri, gtk_get_current_event_time (), &error))
{
GtkWidget *dialog;
dialog = gtk_message_dialog_new (GTK_WINDOW (about),
GTK_DIALOG_DESTROY_WITH_PARENT |
GTK_DIALOG_MODAL,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"%s", _("Could not show link"));
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
"%s", error->message);
g_error_free (error);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_widget_destroy), NULL);
gtk_window_present (GTK_WINDOW (dialog));
}
return TRUE;
}
static void
update_website (GtkAboutDialog *about)
{
@@ -889,7 +857,7 @@ update_website (GtkAboutDialog *about)
gtk_widget_show (priv->website_label);
if (priv->website_url && (!activate_url_hook_set || activate_url_hook != NULL))
if (priv->website_url)
{
gchar *markup;
@@ -1796,52 +1764,18 @@ follow_if_link (GtkAboutDialog *about,
{
GSList *tags = NULL, *tagp = NULL;
GtkAboutDialogPrivate *priv = about->priv;
gchar *url = NULL;
GtkAboutDialogActivateLinkFunc email_hook, url_hook;
gpointer email_hook_data, url_hook_data;
if (activate_email_hook_set)
{
email_hook = activate_email_hook;
email_hook_data = activate_email_hook_data;
}
else
{
email_hook = default_email_hook;
email_hook_data = NULL;
}
if (activate_url_hook_set)
{
url_hook = activate_url_hook;
url_hook_data = activate_url_hook_data;
}
else
{
url_hook = default_url_hook;
url_hook_data = NULL;
}
gchar *uri = NULL;
tags = gtk_text_iter_get_tags (iter);
for (tagp = tags; tagp != NULL && !url; tagp = tagp->next)
for (tagp = tags; tagp != NULL && !uri; tagp = tagp->next)
{
GtkTextTag *tag = tagp->data;
if (email_hook != NULL)
{
url = g_object_get_data (G_OBJECT (tag), "email");
if (url)
email_hook (about, url, email_hook_data);
}
uri = g_object_get_data (G_OBJECT (tag), "uri");
if (uri)
emit_activate_link (about, uri);
if (!url && url_hook != NULL)
{
url = g_object_get_data (G_OBJECT (tag), "url");
if (url)
url_hook (about, url, url_hook_data);
}
if (url && !g_slist_find_custom (priv->visited_links, url, (GCompareFunc)strcmp))
if (uri && !g_slist_find_custom (priv->visited_links, uri, (GCompareFunc)strcmp))
{
GdkColor *style_visited_link_color;
GdkColor color;
@@ -1860,7 +1794,7 @@ follow_if_link (GtkAboutDialog *about,
g_object_set (G_OBJECT (tag), "foreground-gdk", &color, NULL);
priv->visited_links = g_slist_prepend (priv->visited_links, g_strdup (url));
priv->visited_links = g_slist_prepend (priv->visited_links, g_strdup (uri));
}
}
@@ -1932,10 +1866,10 @@ text_view_event_after (GtkWidget *text_view,
static void
set_cursor_if_appropriate (GtkAboutDialog *about,
GtkTextView *text_view,
GtkTextView *text_view,
GdkDevice *device,
gint x,
gint y)
gint x,
gint y)
{
GtkAboutDialogPrivate *priv = about->priv;
GSList *tags = NULL, *tagp = NULL;
@@ -1948,10 +1882,9 @@ set_cursor_if_appropriate (GtkAboutDialog *about,
for (tagp = tags; tagp != NULL; tagp = tagp->next)
{
GtkTextTag *tag = tagp->data;
gchar *email = g_object_get_data (G_OBJECT (tag), "email");
gchar *url = g_object_get_data (G_OBJECT (tag), "url");
gchar *uri = g_object_get_data (G_OBJECT (tag), "uri");
if (email != NULL || url != NULL)
if (uri != NULL)
{
hovering_over_link = TRUE;
break;
@@ -2033,7 +1966,6 @@ text_view_new (GtkAboutDialog *about,
GtkWidget *view;
GtkTextView *text_view;
GtkTextBuffer *buffer;
gboolean linkify_email, linkify_urls;
GdkColor *style_link_color;
GdkColor *style_visited_link_color;
GdkColor color;
@@ -2042,9 +1974,6 @@ text_view_new (GtkAboutDialog *about,
GtkAboutDialogPrivate *priv = about->priv;
linkify_email = (!activate_email_hook_set || activate_email_hook != NULL);
linkify_urls = (!activate_url_hook_set || activate_url_hook != NULL);
gtk_widget_ensure_style (GTK_WIDGET (about));
gtk_widget_style_get (GTK_WIDGET (about),
"link-color", &style_link_color,
@@ -2096,9 +2025,9 @@ text_view_new (GtkAboutDialog *about,
q0 = *p;
while (*q0)
{
q1 = linkify_email ? strchr (q0, '<') : NULL;
q1 = strchr (q0, '<');
q2 = q1 ? strchr (q1, '>') : NULL;
r1 = linkify_urls ? strstr (q0, "http://") : NULL;
r1 = strstr (q0, "http://");
if (r1)
{
r2 = strpbrk (r1, " \n\t");
@@ -2118,6 +2047,7 @@ text_view_new (GtkAboutDialog *about,
{
GtkTextIter end;
gchar *link;
gchar *uri;
const gchar *link_type;
GtkTextTag *tag;
@@ -2126,13 +2056,13 @@ text_view_new (GtkAboutDialog *about,
gtk_text_buffer_insert_at_cursor (buffer, q0, (q1 - q0) + 1);
gtk_text_buffer_get_end_iter (buffer, &end);
q1++;
link_type = I_("email");
link_type = "email";
}
else
{
gtk_text_buffer_insert_at_cursor (buffer, q0, q1 - q0);
gtk_text_buffer_get_end_iter (buffer, &end);
link_type = I_("url");
link_type = "uri";
}
q0 = q2;
@@ -2148,7 +2078,19 @@ text_view_new (GtkAboutDialog *about,
"foreground-gdk", &color,
"underline", PANGO_UNDERLINE_SINGLE,
NULL);
g_object_set_data_full (G_OBJECT (tag), link_type, g_strdup (link), g_free);
if (strcmp (link_type, "email") == 0)
{
gchar *escaped;
escaped = g_uri_escape_string (link, NULL, FALSE);
uri = g_strconcat ("mailto:", escaped, NULL);
g_free (escaped);
}
else
{
uri = g_strdup (link);
}
g_object_set_data_full (G_OBJECT (tag), I_("uri"), uri, g_free);
gtk_text_buffer_insert_with_tags (buffer, &end, link, -1, tag, NULL);
g_free (link);
@@ -2291,10 +2233,10 @@ display_license_dialog (GtkWidget *button,
}
dialog = gtk_dialog_new_with_buttons (_("License"),
GTK_WINDOW (about),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_CLOSE, GTK_RESPONSE_CANCEL,
NULL);
GTK_WINDOW (about),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_CLOSE, GTK_RESPONSE_CANCEL,
NULL);
license_dialog = GTK_DIALOG (dialog);
content_area = gtk_dialog_get_content_area (license_dialog);
@@ -2354,78 +2296,6 @@ gtk_about_dialog_new (void)
return GTK_WIDGET (dialog);
}
/**
* gtk_about_dialog_set_email_hook:
* @func: a function to call when an email link is activated.
* @data: data to pass to @func
* @destroy: #GDestroyNotify for @data
*
* Installs a global function to be called whenever the user activates an
* email link in an about dialog.
*
* Since 2.18 there exists a default function which uses gtk_show_uri(). To
* deactivate it, you can pass %NULL for @func.
*
* Return value: the previous email hook.
*
* Since: 2.6
*/
GtkAboutDialogActivateLinkFunc
gtk_about_dialog_set_email_hook (GtkAboutDialogActivateLinkFunc func,
gpointer data,
GDestroyNotify destroy)
{
GtkAboutDialogActivateLinkFunc old;
if (activate_email_hook_destroy != NULL)
(* activate_email_hook_destroy) (activate_email_hook_data);
old = activate_email_hook;
activate_email_hook_set = TRUE;
activate_email_hook = func;
activate_email_hook_data = data;
activate_email_hook_destroy = destroy;
return old;
}
/**
* gtk_about_dialog_set_url_hook:
* @func: a function to call when a URL link is activated.
* @data: data to pass to @func
* @destroy: #GDestroyNotify for @data
*
* Installs a global function to be called whenever the user activates a
* URL link in an about dialog.
*
* Since 2.18 there exists a default function which uses gtk_show_uri(). To
* deactivate it, you can pass %NULL for @func.
*
* Return value: the previous URL hook.
*
* Since: 2.6
*/
GtkAboutDialogActivateLinkFunc
gtk_about_dialog_set_url_hook (GtkAboutDialogActivateLinkFunc func,
gpointer data,
GDestroyNotify destroy)
{
GtkAboutDialogActivateLinkFunc old;
if (activate_url_hook_destroy != NULL)
(* activate_url_hook_destroy) (activate_url_hook_data);
old = activate_url_hook;
activate_url_hook_set = TRUE;
activate_url_hook = func;
activate_url_hook_data = data;
activate_url_hook_destroy = destroy;
return old;
}
static void
close_cb (GtkAboutDialog *about)
{
+20 -39
View File
@@ -85,7 +85,7 @@ typedef enum {
* The <structname>GtkAboutDialog</structname> struct contains
* only private fields and should not be directly accessed.
*/
struct _GtkAboutDialog
struct _GtkAboutDialog
{
GtkDialog parent_instance;
@@ -93,10 +93,13 @@ struct _GtkAboutDialog
GtkAboutDialogPrivate *priv;
};
struct _GtkAboutDialogClass
struct _GtkAboutDialogClass
{
GtkDialogClass parent_class;
gboolean (*activate_link) (GtkAboutDialog *dialog,
const gchar *uri);
/* Padding for future expansion */
void (*_gtk_reserved1) (void);
void (*_gtk_reserved2) (void);
@@ -107,23 +110,23 @@ struct _GtkAboutDialogClass
GType gtk_about_dialog_get_type (void) G_GNUC_CONST;
GtkWidget *gtk_about_dialog_new (void);
void gtk_show_about_dialog (GtkWindow *parent,
const gchar *first_property_name,
...) G_GNUC_NULL_TERMINATED;
const gchar *first_property_name,
...) G_GNUC_NULL_TERMINATED;
G_CONST_RETURN gchar *gtk_about_dialog_get_program_name (GtkAboutDialog *about);
void gtk_about_dialog_set_program_name (GtkAboutDialog *about,
const gchar *name);
const gchar *name);
G_CONST_RETURN gchar *gtk_about_dialog_get_version (GtkAboutDialog *about);
void gtk_about_dialog_set_version (GtkAboutDialog *about,
const gchar *version);
const gchar *version);
G_CONST_RETURN gchar *gtk_about_dialog_get_copyright (GtkAboutDialog *about);
void gtk_about_dialog_set_copyright (GtkAboutDialog *about,
const gchar *copyright);
const gchar *copyright);
G_CONST_RETURN gchar *gtk_about_dialog_get_comments (GtkAboutDialog *about);
void gtk_about_dialog_set_comments (GtkAboutDialog *about,
const gchar *comments);
const gchar *comments);
G_CONST_RETURN gchar *gtk_about_dialog_get_license (GtkAboutDialog *about);
void gtk_about_dialog_set_license (GtkAboutDialog *about,
const gchar *license);
const gchar *license);
void gtk_about_dialog_set_license_type (GtkAboutDialog *about,
GtkLicense license_type);
GtkLicense gtk_about_dialog_get_license_type (GtkAboutDialog *about);
@@ -134,50 +137,28 @@ void gtk_about_dialog_set_wrap_license (GtkAboutDialog
G_CONST_RETURN gchar *gtk_about_dialog_get_website (GtkAboutDialog *about);
void gtk_about_dialog_set_website (GtkAboutDialog *about,
const gchar *website);
const gchar *website);
G_CONST_RETURN gchar *gtk_about_dialog_get_website_label (GtkAboutDialog *about);
void gtk_about_dialog_set_website_label (GtkAboutDialog *about,
const gchar *website_label);
const gchar *website_label);
G_CONST_RETURN gchar* G_CONST_RETURN * gtk_about_dialog_get_authors (GtkAboutDialog *about);
void gtk_about_dialog_set_authors (GtkAboutDialog *about,
const gchar **authors);
const gchar **authors);
G_CONST_RETURN gchar* G_CONST_RETURN * gtk_about_dialog_get_documenters (GtkAboutDialog *about);
void gtk_about_dialog_set_documenters (GtkAboutDialog *about,
const gchar **documenters);
const gchar **documenters);
G_CONST_RETURN gchar* G_CONST_RETURN * gtk_about_dialog_get_artists (GtkAboutDialog *about);
void gtk_about_dialog_set_artists (GtkAboutDialog *about,
const gchar **artists);
const gchar **artists);
G_CONST_RETURN gchar *gtk_about_dialog_get_translator_credits (GtkAboutDialog *about);
void gtk_about_dialog_set_translator_credits (GtkAboutDialog *about,
const gchar *translator_credits);
const gchar *translator_credits);
GdkPixbuf *gtk_about_dialog_get_logo (GtkAboutDialog *about);
void gtk_about_dialog_set_logo (GtkAboutDialog *about,
GdkPixbuf *logo);
GdkPixbuf *logo);
G_CONST_RETURN gchar *gtk_about_dialog_get_logo_icon_name (GtkAboutDialog *about);
void gtk_about_dialog_set_logo_icon_name (GtkAboutDialog *about,
const gchar *icon_name);
/**
* GtkAboutDialogActivateLinkFunc:
* @about: the #GtkAboutDialog in which the link was activated
* @link_: the URL or email address to which the activated link points
* @data: user data that was passed when the function was registered
* with gtk_about_dialog_set_email_hook() or
* gtk_about_dialog_set_url_hook()
*
* The type of a function which is called when a URL or email
* link is activated.
*/
typedef void (* GtkAboutDialogActivateLinkFunc) (GtkAboutDialog *about,
const gchar *link_,
gpointer data);
GtkAboutDialogActivateLinkFunc gtk_about_dialog_set_email_hook (GtkAboutDialogActivateLinkFunc func,
gpointer data,
GDestroyNotify destroy);
GtkAboutDialogActivateLinkFunc gtk_about_dialog_set_url_hook (GtkAboutDialogActivateLinkFunc func,
gpointer data,
GDestroyNotify destroy);
const gchar *icon_name);
G_END_DECLS
+16 -15
View File
@@ -319,7 +319,7 @@ gtk_accel_label_finalize (GObject *object)
* Fetches the widget monitored by this accelerator label. See
* gtk_accel_label_set_accel_widget().
*
* Returns: the object monitored by the accelerator label, or %NULL.
* Returns: (transfer none): the object monitored by the accelerator label, or %NULL.
**/
GtkWidget*
gtk_accel_label_get_accel_widget (GtkAccelLabel *accel_label)
@@ -405,7 +405,8 @@ gtk_accel_label_expose_event (GtkWidget *widget,
ac_width = gtk_accel_label_get_accel_width (accel_label);
gtk_widget_get_allocation (widget, &allocation);
gtk_widget_size_request (widget, &requisition);
gtk_size_request_get_size (GTK_SIZE_REQUEST (widget),
&requisition, NULL);
if (allocation.width >= requisition.width + ac_width)
{
@@ -634,67 +635,67 @@ append_keyval_symbol (guint accelerator_key,
#ifdef GDK_WINDOWING_QUARTZ
switch (accelerator_key)
{
case GDK_Return:
case GDK_KEY_Return:
/* U+21A9 LEFTWARDS ARROW WITH HOOK */
g_string_append (gstring, "\xe2\x86\xa9");
return TRUE;
case GDK_ISO_Enter:
case GDK_KEY_ISO_Enter:
/* U+2324 UP ARROWHEAD BETWEEN TWO HORIZONTAL BARS */
g_string_append (gstring, "\xe2\x8c\xa4");
return TRUE;
case GDK_Left:
case GDK_KEY_Left:
/* U+2190 LEFTWARDS ARROW */
g_string_append (gstring, "\xe2\x86\x90");
return TRUE;
case GDK_Up:
case GDK_KEY_Up:
/* U+2191 UPWARDS ARROW */
g_string_append (gstring, "\xe2\x86\x91");
return TRUE;
case GDK_Right:
case GDK_KEY_Right:
/* U+2192 RIGHTWARDS ARROW */
g_string_append (gstring, "\xe2\x86\x92");
return TRUE;
case GDK_Down:
case GDK_KEY_Down:
/* U+2193 DOWNWARDS ARROW */
g_string_append (gstring, "\xe2\x86\x93");
return TRUE;
case GDK_Page_Up:
case GDK_KEY_Page_Up:
/* U+21DE UPWARDS ARROW WITH DOUBLE STROKE */
g_string_append (gstring, "\xe2\x87\x9e");
return TRUE;
case GDK_Page_Down:
case GDK_KEY_Page_Down:
/* U+21DF DOWNWARDS ARROW WITH DOUBLE STROKE */
g_string_append (gstring, "\xe2\x87\x9f");
return TRUE;
case GDK_Home:
case GDK_KEY_Home:
/* U+2196 NORTH WEST ARROW */
g_string_append (gstring, "\xe2\x86\x96");
return TRUE;
case GDK_End:
case GDK_KEY_End:
/* U+2198 SOUTH EAST ARROW */
g_string_append (gstring, "\xe2\x86\x98");
return TRUE;
case GDK_Escape:
case GDK_KEY_Escape:
/* U+238B BROKEN CIRCLE WITH NORTHWEST ARROW */
g_string_append (gstring, "\xe2\x8e\x8b");
return TRUE;
case GDK_BackSpace:
case GDK_KEY_BackSpace:
/* U+232B ERASE TO THE LEFT */
g_string_append (gstring, "\xe2\x8c\xab");
return TRUE;
case GDK_Delete:
case GDK_KEY_Delete:
/* U+2326 ERASE TO THE RIGHT */
g_string_append (gstring, "\xe2\x8c\xa6");
return TRUE;
+5 -5
View File
@@ -873,7 +873,7 @@ gtk_action_unblock_activate (GtkAction *action)
* This function is intended for use by action implementations to
* create icons displayed in the proxy widgets.
*
* Returns: a widget that displays the icon for this action.
* Returns: (transfer full): a widget that displays the icon for this action.
*
* Since: 2.4
*/
@@ -899,7 +899,7 @@ gtk_action_create_icon (GtkAction *action, GtkIconSize icon_size)
*
* Creates a menu item widget that proxies for the given action.
*
* Returns: a menu item connected to the action.
* Returns: (transfer full): a menu item connected to the action.
*
* Since: 2.4
*/
@@ -924,7 +924,7 @@ gtk_action_create_menu_item (GtkAction *action)
*
* Creates a toolbar item widget that proxies for the given action.
*
* Returns: a toolbar item connected to the action.
* Returns: (transfer full): a toolbar item connected to the action.
*
* Since: 2.4
*/
@@ -1609,7 +1609,7 @@ gtk_action_set_gicon (GtkAction *action,
*
* Gets the gicon of @action.
*
* Returns: The action's #GIcon if one is set.
* Returns: (transfer none): The action's #GIcon if one is set.
*
* Since: 2.16
*/
@@ -1811,7 +1811,7 @@ gtk_action_disconnect_accelerator (GtkAction *action)
* item or the toolbar item it creates, this function returns an
* instance of that menu.
*
* Return value: the menu item provided by the action, or %NULL.
* Return value: (transfer full): the menu item provided by the action, or %NULL.
*
* Since: 2.12
*/
+1 -1
View File
@@ -478,7 +478,7 @@ gtk_activatable_do_set_related_action (GtkActivatable *activatable,
*
* Gets the related #GtkAction for @activatable.
*
* Returns: the related #GtkAction if one is set.
* Returns: (transfer none): the related #GtkAction if one is set.
*
* Since: 2.16
**/
+4
View File
@@ -41,6 +41,10 @@
* area. The values range from 0 (top or left) to 1 (bottom or right).
* Of course, if the scale settings are both set to 1, the alignment settings
* have no effect.
*
* Note that the desired effect can in most cases be achieved by using the
* #GtkWidget:halign, #GtkWidget:valign and #GtkWidget:margin properties
* on the child widget.
*/
#include "config.h"
+4 -4
View File
@@ -66,12 +66,12 @@ struct _GtkApplicationClass
GApplicationClass parent_class;
/*< vfuncs >*/
GtkWindow *(* create_window) (GtkApplication *application);
void (* activated) (GtkApplication *application,
GtkWindow *(* create_window) (GtkApplication *app);
void (* activated) (GtkApplication *app,
GVariant *args);
void (* action) (GtkApplication *application,
void (* action) (GtkApplication *app,
const gchar *action_name);
gboolean (* quit) (GtkApplication *application);
gboolean (* quit) (GtkApplication *app);
/* Padding for future expansion */
+6 -1
View File
@@ -44,7 +44,11 @@
*/
#include "config.h"
#include "gtkaspectframe.h"
#include "gtksizerequest.h"
#include "gtkprivate.h"
#include "gtkintl.h"
@@ -348,7 +352,8 @@ gtk_aspect_frame_compute_child_allocation (GtkFrame *frame,
{
GtkRequisition child_requisition;
gtk_widget_get_child_requisition (child, &child_requisition);
gtk_size_request_get_size (GTK_SIZE_REQUEST (child),
&child_requisition, NULL);
if (child_requisition.height != 0)
{
ratio = ((gdouble) child_requisition.width /
+29 -19
View File
@@ -58,6 +58,7 @@
#include "gtkimage.h"
#include "gtklabel.h"
#include "gtksizegroup.h"
#include "gtksizerequest.h"
#include "gtkstock.h"
#include "gtkintl.h"
@@ -1156,11 +1157,13 @@ gtk_assistant_size_request (GtkWidget *widget,
GtkAssistantPage *page = list->data;
gint w, h;
gtk_widget_size_request (page->page, &child_requisition);
gtk_size_request_get_size (GTK_SIZE_REQUEST (page->page),
&child_requisition, NULL);
width = MAX (width, child_requisition.width);
height = MAX (height, child_requisition.height);
gtk_widget_size_request (page->title, &child_requisition);
gtk_size_request_get_size (GTK_SIZE_REQUEST (page->title),
&child_requisition, NULL);
w = child_requisition.width;
h = child_requisition.height;
@@ -1176,16 +1179,19 @@ gtk_assistant_size_request (GtkWidget *widget,
list = list->next;
}
gtk_widget_size_request (priv->sidebar_image, &child_requisition);
gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->sidebar_image),
&child_requisition, NULL);
width += child_requisition.width;
height = MAX (height, child_requisition.height);
gtk_widget_set_size_request (priv->header_image, header_width, header_height);
gtk_widget_size_request (priv->header_image, &child_requisition);
gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->header_image),
&child_requisition, NULL);
width = MAX (width, header_width) + 2 * header_padding;
height += header_height + 2 * header_padding;
gtk_widget_size_request (priv->action_area, &child_requisition);
gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->action_area),
&child_requisition, NULL);
width = MAX (width, child_requisition.width);
height += child_requisition.height + ACTION_AREA_SPACING;
@@ -1224,7 +1230,8 @@ gtk_assistant_size_allocate (GtkWidget *widget,
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
/* Header */
gtk_widget_get_child_requisition (priv->header_image, &header_requisition);
gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->header_image),
&header_requisition, NULL);
header_allocation.x = border_width + header_padding;
header_allocation.y = border_width + header_padding;
@@ -1234,7 +1241,8 @@ gtk_assistant_size_allocate (GtkWidget *widget,
gtk_widget_size_allocate (priv->header_image, &header_allocation);
/* Action area */
gtk_widget_get_child_requisition (priv->action_area, &action_requisition);
gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->action_area),
&action_requisition, NULL);
child_allocation.x = border_width;
child_allocation.y = allocation->height - border_width - action_requisition.height;
@@ -1247,7 +1255,8 @@ gtk_assistant_size_allocate (GtkWidget *widget,
gtk_widget_get_allocation (priv->action_area, &action_area_allocation);
/* Sidebar */
gtk_widget_get_child_requisition (priv->sidebar_image, &sidebar_requisition);
gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->sidebar_image),
&sidebar_requisition, NULL);
if (rtl)
child_allocation.x = allocation->width - border_width - sidebar_requisition.width;
@@ -1677,7 +1686,8 @@ gtk_assistant_get_n_pages (GtkAssistant *assistant)
*
* Returns the child widget contained in page number @page_num.
*
* Return value: The child widget, or %NULL if @page_num is out of bounds.
* Return value: (transfer none): The child widget, or %NULL
* if @page_num is out of bounds.
*
* Since: 2.10
**/
@@ -2108,11 +2118,11 @@ gtk_assistant_set_page_header_image (GtkAssistant *assistant,
* gtk_assistant_get_page_header_image:
* @assistant: a #GtkAssistant
* @page: a page of @assistant
*
* Gets the header image for @page.
*
* Return value: the header image for @page, or %NULL
* if there's no header image for the page.
*
* Gets the header image for @page.
*
* Return value: (transfer none): the header image for @page, or %NULL
* if there's no header image for the page.
*
* Since: 2.10
**/
@@ -2188,11 +2198,11 @@ gtk_assistant_set_page_side_image (GtkAssistant *assistant,
* gtk_assistant_get_page_side_image:
* @assistant: a #GtkAssistant
* @page: a page of @assistant
*
* Gets the header image for @page.
*
* Return value: the side image for @page, or %NULL
* if there's no side image for the page.
*
* Gets the header image for @page.
*
* Return value: (transfer none): the side image for @page, or %NULL
* if there's no side image for the page.
*
* Since: 2.10
**/
+8 -2
View File
@@ -45,9 +45,13 @@
*/
#include "config.h"
#include "gtkbbox.h"
#include "gtkorientable.h"
#include "gtkprivate.h"
#include "gtksizerequest.h"
#include "gtkintl.h"
@@ -447,7 +451,8 @@ gtk_button_box_child_requisition (GtkWidget *widget,
if (gtk_widget_get_visible (child))
{
nchildren += 1;
gtk_widget_size_request (child, &child_requisition);
gtk_size_request_get_size (GTK_SIZE_REQUEST (child),
&child_requisition, NULL);
avg_w += child_requisition.width + ipad_w;
avg_h += child_requisition.height + ipad_h;
}
@@ -474,7 +479,8 @@ gtk_button_box_child_requisition (GtkWidget *widget,
if (is_secondary)
nsecondaries++;
gtk_widget_get_child_requisition (child, &child_requisition);
gtk_size_request_get_size (GTK_SIZE_REQUEST (child),
&child_requisition, NULL);
if (homogeneous || (child_requisition.width + ipad_w < avg_w * 1.5))
{
+8 -3
View File
@@ -214,10 +214,15 @@ get_child_padding_delta (GtkBin *bin,
gint *delta_v)
{
GtkBinPrivate *priv = bin->priv;
gint hmin, vmin, child_hmin, child_vmin;
gint hmin, vmin, hnat, vnat, child_hmin, child_vmin;
gtk_size_request_get_width (GTK_SIZE_REQUEST (bin), &hmin, NULL);
gtk_size_request_get_height (GTK_SIZE_REQUEST (bin), &vmin, NULL);
/* we can't use gtk_size_request_get_width() wrapper because we want
* our "original" request, not any external adjustments from
* set_size_request() or whatever. we have to ask for natural also
* because NULL isn't allowed for the direct vfuncs
*/
GTK_SIZE_REQUEST_GET_IFACE (bin)->get_width(GTK_SIZE_REQUEST (bin), &hmin, &hnat);
GTK_SIZE_REQUEST_GET_IFACE (bin)->get_height (GTK_SIZE_REQUEST (bin), &vmin, &vnat);
gtk_size_request_get_width (GTK_SIZE_REQUEST (priv->child), &child_hmin, NULL);
gtk_size_request_get_height (GTK_SIZE_REQUEST (priv->child), &child_vmin, NULL);
+18 -12
View File
@@ -769,7 +769,8 @@ gtk_binding_entry_remove (GtkBindingSet *binding_set,
* @keyval: key value
* @modifiers: key modifier
* @signal_name: signal name to be bound
* @binding_args: list of #GtkBindingArg signal arguments
* @binding_args: (transfer none) (element-type GtkBindingArg):
* list of #GtkBindingArg signal arguments
*
* Override or install a new key binding for @keyval with @modifiers on
* @binding_set.
@@ -1350,6 +1351,7 @@ gtk_binding_parse_signal (GScanner *scanner,
gboolean negate;
gboolean need_arg;
gboolean seen_comma;
guint token;
g_return_val_if_fail (scanner != NULL, G_TOKEN_ERROR);
@@ -1377,8 +1379,9 @@ gtk_binding_parse_signal (GScanner *scanner,
expected_token = G_TOKEN_INT;
else
expected_token = ')';
g_scanner_get_next_token (scanner);
switch (scanner->token)
token = g_scanner_get_next_token (scanner);
switch (token)
{
GtkBindingArg *arg;
@@ -1501,14 +1504,15 @@ gtk_binding_parse_bind (GScanner *scanner,
guint keyval = 0;
GdkModifierType modifiers = 0;
gboolean unbind = FALSE;
guint token;
g_return_val_if_fail (scanner != NULL, G_TOKEN_ERROR);
g_scanner_get_next_token (scanner);
if (scanner->token != GTK_RC_TOKEN_BIND &&
scanner->token != GTK_RC_TOKEN_UNBIND)
token = g_scanner_get_next_token (scanner);
if (token != GTK_RC_TOKEN_BIND &&
token != GTK_RC_TOKEN_UNBIND)
return GTK_RC_TOKEN_BIND;
unbind = scanner->token == GTK_RC_TOKEN_UNBIND;
unbind = token == GTK_RC_TOKEN_UNBIND;
g_scanner_get_next_token (scanner);
if (scanner->token != G_TOKEN_STRING)
return G_TOKEN_STRING;
@@ -1559,13 +1563,14 @@ gtk_binding_parse_bind (GScanner *scanner,
guint
_gtk_binding_parse_binding (GScanner *scanner)
{
gchar *name;
GtkBindingSet *binding_set;
gchar *name;
guint token;
g_return_val_if_fail (scanner != NULL, G_TOKEN_ERROR);
g_scanner_get_next_token (scanner);
if (scanner->token != GTK_RC_TOKEN_BINDING)
token = g_scanner_get_next_token (scanner);
if (token != GTK_RC_TOKEN_BINDING)
return GTK_RC_TOKEN_BINDING;
g_scanner_get_next_token (scanner);
if (scanner->token != G_TOKEN_STRING)
@@ -1590,7 +1595,8 @@ _gtk_binding_parse_binding (GScanner *scanner)
g_scanner_peek_next_token (scanner);
while (scanner->next_token != '}')
{
switch (scanner->next_token)
guint next_token = scanner->next_token;
switch (next_token)
{
guint expected_token;
+93 -44
View File
@@ -141,6 +141,10 @@ struct _GtkBoxChild
static void gtk_box_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static void gtk_box_compute_expand (GtkWidget *widget,
gboolean *hexpand,
gboolean *vexpand);
static void gtk_box_set_property (GObject *object,
guint prop_id,
const GValue *value,
@@ -149,7 +153,6 @@ static void gtk_box_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
static void gtk_box_add (GtkContainer *container,
GtkWidget *widget);
static void gtk_box_remove (GtkContainer *container,
@@ -207,6 +210,7 @@ gtk_box_class_init (GtkBoxClass *class)
object_class->get_property = gtk_box_get_property;
widget_class->size_allocate = gtk_box_size_allocate;
widget_class->compute_expand = gtk_box_compute_expand;
container_class->add = gtk_box_add;
container_class->remove = gtk_box_remove;
@@ -214,6 +218,7 @@ gtk_box_class_init (GtkBoxClass *class)
container_class->child_type = gtk_box_child_type;
container_class->set_child_property = gtk_box_set_child_property;
container_class->get_child_property = gtk_box_get_child_property;
gtk_container_class_handle_border_width (container_class);
g_object_class_override_property (object_class,
PROP_ORIENTATION,
@@ -390,7 +395,7 @@ count_expand_children (GtkBox *box,
if (gtk_widget_get_visible (child->widget))
{
*visible_children += 1;
if (child->expand)
if (child->expand || gtk_widget_compute_expand (child->widget, private->orientation))
*expand_children += 1;
}
}
@@ -407,7 +412,6 @@ gtk_box_size_allocate (GtkWidget *widget,
gint nvis_children;
gint nexpand_children;
guint border_width;
GtkTextDirection direction;
GtkAllocation child_allocation;
GtkRequestedSize *sizes;
@@ -429,14 +433,13 @@ gtk_box_size_allocate (GtkWidget *widget,
if (nvis_children <= 0)
return;
border_width = gtk_container_get_border_width (GTK_CONTAINER (box));
direction = gtk_widget_get_direction (widget);
sizes = g_newa (GtkRequestedSize, nvis_children);
if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
size = allocation->width - border_width * 2 - (nvis_children - 1) * private->spacing;
size = allocation->width - (nvis_children - 1) * private->spacing;
else
size = allocation->height - border_width * 2 - (nvis_children - 1) * private->spacing;
size = allocation->height - (nvis_children - 1) * private->spacing;
/* Retrieve desired size for visible children. */
for (i = 0, children = private->children; children; children = children->next)
@@ -490,9 +493,9 @@ gtk_box_size_allocate (GtkWidget *widget,
* minimum sizes for children that are not going to fill
*/
if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
size = allocation->width - border_width * 2 - (nvis_children - 1) * private->spacing;
size = allocation->width - (nvis_children - 1) * private->spacing;
else
size = allocation->height - border_width * 2 - (nvis_children - 1) * private->spacing;
size = allocation->height - (nvis_children - 1) * private->spacing;
extra = size / nvis_children;
n_extra_widgets = size % nvis_children;
@@ -519,21 +522,21 @@ gtk_box_size_allocate (GtkWidget *widget,
{
if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
{
child_allocation.y = allocation->y + border_width;
child_allocation.height = MAX (1, allocation->height - border_width * 2);
child_allocation.y = allocation->y;
child_allocation.height = MAX (1, allocation->height);
if (packing == GTK_PACK_START)
x = allocation->x + border_width;
x = allocation->x;
else
x = allocation->x + allocation->width - border_width;
x = allocation->x + allocation->width;
}
else
{
child_allocation.x = allocation->x + border_width;
child_allocation.width = MAX (1, allocation->width - border_width * 2);
child_allocation.x = allocation->x;
child_allocation.width = MAX (1, allocation->width);
if (packing == GTK_PACK_START)
y = allocation->y + border_width;
y = allocation->y;
else
y = allocation->y + allocation->height - border_width;
y = allocation->y + allocation->height;
}
for (i = 0, children = private->children;
@@ -570,7 +573,7 @@ gtk_box_size_allocate (GtkWidget *widget,
{
child_size = sizes[i].minimum_size + child->padding * 2;
if (child->expand)
if (child->expand || gtk_widget_compute_expand (child->widget, private->orientation))
{
child_size += extra;
@@ -642,6 +645,56 @@ gtk_box_size_allocate (GtkWidget *widget,
}
}
static void
gtk_box_compute_expand (GtkWidget *widget,
gboolean *hexpand_p,
gboolean *vexpand_p)
{
GtkBoxPrivate *private = GTK_BOX (widget)->priv;
GList *children;
GtkBoxChild *child;
gboolean our_expand;
gboolean opposite_expand;
GtkOrientation opposite_orientation;
if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
opposite_orientation = GTK_ORIENTATION_VERTICAL;
else
opposite_orientation = GTK_ORIENTATION_HORIZONTAL;
our_expand = FALSE;
opposite_expand = FALSE;
for (children = private->children; children; children = children->next)
{
child = children->data;
/* we don't recurse into children anymore as soon as we know
* expand=TRUE in an orientation
*/
if (child->expand || (!our_expand && gtk_widget_compute_expand (child->widget, private->orientation)))
our_expand = TRUE;
if (!opposite_expand && gtk_widget_compute_expand (child->widget, opposite_orientation))
opposite_expand = TRUE;
if (our_expand && opposite_expand)
break;
}
if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
{
*hexpand_p = our_expand;
*vexpand_p = opposite_expand;
}
else
{
*hexpand_p = opposite_expand;
*vexpand_p = our_expand;
}
}
static GType
gtk_box_child_type (GtkContainer *container)
{
@@ -834,12 +887,10 @@ gtk_box_get_size (GtkSizeRequest *widget,
GtkBoxPrivate *private;
GList *children;
gint nvis_children;
gint border_width;
gint minimum, natural;
box = GTK_BOX (widget);
private = box->priv;
border_width = gtk_container_get_border_width (GTK_CONTAINER (box));
minimum = natural = 0;
@@ -900,9 +951,6 @@ gtk_box_get_size (GtkSizeRequest *widget,
natural += (nvis_children - 1) * private->spacing;
}
minimum += border_width * 2;
natural += border_width * 2;
if (minimum_size)
*minimum_size = minimum;
@@ -938,7 +986,6 @@ gtk_box_compute_size_for_opposing_orientation (GtkBox *box,
gint nvis_children;
gint nexpand_children;
gint computed_minimum = 0, computed_natural = 0;
guint border_width = gtk_container_get_border_width (GTK_CONTAINER (box));
GtkRequestedSize *sizes;
GtkPackType packing;
gint size, extra, i;
@@ -951,7 +998,7 @@ gtk_box_compute_size_for_opposing_orientation (GtkBox *box,
return;
sizes = g_newa (GtkRequestedSize, nvis_children);
size = avail_size - border_width * 2 - (nvis_children - 1) * private->spacing;
size = avail_size - (nvis_children - 1) * private->spacing;
/* Retrieve desired size for visible children */
for (i = 0, children = private->children; children; children = children->next)
@@ -997,7 +1044,7 @@ gtk_box_compute_size_for_opposing_orientation (GtkBox *box,
/* If were homogenous we still need to run the above loop to get the
* minimum sizes for children that are not going to fill
*/
size = avail_size - border_width * 2 - (nvis_children - 1) * private->spacing;
size = avail_size - (nvis_children - 1) * private->spacing;
extra = size / nvis_children;
n_extra_widgets = size % nvis_children;
}
@@ -1057,7 +1104,7 @@ gtk_box_compute_size_for_opposing_orientation (GtkBox *box,
{
child_size = sizes[i].minimum_size + child->padding * 2;
if (child->expand)
if (child->expand || gtk_widget_compute_expand (child->widget, private->orientation))
{
child_size += extra;
@@ -1095,16 +1142,13 @@ gtk_box_compute_size_for_opposing_orientation (GtkBox *box,
}
}
computed_minimum += border_width * 2;
computed_natural += border_width * 2;
if (minimum_size)
*minimum_size = computed_minimum;
if (natural_size)
*natural_size = computed_natural;
}
}
static void
static void
gtk_box_compute_size_for_orientation (GtkBox *box,
gint avail_size,
gint *minimum_size,
@@ -1115,12 +1159,8 @@ gtk_box_compute_size_for_orientation (GtkBox *box,
gint nvis_children = 0;
gint required_size = 0, required_natural = 0, child_size, child_natural;
gint largest_child = 0, largest_natural = 0;
guint border_width;
border_width = gtk_container_get_border_width (GTK_CONTAINER (box));
avail_size -= border_width * 2;
for (children = private->children; children != NULL;
for (children = private->children; children != NULL;
children = children->next, nvis_children++)
{
GtkBoxChild *child = children->data;
@@ -1162,9 +1202,6 @@ gtk_box_compute_size_for_orientation (GtkBox *box,
required_natural += (nvis_children - 1) * private->spacing;
}
required_size += border_width * 2;
required_natural += border_width * 2;
if (minimum_size)
*minimum_size = required_size;
@@ -1172,7 +1209,7 @@ gtk_box_compute_size_for_orientation (GtkBox *box,
*natural_size = required_natural;
}
static void
static void
gtk_box_get_width_for_height (GtkSizeRequest *widget,
gint height,
gint *minimum_width,
@@ -1182,12 +1219,12 @@ gtk_box_get_width_for_height (GtkSizeRequest *widget,
GtkBoxPrivate *private = box->priv;
if (private->orientation == GTK_ORIENTATION_VERTICAL)
gtk_box_compute_size_for_opposing_orientation (box, height, minimum_width, natural_width);
gtk_box_compute_size_for_opposing_orientation (box, height, minimum_width, natural_width);
else
gtk_box_compute_size_for_orientation (box, height, minimum_width, natural_width);
}
static void
static void
gtk_box_get_height_for_width (GtkSizeRequest *widget,
gint width,
gint *minimum_height,
@@ -1564,8 +1601,20 @@ gtk_box_set_child_packing (GtkBox *box,
gtk_widget_freeze_child_notify (child);
if (list)
{
child_info->expand = expand != FALSE;
gtk_widget_child_notify (child, "expand");
gboolean expanded;
expanded = expand != FALSE;
/* avoid setting expand if unchanged, since queue_compute_expand
* can be expensive-ish
*/
if (child_info->expand != expanded)
{
child_info->expand = expand != FALSE;
gtk_widget_queue_compute_expand (GTK_WIDGET (box));
gtk_widget_child_notify (child, "expand");
}
child_info->fill = fill != FALSE;
gtk_widget_child_notify (child, "fill");
child_info->padding = padding;
+3 -3
View File
@@ -204,12 +204,12 @@ gtk_buildable_parser_finished (GtkBuildable *buildable,
* @builder: #GtkBuilder used to construct this object
* @name: name of child to construct
*
* Constructs a child of @buildable with the name @name.
* Constructs a child of @buildable with the name @name.
*
* #GtkBuilder calls this function if a "constructor" has been
* specified in the UI definition.
*
* Returns: the constructed child
* Returns: (transfer full): the constructed child
*
* Since: 2.12
**/
@@ -337,7 +337,7 @@ gtk_buildable_custom_finished (GtkBuildable *buildable,
*
* Get the internal child called @childname of the @buildable object.
*
* Returns: the internal child of the buildable object
* Returns: (transfer none): the internal child of the buildable object
*
* Since: 2.12
**/
+1 -1
View File
@@ -1028,7 +1028,7 @@ gtk_builder_add_from_string (GtkBuilder *builder,
* @builder: a #GtkBuilder
* @buffer: the string to parse
* @length: the length of @buffer (may be -1 if @buffer is nul-terminated)
* @object_ids: (array zero-teminated=1) (element-type utf8): nul-terminated array of objects to build
* @object_ids: (array zero-terminated=1) (element-type utf8): nul-terminated array of objects to build
* @error: (allow-none): return location for an error, or %NULL
*
* Parses a string containing a <link linkend="BUILDER-UI">GtkBuilder
+20 -30
View File
@@ -227,6 +227,7 @@ gtk_button_class_init (GtkButtonClass *klass)
container_class->child_type = gtk_button_child_type;
container_class->add = gtk_button_add;
gtk_container_class_handle_border_width (container_class);
klass->pressed = gtk_real_button_pressed;
klass->released = gtk_real_button_released;
@@ -1284,19 +1285,16 @@ gtk_button_realize (GtkWidget *widget)
GdkWindow *window;
GdkWindowAttr attributes;
gint attributes_mask;
gint border_width;
gtk_widget_get_allocation (widget, &allocation);
gtk_widget_set_realized (widget, TRUE);
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
attributes.window_type = GDK_WINDOW_CHILD;
attributes.x = allocation.x + border_width;
attributes.y = allocation.y + border_width;
attributes.width = allocation.width - border_width * 2;
attributes.height = allocation.height - border_width * 2;
attributes.x = allocation.x;
attributes.y = allocation.y;
attributes.width = allocation.width;
attributes.height = allocation.height;
attributes.wclass = GDK_INPUT_ONLY;
attributes.event_mask = gtk_widget_get_events (widget);
attributes.event_mask |= (GDK_BUTTON_PRESS_MASK |
@@ -1455,7 +1453,6 @@ gtk_button_size_allocate (GtkWidget *widget,
GtkStyle *style;
GtkWidget *child;
guint border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
gint xthickness, ythickness;
GtkBorder default_border;
GtkBorder inner_border;
@@ -1476,30 +1473,28 @@ gtk_button_size_allocate (GtkWidget *widget,
if (gtk_widget_get_realized (widget))
gdk_window_move_resize (button->event_window,
allocation->x + border_width,
allocation->y + border_width,
allocation->width - border_width * 2,
allocation->height - border_width * 2);
allocation->x,
allocation->y,
allocation->width,
allocation->height);
child = gtk_bin_get_child (GTK_BIN (button));
if (child && gtk_widget_get_visible (child))
{
child_allocation.x = allocation->x + border_width + inner_border.left + xthickness;
child_allocation.y = allocation->y + border_width + inner_border.top + ythickness;
child_allocation.x = allocation->x + inner_border.left + xthickness;
child_allocation.y = allocation->y + inner_border.top + ythickness;
child_allocation.width =
allocation->width -
xthickness * 2 -
inner_border.left -
inner_border.right -
border_width * 2;
inner_border.right;
child_allocation.height =
allocation->height -
ythickness * 2 -
inner_border.top -
inner_border.bottom -
border_width * 2;
inner_border.bottom;
if (gtk_widget_get_can_default (GTK_WIDGET (button)))
{
@@ -1548,7 +1543,6 @@ _gtk_button_paint (GtkButton *button,
GtkWidget *widget;
gint width, height;
gint x, y;
gint border_width;
GtkBorder default_border;
GtkBorder default_outside_border;
gboolean interior_focus;
@@ -1563,8 +1557,6 @@ _gtk_button_paint (GtkButton *button,
GdkWindow *window;
GtkStyle *style;
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
gtk_button_get_props (button, &default_border, &default_outside_border, NULL, &interior_focus);
gtk_widget_style_get (widget,
"focus-line-width", &focus_width,
@@ -1575,10 +1567,10 @@ _gtk_button_paint (GtkButton *button,
style = gtk_widget_get_style (widget);
window = gtk_widget_get_window (widget);
x = allocation.x + border_width;
y = allocation.y + border_width;
width = allocation.width - border_width * 2;
height = allocation.height - border_width * 2;
x = allocation.x;
y = allocation.y;
width = allocation.width;
height = allocation.height;
if (gtk_widget_has_default (widget) &&
GTK_BUTTON (widget)->relief == GTK_RELIEF_NORMAL)
@@ -1925,7 +1917,6 @@ gtk_button_get_size (GtkSizeRequest *widget,
gint focus_width;
gint focus_pad;
gint minimum, natural;
guint border_width;
gtk_button_get_props (button, &default_border, NULL, &inner_border, NULL);
gtk_widget_style_get (GTK_WIDGET (widget),
@@ -1933,12 +1924,11 @@ gtk_button_get_size (GtkSizeRequest *widget,
"focus-padding", &focus_pad,
NULL);
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
style = gtk_widget_get_style (GTK_WIDGET (widget));
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
minimum = ((border_width + style->xthickness) * 2 +
minimum = (style->xthickness * 2 +
inner_border.left + inner_border.right);
if (gtk_widget_get_can_default (GTK_WIDGET (widget)))
@@ -1946,7 +1936,7 @@ gtk_button_get_size (GtkSizeRequest *widget,
}
else
{
minimum = ((border_width + style->ythickness) * 2 +
minimum = (style->ythickness * 2 +
inner_border.top + inner_border.bottom);
if (gtk_widget_get_can_default (GTK_WIDGET (widget)))
@@ -2453,7 +2443,7 @@ gtk_button_set_image (GtkButton *button,
* This may have been explicitly set by gtk_button_set_image()
* or constructed by gtk_button_new_from_stock().
*
* Return value: a #GtkWidget or %NULL in case there is no image
* Return value: (transfer none): a #GtkWidget or %NULL in case there is no image
*
* Since: 2.6
*/
+4 -4
View File
@@ -719,15 +719,15 @@ gtk_cell_renderer_activate (GtkCellRenderer *cell,
* @cell: a #GtkCellRenderer
* @event: a #GdkEvent
* @widget: widget that received the event
* @path: widget-dependent string representation of the event location;
* @path: widget-dependent string representation of the event location;
* e.g. for #GtkTreeView, a string representation of #GtkTreePath
* @background_area: background area as passed to gtk_cell_renderer_render()
* @cell_area: cell area as passed to gtk_cell_renderer_render()
* @flags: render flags
*
*
* Passes an activate event to the cell renderer for possible processing.
*
* Return value: A new #GtkCellEditable, or %NULL
*
* Return value: (transfer full): A new #GtkCellEditable, or %NULL
**/
GtkCellEditable *
gtk_cell_renderer_start_editing (GtkCellRenderer *cell,
+2
View File
@@ -111,6 +111,7 @@ struct _GtkCellRendererClass
GType gtk_cell_renderer_get_type (void) G_GNUC_CONST;
#ifndef GTK_DISABLE_DEPRECATED
void gtk_cell_renderer_get_size (GtkCellRenderer *cell,
GtkWidget *widget,
const GdkRectangle *cell_area,
@@ -118,6 +119,7 @@ void gtk_cell_renderer_get_size (GtkCellRenderer *cell,
gint *y_offset,
gint *width,
gint *height);
#endif
void gtk_cell_renderer_render (GtkCellRenderer *cell,
GdkWindow *window,
GtkWidget *widget,
+8 -3
View File
@@ -18,15 +18,19 @@
*/
#include "config.h"
#include "gtkcellrendereraccel.h"
#include "gdk/gdkkeysyms.h"
#include "gtkintl.h"
#include "gtkaccelgroup.h"
#include "gtkmarshalers.h"
#include "gtkcellrendereraccel.h"
#include "gtklabel.h"
#include "gtkeventbox.h"
#include "gtkmain.h"
#include "gtksizerequest.h"
#include "gtkprivate.h"
#include "gdk/gdkkeysyms.h"
static void gtk_cell_renderer_accel_get_property (GObject *object,
@@ -413,7 +417,8 @@ gtk_cell_renderer_accel_get_size (GtkCellRenderer *cell,
if (priv->sizing_label == NULL)
priv->sizing_label = gtk_label_new (_("New accelerator..."));
gtk_widget_size_request (priv->sizing_label, &requisition);
gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->sizing_label),
&requisition, NULL);
GTK_CELL_RENDERER_CLASS (gtk_cell_renderer_accel_parent_class)->get_size (cell, widget, cell_area,
x_offset, y_offset, width, height);
+8 -3
View File
@@ -18,11 +18,15 @@
*/
#include "config.h"
#include <stdlib.h>
#include "gtkcellrenderertext.h"
#include <stdlib.h>
#include "gtkeditable.h"
#include "gtkcellsizerequest.h"
#include "gtkentry.h"
#include "gtksizerequest.h"
#include "gtkmarshalers.h"
#include "gtkintl.h"
#include "gtkprivate.h"
@@ -1928,8 +1932,9 @@ gtk_cell_renderer_text_start_editing (GtkCellRenderer *cell,
g_object_set_data_full (G_OBJECT (priv->entry), I_(GTK_CELL_RENDERER_TEXT_PATH), g_strdup (path), g_free);
gtk_editable_select_region (GTK_EDITABLE (priv->entry), 0, -1);
gtk_widget_size_request (priv->entry, &requisition);
gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->entry),
&requisition, NULL);
if (requisition.height < cell_area->height)
{
GtkBorder *style_border;
-2
View File
@@ -266,8 +266,6 @@ gtk_cell_size_request_get_height_for_width (GtkCellSizeRequest *cell,
* gtk_cell_size_request_get_size:
* @cell: a #GtkCellSizeRequest instance
* @widget: the #GtkWidget this cell will be rendering to
* @request_natural: Whether to base the contextual request off of the
* base natural or the base minimum
* @minimum_size: (out) (allow-none): location for storing the minimum size, or %NULL
* @natural_size: (out) (allow-none): location for storing the natural size, or %NULL
*
+1 -1
View File
@@ -923,7 +923,7 @@ gtk_cell_view_set_model (GtkCellView *cell_view,
* Returns the model for @cell_view. If no model is used %NULL is
* returned.
*
* Returns: a #GtkTreeModel used or %NULL
* Returns: (transfer none): a #GtkTreeModel used or %NULL
*
* Since: 2.16
**/
+2
View File
@@ -66,9 +66,11 @@ GtkTreeModel *gtk_cell_view_get_model (GtkCellView *cell_v
void gtk_cell_view_set_displayed_row (GtkCellView *cell_view,
GtkTreePath *path);
GtkTreePath *gtk_cell_view_get_displayed_row (GtkCellView *cell_view);
#ifndef GTK_DISABLE_DEPRECATED
gboolean gtk_cell_view_get_size_of_row (GtkCellView *cell_view,
GtkTreePath *path,
GtkRequisition *requisition);
#endif
void gtk_cell_view_get_desired_width_of_row(GtkCellView *cell_view,
GtkTreePath *path,
gint *minimum_size,
+10 -4
View File
@@ -25,8 +25,12 @@
*/
#include "config.h"
#include "gtkcheckbutton.h"
#include "gtklabel.h"
#include "gtksizerequest.h"
#include "gtkprivate.h"
#include "gtkintl.h"
@@ -234,8 +238,9 @@ gtk_check_button_size_request (GtkWidget *widget,
if (child && gtk_widget_get_visible (child))
{
GtkRequisition child_requisition;
gtk_widget_size_request (child, &child_requisition);
gtk_size_request_get_size (GTK_SIZE_REQUEST (child),
&child_requisition, NULL);
requisition->width += child_requisition.width + indicator_spacing;
requisition->height += child_requisition.height;
@@ -290,8 +295,9 @@ gtk_check_button_size_allocate (GtkWidget *widget,
GtkRequisition child_requisition;
guint border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
gtk_widget_get_child_requisition (child, &child_requisition);
gtk_size_request_get_size (GTK_SIZE_REQUEST (child),
&child_requisition, NULL);
child_allocation.width = MIN (child_requisition.width,
allocation->width -
((border_width + focus_width + focus_pad) * 2
+76 -78
View File
@@ -563,22 +563,23 @@ gtk_clipboard_set_contents (GtkClipboard *clipboard,
/**
* gtk_clipboard_set_with_data:
* @clipboard: a #GtkClipboard
* @targets: array containing information about the available forms for the
* clipboard data
* @n_targets: number of elements in @targets
* @get_func: function to call to get the actual clipboard data
* @clear_func: when the clipboard contents are set again, this function will
* be called, and @get_func will not be subsequently called.
* @user_data: user data to pass to @get_func and @clear_func.
*
* @clipboard: a #GtkClipboard
* @targets: array containing information about the available forms for the
* clipboard data
* @n_targets: number of elements in @targets
* @get_func: (scope async): function to call to get the actual clipboard data
* @clear_func: (scope async): when the clipboard contents are set again,
* this function will be called, and @get_func will not be subsequently
* called.
* @user_data: user data to pass to @get_func and @clear_func.
*
* Virtually sets the contents of the specified clipboard by providing
* a list of supported formats for the clipboard data and a function
* to call to get the actual data when it is requested.
*
* Return value: %TRUE if setting the clipboard data succeeded. If setting
* the clipboard data failed the provided callback functions
* will be ignored.
*
* Return value: %TRUE if setting the clipboard data succeeded.
* If setting the clipboard data failed the provided callback
* functions will be ignored.
**/
gboolean
gtk_clipboard_set_with_data (GtkClipboard *clipboard,
@@ -599,27 +600,28 @@ gtk_clipboard_set_with_data (GtkClipboard *clipboard,
/**
* gtk_clipboard_set_with_owner:
* @clipboard: a #GtkClipboard
* @targets: array containing information about the available forms for the
* clipboard data
* @n_targets: number of elements in @targets
* @get_func: function to call to get the actual clipboard data
* @clear_func: when the clipboard contents are set again, this function will
* be called, and @get_func will not be subsequently called.
* @owner: an object that "owns" the data. This object will be passed
* to the callbacks when called.
*
* @clipboard: a #GtkClipboard
* @targets: array containing information about the available forms for
* the clipboard data
* @n_targets: number of elements in @targets
* @get_func: (scope async): function to call to get the actual clipboard data
* @clear_func: (scope async): when the clipboard contents are set again,
* this function will be called, and @get_func will not be subsequently
* called
* @owner: an object that "owns" the data. This object will be passed
* to the callbacks when called
*
* Virtually sets the contents of the specified clipboard by providing
* a list of supported formats for the clipboard data and a function
* to call to get the actual data when it is requested.
*
* The difference between this function and gtk_clipboard_set_with_data()
* is that instead of an generic @user_data pointer, a #GObject is passed
* in.
*
* Return value: %TRUE if setting the clipboard data succeeded. If setting
* the clipboard data failed the provided callback functions
* will be ignored.
* in.
*
* Return value: %TRUE if setting the clipboard data succeeded.
* If setting the clipboard data failed the provided callback
* functions will be ignored.
**/
gboolean
gtk_clipboard_set_with_owner (GtkClipboard *clipboard,
@@ -642,13 +644,14 @@ gtk_clipboard_set_with_owner (GtkClipboard *clipboard,
/**
* gtk_clipboard_get_owner:
* @clipboard: a #GtkClipboard
*
* If the clipboard contents callbacks were set with
* gtk_clipboard_set_with_owner(), and the gtk_clipboard_set_with_data() or
* gtk_clipboard_clear() has not subsequently called, returns the owner set
*
* If the clipboard contents callbacks were set with
* gtk_clipboard_set_with_owner(), and the gtk_clipboard_set_with_data() or
* gtk_clipboard_clear() has not subsequently called, returns the owner set
* by gtk_clipboard_set_with_owner().
*
* Return value: the owner of the clipboard, if any; otherwise %NULL.
*
* Return value: (transfer none): the owner of the clipboard, if any;
* otherwise %NULL.
**/
GObject *
gtk_clipboard_get_owner (GtkClipboard *clipboard)
@@ -874,14 +877,13 @@ selection_received (GtkWidget *widget,
/**
* gtk_clipboard_request_contents:
* @clipboard: a #GtkClipboard
* @target: an atom representing the form into which the clipboard
* owner should convert the selection.
* @callback: A function to call when the results are received
* (or the retrieval fails). If the retrieval fails
* the length field of @selection_data will be
* negative.
* @target: an atom representing the form into which the clipboard
* owner should convert the selection.
* @callback: (scope async): A function to call when the results are received
* (or the retrieval fails). If the retrieval fails the length field of
* @selection_data will be negative.
* @user_data: user data to pass to @callback
*
*
* Requests the contents of clipboard as the given target.
* When the results of the result are later received the supplied callback
* will be called.
@@ -957,14 +959,13 @@ request_text_received_func (GtkClipboard *clipboard,
/**
* gtk_clipboard_request_text:
* @clipboard: a #GtkClipboard
* @callback: a function to call when the text is received,
* or the retrieval fails. (It will always be called
* one way or the other.)
* @callback: (scope async): a function to call when the text is received,
* or the retrieval fails. (It will always be called one way or the other.)
* @user_data: user data to pass to @callback.
*
*
* Requests the contents of the clipboard as text. When the text is
* later received, it will be converted to UTF-8 if necessary, and
* @callback will be called.
* @callback will be called.
*
* The @text parameter to @callback will contain the resulting text if
* the request succeeded, or %NULL if it failed. This could happen for
@@ -1021,10 +1022,9 @@ request_rich_text_received_func (GtkClipboard *clipboard,
/**
* gtk_clipboard_request_rich_text:
* @clipboard: a #GtkClipboard
* @buffer: a #GtkTextBuffer
* @callback: a function to call when the text is received,
* or the retrieval fails. (It will always be called
* one way or the other.)
* @buffer: a #GtkTextBuffer
* @callback: (scope async): a function to call when the text is received,
* or the retrieval fails. (It will always be called one way or the other.)
* @user_data: user data to pass to @callback.
*
* Requests the contents of the clipboard as rich text. When the rich
@@ -1114,19 +1114,18 @@ request_image_received_func (GtkClipboard *clipboard,
/**
* gtk_clipboard_request_image:
* @clipboard: a #GtkClipboard
* @callback: a function to call when the image is received,
* or the retrieval fails. (It will always be called
* one way or the other.)
* @callback: (scope async): a function to call when the image is received,
* or the retrieval fails. (It will always be called one way or the other.)
* @user_data: user data to pass to @callback.
*
*
* Requests the contents of the clipboard as image. When the image is
* later received, it will be converted to a #GdkPixbuf, and
* @callback will be called.
* @callback will be called.
*
* The @pixbuf parameter to @callback will contain the resulting
* #GdkPixbuf if the request succeeded, or %NULL if it failed. This
* could happen for various reasons, in particular if the clipboard
* was empty or if the contents of the clipboard could not be
* The @pixbuf parameter to @callback will contain the resulting
* #GdkPixbuf if the request succeeded, or %NULL if it failed. This
* could happen for various reasons, in particular if the clipboard
* was empty or if the contents of the clipboard could not be
* converted into an image.
*
* Since: 2.6
@@ -1169,11 +1168,10 @@ request_uris_received_func (GtkClipboard *clipboard,
/**
* gtk_clipboard_request_uris:
* @clipboard: a #GtkClipboard
* @callback: a function to call when the URIs are received,
* or the retrieval fails. (It will always be called
* one way or the other.)
* @callback: (scope async): a function to call when the URIs are received,
* or the retrieval fails. (It will always be called one way or the other.)
* @user_data: user data to pass to @callback.
*
*
* Requests the contents of the clipboard as URIs. When the URIs are
* later received @callback will be called.
*
@@ -1223,13 +1221,13 @@ request_targets_received_func (GtkClipboard *clipboard,
/**
* gtk_clipboard_request_targets:
* @clipboard: a #GtkClipboard
* @callback: a function to call when the targets are received,
* or the retrieval fails. (It will always be called
* one way or the other.)
* @callback: (scope async): a function to call when the targets are
* received, or the retrieval fails. (It will always be called
* one way or the other.)
* @user_data: user data to pass to @callback.
*
* Requests the contents of the clipboard as list of supported targets.
* When the list is later received, @callback will be called.
*
* Requests the contents of the clipboard as list of supported targets.
* When the list is later received, @callback will be called.
*
* The @targets parameter to @callback will contain the resulting targets if
* the request succeeded, or %NULL if it failed.
@@ -1466,18 +1464,18 @@ clipboard_image_received_func (GtkClipboard *clipboard,
/**
* gtk_clipboard_wait_for_image:
* @clipboard: a #GtkClipboard
*
*
* Requests the contents of the clipboard as image and converts
* the result to a #GdkPixbuf. This function waits for
* the data to be received using the main loop, so events,
* timeouts, etc, may be dispatched during the wait.
*
* Return value: a newly-allocated #GdkPixbuf object which must
* be disposed with g_object_unref(), or %NULL if
* retrieving the selection data failed. (This
* could happen for various reasons, in particular
* if the clipboard was empty or if the contents of
* the clipboard could not be converted into an image.)
*
* Return value: (transfer full): a newly-allocated #GdkPixbuf
* object which must be disposed with g_object_unref(), or
* %NULL if retrieving the selection data failed. (This could
* happen for various reasons, in particular if the clipboard
* was empty or if the contents of the clipboard could not be
* converted into an image.)
*
* Since: 2.6
**/
@@ -1568,7 +1566,7 @@ gtk_clipboard_wait_for_uris (GtkClipboard *clipboard)
*
* Gets the #GdkDisplay associated with @clipboard
*
* Return value: the #GdkDisplay associated with @clipboard
* Return value: (transfer none): the #GdkDisplay associated with @clipboard
*
* Since: 2.2
**/
+6 -2
View File
@@ -26,12 +26,14 @@
*/
#include "config.h"
#include "gtkcolorsel.h"
#include <math.h>
#include <string.h>
#include "gdkconfig.h"
#include "gdk/gdkkeysyms.h"
#include "gtkcolorsel.h"
#include "gtkhsv.h"
#include "gtkwindow.h"
#include "gtkselection.h"
@@ -57,6 +59,7 @@
#include "gtksettings.h"
#include "gtkstock.h"
#include "gtkaccessible.h"
#include "gtksizerequest.h"
#include "gtkprivate.h"
#include "gtkintl.h"
@@ -1357,7 +1360,8 @@ popup_position_func (GtkMenu *menu,
gdk_window_get_origin (gtk_widget_get_window (widget),
&root_x, &root_y);
gtk_widget_size_request (GTK_WIDGET (menu), &req);
gtk_size_request_get_size (GTK_SIZE_REQUEST (menu),
&req, NULL);
gtk_widget_get_allocation (widget, &allocation);
/* Put corner of menu centered on color cell */
+1 -1
View File
@@ -210,7 +210,7 @@ gtk_color_selection_dialog_new (const gchar *title)
*
* Retrieves the #GtkColorSelection widget embedded in the dialog.
*
* Returns: the embedded #GtkColorSelection
* Returns: (transfer none): the embedded #GtkColorSelection
*
* Since: 2.14
**/
+22 -13
View File
@@ -1529,7 +1529,8 @@ gtk_combo_box_menu_position_below (GtkMenu *menu,
if (GTK_SHADOW_NONE != combo_box->priv->shadow_type)
sx -= gtk_widget_get_style (GTK_WIDGET (combo_box))->xthickness;
gtk_widget_size_request (GTK_WIDGET (menu), &req);
gtk_size_request_get_size (GTK_SIZE_REQUEST (menu),
&req, NULL);
if (gtk_widget_get_direction (GTK_WIDGET (combo_box)) == GTK_TEXT_DIR_LTR)
*x = sx;
@@ -1705,14 +1706,16 @@ gtk_combo_box_list_position (GtkComboBox *combo_box,
hpolicy = vpolicy = GTK_POLICY_NEVER;
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->scrolled_window),
hpolicy, vpolicy);
gtk_widget_size_request (priv->scrolled_window, &popup_req);
gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->scrolled_window),
&popup_req, NULL);
if (popup_req.width > *width)
{
hpolicy = GTK_POLICY_ALWAYS;
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->scrolled_window),
hpolicy, vpolicy);
gtk_widget_size_request (priv->scrolled_window, &popup_req);
gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->scrolled_window),
&popup_req, NULL);
}
*height = popup_req.height;
@@ -2168,7 +2171,8 @@ gtk_combo_box_update_requested_width (GtkComboBox *combo_box,
}
#define GTK_COMBO_BOX_SIZE_ALLOCATE_BUTTON \
gtk_widget_size_request (combo_box->priv->button, &req); \
gtk_size_request_get_size (GTK_SIZE_REQUEST (combo_box->priv->button), \
&req, NULL); \
\
if (is_rtl) \
child.x = allocation->x + shadow_width; \
@@ -2254,7 +2258,8 @@ gtk_combo_box_size_allocate (GtkWidget *widget,
/* handle the children */
gtk_widget_size_request (priv->arrow, &req);
gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->arrow),
&req, NULL);
child.width = req.width;
if (!is_rtl)
child.x += width - req.width;
@@ -2263,7 +2268,8 @@ gtk_combo_box_size_allocate (GtkWidget *widget,
gtk_widget_size_allocate (priv->arrow, &child);
if (is_rtl)
child.x += req.width;
gtk_widget_size_request (priv->separator, &req);
gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->separator),
&req, NULL);
child.width = req.width;
if (!is_rtl)
child.x -= req.width;
@@ -2910,7 +2916,8 @@ gtk_cell_view_menu_item_new (GtkComboBox *combo_box,
gtk_tree_path_free (path);
gtk_combo_box_sync_cells (combo_box, GTK_CELL_LAYOUT (cell_view));
gtk_widget_size_request (cell_view, &req);
gtk_size_request_get_size (GTK_SIZE_REQUEST (cell_view),
&req, NULL);
gtk_widget_show (cell_view);
return item;
@@ -5092,12 +5099,13 @@ out:
}
/**
* gtk_combo_box_get_model
* gtk_combo_box_get_model:
* @combo_box: A #GtkComboBox
*
* Returns the #GtkTreeModel which is acting as data source for @combo_box.
*
* Return value: (transfer none): A #GtkTreeModel which was passed during construction.
* Return value: (transfer none): A #GtkTreeModel which was passed
* during construction.
*
* Since: 2.4
*/
@@ -5737,7 +5745,8 @@ gtk_combo_box_set_title (GtkComboBox *combo_box,
* This function is mostly intended for use by accessibility technologies;
* applications should have little use for it.
*
* Returns: the accessible object corresponding to the combo box's popup.
* Returns: (transfer none): the accessible object corresponding
* to the combo box's popup.
*
* Since: 2.6
*/
@@ -6172,8 +6181,8 @@ gtk_combo_box_get_height (GtkSizeRequest *widget,
/* Combo box is height-for-width only
* (so we always just reserve enough height for the minimum width) */
gtk_size_request_get_width (widget, &min_width, NULL);
gtk_size_request_get_height_for_width (widget, min_width, minimum_size, natural_size);
GTK_SIZE_REQUEST_GET_IFACE (widget)->get_width (widget, &min_width, NULL);
GTK_SIZE_REQUEST_GET_IFACE (widget)->get_height_for_width (widget, min_width, minimum_size, natural_size);
}
static void
@@ -6184,7 +6193,7 @@ gtk_combo_box_get_width_for_height (GtkSizeRequest *widget,
{
/* Combo box is height-for-width only
* (so we assume we always reserved enough height for the minimum width) */
gtk_size_request_get_width (widget, minimum_size, natural_size);
GTK_SIZE_REQUEST_GET_IFACE (widget)->get_width (widget, minimum_size, natural_size);
}
+170 -7
View File
@@ -25,16 +25,19 @@
*/
#include "config.h"
#include "gtkcontainer.h"
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
#include "gtkcontainer.h"
#include "gtkbuildable.h"
#include "gtkbuilderprivate.h"
#include "gtkprivate.h"
#include "gtkmain.h"
#include "gtkmarshalers.h"
#include "gtksizerequest.h"
#include "gtkwindow.h"
#include "gtkintl.h"
#include "gtktoolbar.h"
@@ -91,6 +94,9 @@ static void gtk_container_add_unimplemented (GtkContainer *container
static void gtk_container_remove_unimplemented (GtkContainer *container,
GtkWidget *widget);
static void gtk_container_real_check_resize (GtkContainer *container);
static void gtk_container_compute_expand (GtkWidget *widget,
gboolean *hexpand_p,
gboolean *vexpand_p);
static gboolean gtk_container_focus (GtkWidget *widget,
GtkDirectionType direction);
static void gtk_container_real_set_focus_child (GtkContainer *container,
@@ -107,6 +113,13 @@ static gint gtk_container_expose (GtkWidget *widget,
GdkEventExpose *event);
static void gtk_container_map (GtkWidget *widget);
static void gtk_container_unmap (GtkWidget *widget);
static void gtk_container_adjust_size_request (GtkWidget *widget,
GtkOrientation orientation,
gint for_size,
gint *minimum_size,
gint *natural_size);
static void gtk_container_adjust_size_allocation (GtkWidget *widget,
GtkAllocation *allocation);
static gchar* gtk_container_child_default_composite_name (GtkContainer *container,
GtkWidget *child);
@@ -227,13 +240,17 @@ gtk_container_class_init (GtkContainerClass *class)
object_class->destroy = gtk_container_destroy;
widget_class->compute_expand = gtk_container_compute_expand;
widget_class->show_all = gtk_container_show_all;
widget_class->hide_all = gtk_container_hide_all;
widget_class->expose_event = gtk_container_expose;
widget_class->map = gtk_container_map;
widget_class->unmap = gtk_container_unmap;
widget_class->focus = gtk_container_focus;
widget_class->adjust_size_request = gtk_container_adjust_size_request;
widget_class->adjust_size_allocation = gtk_container_adjust_size_allocation;
class->add = gtk_container_add_unimplemented;
class->remove = gtk_container_remove_unimplemented;
class->check_resize = gtk_container_real_check_resize;
@@ -1472,8 +1489,9 @@ gtk_container_real_check_resize (GtkContainer *container)
GtkWidget *widget = GTK_WIDGET (container);
GtkAllocation allocation;
GtkRequisition requisition;
gtk_widget_size_request (widget, &requisition);
gtk_size_request_get_size (GTK_SIZE_REQUEST (widget),
&requisition, NULL);
gtk_widget_get_allocation (widget, &allocation);
if (requisition.width > allocation.width ||
@@ -1520,6 +1538,103 @@ gtk_container_resize_children (GtkContainer *container)
gtk_widget_set_allocation (widget, &allocation);
}
static void
gtk_container_adjust_size_request (GtkWidget *widget,
GtkOrientation orientation,
gint for_size,
gint *minimum_size,
gint *natural_size)
{
GtkContainer *container;
container = GTK_CONTAINER (widget);
if (GTK_CONTAINER_GET_CLASS (widget)->handle_border_width)
{
int border_width;
border_width = container->priv->border_width;
*minimum_size += border_width * 2;
*natural_size += border_width * 2;
}
/* chain up last so gtk_widget_set_size_request() values
* will have a chance to overwrite our border width.
*/
parent_class->adjust_size_request (widget, orientation, for_size,
minimum_size, natural_size);
}
static void
gtk_container_adjust_size_allocation (GtkWidget *widget,
GtkAllocation *allocation)
{
GtkContainer *container;
int border_width;
container = GTK_CONTAINER (widget);
parent_class->adjust_size_allocation (widget, allocation);
if (!GTK_CONTAINER_GET_CLASS (widget)->handle_border_width)
return;
border_width = container->priv->border_width;
allocation->width -= border_width * 2;
allocation->height -= border_width * 2;
/* If we get a pathological too-small allocation to hold
* even the border width, leave all allocation to the actual
* widget, and leave x,y unchanged. (GtkWidget's min size is
* 1x1 if you're wondering why <1 and not <0)
*
* As long as we have space, set x,y properly.
*/
if (allocation->width < 1)
{
allocation->width += border_width * 2;
}
else
{
allocation->x += border_width;
}
if (allocation->height < 1)
{
allocation->height += border_width * 2;
}
else
{
allocation->y += border_width;
}
}
/**
* gtk_container_class_handle_border_width:
* @klass: the class struct of a #GtkContainer subclass
*
* Modifies a subclass of #GtkContainerClass to automatically add and
* remove the border-width setting on GtkContainer. This allows the
* subclass to ignore the border width in its size request and
* allocate methods. The intent is for a subclass to invoke this
* in its class_init function.
*
* gtk_container_class_handle_border_width() is necessary because it
* would break API too badly to make this behavior the default. So
* subclasses must "opt in" to the parent class handling border_width
* for them.
*/
void
gtk_container_class_handle_border_width (GtkContainerClass *klass)
{
g_return_if_fail (GTK_IS_CONTAINER_CLASS (klass));
klass->handle_border_width = TRUE;
}
/**
* gtk_container_forall:
* @container: a #GtkContainer
@@ -1552,7 +1667,7 @@ gtk_container_forall (GtkContainer *container,
/**
* gtk_container_foreach:
* @container: a #GtkContainer
* @callback: a callback
* @callback: (scope call): a callback
* @callback_data: callback user data
*
* Invokes @callback on each non-internal child of @container. See
@@ -1721,6 +1836,53 @@ _gtk_container_child_composite_name (GtkContainer *container,
return NULL;
}
typedef struct {
gboolean hexpand;
gboolean vexpand;
} ComputeExpandData;
static void
gtk_container_compute_expand_callback (GtkWidget *widget,
gpointer client_data)
{
ComputeExpandData *data = client_data;
/* note that we don't get_expand on the child if we already know we
* have to expand, so we only recurse into children until we find
* one that expands and then we basically don't do any more
* work. This means that we can leave some children in a
* need_compute_expand state, which is fine, as long as GtkWidget
* doesn't rely on an invariant that "if a child has
* need_compute_expand, its parents also do"
*
* gtk_widget_compute_expand() always returns FALSE if the
* child is !visible so that's taken care of.
*/
data->hexpand = data->hexpand ||
gtk_widget_compute_expand (widget, GTK_ORIENTATION_HORIZONTAL);
data->vexpand = data->vexpand ||
gtk_widget_compute_expand (widget, GTK_ORIENTATION_VERTICAL);
}
static void
gtk_container_compute_expand (GtkWidget *widget,
gboolean *hexpand_p,
gboolean *vexpand_p)
{
ComputeExpandData data;
data.hexpand = FALSE;
data.vexpand = FALSE;
gtk_container_forall (GTK_CONTAINER (widget),
gtk_container_compute_expand_callback,
&data);
*hexpand_p = data.hexpand;
*vexpand_p = data.vexpand;
}
static void
gtk_container_real_set_focus_child (GtkContainer *container,
GtkWidget *child)
@@ -2369,9 +2531,10 @@ chain_widget_destroyed (GtkWidget *widget,
}
/**
* gtk_container_set_focus_chain:
* gtk_container_set_focus_chain:
* @container: a #GtkContainer
* @focusable_widgets: the new focus chain
* @focusable_widgets: (transfer none) (element-type GtkWidget):
* the new focus chain
*
* Sets a focus chain, overriding the one computed automatically by GTK+.
*
+4
View File
@@ -62,6 +62,8 @@ struct _GtkContainerClass
{
GtkWidgetClass parent_class;
unsigned int handle_border_width : 1;
void (*add) (GtkContainer *container,
GtkWidget *widget);
void (*remove) (GtkContainer *container,
@@ -194,6 +196,8 @@ void gtk_container_forall (GtkContainer *container,
GtkCallback callback,
gpointer callback_data);
void gtk_container_class_handle_border_width (GtkContainerClass *klass);
/* Non-public methods */
void _gtk_container_queue_resize (GtkContainer *container);
void _gtk_container_clear_resize_widgets (GtkContainer *container);
+6 -6
View File
@@ -346,15 +346,15 @@ gtk_dialog_map (GtkWidget *widget)
g_signal_emit_by_name (window, "move_focus", GTK_DIR_TAB_FORWARD);
focus = gtk_window_get_focus (window);
if (GTK_IS_LABEL (focus) &&
!gtk_label_get_current_uri (GTK_LABEL (focus)))
gtk_label_select_region (GTK_LABEL (focus), 0, 0);
if (first_focus == NULL)
first_focus = focus;
else if (first_focus == focus)
{
if (GTK_IS_LABEL (focus) &&
!gtk_label_get_current_uri (GTK_LABEL (focus)))
gtk_label_select_region (GTK_LABEL (focus), 0, 0);
break;
}
break;
if (!GTK_IS_LABEL (focus))
break;
}
+27 -16
View File
@@ -355,27 +355,32 @@ gtk_drag_highlight_expose (GtkWidget *widget,
if (gtk_widget_is_drawable (widget))
{
cairo_t *cr;
GdkWindow *window = gtk_widget_get_window (widget);
if (!gtk_widget_get_has_window (widget))
{
x = widget->allocation.x;
y = widget->allocation.y;
width = widget->allocation.width;
height = widget->allocation.height;
GtkAllocation allocation;
gtk_widget_get_allocation (widget, &allocation);
x = allocation.x;
y = allocation.y;
width = allocation.width;
height = allocation.height;
}
else
{
x = 0;
y = 0;
gdk_drawable_get_size (widget->window, &width, &height);
gdk_drawable_get_size (window, &width, &height);
}
gtk_paint_shadow (widget->style, widget->window,
gtk_paint_shadow (gtk_widget_get_style (widget), window,
GTK_STATE_NORMAL, GTK_SHADOW_OUT,
NULL, widget, "dnd",
x, y, width, height);
cr = gdk_cairo_create (widget->window);
cr = gdk_cairo_create (window);
cairo_set_source_rgb (cr, 0.0, 0.0, 0.0); /* black */
cairo_set_line_width (cr, 1.0);
cairo_rectangle (cr,
@@ -432,9 +437,10 @@ static NSWindow *
get_toplevel_nswindow (GtkWidget *widget)
{
GtkWidget *toplevel = gtk_widget_get_toplevel (widget);
GdkWindow *window = gtk_widget_get_window (toplevel);
if (gtk_widget_is_toplevel (toplevel) && toplevel->window)
return [gdk_quartz_window_get_nsview (toplevel->window) window];
if (gtk_widget_is_toplevel (toplevel) && window)
return [gdk_quartz_window_get_nsview (window) window];
else
return NULL;
}
@@ -683,18 +689,23 @@ gtk_drag_find_widget (GtkWidget *widget,
* our coordinates to be relative to widget->window and
* recurse.
*/
new_allocation = widget->allocation;
gtk_widget_get_allocation (widget, &new_allocation);
if (widget->parent)
if (gtk_widget_get_parent (widget))
{
gint tx, ty;
GdkWindow *window = widget->window;
GdkWindow *window = gtk_widget_get_window (widget);
GdkWindow *parent_window;
GtkAllocation allocation;
parent_window = gtk_widget_get_window (gtk_widget_get_parent (widget));
/* Compute the offset from allocation-relative to
* window-relative coordinates.
*/
allocation_to_window_x = widget->allocation.x;
allocation_to_window_y = widget->allocation.y;
gtk_widget_get_allocation (widget, &allocation);
allocation_to_window_x = allocation.x;
allocation_to_window_y = allocation.y;
if (gtk_widget_get_has_window (widget))
{
@@ -710,7 +721,7 @@ gtk_drag_find_widget (GtkWidget *widget,
new_allocation.x = 0 + allocation_to_window_x;
new_allocation.y = 0 + allocation_to_window_y;
while (window && window != widget->parent->window)
while (window && window != parent_window)
{
GdkRectangle window_rect = { 0, 0, 0, 0 };
@@ -970,7 +981,7 @@ _gtk_drag_dest_handle_event (GtkWidget *toplevel,
}
}
gdk_window_get_position (toplevel->window, &tx, &ty);
gdk_window_get_position (gtk_widget_get_window (toplevel), &tx, &ty);
data.x = event->dnd.x_root - tx;
data.y = event->dnd.y_root - ty;
+78 -84
View File
@@ -119,40 +119,38 @@ struct _GtkDragSourceInfo
guint update_idle; /* Idle function to update the drag */
guint drop_timeout; /* Timeout for aborting drop */
guint destroy_icon : 1; /* If true, destroy icon_window
*/
guint have_grab : 1; /* Do we still have the pointer grab
*/
guint destroy_icon : 1; /* If true, destroy icon_window */
guint have_grab : 1; /* Do we still have the pointer grab */
GdkPixbuf *icon_pixbuf;
GdkCursor *drag_cursors[6];
};
struct _GtkDragDestSite
struct _GtkDragDestSite
{
GtkDestDefaults flags;
GtkTargetList *target_list;
GdkDragAction actions;
GdkWindow *proxy_window;
GdkDragProtocol proxy_protocol;
guint do_proxy : 1;
guint do_proxy : 1;
guint proxy_coords : 1;
guint have_drag : 1;
guint have_drag : 1;
guint track_motion : 1;
};
struct _GtkDragDestInfo
struct _GtkDragDestInfo
{
GtkWidget *widget; /* Widget in which drag is in */
GdkDragContext *context; /* Drag context */
GtkDragSourceInfo *proxy_source; /* Set if this is a proxy drag */
GtkSelectionData *proxy_data; /* Set while retrieving proxied data */
guint dropped : 1; /* Set after we receive a drop */
guint32 proxy_drop_time; /* Timestamp for proxied drop */
GtkWidget *widget; /* Widget in which drag is in */
GdkDragContext *context; /* Drag context */
GtkDragSourceInfo *proxy_source; /* Set if this is a proxy drag */
GtkSelectionData *proxy_data; /* Set while retrieving proxied data */
guint32 proxy_drop_time; /* Timestamp for proxied drop */
guint proxy_drop_wait : 1; /* Set if we are waiting for a
* status reply before sending
* a proxied drop on.
*/
gint drop_x, drop_y; /* Position of drop */
* status reply before sending
* a proxied drop on.
*/
guint dropped : 1; /* Set after we receive a drop */
gint drop_x, drop_y; /* Position of drop */
};
#define DROP_ABORT_TIME 300000
@@ -1009,17 +1007,16 @@ gtk_drag_get_data (GtkWidget *widget,
}
/*************************************************************
/**
* gtk_drag_get_source_widget:
* Get the widget the was the source of this drag, if
* the drag originated from this application.
* arguments:
* context: The drag context for this drag
* results:
* The source widget, or NULL if the drag originated from
* a different application.
*************************************************************/
* @context: a (destination side) drag context
*
* Determines the source widget for a drag.
*
* Return value: (transfer none): if the drag is occurring
* within a single application, a pointer to the source widget.
* Otherwise, %NULL.
*/
GtkWidget *
gtk_drag_get_source_widget (GdkDragContext *context)
{
@@ -1296,7 +1293,7 @@ gtk_drag_dest_set (GtkWidget *widget,
g_return_if_fail (GTK_IS_WIDGET (widget));
site = g_new (GtkDragDestSite, 1);
site = g_slice_new0 (GtkDragDestSite);
site->flags = flags;
site->have_drag = FALSE;
@@ -1692,7 +1689,7 @@ _gtk_drag_dest_handle_event (GtkWidget *toplevel,
* @context: drag context
* @target_list: (allow-none): list of droppable targets, or %NULL to use
* gtk_drag_dest_get_target_list (@widget).
*
*
* Looks for a match between @context->targets and the
* @dest_target_list, returning the first matching target, otherwise
* returning %GDK_NONE. @dest_target_list should usually be the return
@@ -1700,7 +1697,7 @@ _gtk_drag_dest_handle_event (GtkWidget *toplevel,
* have different valid targets for different parts of the widget; in
* that case, they will have to implement a drag_motion handler that
* passes the correct target list to this function.
*
*
* Return value: first target that the source offers and the dest can accept, or %GDK_NONE
**/
GdkAtom
@@ -1989,9 +1986,7 @@ gtk_drag_proxy_begin (GtkWidget *widget,
static void
gtk_drag_dest_info_destroy (gpointer data)
{
GtkDragDestInfo *info = data;
g_free (info);
g_slice_free (GtkDragDestInfo, data);
}
static GtkDragDestInfo *
@@ -2006,15 +2001,10 @@ gtk_drag_get_dest_info (GdkDragContext *context,
info = g_object_get_qdata (G_OBJECT (context), info_quark);
if (!info && create)
{
info = g_new (GtkDragDestInfo, 1);
info->widget = NULL;
info = g_slice_new0 (GtkDragDestInfo);
info->context = context;
info->proxy_source = NULL;
info->proxy_data = NULL;
info->dropped = FALSE;
info->proxy_drop_wait = FALSE;
g_object_set_qdata_full (G_OBJECT (context), info_quark,
info, gtk_drag_dest_info_destroy);
info, gtk_drag_dest_info_destroy);
}
return info;
@@ -2077,7 +2067,7 @@ gtk_drag_dest_site_destroy (gpointer data)
if (site->target_list)
gtk_target_list_unref (site->target_list);
g_free (site);
g_slice_free (GtkDragDestSite, site);
}
/*
@@ -2561,7 +2551,7 @@ gtk_drag_begin_internal (GtkWidget *widget,
* @actions: A bitmask of the allowed drag actions for this drag.
* @button: The button the user clicked to start the drag.
* @event: The event that triggered the start of the drag.
*
*
* Initiates a drag on the source side. The function
* only needs to be used when the application is
* starting drags itself, and is not needed when
@@ -2573,23 +2563,23 @@ gtk_drag_begin_internal (GtkWidget *widget,
* used by GTK+ to get information about the start position of the drag, for
* example if the @event is a GDK_MOTION_NOTIFY.
*
* Generally there are three cases when you want to start a drag by hand by calling
* this function:
* Generally there are three cases when you want to start a drag by hand by
* calling this function:
*
* 1. During a button-press-event handler, if you want to start a drag immediately
* when the user presses the mouse button. Pass the @event that you have in your
* button-press-event handler.
* 1. During a button-press-event handler, if you want to start a drag
* immediately when the user presses the mouse button. Pass the @event
* that you have in your button-press-event handler.
*
* 2. During a motion-notify-event handler, if you want to start a drag when the mouse
* moves past a certain threshold distance after a button-press. Pass the @event that you
* have in your motion-notify-event handler.
* 2. During a motion-notify-event handler, if you want to start a drag
* when the mouse moves past a certain threshold distance after a button-press.
* Pass the @event that you have in your motion-notify-event handler.
*
* 3. During a timeout handler, if you want to start a drag after the mouse
* button is held down for some time. Try to save the last event that you got
* from the mouse, using gdk_event_copy(), and pass it to this function
* (remember to free the event with gdk_event_free() when you are done). If you
* can really not pass a real event, pass #NULL instead.
*
* (remember to free the event with gdk_event_free() when you are done).
* If you can really not pass a real event, pass #NULL instead.
*
* Return value: the context for this drag.
**/
GdkDragContext *
@@ -2644,7 +2634,7 @@ gtk_drag_source_set (GtkWidget *widget,
}
else
{
site = g_new0 (GtkDragSourceSite, 1);
site = g_slice_new0 (GtkDragSourceSite);
site->icon_type = GTK_IMAGE_EMPTY;
@@ -2679,7 +2669,7 @@ gtk_drag_source_set (GtkWidget *widget,
*************************************************************/
void
gtk_drag_source_unset (GtkWidget *widget)
gtk_drag_source_unset (GtkWidget *widget)
{
GtkDragSourceSite *site;
@@ -3596,14 +3586,14 @@ gtk_drag_drop_finished (GtkDragSourceInfo *info,
gtk_drag_source_info_destroy (info);
}
else
{
GtkDragAnim *anim = g_new (GtkDragAnim, 1);
anim->info = info;
anim->step = 0;
anim->n_steps = MAX (info->cur_x - info->start_x,
info->cur_y - info->start_y) / ANIM_STEP_LENGTH;
anim->n_steps = CLAMP (anim->n_steps, ANIM_MIN_STEPS, ANIM_MAX_STEPS);
{
GtkDragAnim *anim = g_slice_new0 (GtkDragAnim);
anim->info = info;
anim->step = 0;
anim->n_steps = MAX (info->cur_x - info->start_x,
info->cur_y - info->start_y) / ANIM_STEP_LENGTH;
anim->n_steps = CLAMP (anim->n_steps, ANIM_MIN_STEPS, ANIM_MAX_STEPS);
info->cur_screen = gtk_widget_get_screen (info->widget);
@@ -3612,7 +3602,7 @@ gtk_drag_drop_finished (GtkDragSourceInfo *info,
0, 0, TRUE);
gtk_drag_update_icon (info);
/* Mark the context as dead, so if the destination decides
* to respond really late, we still are OK.
*/
@@ -3773,7 +3763,7 @@ gtk_drag_source_site_destroy (gpointer data)
gtk_target_list_unref (site->target_list);
gtk_drag_source_unset_icon (site);
g_free (site);
g_slice_free (GtkDragSourceSite, site);
}
static void
@@ -3840,34 +3830,38 @@ gtk_drag_selection_get (GtkWidget *widget,
static gboolean
gtk_drag_anim_timeout (gpointer data)
{
GtkDragAnim *anim = data;
GtkDragAnim *anim;
GtkDragSourceInfo *info;
gint x, y;
gboolean retval;
anim = data;
info = anim->info;
if (anim->step == anim->n_steps)
{
gtk_drag_source_info_destroy (anim->info);
g_free (anim);
g_slice_free (GtkDragAnim, anim);
retval = FALSE;
}
else
{
x = (anim->info->start_x * (anim->step + 1) +
anim->info->cur_x * (anim->n_steps - anim->step - 1)) / anim->n_steps;
y = (anim->info->start_y * (anim->step + 1) +
anim->info->cur_y * (anim->n_steps - anim->step - 1)) / anim->n_steps;
if (anim->info->icon_window)
{
GtkWidget *icon_window;
gint hot_x, hot_y;
gtk_drag_get_icon (anim->info, &icon_window, &hot_x, &hot_y);
gtk_window_move (GTK_WINDOW (icon_window),
x - hot_x,
y - hot_y);
}
x = (info->start_x * (anim->step + 1) +
info->cur_x * (anim->n_steps - anim->step - 1)) / anim->n_steps;
y = (info->start_y * (anim->step + 1) +
info->cur_y * (anim->n_steps - anim->step - 1)) / anim->n_steps;
if (info->icon_window)
{
GtkWidget *icon_window;
gint hot_x, hot_y;
gtk_drag_get_icon (info, &icon_window, &hot_x, &hot_y);
gtk_window_move (GTK_WINDOW (icon_window),
x - hot_x,
y - hot_y);
}
anim->step++;
retval = TRUE;
+55 -11
View File
@@ -24,6 +24,50 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
/**
* SECTION:gtkeditable
* @Short_description: Interface for text-editing widgets
* @Title: GtkEditable
*
* The #GtkEditable interface is an interface which should be implemented by
* text editing widgets, such as #GtkEntry and #GtkText. It contains functions
* for generically manipulating an editable widget, a large number of action
* signals used for key bindings, and several signals that an application can
* connect to to modify the behavior of a widget.
*
* As an example of the latter usage, by connecting
* the following handler to "insert_text", an application
* can convert all entry into a widget into uppercase.
*
* <example>
* <title>Forcing entry to uppercase.</title>
* <programlisting>
* #include &lt;ctype.h&gt;
*
* void
* insert_text_handler (GtkEditable &ast;editable,
* const gchar &ast;text,
* gint length,
* gint &ast;position,
* gpointer data)
* {
* int i;
* gchar &ast;result = g_utf8_strup (text, length);
*
* g_signal_handlers_block_by_func (editable,
* (gpointer) insert_text_handler, data);
* gtk_editable_insert_text (editable, result, length, position);
* g_signal_handlers_unblock_by_func (editable,
* (gpointer) insert_text_handler, data);
*
* g_signal_stop_emission_by_name (editable, "insert_text");
*
* g_free (result);
* }
* </programlisting>
* </example>
*/
#include "config.h"
#include <string.h>
@@ -44,7 +88,7 @@ gtk_editable_get_type (void)
{
const GTypeInfo editable_info =
{
sizeof (GtkEditableClass), /* class_size */
sizeof (GtkEditableInterface), /* class_size */
gtk_editable_base_init, /* base_init */
NULL, /* base_finalize */
};
@@ -85,7 +129,7 @@ gtk_editable_base_init (gpointer g_class)
g_signal_new (I_("insert-text"),
GTK_TYPE_EDITABLE,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GtkEditableClass, insert_text),
G_STRUCT_OFFSET (GtkEditableInterface, insert_text),
NULL, NULL,
_gtk_marshal_VOID__STRING_INT_POINTER,
G_TYPE_NONE, 3,
@@ -112,7 +156,7 @@ gtk_editable_base_init (gpointer g_class)
g_signal_new (I_("delete-text"),
GTK_TYPE_EDITABLE,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GtkEditableClass, delete_text),
G_STRUCT_OFFSET (GtkEditableInterface, delete_text),
NULL, NULL,
_gtk_marshal_VOID__INT_INT,
G_TYPE_NONE, 2,
@@ -134,7 +178,7 @@ gtk_editable_base_init (gpointer g_class)
g_signal_new (I_("changed"),
GTK_TYPE_EDITABLE,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GtkEditableClass, changed),
G_STRUCT_OFFSET (GtkEditableInterface, changed),
NULL, NULL,
_gtk_marshal_VOID__VOID,
G_TYPE_NONE, 0);
@@ -168,7 +212,7 @@ gtk_editable_insert_text (GtkEditable *editable,
if (new_text_length < 0)
new_text_length = strlen (new_text);
GTK_EDITABLE_GET_CLASS (editable)->do_insert_text (editable, new_text, new_text_length, position);
GTK_EDITABLE_GET_IFACE (editable)->do_insert_text (editable, new_text, new_text_length, position);
}
/**
@@ -191,7 +235,7 @@ gtk_editable_delete_text (GtkEditable *editable,
{
g_return_if_fail (GTK_IS_EDITABLE (editable));
GTK_EDITABLE_GET_CLASS (editable)->do_delete_text (editable, start_pos, end_pos);
GTK_EDITABLE_GET_IFACE (editable)->do_delete_text (editable, start_pos, end_pos);
}
/**
@@ -218,7 +262,7 @@ gtk_editable_get_chars (GtkEditable *editable,
{
g_return_val_if_fail (GTK_IS_EDITABLE (editable), NULL);
return GTK_EDITABLE_GET_CLASS (editable)->get_chars (editable, start_pos, end_pos);
return GTK_EDITABLE_GET_IFACE (editable)->get_chars (editable, start_pos, end_pos);
}
/**
@@ -240,7 +284,7 @@ gtk_editable_set_position (GtkEditable *editable,
{
g_return_if_fail (GTK_IS_EDITABLE (editable));
GTK_EDITABLE_GET_CLASS (editable)->set_position (editable, position);
GTK_EDITABLE_GET_IFACE (editable)->set_position (editable, position);
}
/**
@@ -259,7 +303,7 @@ gtk_editable_get_position (GtkEditable *editable)
{
g_return_val_if_fail (GTK_IS_EDITABLE (editable), 0);
return GTK_EDITABLE_GET_CLASS (editable)->get_position (editable);
return GTK_EDITABLE_GET_IFACE (editable)->get_position (editable);
}
/**
@@ -286,7 +330,7 @@ gtk_editable_get_selection_bounds (GtkEditable *editable,
g_return_val_if_fail (GTK_IS_EDITABLE (editable), FALSE);
result = GTK_EDITABLE_GET_CLASS (editable)->get_selection_bounds (editable, &tmp_start, &tmp_end);
result = GTK_EDITABLE_GET_IFACE (editable)->get_selection_bounds (editable, &tmp_start, &tmp_end);
if (start_pos)
*start_pos = MIN (tmp_start, tmp_end);
@@ -335,7 +379,7 @@ gtk_editable_select_region (GtkEditable *editable,
{
g_return_if_fail (GTK_IS_EDITABLE (editable));
GTK_EDITABLE_GET_CLASS (editable)->set_selection_bounds (editable, start_pos, end_pos);
GTK_EDITABLE_GET_IFACE (editable)->set_selection_bounds (editable, start_pos, end_pos);
}
/**
+4 -6
View File
@@ -39,15 +39,13 @@ G_BEGIN_DECLS
#define GTK_TYPE_EDITABLE (gtk_editable_get_type ())
#define GTK_EDITABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_EDITABLE, GtkEditable))
#define GTK_EDITABLE_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), GTK_TYPE_EDITABLE, GtkEditableClass))
#define GTK_IS_EDITABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_EDITABLE))
#define GTK_IS_EDITABLE_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), GTK_TYPE_EDITABLE))
#define GTK_EDITABLE_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GTK_TYPE_EDITABLE, GtkEditableClass))
#define GTK_EDITABLE_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GTK_TYPE_EDITABLE, GtkEditableInterface))
typedef struct _GtkEditable GtkEditable; /* Dummy typedef */
typedef struct _GtkEditableClass GtkEditableClass;
typedef struct _GtkEditable GtkEditable; /* Dummy typedef */
typedef struct _GtkEditableInterface GtkEditableInterface;
struct _GtkEditableClass
struct _GtkEditableInterface
{
GTypeInterface base_iface;
+32 -36
View File
@@ -53,6 +53,7 @@
#include "gtkseparatormenuitem.h"
#include "gtkselection.h"
#include "gtksettings.h"
#include "gtksizerequest.h"
#include "gtkspinbutton.h"
#include "gtkstock.h"
#include "gtktextutil.h"
@@ -238,7 +239,7 @@ typedef enum
/* GObject, GtkObject methods
*/
static void gtk_entry_editable_init (GtkEditableClass *iface);
static void gtk_entry_editable_init (GtkEditableInterface *iface);
static void gtk_entry_cell_editable_init (GtkCellEditableIface *iface);
static void gtk_entry_set_property (GObject *object,
guint prop_id,
@@ -1768,7 +1769,7 @@ gtk_entry_class_init (GtkEntryClass *class)
}
static void
gtk_entry_editable_init (GtkEditableClass *iface)
gtk_entry_editable_init (GtkEditableInterface *iface)
{
iface->do_insert_text = gtk_entry_insert_text;
iface->do_delete_text = gtk_entry_delete_text;
@@ -2693,21 +2694,18 @@ gtk_entry_map (GtkWidget *widget)
EntryIconInfo *icon_info = NULL;
gint i;
if (gtk_widget_get_realized (widget) && !gtk_widget_get_mapped (widget))
GTK_WIDGET_CLASS (gtk_entry_parent_class)->map (widget);
for (i = 0; i < MAX_ICONS; i++)
{
GTK_WIDGET_CLASS (gtk_entry_parent_class)->map (widget);
for (i = 0; i < MAX_ICONS; i++)
if ((icon_info = priv->icons[i]) != NULL)
{
if ((icon_info = priv->icons[i]) != NULL)
{
if (icon_info->pixbuf != NULL && icon_info->window != NULL)
gdk_window_show (icon_info->window);
}
if (icon_info->pixbuf != NULL && icon_info->window != NULL)
gdk_window_show (icon_info->window);
}
update_cursors (widget);
}
update_cursors (widget);
}
static void
@@ -2717,19 +2715,16 @@ gtk_entry_unmap (GtkWidget *widget)
EntryIconInfo *icon_info = NULL;
gint i;
if (gtk_widget_get_mapped (widget))
for (i = 0; i < MAX_ICONS; i++)
{
for (i = 0; i < MAX_ICONS; i++)
if ((icon_info = priv->icons[i]) != NULL)
{
if ((icon_info = priv->icons[i]) != NULL)
{
if (icon_info->pixbuf != NULL && icon_info->window != NULL)
gdk_window_hide (icon_info->window);
}
if (icon_info->pixbuf != NULL && icon_info->window != NULL)
gdk_window_hide (icon_info->window);
}
GTK_WIDGET_CLASS (gtk_entry_parent_class)->unmap (widget);
}
GTK_WIDGET_CLASS (gtk_entry_parent_class)->unmap (widget);
}
static void
@@ -2990,7 +2985,8 @@ gtk_entry_get_text_area_size (GtkEntry *entry,
gint frame_height;
gint xborder, yborder;
gtk_widget_get_child_requisition (widget, &requisition);
gtk_size_request_get_size (GTK_SIZE_REQUEST (widget),
&requisition, NULL);
gtk_widget_get_allocation (widget, &allocation);
_gtk_entry_get_borders (entry, &xborder, &yborder);
@@ -3044,7 +3040,8 @@ get_widget_window_size (GtkEntry *entry,
GtkRequisition requisition;
GtkWidget *widget = GTK_WIDGET (entry);
gtk_widget_get_child_requisition (widget, &requisition);
gtk_size_request_get_size (GTK_SIZE_REQUEST (widget),
&requisition, NULL);
gtk_widget_get_allocation (widget, &allocation);
if (x)
@@ -3106,10 +3103,6 @@ gtk_entry_size_allocate (GtkWidget *widget,
if (gtk_widget_get_realized (widget))
{
/* We call gtk_widget_get_child_requisition, since we want (for
* backwards compatibility reasons) the realization here to
* be affected by the usize of the entry, if set
*/
gint x, y, width, height;
GtkEntryCompletion* completion;
@@ -6687,7 +6680,7 @@ get_buffer (GtkEntry *entry)
*
* Since: 2.18
*
* Returns: A #GtkEntryBuffer object.
* Returns: (transfer none): A #GtkEntryBuffer object.
*/
GtkEntryBuffer*
gtk_entry_get_buffer (GtkEntry *entry)
@@ -6760,7 +6753,7 @@ gtk_entry_set_buffer (GtkEntry *entry,
*
* See also gtk_entry_get_icon_window().
*
* Return value: the entry's text window.
* Return value: (transfer none): the entry's text window.
*
* Since: 2.20
**/
@@ -7823,7 +7816,8 @@ gtk_entry_get_icon_activatable (GtkEntry *entry,
* method will work regardless of whether the icon was set using a
* #GdkPixbuf, a #GIcon, a stock item, or an icon name.
*
* Returns: A #GdkPixbuf, or %NULL if no icon is set for this position.
* Returns: (transfer none): A #GdkPixbuf, or %NULL if no icon is
* set for this position.
*
* Since: 2.16
*/
@@ -7857,8 +7851,8 @@ gtk_entry_get_icon_pixbuf (GtkEntry *entry,
* no icon or if the icon was set by some other method (e.g., by
* stock, pixbuf, or icon name).
*
* Returns: A #GIcon, or %NULL if no icon is set or if the icon
* is not a #GIcon
* Returns: (transfer none): A #GIcon, or %NULL if no icon is set
* or if the icon is not a #GIcon
*
* Since: 2.16
*/
@@ -8188,7 +8182,7 @@ gtk_entry_get_current_icon_drag_source (GtkEntry *entry)
*
* See also gtk_entry_get_text_window().
*
* Return value: the entry's icon window at @icon_pos.
* Return value: (transfer none): the entry's icon window at @icon_pos.
*
* Since: 2.20
*/
@@ -8509,7 +8503,8 @@ popup_position_func (GtkMenu *menu,
gtk_menu_set_monitor (menu, monitor_num);
gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
gtk_widget_size_request (entry->popup_menu, &menu_req);
gtk_size_request_get_size (GTK_SIZE_REQUEST (entry->popup_menu),
&menu_req, NULL);
gdk_drawable_get_size (entry->text_area, NULL, &height);
gtk_entry_get_cursor_locations (entry, CURSOR_STANDARD, &strong_x, NULL);
_gtk_entry_effective_inner_border (entry, &inner_border);
@@ -9731,7 +9726,8 @@ gtk_entry_set_completion (GtkEntry *entry,
*
* Returns the auxiliary completion object currently in use by @entry.
*
* Return value: The auxiliary completion object currently in use by @entry.
* Return value: (transfer none): The auxiliary completion object currently
* in use by @entry.
*
* Since: 2.4
*/
+12 -6
View File
@@ -18,7 +18,9 @@
*/
#include "config.h"
#include "gtkentrycompletion.h"
#include "gtkentryprivate.h"
#include "gtkcelllayout.h"
@@ -28,6 +30,7 @@
#include "gtktreeselection.h"
#include "gtktreeview.h"
#include "gtkscrolledwindow.h"
#include "gtksizerequest.h"
#include "gtkvbox.h"
#include "gtkwindow.h"
#include "gtkentry.h"
@@ -1009,7 +1012,7 @@ gtk_entry_completion_new (void)
*
* Gets the entry @completion has been attached to.
*
* Return value: The entry @completion has been attached to.
* Return value: (transfer none): The entry @completion has been attached to.
*
* Since: 2.4
*/
@@ -1073,7 +1076,8 @@ gtk_entry_completion_set_model (GtkEntryCompletion *completion,
* Returns the model the #GtkEntryCompletion is using as data source.
* Returns %NULL if the model is unset.
*
* Return value: A #GtkTreeModel, or %NULL if none is currently being used.
* Return value: (transfer none): A #GtkTreeModel, or %NULL if none
* is currently being used.
*
* Since: 2.4
*/
@@ -1084,7 +1088,7 @@ gtk_entry_completion_get_model (GtkEntryCompletion *completion)
if (!completion->priv->filter_model)
return NULL;
return gtk_tree_model_filter_get_model (completion->priv->filter_model);
}
@@ -1449,9 +1453,11 @@ _gtk_entry_completion_resize_popup (GtkEntryCompletion *completion)
else
gtk_widget_hide (completion->priv->action_view);
gtk_widget_size_request (completion->priv->popup_window, &popup_req);
gtk_widget_size_request (completion->priv->entry, &entry_req);
gtk_size_request_get_size (GTK_SIZE_REQUEST (completion->priv->popup_window),
&popup_req, NULL);
gtk_size_request_get_size (GTK_SIZE_REQUEST (completion->priv->entry),
&entry_req, NULL);
if (x < monitor.x)
x = monitor.x;
else if (x + popup_req.width > monitor.x + monitor.width)
+39 -34
View File
@@ -35,6 +35,36 @@
G_BEGIN_DECLS
/**
* GtkAlign:
*
* @GTK_ALIGN_FILL: stretch to fill all space if possible, center if
* no meaningful way to stretch
* @GTK_ALIGN_START: snap to left or top side, leaving space on right
* or bottom
* @GTK_ALIGN_END: snap to right or bottom side, leaving space on left
* or top
* @GTK_ALIGN_CENTER: center natural width of widget inside the
* allocation
*
* Controls how a widget deals with extra space in a single (x or y)
* dimension.
*
* Alignment only matters if the widget receives a "too large"
* allocation, for example if you packed the widget with the "expand"
* flag inside a #GtkBox, then the widget might get extra space. If
* you have for example a 16x16 icon inside a 32x32 space, the icon
* could be scaled and stretched, it could be centered, or it could be
* positioned to one side of the space.
*/
typedef enum
{
GTK_ALIGN_FILL,
GTK_ALIGN_START,
GTK_ALIGN_END,
GTK_ALIGN_CENTER
} GtkAlign;
/* Arrow placement */
typedef enum
{
@@ -530,26 +560,19 @@ typedef enum {
/**
* GtkWrapBoxSpreading:
* @GTK_WRAP_BOX_SPREAD_START: Children are allocated no more than their natural size
* in the layout's orientation and any extra space is left trailing at
* the end of each line.
* in the given orientation and any extra space is left trailing at
* the end of each row/column.
* @GTK_WRAP_BOX_SPREAD_END: Children are allocated no more than their natural size
* in the layout's orientation and any extra space skipped at the beginning
* of each line.
* in the given orientation and any extra space skipped at the beginning
* of each row/column.
* @GTK_WRAP_BOX_SPREAD_EVEN: Children are allocated no more than their natural size
* in the layout's orientation and any extra space is evenly distributed
* in the given orientation and any extra space is evenly distributed
* as empty space between children.
* @GTK_WRAP_BOX_SPREAD_EXPAND: Items share the extra space evenly (or among children that 'expand' when
* in %GTK_WRAP_ALLOCATE_FREE mode.
*
* Describes how an #GtkWrapBox deals with extra space when allocating children.
*
* The box always tries to fit as many children at their natural size
* in the given orentation as possible with the exception of fitting "minimum-line-children"
* items into the available size. When the available size is larger than
* the size needed to fit a given number of children at their natural size
* then extra space is available to distribute among children. The
* #GtkWrapBoxSpreading option describes what to do with this space.
* @GTK_WRAP_BOX_SPREAD_EXPAND: Extra space is given to children which asked to expand in the given
* orientation (or columns/rows which contain children who asked to expand).
* If no children asked to expand; extra space is distributed evenly.
*
* Describes how a #GtkWrapBox deals with extra space in a given orientation when allocating children.
*/
typedef enum {
GTK_WRAP_BOX_SPREAD_START = 0,
@@ -558,24 +581,6 @@ typedef enum {
GTK_WRAP_BOX_SPREAD_EXPAND
} GtkWrapBoxSpreading;
/**
* GtkWrapBoxPacking:
* @GTK_WRAP_BOX_H_EXPAND: Whether the child expands horizontally.
* @GTK_WRAP_BOX_H_FILL: Whether the child fills its allocated horizontal space.
* @GTK_WRAP_BOX_V_EXPAND: Whether the child expands vertically.
* @GTK_WRAP_BOX_V_FILL: Whether the child fills its allocated vertical space.
*
* Specifies how widgets will expand/fill vertically and
* horizontally when placed inside a #GtkWrapBox.
*/
typedef enum
{
GTK_WRAP_BOX_H_EXPAND = 1 << 0,
GTK_WRAP_BOX_H_FILL = 1 << 1,
GTK_WRAP_BOX_V_EXPAND = 1 << 2,
GTK_WRAP_BOX_V_FILL = 1 << 3
} GtkWrapBoxPacking;
G_END_DECLS

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