Skip to content
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
4 changes: 4 additions & 0 deletions metadata/panel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,10 @@ If full_span is off, both sides of the panel will take the same amount of space,
<value>show_quick_target</value>
<_name>Show quick action target</_name>
</desc>
<desc>
<value>mute_quick_target</value>
<_name>Mute quick action target</_name>
</desc>
</option>
<option name="mixer_middle_click_action" type="string">
<_short>Middle click action</_short>
Expand Down
2 changes: 1 addition & 1 deletion src/panel/widgets/launchers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <glibmm/spawn.h>
#include <glibmm/keyfile.h>
#include <gtkmm/icontheme.h>
#include "gtkmm/gestureclick.h"
#include <gtkmm/gestureclick.h>
#include <gdk/gdkcairo.h>
#include <cassert>
#include <gtk-utils.hpp>
Expand Down
21 changes: 11 additions & 10 deletions src/panel/widgets/mixer/mixer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,22 @@ void WayfireMixer::reload_config()
// "actions" that can be bound to different clicks
auto show_mixer_action = [&] (int c, double x, double y)
{
if (button->get_popup_child() != (Gtk::Widget*)&master_box)
if ((button->get_popup_child() == &master_box) && button->is_popup_visible())
{
button->popdown();
return;
}

button->popup();

if (button->get_popup_child() != &master_box)
{
button->set_popup_child(master_box);
}
};

auto show_quick_target_action = [&] (int c, double x, double y)
{
// unschedule hiding
if (!quick_target)
{
return; // no quick_target means we have nothing to show
Expand All @@ -70,10 +77,7 @@ void WayfireMixer::reload_config()
return;
}

if (!button->is_popup_visible())
{
button->popup();
}
button->popup();

if (button->get_popup_child() != quick_target.get())
{
Expand All @@ -93,7 +97,6 @@ void WayfireMixer::reload_config()

if (str_wp_left_click_action.value() == "show_mixer")
{
button->open_on(1);
left_conn = left_click_gesture->signal_released().connect(show_mixer_action);
}

Expand All @@ -109,7 +112,6 @@ void WayfireMixer::reload_config()

if (str_wp_middle_click_action.value() == "show_mixer")
{
button->open_on(3);
middle_conn = middle_click_gesture->signal_released().connect(show_mixer_action);
}

Expand All @@ -125,7 +127,6 @@ void WayfireMixer::reload_config()

if (str_wp_right_click_action.value() == "show_mixer")
{
button->open_on(2);
right_conn = right_click_gesture->signal_released().connect(show_mixer_action);
}

Expand Down Expand Up @@ -161,7 +162,7 @@ void WayfireMixer::init(Gtk::Box *container)
button->add_css_class("widget-icon");
button->append(main_image);
button->show();
button->open_on(1);
button->open_on(-1); // the gestures callback will take care of opening and closing
sinks_box.add_css_class("outputs");
sources_box.add_css_class("inputs");
streams_box.add_css_class("streams");
Expand Down
4 changes: 1 addition & 3 deletions src/panel/widgets/volume.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#include <gtkmm.h>
#include <glibmm.h>

#include "volume.hpp"
#include "glib.h"
#include "glibmm/main.h"
#include "gtkmm/gesture.h"
#include "icon-select.hpp"
#include "wf-popover.hpp"

Expand Down
2 changes: 0 additions & 2 deletions src/panel/widgets/window-list/toplevel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
#include <sys/mman.h>

#include "toplevel.hpp"
#include "gtkmm/enums.h"
#include "gtkmm/gesture.h"
#include "window-list.hpp"
#include "gtk-utils.hpp"

Expand Down
23 changes: 11 additions & 12 deletions src/util/wf-popover.cpp
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
#include "wf-popover.hpp"
#include "giomm/menumodel.h"
#include "glib.h"
#include "glibmm.h"
#include "glibmm/main.h"
#include "gtk/gtk.h"
#include "gtkmm/eventcontrollermotion.h"
#include "gtkmm/gestureclick.h"
#include "gtkmm/widget.h"
#include "wf-autohide-window.hpp"
#include <cstddef>
#include <cstdio>
#include <iostream>
#include <memory>
#include <gtk4-layer-shell.h>

#include "wf-popover.hpp"
#include "wf-autohide-window.hpp"

/* Helper to get panel from button. NULL if not added to one */
WayfireAutohidingWindow *get_panel(Gtk::Widget *button)
{
Expand Down Expand Up @@ -299,7 +291,14 @@ void WayfireMenuWidget::set_popup_child(Gtk::Widget & widget)

Gtk::Widget*WayfireMenuWidget::get_popup_child()
{
return popover.get_child();
auto child = scroll.get_child();
// the scrollable window wraps the child given to it in a viewport if it is not scrollable
if (auto *viewport = dynamic_cast<Gtk::Viewport*>(child))
{
return viewport->get_child();
}

return child;
}

void WayfireMenuWidget::toggle()
Expand Down
13 changes: 4 additions & 9 deletions src/util/wf-popover.hpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
#pragma once

#include "giomm/menumodel.h"
#include "glibmm/refptr.h"
#include "gtkmm/gestureclick.h"
#include "gtkmm/scrolledwindow.h"
#include <gtkmm/widget.h>
#include <glibmm.h>
#include <giomm.h>
#include <gtkmm.h>

#include <sigc++/connection.h>
#include <sigc++/signal.h>
#include <gtkmm/box.h>
#include <gtkmm/popover.h>
#include <gtkmm/popovermenu.h>
#include <memory>
#include <vector>
#include <wf-option-wrap.hpp>

Expand Down
Loading