Commit graph

322 commits

Author SHA1 Message Date
Guido Cella
5ed227384b rename drw
It's impossible to understand that this stands from drawable if you're
not familiar with dwm's code.
2020-12-20 18:19:43 +01:00
Guido Cella
b161b5d8f4 don't notify of activity
...or update selmon when we just want to restore pointer focus.
2020-12-20 16:04:13 +01:00
Guido Cella
13c7e039bb deactivate the focused client on overlay focus 2020-12-20 15:55:52 +01:00
Guido Cella
a571ea465c replace shouldfocusclients with checking old
And don't activate clients while an overlay is focused.
2020-12-20 15:46:31 +01:00
Guido Cella
39946e07f2 fix keyboard focus with overlays
Don't let internal calls to motionnotify(0) meant to update the pointer
focus from maplayersurfacenotify and destroylayersurfacenotify also
shift the keyboard focus to the surface under the cursor with
sloppyfocus.
2020-12-20 15:46:31 +01:00
Guido Cella
f80f08848b ensure that xwayland cursor defaults to left_ptr
Don't show an X cursor when closing an Xwayland window or with certain
dropdowns.

Based on https://github.com/djpohly/dwl/pull/32
2020-12-20 14:57:41 +01:00
Guido Cella
444a5f9dec enable adaptive sync
The comment in this function's declaration says the backend is free to
ignore this setting, so maybe there's no need to make it configurable?
2020-12-20 14:57:41 +01:00
Guido Cella
6b47e2bb62 use bool
Because it's 2020. Passing integers to wlroots variables and functions
with bool in their signature is silly.
2020-12-20 14:57:39 +01:00
Guido Cella
0b2f4f213d remove -Werror=declaration-after-statement
wtf is the point of this crap? It makes the code harder to follow,
increases the line count and made me fail compilation a million times.
We shouldn't blindy follow everything about suckless's style.
2020-12-19 19:52:28 +01:00
Guido Cella
ba1540c3d0 remove goto when the border is 0
Rendering 0-dimension rectangles no longer crashes wlroots.
2020-12-19 19:32:16 +01:00
Guido Cella
2eaa8c6de3 remove useless assignment
calloc already initializes ints to 0.
2020-12-19 18:56:42 +01:00
Guido Cella
ee7e8688a7 s/maprequest/mapnotify
This should be consistent with other function names instead of keeping
the X name.
2020-12-19 18:51:22 +01:00
will
aa679c4f29 Added support for natural scrolling 2020-12-19 18:37:10 +01:00
will
4f1e557d3d Added basic tap-to-click for touchpad users 2020-12-19 18:37:10 +01:00
Bonicgamer
679f6493c9 Made scalebox the way sway does it
Scaling a wlr_box without rounding can sometimes make the borders not
connected and nice. I noticed this when setting scale in monrules to 1.2

So I've went and copied what Sway did in desktop/output.c but without
having a second function and now using a random rounding macro I found
on the internet so as to not use round from math.h.
2020-12-19 18:35:25 +01:00
Guido Cella
9c2524b06a s/prev/old
Be consistent with the rest of the code and dwm
2020-12-19 18:31:26 +01:00
Guido Cella
c89de53de3 remove togglefullscreen keybinding
Distribute it as a patch like in dwm since graphical applications
usually provide their own keybinding; I guess it's only for terminals.

Note that even though these commits don't let you open multiple windows
in fullscreen and cycle between them like in dwm, with just
fullscreennotify spawning new windows or changing tag would still exit
fullscreen automatically, but you would have to toggle fullscreen twice
when switching back to the fullscreen window to enter fullscreen again,
so this is better since it avoids that.
2020-12-19 18:23:23 +01:00
Stivvo
14ce016213 Readme: achieve fullscreen + allow borderpx = 0 2020-12-19 18:06:38 +01:00
Stivvo
1e134fde97 Quit fullscreen on new x11 window
After the removal of quitfullscreen() dwl wouldn't compile widh xwayland
enabled because createnotifyx11 was still using the old function
2020-12-19 18:06:38 +01:00
Stivvo
32612c90b6 Delete quitfullscreen()
quitfullscreen() was replicating the functionalities of setfullscreen(c,
0)

Reusing setfullscreen() in quitfullscreen() leads to a 3 line function,
which is useless since quitfullscreen() is used once anyway
2020-12-19 18:06:37 +01:00
Stivvo
5a16649e79 Keep windows fullscreen after redraw
This fixes the bug that happens when changing workspace (or any time
arrange() is called) where there are fullscreen windows, which are still
fullscreen but leave the space for layer surfaces like waybar (which
should be hidden when going fullscreen)

