Commit graph

78 commits

Author SHA1 Message Date
Daniel Eklöf
74016d7d33
bar: add bar->output_name(), returns the name of the output we’re on 2021-08-09 19:56:47 +02:00
Daniel Eklöf
b97ba80aea
bar: add border.{left,right,top,bottom}-width
This allows you to configure the width of each side of the border
individually. border.width can still be used, and will set all four
borders to the same width.

Closes #77
2021-07-28 11:00:04 +02:00
Daniel Eklöf
0aef2f85ee
config: add bar.trackpad-sensitivity
This is an integer that specifies the amount of scrolling that needs
to be accumulated before a wheel-up/down event is emitted.

A higher value means you need to drag your fingers a longer distance
before the event is emitted.

The default is 30.
2021-07-01 17:15:54 +02:00
Daniel Eklöf
4ce3fe2285
bar/wayland: fix mouse wheel up not being emitted
We emit mouse wheel up events when the ‘discrete’ counter is
negative. Thus, when looping, we need to loop to its *absolute* value.
2021-07-01 17:15:54 +02:00
Daniel Eklöf
530afe6cf5
bar: wayland: initial support for mouse wheel up/down 2021-07-01 17:15:54 +02:00
Daniel Eklöf
93a5bbb4a4
bar: wayland: require seat version 5, to get discrete axis events 2021-07-01 17:15:54 +02:00
Daniel Eklöf
c79ffbe057
Add support binding on-click handlers to other buttons than LEFT
One can now bind the left/middle/right mouse buttons to on-click. In
fact, you can have all three buttons bound to different handlers for
the same particle. The new syntax is

    on-click:
        left: <command>
        middle: <command>
        right: <command>

Leaving one out is the same thing as not mapping it at
all. Furthermore,

    on-click: <command>

is still valid, and is a shorthand for

    on-click:
        left: <commsnd>
2021-07-01 17:15:53 +02:00
Daniel Eklöf
dd724d1bc2
exposable: add ‘btn’ argument to on_mouse() 2021-07-01 17:15:52 +02:00
Daniel Eklöf
08fa56a0f4
bar: set thread name of the bar’s own thread 2021-06-21 18:16:22 +02:00
Daniel Eklöf
8c93b48146
bar/wayland: xdg_handle_output_name(): free previous monitor name 2021-04-07 07:58:16 +02:00
Daniel Eklöf
008235d904
bar/wayland: close command pipe FDs in cleanup 2020-11-25 20:36:45 +01:00
Daniel Eklöf
328ebe8fe9
bar/wayland: plug memory leak: free seat name 2020-11-25 20:36:45 +01:00
Daniel Eklöf
1262f1b3d1
bar/wayland: use wl_*_release() instead of wl_*_destroy()
This lets the compositor free up internal state.
2020-11-09 19:53:57 +01:00
Daniel Eklöf
588e6150d2
bar/wayland: do *not* set backend->scale in xdg_output_handle_done()
This is done by update_size(). Setting it in xdg_output_handle_done()
causes update_size() to do an early exit, and thus we end up never
actually configuring the surface.

We also never instantiate a pixman image, which led to a hard crash at
startup when the user had configured a specific output to use.
2020-07-20 17:30:20 +02:00
Daniel Eklöf
aa1b3457a1
bar/wayland: make sure we don't strcmp() a NULL pointer 2020-07-20 17:29:56 +02:00
Daniel Eklöf
e38f593acd
bar/wayland: don't try to set cursor surface if serial is 0 2020-07-11 07:39:02 +02:00
Daniel Eklöf
74933c40ee
bar/wayland: log error message when failing to load cursor (image) 2020-07-11 07:37:01 +02:00
Daniel Eklöf
84ba1c231a
bar/wayland: update cursor on pointer enter event 2020-07-10 18:38:00 +02:00
Daniel Eklöf
c03564513d
bar/wayland: seat: handle failure to create pointer surface 2020-07-10 18:37:39 +02:00
Daniel Eklöf
0a0ef8852a
bar/wayland: move seat.pointer.pointer -> seat.wl_pointer 2020-07-10 18:20:29 +02:00
Daniel Eklöf
f426155e0b
bar/wayland: explicitly refresh on scale changes
Just calling update_size() isn't enough, as that in itself doesn't
trigger a redraw.
2020-07-10 11:43:34 +02:00
Daniel Eklöf
6bf077240c
bar/wayland: update_size: release old buffer when reloading buffers 2020-07-10 11:43:12 +02:00
Daniel Eklöf
dd74b7f747
bar/wayland: don't initialize backend->scale = 1
This causes the first call to update_size() to exit early, and thus we
never configure the initial state.
2020-07-10 11:42:26 +02:00
Daniel Eklöf
31a4cddde3
bar/wayland: guess scale when no 'output' has been configured 2020-07-10 10:48:17 +02:00
Daniel Eklöf
d80fbd4084
bar/wayland: remove commented out code 2020-07-10 10:48:07 +02:00
Daniel Eklöf
d929c12ecb
bar/wayland: reload cursor theme: remember current pointer name
This allows us to avoid reloading the same pointer image again and
again.
2020-07-09 19:52:10 +02:00
Daniel Eklöf
f04b1e806c
bar: let backend check if xcursor should be updated or not
This allows the backend to support multi-seat "properly", by checking
against the correct seat. Before this, when we used a single, global
xcursor value, a seat whose pointer needed to be updated would not be
updated.
2020-07-09 19:02:02 +02:00
Daniel Eklöf
5884e665a4
bar/wayland: set-cursor: don't skip out if "old" xcursor is same as "new"
We might be setting on a different seat than before.
2020-07-09 18:55:04 +02:00
Daniel Eklöf
13c2b8296d
bar/wayland: resize surface+buffers on dynamic scale changes 2020-07-09 18:51:44 +02:00
Daniel Eklöf
40d47f8273
bar/wayland: handle seat removal 2020-07-07 20:52:25 +02:00
Daniel Eklöf
b658f577de
bar/wayland: don't roundtrip when adding globals
Instead, roundtrip once all globals have been handled. This means all
listeners have been registered.

