Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require gtk-layer-shell #2836

Merged
merged 5 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 8 additions & 21 deletions include/bar.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,34 +53,18 @@
}
#endif // HAVE_SWAY

class BarSurface {
protected:
BarSurface() = default;

public:
virtual void setExclusiveZone(bool enable) = 0;
virtual void setLayer(bar_layer layer) = 0;
virtual void setMargins(const struct bar_margins &margins) = 0;
virtual void setPassThrough(bool enable) = 0;
virtual void setPosition(Gtk::PositionType position) = 0;
virtual void setSize(uint32_t width, uint32_t height) = 0;
virtual void commit(){};

virtual ~BarSurface() = default;
};

class Bar {
public:
using bar_mode_map = std::map<std::string_view, struct bar_mode>;
using bar_mode_map = std::map<std::string, struct bar_mode>;
static const bar_mode_map PRESET_MODES;
static const std::string_view MODE_DEFAULT;
static const std::string_view MODE_INVISIBLE;
static const std::string MODE_DEFAULT;
static const std::string MODE_INVISIBLE;

Bar(struct waybar_output *w_output, const Json::Value &);
Bar(const Bar &) = delete;
~Bar();

void setMode(const std::string_view &);
void setMode(const std::string &mode);
void setVisible(bool visible);
void toggle();
void handleSignal(int);
Expand All @@ -107,6 +91,8 @@
void setupAltFormatKeyForModule(const std::string &module_name);
void setupAltFormatKeyForModuleList(const char *module_list_name);
void setMode(const bar_mode &);
void setPassThrough(bool passthrough);
void setPosition(Gtk::PositionType position);
void onConfigure(GdkEventConfigure *ev);
void configureGlobalOffset(int width, int height);
void onOutputGeometryChanged();
Expand All @@ -116,8 +102,9 @@
std::string last_mode_{MODE_DEFAULT};

struct bar_margins margins_;
uint32_t width_, height_;

Check warning on line 105 in include/bar.hpp

View workflow job for this annotation

GitHub Actions / build

include/bar.hpp:105:12 [readability-identifier-naming]

invalid case style for private member 'width_'

Check warning on line 105 in include/bar.hpp

View workflow job for this annotation

GitHub Actions / build

include/bar.hpp:105:20 [readability-identifier-naming]

invalid case style for private member 'height_'
bool passthrough_;

Check warning on line 106 in include/bar.hpp

View workflow job for this annotation

GitHub Actions / build

include/bar.hpp:106:8 [readability-identifier-naming]

invalid case style for private member 'passthrough_'

std::unique_ptr<BarSurface> surface_impl_;
Gtk::Box left_;
Gtk::Box center_;
Gtk::Box right_;
Expand Down
2 changes: 0 additions & 2 deletions include/client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "util/css_reload_helper.hpp"
#include "util/portal.hpp"

struct zwlr_layer_shell_v1;
struct zwp_idle_inhibitor_v1;
struct zwp_idle_inhibit_manager_v1;

Expand All @@ -26,7 +25,6 @@ class Client {
Glib::RefPtr<Gdk::Display> gdk_display;
struct wl_display *wl_display = nullptr;
struct wl_registry *registry = nullptr;
struct zwlr_layer_shell_v1 *layer_shell = nullptr;
struct zxdg_output_manager_v1 *xdg_output_manager = nullptr;
struct zwp_idle_inhibit_manager_v1 *idle_inhibit_manager = nullptr;
std::vector<std::unique_ptr<Bar>> bars;
Expand Down
6 changes: 0 additions & 6 deletions man/waybar.5.scd.in
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,6 @@ Also, a minimal example configuration can be found at the bottom of this man pag
Option to pass any pointer events to the window under the bar.
Intended to be used with either *top* or *overlay* layers and without exclusive zone.

*gtk-layer-shell* ++
typeof: bool ++
default: true ++
Option to disable the use of gtk-layer-shell for popups.
Only functional if compiled with gtk-layer-shell support.

*ipc* ++
typeof: bool ++
default: false ++
Expand Down
10 changes: 3 additions & 7 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ if libsndio.found()
endif
endif

gtk_layer_shell = dependency('gtk-layer-shell-0',
required: get_option('gtk-layer-shell'),
fallback : ['gtk-layer-shell', 'gtk_layer_shell_dep'])
gtk_layer_shell = dependency('gtk-layer-shell-0', version: ['>=0.6.0'],
default_options: ['introspection=false', 'vapi=false'],
fallback: ['gtk-layer-shell', 'gtk_layer_shell'])
systemd = dependency('systemd', required: get_option('systemd'))

cpp_lib_chrono = compiler.compute_int('__cpp_lib_chrono', prefix : '#include <chrono>')
Expand Down Expand Up @@ -353,10 +353,6 @@ if libmpdclient.found()
src_files += 'src/modules/mpd/state.cpp'
endif

if gtk_layer_shell.found()
add_project_arguments('-DHAVE_GTK_LAYER_SHELL', language: 'cpp')
endif

if libsndio.found()
add_project_arguments('-DHAVE_LIBSNDIO', language: 'cpp')
src_files += 'src/modules/sndio.cpp'
Expand Down
1 change: 0 additions & 1 deletion meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ option('systemd', type: 'feature', value: 'auto', description: 'Install systemd
option('dbusmenu-gtk', type: 'feature', value: 'auto', description: 'Enable support for tray')
option('man-pages', type: 'feature', value: 'auto', description: 'Generate and install man pages')
option('mpd', type: 'feature', value: 'auto', description: 'Enable support for the Music Player Daemon')
option('gtk-layer-shell', type: 'feature', value: 'auto', description: 'Use gtk-layer-shell library for popups support')
option('rfkill', type: 'feature', value: 'auto', description: 'Enable support for RFKILL')
option('sndio', type: 'feature', value: 'auto', description: 'Enable support for sndio')
option('logind', type: 'feature', value: 'auto', description: 'Enable support for logind')
Expand Down
1 change: 0 additions & 1 deletion protocol/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ client_protocols = [
[wl_protocol_dir, 'stable/xdg-shell/xdg-shell.xml'],
[wl_protocol_dir, 'unstable/xdg-output/xdg-output-unstable-v1.xml'],
[wl_protocol_dir, 'unstable/idle-inhibit/idle-inhibit-unstable-v1.xml'],
['wlr-layer-shell-unstable-v1.xml'],
['wlr-foreign-toplevel-management-unstable-v1.xml'],
['ext-workspace-unstable-v1.xml'],
['river-status-unstable-v1.xml'],
Expand Down
Loading
Loading