Also as soon one fullscreen window is found hte function returns to
improve efficiency
2020-12-19 18:06:11 +01:00
Stivvo
02a09cb854 Set fullscreen simpler 2020-12-19 18:06:11 +01:00
Stivvo
cb9269df41 use m->m (fullscreen on top of layers) 2020-12-19 18:06:11 +01:00
Guido Cella
36b9831ffd fix typo 2020-12-19 18:06:11 +01:00
Stivvo
5bd9be3a75 Allow borderpx = 0 2020-12-19 18:06:11 +01:00
Stivvo
f125e1b9a4 Toggle fullscreen on all clients
mod+e allows to toggle fullscreen any client, even those who don't
support it themselves
2020-12-19 18:06:11 +01:00
Stivvo
d41cc60ec1 Handle new windows
Windows lose fullscreen state when a new window is created in the same
tag
2020-12-19 18:06:09 +01:00
Stivvo
2abfd475de isfullscreen int 2020-12-19 18:05:51 +01:00
Stivvo
af68b71094 Same fscreen func for xdg and xwayland 2020-12-19 18:05:51 +01:00
Stivvo
64113a682f Fullscreen xwayland 2020-12-19 18:05:51 +01:00
Stivvo
573535c89c Unlink fullscreen 2020-12-19 18:05:51 +01:00
Stivvo
60a732ceb8 Restore windows after fullscreen
Store position and size of windows before going fullscreen. This is more
efficient than arrange() and also works with floating windows

All the clients keep their original position because arrange() isn't
used after quitting fullscreen
2020-12-19 18:05:51 +01:00
Stivvo
de6db97401 No borders on fullscreen windows
Some code has been borrowed from the smartBorders patch
2020-12-19 18:05:51 +01:00
Stivvo
dd3920e75d Toggle fullscreen 2020-12-19 18:05:51 +01:00
Stivvo
0f04c76387 Basic fullscreen 2020-12-19 18:05:51 +01:00
Guido Cella
0f48c9552e handle the x11 configure event
This fixes the window size of old games in Wine.
2020-12-19 12:34:32 +01:00
Guido Cella
0016a209e4 implement the virtual keyboard protocol
This is used by wtype.

Also properly cleanup keyboards. Without wl_list_remove(&kb->link) dwl
crashed after using wtype 2-3 times.
2020-12-19 12:34:32 +01:00
Guido Cella
90cc3b1e2c Allow toggling the layout before selecting a different one 2020-12-19 12:34:32 +01:00
Guido Cella
41cc23e1cf Implement the idle protocol
It allows clients such as swayidle and chat applications to monitor user
idle time.
2020-12-19 12:34:32 +01:00
Guido Cella
1024928c15 deactivate focused client when spawning a new one
Because maprequest immediately calls wl_list_insert(&fstack, &c->flink),
in the following call to setmon(), the selclient() which is passed to
focusclient() as the old client is actually the newly mapped client, and
the real old one is never deactivated. You can see this by, for example,
opening Chromium's devtools, then spawning a terminal. The background of
the focused line in the devtools doesn't change from light blue to grey.

We can't just remove wl_list_insert(&fstack, &c->flink) from maprequest,
because calling wl_list_remove in focusclient() with a client that has
not been added to the list causes a segmentation fault.
Therefore we fix the focusclient call by not passing it the old client
every time, but instead using the wlroots function that gets the focused
surface and deactivate that, like in TinyWL.
This also avoids getting the selected client and passing it to
focusclient() on every call unnecessarily, and will allow removing
shouldfocusclients in a future commit by checking if old is a layer
surface instead.
2020-12-19 12:34:31 +01:00
Guido Cella
64faad7cb6 implement the wlr-data-transfer protocol
It makes wl-clipboard work properly in neovim, without having to create
a transparent surface that steals focus and causes flickering. It's also
required for clipman.
2020-12-19 12:26:31 +01:00
Guido Cella
ee5bd9a643 fix temporarily disabling a single monitor
The code in this else completely freezes my system when I run the
swayidle command to replicate xset dpms force off. No idea if it works
on multiple monitors, but for now avoid running when there's 1 monitor.

Also remove the comment with the function name in sway.
2020-12-19 12:26:14 +01:00
Stivvo
d9ab75721a Don't switch to another disabled monitors
Since wlr_output_enable doesn't have any effect before finishing all the
procedure, a little hack allows to make use of focusmon(), which must
know the latest in about which output is currently disabled

Also improve performance in focusmon() and cleaner code in
outputmgrapplyortest()
2020-10-31 18:29:33 +01:00
Stivvo
80a685ee51 Fix crash with no monitors left
When there's no monitors left, prevent the while in cleanupmon() to
become an infinite loop

Also switch to the left monitors instead of the right
2020-10-31 17:11:16 +01:00
Stivvo
5221a329e2 closemon() has now only 1 parameter 2020-10-31 16:25:46 +01:00
Stivvo
934ce085b6 Don't switch to disabled mons after unplug 2020-10-31 16:25:29 +01:00
Stivvo
38606a1d23 Merge branch 'handleUnplug' into output-management 2020-10-31 16:16:22 +01:00
Stivvo
9f0b16868a Back to closemon() with one parameter
With the recent changes in output-management, the extra argument in
closemon() would be needed only when unplugging the monitor, so it isn't
worth it anymore. Also now is more efficient.
2020-10-31 13:19:31 +01:00
Stivvo
9f3f15b467 Disable mon faster
Since focusmon() now never focuses disabled monitors, there's no need to
focus the disabled monitor first
2020-10-31 13:00:55 +01:00
Stivvo
25671d7905 Fix crash when disabling focused mon
m->link.next leads to errors if the monitor to disable doesn't have a
"next" (right) monitor and is currently focused. dirtmon() does more
checks.

In some previous commits m->link.next is told to be left monitor, which
is wrong

Also focusclient() explicitly checks for disabled monitors (this fixes
in case of more than one disabled monitor)
2020-10-31 12:52:22 +01:00