When we detect a specific monitor to map to, and it has a non-default
scale, update the cursor theme (since it depends on the scale).
2020-07-07 20:44:17 +02:00
Daniel Eklöf
b73e3acd0a
bar/wayland: remove debug output 2020-07-07 16:42:57 +02:00
Daniel Eklöf
6f22edaba6
bar/wayland: multi-seat support
We only care about the mouse. We now track per-seat cursor positions
and cursor themes.

Any enter/leave/motion/button event will call the bar on_mouse()
method using the coordinates from the "current" seat.

Since the bar framework doesn't deal with multi-seats at all, we
internally, in the backend, track the currently active seat. This is
the seat which we last saw any kind of events from.

This is used in e.g. set_cursor(), which is called from the bar.
2020-07-07 14:09:25 +02:00
Daniel Eklöf
0678015eb1
bar/wayland: shutdown when compositor "closed" our layer surface 2020-04-28 18:58:27 +02:00
Daniel Eklöf
860ec01791
bar/wayland: log globals 2020-04-28 18:58:18 +02:00
Daniel Eklöf
c707b00a2a
bar/wayland: don't destroy pointer unnecessarily
We only need to create/destroy the pointer when the POINTER capability
changes.
2020-04-28 18:57:32 +02:00
Daniel Eklöf
c7cfb451e3
bar/wayland: spell compositor correctly 2020-04-27 20:50:36 +02:00
Daniel Eklöf
df1a004f97
bar/wayland: layer surface "namespace" is a category, not application ID 2020-02-06 19:11:16 +01:00
Daniel Eklöf
edfe7e70f9
bar/wayland: don't use wl_display_dispatch()
wl_display_dispatch() calls poll(), which is unnecessary since we
already know the FD is readable.

Use the more lower level wl_display_read_events() +
wl_display_dispatch_pending().

These require wl_display_prepare_read() to have been called.
2020-01-03 21:24:26 +01:00
Daniel Eklöf
baee3924e4
bar/wayland: let compositor choose output if user didn't
Instead of us selecting an output randomly (we used to select that
"last" output) when the user hasn't configured one, let the compositor
choose one for us.
2019-12-31 11:39:33 +01:00
Daniel Eklöf
e05d586f17
bar/wayland: WL_OUTPUT_MODE_PREFERRED doesn't meen this *output* is preferred
It means the *mode* (width, height, refresh) is the preferred one for
*this* output.
2019-12-31 11:16:23 +01:00
Daniel Eklöf
199a7ccd21
bar/wayland: change disconnected log type from warn -> info
Because being disconnected from Wayland is how we typically exit.
2019-11-23 13:50:29 +01:00
Daniel Eklöf
0550d2799d
tllist: use tllist from external git repository 2019-11-17 19:17:34 +01:00
Daniel Eklöf
736e07b15e
wayland: verify server implements the required interface versions 2019-11-03 16:17:17 +01:00
Daniel Eklöf
9dbbc480e4
Rename project: f00bar -> yambar 2019-09-28 20:39:45 +02:00
Daniel Eklöf
f29f96be96
bar/wayland: use preferred monitor if user didn't specify one 2019-09-22 12:08:08 +02:00
Daniel Eklöf
18e9d67d77
bar/wayland: fail when we can't find the specified monitor 2019-09-22 11:59:48 +02:00
Daniel Eklöf
4ce314e328
cairo: drop all remaining references to cairo
We now use pixman (and freetype + fontconfig) exclusively.
2019-09-22 11:52:37 +02:00
Daniel Eklöf
01e71590e0
bar: don't use cairo
This is trivial in the Wayland backend; just instantiate a pixman
pointing to the same mmapped memory as the wayland buffer.

In the XCB backend, we change the implementation slightly; instead of
rendering via a cairo XCB surface backend (to a server side pixmap),
which is then blitted to the window in commit(), we now render to a
client-side pixman pixmap, and blit it using xcb_put_image() in
commit().
2019-09-22 11:46:46 +02:00
Daniel Eklöf
c11fee4ce3
cairo: replace cairo with pixman in decos, particles and modules
All decoration, particle and module interfaces now takes a
pixman_image_t parameter, and all drawing is done using pixman APIs.

The wayland/xcb backends implement a new interface functions,
get_pixman_image(), that should return a pixman image instance that is
suitable for rendering.

In the wayland backend, the image uses the same backing data as the
cairo surface.

In the XCB backend, we create a new image each time, and then blit it
to the cairo surface at commit time.
2019-09-22 01:56:58 +02:00