diff options
37 files changed, 2778 insertions, 123 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d1febfd6..40c9afb4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,6 +39,7 @@ env: libsoup-3.0-dev libwnck-3-dev libx11-dev + libxfce4windowing-0-dev libxrandr-dev # mate-desktop dependencies DEB_LIBRARY_DEPS_MATE_DESKTOP: | @@ -79,6 +80,7 @@ env: libmateweather libsm libwnck3 + libxfce4windowing make mate-common mate-desktop diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..615554d2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,86 @@ +# Build artifacts +*.o +*.lo +*.la +.deps/ +.libs/ +*.gcda +*.gcno +*.orig +*.rej +*.tab.c +*~ +.*.sw[nop] +.dirstamp +/build/ +/build-inproc/ +/builddir/ +/meson-private/ +/Makefile +/Makefile.in + +# Autotools generated +/ABOUT-NLS +/GPATH +/GRTAGS +/GSYMS +/GTAGS +/ID +/INSTALL +/TAGS +/aclocal.m4 +/autom4te.cache/ +/compile +/config.cache +/config.guess +/config.h +/config.h.in +/config.log +/config.lt +/config.rpath +/config.status +/config.status.lineno +/config.sub +/configure +/configure.lineno +/depcomp +/gtk-doc.make +/install-sh +/intltool-extract.in +/intltool-merge.in +/intltool-update.in +/libtool +/ltmain.sh +/m4/ +/missing +/mkinstalldirs +/omf.make +/so_locations +/stamp-h1 +/tags +/xmldocs.make + +# Generated data +/data/Makefile +/data/Makefile.in +/data/org.mate.panel.enums.xml +/data/*.gschema.xml +/data/*.valid + +# gettext/po generated +/po/*.gmo +/po/*.header +/po/*.mo +/po/*.sed +/po/*.sin +/po/.intltool-merge-cache +/po/Makefile +/po/Makefile.in +/po/Makefile.in.in +/po/Makefile.in.in~ +/po/Makevars.template +/po/POTFILES +/po/Rules-quot +/po/mate-panel.pot +/po/stamp-it +/po/stamp-po diff --git a/applets/clock/meson.build b/applets/clock/meson.build new file mode 100644 index 00000000..c0db5a17 --- /dev/null +++ b/applets/clock/meson.build @@ -0,0 +1,241 @@ +clock_enum_headers = ['clock-utils.h'] + +clock_typebuiltins_h = custom_target('clock-typebuiltins.h', + input: clock_enum_headers, + output: 'clock-typebuiltins.h', + command: [ + glib_mkenums, + '--fhead', '#ifndef __CLOCK_TYPEBUILTINS_H__\n', + '--fhead', '#define __CLOCK_TYPEBUILTINS_H__ 1\n\n', + '--fhead', '#ifdef __cplusplus\nextern "C" {\n#endif\n\n', + '--ftail', '#ifdef __cplusplus\n}\n#endif\n\n', + '--ftail', '#endif /* __CLOCK_TYPEBUILTINS_H__ */\n', + '--fprod', '\n/* --- @filename@ --- */', + '--eprod', '#define CLOCK_TYPE_@ENUMSHORT@ @enum_name@_get_type()\n', + '--eprod', 'GType @enum_name@_get_type (void);\n', + '--output', '@OUTPUT@', + '@INPUT@', + ], +) + +clock_typebuiltins_c = custom_target('clock-typebuiltins.c', + input: clock_enum_headers, + output: 'clock-typebuiltins.c', + command: [ + glib_mkenums, + '--fhead', '#include <glib-object.h>\n', + '--fhead', '#include "clock-typebuiltins.h"\n\n', + '--fprod', '\n/* enumerations from "@filename@" */', + '--fprod', '\n#include "@filename@"\n', + '--vhead', 'static const GEnumValue _@enum_name@_values[] = {', + '--vprod', ' { @VALUENAME@, "@VALUENAME@", "@valuenick@" },', + '--vtail', ' { 0, NULL, NULL }\n};\n\n', + '--vtail', 'GType\n@enum_name@_get_type (void)\n{\n', + '--vtail', ' static GType type = 0;\n\n', + '--vtail', ' if (!type)\n', + '--vtail', ' type = g_enum_register_static ("@EnumName@", _@enum_name@_values);\n\n', + '--vtail', ' return type;\n}\n\n', + '--output', '@OUTPUT@', + '@INPUT@', + ], +) + +clock_marshal = gnome.genmarshal('clock-marshallers', + sources: 'clock-marshallers.list', + prefix: '_clock_marshal', + internal: true, +) + +clock_resource_deps = files( + 'clock.ui', + 'clock-menu.xml', + 'pixmaps/clock-face-large.svg', + 'pixmaps/clock-face-small.svg', + 'pixmaps/clock-face-small-morning.svg', + 'pixmaps/clock-face-small-day.svg', + 'pixmaps/clock-face-small-evening.svg', + 'pixmaps/clock-face-small-night.svg', + 'pixmaps/clock-map.png', + 'pixmaps/clock-map-location-marker.png', + 'pixmaps/clock-map-location-current.png', + 'pixmaps/clock-map-location-hilight.png', +) + +clock_resources_c = custom_target('clock-resources.c', + input: 'clock.gresource.xml', + output: 'clock-resources.c', + depend_files: clock_resource_deps, + command: [ + glib_compile_resources, + '--target', '@OUTPUT@', + '--sourcedir', meson.current_source_dir(), + '--generate-source', + '--c-name', 'clock', + '@INPUT@', + ], +) + +clock_resources_h = custom_target('clock-resources.h', + input: 'clock.gresource.xml', + output: 'clock-resources.h', + depend_files: clock_resource_deps, + command: [ + glib_compile_resources, + '--target', '@OUTPUT@', + '--sourcedir', meson.current_source_dir(), + '--generate-header', + '--c-name', 'clock', + '@INPUT@', + ], +) + +clock_built_sources = [ + clock_marshal, + clock_resources_c, + clock_resources_h, + clock_typebuiltins_c, + clock_typebuiltins_h, +] + +# system timezone helper +libsystem_timezone = static_library('system-timezone', + 'system-timezone.c', + 'system-timezone.h', + dependencies: [gio_dep], + c_args: disable_deprecated_flags, +) + +executable('test-system-timezone', + 'test-system-timezone.c', + dependencies: [gio_dep], + link_with: libsystem_timezone, + c_args: disable_deprecated_flags, +) + +clock_sources = [ + 'calendar-window.c', + 'calendar-window.h', + 'clock.c', + 'clock.h', + 'clock-face.c', + 'clock-face.h', + 'clock-location.c', + 'clock-location.h', + 'clock-location-tile.c', + 'clock-location-tile.h', + 'clock-map.c', + 'clock-map.h', + 'clock-sunpos.c', + 'clock-sunpos.h', + 'clock-utils.c', + 'clock-utils.h', + 'set-timezone.c', + 'set-timezone.h', + clock_built_sources, +] + +if have_eds + clock_sources += [ + 'calendar-client.c', + 'calendar-client.h', + 'calendar-sources.c', + 'calendar-sources.h', + 'calendar-debug.h', + ] +endif + +clock_deps = [ + pango_dep, + gtk_dep, + glib_dep, + gio_dep, + mateweather_dep, + mate_desktop_dep, + m_dep, +] + libmate_panel_applet_deps + +if have_eds + clock_deps += eds_deps +endif + +if have_wayland + clock_deps += wayland_deps +endif + +clock_inc_dirs = [ + include_directories('.'), + libmate_panel_applet_inc, +] + +clock_c_args = [ + '-DMATELOCALEDIR="@0@"'.format(mate_panel_localedir), + '-DMATEWEATHER_I_KNOW_THIS_IS_UNSTABLE', +] + disable_deprecated_flags + +if clock_inprocess + clock_applet = shared_library('clock-applet', + clock_sources, + include_directories: clock_inc_dirs, + dependencies: clock_deps, + c_args: clock_c_args, + link_with: [libmate_panel_applet_lib, libsystem_timezone], + install: true, + install_dir: mate_panel_pkglibdir, + ) + clock_applet_in_process = 'true' + clock_applet_location = join_paths(mate_panel_pkglibdir, 'libclock-applet.so') +else + clock_applet = executable('clock-applet', + clock_sources, + include_directories: clock_inc_dirs, + dependencies: clock_deps, + c_args: clock_c_args, + link_with: [libmate_panel_applet_lib, libsystem_timezone], + install: true, + install_dir: mate_panel_libexecdir, + ) + clock_applet_in_process = 'false' + clock_applet_location = join_paths(mate_panel_libexecdir, 'clock-applet') +endif + +# applet registration file +clock_applet_desktop_in = configure_file( + input: 'org.mate.panel.ClockApplet.mate-panel-applet.desktop.in.in', + output: 'org.mate.panel.ClockApplet.mate-panel-applet.desktop.in', + configuration: { + 'IN_PROCESS': clock_applet_in_process, + 'LOCATION': clock_applet_location, + 'VERSION': mate_panel_version, + }, +) + +clock_applet_desktop = i18n.merge_file( + input: clock_applet_desktop_in, + output: 'org.mate.panel.ClockApplet.mate-panel-applet', + type: 'desktop', + po_dir: '../../po', + install: true, + install_dir: mate_panel_appletsdir, +) + +if not clock_inprocess + clock_service = configure_file( + input: 'org.mate.panel.applet.ClockAppletFactory.service.in', + output: 'org.mate.panel.applet.ClockAppletFactory.service', + configuration: { + 'LOCATION': clock_applet_location, + }, + ) + install_data(clock_service, + install_dir: join_paths(mate_panel_datadir, 'dbus-1', 'services'), + ) +endif + +# gsettings schema +clock_gschema = configure_file( + input: 'org.mate.panel.applet.clock.gschema.xml.in', + output: 'org.mate.panel.applet.clock.gschema.xml', + configuration: {'GETTEXT_PACKAGE': mate_panel_gettext_package}, +) + +install_data(clock_gschema, install_dir: mate_panel_schemadir) diff --git a/applets/fish/meson.build b/applets/fish/meson.build new file mode 100644 index 00000000..59d538e7 --- /dev/null +++ b/applets/fish/meson.build @@ -0,0 +1,138 @@ +mate_panel_fishdir = join_paths(mate_panel_pkgdatadir, 'fish') + +fish_resource_deps = files( + 'fish.ui', + 'fish-menu.xml', +) + +fish_resources_c = custom_target('fish-resources.c', + input: 'fish.gresource.xml', + output: 'fish-resources.c', + depend_files: fish_resource_deps, + command: [ + glib_compile_resources, + '--target', '@OUTPUT@', + '--sourcedir', meson.current_source_dir(), + '--generate-source', + '--c-name', 'fish', + '@INPUT@', + ], +) + +fish_resources_h = custom_target('fish-resources.h', + input: 'fish.gresource.xml', + output: 'fish-resources.h', + depend_files: fish_resource_deps, + command: [ + glib_compile_resources, + '--target', '@OUTPUT@', + '--sourcedir', meson.current_source_dir(), + '--generate-header', + '--c-name', 'fish', + '@INPUT@', + ], +) + +fish_built_sources = [ + fish_resources_c, + fish_resources_h, +] + +fish_sources = [ + 'fish.c', + fish_built_sources, +] + +fish_deps = [ + gtk_dep, + cairo_dep, + mate_desktop_dep, +] + libmate_panel_applet_deps + +fish_inc_dirs = [ + include_directories('.'), + libmate_panel_applet_inc, +] + +fish_c_args = [ + '-DMATELOCALEDIR="@0@"'.format(mate_panel_localedir), + '-DFISH_ICONDIR="@0@"'.format(mate_panel_fishdir), +] + disable_deprecated_flags + +if fish_inprocess + fish_applet = shared_library('fish-applet', + fish_sources, + include_directories: fish_inc_dirs, + dependencies: fish_deps, + c_args: fish_c_args, + link_with: libmate_panel_applet_lib, + install: true, + install_dir: mate_panel_pkglibdir, + ) + fish_applet_in_process = 'true' + fish_applet_location = join_paths(mate_panel_pkglibdir, 'libfish-applet.so') +else + fish_applet = executable('fish-applet', + fish_sources, + include_directories: fish_inc_dirs, + dependencies: fish_deps, + c_args: fish_c_args, + link_with: libmate_panel_applet_lib, + install: true, + install_dir: mate_panel_libexecdir, + ) + fish_applet_in_process = 'false' + fish_applet_location = join_paths(mate_panel_libexecdir, 'fish-applet') +endif + +# applet registration file +fish_applet_desktop_in = configure_file( + input: 'org.mate.panel.FishApplet.mate-panel-applet.desktop.in.in', + output: 'org.mate.panel.FishApplet.mate-panel-applet.desktop.in', + configuration: { + 'IN_PROCESS': fish_applet_in_process, + 'LOCATION': fish_applet_location, + 'VERSION': mate_panel_version, + }, +) + +fish_applet_desktop = i18n.merge_file( + input: fish_applet_desktop_in, + output: 'org.mate.panel.FishApplet.mate-panel-applet', + type: 'desktop', + po_dir: '../../po', + install: true, + install_dir: mate_panel_appletsdir, +) + +if not fish_inprocess + fish_service = configure_file( + input: 'org.mate.panel.applet.FishAppletFactory.service.in', + output: 'org.mate.panel.applet.FishAppletFactory.service', + configuration: { + 'LOCATION': fish_applet_location, + }, + ) + install_data(fish_service, + install_dir: join_paths(mate_panel_datadir, 'dbus-1', 'services'), + ) +endif + +# fish bitmaps +install_data( + 'wanda.png', + 'fishanim.png', + 'oldwanda.png', + 'footguy.png', + 'monkey.png', + install_dir: mate_panel_fishdir, +) + +# gsettings schema +fish_gschema = configure_file( + input: 'org.mate.panel.applet.fish.gschema.xml.in', + output: 'org.mate.panel.applet.fish.gschema.xml', + configuration: {'GETTEXT_PACKAGE': mate_panel_gettext_package}, +) + +install_data(fish_gschema, install_dir: mate_panel_schemadir) diff --git a/applets/meson.build b/applets/meson.build new file mode 100644 index 00000000..21511944 --- /dev/null +++ b/applets/meson.build @@ -0,0 +1,4 @@ +subdir('clock') +subdir('fish') +subdir('wncklet') +subdir('notification_area') diff --git a/applets/notification_area/libstatus-notifier-watcher/meson.build b/applets/notification_area/libstatus-notifier-watcher/meson.build new file mode 100644 index 00000000..a180a16e --- /dev/null +++ b/applets/notification_area/libstatus-notifier-watcher/meson.build @@ -0,0 +1,12 @@ +libstatus_notifier_watcher = static_library('status-notifier-watcher', + 'gf-sn-watcher-v0.c', + 'gf-sn-watcher-v0.h', + 'gf-status-notifier-watcher.c', + 'gf-status-notifier-watcher.h', + gnome.gdbus_codegen('gf-sn-watcher-v0-gen', + 'org.kde.StatusNotifierWatcher.xml', + namespace: 'Gf', + ), + dependencies: notification_area_deps, + c_args: ['-DG_LOG_DOMAIN="status-notifier-watcher"'] + disable_deprecated_flags, +) diff --git a/applets/notification_area/meson.build b/applets/notification_area/meson.build new file mode 100644 index 00000000..74400b21 --- /dev/null +++ b/applets/notification_area/meson.build @@ -0,0 +1,162 @@ +notification_area_deps = [ + gtk_dep, + mate_desktop_dep, +] + +notification_area_c_args = [ + '-DMATELOCALEDIR="@0@"'.format(mate_panel_localedir), + '-DG_LOG_DOMAIN="notification-area-applet"', + '-DPROVIDE_WATCHER_SERVICE=1', +] + disable_deprecated_flags + +subdir('libstatus-notifier-watcher') +subdir('status-notifier') + +if have_x11 + subdir('system-tray') +endif + +libtray_sources = [ + 'na-grid.c', + 'na-grid.h', + 'na-host.c', + 'na-host.h', + 'na-item.c', + 'na-item.h', +] + +libtray = static_library('tray', + libtray_sources + status_notifier_codegen, + include_directories: [include_directories('.'), include_directories('status-notifier')], + dependencies: notification_area_deps, + link_with: [libstatus_notifier, libstatus_notifier_watcher], + c_args: notification_area_c_args, +) + +if have_x11 + libtray_extra_link = libsystem_tray + executable('testtray', + 'testtray.c', + include_directories: include_directories('.'), + dependencies: notification_area_deps, + link_with: [libtray, libstatus_notifier, libstatus_notifier_watcher, libsystem_tray], + c_args: notification_area_c_args, + ) +else + libtray_extra_link = [] +endif + +na_resource_deps = files( + 'notification-area-preferences-dialog.ui', + 'notification-area-menu.xml', +) + +na_resources_c = custom_target('na-resources.c', + input: 'na.gresource.xml', + output: 'na-resources.c', + depend_files: na_resource_deps, + command: [ + glib_compile_resources, + '--target', '@OUTPUT@', + '--sourcedir', meson.current_source_dir(), + '--generate-source', + '--c-name', 'na', + '@INPUT@', + ], +) + +na_resources_h = custom_target('na-resources.h', + input: 'na.gresource.xml', + output: 'na-resources.h', + depend_files: na_resource_deps, + command: [ + glib_compile_resources, + '--target', '@OUTPUT@', + '--sourcedir', meson.current_source_dir(), + '--generate-header', + '--c-name', 'na', + '@INPUT@', + ], +) + +notification_area_sources = [ + 'main.c', + 'main.h', + na_resources_c, + na_resources_h, +] + +notification_area_full_deps = notification_area_deps + libmate_panel_applet_deps + +notification_area_inc_dirs = [ + include_directories('.'), + libmate_panel_applet_inc, +] + +if notification_area_inprocess + notification_area_applet = shared_library('notification-area-applet', + notification_area_sources, + include_directories: notification_area_inc_dirs, + dependencies: notification_area_full_deps, + c_args: notification_area_c_args, + link_with: [libmate_panel_applet_lib, libtray, libstatus_notifier, libstatus_notifier_watcher] + libtray_extra_link, + install: true, + install_dir: mate_panel_pkglibdir, + ) + notification_area_applet_in_process = 'true' + notification_area_applet_location = join_paths(mate_panel_pkglibdir, 'libnotification-area-applet.so') +else + notification_area_applet = executable('notification-area-applet', + notification_area_sources, + include_directories: notification_area_inc_dirs, + dependencies: notification_area_full_deps, + c_args: notification_area_c_args, + link_with: [libmate_panel_applet_lib, libtray, libstatus_notifier, libstatus_notifier_watcher] + libtray_extra_link, + install: true, + install_dir: mate_panel_libexecdir, + ) + notification_area_applet_in_process = 'false' + notification_area_applet_location = join_paths(mate_panel_libexecdir, 'notification-area-applet') +endif + +# applet registration file +notification_area_applet_desktop_in = configure_file( + input: 'org.mate.panel.NotificationAreaApplet.mate-panel-applet.desktop.in.in', + output: 'org.mate.panel.NotificationAreaApplet.mate-panel-applet.desktop.in', + configuration: { + 'IN_PROCESS': notification_area_applet_in_process, + 'LOCATION': notification_area_applet_location, + 'VERSION': mate_panel_version, + }, +) + +notification_area_applet_desktop = i18n.merge_file( + input: notification_area_applet_desktop_in, + output: 'org.mate.panel.NotificationAreaApplet.mate-panel-applet', + type: 'desktop', + po_dir: '../../po', + install: true, + install_dir: mate_panel_appletsdir, +) + +if not notification_area_inprocess + notification_area_service = configure_file( + input: 'org.mate.panel.applet.NotificationAreaAppletFactory.service.in', + output: 'org.mate.panel.applet.NotificationAreaAppletFactory.service', + configuration: { + 'LOCATION': notification_area_applet_location, + }, + ) + install_data(notification_area_service, + install_dir: join_paths(mate_panel_datadir, 'dbus-1', 'services'), + ) +endif + +# gsettings schema +notification_area_gschema = configure_file( + input: 'org.mate.panel.applet.notification-area.gschema.xml.in', + output: 'org.mate.panel.applet.notification-area.gschema.xml', + configuration: {'GETTEXT_PACKAGE': mate_panel_gettext_package}, +) + +install_data(notification_area_gschema, install_dir: mate_panel_schemadir) diff --git a/applets/notification_area/status-notifier/meson.build b/applets/notification_area/status-notifier/meson.build new file mode 100644 index 00000000..6f6305a5 --- /dev/null +++ b/applets/notification_area/status-notifier/meson.build @@ -0,0 +1,40 @@ +status_notifier_codegen = [ + gnome.gdbus_codegen('sn-dbus-menu-gen', + 'com.canonical.dbusmenu.xml', + namespace: 'Sn', + ), + gnome.gdbus_codegen('sn-host-v0-gen', + 'org.kde.StatusNotifierHost.xml', + namespace: 'Sn', + ), + gnome.gdbus_codegen('sn-item-v0-gen', + 'org.kde.StatusNotifierItem.xml', + namespace: 'Sn', + ), + gnome.gdbus_codegen('sn-watcher-v0-gen', + 'org.kde.StatusNotifierWatcher.xml', + namespace: 'Sn', + ), +] + +libstatus_notifier = static_library('status-notifier', + 'sn-dbus-menu.c', + 'sn-dbus-menu.h', + 'sn-dbus-menu-item.c', + 'sn-dbus-menu-item.h', + 'sn-flat-button.c', + 'sn-flat-button.h', + 'sn-host-v0.c', + 'sn-host-v0.h', + 'sn-item.c', + 'sn-item.h', + 'sn-item-v0.c', + 'sn-item-v0.h', + status_notifier_codegen, + include_directories: [include_directories('.'), include_directories('..')], + dependencies: notification_area_deps + [m_dep], + c_args: [ + '-DMATELOCALEDIR="@0@"'.format(mate_panel_localedir), + '-DG_LOG_DOMAIN="notification-area-applet"', + ] + disable_deprecated_flags, +) diff --git a/applets/notification_area/system-tray/meson.build b/applets/notification_area/system-tray/meson.build new file mode 100644 index 00000000..a3add66a --- /dev/null +++ b/applets/notification_area/system-tray/meson.build @@ -0,0 +1,23 @@ +na_marshal = gnome.genmarshal('na-marshal', + sources: 'na-marshal.list', + prefix: '_na_marshal', + internal: true, +) + +libsystem_tray = static_library('system-tray', + 'fixedtip.c', + 'fixedtip.h', + na_marshal, + 'na-tray.c', + 'na-tray.h', + 'na-tray-child.c', + 'na-tray-child.h', + 'na-tray-manager.c', + 'na-tray-manager.h', + include_directories: [include_directories('.'), include_directories('..')], + dependencies: notification_area_deps + [x11_dep], + c_args: [ + '-DMATELOCALEDIR="@0@"'.format(mate_panel_localedir), + '-DG_LOG_DOMAIN="notification-area-applet"', + ] + disable_deprecated_flags, +) diff --git a/applets/wncklet/Makefile.am b/applets/wncklet/Makefile.am index 2acab8d0..abfb5113 100644 --- a/applets/wncklet/Makefile.am +++ b/applets/wncklet/Makefile.am @@ -21,13 +21,9 @@ WNCKLET_SOURCES = \ window-list.h \ showdesktop.c \ showdesktop.h \ - $(BUILT_SOURCES) - -if ENABLE_X11 -WNCKLET_SOURCES += \ workspace-switcher.c \ - workspace-switcher.h -endif + workspace-switcher.h \ + $(BUILT_SOURCES) @@ -45,14 +41,18 @@ if ENABLE_WAYLAND WNCKLET_SOURCES += \ wayland-backend.c \ wayland-backend.h \ + wayland-workspace.c \ + wayland-workspace.h \ wayland-protocol/wlr-foreign-toplevel-management-unstable-v1-code.c \ wayland-protocol/wlr-foreign-toplevel-management-unstable-v1-client.h WNCKLET_LDADD += \ - $(WAYLAND_LIBS) + $(WAYLAND_LIBS) \ + $(XFW_LIBS) AM_CPPFLAGS += \ - $(WAYLAND_CFLAGS) + $(WAYLAND_CFLAGS) \ + $(XFW_CFLAGS) endif if WNCKLET_INPROCESS @@ -104,15 +104,10 @@ ui_FILES = \ showdesktop-menu.xml \ window-list-menu.xml \ window-list.ui \ - window-menu-menu.xml - -if ENABLE_X11 -ui_FILES += \ + window-menu-menu.xml \ workspace-switcher-menu.xml \ workspace-switcher.ui -endif - diff --git a/applets/wncklet/meson.build b/applets/wncklet/meson.build new file mode 100644 index 00000000..2a07cb21 --- /dev/null +++ b/applets/wncklet/meson.build @@ -0,0 +1,164 @@ +wncklet_resource_deps = files( + 'showdesktop-menu.xml', + 'window-list.ui', + 'window-list-menu.xml', + 'window-menu-menu.xml', + 'workspace-switcher.ui', + 'workspace-switcher-menu.xml', +) + +wncklet_resources_c = custom_target('wncklet-resources.c', + input: 'wncklet.gresource.xml', + output: 'wncklet-resources.c', + depend_files: wncklet_resource_deps, + command: [ + glib_compile_resources, + '--target', '@OUTPUT@', + '--sourcedir', meson.current_source_dir(), + '--generate-source', + '--c-name', 'wncklet', + '@INPUT@', + ], +) + +wncklet_resources_h = custom_target('wncklet-resources.h', + input: 'wncklet.gresource.xml', + output: 'wncklet-resources.h', + depend_files: wncklet_resource_deps, + command: [ + glib_compile_resources, + '--target', '@OUTPUT@', + '--sourcedir', meson.current_source_dir(), + '--generate-header', + '--c-name', 'wncklet', + '@INPUT@', + ], +) + +wncklet_built_sources = [ + wncklet_resources_c, + wncklet_resources_h, +] + +wncklet_sources = [ + 'wncklet.c', + 'wncklet.h', + 'window-menu.c', + 'window-menu.h', + 'window-list.c', + 'window-list.h', + 'showdesktop.c', + 'showdesktop.h', + 'workspace-switcher.c', + 'workspace-switcher.h', + wncklet_built_sources, +] + +if have_wayland + wncklet_sources += [ + 'wayland-backend.c', + 'wayland-backend.h', + 'wayland-workspace.c', + 'wayland-workspace.h', + 'wayland-protocol/wlr-foreign-toplevel-management-unstable-v1-code.c', + 'wayland-protocol/wlr-foreign-toplevel-management-unstable-v1-client.h', + ] +endif + +wncklet_deps = [ + gtk_dep, + wnck_dep, + mate_desktop_dep, +] + libmate_panel_applet_deps + +if have_x11 + wncklet_deps += x11_dep +endif + +if have_wayland + wncklet_deps += wayland_deps + [xfw_dep] +endif + +wncklet_inc_dirs = [ + include_directories('.'), + libmate_panel_applet_inc, +] + +wncklet_c_args = [ + '-DMATELOCALEDIR="@0@"'.format(mate_panel_localedir), +] + disable_deprecated_flags + +if wncklet_inprocess + wncklet_applet = shared_library('wnck-applet', + wncklet_sources, + include_directories: wncklet_inc_dirs, + dependencies: wncklet_deps, + c_args: wncklet_c_args, + link_with: libmate_panel_applet_lib, + install: true, + install_dir: mate_panel_pkglibdir, + ) + wncklet_applet_in_process = 'true' + wncklet_applet_location = join_paths(mate_panel_pkglibdir, 'libwnck-applet.so') +else + wncklet_applet = executable('wnck-applet', + wncklet_sources, + include_directories: wncklet_inc_dirs, + dependencies: wncklet_deps, + c_args: wncklet_c_args, + link_with: libmate_panel_applet_lib, + install: true, + install_dir: mate_panel_libexecdir, + ) + wncklet_applet_in_process = 'false' + wncklet_applet_location = join_paths(mate_panel_libexecdir, 'wnck-applet') +endif + +# applet registration file +wncklet_applet_desktop_in = configure_file( + input: 'org.mate.panel.Wncklet.mate-panel-applet.desktop.in.in', + output: 'org.mate.panel.Wncklet.mate-panel-applet.desktop.in', + configuration: { + 'IN_PROCESS': wncklet_applet_in_process, + 'LOCATION': wncklet_applet_location, + 'VERSION': mate_panel_version, + }, +) + +wncklet_applet_desktop = i18n.merge_file( + input: wncklet_applet_desktop_in, + output: 'org.mate.panel.Wncklet.mate-panel-applet', + type: 'desktop', + po_dir: '../../po', + install: true, + install_dir: mate_panel_appletsdir, +) + +if not wncklet_inprocess + wncklet_service = configure_file( + input: 'org.mate.panel.applet.WnckletFactory.service.in', + output: 'org.mate.panel.applet.WnckletFactory.service', + configuration: { + 'LOCATION': wncklet_applet_location, + }, + ) + install_data(wncklet_service, + install_dir: join_paths(mate_panel_datadir, 'dbus-1', 'services'), + ) +endif + +# gsettings schemas +foreach schema : [ + 'org.mate.panel.applet.window-list', + 'org.mate.panel.applet.window-list-previews', + 'org.mate.panel.applet.workspace-switcher', + ] + install_data( + configure_file( + input: schema + '.gschema.xml.in', + output: schema + '.gschema.xml', + configuration: {'GETTEXT_PACKAGE': mate_panel_gettext_package}, + ), + install_dir: mate_panel_schemadir, + ) +endforeach diff --git a/applets/wncklet/org.mate.panel.Wncklet.mate-panel-applet.desktop.in.in b/applets/wncklet/org.mate.panel.Wncklet.mate-panel-applet.desktop.in.in index ec53ade3..6a2285af 100644 --- a/applets/wncklet/org.mate.panel.Wncklet.mate-panel-applet.desktop.in.in +++ b/applets/wncklet/org.mate.panel.Wncklet.mate-panel-applet.desktop.in.in @@ -24,7 +24,7 @@ Description=Switch between workspaces # Translators: Do NOT translate or transliterate this text (this is an icon file name)! Icon=mate-panel-workspace-switcher MateComponentId=OAFIID:MATE_WorkspaceSwitcherApplet;OAFIID:MATE_PagerApplet; -Platforms=X11; +Platforms=X11;Wayland; X-MATE-Bugzilla-Bugzilla=MATE X-MATE-Bugzilla-Product=mate-panel X-MATE-Bugzilla-Component=workspace switcher diff --git a/applets/wncklet/wayland-workspace.c b/applets/wncklet/wayland-workspace.c new file mode 100644 index 00000000..646ab802 --- /dev/null +++ b/applets/wncklet/wayland-workspace.c @@ -0,0 +1,526 @@ +/* + * Copyright (C) 2026 MATE Desktop Team + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +#include <config.h> + +#include <gtk/gtk.h> +#include <libxfce4windowing/libxfce4windowing.h> + +#include "wayland-workspace.h" + +typedef struct _GroupSignal GroupSignal; + +struct _GroupSignal { + XfwWorkspaceGroup *group; + gulong handlers[3]; /* active-changed, added, removed */ +}; + +typedef struct _WaylandWorkspaceData WaylandWorkspaceData; + +struct _WaylandWorkspaceData { + GtkWidget *grid; + + XfwScreen *screen; + XfwWorkspaceManager *workspace_manager; + GList *group_signals; /* list of GroupSignal* */ + + GtkOrientation orientation; + int n_rows; + gboolean display_all; + gboolean display_names; + gboolean ignore_toggle; +}; + +static void rebuild_ui (WaylandWorkspaceData *data); + +/* ---- Helpers ---- */ + +static int +count_visible_workspaces (WaylandWorkspaceData *data) +{ + GList *workspaces, *l; + int n = 0; + + workspaces = xfw_workspace_manager_list_workspaces (data->workspace_manager); + + for (l = workspaces; l != NULL; l = l->next) + { + XfwWorkspace *ws = l->data; + XfwWorkspaceState state = xfw_workspace_get_state (ws); + + if (data->display_all || !(state & XFW_WORKSPACE_STATE_HIDDEN)) + n++; + } + + return MAX (n, 1); +} + +static XfwWorkspace * +get_nth_workspace (WaylandWorkspaceData *data, int index) +{ + GList *workspaces, *l; + int i = 0; + + workspaces = xfw_workspace_manager_list_workspaces (data->workspace_manager); + + for (l = workspaces; l != NULL; l = l->next) + { + XfwWorkspace *ws = l->data; + XfwWorkspaceState state = xfw_workspace_get_state (ws); + + if (data->display_all || !(state & XFW_WORKSPACE_STATE_HIDDEN)) + { + if (i == index) + return ws; + i++; + } + } + + return NULL; +} + +/* ---- Build / rebuild the button grid ---- */ + +static void +on_button_toggled (GtkToggleButton *button, WaylandWorkspaceData *data) +{ + int index; + + if (data->ignore_toggle) + return; + + if (gtk_toggle_button_get_active (button)) + { + index = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (button), "ws-index")); + XfwWorkspace *ws = get_nth_workspace (data, index); + if (ws) + { + GError *error = NULL; + if (!xfw_workspace_activate (ws, &error)) + { + g_warning ("Failed to activate workspace: %s", + error ? error->message : "unknown error"); + g_clear_error (&error); + } + } + } + else + { + /* User clicked the already-active button — keep it toggled on */ + data->ignore_toggle = TRUE; + gtk_toggle_button_set_active (button, TRUE); + data->ignore_toggle = FALSE; + } +} + +static void +rebuild_ui (WaylandWorkspaceData *data) +{ + GList *children, *l; + int n_spaces, i, col, row; + int rows, cols; + + /* Destroy old buttons */ + children = gtk_container_get_children (GTK_CONTAINER (data->grid)); + for (l = children; l != NULL; l = l->next) + gtk_widget_destroy (GTK_WIDGET (l->data)); + g_list_free (children); + + n_spaces = count_visible_workspaces (data); + + /* Determine grid dimensions */ + if (data->orientation == GTK_ORIENTATION_HORIZONTAL) + { + rows = data->n_rows; + cols = (n_spaces + rows - 1) / rows; + } + else + { + cols = data->n_rows; + rows = (n_spaces + cols - 1) / cols; + } + + gtk_grid_set_column_homogeneous (GTK_GRID (data->grid), TRUE); + gtk_grid_set_row_homogeneous (GTK_GRID (data->grid), TRUE); + + /* Create buttons */ + for (i = 0; i < n_spaces; i++) + { + XfwWorkspace *ws; + const char *name; + char *free_name = NULL; + GtkWidget *button; + XfwWorkspaceState ws_state; + + ws = get_nth_workspace (data, i); + + if (data->display_names && ws) + { + name = xfw_workspace_get_name (ws); + if (!name || name[0] == '\0') + name = xfw_workspace_get_id (ws); + if (!name) + name = ""; + } + else + { + free_name = g_strdup_printf ("%d", i + 1); + name = free_name; + } + + button = gtk_toggle_button_new_with_label (name); + g_free (free_name); + + gtk_widget_set_name (button, "wnck-pager-button"); + g_object_set_data (G_OBJECT (button), "ws-index", GINT_TO_POINTER (i)); + + /* Set active state */ + ws_state = ws ? xfw_workspace_get_state (ws) : XFW_WORKSPACE_STATE_NONE; + data->ignore_toggle = TRUE; + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), + (ws_state & XFW_WORKSPACE_STATE_ACTIVE) != 0); + data->ignore_toggle = FALSE; + + g_signal_connect (button, "toggled", + G_CALLBACK (on_button_toggled), data); + + /* Calculate grid position */ + if (data->orientation == GTK_ORIENTATION_HORIZONTAL) + { + col = i / rows; + row = i % rows; + } + else + { + col = i % cols; + row = i / cols; + } + + gtk_grid_attach (GTK_GRID (data->grid), button, col, row, 1, 1); + } + + gtk_widget_show_all (data->grid); +} + +/* ---- Signal handlers on workspace groups ---- */ + +static void +on_active_workspace_changed (XfwWorkspaceGroup *group, + XfwWorkspace *previous, + WaylandWorkspaceData *data) +{ + rebuild_ui (data); +} + +static void +on_workspace_added (XfwWorkspaceGroup *group, + XfwWorkspace *workspace, + WaylandWorkspaceData *data) +{ + rebuild_ui (data); +} + +static void +on_workspace_removed (XfwWorkspaceGroup *group, + XfwWorkspace *workspace, + WaylandWorkspaceData *data) +{ + rebuild_ui (data); +} + +/* ---- Group signal management ---- */ + +static void +disconnect_group_signals (WaylandWorkspaceData *data) +{ + for (GList *l = data->group_signals; l != NULL; l = l->next) + { + GroupSignal *gs = l->data; + g_signal_handler_disconnect (gs->group, gs->handlers[0]); + g_signal_handler_disconnect (gs->group, gs->handlers[1]); + g_signal_handler_disconnect (gs->group, gs->handlers[2]); + g_free (gs); + } + + g_list_free (data->group_signals); + data->group_signals = NULL; +} + +static void +connect_group_signals (WaylandWorkspaceData *data) +{ + GList *groups, *l; + + disconnect_group_signals (data); + + groups = xfw_workspace_manager_list_workspace_groups (data->workspace_manager); + if (!groups) + return; + + for (l = groups; l != NULL; l = l->next) + { + XfwWorkspaceGroup *group = l->data; + GroupSignal *gs = g_new0 (GroupSignal, 1); + + gs->group = group; + gs->handlers[0] = g_signal_connect (group, "active-workspace-changed", + G_CALLBACK (on_active_workspace_changed), data); + gs->handlers[1] = g_signal_connect (group, "workspace-added", + G_CALLBACK (on_workspace_added), data); + gs->handlers[2] = g_signal_connect (group, "workspace-removed", + G_CALLBACK (on_workspace_removed), data); + + data->group_signals = g_list_append (data->group_signals, gs); + } +} + +static void +on_workspace_group_created (XfwWorkspaceManager *manager, + XfwWorkspaceGroup *group, + WaylandWorkspaceData *data) +{ + connect_group_signals (data); + rebuild_ui (data); +} + +static void +on_workspace_group_destroyed (XfwWorkspaceManager *manager, + XfwWorkspaceGroup *group, + WaylandWorkspaceData *data) +{ + connect_group_signals (data); + rebuild_ui (data); +} + +static void +on_workspace_created (XfwWorkspaceManager *manager, + XfwWorkspace *workspace, + WaylandWorkspaceData *data) +{ + rebuild_ui (data); +} + +static void +on_workspace_destroyed (XfwWorkspaceManager *manager, + XfwWorkspace *workspace, + WaylandWorkspaceData *data) +{ + rebuild_ui (data); +} + +/* ---- Cleanup ---- */ + +static void +wayland_pager_data_free (WaylandWorkspaceData *data) +{ + disconnect_group_signals (data); + g_free (data); +} + +/* ---- Public API ---- */ + +GtkWidget * +wayland_workspace_new (void) +{ + WaylandWorkspaceData *data; + + xfw_set_client_type (XFW_CLIENT_TYPE_PAGER); + + data = g_new0 (WaylandWorkspaceData, 1); + data->orientation = GTK_ORIENTATION_HORIZONTAL; + data->n_rows = 1; + data->display_all = TRUE; + data->display_names = FALSE; + data->ignore_toggle = FALSE; + + data->grid = gtk_grid_new (); + gtk_widget_set_size_request (data->grid, 48, -1); + + GtkStyleContext *context = gtk_widget_get_style_context (data->grid); + gtk_style_context_add_class (context, "wnck-pager"); + + g_object_set_data_full (G_OBJECT (data->grid), + "wayland_pager_data", + data, + (GDestroyNotify) wayland_pager_data_free); + + data->screen = xfw_screen_get_default (); + if (!data->screen) + { + g_warning ("xfw_screen_get_default() failed"); + return data->grid; + } + + data->workspace_manager = xfw_screen_get_workspace_manager (data->screen); + if (!data->workspace_manager) + { + g_warning ("xfw_screen_get_workspace_manager() failed"); + return data->grid; + } + + g_signal_connect (data->workspace_manager, "workspace-group-created", + G_CALLBACK (on_workspace_group_created), data); + g_signal_connect (data->workspace_manager, "workspace-group-destroyed", + G_CALLBACK (on_workspace_group_destroyed), data); + + g_signal_connect (data->workspace_manager, "workspace-created", + G_CALLBACK (on_workspace_created), data); + g_signal_connect (data->workspace_manager, "workspace-destroyed", + G_CALLBACK (on_workspace_destroyed), data); + + connect_group_signals (data); + rebuild_ui (data); + + return data->grid; +} + +static WaylandWorkspaceData * +pager_widget_get_data (GtkWidget *pager_widget) +{ + return g_object_get_data (G_OBJECT (pager_widget), "wayland_pager_data"); +} + +void +wayland_workspace_set_orientation (GtkWidget *pager_widget, GtkOrientation orientation) +{ + WaylandWorkspaceData *data = pager_widget_get_data (pager_widget); + g_return_if_fail (data); + + if (data->orientation == orientation) + return; + + data->orientation = orientation; + rebuild_ui (data); +} + +void +wayland_workspace_set_rows (GtkWidget *pager_widget, int n_rows) +{ + WaylandWorkspaceData *data = pager_widget_get_data (pager_widget); + g_return_if_fail (data); + + n_rows = CLAMP (n_rows, 1, 16); + + if (data->n_rows == n_rows) + return; + + data->n_rows = n_rows; + rebuild_ui (data); +} + +void +wayland_workspace_set_show_all (GtkWidget *pager_widget, gboolean show_all) +{ + WaylandWorkspaceData *data = pager_widget_get_data (pager_widget); + g_return_if_fail (data); + + if (data->display_all == show_all) + return; + + data->display_all = show_all; + rebuild_ui (data); +} + +void +wayland_workspace_set_show_names (GtkWidget *pager_widget, gboolean show_names) +{ + WaylandWorkspaceData *data = pager_widget_get_data (pager_widget); + g_return_if_fail (data); + + if (data->display_names == show_names) + return; + + data->display_names = show_names; + rebuild_ui (data); +} + +int +wayland_workspace_get_count (GtkWidget *pager_widget) +{ + WaylandWorkspaceData *data = pager_widget_get_data (pager_widget); + + g_return_val_if_fail (data, 0); + + return g_list_length (xfw_workspace_manager_list_workspaces (data->workspace_manager)); +} + +const char * +wayland_workspace_get_name (GtkWidget *pager_widget, int index) +{ + WaylandWorkspaceData *data = pager_widget_get_data (pager_widget); + XfwWorkspace *ws; + + g_return_val_if_fail (data, "workspace"); + + ws = get_nth_workspace (data, index); + if (ws) + { + const char *name = xfw_workspace_get_name (ws); + if (name && name[0] != '\0') + return name; + return xfw_workspace_get_id (ws); + } + + return "workspace"; +} + +int +wayland_workspace_get_active_index (GtkWidget *pager_widget) +{ + WaylandWorkspaceData *data = pager_widget_get_data (pager_widget); + GList *workspaces, *l; + int i = 0; + + g_return_val_if_fail (data, 0); + + workspaces = xfw_workspace_manager_list_workspaces (data->workspace_manager); + + for (l = workspaces; l != NULL; l = l->next) + { + XfwWorkspace *ws = l->data; + XfwWorkspaceState state = xfw_workspace_get_state (ws); + + if (state & XFW_WORKSPACE_STATE_ACTIVE) + return i; + i++; + } + + return 0; +} + +void +wayland_workspace_activate_nth (GtkWidget *pager_widget, int index) +{ + WaylandWorkspaceData *data = pager_widget_get_data (pager_widget); + XfwWorkspace *ws; + + g_return_if_fail (data); + + ws = get_nth_workspace (data, index); + if (ws) + { + GError *error = NULL; + if (!xfw_workspace_activate (ws, &error)) + { + g_warning ("Failed to activate workspace: %s", + error ? error->message : "unknown error"); + g_clear_error (&error); + } + } +} diff --git a/applets/wncklet/wayland-workspace.h b/applets/wncklet/wayland-workspace.h new file mode 100644 index 00000000..36d84c47 --- /dev/null +++ b/applets/wncklet/wayland-workspace.h @@ -0,0 +1,52 @@ +/* Wncklet applet Wayland workspace backend */ + +/* + * Copyright (C) 2026 MATE Desktop Team + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +#ifndef _WNCKLET_APPLET_WAYLAND_WORKSPACE_H_ +#define _WNCKLET_APPLET_WAYLAND_WORKSPACE_H_ + +#include <gtk/gtk.h> +#include <gdk/gdk.h> + +#ifdef __cplusplus +extern "C" { +#endif + +GtkWidget* wayland_workspace_new (void); +void wayland_workspace_set_orientation(GtkWidget *pager_widget, + GtkOrientation orientation); +void wayland_workspace_set_rows (GtkWidget *pager_widget, + int n_rows); +void wayland_workspace_set_show_all (GtkWidget *pager_widget, + gboolean show_all); +void wayland_workspace_set_show_names (GtkWidget *pager_widget, + gboolean show_names); +int wayland_workspace_get_count (GtkWidget *pager_widget); +const char* wayland_workspace_get_name (GtkWidget *pager_widget, + int index); +int wayland_workspace_get_active_index (GtkWidget *pager_widget); +void wayland_workspace_activate_nth (GtkWidget *pager_widget, + int index); + +#ifdef __cplusplus +} +#endif + +#endif /* _WNCKLET_APPLET_WAYLAND_WORKSPACE_H_ */ diff --git a/applets/wncklet/wncklet.c b/applets/wncklet/wncklet.c index 1ced4507..5662aead 100644 --- a/applets/wncklet/wncklet.c +++ b/applets/wncklet/wncklet.c @@ -131,10 +131,8 @@ static gboolean wncklet_factory(MatePanelApplet* applet, const char* iid, gpoint if (!strcmp(iid, "WindowMenuApplet")) retval = window_menu_applet_fill(applet); -#ifdef HAVE_X11 else if (!strcmp(iid, "WorkspaceSwitcherApplet") || !strcmp(iid, "PagerApplet")) retval = workspace_switcher_applet_fill(applet); -#endif else if (!strcmp(iid, "WindowListApplet") || !strcmp(iid, "TasklistApplet")) retval = window_list_applet_fill(applet); else if (!strcmp(iid, "ShowDesktopApplet")) diff --git a/applets/wncklet/workspace-switcher.c b/applets/wncklet/workspace-switcher.c index cba0ecbd..93318314 100644 --- a/applets/wncklet/workspace-switcher.c +++ b/applets/wncklet/workspace-switcher.c @@ -31,6 +31,7 @@ #ifdef HAVE_WAYLAND #include <gdk/gdkwayland.h> +#include "wayland-workspace.h" #endif /* HAVE_WAYLAND */ #include <libmate-desktop/mate-gsettings.h> @@ -217,8 +218,11 @@ typedef struct { #ifdef HAVE_X11 WnckHandle* wnck_handle; -#endif WnckScreen* screen; +#endif +#ifdef HAVE_WAYLAND + gboolean is_wayland; +#endif PagerWM wm; /* Properties: */ @@ -280,6 +284,16 @@ static void pager_update(PagerData* pager) pager_update_wnck(pager, WNCK_PAGER(pager->pager)); } #endif /* HAVE_X11 */ + +#ifdef HAVE_WAYLAND + if (pager->is_wayland) + { + wayland_workspace_set_orientation(pager->pager, pager->orientation); + wayland_workspace_set_rows(pager->pager, pager->n_rows); + wayland_workspace_set_show_all(pager->pager, pager->display_all); + wayland_workspace_set_show_names(pager->pager, pager->display_names); + } +#endif /* HAVE_WAYLAND */ } static void update_properties_for_wm(PagerData* pager) @@ -365,9 +379,9 @@ static void update_properties_for_wm(PagerData* pager) } } +#ifdef HAVE_X11 static void window_manager_changed(WnckScreen* screen, PagerData* pager) { -#ifdef HAVE_X11 const char *wm_name = NULL; if (pager->screen) @@ -389,13 +403,11 @@ static void window_manager_changed(WnckScreen* screen, PagerData* pager) pager->wm = PAGER_WM_COMPIZ; else pager->wm = PAGER_WM_UNKNOWN; -#else - pager->wm = PAGER_WM_UNKNOWN; -#endif /* HAVE_X11 */ update_properties_for_wm(pager); pager_update(pager); } +#endif /* HAVE_X11 */ static void applet_realized(MatePanelApplet* applet, PagerData* pager) { @@ -404,10 +416,17 @@ static void applet_realized(MatePanelApplet* applet, PagerData* pager) { pager->screen = wncklet_get_screen(pager->wnck_handle, GTK_WIDGET(applet)); wncklet_connect_while_alive(pager->screen, "window_manager_changed", G_CALLBACK(window_manager_changed), pager, pager->applet); + window_manager_changed(pager->screen, pager); + return; } #endif /* HAVE_X11 */ - window_manager_changed(pager->screen, pager); +#ifdef HAVE_WAYLAND + if (pager->is_wayland) + { + pager_update(pager); + } +#endif /* HAVE_WAYLAND */ } static void applet_unrealized(MatePanelApplet* applet, PagerData* pager) @@ -473,7 +492,6 @@ static void applet_style_updated (MatePanelApplet *applet, GtkStyleContext *cont provider = gtk_css_provider_new (); - /* Provide a fallback color for the highlighted workspace based on the current theme */ gtk_style_context_lookup_color (context, "theme_selected_bg_color", &color); color_str = gdk_rgba_to_string (&color); bg_css = g_strconcat (".wnck-pager:selected {\n" @@ -485,7 +503,7 @@ static void applet_style_updated (MatePanelApplet *applet, GtkStyleContext *cont gtk_style_context_add_provider (context, GTK_STYLE_PROVIDER (provider), - GTK_STYLE_PROVIDER_PRIORITY_FALLBACK); + GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); g_object_unref (provider); } @@ -508,6 +526,91 @@ static gboolean applet_scroll(MatePanelApplet* applet, GdkEventScroll* event, Pa if (event->direction == GDK_SCROLL_SMOOTH) return FALSE; +#ifdef HAVE_WAYLAND + if (pager->is_wayland) + { + GdkScrollDirection absolute_direction; + int index; + int n_workspaces; + int n_columns; + int in_last_row; + + index = wayland_workspace_get_active_index (pager->pager); + n_workspaces = wayland_workspace_get_count (pager->pager); + + if (n_workspaces <= 0) + return TRUE; + + n_columns = n_workspaces / pager->n_rows; + if (n_workspaces % pager->n_rows != 0) + n_columns++; + + in_last_row = n_workspaces % n_columns; + + absolute_direction = event->direction; + + if (gtk_widget_get_direction (GTK_WIDGET (applet)) == GTK_TEXT_DIR_RTL) + { + switch (event->direction) + { + case GDK_SCROLL_RIGHT: + absolute_direction = GDK_SCROLL_LEFT; + break; + case GDK_SCROLL_LEFT: + absolute_direction = GDK_SCROLL_RIGHT; + break; + default: + break; + } + } + + switch (absolute_direction) + { + case GDK_SCROLL_DOWN: + if (index + n_columns < n_workspaces) + index += n_columns; + else if (pager->wrap_workspaces && index == n_workspaces - 1) + index = 0; + else if ((index < n_workspaces - 1 && index + in_last_row != n_workspaces - 1) || + (index == n_workspaces - 1 && in_last_row != 0)) + index = (index % n_columns) + 1; + break; + + case GDK_SCROLL_RIGHT: + if (index < n_workspaces - 1) + index++; + else if (pager->wrap_workspaces) + index = 0; + break; + + case GDK_SCROLL_UP: + if (index - n_columns >= 0) + index -= n_columns; + else if (index > 0) + index = ((pager->n_rows - 1) * n_columns) + (index % n_columns) - 1; + else if (pager->wrap_workspaces) + index = n_workspaces - 1; + + if (index >= n_workspaces) + index -= n_columns; + break; + + case GDK_SCROLL_LEFT: + if (index > 0) + index--; + else if (pager->wrap_workspaces) + index = n_workspaces - 1; + break; + + default: + return FALSE; + } + + wayland_workspace_activate_nth (pager->pager, index); + return TRUE; + } +#endif /* HAVE_WAYLAND */ + #ifdef HAVE_X11 if (pager->screen) { @@ -644,10 +747,21 @@ static const GtkActionEntry pager_menu_actions[] = { static void num_rows_changed(GSettings* settings, gchar* key, PagerData* pager) { int n_rows; + int ws_count = MAX_REASONABLE_ROWS; + +#ifdef HAVE_X11 + if (pager->screen) + ws_count = wnck_screen_get_workspace_count (pager->screen); +#endif /* HAVE_X11 */ + +#ifdef HAVE_WAYLAND + if (pager->is_wayland) + ws_count = wayland_workspace_get_count (pager->pager); +#endif /* HAVE_WAYLAND */ n_rows = CLAMP (g_settings_get_int (settings, key), 1, - MIN (wnck_screen_get_workspace_count (pager->screen), + MIN (ws_count, MAX_REASONABLE_ROWS)); pager->n_rows = n_rows; @@ -785,7 +899,8 @@ gboolean workspace_switcher_applet_fill(MatePanelApplet* applet) #ifdef HAVE_WAYLAND if (GDK_IS_WAYLAND_DISPLAY (gdk_display_get_default ())) { - pager->pager = gtk_label_new ("[Pager not supported on Wayland]"); + pager->is_wayland = TRUE; + pager->pager = wayland_workspace_new(); } else #endif /* HAVE_WAYLAND */ @@ -922,6 +1037,13 @@ static const char *get_workspace_name(PagerData* pager, int workspace_index) } #endif /* HAVE_X11 */ +#ifdef HAVE_WAYLAND + if (pager->is_wayland) + { + return wayland_workspace_get_name(pager->pager, workspace_index); + } +#endif /* HAVE_WAYLAND */ + /* Fallback */ return "workspace"; } @@ -935,6 +1057,14 @@ static void update_workspaces_model(PagerData* pager) nr_ws = wnck_screen_get_workspace_count (pager->screen); #endif /* HAVE_X11 */ +#ifdef HAVE_WAYLAND + if (pager->is_wayland) + nr_ws = wayland_workspace_get_count (pager->pager); +#endif /* HAVE_WAYLAND */ + + if (nr_ws == 0) + nr_ws = 1; + if (pager->properties_dialog) { int i; @@ -1297,5 +1427,10 @@ static void destroy_pager(GtkWidget* widget, PagerData* pager) g_clear_object(&pager->wnck_handle); #endif +#ifdef HAVE_WAYLAND + /* The Wayland pager widget cleanup is handled by the + * destroy notify on the outer_box's g_object_set_data */ +#endif + g_free(pager); } diff --git a/configure.ac b/configure.ac index 92dd8aae..cde280a0 100644 --- a/configure.ac +++ b/configure.ac @@ -214,6 +214,17 @@ if test "x$enable_wayland" != "xno"; then ]) fi +have_xfw=no +if test "x$have_wayland" = "xyes"; then + PKG_CHECK_MODULES(XFW, libxfce4windowing-0 >= 4.19.4, have_xfw=yes, [ + if test "x$enable_wayland" = "xyes"; then + AC_MSG_ERROR([Wayland support requires libxfce4windowing-0 >= 4.19.4]) + else + have_wayland=no + fi + ]) +fi + AM_CONDITIONAL(ENABLE_WAYLAND, [test "x$have_wayland" = "xyes"]) if test "x$have_wayland" = "xyes"; then diff --git a/data/meson.build b/data/meson.build new file mode 100644 index 00000000..e87e5e1c --- /dev/null +++ b/data/meson.build @@ -0,0 +1,64 @@ +# panel layouts +install_data( + 'default.layout', + 'fedora.layout', + 'linuxmint.layout', + 'mageia.layout', + 'opensuse.layout', + 'ubuntu.layout', + install_dir: mate_panel_layoutsdir, +) + +# gsettings enums +glib_mkenums = find_program('glib-mkenums') + +panel_enums = custom_target('org.mate.panel.enums.xml', + input: '../mate-panel/panel-enums-gsettings.h', + output: 'org.mate.panel.enums.xml', + build_by_default: true, + install: true, + install_dir: mate_panel_schemadir, + command: [ + glib_mkenums, + '--comments', '<!-- @comment@ -->', + '--fhead', '<schemalist>', + '--vhead', ' <@type@ id=\'org.mate.panel.@EnumName@\'>', + '--vprod', ' <value nick=\'@valuenick@\' value=\'@valuenum@\'/>', + '--vtail', ' </@type@>', + '--ftail', '</schemalist>', + '--output', '@OUTPUT@', + '@INPUT@', + ], +) + +# gsettings schemas +schemas = [] +foreach schema : [ + 'org.mate.panel', + 'org.mate.panel.object', + 'org.mate.panel.toplevel', + 'org.mate.panel.menubar', + ] + schemas += configure_file( + input: schema + '.gschema.xml.in', + output: schema + '.gschema.xml', + configuration: {'GETTEXT_PACKAGE': mate_panel_gettext_package}, + ) +endforeach + +install_data(schemas, install_dir: mate_panel_schemadir) + +glib_compile_schemas = find_program('glib-compile-schemas') + +gschemas_compiled = custom_target('gschemas.compiled', + output: 'gschemas.compiled', + input: schemas, + build_by_default: true, + command: [ + glib_compile_schemas, + meson.current_build_dir(), + ], +) + +gnome = import('gnome') +gnome.post_install(glib_compile_schemas: true) diff --git a/doc/meson.build b/doc/meson.build new file mode 100644 index 00000000..ead14c40 --- /dev/null +++ b/doc/meson.build @@ -0,0 +1 @@ +subdir('reference') diff --git a/doc/reference/mate-panel-applet/meson.build b/doc/reference/mate-panel-applet/meson.build new file mode 100644 index 00000000..61878e88 --- /dev/null +++ b/doc/reference/mate-panel-applet/meson.build @@ -0,0 +1,22 @@ +doc_module = 'mate-panel-applet' + +gtkdoc_link_dep = declare_dependency( + link_with: libmate_panel_applet_lib, + include_directories: libmate_panel_applet_inc, +) + +gnome.gtkdoc(doc_module, + main_sgml: '@[email protected]'.format(doc_module), + src_dir: 'libmate-panel-applet', + gobject_typesfile: '@[email protected]'.format(doc_module), + ignore_headers: [ + 'MATE_Panel.h', + 'mate-panel-applet-enums.h', + 'mate-panel-applet-marshal.h', + 'mate-panel-applet-private.h', + 'mate-panel-applet-shell.h', + ], + mkdb_args: '--output-format=xml', + dependencies: libmate_panel_applet_deps + [gtkdoc_link_dep], + install: true, +) diff --git a/doc/reference/meson.build b/doc/reference/meson.build new file mode 100644 index 00000000..196fd7ce --- /dev/null +++ b/doc/reference/meson.build @@ -0,0 +1 @@ +subdir('mate-panel-applet') diff --git a/help/mate-clock/meson.build b/help/mate-clock/meson.build new file mode 100644 index 00000000..d82268e4 --- /dev/null +++ b/help/mate-clock/meson.build @@ -0,0 +1,21 @@ +fs = import('fs') + +help_id = 'mate-clock' +help_sources = ['index.docbook', 'legal.xml'] +help_media = ['figures/clock_applet.png'] + +# discover the locale directories holding a <locale>.po translation file +langs = [] +foreach entry : run_command('ls', '-1', meson.current_source_dir(), check: true).stdout().strip().split('\n') + entry_path = join_paths(meson.current_source_dir(), entry) + if entry != 'C' and fs.is_dir(entry_path) and fs.exists(join_paths(entry_path, entry + '.po')) + langs += entry + endif +endforeach + +gnome.yelp(help_id, + sources: help_sources, + media: help_media, + languages: langs, + symlink_media: true, +) diff --git a/help/mate-fish/meson.build b/help/mate-fish/meson.build new file mode 100644 index 00000000..2cf0f3c0 --- /dev/null +++ b/help/mate-fish/meson.build @@ -0,0 +1,21 @@ +fs = import('fs') + +help_id = 'mate-fish' +help_sources = ['index.docbook', 'legal.xml'] +help_media = ['figures/fish_applet.png'] + +# discover the locale directories holding a <locale>.po translation file +langs = [] +foreach entry : run_command('ls', '-1', meson.current_source_dir(), check: true).stdout().strip().split('\n') + entry_path = join_paths(meson.current_source_dir(), entry) + if entry != 'C' and fs.is_dir(entry_path) and fs.exists(join_paths(entry_path, entry + '.po')) + langs += entry + endif +endforeach + +gnome.yelp(help_id, + sources: help_sources, + media: help_media, + languages: langs, + symlink_media: true, +) diff --git a/help/meson.build b/help/meson.build new file mode 100644 index 00000000..a999b5f6 --- /dev/null +++ b/help/meson.build @@ -0,0 +1,2 @@ +subdir('mate-clock') +subdir('mate-fish') diff --git a/icons/meson.build b/icons/meson.build new file mode 100644 index 00000000..eb3023d0 --- /dev/null +++ b/icons/meson.build @@ -0,0 +1,53 @@ +icon_names = [ + 'mate-panel-clock', + 'mate-panel-drawer', + 'mate-panel-fish', + 'mate-panel-force-quit', + 'mate-panel-launcher', + 'mate-panel-notification-area', + 'mate-panel-separator', + 'mate-panel', + 'mate-panel-window-list', + 'mate-panel-window-menu', + 'mate-panel-workspace-switcher', +] + +foreach size : ['16x16', '22x22', '24x24', '32x32', '48x48', '64x64', '96x96', '256x256'] + icons_dir = join_paths(mate_panel_datadir, 'icons', 'hicolor', size, 'apps') + install_data( + sources: [size + '/mate-panel-clock.png', + size + '/mate-panel-drawer.png', + size + '/mate-panel-fish.png', + size + '/mate-panel-force-quit.png', + size + '/mate-panel-launcher.png', + size + '/mate-panel-notification-area.png', + size + '/mate-panel-separator.png', + size + '/mate-panel.png', + size + '/mate-panel-window-list.png', + size + '/mate-panel-window-menu.png', + size + '/mate-panel-workspace-switcher.png'], + install_dir: icons_dir, + ) +endforeach + +install_data( + 'scalable/mate-panel-clock.svg', + 'scalable/mate-panel-drawer.svg', + 'scalable/mate-panel-fish.svg', + 'scalable/mate-panel-force-quit.svg', + 'scalable/mate-panel-launcher.svg', + 'scalable/mate-panel-notification-area.svg', + 'scalable/mate-panel-separator.svg', + 'scalable/mate-panel.svg', + 'scalable/mate-panel-window-list.svg', + 'scalable/mate-panel-window-menu.svg', + 'scalable/mate-panel-workspace-switcher.svg', + install_dir: join_paths(mate_panel_datadir, 'icons', 'hicolor', 'scalable', 'apps'), +) + +gnome = import('gnome') + +gnome.post_install( + glib_compile_schemas: false, + gtk_update_icon_cache: true, +) diff --git a/libmate-panel-applet/meson.build b/libmate-panel-applet/meson.build new file mode 100644 index 00000000..4eb4fe27 --- /dev/null +++ b/libmate-panel-applet/meson.build @@ -0,0 +1,145 @@ +libmate_panel_applet_inc = include_directories('.') + +glib_mkenums = find_program('glib-mkenums') + +# generated marshallers +libmate_panel_applet_marshal = gnome.genmarshal('mate-panel-applet-marshal', + sources: 'mate-panel-applet-marshal.list', + prefix: 'mate_panel_applet_marshal', +) + +# generated enumerations +mate_panel_applet_enum_headers = files('mate-panel-applet.h') + +libmate_panel_applet_enums_h = custom_target('mate-panel-applet-enums.h', + input: mate_panel_applet_enum_headers, + output: 'mate-panel-applet-enums.h', + install: true, + install_dir: join_paths(get_option('includedir'), + 'mate-panel-@0@/libmate-panel-applet'.format(mate_panel_api_version)), + command: [ + glib_mkenums, + '--fhead', '#ifndef __MATE_PANEL_APPLET_ENUMS_H__\n#define __MATE_PANEL_APPLET_ENUMS_H__\n\n#ifdef __cplusplus\nextern "C" {\n#endif\n\n', + '--ftail', '#ifdef __cplusplus\n}\n#endif\n\n#endif /* __MATE_PANEL_APPLET_ENUMS_H__ */\n', + '--fprod', '\n/* --- @filename@ --- */', + '--eprod', '#define PANEL_TYPE_@ENUMNAME@ @enum_name@_get_type()\nGType @enum_name@_get_type (void);\n', + '--output', '@OUTPUT@', + '@INPUT@', + ], +) + +libmate_panel_applet_enums_c = custom_target('mate-panel-applet-enums.c', + input: mate_panel_applet_enum_headers, + output: 'mate-panel-applet-enums.c', + command: [ + glib_mkenums, + '--fhead', '#include <glib-object.h>\n#include "mate-panel-applet-enums.h"\n', + '--fprod', '\n/* enumerations from "@filename@" */\n#include "@filename@"\n', + '--vhead', 'static const G@Type@Value _@enum_name@_values[] = {', + '--vprod', ' { @VALUENAME@, "@VALUENAME@", "@valuenick@" },', + '--vtail', ' { 0, NULL, NULL }\n};\n\n', + '--vtail', 'GType\n@enum_name@_get_type (void)\n{\n', + '--vtail', ' static GType type = 0;\n\n', + '--vtail', ' if (!type)\n', + '--vtail', ' type = g_@type@_register_static ("@EnumName@", _@enum_name@_values);\n\n', + '--vtail', ' return type;\n}\n\n', + '--output', '@OUTPUT@', + '@INPUT@', + ], +) + +libmate_panel_applet_sources = [ + 'mate-panel-applet.h', + 'mate-panel-applet.c', + 'mate-panel-applet-factory.h', + 'mate-panel-applet-factory.c', + 'mate-panel-applet-gsettings.c', + 'mate-panel-applet-gsettings.h', + 'panel-applet-private.h', + libmate_panel_applet_marshal, + libmate_panel_applet_enums_c, + libmate_panel_applet_enums_h, +] + +if have_x11 + libmate_panel_applet_sources += ['panel-plug.c', 'panel-plug-private.h'] +endif + +libmate_panel_applet_deps_local = libmate_panel_applet_deps +if have_x11 + libmate_panel_applet_deps_local += x11_dep +endif + +libmate_panel_applet_lib = library('mate-panel-applet-4', + libmate_panel_applet_sources, + version: '@0@.@1@.@2@'.format(libmate_panel_applet_current, libmate_panel_applet_age, libmate_panel_applet_revision), + include_directories: libmate_panel_applet_inc, + dependencies: libmate_panel_applet_deps_local, + c_args: disable_deprecated_flags, + install: true, +) + +install_headers( + 'mate-panel-applet.h', + 'mate-panel-applet-gsettings.h', + subdir: 'mate-panel-@0@/libmate-panel-applet'.format(mate_panel_api_version), +) + +pkg = import('pkgconfig') + +pkg.generate(libmate_panel_applet_lib, + filebase: 'libmatepanelapplet-@0@'.format(mate_panel_api_version), + name: 'libmate-panel-applet-4', + description: 'libmate-panel-applet-4', + version: mate_panel_version, + requires: ['glib-2.0', 'gio-2.0', 'gtk+-3.0'], + subdirs: 'mate-panel-@0@/libmate-panel-applet'.format(mate_panel_api_version), + install_dir: join_paths(mate_panel_libdir, 'pkgconfig'), +) + +# test program +executable('test-dbus-applet', + 'test-dbus-applet.c', + include_directories: libmate_panel_applet_inc, + dependencies: libmate_panel_applet_deps_local, + link_with: libmate_panel_applet_lib, +) + +# test applet desktop file (not installed) +test_applet_desktop = i18n.merge_file( + input: 'org.mate.panel.TestApplet.mate-panel-applet.desktop.in', + output: 'org.mate.panel.TestApplet.mate-panel-applet', + type: 'desktop', + po_dir: '../po', + install: false, +) + +# introspection +if enable_introspection.allowed() + introspection_sources = [ + 'mate-panel-applet.c', + 'mate-panel-applet.h', + 'mate-panel-applet-gsettings.c', + 'mate-panel-applet-gsettings.h', + ] + built_introspection_sources = [ + libmate_panel_applet_enums_c, + libmate_panel_applet_enums_h, + ] + + mate_panel_applet_gir = gnome.generate_gir(libmate_panel_applet_lib, + sources: introspection_sources + built_introspection_sources, + nsversion: mate_panel_gir_version, + namespace: mate_panel_gir_ns, + symbol_prefix: 'mate_panel_applet', + identifier_prefix: 'MatePanelApplet', + export_packages: 'libmatepanelapplet-@0@'.format(mate_panel_api_version), + includes: ['GObject-2.0', 'Gtk-3.0', 'Gio-2.0'], + install: true, + extra_args: [ + '--warn-all', + '--strip-prefix=MatePanel', + '--add-include-path=@0@'.format(meson.current_source_dir()), + ], + ) +endif diff --git a/man/meson.build b/man/meson.build new file mode 100644 index 00000000..d93ce456 --- /dev/null +++ b/man/meson.build @@ -0,0 +1,5 @@ +install_man( + 'mate-panel.1', + 'mate-desktop-item-edit.1', + 'mate-panel-test-applets.1', +) diff --git a/mate-panel/libmate-panel-applet-private/meson.build b/mate-panel/libmate-panel-applet-private/meson.build new file mode 100644 index 00000000..14187815 --- /dev/null +++ b/mate-panel/libmate-panel-applet-private/meson.build @@ -0,0 +1,47 @@ +panel_applet_private_inc = include_directories('.') + +libmate_panel_applet_private_sources = [ + 'panel-applets-manager-dbus.c', + 'panel-applets-manager-dbus.h', + 'panel-applet-container.c', + 'panel-applet-container.h', + 'panel-applet-frame-dbus.c', + 'panel-applet-frame-dbus.h', +] + +libmate_panel_applet_private_mini_sources = [ + 'panel-applet-mini.c', + 'panel-applets-manager-dbus.c', + 'panel-applets-manager-dbus.h', + 'panel-applet-container.c', + 'panel-applet-container.h', +] + +libmate_panel_applet_private_common_args = [ + '-DDATADIR="@0@"'.format(mate_panel_datadir), + '-DMATE_PANEL_APPLETS_DIR="@0@"'.format(mate_panel_appletsdir), +] + disable_deprecated_flags + +libmate_panel_applet_private_inc_dirs = [ + panel_applet_private_inc, + mate_panel_inc, + libpanel_util_inc, +] + +libmate_panel_applet_private_deps = panel_deps + [dconf_dep] + +libmate_panel_applet_private = static_library('mate-panel-applet-private', + libmate_panel_applet_private_sources, + panel_marshal, + include_directories: libmate_panel_applet_private_inc_dirs, + dependencies: libmate_panel_applet_private_deps, + c_args: libmate_panel_applet_private_common_args, +) + +libmate_panel_applet_private_mini = static_library('mate-panel-applet-private-mini', + libmate_panel_applet_private_mini_sources, + panel_marshal, + include_directories: libmate_panel_applet_private_inc_dirs, + dependencies: libmate_panel_applet_private_deps, + c_args: libmate_panel_applet_private_common_args, +) diff --git a/mate-panel/libpanel-util/meson.build b/mate-panel/libpanel-util/meson.build new file mode 100644 index 00000000..6383084c --- /dev/null +++ b/mate-panel/libpanel-util/meson.build @@ -0,0 +1,33 @@ +libpanel_util_sources = [ + 'panel-cleanup.c', + 'panel-cleanup.h', + 'panel-color.c', + 'panel-color.h', + 'panel-error.c', + 'panel-error.h', + 'panel-glib.c', + 'panel-glib.h', + 'panel-gtk.c', + 'panel-gtk.h', + 'panel-icon-chooser.c', + 'panel-icon-chooser.h', + 'panel-keyfile.c', + 'panel-keyfile.h', + 'panel-launch.c', + 'panel-launch.h', + 'panel-list.c', + 'panel-list.h', + 'panel-session-manager.c', + 'panel-session-manager.h', + 'panel-show.c', + 'panel-show.h', + 'panel-xdg.c', + 'panel-xdg.h', +] + +libpanel_util = static_library('panel-util', + libpanel_util_sources, + include_directories: libpanel_util_inc, + dependencies: panel_deps + [dconf_dep], + c_args: ['-DDATADIR="@0@"'.format(mate_panel_datadir)] + disable_deprecated_flags, +) diff --git a/mate-panel/meson.build b/mate-panel/meson.build new file mode 100644 index 00000000..95af7190 --- /dev/null +++ b/mate-panel/meson.build @@ -0,0 +1,355 @@ +mate_panel_inc = include_directories('.') +mate_submodules_inc = include_directories('mate-submodules') +libpanel_util_inc = include_directories('libpanel-util') + +glib_mkenums = find_program('glib-mkenums') +glib_compile_resources = find_program('glib-compile-resources') + +# --- generated sources --- + +# marshallers +panel_marshal = gnome.genmarshal('panel-marshal', + sources: 'panel-marshal.list', + prefix: 'panel_marshal', +) + +# enumerations +panel_enum_headers = [ + 'panel-enums.h', + 'panel-enums-gsettings.h', + 'panel-types.h', +] + +panel_typebuiltins_c = custom_target('panel-typebuiltins.c', + input: panel_enum_headers, + output: 'panel-typebuiltins.c', + command: [ + glib_mkenums, + '--fhead', '#include <glib-object.h>\n', + '--fhead', '#include "panel-typebuiltins.h"\n\n', + '--fprod', '\n/* enumerations from "@filename@" */', + '--fprod', '\n#include "@filename@"\n', + '--vhead', 'static const GEnumValue _@enum_name@_values[] = {', + '--vprod', ' { @VALUENAME@, "@VALUENAME@", "@valuenick@" },', + '--vtail', ' { 0, NULL, NULL }\n};\n\n', + '--vtail', 'GType\n@enum_name@_get_type (void)\n{\n', + '--vtail', ' static GType type = 0;\n\n', + '--vtail', ' if (!type)\n', + '--vtail', ' type = g_enum_register_static ("@EnumName@", _@enum_name@_values);\n\n', + '--vtail', ' return type;\n}\n\n', + '--output', '@OUTPUT@', + '@INPUT@', + ], +) + +panel_typebuiltins_h = custom_target('panel-typebuiltins.h', + input: panel_enum_headers, + output: 'panel-typebuiltins.h', + command: [ + glib_mkenums, + '--fhead', '#ifndef __PANEL_TYPEBUILTINS_H__\n', + '--fhead', '#define __PANEL_TYPEBUILTINS_H__ 1\n\n', + '--fhead', '#ifdef __cplusplus\nextern "C" {\n#endif\n\n', + '--ftail', '#ifdef __cplusplus\n}\n#endif\n\n', + '--ftail', '#endif /* __PANEL_TYPEBUILTINS_H__ */\n', + '--fprod', '\n/* --- @filename@ --- */', + '--eprod', '#define PANEL_TYPE_@ENUMSHORT@ @enum_name@_get_type()\n', + '--eprod', 'GType @enum_name@_get_type (void);\n', + '--output', '@OUTPUT@', + '@INPUT@', + ], +) + +# resources +panel_resource_deps = [ + 'panel-ditem-editor-dialog.ui', + 'panel-properties-dialog.ui', + 'panel-run-dialog.ui', + '../data/theme/mate-panel.css', + '../data/theme/panel-grid-symbolic.svg', +] + +panel_resources_c = custom_target('panel-resources.c', + input: 'panel.gresource.xml', + output: 'panel-resources.c', + depend_files: panel_resource_deps, + command: [ + glib_compile_resources, + '--target', '@OUTPUT@', + '--sourcedir', meson.current_source_dir(), + '--generate-source', + '--c-name', 'panel', + '@INPUT@', + ], +) + +panel_resources_h = custom_target('panel-resources.h', + input: 'panel.gresource.xml', + output: 'panel-resources.h', + depend_files: panel_resource_deps, + command: [ + glib_compile_resources, + '--target', '@OUTPUT@', + '--sourcedir', meson.current_source_dir(), + '--generate-header', + '--c-name', 'panel', + '@INPUT@', + ], +) + +panel_test_applets_resources_c = custom_target('panel-test-applets-resources.c', + input: 'panel-test-applets.gresource.xml', + output: 'panel-test-applets-resources.c', + command: [ + glib_compile_resources, + '--target', '@OUTPUT@', + '--sourcedir', meson.current_source_dir(), + '--generate-source', + '--c-name', 'panel', + '@INPUT@', + ], +) + +panel_test_applets_resources_h = custom_target('panel-test-applets-resources.h', + input: 'panel-test-applets.gresource.xml', + output: 'panel-test-applets-resources.h', + command: [ + glib_compile_resources, + '--target', '@OUTPUT@', + '--sourcedir', meson.current_source_dir(), + '--generate-header', + '--c-name', 'panel', + '@INPUT@', + ], +) + +# --- sub-libraries --- + +# libegg is built from the mate-submodules git submodule, whose working tree +# is not tracked by this repository. Build it directly from here so that a +# fresh checkout (with the submodule populated) needs no extra meson files. +libegg_sources = files( + 'mate-submodules/libegg/eggtreemultidnd.c', + 'mate-submodules/libegg/eggtreemultidnd.h', + 'mate-submodules/libegg/eggdesktopfile.c', + 'mate-submodules/libegg/eggdesktopfile.h', + 'mate-submodules/libegg/eggsmclient.c', + 'mate-submodules/libegg/eggsmclient.h', + 'mate-submodules/libegg/eggsmclient-private.h', + 'mate-submodules/libegg/eggsmclient-xsmp.c', +) + +libegg = static_library('egg', + libegg_sources, + dependencies: [ice_dep, sm_dep, gtk_dep, glib_dep], + c_args: [ + '-DEGG_SM_CLIENT_BACKEND_XSMP', + '-DG_LOG_DOMAIN="EggSMClient"', + ] + disable_deprecated_flags, +) + +subdir('libmate-panel-applet-private') +subdir('libpanel-util') + +# --- programs --- + +panel_common_cpp_args = [ + '-DMATELOCALEDIR="@0@"'.format(mate_panel_localedir), + '-DPANELDATADIR="@0@"'.format(mate_panel_pkgdatadir), + '-DPANEL_MODULES_DIR="@0@"'.format(mate_panel_modulesdir), +] + disable_deprecated_flags + +panel_common_inc_dirs = [ + mate_panel_inc, + libpanel_util_inc, + mate_submodules_inc, +] + +panel_common_deps = panel_deps + [dconf_dep] + +panel_sources = [ + panel_marshal, + panel_typebuiltins_c, + panel_typebuiltins_h, + panel_resources_c, + panel_resources_h, + 'main.c', + 'panel-widget.c', + 'button-widget.c', + 'panel-session.c', + 'panel.c', + 'applet.c', + 'drawer.c', + 'panel-config-global.c', + 'panel-util.c', + 'panel-properties-dialog.c', + 'panel-run-dialog.c', + 'menu.c', + 'panel-context-menu.c', + 'launcher.c', + 'panel-applet-frame.c', + 'panel-applets-manager.c', + 'panel-shell.c', + 'panel-background.c', + 'panel-stock-icons.c', + 'panel-action-button.c', + 'panel-menu-bar.c', + 'panel-menu-button.c', + 'panel-menu-items.c', + 'panel-separator.c', + 'panel-recent.c', + 'panel-toplevel.c', + 'panel-frame.c', + 'panel-multimonitor.c', + 'panel-a11y.c', + 'panel-bindings.c', + 'panel-layout.c', + 'panel-profile.c', + 'panel-lockdown.c', + 'panel-addto.c', + 'panel-ditem-editor.c', + 'panel-modules.c', + 'panel-applet-info.c', + 'panel-reset.c', + 'panel-types.h', + 'panel-widget.h', + 'panel-globals.h', + 'button-widget.h', + 'panel-session.h', + 'panel.h', + 'applet.h', + 'drawer.h', + 'drawer-private.h', + 'panel-util.h', + 'panel-properties-dialog.h', + 'panel-config-global.h', + 'panel-run-dialog.h', + 'menu.h', + 'panel-context-menu.h', + 'launcher.h', + 'panel-applet-frame.h', + 'panel-applets-manager.h', + 'panel-shell.h', + 'panel-background.h', + 'panel-stock-icons.h', + 'panel-action-button.h', + 'panel-menu-bar.h', + 'panel-menu-button.h', + 'panel-menu-items.h', + 'panel-separator.h', + 'panel-recent.h', + 'panel-toplevel.h', + 'panel-frame.h', + 'panel-multimonitor.h', + 'panel-a11y.h', + 'panel-bindings.h', + 'panel-layout.h', + 'panel-profile.h', + 'panel-enums-gsettings.h', + 'panel-enums.h', + 'panel-lockdown.h', + 'panel-addto.h', + 'panel-ditem-editor.h', + 'panel-icon-names.h', + 'panel-modules.h', + 'panel-applet-info.h', + 'panel-reset.h', + 'panel-schemas.h', +] + +if have_wayland + panel_sources += ['wayland-backend.c', 'wayland-backend.h'] +endif + +if have_x11 + panel_sources += [ + 'xstuff.c', + 'panel-xutils.c', + 'panel-force-quit.c', + 'panel-action-protocol.c', + 'panel-struts.c', + 'xstuff.h', + 'panel-xutils.h', + 'panel-force-quit.h', + 'panel-action-protocol.h', + 'panel-struts.h', + ] +endif + +mate_panel_deps = panel_common_deps + [randr_dep] +if have_x11 + mate_panel_deps += x11_dep +endif +if have_wayland + mate_panel_deps += wayland_deps +endif + +executable('mate-panel', + panel_sources, + include_directories: panel_common_inc_dirs, + dependencies: mate_panel_deps, + c_args: panel_common_cpp_args + ['-DMATEMENU_I_KNOW_THIS_IS_UNSTABLE'], + link_with: [libegg, libmate_panel_applet_private, libpanel_util], + export_dynamic: true, + install: true, +) + +mate_desktop_item_edit_sources = [ + 'mate-desktop-item-edit.c', + 'panel-ditem-editor.c', + panel_resources_c, + panel_resources_h, + panel_marshal, + 'panel-util.c', +] + +if have_x11 + mate_desktop_item_edit_sources += ['xstuff.c'] +endif + +mate_desktop_item_edit_deps = panel_common_deps +if have_x11 + mate_desktop_item_edit_deps += x11_dep +endif + +executable('mate-desktop-item-edit', + mate_desktop_item_edit_sources, + include_directories: panel_common_inc_dirs, + dependencies: mate_desktop_item_edit_deps, + c_args: panel_common_cpp_args, + link_with: libpanel_util, + export_dynamic: true, + install: true, +) + +mate_panel_test_applets_sources = [ + panel_marshal, + panel_test_applets_resources_c, + panel_test_applets_resources_h, + 'panel-modules.c', + 'panel-applet-info.c', + 'panel-applets-manager.c', + 'panel-test-applets.c', +] + +executable('mate-panel-test-applets', + mate_panel_test_applets_sources, + include_directories: panel_common_inc_dirs, + dependencies: panel_common_deps, + c_args: panel_common_cpp_args + [ + '-DMATE_PANEL_APPLETS_DIR="@0@"'.format(mate_panel_appletsdir), + ], + link_with: [libmate_panel_applet_private_mini, libpanel_util], + export_dynamic: true, + install: true, +) + +# desktop file +mate_panel_desktop = i18n.merge_file( + input: 'mate-panel.desktop.in', + output: 'mate-panel.desktop', + type: 'desktop', + po_dir: '../po', + install: true, + install_dir: join_paths(mate_panel_datadir, 'applications'), +) diff --git a/mate-panel/panel-widget.c b/mate-panel/panel-widget.c index 57972e7c..6b52b99a 100644 --- a/mate-panel/panel-widget.c +++ b/mate-panel/panel-widget.c @@ -612,38 +612,6 @@ get_applet_list_pos (PanelWidget *panel, return NULL; } -/*tells us if an applet is "stuck" on the right side*/ -int -panel_widget_is_applet_stuck (PanelWidget *panel_widget, - GtkWidget *widget) -{ - AppletData *applet; - - g_return_val_if_fail (PANEL_IS_WIDGET (panel_widget), FALSE); - g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE); - - applet = g_object_get_data (G_OBJECT (widget), MATE_PANEL_APPLET_DATA); - if (applet) { - GList *applet_list, *l; - int end_pos = -1; - - applet_list = g_list_find (panel_widget->applet_list, applet); - - for (l = applet_list; l; l = l->next) { - applet = l->data; - - if (end_pos != -1 && applet->pos != end_pos) - break; - - end_pos = applet->pos + applet->cells; - if (end_pos >= panel_widget->size) - return TRUE; - } - } - - return FALSE; -} - static int get_size_from_hints (AppletData *ad, int cells) { @@ -1075,46 +1043,6 @@ panel_widget_push_move (PanelWidget *panel, } } -/*this is a special function and may fail if called improperly, it works -only under special circumstance when we know there is nothing from -old_size to panel->size*/ -static void -panel_widget_right_stick(PanelWidget *panel,int old_size) -{ - int i,pos; - GList *list,*prev; - AppletData *ad; - - g_return_if_fail(PANEL_IS_WIDGET(panel)); - g_return_if_fail(old_size>=0); - - if(old_size>=panel->size || - panel->packed) - return; - - list = get_applet_list_pos(panel,old_size-1); - - if(!list) - return; - - pos = panel->size-1; - - ad = list->data; - do { - i = ad->pos; - ad->pos = ad->constrained = pos--; - ad->cells = 1; - prev = list; - list = g_list_previous(list); - if(!list) - break; - ad = list->data; - } while(ad->pos + ad->cells == i); - - for (list = prev; list; list = list->next) - emit_applet_moved (panel, list->data); -} - /* data should be freed with g_list_free() */ static GList * get_applet_list_pack (PanelWidget *panel, diff --git a/mate-panel/panel-widget.h b/mate-panel/panel-widget.h index 29e6dc14..1e27daee 100644 --- a/mate-panel/panel-widget.h +++ b/mate-panel/panel-widget.h @@ -194,9 +194,6 @@ void panel_widget_draw_all (PanelWidget *panel, void panel_widget_draw_icon (PanelWidget *panel, ButtonWidget *applet); -/*tells us if an applet is "stuck" on the right side*/ -int panel_widget_is_applet_stuck (PanelWidget *panel, - GtkWidget *applet); /*get pos of the cursor location in panel coordinates*/ int panel_widget_get_cursorloc (PanelWidget *panel); diff --git a/mate-panel/panel.c b/mate-panel/panel.c index 065d2090..b720aeb6 100644 --- a/mate-panel/panel.c +++ b/mate-panel/panel.c @@ -1401,26 +1401,6 @@ panel_screen_from_panel_widget (PanelWidget *panel) return gtk_window_get_screen (GTK_WINDOW (panel->toplevel)); } -gboolean -panel_is_applet_right_stick (GtkWidget *applet) -{ - GtkWidget *parent; - PanelWidget *panel_widget; - - g_return_val_if_fail (GTK_IS_WIDGET (applet), FALSE); - - parent = gtk_widget_get_parent (applet); - - g_return_val_if_fail (PANEL_IS_WIDGET (parent), FALSE); - - panel_widget = PANEL_WIDGET (parent); - - if (!panel_toplevel_get_expand (panel_widget->toplevel)) - return FALSE; - - return panel_widget_is_applet_stuck (panel_widget, applet); -} - static void panel_delete_without_query (PanelToplevel *toplevel) { diff --git a/mate-panel/panel.h b/mate-panel/panel.h index bf1517ec..aafddb4a 100644 --- a/mate-panel/panel.h +++ b/mate-panel/panel.h @@ -26,7 +26,7 @@ PanelData *panel_setup (PanelToplevel *toplevel); GdkScreen *panel_screen_from_panel_widget (PanelWidget *panel); -gboolean panel_is_applet_right_stick (GtkWidget *applet); + gboolean panel_check_dnd_target_data (GtkWidget *widget, GdkDragContext *context, diff --git a/meson.build b/meson.build new file mode 100644 index 00000000..64c09ab7 --- /dev/null +++ b/meson.build @@ -0,0 +1,325 @@ +project( + 'mate-panel', + 'c', + version: '1.29.0', + meson_version: '>= 0.56.0', + license: ['GPL-2', 'LGPL-2', 'FDL-1.1'], +) + +# Before making a release, the LT_VERSION string should be modified. +# The string is of the form C:R:A. +# - If interfaces have been changed or added, but binary compatibility has +# been preserved, change to C+1:0:A+1 +# - If binary compatibility has been broken (eg removed or changed interfaces) +# change to C+1:0:0 +# - If the interface is the same as the previous version, change to C:R+1:A +libmate_panel_applet_current = 2 +libmate_panel_applet_revision = 0 +libmate_panel_applet_age = 0 + +mate_panel_version = meson.project_version() +version_array = mate_panel_version.split('.') +mate_panel_major_version = version_array[0].to_int() +mate_panel_minor_version = version_array[1].to_int() +mate_panel_micro_version = version_array[2].to_int() + +mate_panel_api_version = '4.0' +mate_panel_api_name = 'libmate-panel-applet-@0@'.format(mate_panel_api_version) + +mate_panel_gir_ns = 'MatePanelApplet' +mate_panel_gir_version = mate_panel_api_version + +mate_panel_gettext_package = meson.project_name() + +mate_panel_prefix = get_option('prefix') +mate_panel_bindir = join_paths(mate_panel_prefix, get_option('bindir')) +mate_panel_datadir = join_paths(mate_panel_prefix, get_option('datadir')) +mate_panel_includedir = join_paths(mate_panel_prefix, get_option('includedir')) +mate_panel_libdir = join_paths(mate_panel_prefix, get_option('libdir')) +mate_panel_libexecdir = join_paths(mate_panel_prefix, get_option('libexecdir')) +mate_panel_localedir = join_paths(mate_panel_prefix, get_option('localedir')) +mate_panel_pkgdatadir = join_paths(mate_panel_datadir, 'mate-panel') +mate_panel_pkglibdir = join_paths(mate_panel_libdir, 'mate-panel') +mate_panel_modulesdir = join_paths(mate_panel_libdir, 'mate-panel', 'modules') +mate_panel_appletsdir = join_paths(mate_panel_datadir, 'mate-panel', 'applets') +mate_panel_layoutsdir = join_paths(mate_panel_pkgdatadir, 'layouts') +mate_panel_schemadir = join_paths(mate_panel_datadir, 'glib-2.0', 'schemas') + +cc = meson.get_compiler('c') + +# options +enable_deprecation_flags = get_option('enable-deprecation-flags') +enable_introspection = get_option('introspection') +enable_gtk_doc = get_option('gtk-doc') +enable_help = get_option('help') +enable_compile_warnings = get_option('compile-warnings') + +config_h = configuration_data() +config_h.set_quoted('GETTEXT_PACKAGE', mate_panel_gettext_package) +config_h.set_quoted('PACKAGE', meson.project_name()) +config_h.set_quoted('PACKAGE_NAME', meson.project_name()) +config_h.set_quoted('PACKAGE_STRING', '@0@ @1@'.format(meson.project_name(), mate_panel_version)) +config_h.set_quoted('PACKAGE_TARNAME', meson.project_name()) +config_h.set_quoted('PACKAGE_URL', 'https://mate-desktop.org') +config_h.set_quoted('PACKAGE_BUGREPORT', 'https://github.com/mate-desktop/mate-panel/issues') +config_h.set_quoted('PACKAGE_VERSION', mate_panel_version) +config_h.set_quoted('VERSION', mate_panel_version) +config_h.set_quoted('MATELOCALEDIR', mate_panel_localedir) +config_h.set_quoted('DATADIR', mate_panel_datadir) +config_h.set_quoted('PANELDATADIR', mate_panel_pkgdatadir) +config_h.set_quoted('PANEL_MODULES_DIR', mate_panel_modulesdir) +config_h.set_quoted('MATE_PANEL_APPLETS_DIR', mate_panel_appletsdir) +config_h.set('ENABLE_NLS', 1) + +# standard headers +foreach header : [ + 'dirent.h', + 'dlfcn.h', + 'inttypes.h', + 'langinfo.h', + 'stdint.h', + 'stdio.h', + 'stdlib.h', + 'strings.h', + 'string.h', + 'sys/stat.h', + 'sys/types.h', + 'unistd.h', + ] + if cc.has_header(header) + config_h.set('HAVE_' + header.underscorify().to_upper(), 1) + endif +endforeach +config_h.set('HAVE_NL_LANGINFO', cc.has_function('nl_langinfo')) +config_h.set('STDC_HEADERS', 1) +config_h.set('HAVE_STRUCT_DIRENT_D_TYPE', + cc.has_member('struct dirent', 'd_type', prefix: '#include <dirent.h>')) + +if get_option('enable-debug').enabled() + config_h.set('MATE_ENABLE_DEBUG', 1) +else + config_h.set('NDEBUG', 1) +endif + +# compile warnings +warning_flags = [] +if enable_compile_warnings == 'no' + warning_flags = [] +elif enable_compile_warnings == 'minimum' + warning_flags = ['-Wall'] +elif enable_compile_warnings == 'yes' + warning_flags = ['-Wall', '-Wmissing-prototypes'] +elif enable_compile_warnings == 'maximum' or enable_compile_warnings == 'error' + warning_flags = [ + '-Wall', + '-Wmissing-prototypes', + '-Wbad-function-cast', + '-Wcast-align', + '-Wextra', + '-Wno-unused-parameter', + '-Wformat-nonliteral', + '-Wmissing-declarations', + '-Wmissing-field-initializers', + '-Wnested-externs', + '-Wpointer-arith', + '-Wredundant-decls', + '-Wshadow', + '-Wstrict-prototypes', + '-Werror=format-security', + ] + if enable_compile_warnings == 'error' + warning_flags += ['-Werror'] + endif +endif + +foreach flag : warning_flags + if cc.has_argument(flag) + add_project_arguments(flag, language: 'c') + endif +endforeach + +# *_DISABLE_DEPRECATED flags +disable_deprecated_flags = [] +if enable_deprecation_flags + disable_deprecated_flags = [ + '-DG_DISABLE_DEPRECATED', + '-DG_DISABLE_SINGLE_INCLUDES', + '-DATK_DISABLE_DEPRECATED', + '-DATK_DISABLE_SINGLE_INCLUDES', + '-DPANGO_DISABLE_DEPRECATED', + '-DPANGO_DISABLE_SINGLE_INCLUDES', + '-DGDK_DISABLE_DEPRECATED', + '-DGDK_DISABLE_SINGLE_INCLUDES', + '-DGDK_PIXBUF_DISABLE_DEPRECATED', + '-DGDK_PIXBUF_DISABLE_SINGLE_INCLUDES', + '-DGTK_DISABLE_DEPRECATED', + '-DGTK_DISABLE_SINGLE_INCLUDES', + '-DMATE_DISABLE_DEPRECATED', + '-DMATE_DISABLE_SINGLE_INCLUDES', + '-DLIBGLADE_DISABLE_DEPRECATED', + '-DLIBGLADE_DISABLE_SINGLE_INCLUDES', + '-DVTE_DISABLE_DEPRECATED', + '-DVTE_DISABLE_SINGLE_INCLUDES', + '-DWNCK_DISABLE_DEPRECATED', + '-DWNCK_DISABLE_SINGLE_INCLUDES', + '-DLIBSOUP_DISABLE_DEPRECATED', + '-DLIBSOUP_DISABLE_SINGLE_INCLUDES', + ] +endif + +add_project_arguments( + '-DHAVE_CONFIG_H', + '-I' + meson.current_build_dir(), + language: 'c', +) + +# dependencies +glib_dep = dependency('glib-2.0', version: '>= 2.50.0') +gio_dep = dependency('gio-2.0', version: '>= 2.50.0') +gio_unix_dep = dependency('gio-unix-2.0', version: '>= 2.50.0') +gdk_pixbuf_dep = dependency('gdk-pixbuf-2.0', version: '>= 2.26.0') +pango_dep = dependency('pango', version: '>= 1.15.4') +gtk_dep = dependency('gtk+-3.0', version: '>= 3.24.0') +cairo_dep = dependency('cairo', version: '>= 1.0.0') +mate_desktop_dep = dependency('mate-desktop-2.0', version: '>= 1.28.2') +mate_menu_dep = dependency('libmate-menu', version: '>= 1.21.0') +dconf_dep = dependency('dconf', version: '>= 0.13.4') +wnck_dep = dependency('libwnck-3.0', version: '>= 43.0') +mateweather_dep = dependency('mateweather', version: '>= 1.17.0') +gmodule_dep = dependency('gmodule-2.0', required: false) +ice_dep = dependency('ice') +sm_dep = dependency('sm') +m_dep = cc.find_library('m', required: false) + +# X11 support +x11_opt = get_option('enable-x11') +x11_dep = dependency('x11', required: x11_opt) +have_x11 = x11_dep.found() +config_h.set('HAVE_X11', have_x11) + +# Wayland support +wayland_opt = get_option('enable-wayland') +wayland_deps = [ + dependency('gtk-layer-shell-0', required: wayland_opt), + dependency('wayland-client', required: wayland_opt), +] +have_wayland = wayland_deps[0].found() and wayland_deps[1].found() +if have_wayland + xfw_dep = dependency('libxfce4windowing-0', version: '>= 4.19.4', required: false) + if not xfw_dep.found() + if wayland_opt.enabled() + error('Wayland support requires libxfce4windowing-0 >= 4.19.4') + else + have_wayland = false + endif + endif +endif +config_h.set('HAVE_WAYLAND', have_wayland) + +if not have_x11 and not have_wayland + if wayland_opt.disabled() and x11_opt.disabled() + error('At least one backend must be enabled') + else + error('No usable backend found, install X11 or Wayland development libraries') + endif +endif + +# XRandR extension +randr_dep = dependency('xrandr', version: '>= 1.3.0', required: false) +have_randr = randr_dep.found() +config_h.set('HAVE_RANDR', have_randr) + +# Evolution Data Server support for calendar integration +eds_opt = get_option('enable-eds') +eds_deps = [ + dependency('libecal-2.0', version: '>= 3.33.2', required: eds_opt), + dependency('libedataserver-1.2', version: '>= 3.5.3', required: eds_opt), +] +have_eds = eds_deps[0].found() and eds_deps[1].found() +config_h.set('HAVE_EDS', have_eds) + +# applets to compile in-process +in_process_applets = get_option('in-process-applets') +clock_inprocess = false +fish_inprocess = false +notification_area_inprocess = false +wncklet_inprocess = false +if 'none' in in_process_applets + in_process_applets = [] +endif +if 'all' in in_process_applets + in_process_applets = ['clock', 'fish', 'notification-area', 'wncklet'] +endif +foreach applet : in_process_applets + if applet == 'clock' + clock_inprocess = true + config_h.set('CLOCK_INPROCESS', 1) + elif applet == 'fish' + fish_inprocess = true + config_h.set('FISH_INPROCESS', 1) + elif applet == 'notification-area' + notification_area_inprocess = true + config_h.set('NOTIFICATION_AREA_INPROCESS', 1) + elif applet == 'wncklet' + wncklet_inprocess = true + config_h.set('WNCKLET_INPROCESS', 1) + else + error('applet @0@ not recognized'.format(applet)) + endif +endforeach + +panel_deps = [ + gmodule_dep, + gdk_pixbuf_dep, + pango_dep, + gtk_dep, + glib_dep, + gio_unix_dep, + mate_desktop_dep, + gio_dep, + mate_menu_dep, +] + +libmate_panel_applet_deps = [ + gtk_dep, + gio_dep, + gio_unix_dep, +] + +# top-level include dirs +panel_inc = include_directories('.') + +subdir('po') +subdir('data') +subdir('icons') +subdir('man') +subdir('libmate-panel-applet') +subdir('mate-panel') +subdir('applets') + +gtk_doc_dep = dependency('gtk-doc', required: enable_gtk_doc) +if gtk_doc_dep.found() + subdir('doc') +endif + +itstool = find_program('itstool', required: enable_help) +if enable_help.allowed() and itstool.found() + subdir('help') +endif + +configure_file( + output: 'config.h', + configuration: config_h, +) + +summary({ + 'Maintainer mode': false, + 'Use *_DISABLE_DEPRECATED': enable_deprecation_flags, + 'Applets to build in-process': in_process_applets.length() > 0 ? in_process_applets : ['(none)'], + 'Wayland support': have_wayland, + 'X11 support': have_x11, + 'XRandr support': have_randr, + 'Evolution Data Server support': have_eds, + 'Build introspection support': enable_introspection, + 'Build gtk-doc documentation': enable_gtk_doc, +}, section: 'mate-panel') diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 00000000..af77de81 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,60 @@ +option('enable-deprecation-flags', + type: 'boolean', + value: false, + description: 'use *_DISABLE_DEPRECATED flags' +) + +option('enable-eds', + type: 'feature', + value: 'auto', + description: 'Enable Evolution Data Server calendar integration' +) + +option('enable-x11', + type: 'feature', + value: 'auto', + description: 'Explicitly enable or disable X11 support' +) + +option('enable-wayland', + type: 'feature', + value: 'auto', + description: 'Explicitly enable or disable Wayland support' +) + +option('in-process-applets', + type: 'array', + value: ['none'], + description: 'list of applets to compile in-process (none, clock, fish, notification-area, wncklet, all)' +) + +option('introspection', + type: 'feature', + value: 'auto', + description: 'Enable introspection for this build' +) + +option('gtk-doc', + type: 'feature', + value: 'auto', + description: 'use gtk-doc to build documentation' +) + +option('help', + type: 'feature', + value: 'auto', + description: 'build the user help documentation' +) + +option('enable-debug', + type: 'feature', + value: 'disabled', + description: 'turn on debugging' +) + +option('compile-warnings', + type: 'combo', + value: 'yes', + choices: ['no', 'minimum', 'yes', 'maximum', 'error'], + description: 'Turn on compiler warnings' +) diff --git a/po/meson.build b/po/meson.build new file mode 100644 index 00000000..57ed553d --- /dev/null +++ b/po/meson.build @@ -0,0 +1,6 @@ +i18n = import('i18n') + +i18n.gettext( + mate_panel_gettext_package, + preset: 'glib', +) |
