clang-format
This commit is contained in:
parent
587dc6c84d
commit
6849b8a56b
@ -1,6 +1,7 @@
|
|||||||
|
#include "components/bar.hpp"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include "components/bar.hpp"
|
|
||||||
#include "components/config.hpp"
|
#include "components/config.hpp"
|
||||||
#include "components/parser.hpp"
|
#include "components/parser.hpp"
|
||||||
#include "components/renderer.hpp"
|
#include "components/renderer.hpp"
|
||||||
@ -259,7 +260,7 @@ bar::bar(connection& conn, signal_emitter& emitter, const config& config, const
|
|||||||
auto offsety = m_conf.get(m_conf.section(), "offset-y", ""s);
|
auto offsety = m_conf.get(m_conf.section(), "offset-y", ""s);
|
||||||
|
|
||||||
m_opts.size.w = geom_format_to_pixels(w, m_opts.monitor->w);
|
m_opts.size.w = geom_format_to_pixels(w, m_opts.monitor->w);
|
||||||
m_opts.size.h = geom_format_to_pixels(h, m_opts.monitor->h);;
|
m_opts.size.h = geom_format_to_pixels(h, m_opts.monitor->h);
|
||||||
m_opts.offset.x = geom_format_to_pixels(offsetx, m_opts.monitor->w);
|
m_opts.offset.x = geom_format_to_pixels(offsetx, m_opts.monitor->w);
|
||||||
m_opts.offset.y = geom_format_to_pixels(offsety, m_opts.monitor->h);
|
m_opts.offset.y = geom_format_to_pixels(offsety, m_opts.monitor->h);
|
||||||
|
|
||||||
@ -279,10 +280,9 @@ bar::bar(connection& conn, signal_emitter& emitter, const config& config, const
|
|||||||
throw application_error("Resulting bar height is out of bounds (" + to_string(m_opts.size.h) + ")");
|
throw application_error("Resulting bar height is out of bounds (" + to_string(m_opts.size.h) + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.info("Bar geometry: %ix%i+%i+%i; Borders: %d,%d,%d,%d", m_opts.size.w,
|
m_log.info("Bar geometry: %ix%i+%i+%i; Borders: %d,%d,%d,%d", m_opts.size.w, m_opts.size.h, m_opts.pos.x,
|
||||||
m_opts.size.h, m_opts.pos.x, m_opts.pos.y,
|
m_opts.pos.y, m_opts.borders[edge::TOP].size, m_opts.borders[edge::RIGHT].size, m_opts.borders[edge::BOTTOM].size,
|
||||||
m_opts.borders[edge::TOP].size, m_opts.borders[edge::RIGHT].size,
|
m_opts.borders[edge::LEFT].size);
|
||||||
m_opts.borders[edge::BOTTOM].size, m_opts.borders[edge::LEFT].size);
|
|
||||||
|
|
||||||
m_log.trace("bar: Attach X event sink");
|
m_log.trace("bar: Attach X event sink");
|
||||||
m_connection.attach_sink(this, SINK_PRIORITY_BAR);
|
m_connection.attach_sink(this, SINK_PRIORITY_BAR);
|
||||||
@ -633,16 +633,20 @@ void bar::handle(const evt::motion_notify& evt) {
|
|||||||
m_log.trace("bar: Detected motion: %i at pos(%i, %i)", evt->detail, evt->event_x, evt->event_y);
|
m_log.trace("bar: Detected motion: %i at pos(%i, %i)", evt->detail, evt->event_x, evt->event_y);
|
||||||
#if WITH_XCURSOR
|
#if WITH_XCURSOR
|
||||||
m_motion_pos = evt->event_x;
|
m_motion_pos = evt->event_x;
|
||||||
// scroll cursor is less important than click cursor, so we shouldn't return until we are sure there is no click action
|
// scroll cursor is less important than click cursor, so we shouldn't return until we are sure there is no click
|
||||||
|
// action
|
||||||
bool found_scroll = false;
|
bool found_scroll = false;
|
||||||
const auto find_click_area = [&](const action& action) {
|
const auto find_click_area = [&](const action& action) {
|
||||||
if (!m_opts.cursor_click.empty() && !(action.button == mousebtn::SCROLL_UP || action.button == mousebtn::SCROLL_DOWN || action.button == mousebtn::NONE)) {
|
if (!m_opts.cursor_click.empty() &&
|
||||||
|
!(action.button == mousebtn::SCROLL_UP || action.button == mousebtn::SCROLL_DOWN ||
|
||||||
|
action.button == mousebtn::NONE)) {
|
||||||
if (!string_util::compare(m_opts.cursor, m_opts.cursor_click)) {
|
if (!string_util::compare(m_opts.cursor, m_opts.cursor_click)) {
|
||||||
m_opts.cursor = m_opts.cursor_click;
|
m_opts.cursor = m_opts.cursor_click;
|
||||||
m_sig.emit(cursor_change{string{m_opts.cursor}});
|
m_sig.emit(cursor_change{string{m_opts.cursor}});
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else if (!m_opts.cursor_scroll.empty() && (action.button == mousebtn::SCROLL_UP || action.button == mousebtn::SCROLL_DOWN)) {
|
} else if (!m_opts.cursor_scroll.empty() &&
|
||||||
|
(action.button == mousebtn::SCROLL_UP || action.button == mousebtn::SCROLL_DOWN)) {
|
||||||
if (!found_scroll) {
|
if (!found_scroll) {
|
||||||
found_scroll = true;
|
found_scroll = true;
|
||||||
}
|
}
|
||||||
@ -856,7 +860,8 @@ bool bar::on(const signals::ui::unshade_window&) {
|
|||||||
double steptime{25.0 / 2.0};
|
double steptime{25.0 / 2.0};
|
||||||
m_anim_step = distance / steptime / 2.0;
|
m_anim_step = distance / steptime / 2.0;
|
||||||
|
|
||||||
m_taskqueue->defer_unique("window-shade", 25ms,
|
m_taskqueue->defer_unique(
|
||||||
|
"window-shade", 25ms,
|
||||||
[&](size_t remaining) {
|
[&](size_t remaining) {
|
||||||
if (!m_opts.shaded) {
|
if (!m_opts.shaded) {
|
||||||
m_sig.emit(signals::ui::tick{});
|
m_sig.emit(signals::ui::tick{});
|
||||||
@ -895,7 +900,8 @@ bool bar::on(const signals::ui::shade_window&) {
|
|||||||
double steptime{25.0 / 2.0};
|
double steptime{25.0 / 2.0};
|
||||||
m_anim_step = distance / steptime / 2.0;
|
m_anim_step = distance / steptime / 2.0;
|
||||||
|
|
||||||
m_taskqueue->defer_unique("window-shade", 25ms,
|
m_taskqueue->defer_unique(
|
||||||
|
"window-shade", 25ms,
|
||||||
[&](size_t remaining) {
|
[&](size_t remaining) {
|
||||||
if (m_opts.shaded) {
|
if (m_opts.shaded) {
|
||||||
m_sig.emit(signals::ui::tick{});
|
m_sig.emit(signals::ui::tick{});
|
||||||
|
Loading…
Reference in New Issue
Block a user