gtk-32: fixed build, added patches

This commit is contained in:
Tim Biermann 2024-10-29 20:00:49 +01:00
parent bfa0993c38
commit 983f011a4c
Signed by: tb
GPG Key ID: 42F8B4E30B673606
12 changed files with 888 additions and 15 deletions

View File

@ -1,5 +1,15 @@
untrusted comment: verify with /etc/ports/compat-32.pub
RWSwxGo/zH7eXZ1RfSlRcPi26z+8DoSRN5np8fQXpSE7KaQXFTOQ8a5Zvjgl3F4F8YdbOXrUcM+Od+6oZRRRzj5pjH0dUTvITwI=
SHA256 (Pkgfile) = 152608c2c0309a24805c3d2495e2e215ea4527caededc8de961eb7946188bbec
RWSwxGo/zH7eXa+Sy23HIgL/c8QV1+GCwoMj0x13wln9Cik/7tXSANmVGNTwFGbvPjtvmgc8oEHXMro2sCHKr7dcQpb8et+okQc=
SHA256 (Pkgfile) = 6ee935100f908bd1388c31ec38829b54e7ac34e1cb8896454a05eeaf26c69dcd
SHA256 (.footprint) = ed937edd86b37309fa1dbf615db7c5585929755a2ff278e7143277eab8303b9f
SHA256 (gtk+-2.24.33.tar.xz) = ac2ac757f5942d318a311a54b0c80b5ef295f299c2a73c632f6bfb1ff49cc6da
SHA256 (icon-padding.patch) = 8846d81ceb6a5f48f116e7fd1c3ac709d9c8371425355c3695a09c9f9de7663d
SHA256 (tooltip-positioning.patch) = 80adf8cd8c0a862c101525122da769457540599e180d875718673de4c3691719
SHA256 (window-dragging.patch) = 4cf99b6d5f8c25cb7f97a041eaec6d23a3171d7bed1204aca03f257ffd9e8e34
SHA256 (gtk2-c99.patch) = a5d1ceb0850249da13e404c1c044cbd2377acea1ae5d18255650a6b774333101
SHA256 (gtk2-c89.patch) = c2517ba418f72224d1a74b1a20dda698cc99fb27ac3773d19eb18c89572cd6c3
SHA256 (gtk2-c89-2.patch) = 1dd4bee9023f76762333d557f3a59b9eb400bef508dba45dcd492053827d5ed7
SHA256 (gtk2-c89-3.patch) = b3ebdad2d887b0be6b8169d987550cadb3353d005debfb5eb1e0e63975072201
SHA256 (gtk2-c89-4.patch) = dfe109be88a41e01433b6a260876071354a576b1b46dd401463e8de73073cf6a
SHA256 (gtk2-c89-5.patch) = 89343af092e6e99496c48e7356e044ac673f49705cd039e3335c05541d6f8e85
SHA256 (gtk2-c89-6.patch) = c019553aae8ea3688b4f9f56c191789c63b57cdf251156372dcf1fbc5b578d10

View File

@ -5,18 +5,45 @@
name=gtk-32
version=2.24.33
release=1
source=(https://download.gnome.org/sources/gtk+/${version%.*}/gtk+-$version.tar.xz)
release=2
source=(https://download.gnome.org/sources/gtk+/${version%.*}/gtk+-$version.tar.xz
icon-padding.patch
tooltip-positioning.patch
window-dragging.patch
gtk2-c99.patch
gtk2-c89.patch
gtk2-c89-2.patch
gtk2-c89-3.patch
gtk2-c89-4.patch
gtk2-c89-5.patch
gtk2-c89-6.patch)
build() {
cd gtk+-$version
export PKG_CONFIG_PATH+=":/usr/share/pkgconfig"
patch -Np1 -i $SRC/icon-padding.patch
patch -Np1 -i $SRC/tooltip-positioning.patch
patch -Np1 -i $SRC/window-dragging.patch
patch -Np1 -i $SRC/gtk2-c99.patch
patch -Np1 -i $SRC/gtk2-c89.patch
patch -Np1 -i $SRC/gtk2-c89-2.patch
patch -Np1 -i $SRC/gtk2-c89-3.patch
patch -Np1 -i $SRC/gtk2-c89-4.patch
patch -Np1 -i $SRC/gtk2-c89-5.patch
patch -Np1 -i $SRC/gtk2-c89-6.patch
CFLAGS+=' -Wno-deprecated-declarations -Wno-unused-but-set-variable' \
CXXFLAGS+=' -Wno-deprecated-declarations -Wno-unused-but-set-variable' \
./configure \
--prefix=/usr \
--libdir=/usr/lib32 \
--disable-cups
--disable-cups \
--with-xinput=yes
sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
make
make DESTDIR=$PKG install

19
gtk-32/gtk2-c89-2.patch Normal file
View File

@ -0,0 +1,19 @@
commit 018a4255624928fb7d951f1d1c89196fe77e8267
Author: Cosimo Cecchi <cosimoc@gnome.org>
Date: Mon Feb 18 19:37:20 2013 -0500
immodule: fix a GCC warning
diff --git a/gtk/gtkimmodule.c b/gtk/gtkimmodule.c
index 1fcb17a7d87f197c..445b2be87f57742f 100644
--- a/gtk/gtkimmodule.c
+++ b/gtk/gtkimmodule.c
@@ -662,7 +662,7 @@ lookup_immodule (gchar **immodules_list)
gboolean found;
gchar *context_id;
found = g_hash_table_lookup_extended (contexts_hash, *immodules_list,
- &context_id, NULL);
+ (gpointer *) &context_id, NULL);
if (found)
return context_id;
}

