diff options
author | Colomban Wendling <[email protected]> | 2023-07-13 10:09:07 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2023-07-17 02:47:28 +0200 |
commit | 41458272ba8e4a01c5ce6a5e0b74d17a7ad80535 (patch) | |
tree | 73f0c2ac619b8f1b377cce357772eb36d9afd5f7 /geyes/src | |
parent | 84498251fab3fdbd4031478eea4dfe4eb8c0c28b (diff) | |
download | mate-applets-41458272ba8e4a01c5ce6a5e0b74d17a7ad80535.tar.bz2 mate-applets-41458272ba8e4a01c5ce6a5e0b74d17a7ad80535.tar.xz |
geyes: Add support for building in-process
Diffstat (limited to 'geyes/src')
-rw-r--r-- | geyes/src/Makefile.am | 23 | ||||
-rw-r--r-- | geyes/src/geyes.c | 25 |
2 files changed, 34 insertions, 14 deletions
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) |