Allow to optionally build `x11/gxkb' against GTKv3 instead of v2 and

tell PORTSCOUT to skip version 0.9.0 as it carries no other changes.

PR:	251899
This commit is contained in:
Alexey Dokuchaev 2021-04-12 09:56:26 +00:00
parent ce69d7fccb
commit 4f62babfc4
2 changed files with 122 additions and 5 deletions

View File

@ -10,20 +10,29 @@ COMMENT= X11 keyboard layout indicator and switcher
LICENSE= GPLv2
LIB_DEPENDS= libxklavier.so:x11/libxklavier \
libwnck-1.so:x11-toolkits/libwnck
LIB_DEPENDS= libxklavier.so:x11/libxklavier
USES= gnome pkgconfig
GNU_CONFIGURE= yes
USE_GNOME= gdkpixbuf2 glib20 gtk20
USE_GNOME= gdkpixbuf2 glib20
PORTSCOUT= skipv:0.9.0 # same as 0.8.2, but GTK3 is the default
PORTDOCS= AUTHORS NEWS
OPTIONS_DEFINE= DOCS
OPTIONS_DEFINE= DOCS GTK3
GTK3_DESC= Build against GTK version 3, not 2
GTK3_EXTRA_PATCHES= ${FILESDIR}/extra-patch-gtk3
GTK3_LIB_DEPENDS= libwnck-3.so:x11-toolkits/libwnck3
GTK3_LIB_DEPENDS_OFF= libwnck-1.so:x11-toolkits/libwnck
GTK3_USES= autoreconf
GTK3_USE= GNOME=gtk30
GTK3_USE_OFF= GNOME=gtk20
post-patch-DOCS-on:
@${REINPLACE_CMD} -e '/^doc_DATA/s, C[^ ]*,,g' \
${WRKSRC}/doc/Makefile.in
${WRKSRC}/doc/Makefile.[ai][mn]
post-patch-DOCS-off:
@${REINPLACE_CMD} -e '/^SUBDIRS/s, doc,,' ${WRKSRC}/Makefile.in

View File

@ -0,0 +1,108 @@
GTK3 support, courtesy of Mateusz Łukasik <mati75@linuxmint.pl>
--- configure.ac.orig 2020-07-07 08:50:37 UTC
+++ configure.ac
@@ -7,10 +7,10 @@ AC_PROG_RANLIB
AM_PROG_CC_C_O
AC_HEADER_STDC
PKG_PROG_PKG_CONFIG([0.20])
-PKG_CHECK_MODULES(GTK, [gtk+-2.0 >= 2.12.0])
+PKG_CHECK_MODULES(GTK, [gtk+-3.0])
PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.16.0])
PKG_CHECK_MODULES(LIBXKLAVIER, [libxklavier >= 3.0])
-PKG_CHECK_MODULES(LIBWNCK, [libwnck-1.0 >= 2.22.0])
+PKG_CHECK_MODULES(LIBWNCK, [libwnck-3.0])
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)
AC_SUBST(GLIB_CFLAGS)
--- src/statusicon.c.orig 2020-07-07 08:50:37 UTC
+++ src/statusicon.c
@@ -74,9 +74,7 @@ gtk_status_icon_clicked( GtkStatusIcon *status_icon, g
if( xkb_config_get_group_count() > 2 )
{
- gtk_menu_popup( GTK_MENU( lb_mouse_popup ), NULL, NULL,
- gtk_status_icon_position_menu, status_icon,
- 0, gtk_get_current_event_time() );
+ gtk_menu_popup_at_pointer( GTK_MENU( lb_mouse_popup ), NULL );
}
else
{
@@ -116,9 +114,7 @@ gtk_status_icon_popup_menu( GtkStatusIcon *status_icon
if( status_icon == NULL )
return;
- gtk_menu_popup( GTK_MENU( rb_mouse_popup ),
- NULL, NULL, gtk_status_icon_position_menu, status_icon, button,
- activate_time );
+ gtk_menu_popup_at_pointer( GTK_MENU( rb_mouse_popup ), NULL );
}
void
@@ -153,7 +149,7 @@ statusicon_update_current_image( void )
}
gtk_status_icon_set_from_pixbuf( trayicon, pixmap );
- gtk_status_icon_set_tooltip( trayicon, g_ascii_strup( group_name, -1 ) );
+ gtk_status_icon_set_tooltip_text( trayicon, g_ascii_strup( group_name, -1 ) );
}
else if( icon_type == APPINDICATOR )
{
@@ -220,7 +216,7 @@ statusicon_update_menu( void )
if( icon_type == APPINDICATOR )
{
// Separator
- mi = gtk_menu_item_new();
+ mi = gtk_separator_menu_item_new();
gtk_widget_show( mi );
gtk_menu_shell_append( GTK_MENU_SHELL( lb_mouse_popup ), mi );
gtk_widget_set_sensitive( mi, FALSE );
@@ -231,20 +227,21 @@ statusicon_update_menu( void )
rb_mouse_popup = gtk_menu_new();
}
- mi = gtk_image_menu_item_new_from_stock( GTK_STOCK_ABOUT, NULL );
+ mi = gtk_image_menu_item_new_from_stock( "gtk-about", NULL );
g_signal_connect( G_OBJECT( mi ), "activate", (GCallback)xkb_about, NULL );
gtk_menu_shell_append( GTK_MENU_SHELL( rb_mouse_popup ), mi );
gtk_widget_show( mi );
if( icon_type == SYSTRAY )
{
- mi = gtk_menu_item_new();
+ // Separator
+ mi = gtk_separator_menu_item_new();
gtk_widget_show( mi );
gtk_menu_shell_append( GTK_MENU_SHELL( rb_mouse_popup ), mi );
gtk_widget_set_sensitive( mi, FALSE );
}
- mi = gtk_image_menu_item_new_from_stock( GTK_STOCK_QUIT, NULL );
+ mi = gtk_image_menu_item_new_from_stock( "gtk-quit", NULL );
g_signal_connect( G_OBJECT( mi ), "activate", (GCallback)xkb_main_quit, NULL );
gtk_menu_shell_append( GTK_MENU_SHELL( rb_mouse_popup ), mi );
gtk_widget_show( mi );
--- src/xkb-callbacks.c.orig 2019-08-09 18:09:51 UTC
+++ src/xkb-callbacks.c
@@ -74,12 +74,18 @@ xkb_about( void )
GtkWidget* about_dialog = gtk_about_dialog_new();
gtk_window_set_icon(
(GtkWindow*)about_dialog,
- gtk_widget_render_icon(about_dialog, GTK_STOCK_ABOUT, GTK_ICON_SIZE_DIALOG, NULL)
+ gtk_icon_theme_load_icon(
+ gtk_icon_theme_get_default(),
+ "gtk-about",
+ GTK_ICON_SIZE_DIALOG,
+ 0,
+ NULL
+ )
);
- const gchar* authors[] = { AUTHORS, NULL };
+ const gchar** authors = (const gchar**) g_strsplit( AUTHORS, "\n", -1 );
gtk_about_dialog_set_authors( (GtkAboutDialog*)about_dialog, authors );
- gtk_about_dialog_set_name( (GtkAboutDialog*)about_dialog, PACKAGE );
+ gtk_about_dialog_set_program_name( (GtkAboutDialog*)about_dialog, PACKAGE );
gtk_about_dialog_set_version( (GtkAboutDialog*)about_dialog, VERSION );
gtk_about_dialog_set_comments( (GtkAboutDialog*)about_dialog, DESCRIPTION );
gtk_about_dialog_set_website( (GtkAboutDialog*)about_dialog, PACKAGE_URL );