21
gtk-32/gtk2-c89-3.patch Normal file
View File

@ -0,0 +1,21 @@
Partial backport of:
commit 345d865ac6b2f7760503ab144dd68e6062438b80
Author: Matthias Clasen <mclasen@redhat.com>
Date: Wed Jan 18 00:57:20 2012 -0500
GtkScale: Fix late setting of marks
diff --git a/gtk/gtkscale.c b/gtk/gtkscale.c
index 4317523fb8f1918a..a573b2f6ba203b92 100644
--- a/gtk/gtkscale.c
+++ b/gtk/gtkscale.c
@@ -1471,7 +1471,7 @@ gtk_scale_add_mark (GtkScale *scale,
mark->position = position;
priv->marks = g_slist_insert_sorted_with_data (priv->marks, mark,
- (GCompareFunc) compare_marks,
+ compare_marks,
GINT_TO_POINTER (
gtk_range_get_inverted (GTK_RANGE (scale))
));

16
gtk-32/gtk2-c89-4.patch Normal file
View File

@ -0,0 +1,16 @@
Return the expected GObject * type. This was not fixed upstream before
this file was removed.
diff --git a/gtk/gtkuimanager.c b/gtk/gtkuimanager.c
index d004cf1ed3a2be11..8cbeda9e85b8f460 100644
--- a/gtk/gtkuimanager.c
+++ b/gtk/gtkuimanager.c
@@ -503,7 +503,7 @@ gtk_ui_manager_buildable_construct_child (GtkBuildable *buildable,
g_signal_connect (widget, "hierarchy-changed",
G_CALLBACK (child_hierarchy_changed_cb),
GTK_UI_MANAGER (buildable));
- return g_object_ref (widget);
+ return G_OBJECT (g_object_ref (widget));
}
static void

51
gtk-32/gtk2-c89-5.patch Normal file
View File

@ -0,0 +1,51 @@
Part of this commit upstream:
commit ca94ff10ce2ea57bfde7692aaa558b1260c9ff75
Author: Daniel Boles <dboles.src@gmail.com>
Date: Fri Jun 29 20:00:06 2018 +0100
testsuite/gtk/defaultvalue: Actually build...& fix
It looks like this got dropped during the move from autotools and never
restored. I can see why, since making it work wasn't a hugely fun task!
Notes on some less then obvious details:
* PlacesSidebar is private now and didn't seem to be to be particularly
easy to adapt to, so this moves to checking for it by name, not TYPE.
I couldn't find a (fast) better way; if you know how, please clean up
* added 2 casts to avoid warnings from the new type-propagating ref()
* GdkClipboard and GdkContentProvider need some properties dodged
* GtkToolItemGroup is gone
* fixed indentation and used TypeName:property-name syntax in a print()
diff --git a/gtk/tests/defaultvalue.c b/gtk/tests/defaultvalue.c
index 64a113c955822af0..b78dcd6f59353102 100644
--- a/gtk/tests/defaultvalue.c
+++ b/gtk/tests/defaultvalue.c
@@ -91,13 +91,13 @@ test_type (gconstpointer data)
klass = g_type_class_ref (type);
if (g_type_is_a (type, GTK_TYPE_SETTINGS))
- instance = g_object_ref (gtk_settings_get_default ());
+ instance = G_OBJECT (g_object_ref (gtk_settings_get_default ()));
else if (g_type_is_a (type, GDK_TYPE_PANGO_RENDERER))
- instance = g_object_ref (gdk_pango_renderer_get_default (gdk_screen_get_default ()));
+ instance = G_OBJECT (g_object_ref (gdk_pango_renderer_get_default (gdk_screen_get_default ())));
else if (g_type_is_a (type, GDK_TYPE_PIXMAP))
- instance = g_object_ref (gdk_pixmap_new (NULL, 1, 1, 1));
+ instance = G_OBJECT (g_object_ref (gdk_pixmap_new (NULL, 1, 1, 1)));
else if (g_type_is_a (type, GDK_TYPE_COLORMAP))
- instance = g_object_ref (gdk_colormap_new (gdk_visual_get_best (), TRUE));
+ instance = G_OBJECT (g_object_ref (gdk_colormap_new (gdk_visual_get_best (), TRUE)));
else if (g_type_is_a (type, GDK_TYPE_WINDOW))
{
GdkWindowAttr attributes;
@@ -105,7 +105,7 @@ test_type (gconstpointer data)
attributes.event_mask = 0;
attributes.width = 100;
attributes.height = 100;
- instance = g_object_ref (gdk_window_new (NULL, &attributes, 0));
+ instance = G_OBJECT (g_object_ref (gdk_window_new (NULL, &attributes, 0)));
}
else
instance = g_object_new (type, NULL);

16
gtk-32/gtk2-c89-6.patch Normal file
View File

@ -0,0 +1,16 @@
Convert to the expected pointer. This was not fixed before the file
was removed upstream.
diff --git a/modules/other/gail/gailtreeview.c b/modules/other/gail/gailtreeview.c
index 23923c59a16a6efb..ac6ff0a1c4a2fe22 100644
--- a/modules/other/gail/gailtreeview.c
+++ b/modules/other/gail/gailtreeview.c
@@ -995,7 +995,7 @@ gail_tree_view_ref_child (AtkObject *obj,
gail_cell_add_state (cell, ATK_STATE_FOCUSABLE, FALSE);
if (focus_index == i)
{
- gailview->focus_cell = g_object_ref (cell);
+ gailview->focus_cell = ATK_OBJECT (g_object_ref (cell));
gail_cell_add_state (cell, ATK_STATE_FOCUSED, FALSE);
g_signal_emit_by_name (gailview,
"active-descendant-changed",

115
gtk-32/gtk2-c89.patch Normal file
View File

@ -0,0 +1,115 @@
commit 072f06abf713d7536ce2a84a5ac266f585c88d39
Author: Matthias Clasen <mclasen@redhat.com>
Date: Fri Dec 8 17:48:47 2017 -0500
Fix fallout from g_object_ref change
g_object_ref now returns the type of the object that was
passed. Introduce cast as necessary to avoid warnings due
to this.
diff --git a/gtk/gtkcellrendererspin.c b/gtk/gtkcellrendererspin.c
index 2a3961bf203cbe59..7129d05e3b2c1ae6 100644
--- a/gtk/gtkcellrendererspin.c
+++ b/gtk/gtkcellrendererspin.c
@@ -207,7 +207,8 @@ gtk_cell_renderer_spin_set_property (GObject *object,
}
if (obj)
- priv->adjustment = g_object_ref_sink (obj);
+ priv->adjustment = GTK_ADJUSTMENT (g_object_ref_sink (obj));
+
break;
case PROP_CLIMB_RATE:
priv->climb_rate = g_value_get_double (value);
diff --git a/gtk/gtkcomboboxtext.c b/gtk/gtkcomboboxtext.c
index 9ffba687660c1214..5e75323c2c55d491 100644
--- a/gtk/gtkcomboboxtext.c
+++ b/gtk/gtkcomboboxtext.c
@@ -275,7 +275,7 @@ gtk_combo_box_text_buildable_custom_tag_start (GtkBuildable *buildable,
parser_data = g_slice_new0 (ItemParserData);
parser_data->builder = g_object_ref (builder);
- parser_data->object = g_object_ref (buildable);
+ parser_data->object = (GObject *)g_object_ref (buildable);
parser_data->domain = gtk_builder_get_translation_domain (builder);
*parser = item_parser;
*data = parser_data;
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index c47de5924f6f0b49..879586b0d9855374 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -1336,7 +1336,7 @@ gtk_label_buildable_custom_tag_start (GtkBuildable *buildable,
parser_data = g_slice_new0 (PangoParserData);
parser_data->builder = g_object_ref (builder);
- parser_data->object = g_object_ref (buildable);
+ parser_data->object = (GObject *) g_object_ref (buildable);
*parser = pango_parser;
*data = parser_data;
return TRUE;
diff --git a/gtk/gtktoolpalette.c b/gtk/gtktoolpalette.c
index b984193ca3375223..ba4e472dea4ebd77 100644
--- a/gtk/gtktoolpalette.c
+++ b/gtk/gtktoolpalette.c
@@ -734,7 +734,7 @@ gtk_tool_palette_add (GtkContainer *container,
g_ptr_array_add (palette->priv->groups, info);
info->pos = palette->priv->groups->len - 1;
- info->widget = g_object_ref_sink (child);
+ info->widget = (GtkToolItemGroup *)g_object_ref_sink (child);
gtk_widget_set_parent (child, GTK_WIDGET (palette));
}
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 89301eb91d21c793..0d2d15b4883a7110 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -14147,7 +14147,7 @@ gtk_tree_view_set_search_entry (GtkTreeView *tree_view,
if (entry)
{
- tree_view->priv->search_entry = g_object_ref (entry);
+ tree_view->priv->search_entry = GTK_WIDGET (g_object_ref (entry));
tree_view->priv->search_custom_entry_set = TRUE;
if (tree_view->priv->search_entry_changed_id == 0)
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index d8f6023ba3ae164c..b6d7b815505760da 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -10686,7 +10686,7 @@ gtk_widget_buildable_custom_tag_start (GtkBuildable *buildable,
AccelGroupParserData *parser_data;
parser_data = g_slice_new0 (AccelGroupParserData);
- parser_data->object = g_object_ref (buildable);
+ parser_data->object = (GObject *)g_object_ref (buildable);
*parser = accel_group_parser;
*data = parser_data;
return TRUE;
diff --git a/modules/printbackends/cups/gtkprintbackendcups.c b/modules/printbackends/cups/gtkprintbackendcups.c
index 2a000dc16ff57582..e081a70c45743fd2 100644
--- a/modules/printbackends/cups/gtkprintbackendcups.c
+++ b/modules/printbackends/cups/gtkprintbackendcups.c
@@ -3479,7 +3479,7 @@ cups_request_ppd (GtkPrinter *printer)
g_io_channel_set_encoding (data->ppd_io, NULL, NULL);
g_io_channel_set_close_on_unref (data->ppd_io, TRUE);
- data->printer = g_object_ref (printer);
+ data->printer = (GtkPrinterCups *) g_object_ref (printer);
resource = g_strdup_printf ("/printers/%s.ppd",
gtk_printer_cups_get_ppd_name (GTK_PRINTER_CUPS (printer)));
diff --git a/tests/testentrycompletion.c b/tests/testentrycompletion.c
index 36c41f78a42fb928..c556734b72ef71b0 100644
--- a/tests/testentrycompletion.c
+++ b/tests/testentrycompletion.c
@@ -237,7 +237,7 @@ animation_timer (GtkEntryCompletion *completion)
{
g_print ("removing model!\n");
- old_store = g_object_ref (gtk_entry_completion_get_model (completion));
+ old_store = GTK_LIST_STORE (g_object_ref (gtk_entry_completion_get_model (completion)));
gtk_entry_completion_set_model (completion, NULL);
}
else

42
gtk-32/gtk2-c99.patch Normal file
View File

@ -0,0 +1,42 @@
commit bcfc53066ae54d0adbf282d5678d9a4a7083b4d3
Author: Javier Jardón <jjardon@gnome.org>
Date: Mon May 3 02:56:29 2010 +0200
tests: Too many arguments in call to 'create_menu'
diff --git a/tests/testmenubars.c b/tests/testmenubars.c
index 416a93986121d858..853d822a9b6a7925 100644
--- a/tests/testmenubars.c
+++ b/tests/testmenubars.c
@@ -21,7 +21,7 @@
#include <gtk/gtk.h>
static GtkWidget *
-create_menu (depth)
+create_menu (guint depth)
{
GtkWidget *menu;
GtkWidget *menuitem;
@@ -70,19 +70,19 @@ create_menubar (GtkPackDirection pack_dir,
menuitem = gtk_image_menu_item_new_from_stock (GTK_STOCK_HOME, NULL);
gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem);
gtk_label_set_angle (GTK_LABEL (GTK_BIN (menuitem)->child), angle);
- menu = create_menu (2, TRUE);
+ menu = create_menu (2);
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), menu);
menuitem = gtk_menu_item_new_with_label ("foo");
gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem);
gtk_label_set_angle (GTK_LABEL (GTK_BIN (menuitem)->child), angle);
- menu = create_menu (2, TRUE);
+ menu = create_menu (2);
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), menu);
menuitem = gtk_menu_item_new_with_label ("bar");
gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem);
gtk_label_set_angle (GTK_LABEL (GTK_BIN (menuitem)->child), angle);
- menu = create_menu (2, TRUE);
+ menu = create_menu (2);
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), menu);
return menubar;

258
gtk-32/icon-padding.patch Normal file
View File

@ -0,0 +1,258 @@
diff -up gtk+-2.19.7/gtk/gtkstatusicon.c.icon-padding gtk+-2.19.7/gtk/gtkstatusicon.c
--- gtk+-2.19.7/gtk/gtkstatusicon.c.icon-padding 2010-03-08 08:42:22.000000000 -0500
+++ gtk+-2.19.7/gtk/gtkstatusicon.c 2010-03-10 00:40:11.165527903 -0500
@@ -170,6 +170,7 @@ static void gtk_status_icon_screen_c
GdkScreen *old_screen);
static void gtk_status_icon_embedded_changed (GtkStatusIcon *status_icon);
static void gtk_status_icon_orientation_changed (GtkStatusIcon *status_icon);
+static void gtk_status_icon_padding_changed (GtkStatusIcon *status_icon);
static gboolean gtk_status_icon_scroll (GtkStatusIcon *status_icon,
GdkEventScroll *event);
static gboolean gtk_status_icon_query_tooltip (GtkStatusIcon *status_icon,
@@ -850,6 +851,8 @@ gtk_status_icon_init (GtkStatusIcon *sta
G_CALLBACK (gtk_status_icon_embedded_changed), status_icon);
g_signal_connect_swapped (priv->tray_icon, "notify::orientation",
G_CALLBACK (gtk_status_icon_orientation_changed), status_icon);
+ g_signal_connect_swapped (priv->tray_icon, "notify::padding",
+ G_CALLBACK (gtk_status_icon_padding_changed), status_icon);
g_signal_connect_swapped (priv->tray_icon, "button-press-event",
G_CALLBACK (gtk_status_icon_button_press), status_icon);
g_signal_connect_swapped (priv->tray_icon, "button-release-event",
@@ -975,6 +978,8 @@ gtk_status_icon_finalize (GObject *objec
g_signal_handlers_disconnect_by_func (priv->tray_icon,
gtk_status_icon_orientation_changed, status_icon);
g_signal_handlers_disconnect_by_func (priv->tray_icon,
+ gtk_status_icon_padding_changed, status_icon);
+ g_signal_handlers_disconnect_by_func (priv->tray_icon,
gtk_status_icon_button_press, status_icon);
g_signal_handlers_disconnect_by_func (priv->tray_icon,
gtk_status_icon_button_release, status_icon);
@@ -1679,14 +1684,32 @@ gtk_status_icon_screen_changed (GtkStatu
#ifdef GDK_WINDOWING_X11
static void
+gtk_status_icon_padding_changed (GtkStatusIcon *status_icon)
+{
+ GtkStatusIconPrivate *priv = status_icon->priv;
+ GtkOrientation orientation;
+ gint padding;
+
+ orientation = _gtk_tray_icon_get_orientation (GTK_TRAY_ICON (priv->tray_icon));
+ padding = _gtk_tray_icon_get_padding (GTK_TRAY_ICON (priv->tray_icon));
+
+ if (orientation == GTK_ORIENTATION_HORIZONTAL)
+ gtk_misc_set_padding (GTK_MISC (priv->image), padding, 0);
+ else
+ gtk_misc_set_padding (GTK_MISC (priv->image), 0, padding);
+}
+
+static void
gtk_status_icon_embedded_changed (GtkStatusIcon *status_icon)
{
+ gtk_status_icon_padding_changed (status_icon);
g_object_notify (G_OBJECT (status_icon), "embedded");
}
static void
gtk_status_icon_orientation_changed (GtkStatusIcon *status_icon)
{
+ gtk_status_icon_padding_changed (status_icon);
g_object_notify (G_OBJECT (status_icon), "orientation");
}
@@ -1804,7 +1827,7 @@ gtk_status_icon_reset_image_data (GtkSta
g_object_notify (G_OBJECT (status_icon), "stock");
break;
-
+
case GTK_IMAGE_ICON_NAME:
g_free (priv->image_data.icon_name);
priv->image_data.icon_name = NULL;
diff -up gtk+-2.19.7/gtk/gtktrayicon.h.icon-padding gtk+-2.19.7/gtk/gtktrayicon.h
--- gtk+-2.19.7/gtk/gtktrayicon.h.icon-padding 2009-10-18 01:35:45.000000000 -0400
+++ gtk+-2.19.7/gtk/gtktrayicon.h 2010-03-10 00:40:11.169528392 -0500
@@ -69,7 +69,8 @@ void _gtk_tray_icon_cancel_mes
guint id);
GtkOrientation _gtk_tray_icon_get_orientation (GtkTrayIcon *icon);
-
+gint _gtk_tray_icon_get_padding (GtkTrayIcon *icon);
+
G_END_DECLS
#endif /* __GTK_TRAY_ICON_H__ */
diff -up gtk+-2.19.7/gtk/gtktrayicon-x11.c.icon-padding gtk+-2.19.7/gtk/gtktrayicon-x11.c
--- gtk+-2.19.7/gtk/gtktrayicon-x11.c.icon-padding 2010-03-08 21:01:28.000000000 -0500
+++ gtk+-2.19.7/gtk/gtktrayicon-x11.c 2010-03-10 00:49:48.229509604 -0500
@@ -43,23 +43,26 @@
enum {
PROP_0,
- PROP_ORIENTATION
+ PROP_ORIENTATION,
+ PROP_PADDING
};
struct _GtkTrayIconPrivate
{
guint stamp;
-
+
Atom selection_atom;
Atom manager_atom;
Atom system_tray_opcode_atom;
Atom orientation_atom;
Atom visual_atom;
+ Atom padding_atom;
Window manager_window;
GdkVisual *manager_visual;
gboolean manager_visual_rgba;
GtkOrientation orientation;
+ gint padding;
};
static void gtk_tray_icon_constructed (GObject *object);
@@ -113,6 +116,16 @@ gtk_tray_icon_class_init (GtkTrayIconCla
GTK_ORIENTATION_HORIZONTAL,
GTK_PARAM_READABLE));
+ g_object_class_install_property (gobject_class,
+ PROP_PADDING,
+ g_param_spec_int ("padding",
+ P_("Padding"),
+ P_("Padding that should be put around icons in the tray"),
+ 0,
+ G_MAXINT,
+ 0,
+ GTK_PARAM_READABLE));
+
g_type_class_add_private (class, sizeof (GtkTrayIconPrivate));
}
@@ -124,6 +137,7 @@ gtk_tray_icon_init (GtkTrayIcon *icon)
icon->priv->stamp = 1;
icon->priv->orientation = GTK_ORIENTATION_HORIZONTAL;
+ icon->priv->padding = 0;
gtk_widget_set_app_paintable (GTK_WIDGET (icon), TRUE);
gtk_widget_add_events (GTK_WIDGET (icon), GDK_PROPERTY_CHANGE_MASK);
@@ -161,6 +175,10 @@ gtk_tray_icon_constructed (GObject *obje
"_NET_SYSTEM_TRAY_VISUAL",
False);
+ icon->priv->padding_atom = XInternAtom (xdisplay,
+ "_NET_SYSTEM_TRAY_PADDING",
+ False);
+
/* Add a root window filter so that we get changes on MANAGER */
gdk_window_add_filter (root_window,
gtk_tray_icon_manager_filter, icon);
@@ -212,6 +230,9 @@ gtk_tray_icon_get_property (GObject *
case PROP_ORIENTATION:
g_value_set_enum (value, icon->priv->orientation);
break;
+ case PROP_PADDING:
+ g_value_set_int (value, icon->priv->padding);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -372,9 +393,58 @@ gtk_tray_icon_get_visual_property (GtkTr
XFree (prop.prop);
}
+static void
+gtk_tray_icon_get_padding_property (GtkTrayIcon *icon)
+{
+ GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (icon));
+ GdkDisplay *display = gdk_screen_get_display (screen);
+ Display *xdisplay = GDK_DISPLAY_XDISPLAY (display);
+
+ Atom type;
+ int format;
+ union {
+ gulong *prop;
+ guchar *prop_ch;
+ } prop = { NULL };
+ gulong nitems;
+ gulong bytes_after;
+ int error, result;
+
+ g_assert (icon->priv->manager_window != None);
+
+ gdk_error_trap_push ();
+ type = None;
+ result = XGetWindowProperty (xdisplay,
+ icon->priv->manager_window,
+ icon->priv->padding_atom,
+ 0, G_MAXLONG, FALSE,
+ XA_CARDINAL,
+ &type, &format, &nitems,
+ &bytes_after, &(prop.prop_ch));
+ error = gdk_error_trap_pop ();
+
+ if (!error && result == Success &&
+ type == XA_CARDINAL && nitems == 1 && format == 32)
+ {
+ gint padding;
+
+ padding = prop.prop[0];
+
+ if (icon->priv->padding != padding)
+ {
+ icon->priv->padding = padding;
+
+ g_object_notify (G_OBJECT (icon), "padding");
+ }
+ }
+
+ if (type != None)
+ XFree (prop.prop);
+}
+
static GdkFilterReturn
-gtk_tray_icon_manager_filter (GdkXEvent *xevent,
- GdkEvent *event,
+gtk_tray_icon_manager_filter (GdkXEvent *xevent,
+ GdkEvent *event,
gpointer user_data)
{
GtkTrayIcon *icon = user_data;
@@ -399,6 +469,11 @@ gtk_tray_icon_manager_filter (GdkXEvent
gtk_tray_icon_get_orientation_property (icon);
}
+ else if (xev->xany.type == PropertyNotify &&
+ xev->xproperty.atom == icon->priv->padding_atom)
+ {
+ gtk_tray_icon_get_padding_property (icon);
+ }
else if (xev->xany.type == DestroyNotify)
{
GTK_NOTE (PLUGSOCKET,
@@ -504,6 +579,7 @@ gtk_tray_icon_update_manager_window (Gtk
gtk_tray_icon_get_orientation_property (icon);
gtk_tray_icon_get_visual_property (icon);
+ gtk_tray_icon_get_padding_property (icon);
if (gtk_widget_get_realized (GTK_WIDGET (icon)))
{
@@ -740,6 +816,14 @@ _gtk_tray_icon_get_orientation (GtkTrayI
return icon->priv->orientation;
}
+gint
+_gtk_tray_icon_get_padding (GtkTrayIcon *icon)
+{
+ g_return_val_if_fail (GTK_IS_TRAY_ICON (icon), 0);
+
+ return icon->priv->padding;
+}
+
#define __GTK_TRAY_ICON_X11_C__
#include "gtkaliasdef.c"

View File

@ -0,0 +1,182 @@
diff --git a/gtk/gtktooltip.c b/gtk/gtktooltip.c
index 5cc2334..204a2b6 100644
--- a/gtk/gtktooltip.c
+++ b/gtk/gtktooltip.c
@@ -903,53 +903,128 @@ gtk_tooltip_position (GtkTooltip *tooltip,
{
gint x, y;
GdkScreen *screen;
+ gint monitor_num;
+ GdkRectangle monitor;
+ GtkRequisition requisition;
+ guint cursor_size;
+ GdkRectangle bounds;
+
+#define MAX_DISTANCE 32
tooltip->tooltip_widget = new_tooltip_widget;
+ screen = gtk_widget_get_screen (new_tooltip_widget);
+
+ gtk_widget_size_request (GTK_WIDGET (tooltip->current_window), &requisition);
+
+ monitor_num = gdk_screen_get_monitor_at_point (screen,
+ tooltip->last_x,
+ tooltip->last_y);
+ gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
+
+ get_bounding_box (new_tooltip_widget, &bounds);
+
/* Position the tooltip */
- /* FIXME: should we swap this when RTL is enabled? */
- if (tooltip->keyboard_mode_enabled)
+
+ cursor_size = gdk_display_get_default_cursor_size (display);
+
+ /* Try below */
+ x = bounds.x + bounds.width / 2 - requisition.width / 2;
+ y = bounds.y + bounds.height + 4;
+
+ if (y + requisition.height <= monitor.y + monitor.height)
{
- GdkRectangle bounds;
+ if (tooltip->keyboard_mode_enabled)
+ goto found;
- get_bounding_box (new_tooltip_widget, &bounds);
+ if (y <= tooltip->last_y + cursor_size + MAX_DISTANCE)
+ {
+ if (tooltip->last_x + cursor_size + MAX_DISTANCE < x)
+ x = tooltip->last_x + cursor_size + MAX_DISTANCE;
+ else if (x + requisition.width < tooltip->last_x - MAX_DISTANCE)
+ x = tooltip->last_x - MAX_DISTANCE - requisition.width;
- /* For keyboard mode we position the tooltip below the widget,
- * right of the center of the widget.
- */
- x = bounds.x + bounds.width / 2;
- y = bounds.y + bounds.height + 4;
+ goto found;
+ }
+ }
+
+ /* Try above */
+ x = bounds.x + bounds.width / 2 - requisition.width / 2;
+ y = bounds.y - requisition.height - 4;
+
+ if (y >= monitor.y)
+ {
+ if (tooltip->keyboard_mode_enabled)
+ goto found;
+
+ if (y + requisition.height >= tooltip->last_y - MAX_DISTANCE)
+ {
+ if (tooltip->last_x + cursor_size + MAX_DISTANCE < x)
+ x = tooltip->last_x + cursor_size + MAX_DISTANCE;
+ else if (x + requisition.width < tooltip->last_x - MAX_DISTANCE)
+ x = tooltip->last_x - MAX_DISTANCE - requisition.width;
+
+ goto found;
+ }
}
- else
+
+ /* Try right FIXME: flip on rtl ? */
+ x = bounds.x + bounds.width + 4;
+ y = bounds.y + bounds.height / 2 - requisition.height / 2;
+
+ if (x + requisition.width <= monitor.x + monitor.width)
{
- guint cursor_size;
+ if (tooltip->keyboard_mode_enabled)
+ goto found;
- x = tooltip->last_x;
- y = tooltip->last_y;
+ if (x <= tooltip->last_x + cursor_size + MAX_DISTANCE)
+ {
+ if (tooltip->last_y + cursor_size + MAX_DISTANCE < y)
+ y = tooltip->last_y + cursor_size + MAX_DISTANCE;
+ else if (y + requisition.height < tooltip->last_y - MAX_DISTANCE)
+ y = tooltip->last_y - MAX_DISTANCE - requisition.height;
- /* For mouse mode, we position the tooltip right of the cursor,
- * a little below the cursor's center.
- */
- cursor_size = gdk_display_get_default_cursor_size (display);
- x += cursor_size / 2;
- y += cursor_size / 2;
+ goto found;
+ }
}
- screen = gtk_widget_get_screen (new_tooltip_widget);
+ /* Try left FIXME: flip on rtl ? */
+ x = bounds.x - requisition.width - 4;
+ y = bounds.y + bounds.height / 2 - requisition.height / 2;
- /* Show it */
- if (tooltip->current_window)
+ if (x >= monitor.x)
{
- gint monitor_num;
- GdkRectangle monitor;
- GtkRequisition requisition;
+ if (tooltip->keyboard_mode_enabled)
+ goto found;
- gtk_widget_size_request (GTK_WIDGET (tooltip->current_window),
- &requisition);
+ if (x + requisition.width >= tooltip->last_x - MAX_DISTANCE)
+ {
+ if (tooltip->last_y + cursor_size + MAX_DISTANCE < y)
+ y = tooltip->last_y + cursor_size + MAX_DISTANCE;
+ else if (y + requisition.height < tooltip->last_y - MAX_DISTANCE)
+ y = tooltip->last_y - MAX_DISTANCE - requisition.height;
- monitor_num = gdk_screen_get_monitor_at_point (screen, x, y);
- gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
+ goto found;
+ }
+ }
+ /* Fallback */
+ if (tooltip->keyboard_mode_enabled)
+ {
+ x = bounds.x + bounds.width / 2 - requisition.width / 2;
+ y = bounds.y + bounds.height + 4;
+ }
+ else
+ {
+ /* At cursor */
+ x = tooltip->last_x + cursor_size * 3 / 4;
+ y = tooltip->last_y + cursor_size * 3 / 4;
+ }
+
+found:
+ /* Show it */
+ if (tooltip->current_window)
+ {
if (x + requisition.width > monitor.x + monitor.width)
x -= x - (monitor.x + monitor.width) + requisition.width;
else if (x < monitor.x)
@@ -957,7 +1032,9 @@ gtk_tooltip_position (GtkTooltip *tooltip,
if (y + requisition.height > monitor.y + monitor.height)
y -= y - (monitor.y + monitor.height) + requisition.height;
-
+ else if (y < monitor.y)
+ y = monitor.y;
+
if (!tooltip->keyboard_mode_enabled)
{
/* don't pop up under the pointer */
@@ -965,7 +1042,7 @@ gtk_tooltip_position (GtkTooltip *tooltip,
y <= tooltip->last_y && tooltip->last_y < y + requisition.height)
y = tooltip->last_y - requisition.height - 2;
}
-
+
gtk_window_move (GTK_WINDOW (tooltip->current_window), x, y);
gtk_widget_show (GTK_WIDGET (tooltip->current_window));
}

View File

@ -0,0 +1,116 @@
diff -up gtk+-2.24.7/gtk/gtkmenushell.c.window-dragging gtk+-2.24.7/gtk/gtkmenushell.c
--- gtk+-2.24.7/gtk/gtkmenushell.c.window-dragging 2011-08-15 22:30:52.000000000 -0400
+++ gtk+-2.24.7/gtk/gtkmenushell.c 2011-10-17 19:50:52.180468086 -0400
@@ -589,18 +589,45 @@ gtk_menu_shell_button_press (GtkWidget
if (!menu_shell->active || !menu_shell->button)
{
- gtk_menu_shell_activate (menu_shell);
+ gboolean initially_active = menu_shell->active;
menu_shell->button = event->button;
- if (menu_item && _gtk_menu_item_is_selectable (menu_item) &&
- menu_item->parent == widget &&
- menu_item != menu_shell->active_menu_item)
+ if (menu_item)
{
- if (GTK_MENU_SHELL_GET_CLASS (menu_shell)->submenu_placement == GTK_TOP_BOTTOM)
+ if (_gtk_menu_item_is_selectable (menu_item) &&
+ menu_item->parent == widget &&
+ menu_item != menu_shell->active_menu_item)
{
- menu_shell->activate_time = event->time;
- gtk_menu_shell_select_item (menu_shell, menu_item);
+ gtk_menu_shell_activate (menu_shell);
+ menu_shell->button = event->button;
+
+ if (GTK_MENU_SHELL_GET_CLASS (menu_shell)->submenu_placement == GTK_TOP_BOTTOM)
+ {
+ menu_shell->activate_time = event->time;
+ gtk_menu_shell_select_item (menu_shell, menu_item);
+ }
+ }
+ }
+ else
+ {
+ if (!initially_active)
+ {
+ gboolean window_drag = FALSE;
+
+ gtk_widget_style_get (widget,
+ "window-dragging", &window_drag,
+ NULL);
+
+ if (window_drag)
+ {
+ gtk_menu_shell_deactivate (menu_shell);
+ gtk_window_begin_move_drag (GTK_WINDOW (gtk_widget_get_toplevel (widget)),
+ event->button,
+ event->x_root,
+ event->y_root,
+ event->time);
+ }
}
}
}
diff -up gtk+-2.24.7/gtk/gtktoolbar.c.window-dragging gtk+-2.24.7/gtk/gtktoolbar.c
--- gtk+-2.24.7/gtk/gtktoolbar.c.window-dragging 2011-10-01 11:29:06.000000000 -0400
+++ gtk+-2.24.7/gtk/gtktoolbar.c 2011-10-17 19:52:56.104463657 -0400
@@ -2701,6 +2701,8 @@ static gboolean
gtk_toolbar_button_press (GtkWidget *toolbar,
GdkEventButton *event)
{
+ GtkWidget *window;
+
if (_gtk_button_event_triggers_context_menu (event))
{
gboolean return_value;
@@ -2711,7 +2713,29 @@ gtk_toolbar_button_press (GtkWidget
return return_value;
}
-
+
+ window = gtk_widget_get_toplevel (toolbar);
+
+ if (window)
+ {
+ gboolean window_drag = FALSE;
+
+ gtk_widget_style_get (toolbar,
+ "window-dragging", &window_drag,
+ NULL);
+
+ if (window_drag)
+ {
+ gtk_window_begin_move_drag (GTK_WINDOW (window),
+ event->button,
+ event->x_root,
+ event->y_root,
+ event->time);
+
+ return TRUE;
+ }
+ }
+
return FALSE;
}
diff -up gtk+-2.24.7/gtk/gtkwidget.c.window-dragging gtk+-2.24.7/gtk/gtkwidget.c
--- gtk+-2.24.7/gtk/gtkwidget.c.window-dragging 2011-10-17 19:50:52.175468086 -0400
+++ gtk+-2.24.7/gtk/gtkwidget.c 2011-10-17 19:50:52.184468086 -0400
@@ -2467,6 +2467,13 @@ gtk_widget_class_init (GtkWidgetClass *k
0.0, 1.0, 0.04,
GTK_PARAM_READABLE));
+ gtk_widget_class_install_style_property (klass,
+ g_param_spec_boolean ("window-dragging",
+ P_("Window dragging"),
+ P_("Window dragging"),
+ FALSE,
+ GTK_PARAM_READWRITE));
+
/**
* GtkWidget:draw-border:
*