Skip to content

Commit 787bdaf

Browse files
committed
reverted changes made by uncrustify on some comments
1 parent cda1e4c commit 787bdaf

31 files changed

+789
-729
lines changed

meson_options.txt

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,2 @@
1-
option(
2-
'pulse',
3-
type: 'feature',
4-
value: 'auto',
5-
description: 'Build pulseaudio volume widget',
6-
)
7-
option(
8-
'wayland-logout',
9-
type: 'boolean',
10-
value: true,
11-
description: 'Install wayland-logout',
12-
)
1+
option('pulse', type: 'feature', value: 'auto', description: 'Build pulseaudio volume widget')
2+
option('wayland-logout', type: 'boolean', value: 'true', description: 'Install wayland-logout')

src/dock/toplevel-icon.cpp

Lines changed: 36 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#include <giomm/desktopappinfo.h>
22
#include <gtkmm/button.h>
3-
#include <gtkmm/box.h>
3+
#include <gtkmm/hvbox.h>
44
#include <gtkmm/icontheme.h>
55
#include <gtkmm/image.h>
66

77
#include <gdkmm/display.h>
88
#include <gdkmm/seat.h>
9-
#include <gdk/wayland/gdkwayland.h>
9+
#include <gdk/gdkwayland.h>
1010

1111
#include "dock.hpp"
1212
#include "toplevel.hpp"
@@ -29,7 +29,6 @@ class WfToplevelIcon::impl
2929
wl_output *output;
3030

3131
uint32_t state;
32-
bool closing = false;
3332

3433
Gtk::Button button;
3534
Gtk::Image image;
@@ -42,13 +41,17 @@ class WfToplevelIcon::impl
4241
this->handle = handle;
4342
this->output = output;
4443

45-
button.set_child(image);
44+
button.add(image);
4645
button.set_tooltip_text("none");
4746
button.get_style_context()->add_class("flat");
48-
button.get_style_context()->add_class("toplevel-icon");
47+
button.show_all();
4948

50-
button.signal_clicked().connect(
51-
sigc::mem_fun(*this, &WfToplevelIcon::impl::on_clicked));
49+
button.signal_clicked().connect_notify(
50+
sigc::mem_fun(this, &WfToplevelIcon::impl::on_clicked));
51+
button.signal_size_allocate().connect_notify(
52+
sigc::mem_fun(this, &WfToplevelIcon::impl::on_allocation_changed));
53+
button.property_scale_factor().signal_changed()
54+
.connect(sigc::mem_fun(this, &WfToplevelIcon::impl::on_scale_update));
5255

5356
auto dock = WfDockApp::get().dock_for_wl_output(output);
5457
assert(dock); // ToplevelIcon is created only for existing outputs
@@ -57,11 +60,6 @@ class WfToplevelIcon::impl
5760

5861
void on_clicked()
5962
{
60-
if (closing)
61-
{
62-
return;
63-
}
64-
6563
if (!(state & WF_TOPLEVEL_STATE_ACTIVATED))
6664
{
6765
auto gseat = Gdk::Display::get_default()->get_default_seat();
@@ -80,13 +78,18 @@ class WfToplevelIcon::impl
8078
}
8179
}
8280

83-
void set_app_id(std::string app_id)
81+
void on_allocation_changed(Gtk::Allocation& alloc)
8482
{
85-
if (closing)
86-
{
87-
return;
88-
}
83+
send_rectangle_hint();
84+
}
85+
86+
void on_scale_update()
87+
{
88+
set_app_id(app_id);
89+
}
8990

