summaryrefslogtreecommitdiff
path: root/geyes
diff options
context:
space:
mode:
authorColomban Wendling <[email protected]>2023-07-13 10:09:07 +0200
committerraveit65 <[email protected]>2023-07-17 02:47:28 +0200
commit41458272ba8e4a01c5ce6a5e0b74d17a7ad80535 (patch)
tree73f0c2ac619b8f1b377cce357772eb36d9afd5f7 /geyes
parent84498251fab3fdbd4031478eea4dfe4eb8c0c28b (diff)
downloadmate-applets-41458272ba8e4a01c5ce6a5e0b74d17a7ad80535.tar.bz2
mate-applets-41458272ba8e4a01c5ce6a5e0b74d17a7ad80535.tar.xz
geyes: Add support for building in-process
Diffstat (limited to 'geyes')
-rw-r--r--geyes/data/Makefile.am26
-rw-r--r--geyes/data/org.mate.applets.GeyesApplet.mate-panel-applet.desktop.in.in4
-rw-r--r--geyes/data/org.mate.panel.applet.GeyesAppletFactory.service.in2
-rw-r--r--geyes/src/Makefile.am23
-rw-r--r--geyes/src/geyes.c25
5 files changed, 56 insertions, 24 deletions
diff --git a/geyes/data/Makefile.am b/geyes/data/Makefile.am
index 0342bdaf..7d85e179 100644
--- a/geyes/data/Makefile.am
+++ b/geyes/data/Makefile.am
@@ -1,29 +1,39 @@
NULL =
-appletdir = $(datadir)/mate-panel/applets
applet_in_files = org.mate.applets.GeyesApplet.mate-panel-applet.desktop.in
+service_in_files = org.mate.panel.applet.GeyesAppletFactory.service.in
+gschema_in_files = org.mate.panel.applet.geyes.gschema.xml.in
+
+if ENABLE_IN_PROCESS
+APPLET_LOCATION = $(pkglibdir)/libmate-geyes-applet.so
+else !ENABLE_IN_PROCESS
+APPLET_LOCATION = $(libexecdir)/mate-geyes-applet
+endif !ENABLE_IN_PROCESS
+
+appletdir = $(datadir)/mate-panel/applets
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|\@APPLET_LOCATION\@|$(APPLET_LOCATION)|" \
+ -e "s|\@APPLET_IN_PROCESS\@|$(APPLET_IN_PROCESS)|" \
-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 $@
+if !ENABLE_IN_PROCESS
servicedir = $(datadir)/dbus-1/services
-service_in_files = org.mate.panel.applet.GeyesAppletFactory.service.in
service_DATA = $(service_in_files:.service.in=.service)
-org.mate.panel.applet.GeyesAppletFactory.service: $(service_in_files)
+$(service_DATA): $(service_in_files) Makefile
$(AM_V_GEN)sed \
- -e "s|\@LIBEXECDIR\@|$(libexecdir)|" \
+ -e "s|\@APPLET_LOCATION\@|$(APPLET_LOCATION)|" \
$< > $@
+endif !ENABLE_IN_PROCESS
-geyes_gschema_in_files = org.mate.panel.applet.geyes.gschema.xml.in
-gsettings_SCHEMAS = $(geyes_gschema_in_files:.xml.in=.xml)
+gsettings_SCHEMAS = $(gschema_in_files:.xml.in=.xml)
@GSETTINGS_RULES@
CLEANFILES = \
@@ -40,7 +50,7 @@ EXTRA_DIST = \
themes.ui \
$(applet_in_files).in \
$(service_in_files) \
- $(geyes_gschema_in_files) \
+ $(gschema_in_files) \
$(NULL)
-include $(top_srcdir)/git.mk
diff --git a/geyes/data/org.mate.applets.GeyesApplet.mate-panel-applet.desktop.in.in b/geyes/data/org.mate.applets.GeyesApplet.mate-panel-applet.desktop.in.in
index eaadb5f3..3a7c4f21 100644
--- a/geyes/data/org.mate.applets.GeyesApplet.mate-panel-applet.desktop.in.in
+++ b/geyes/data/org.mate.applets.GeyesApplet.mate-panel-applet.desktop.in.in
@@ -1,6 +1,7 @@
[Applet Factory]
Id=GeyesAppletFactory
-Location=@LIBEXECDIR@/mate-geyes-applet
+Location=@APPLET_LOCATION@
+InProcess=@APPLET_IN_PROCESS@
Name=Eyes Applet Factory
Description=Eyes Applet Factory
@@ -10,6 +11,7 @@ Description=A set of eyeballs for your panel
# Translators: Do NOT translate or transliterate this text (this is an icon file name)!
Icon=mate-eyes-applet
MateComponentId=OAFIID:MATE_GeyesApplet
+Platforms=X11;
X-MATE-Bugzilla-Bugzilla=MATE
X-MATE-Bugzilla-Product=mate-applets
X-MATE-Bugzilla-Component=geyes
diff --git a/geyes/data/org.mate.panel.applet.GeyesAppletFactory.service.in b/geyes/data/org.mate.panel.applet.GeyesAppletFactory.service.in
index 2f490e7b..9f2b6073 100644
--- a/geyes/data/org.mate.panel.applet.GeyesAppletFactory.service.in
+++ b/geyes/data/org.mate.panel.applet.GeyesAppletFactory.service.in
@@ -1,3 +1,3 @@
[D-BUS Service]
Name=org.mate.panel.applet.GeyesAppletFactory
-Exec=@LIBEXECDIR@/mate-geyes-applet
+Exec=@APPLET_LOCATION@
diff --git a/geyes/src/Makefile.am b/geyes/src/Makefile.am
index 22856564..912553cb 100644
--- a/geyes/src/Makefile.am
+++ b/geyes/src/Makefile.am
@@ -9,20 +9,31 @@ AM_CPPFLAGS = \
-DGEYES_RESOURCE_PATH=\""/org/mate/mate-applets/eyes/"\" \
${WARN_CFLAGS}
-libexec_PROGRAMS = mate-geyes-applet
-
BUILT_SOURCES = geyes-resources.c geyes-resources.h
-nodist_mate_geyes_applet_SOURCES = $(BUILT_SOURCES)
-mate_geyes_applet_SOURCES = \
+APPLET_SOURCES = \
geyes.c \
geyes.h \
themes.c \
$(NULL)
-
-mate_geyes_applet_LDADD = \
+APPLET_LIBS = \
$(MATE_APPLETS4_LIBS) \
-lm
+if ENABLE_IN_PROCESS
+pkglib_LTLIBRARIES = libmate-geyes-applet.la
+nodist_libmate_geyes_applet_la_SOURCES = $(BUILT_SOURCES)
+libmate_geyes_applet_la_SOURCES = $(APPLET_SOURCES)
+libmate_geyes_applet_la_CFLAGS = $(AM_CFLAGS)
+libmate_geyes_applet_la_LDFLAGS = -module -avoid-version
+libmate_geyes_applet_la_LIBADD = $(APPLET_LIBS)
+else !ENABLE_IN_PROCESS
+libexec_PROGRAMS = mate-geyes-applet
+nodist_mate_geyes_applet_SOURCES = $(BUILT_SOURCES)
+mate_geyes_applet_SOURCES = $(APPLET_SOURCES)
+mate_geyes_applet_CFLAGS = $(AM_CFLAGS)
+mate_geyes_applet_LDADD = $(APPLET_LIBS)
+endif !ENABLE_IN_PROCESS
+
geyes-resources.c: $(srcdir)/../data/geyes-resources.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir)/../data --generate-dependencies $(srcdir)/../data/geyes-resources.gresource.xml)
$(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir)/../data --generate --c-name eyes $<
diff --git a/geyes/src/geyes.c b/geyes/src/geyes.c
index 5fdecf38..8bf793b3 100644
--- a/geyes/src/geyes.c
+++ b/geyes/src/geyes.c
@@ -135,6 +135,7 @@ timer_cb (EyesApplet *eyes_applet)
gint x, y, dx, dy;
gint pupil_x, pupil_y;
gsize i;
+ int applet_x,applet_y;
display = gtk_widget_get_display (GTK_WIDGET (eyes_applet->applet));
seat = gdk_display_get_default_seat (display);
@@ -144,9 +145,17 @@ timer_cb (EyesApplet *eyes_applet)
gdk_window_get_device_position (gtk_widget_get_window (eyes_applet->eyes[i]),
gdk_seat_get_pointer (seat),
&x, &y, NULL);
+
+#ifdef ENABLE_IN_PROCESS
+ gdk_window_get_origin (gtk_widget_get_window (GTK_WIDGET(eyes_applet->applet)),
+ &applet_x, &applet_y);
+#else
+ applet_x = 0;
+ applet_y = 0;
+#endif
gtk_widget_translate_coordinates (eyes_applet->eyes[i],
gtk_widget_get_toplevel(eyes_applet->eyes[i]),
- 0, 0, &dx, &dy);
+ -applet_x, -applet_y, &dx, &dy);
x -= dx;
y -= dy;
@@ -258,8 +267,6 @@ setup_eyes (EyesApplet *eyes_applet)
gtk_widget_set_valign (eyes_applet->eyes[i], GTK_ALIGN_CENTER);
}
- gtk_widget_realize (eyes_applet->eyes[i]);
-
eyes_applet->pointer_last_x[i] = G_MAXINT;
eyes_applet->pointer_last_y[i] = G_MAXINT;
@@ -398,7 +405,9 @@ geyes_applet_fill (MatePanelApplet *applet)
GtkActionGroup *action_group;
gboolean result;
+#ifndef ENABLE_IN_PROCESS
g_set_application_name (_("Eyes"));
+#endif
gtk_window_set_default_icon_name ("mate-eyes-applet");
mate_panel_applet_set_flags (applet, MATE_PANEL_APPLET_EXPAND_MINOR);
@@ -466,8 +475,8 @@ geyes_applet_factory (MatePanelApplet *applet,
return retval;
}
-MATE_PANEL_APPLET_OUT_PROCESS_FACTORY ("GeyesAppletFactory",
- PANEL_TYPE_APPLET,
- "geyes",
- geyes_applet_factory,
- NULL)
+PANEL_APPLET_FACTORY ("GeyesAppletFactory",
+ PANEL_TYPE_APPLET,
+ "geyes",
+ geyes_applet_factory,
+ NULL)