diff options
author | lukefromdc <[email protected]> | 2023-08-09 07:17:27 -0400 |
---|---|---|
committer | Luke from DC <[email protected]> | 2023-08-12 19:08:16 +0000 |
commit | f5ba27007c359c933631d30dac4593c147c5e01e (patch) | |
tree | dfaa438a9cce81b5f56ec4bf981181d50e282ddd /mate-dictionary | |
parent | 757b4728baab9f96808e05ab3d7fc5341b57f11a (diff) | |
download | mate-utils-f5ba27007c359c933631d30dac4593c147c5e01e.tar.bz2 mate-utils-f5ba27007c359c933631d30dac4593c147c5e01e.tar.xz |
dictionary applet: allow building in-process
*This is needed for wayland support
Diffstat (limited to 'mate-dictionary')
-rw-r--r-- | mate-dictionary/data/Makefile.am | 12 | ||||
-rw-r--r-- | mate-dictionary/data/org.mate.DictionaryApplet.mate-panel-applet.desktop.in.in | 3 | ||||
-rw-r--r-- | mate-dictionary/src/Makefile.am | 45 | ||||
-rw-r--r-- | mate-dictionary/src/gdict-aligned-window.c | 13 | ||||
-rw-r--r-- | mate-dictionary/src/gdict-applet.c | 10 |
5 files changed, 72 insertions, 11 deletions
diff --git a/mate-dictionary/data/Makefile.am b/mate-dictionary/data/Makefile.am index 81cfcd35..b174a877 100644 --- a/mate-dictionary/data/Makefile.am +++ b/mate-dictionary/data/Makefile.am @@ -62,9 +62,17 @@ appletdir = $(datadir)/mate-panel/applets applet_in_files = org.mate.DictionaryApplet.mate-panel-applet.desktop.in applet_DATA = $(applet_in_files:.mate-panel-applet.desktop.in=.mate-panel-applet) +if ENABLE_IN_PROCESS +APPLET_LOCATION = $(pkglibdir)/libmate-dictionary-applet.so +APPLET_IN_PROCESS = true +else +APPLET_LOCATION = $(libexecdir)/mate-dictionary-applet +APPLET_IN_PROCESS = false +endif $(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)|" \ $< > $@ $(applet_DATA): $(applet_in_files) Makefile @@ -74,6 +82,7 @@ else $(AM_V_GEN) cp $< $@ endif +if !ENABLE_IN_PROCESS servicedir = $(datadir)/dbus-1/services service_in_files = org.mate.panel.applet.DictionaryAppletFactory.service.in service_DATA = $(service_in_files:.service.in=.service) @@ -82,6 +91,7 @@ org.mate.panel.applet.DictionaryAppletFactory.service: $(service_in_files) $(AM_V_GEN)sed \ -e "s|\@LIBEXECDIR\@|$(libexecdir)|" \ $< > $@ +endif ui_DATA += dictionary-applet-menu.xml diff --git a/mate-dictionary/data/org.mate.DictionaryApplet.mate-panel-applet.desktop.in.in b/mate-dictionary/data/org.mate.DictionaryApplet.mate-panel-applet.desktop.in.in index db553811..2e74c413 100644 --- a/mate-dictionary/data/org.mate.DictionaryApplet.mate-panel-applet.desktop.in.in +++ b/mate-dictionary/data/org.mate.DictionaryApplet.mate-panel-applet.desktop.in.in @@ -1,6 +1,7 @@ [Applet Factory] Id=DictionaryAppletFactory -Location=@LIBEXECDIR@/mate-dictionary-applet +Location=@APPLET_LOCATION@ +InProcess=@APPLET_IN_PROCESS@ Name=Dictionary Applet Factory Description=Factory for the dictionary applet diff --git a/mate-dictionary/src/Makefile.am b/mate-dictionary/src/Makefile.am index e8228e6b..915c9c0c 100644 --- a/mate-dictionary/src/Makefile.am +++ b/mate-dictionary/src/Makefile.am @@ -27,8 +27,12 @@ AM_CPPFLAGS = \ bin_PROGRAMS = mate-dictionary if BUILD_GDICT_APPLET +if ENABLE_IN_PROCESS +pkglib_LTLIBRARIES = libmate-dictionary-applet.la +else libexec_PROGRAMS = mate-dictionary-applet endif +endif mate_dictionary_SOURCES = \ gdict-about.c \ @@ -69,6 +73,45 @@ mate_dictionary_LDADD = \ if BUILD_GDICT_APPLET +if ENABLE_IN_PROCESS +libmate_dictionary_applet_la_SOURCES = \ + gdict-about.c \ + gdict-about.h \ + gdict-aligned-window.c \ + gdict-aligned-window.h \ + gdict-applet.c \ + gdict-applet.h \ + gdict-common.c \ + gdict-common.h \ + gdict-pref-dialog.c \ + gdict-pref-dialog.h \ + gdict-print.c \ + gdict-print.h \ + gdict-sidebar.c \ + gdict-sidebar.h \ + gdict-source-dialog.c \ + gdict-source-dialog.h \ + $(NULL) + +libmate_dictionary_applet_la_CFLAGS = \ + -I$(top_builddir)/mate-dictionary \ + -I$(top_srcdir)/mate-dictionary \ + $(APPLET_CFLAGS) \ + $(GLIB_CFLAGS) \ + $(GIO_CFLAGS) \ + $(GTK_CFLAGS) \ + $(WARN_CFLAGS) \ + $(NULL) + +libmate_dictionary_applet_la_LIBADD = \ + -lm \ + $(top_builddir)/mate-dictionary/libgdict/libmatedict.la \ + $(APPLET_LIBS) \ + $(GLIB_LIBS) \ + $(GIO_LIBS) \ + $(GTK_LIBS) \ + $(NULL) +else mate_dictionary_applet_SOURCES = \ gdict-about.c \ gdict-about.h \ @@ -106,7 +149,7 @@ mate_dictionary_applet_LDADD = \ $(GIO_LIBS) \ $(GTK_LIBS) \ $(NULL) - +endif # ENABLE_IN_PROCESS endif # BUILD_GDICT_APPLET -include $(top_srcdir)/git.mk diff --git a/mate-dictionary/src/gdict-aligned-window.c b/mate-dictionary/src/gdict-aligned-window.c index ed2a08fe..42a00cc9 100644 --- a/mate-dictionary/src/gdict-aligned-window.c +++ b/mate-dictionary/src/gdict-aligned-window.c @@ -154,8 +154,10 @@ gdict_aligned_window_position (GdictAlignedWindow *window) gint entry_x, entry_y, entry_width, entry_height; gint x, y; GdkGravity gravity = GDK_GRAVITY_NORTH_WEST; - GdkWindow *gdk_window; + GdkWindow *gdk_window; GdkDisplay *display; + GdkMonitor *monitor; + GdkRectangle geometry = {0}; g_assert (GDICT_IS_ALIGNED_WINDOW (window)); priv = window->priv; @@ -185,7 +187,12 @@ gdict_aligned_window_position (GdictAlignedWindow *window) &entry_y); gdk_window_get_geometry (gdk_window, NULL, NULL, &entry_width, &entry_height); - if (entry_x + our_width < WidthOfScreen (gdk_x11_screen_get_xscreen (gdk_screen_get_default ()))) + /*Get the monitor dimensions*/ + display= gdk_screen_get_display (gdk_screen_get_default ()); + monitor = gdk_display_get_monitor (display, 0); + gdk_monitor_get_geometry (monitor, &geometry); + + if (entry_x + our_width < geometry.width) x = entry_x + 1; else { @@ -194,7 +201,7 @@ gdict_aligned_window_position (GdictAlignedWindow *window) gravity = GDK_GRAVITY_NORTH_EAST; } - if (entry_y + entry_height + our_height < HeightOfScreen (gdk_x11_screen_get_xscreen (gdk_screen_get_default ()))) + if (entry_y + entry_height + our_height < geometry.height) y = entry_y + entry_height - 1; else { diff --git a/mate-dictionary/src/gdict-applet.c b/mate-dictionary/src/gdict-applet.c index 3c1e3a05..b8c1b4eb 100644 --- a/mate-dictionary/src/gdict-applet.c +++ b/mate-dictionary/src/gdict-applet.c @@ -1214,9 +1214,9 @@ gdict_applet_factory (MatePanelApplet *applet, } /* this defines the main () for the applet */ -MATE_PANEL_APPLET_OUT_PROCESS_FACTORY ("DictionaryAppletFactory", - GDICT_TYPE_APPLET, - "mate-dictionary-applet", - gdict_applet_factory, - NULL); +PANEL_APPLET_FACTORY ("DictionaryAppletFactory", + GDICT_TYPE_APPLET, + "mate-dictionary-applet", + gdict_applet_factory, + NULL); |