refacor media widget, apply clang format rule
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
#include "widgets/tray.hpp"
|
||||
|
||||
#include <cmath>
|
||||
#include <gdkmm/rectangle.h>
|
||||
#include <gio/gmenu.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <cmath>
|
||||
#include <graphene.h>
|
||||
#include <utility>
|
||||
#include <gtk/gtk.h>
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <utility>
|
||||
|
||||
namespace {
|
||||
bool is_wayland_display(GtkWidget *widget) {
|
||||
@@ -182,7 +182,7 @@ void log_menu_tree(const std::vector<TrayService::MenuNode> &nodes,
|
||||
} // namespace
|
||||
|
||||
TrayIconWidget::TrayIconWidget(Icon::Type icon, std::string id) : IconButton(icon), id(std::move(id)),
|
||||
container(Gtk::Orientation::HORIZONTAL) {
|
||||
container(Gtk::Orientation::HORIZONTAL) {
|
||||
aliveFlag = std::make_shared<bool>(true);
|
||||
set_has_frame(false);
|
||||
set_focusable(false);
|
||||
@@ -243,8 +243,8 @@ TrayIconWidget::~TrayIconWidget() {
|
||||
}
|
||||
|
||||
void TrayIconWidget::update(const TrayService::Item &item) {
|
||||
hasRemoteMenu = item.menuAvailable;
|
||||
menuPopupPending = false;
|
||||
hasRemoteMenu = item.menuAvailable;
|
||||
menuPopupPending = false;
|
||||
menuRequestInFlight = false;
|
||||
|
||||
if (!item.menuAvailable) {
|
||||
@@ -350,7 +350,7 @@ void TrayIconWidget::on_secondary_released(int /*n_press*/, double x,
|
||||
}
|
||||
|
||||
menuRequestInFlight = true;
|
||||
auto weak = std::weak_ptr<bool>(aliveFlag);
|
||||
auto weak = std::weak_ptr<bool>(aliveFlag);
|
||||
service.request_menu_layout(
|
||||
id, [weak, this](std::optional<TrayService::MenuNode> layout) {
|
||||
if (auto locked = weak.lock()) {
|
||||
@@ -402,8 +402,8 @@ void TrayIconWidget::on_menu_layout_ready(
|
||||
|
||||
const auto &layout = *layoutOpt;
|
||||
log_menu_tree(layout.children, 0);
|
||||
auto menu = Gio::Menu::create();
|
||||
auto actions = Gio::SimpleActionGroup::create();
|
||||
auto menu = Gio::Menu::create();
|
||||
auto actions = Gio::SimpleActionGroup::create();
|
||||
|
||||
populate_menu_items(layout.children, menu, actions);
|
||||
|
||||
@@ -529,8 +529,8 @@ void TrayIconWidget::on_menu_action(const Glib::VariantBase & /*parameter*/,
|
||||
}
|
||||
|
||||
bool TrayIconWidget::try_get_pending_coords(int32_t &outX, int32_t &outY) const {
|
||||
outX = -1;
|
||||
outY = -1;
|
||||
outX = -1;
|
||||
outY = -1;
|
||||
int32_t sendX = static_cast<int32_t>(std::lround(pendingX));
|
||||
int32_t sendY = static_cast<int32_t>(std::lround(pendingY));
|
||||
if (!try_get_global_click_coords(GTK_WIDGET(gobj()), pendingX, pendingY,
|
||||
|
||||
Reference in New Issue
Block a user