mirror of
https://github.com/swaywm/sway.git
synced 2026-06-15 14:33:54 -04:00
Merge d18bf0f261 into 47ec005a58
This commit is contained in:
commit
af55e39143
17 changed files with 1499 additions and 22 deletions
|
|
@ -8,6 +8,7 @@
|
|||
#include "swaybar/config.h"
|
||||
#include "swaybar/image.h"
|
||||
#include "swaybar/input.h"
|
||||
#include "swaybar/tray/dbusmenu.h"
|
||||
#include "swaybar/tray/host.h"
|
||||
#include "swaybar/tray/icon.h"
|
||||
#include "swaybar/tray/item.h"
|
||||
|
|
@ -18,8 +19,6 @@
|
|||
#include "stringop.h"
|
||||
#include "wlr-layer-shell-unstable-v1-client-protocol.h"
|
||||
|
||||
// TODO menu
|
||||
|
||||
static bool sni_ready(struct swaybar_sni *sni) {
|
||||
return sni->status && (sni->status[0] == 'N' ? // NeedsAttention
|
||||
sni->attention_icon_name || sni->attention_icon_pixmap :
|
||||
|
|
@ -333,8 +332,9 @@ void destroy_sni(struct swaybar_sni *sni) {
|
|||
free(sni);
|
||||
}
|
||||
|
||||
static void handle_click(struct swaybar_sni *sni, int x, int y,
|
||||
uint32_t button, int delta) {
|
||||
static void handle_click(struct swaybar_sni *sni, struct swaybar_output *output,
|
||||
struct swaybar_seat *seat, uint32_t serial, int x, int y, uint32_t button,
|
||||
int delta) {
|
||||
const char *method = NULL;
|
||||
struct tray_binding *binding = NULL;
|
||||
wl_list_for_each(binding, &sni->tray->bar->config->tray_bindings, link) {
|
||||
|
|
@ -365,7 +365,11 @@ static void handle_click(struct swaybar_sni *sni, int x, int y,
|
|||
method = "ContextMenu";
|
||||
}
|
||||
|
||||
if (has_prefix(method, "Scroll")) {
|
||||
if (has_prefix(method, "ContextMenu")) {
|
||||
if (sni->menu && !sni->tray->menu) {
|
||||
swaybar_dbusmenu_open(sni, output, seat, serial, x, y);
|
||||
}
|
||||
} else if (has_prefix(method, "Scroll")) {
|
||||
char dir = method[strlen("Scroll")];
|
||||
char *orientation = (dir == 'U' || dir == 'D') ? "vertical" : "horizontal";
|
||||
int sign = (dir == 'U' || dir == 'L') ? -1 : 1;
|
||||
|
|
@ -385,6 +389,7 @@ static int cmp_sni_id(const void *item, const void *cmp_to) {
|
|||
|
||||
static enum hotspot_event_handling icon_hotspot_callback(
|
||||
struct swaybar_output *output, struct swaybar_hotspot *hotspot,
|
||||
struct swaybar_seat *seat, uint32_t serial,
|
||||
double x, double y, uint32_t button, bool released, void *data) {
|
||||
sway_log(SWAY_DEBUG, "Clicked on %s", (char *)data);
|
||||
|
||||
|
|
@ -406,7 +411,8 @@ static enum hotspot_event_handling icon_hotspot_callback(
|
|||
(int) output->output_height - config->gaps.bottom - y);
|
||||
|
||||
sway_log(SWAY_DEBUG, "Guessing click position at (%d, %d)", global_x, global_y);
|
||||
handle_click(sni, global_x, global_y, button, 1); // TODO get delta from event
|
||||
// TODO get delta from event
|
||||
handle_click(sni, output, seat, serial, global_x, global_y, button, 1);
|
||||
return HOTSPOT_IGNORE;
|
||||
} else {
|
||||
sway_log(SWAY_DEBUG, "but it doesn't exist");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue