Compare commits
153 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 11140f8ba9 | |||
| ffd079a411 | |||
| 175f361d33 | |||
| 406d1981be | |||
| f0e7c9fc64 | |||
| 8017a12b46 | |||
| 1f7966c143 | |||
| a0950f0f54 | |||
| f618f781b9 | |||
| 5a11341c19 | |||
| 9c2dde1c27 | |||
| 23715e121a | |||
| 5aad25aa42 | |||
| 3fd767c92d | |||
| 8b5bc9669b | |||
| a98127fc12 | |||
| 92ededc9b4 | |||
| cc9ac5b7ea | |||
| bc6a3f8cd8 | |||
| 1773b6d50a | |||
| 7dde4d93ad | |||
| 93fd2b44c3 | |||
| 41f4fd94df | |||
| 26c93dc04b | |||
| 8578ff4b38 | |||
| 94e9a35a16 | |||
| 50971f704c | |||
| 3c19eea34b | |||
| b47b1428b8 | |||
| 3557761fb3 | |||
| 65db1100ec | |||
| c45985ae01 | |||
| 8026cd386b | |||
| 8736d31a04 | |||
| 76d7331578 | |||
| 84bae92928 | |||
| 381c14f1e2 | |||
| 61e9f570d9 | |||
| e56a209077 | |||
| aad77642be | |||
| c9ca4beb35 | |||
| b0713fb3bb | |||
| 0e1bba6ef5 | |||
| bb90394147 | |||
| fb62d6105f | |||
| 9ef738c4ab | |||
| 9c3d1080d6 | |||
| 59bc9e8860 | |||
| 0f88b6808c | |||
| 27bc88f7c2 | |||
| ad48f4d52b | |||
| eba2d6cf61 | |||
| e976abe825 | |||
| 9e2996decd | |||
| 93e203e067 | |||
| e0aa12eb0a | |||
| ca251cf1d4 | |||
| 6ba904486c | |||
| 330bc154ed | |||
| 2ddfaeddad | |||
| 14e38da150 | |||
| 1592738d2f | |||
| 1aea318d0f | |||
| bb7ffddff2 | |||
| e8a60e6123 | |||
| d14687ef4b | |||
| def95d1319 | |||
| 743202261a | |||
| ae3be469b3 | |||
| bc7654826f | |||
| 1dcd209cdd | |||
| 8e117b6f3a | |||
| 6b4992d647 | |||
| 35e0ad72e4 | |||
| 92411d2c84 | |||
| 1243b4861c | |||
| e32ab82069 | |||
| c7d73ee587 | |||
| b837ef5a6d | |||
| 4f3e5e6ebc | |||
| 8d5b4e9f6e | |||
| de3512dbba | |||
| 19cab17c22 | |||
| 60c920f228 | |||
| 8c3900f420 | |||
| ac051a7b2c | |||
| 809dbe9f99 | |||
| 15a5a231fc | |||
| efbf04236e | |||
| 6e9349d858 | |||
| 54077d61e2 | |||
| 28c66ed9b0 | |||
| bf19aa46e9 | |||
| 6aa8941b84 | |||
| ab0e68e586 | |||
| 2f78aa3024 | |||
| bf2a7ee1b6 | |||
| 8e72e9a7a0 | |||
| 67e6ac5af9 | |||
| b9f66d9197 | |||
| 3e91238071 | |||
| 38e09dcbb1 | |||
| 896e249e8f | |||
| 560ca1eaad | |||
| 57e0b9a979 | |||
| 1110375f24 | |||
| f5a06df3dc | |||
| 8345760fdb | |||
| e3a8e29a6c | |||
| 15d46dd866 | |||
| b140884fec | |||
| a18e2370bf | |||
| 2ee532645f | |||
| 266476d32b | |||
| 8bfb1e0ab8 | |||
| ab4ba69cc8 | |||
| 7b42d4feda | |||
| 032d3f0ada | |||
| c22b80949d | |||
| 419e1548ab | |||
| 5ba6295a10 | |||
| ff29972a48 | |||
| b64e91adf0 | |||
| 0e484a83d1 | |||
| 8204fe6036 | |||
| 97ffc36540 | |||
| 450beef2a2 | |||
| e02252cdd6 | |||
| 9e81022bf6 | |||
| 153bfacde0 | |||
| 96c3858b21 | |||
| a79637f081 | |||
| 85ae875dcb | |||
| a79d6676ac | |||
| ecaa37529c | |||
| 31cd439385 | |||
| 0fc5433753 | |||
| 234d750bb3 | |||
| d93ab58829 | |||
| 1dc9451b57 | |||
| 474f80442a | |||
| 85735112d7 | |||
| daebca19da | |||
| dc1940e99e | |||
| cd2a19a68d | |||
| 9debfe243f | |||
| cf68c2636a | |||
| c29f0a1392 | |||
| 8960d64cc6 | |||
| cf6eb47758 | |||
| b3079c0d18 | |||
| 7e520d908a | |||
| e3fafd7512 |
+4
-2
@@ -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
@@ -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
@@ -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
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -279,7 +279,7 @@ static gchar *types[] =
|
||||
"GtkTreeStore ",
|
||||
"GtkEntry ",
|
||||
"GtkEditable ",
|
||||
"GtkEditableClass ",
|
||||
"GtkEditableInterface ",
|
||||
"GdkPixmap ",
|
||||
"GdkEventConfigure ",
|
||||
"GdkEventMotion ",
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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.
|
||||
@@ -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))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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" />
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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 ##### -->
|
||||
|
||||
@@ -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 <ctype.h>
|
||||
|
||||
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>
|
||||
|
||||
@@ -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:
|
||||
|
||||
|
||||
@@ -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 ##### -->
|
||||
|
||||
@@ -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:
|
||||
|
||||
|
||||
|
||||
@@ -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
@@ -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
|
||||
|
||||
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 */
|
||||
|
||||
|
||||
@@ -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
@@ -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
@@ -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
|
||||
**/
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
@@ -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)
|
||||
{
|
||||
|
||||
@@ -56,6 +56,11 @@ gdk_error_trap_pop (void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_error_trap_pop_ignored (void)
|
||||
{
|
||||
}
|
||||
|
||||
gchar *
|
||||
gdk_get_display (void)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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
@@ -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
@@ -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 *
|
||||
|
||||
@@ -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
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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
|
||||
**/
|
||||
|
||||
@@ -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
|
||||
**/
|
||||
|
||||
@@ -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
@@ -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
@@ -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
@@ -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><user@<!-- -->host></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 %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
@@ -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
@@ -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
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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
|
||||
**/
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
@@ -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
|
||||
**/
|
||||
|
||||
@@ -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
@@ -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
@@ -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
@@ -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 */
|
||||
|
||||
@@ -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
@@ -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
@@ -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+.
|
||||
*
|
||||
|
||||
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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 <ctype.h>
|
||||
*
|
||||
* 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>
|
||||
*/
|
||||
|
||||
#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
@@ -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
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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
@@ -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
Reference in New Issue
Block a user