91+
void set_app_id(std::string app_id)
92+
{
9093
this->app_id = app_id;
9194
IconProvider::set_image_from_icon(image,
9295
app_id,
@@ -96,11 +99,6 @@ class WfToplevelIcon::impl
9699

97100
void send_rectangle_hint()
98101
{
99-
if (closing)
100-
{
101-
return;
102-
}
103-
104102
Gtk::Widget *widget = &this->button;
105103

106104
int x = 0, y = 0;
@@ -126,55 +124,21 @@ class WfToplevelIcon::impl
126124

127125
void set_title(std::string title)
128126
{
129-
if (closing)
130-
{
131-
return;
132-
}
133-
134127
button.set_tooltip_text(title);
135128
}
136129

137-
void close()
138-
{
139-
button.get_style_context()->add_class("closing");
140-
closing = true;
141-
}
142-
143130
void set_state(uint32_t state)
144131
{
145-
if (closing)
146-
{
147-
return;
148-
}
149-
150132
bool was_activated = this->state & WF_TOPLEVEL_STATE_ACTIVATED;
151133
this->state = state;
152134
bool is_activated = this->state & WF_TOPLEVEL_STATE_ACTIVATED;
153-
bool is_min = state & WF_TOPLEVEL_STATE_MINIMIZED;
154-
bool is_max = state & WF_TOPLEVEL_STATE_MAXIMIZED;
155-
auto style = this->button.get_style_context();
135+
156136
if (!was_activated && is_activated)
157137
{
158-
style->remove_class("flat");
138+
this->button.get_style_context()->remove_class("flat");
159139
} else if (was_activated && !is_activated)
160140
{
161-
style->add_class("flat");
162-
}
163-
164-
if (is_min)
165-
{
166-
style->add_class("minimized");
167-
} else
168-
{
169-
style->remove_class("minimized");
170-
}
171-
172-
if (is_max)
173-
{
174-
style->add_class("maximized");
175-
} else
176-
{
177-
style->remove_class("maximized");
141+
this->button.get_style_context()->add_class("flat");
178142
}
179143
}
180144

@@ -208,11 +172,6 @@ void WfToplevelIcon::set_state(uint32_t state)
208172
return pimpl->set_state(state);
209173
}
210174

211-
void WfToplevelIcon::close()
212-
{
213-
return pimpl->close();
214-
}
215-
216175
/* Icon loading functions */
217176
namespace IconProvider
218177
{
@@ -257,14 +216,20 @@ bool set_custom_icon(Gtk::Image& image, std::string app_id, int size, int scale)
257216
return false;
258217
}
259218

260-
image_set_icon(&image, custom_icons[app_id]);
219+
auto pb = load_icon_pixbuf_safe(custom_icons[app_id], size * scale);
220+
if (!pb.get())
221+
{
222+
return false;
223+
}
224+
225+
set_image_pixbuf(image, pb, scale);
261226
return true;
262227
}
263228

264229
/* Gio::DesktopAppInfo
265230
*
266-
* Usually knowing the app_id, we can get a desktop app info from Gio The filename is either the app_id +
267-
* ".desktop" or lower_app_id + ".desktop" */
231+
* Usually knowing the app_id, we can get a desktop app info from Gio
232+
* The filename is either the app_id + ".desktop" or lower_app_id + ".desktop" */
268233
Icon get_from_desktop_app_info(std::string app_id)
269234
{
270235
Glib::RefPtr<Gio::DesktopAppInfo> app_info;
@@ -340,9 +305,8 @@ void set_image_from_icon(Gtk::Image& image,
340305

341306
bool found_icon = false;
342307

343-
/* Wayfire sends a list of app-id's in space separated format, other compositors send a single app-id, but
344-
* in any case this works fine */
345-
auto display = image.get_display();
308+
/* Wayfire sends a list of app-id's in space separated format, other compositors
309+
* send a single app-id, but in any case this works fine */
346310
while (stream >> app_id)
347311
{
348312
/* Try first method: custom icon file provided by the user */
@@ -359,7 +323,7 @@ void set_image_from_icon(Gtk::Image& image,
359323
if (!icon)
360324
{
361325
/* Finally try directly looking up the icon, if it exists */
362-
if (Gtk::IconTheme::get_for_display(display)->lookup_icon(app_id, 24))
326+
if (Gtk::IconTheme::get_default()->lookup_icon(app_id, 24))
363327
{
364328
icon_name = app_id;
365329
}
@@ -370,7 +334,7 @@ void set_image_from_icon(Gtk::Image& image,
370334

371335
WfIconLoadOptions options;
372336
options.user_scale = scale;
373-
image_set_icon(&image, icon_name);
337+
set_image_icon(image, icon_name, size, options);
374338

375339
/* finally found some icon */
376340
if (icon_name != "unknown")

src/dock/toplevel-icon.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ class WfToplevelIcon
1212
void set_app_id(std::string app_id);
1313
void set_title(std::string title);
1414
void set_state(uint32_t state);
15-
void close();
1615

1716
class impl;
1817

@@ -22,8 +21,8 @@ class WfToplevelIcon
2221

2322
namespace IconProvider
2423
{
25-
/* Loads custom app_id -> icon file mappings from the section They have the format icon_mapping_<app_id> =
26-
* <icon file> */
24+
/* Loads custom app_id -> icon file mappings from the section
25+
* They have the format icon_mapping_<app_id> = <icon file> */
2726
void load_custom_icons();
2827
}
2928

src/dock/toplevel.cpp

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@ class WfToplevel::impl
3535
/* This catches two edge cases:
3636
* 1. The dock on the given output simply was closed by the user
3737
*
38-
* 2. The wl_output has been bound multiple times - this happens because gtk will bind each output
39-
* once, and then we bind it second time. So the compositor will actually send the output_enter/leave
40-
* at least twice, and the one time when we get it with the output resource bound by gtk, we need to
41-
* ignore the request */
38+
* 2. The wl_output has been bound multiple times - this happens because
39+
* gtk will bind each output once, and then we bind it second time. So
40+
* the compositor will actually send the output_enter/leave at least
41+
* twice, and the one time when we get it with the output resource bound
42+
* by gtk, we need to ignore the request */
4243
if (!dock)
4344
{
4445
return;
@@ -85,14 +86,6 @@ class WfToplevel::impl
8586
icon.second->set_state(state);
8687
}
8788
}
88-
89-
void close()
90-
{
91-
for (auto& icon : icons)
92-
{
93-
icon.second->close();
94-
}
95-
}
9689
};
9790

9891

@@ -106,11 +99,6 @@ void WfToplevel::handle_output_leave(wl_output *output)
10699
pimpl->handle_output_leave(output);
107100
}
108101

109-
void WfToplevel::close()
110-
{
111-
pimpl->close();
112-
}
113-
114102
using toplevel_t = zwlr_foreign_toplevel_handle_v1*;
115103
static void handle_toplevel_title(void *data, toplevel_t, const char *title)
116104
{
@@ -136,7 +124,8 @@ static void handle_toplevel_output_leave(void *data, toplevel_t, wl_output *outp
136124
impl->handle_output_leave(output);
137125
}
138126

139-
/* wl_array_for_each isn't supported in C++, so we have to manually get the data from wl_array, see:
127+
/* wl_array_for_each isn't supported in C++, so we have to manually
128+
* get the data from wl_array, see:
140129
*
141130
* https://gitlab.freedesktop.org/wayland/wayland/issues/34 */
142131
template<class T>

src/dock/toplevel.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,14 @@ enum WfToplevelState
1111
WF_TOPLEVEL_STATE_MINIMIZED = (1 << 2),
1212
};
1313

14-
/* Represents a single opened toplevel window. It displays the window icon on all outputs' docks that it is
15-
* visible on */
14+
/* Represents a single opened toplevel window.
15+
* It displays the window icon on all outputs' docks that it is visible on */
1616
class WfToplevel
1717
{
1818
public:
1919
WfToplevel(zwlr_foreign_toplevel_handle_v1 *handle);
2020
~WfToplevel();
2121

22-
void close();
2322
void handle_output_leave(wl_output *output);
2423

2524
class impl;

src/panel/meson.build

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@ if libpulse.found()
3939
deps += [libpulse, libgvc]
4040
endif
4141

42-
executable(
43-
'wf-panel',
44-
['panel.cpp'] + widget_sources,
45-
dependencies: deps,
46-
install: true,
47-
)
42+
executable('wf-panel', ['panel.cpp'] + widget_sources,
43+
dependencies: deps,
44+
install: true)

src/panel/widgets/clock.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,12 @@ bool WayfireClock::update_label()
3939
auto time = Glib::DateTime::create_now_local();
4040
auto text = time.format((std::string)format);
4141

42-
/* Sometimes GLib::DateTime will add leading spaces. This results in unevenly balanced padding around the
43-
* text, which looks quite bad.
42+
/* Sometimes GLib::DateTime will add leading spaces. This results in
43+
* unevenly balanced padding around the text, which looks quite bad.
4444
*
45-
* This could be circumvented with the modifiers the user passes to the format string, * but to remove the
46-
* requirement that the user does something fancy, we just remove any leading spaces. */
45+
* This could be circumvented with the modifiers the user passes to the
46+
* format string, * but to remove the requirement that the user does
47+
* something fancy, we just remove any leading spaces. */
4748
int i = 0;
4849
while (i < (int)text.length() && text[i] == ' ')
4950
{

src/panel/widgets/launchers.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ launcher_container WayfireLaunchers::get_launchers_from_config()
132132
}
133133
}
134134

135-
/* an entry is a deskop-file entry if the it has the desktop prefix but not the file_icon, file_cmd or
136-
* file_label prefix */
135+
/* an entry is a deskop-file entry if the it has the desktop prefix
136+
* but not the file_icon, file_cmd or file_label prefix */
137137
if (begins_with(opt->get_name(), desktop_prefix) &&
138138
!begins_with(opt->get_name(), file_icon_prefix) &&
139139
!begins_with(opt->get_name(), file_cmd_prefix) &&

src/panel/widgets/menu.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,8 @@ void WayfireMenu::load_menu_item(AppInfo app_info)
286286

287287
loaded_apps.insert({name, exec});
288288

289-
/* Check if this has a 'OnlyShownIn' for a different desktop env If so, we throw it in a pile at the
290-
* bottom just to be safe */
289+
/* Check if this has a 'OnlyShownIn' for a different desktop env
290+
* If so, we throw it in a pile at the bottom just to be safe */
291291
if (!app_info->should_show())
292292
{
293293
add_category_app("Hidden", app_info);
@@ -802,9 +802,9 @@ static void app_info_changed(GAppInfoMonitor *gappinfomonitor, gpointer user_dat
802802

803803
void WayfireMenu::init(Gtk::Box *container)
804804
{
805-
/* https://specifications.freedesktop.org/menu-spec/latest/apa.html#main-category-registry Using the
806-
* 'Main' categories, with names and icons assigned Any Categories in .desktop files that are not in this
807-
* list are ignored */
805+
/* https://specifications.freedesktop.org/menu-spec/latest/apa.html#main-category-registry
806+
* Using the 'Main' categories, with names and icons assigned
807+
* Any Categories in .desktop files that are not in this list are ignored */
808808
category_list["All"] = std::make_unique<WfMenuCategory>("All", "applications-other");
809809
category_list["Network"] = std::make_unique<WfMenuCategory>("Internet",
810810
"applications-internet");

src/panel/widgets/menu.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ class WayfireMenu : public WayfireWidget
153153
void on_search_changed();
154154
void on_popover_shown();
155155

156-
/* loaded_apps is a list of the already-opened applications + their execs, so that we don't show duplicate
157-
* entries */
156+
/* loaded_apps is a list of the already-opened applications + their execs,
157+
* so that we don't show duplicate entries */
158158
std::set<std::pair<std::string, std::string>> loaded_apps;
159159
std::unordered_map<std::string, std::unique_ptr<WfMenuCategory>> category_list;
160160
std::string category = "All";

0 commit comments

Comments
 (0)