summaryrefslogtreecommitdiff
path: root/trashapplet
diff options
context:
space:
mode:
authorlukefromdc <[email protected]>2023-06-10 19:00:46 -0400
committerraveit65 <[email protected]>2023-07-16 23:06:44 +0200
commit22d571466674641a3a767e577373a3c5f78ab157 (patch)
treee5540d5b9ccaa23284521c231c25afd054589300 /trashapplet
parentffe372f717b19cf8d97cb187d63a68da1989e064 (diff)
downloadmate-applets-22d571466674641a3a767e577373a3c5f78ab157.tar.bz2
mate-applets-22d571466674641a3a767e577373a3c5f78ab157.tar.xz
trash: port to in-process for wayland support
- ensure applet can be left-clicked in wayland - In wayland we have to open the trash on the button press event - In x11 retain the existing behavior of opening the trash on the button release event - ensure both right and left clicks work in wayland - using code borrowed from cpufreq applet - Cleanup X11 checks
Diffstat (limited to 'trashapplet')
-rw-r--r--trashapplet/data/Makefile.am19
-rw-r--r--trashapplet/data/org.mate.applets.TrashApplet.mate-panel-applet.desktop.in.in3
-rw-r--r--trashapplet/data/org.mate.panel.applet.TrashAppletFactory.service.in3
-rw-r--r--trashapplet/src/Makefile.am19
-rw-r--r--trashapplet/src/trashapplet.c30
5 files changed, 36 insertions, 38 deletions
diff --git a/trashapplet/data/Makefile.am b/trashapplet/data/Makefile.am
index 8603d6c2..f318e0fb 100644
--- a/trashapplet/data/Makefile.am
+++ b/trashapplet/data/Makefile.am
@@ -1,32 +1,25 @@
+APPLET_LOCATION = $(libdir)/mate-applets/libtrashapplet.so
+
appletdir = $(datadir)/mate-panel/applets
applet_in_files = org.mate.applets.TrashApplet.mate-panel-applet.desktop.in
applet_DATA = $(applet_in_files:.mate-panel-applet.desktop.in=.mate-panel-applet)
$(applet_in_files): $(applet_in_files).in Makefile
$(AM_V_GEN)sed \
- -e "s|\@LIBEXECDIR\@|$(libexecdir)|" \
- -e "s|\@VERSION\@|$(PACKAGE_VERSION)|" \
- $< > $@
+ -e "s|\@APPLET_LOCATION\@|$(APPLET_LOCATION)|" \
+ -e "s|\@VERSION\@|$(PACKAGE_VERSION)|" \
+ $< > $@
$(applet_DATA): $(applet_in_files) Makefile
$(AM_V_GEN) $(MSGFMT) --desktop --keyword=Name --keyword=Description --template $< -d $(top_srcdir)/po -o $@
-servicedir = $(datadir)/dbus-1/services
-service_in_files = org.mate.panel.applet.TrashAppletFactory.service.in
-service_DATA = $(service_in_files:.service.in=.service)
-
-org.mate.panel.applet.TrashAppletFactory.service: $(service_in_files)
- $(AM_V_GEN)sed \
- -e "s|\@LIBEXECDIR\@|$(libexecdir)|" \
- $< > $@
EXTRA_DIST = \
$(applet_in_files).in \
- $(service_in_files) \
trashapplet-empty-progress.ui \
trashapplet-menu.xml \
trashapplet-resources.gresource.xml
-CLEANFILES = $(applet_DATA) $(applet_in_files) $(service_DATA)
+CLEANFILES = $(applet_DATA) $(applet_in_files)
-include $(top_srcdir)/git.mk
diff --git a/trashapplet/data/org.mate.applets.TrashApplet.mate-panel-applet.desktop.in.in b/trashapplet/data/org.mate.applets.TrashApplet.mate-panel-applet.desktop.in.in
index 77161ccc..d62a5a74 100644
--- a/trashapplet/data/org.mate.applets.TrashApplet.mate-panel-applet.desktop.in.in
+++ b/trashapplet/data/org.mate.applets.TrashApplet.mate-panel-applet.desktop.in.in
@@ -1,6 +1,7 @@
[Applet Factory]
Id=TrashAppletFactory
-Location=@LIBEXECDIR@/trashapplet
+InProcess=true
+Location=@APPLET_LOCATION@
Name=Trash Applet Factory
Description=Trash Applet Factory
diff --git a/trashapplet/data/org.mate.panel.applet.TrashAppletFactory.service.in b/trashapplet/data/org.mate.panel.applet.TrashAppletFactory.service.in
deleted file mode 100644
index ead24d1d..00000000
--- a/trashapplet/data/org.mate.panel.applet.TrashAppletFactory.service.in
+++ /dev/null
@@ -1,3 +0,0 @@
-[D-BUS Service]
-Name=org.mate.panel.applet.TrashAppletFactory
-Exec=@LIBEXECDIR@/trashapplet
diff --git a/trashapplet/src/Makefile.am b/trashapplet/src/Makefile.am
index 2def1827..1cad7acd 100644
--- a/trashapplet/src/Makefile.am
+++ b/trashapplet/src/Makefile.am
@@ -4,21 +4,20 @@ AM_CPPFLAGS = -I$(top_srcdir) \
-DGRESOURCE=\""/org/mate/mate-applets/trash/\"" \
${WARN_CFLAGS}
-libexec_PROGRAMS = trashapplet
+trashapplet_libdir= $(pkglibdir)
+trashapplet_lib_LTLIBRARIES=libtrashapplet.la
-BUILT_SOURCES = \
- trashapplet-resources.c \
- trashapplet-resources.h
-
-nodist_trashapplet_SOURCES = $(BUILT_SOURCES)
-trashapplet_SOURCES = \
+libtrashapplet_la_SOURCES = \
trashapplet.c \
trash-empty.h \
trash-empty.c \
xstuff.c \
- xstuff.h
+ xstuff.h \
+ trashapplet-resources.c \
+ trashapplet-resources.h \
+ $(NULL)
-trashapplet_LDADD = \
+libtrashapplet_la_LIBADD = \
$(MATE_APPLETS4_LIBS) \
$(GIO_LIBS) \
-lX11
@@ -30,6 +29,6 @@ trashapplet-resources.h: ../data/trashapplet-resources.gresource.xml $(shell $(G
$(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir)/../data/ --generate --c-name trashapplet $<
CLEANFILES = \
- $(BUILT_SOURCES)
+ $(NULL)
-include $(top_srcdir)/git.mk
diff --git a/trashapplet/src/trashapplet.c b/trashapplet/src/trashapplet.c
index eccf7c3d..515bab10 100644
--- a/trashapplet/src/trashapplet.c
+++ b/trashapplet/src/trashapplet.c
@@ -28,6 +28,7 @@
#include <string.h>
#include <glib/gi18n.h>
+#include <gdk/gdkx.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include <gio/gio.h>
@@ -255,21 +256,25 @@ trash_applet_button_release (GtkWidget *widget,
if (settings == NULL)
settings = g_settings_new (PANEL_SCHEMA);
- if (event->button == 1)
+ if (event->button == 2)
+ return FALSE;
+
+ if ((event->button == 1) &&
+ (event->type != GDK_2BUTTON_PRESS) &&
+ (event->type != GDK_3BUTTON_PRESS))
{
- if (g_settings_get_boolean (settings, PANEL_ENABLE_ANIMATIONS))
+#ifdef GDK_WINDOWING_X11
+ if (GDK_IS_X11_DISPLAY (gtk_widget_get_display (widget)) &&
+ g_settings_get_boolean (settings, PANEL_ENABLE_ANIMATIONS))
xstuff_zoom_animate (widget, NULL);
+#endif
trash_applet_open_folder (NULL, applet);
return TRUE;
}
- if (GTK_WIDGET_CLASS (trash_applet_parent_class)->button_release_event)
- return GTK_WIDGET_CLASS (trash_applet_parent_class)
- ->button_release_event (widget, event);
- else
- return FALSE;
+ return GTK_WIDGET_CLASS (trash_applet_parent_class)->button_press_event (widget, event);
}
static gboolean
trash_applet_key_press (GtkWidget *widget,
@@ -603,7 +608,12 @@ trash_applet_class_init (TrashAppletClass *class)
gobject_class->dispose = trash_applet_dispose;
widget_class->size_allocate = trash_applet_size_allocate;
- widget_class->button_release_event = trash_applet_button_release;
+#ifdef GDK_WINDOWING_X11
+ if (GDK_IS_X11_DISPLAY (gdk_display_get_default ()))
+ widget_class->button_release_event = trash_applet_button_release;
+ else /* for Wayland we need to watch button press rather than release */
+#endif
+ widget_class->button_press_event = trash_applet_button_release;
widget_class->key_press_event = trash_applet_key_press;
widget_class->drag_motion = trash_applet_drag_motion;
widget_class->drag_data_received = trash_applet_drag_data_received;
@@ -621,8 +631,6 @@ trash_applet_factory (MatePanelApplet *applet,
AtkObject *atk_obj;
GtkActionGroup *action_group;
- g_set_application_name (_("Trash Applet"));
-
gtk_window_set_default_icon_name ("user-trash");
/* Set up the menu */
@@ -651,7 +659,7 @@ trash_applet_factory (MatePanelApplet *applet,
return retval;
}
-MATE_PANEL_APPLET_OUT_PROCESS_FACTORY ("TrashAppletFactory",
+MATE_PANEL_APPLET_IN_PROCESS_FACTORY ("TrashAppletFactory",
TRASH_TYPE_APPLET,
"TrashApplet",
trash_applet_factory,