Commit Graph

557 Commits

Author SHA1 Message Date
Uli Schlachter a4bac0683e Add a :send method to selection transfers
This makes the following work on a selection acquire object:

    o:connect_signal("request", function(_, _, t)
        t:send{ data = "Hello World!\n" }
    end)

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-11 09:21:50 +01:00
Uli Schlachter 53db43c2b2 Emit a "request" signal on selection acquire objects
This now creates a selection transfer object and requests Lua to reply
to the request via this object. However, so far no answer is possible.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-11 09:21:50 +01:00
Uli Schlachter b979fb724a Start a selection transfer object
Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-11 09:21:43 +01:00
Uli Schlachter 0f948d0dd9 Begin implementing selection transfers
This commit adds an implementation that always answers "Test\n" when
asked for the selection contents.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-11 09:01:37 +01:00
Uli Schlachter 869b1b0dff selection_acquire: Also emit release when X11 selection is lost
Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-11 09:01:21 +01:00
Uli Schlachter e4199dd6b5 Add a :release() method to selection acquire objects
This allows to voluntarily give up ownership of a selection. Because
selection acquire objects cannot be garbage-collected before they are
released, this also gets rid of the function destroying the window when
its selection acquire object is destroyed. Instead, the window is
immediately destroyed when no longer needed.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-11 09:01:21 +01:00
Uli Schlachter 967c9f7a01 Add selection_acquire objects
It is now possible to construct such objects and they already own a
selection.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-11 09:01:21 +01:00
Uli Schlachter 94d413345a Prepare a selection acquiring interface
No run-time behaviour is changed so far.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-11 09:01:21 +01:00
mergify[bot] ec47abb4bc
Merge pull request #2639 from psychon/selection_get
Add selection getter objects
2019-02-11 04:00:59 +00:00
Uli Schlachter 4c82199d19 selection_getter: Convert to use a table as argument
Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-10 09:49:11 +01:00
Uli Schlachter 9b3f3e35d9 selection_getter: Add support for ATOMs
The list of supported formats of the selection is queried by requesting
the target TARGETS. This target is a list of ATOMs and needs special
handling which is what this commit adds.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-07 17:56:26 +01:00
Uli Schlachter 0d2c6fc5d1 Implement INCR transfers
Incremental transfers are required to be supported. This commit adds
that necessary support to awesomeWM.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-07 17:56:26 +01:00
Uli Schlachter 8ad29950f5 selection_getter: Implement simple data transfers
This commit adds support for simple selection transfers. INCR support is
still missing. The API is that a selection getter object emit the "data"
signal when some data becomes available and "data_end" when all data was
received.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-07 17:56:26 +01:00
Uli Schlachter 010c51aa83 Implement constructing selection getter objects
So far they do not do match. The selection and target are specified and
a window is created for a transfer, but no transfer is actually started
yet.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-07 17:56:26 +01:00
Uli Schlachter e17912ec0c Prepare a selection getter interface
This prepares a new class for getting selection contents. No run-time
behaviour changes yet.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-07 15:16:48 +01:00
Uli Schlachter 1304373a19 selection watcher: Actually watch selections
When the selection that is watched by an active selection watcher
changes, then the signal "selection_changed" is emitted on the watcher.
This signal has one boolean argument that indicates if the selection is
owned. This means that this argument is false when the selection owner
went away and the selection now has no owner at all.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-06 10:27:59 +01:00
Uli Schlachter a24f35532c Implement selection watcher objects
These objects are created via e.g. selection_watcher("CLIPBOARD") to
track the CLIPBOARD selection. They start watching when their .active
property is set to true and stop when this property is unset again.

This commit implements the Lua side of that: A list of active watchers
is kept and updated when needed.

The next commit will add the X11-side of this so that these objects
actually do something.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-06 10:10:52 +01:00
Uli Schlachter 0295df81c1 Prepare a selection watcher interface
This commit adds the necessary method calls to setup the class and also
so that xfixes selection notify events can be handled. Currently, these
are empty functions, but later commits will fill them.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-06 09:30:16 +01:00
Uli Schlachter 33cd091d02 Use existing xkbcommon functionality instead of XKeysymToString
Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-01-21 01:08:48 -05:00
Uli Schlachter c292b6709d Improve docs for client class and instance
No idea what "If the client has multiple classes" is supposed to refer
to, but this commit gets rid of that reference. Also, this commit
clarifies how to get the class and instance out of xprop.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-11-21 12:51:19 +01:00
Emmanuel Lepage Vallee 90b17bdc09 awful.rules: Add proper documentation to the extra client properties.
Until now there wasn't much documentation available about how to use
these properties. With the new work on `awful.spawn` that rely more and
more on `awful.rules` integration, it is worth fixing.

This commit add a new documentation section and a future commit will
aggregate them to generate an index.
2018-10-10 01:58:18 -04:00
Uli Schlachter ae3ae1562b Merge branch 'motif_wm_hints' of https://github.com/psychon/awesome 2018-08-22 12:26:26 +02:00
mergify[bot] e9d95fba1e
Merge pull request #2345 from psychon/fix_transient_for_unsetting
Handle unsetting of .transient_for
2018-08-19 06:35:15 +00:00
mergify[bot] 8151a13e44
Merge pull request #2355 from psychon/gravity_changes
Some gravity changes
2018-08-18 22:07:26 +00:00
Uli Schlachter 21b7b29630 xwindow_translate_for_gravity: Change instead of set argument
Previously, this function overwrote the value of its argument with the
result. After this change, the function merely changes the given
variable by the calculated argument.

Thus, the old behaviour is achieved by setting the variable to zero
before the call, which all callers already did. However, for most
callers this change means that a temporary variable can be removed and
instead xwindow_translate_for_gravity() will directly change the target
variable.

No change in behaviour intended.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-08-17 09:58:30 +02:00
Uli Schlachter 56e727e026 Fix a race with setting the focus
There are two ways in which the input focus can change: Lua can request
a change and the X11 server can inform us that the input focus changed
(because some application changed it).

In the first case, we still have to inform the X11 server about the
desired change, in the second case we must not to avoid races due to
X11's asynchronous nature.

However, there was a case where we screwed up: When a focus change is
still pending, meaning that Lua assigned the focus elsewhere, but we
have not yet sent this focus change to the X11 server, we could get an
event from the X11 server telling us that the focus changed. To make
sure that the pending focus change is not lost, we sent the focus change
out in this case (call to client_focus_refresh() in
event_handle_focusin()). After sending out this pending call, we updated
the internal state to record that whatever the X11 server just told us
had the focus. The intention was that our just sent-out focus change
will cause the X11 server to send a new event and our to-be-focused
client then has the focus.

However, if the pending focus change was for a client which only showed
up in this event loop iteration, the client was still banned. This means
that client_focus_refresh() would call client_unban() to be able to give
the focus to this client. However, since awesome (partly) allows to
"focus" currently banned clients, client_unban() recorded that there is
a pending focus change. This caused confusion later on.

In this specific bug, a main window opened a dialog, and when this
dialog was closed, a new dialog window was opened immediately. When the
first dialog was closed, Lua (the focus history) gave the input focus to
the main window. Now, a new dialog showed up and Lua focused it. Next,
we received the event from the X11 server telling us that the main
window was focused. Because there was still a pending focus change to
the new dialog window, event_handle_focusin() called
client_focus_refresh() to send out this focus change. This set
globalconf.focus.need_update to false and continued. However, because
the new dialog only just now appeared, it was still banned, meaning that
client_focus_refresh() had to call client_unban(). This set
globalconf.focus.need_update to true. Thus, when client_focus_refresh()
returned, globalconf.focus.need_update was incorrectly true. Next,
event_handle_focusin() recorded that the main window had the focus.
Thus, it now appeared as if there was a pending focus change for the
main window. Next, we got the event from the X11 server telling us that
the dialog is now focused, and because focus.need_update was set,
awesome now send out a focus change request for the main window.

Fix this race by unsetting globalconf.focus.need_update at the end of
client_focus_refresh() and not at the beginning, thus making sure that
client_unban() cannot set this flag again.

Fixes: https://github.com/awesomeWM/awesome/issues/2220
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-08-16 18:03:22 +02:00
Uli Schlachter 297003126d Handle unsetting of .transient_for
When a window has a WM_TRANSIENT_FOR property that is later unset,
awesome would still keep c.transient_for pointing to the previous
"parent client". This commit fixes that.

First, property_update_wm_transient_for() is fixed so that it unsets
c->transient_for_window if the WM_TRANSIENT_FOR property is deleted.
Additionally, this then calls client_find_transient_for() to update the
c->transient_for pointer.

Secondly (and a bit unrelated), this changes client_find_transient_for()
so that it always sets c->transient_for. Previously, if updating this
property would introduce a cycle in the transient_for relation, it would
just leave c->transient_for with its old value. After this change, it
gets explicitly set to NULL instead.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-08-10 16:39:46 +02:00
Uli Schlachter d76143f97b Add support for motif wm hints
This makes motif wm hints available on clients as c.motif_wm_hints.
Actually interpreting all the values is up to Lua. The definition of the
necessary properties is taken from motif.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-08-03 19:19:43 +02:00
Daniel Hahler 3876b18240 doc: Add missing C-object documentation and fix some papercuts.
Ref: https://github.com/awesomeWM/awesome/issues/1373
2018-07-25 18:26:11 -04:00
Emmanuel Lepage Vallée 40a55a3d2f
client: Add client_set_startup_id definition (#2318)
Fixes #2309
2018-07-25 18:03:09 -04:00
mergify-bot 59a6502790 Merge branch 'master' into 'fix-2299' 2018-07-23 11:50:14 +02:00
Emmanuel Lepage Vallée 7e17bcd026
client: Make startup_id writable (#2275)
And document how to use it on Linux to fix broken startup_id
2018-07-23 04:04:07 -04:00
Uli Schlachter 3553838443 Fix function pointer casts in client.c
The getters for properties already get the object as their second
argument, so there is no need to get the object again from Lua.

Fixes: https://github.com/awesomeWM/awesome/issues/2299
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-07-23 03:48:19 -04:00
Uli Schlachter 6c27f4295b client_manage(): Check that reparenting works (#2298)
When a new client appears, we reparent its window into a window of our
choice so that we can add decorations. However, windows can be difficult
making the reparenting fail. For example, some snapshots of GTK+ set a
parent-relative background, which means that its parent windows have to
have the same depth as the window itself. This makes reparenting fail if
transparency is used/supported.

Make the failure mode... different, by checking if reparenting
succeeded. If it failed, we print an error message and unmanage the
window immediately. This means that those GTK+ windows just do not
appear at all, instead of behaving weirdly.

This idea of this patch came from i3.

Related-to: https://github.com/awesomeWM/awesome/issues/2279
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-07-22 16:05:11 -04:00
Sergey Vlasov 41e66c16f8 Remove systray_cleanup() from drawin_systray_kickout() (#2301)
The systray_cleanup() function gives up the _NET_SYSTEM_TRAY_Sn
selection ownership and should be called only when Awesome exits.
Calling systray_cleanup() from drawin_systray_kickout() is not correct,
because drawin_systray_kickout() is called when the system tray window
needs to be hidden, including the case when the last tray icon was
removed and the tray became empty.

Fixes: https://github.com/awesomeWM/awesome/issues/2301
Signed-off-by: Sergey Vlasov <sigprof@gmail.com>
2018-07-20 14:11:09 +03:00
Uli Schlachter 79d7567a1d screen_refresh(): Fake a screen when the last one is removed (#2223)
Thanks to @ewhac for the suggestion.

Fixes: https://github.com/awesomeWM/awesome/issues/2221
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-06-28 15:36:53 +02:00
Kevin Zander 5d2d296e20 Return nil when indexing screen by number 2018-06-28 15:34:44 +02:00
Kevin Zander 20b1594e17 Return nil for screen string index lookup instead of throwing error 2018-06-28 15:33:35 +02:00
Emmanuel Lepage Vallee c6491e169c doc: Remove the signal name hack 2018-05-28 14:11:41 -04:00
Uli Schlachter 681025dc50 Make fake screens permanent (#2201)
* Make fake screens permanent

Before this, screen_scan() made sure that awesome's information about
available screens conforms to what the X11 server reports. Since fake
screens are, well, fake, this meant that they were deleted.

This commit marks fake screen and handles them specially in
screen_scan() so that they are not deleted.

Note that I did not test this commit at all since I still haven't
figured out how to test RandR stuff without actually messing with
hardware.

Thanks to @madduck for bringing this up and making me fix this long
standing "huh? is that really supposed to work like that?".

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-04-22 02:07:31 -04:00
Uli Schlachter 1acae2aa6c Make alpha work on window borders
Up to now, we always asked the X11 server for color allocation ("which
pixel value corresponds to (r,g,b)?", an AllocCollor request).

This commit adds direct support for TrueColor and DirectColor visuals.
In such a visual, the X11 server gives tells us where the red, green,
and blue color components are in a pixel value and we can then just
directly compute the pixel value.

Additionally, this commit adds code that assumes that in a depth=32
visual, the remaining values (after handling red, green, blue) is the
alpha channel for colors. Thus, this adds support for transparent client
borders.

This commit also touches code for the systray. However, the systray must
always use the X11 server's default visual and that one always(?) has
depth=24, i.e. does not support an alpha channel. Thus, the systray
background still cannot be transparent.

Also, in theory this commit should support visuals where some color
component does not have 8 bits, for example RGB565. However, this is
just theoretic and I have no idea how to actually test this (without
jumping through too many hoops).

Fixes: https://github.com/awesomeWM/awesome/issues/162
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-03-03 10:57:48 +01:00
Daniel Hahler 1326ec20fd
Merge pull request #2117 from psychon/invalid_screen_swap
screen:swap(): Avoid segfault on almost-deleted screens
2017-11-20 00:38:11 +01:00
Uli Schlachter c51a2c2f47 screen_refresh: Protect against globalconf.screens changing
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-11-19 15:53:07 +01:00
Uli Schlachter ea413969f3 screen:swap(): Avoid segfault on almost-deleted screens
When a screen is in the process of being removed, it is still valid, but
no longer in the global list of screens (globalconf.screens). In this
time frame, trying to swap screens could cause a NULL pointer
dereference.

Fix this by throwing a Lua error in this case instead.

Fixes: https://github.com/awesomeWM/awesome/issues/2110
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-11-19 15:40:20 +01:00
Uli Schlachter e7982b7aba Reduce some variable scopes
Codacy things this is a good idea...

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-11-17 10:30:56 +01:00
Emmanuel Lepage Vallée f3f0f42b24
Merge pull request #2096 from psychon/iconic_state_across_restart
client.c: Set WM_STATE_NORMAL before checking _NET_WM_STATE
2017-10-31 19:20:37 +01:00
Uli Schlachter cdb95e6633 Three small fixes to the client docs
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-10-31 15:25:21 +01:00
Uli Schlachter b871c247ba client.c: Set WM_STATE_NORMAL before checking _NET_WM_STATE
_NET_WM_STATE could contain _NET_WM_STATE_HIDDEN, which we interpret as
minimized. Minimized clients have WM_STATE set to WM_STATE_ICONIC, but
the code in client_manage() would later overwrite this to
WM_STATE_NORMAL.

Fix this by setting the initial WM_STATE_NORMAL by doing so before
processing _NET_WM_STATE.

Fixes: https://github.com/awesomeWM/awesome/issues/2095
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-10-31 15:20:34 +01:00
Emmanuel Lepage Vallée 25dea5bd2a drawin: add a `get()` function. (#2013)
Identical to `client.get()`. Same use cases.
2017-08-21 21:15:18 +02:00
Daniel Hahler 784472f212 doc: improve/fix doc for awful.rules (#2005) 2017-08-20 13:37:03 -04:00
Jagannathan Tiruvallur Eachambadi c32096a311 tags: specify layout in add_tag doc snippet (#1950)
Adding a tag without layout causes errors while using the tag. For
example resizing with mouse causes indexing a null error.
2017-08-07 14:35:39 -04:00
Uli Schlachter ab559a6f36 Provide better error message for unknown screen names
The screen object can be indexed by strings to find a screen via some
RANDR output name. However, if a string is used which does not
correspond to a known output, the code just falls through to a function
which will complain "string provided, userdata expected".

This commit provides a slightly more useful error message instead.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-07-02 13:28:03 +02:00
Emmanuel Lepage Vallee 5d6d8043ec quality: Remove trailing white spaces
Fix #1129
2017-06-11 00:11:48 -04:00
Uli Schlachter 1332288f9d screen_client_moveto: Make sure client ends up on target screen
This function tried to move the client to its new screen based on
shifting around its current geometry. However, it assumed that the
client was actually visible on its current screen, which is not always
the case.

Fix this by just forcing the client into its new screen if our moving
approach does not work.

This also reverts commit d5e365804c which
is no longer necessary. This commit only hid the issue (partly).

Fixes: https://github.com/awesomeWM/awesome/issues/318
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-05-15 08:15:50 +02:00
Uli Schlachter c57208d1a8 client_resize(): Stop trying to force on screen
The code here made sure that clients were not moved outside of the root
window. However, that's not enough, because clients can still end up
inside the root window, but outside of anything that is visible in some
output. Thus, just remove this.

Related-to: https://github.com/awesomeWM/awesome/issues/318
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-05-15 08:15:38 +02:00
Uli Schlachter 01e61079c3 Add & use a non-fatal kind of assert() (#1779)
Aborting the process is sometimes a bit harsh for a failed assertion.
This adds a non-fatal assert() macro called "check()" and uses it in
some places where we might be able to survive the error.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-05-13 23:22:15 +02:00
Uli Schlachter bcf70f3740 Drop our use of iconv (#1772)
We were only using this for tag names. This means we are assuming that
everything is UTF8, but tag names are provided in the local locale and
need to be translated into UTF8? That makes no sense, so just drop this.

Fixes: https://github.com/awesomeWM/awesome/issues/1753
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-05-07 17:59:53 +02:00
Uli Schlachter 7481a6e6b8 Fix recursive enterleave ignore (#1747)
Every call to client_ignore_enterleave_events() must be paired with a
following call to client_restore_enterleave_events(). In between these
two calls, no other calls to client_ignore_enterleave_events() is
allowed.

The code in banning_refresh() sometimes broke these rules. This can
happen because the code causes signals to be emitted and Lua code can do
basically anything.

Fix this by moving the calls into the called functions.

Fixes: https://github.com/awesomeWM/awesome/issues/1746
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-04-21 18:53:25 +02:00
Uli Schlachter f290ea8b12 Stop grabbing mouse buttons on frame windows (#1724)
I failed to see the obvious. Thanks to mlen from IRC to make
me look into i3's source code so that I can figure out the obvious.

First, what is the problem? We want to be informed about mouse clicks on
client windows, e.g. for client-to-focus. For this we have to grab mouse
buttons on the client window, since only a single client at a time can
ask for information about all mouse clicks (I think...) and that right
is reserved for the actual application and not the WM.

We also want to be informed about mouse clicks on the titlebar, so that
clicking there actually does something (and also e.g. click-to-focus).
Obviously, we can just grab mouse buttons on the titlebar as well.

However, this causes lots of problems. The X11 window containing the
titlebar is not just the size of the titlebar, but also includes all of
the actual client window. This means that clicking into the client also
activates our button grab on the titlebar. This, in turn, causes the
input focus to briefly shift to the window for the titlebar. This shift
of focus can be detected by clients and caused various issues.

This fix is so obvious that I missed it. We don't have to grab buttons
on the titlebar window. We can just use the "normal" event propagation
without grabs there, i.e. we just include the event masks for button
press and button release and get informed about all mouse events. In
fact, we already have this event mask in place, so the whole use of
grabs is redundant.

That's what this commit does. It also partially reverts commit
394ff06589 which is where this unnecessary grabbing was introduced.

Fixes: https://github.com/awesomeWM/awesome/issues/1479
Fixes: https://github.com/awesomeWM/awesome/issues/1658
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-04-18 14:39:43 +02:00
Luke Bonham 30542351da pull #1648: add icon_sizes property signal emission 2017-03-14 19:38:25 +01:00
Emmanuel Lepage Vallée 957966d636 Merge pull request #1646 from psychon/systray_removal
Partly fix removal of systray from a wibox
2017-03-12 15:43:40 -04:00
Luke Bonham d3b8088c1b ldoc: fixes in lib/gears/color.lua and objects/client.c 2017-03-12 11:45:41 +01:00
Uli Schlachter 51e4a47938 Partly fix removal of systray from a wibox
This commit changes the systray widget, wibox.drawable and the C code to
fix the following bug: When the systray widget is removed from a
drawable without being moved somewhere else, the systray stayed visible.
This was because the systray is not drawn by awesome, but only placed.
When the widget is no longer "drawn", it stays wherever it was placed
last.

This change works by detecting the situation when the systray is
removed. Then, the C code is specifically told to remove the systray
window from the drawable.

Note that this is only a partial fix. This change works correctly when
the widget is removed completely, because it is no longer placed by its
parent widget. However, for example, when you do
wibox.widget.systray().visible = false, the effect is just that the
systray widget gets size 0x0. This is not really visible, but as far as
this change is concerned, the widget is still part of the drawable.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-03-11 18:14:38 +01:00
Uli Schlachter 9992fd6b1a client: Add API to query all icons
This adds c.icon_sizes which is a table containing the width and height
of each available icon. With c:get_icon(i), Lua can query the i-th icon
as a lightuserdata.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-03-07 22:45:49 +01:00
Uli Schlachter f2cb8d8eb9 C code: save all instead of just one client icons
Clients can provide various icons in their _NET_WM_ICON property. Up to
now we only saved a single one, now we save all of them.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-03-07 22:45:49 +01:00
Uli Schlachter 7d2a83f7d0 screen.c: Always emit "primary_changed" when needed
Without RandR telling us what the primary screen is, we just pick the
first one. However, the code here did not emit the right signal.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-03-03 13:25:28 +01:00
Emmanuel Lepage Vallee d5b681502a maximize: Stop mixing horizontal, vertical and both.
Before this commit, do this:

    c.maximize_hoizontal = true
    c.maximize = true
    c.maximize = false
    assert(c.maximize_hoizontal)

Would not work because the states were not preserved individually.
This commit fixes that. Awesome wont be confused about it's own
state anymore.

This may seem pointless, but when it come to undoing these
maximizations, it was ambiguous.
2017-02-07 11:12:42 -05:00
Emmanuel Lepage Vallee 3b1599bd99 maximize: Stop doing it in 2 operations.
Before 4.0, maximizing could only be done in 2 operations.

4.0 add an unified way, but kept doing 2 operations. The old
Lua EWMH code to serialize the 2 operations was dropped when
the codepath was simplified and replaced by a generic version
in awful.placement. However this version never implemented
combining multiple mementos into 1.

This commit unify the maximize C code, drop the ugly macro
template and actually fixes a couple more issues that were
caused because request::geometry was sent twice.
2017-02-07 11:12:40 -05:00
Uli Schlachter 27173163cb client: Apply the whole geometry before emitting the signals
This resolve a possible race condition where the size could be
invalid when queried from a signal callback.

Fix #1456
2017-02-07 11:12:40 -05:00
sudo-nice c003f7ba78 doc: mention to select a tag on awful.tag.add (#1520)
Ref: https://github.com/awesomeWM/awesome/issues/1509#issuecomment-276941061.
2017-02-04 15:13:12 +01:00
Emmanuel Lepage Vallée cbd22eea50 Merge pull request #1475 from psychon/input-shape-support
Input shape support
2017-02-03 12:25:56 -05:00
Luke Bonham ff47b0d0c4 object/client.c: added position and size properties
added client signals connection

added comments doc
2017-02-02 13:09:03 -05:00
Holger Schurig bf2c1993db doc: fix signals (#1455)
- rule reordering was mentioned twice in the NEWS
- fix all shown luadoc errors
- add missing descriptions for signals in module "awesome"
2017-01-28 15:03:56 +01:00
Uli Schlachter 70834848e4 Add input shape support to clients
I explicitly did not add client_shape_input property since querying the
input shape of the client window seems useless to me.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-01-26 11:12:41 +01:00
Uli Schlachter 614d1b0d57 Add input shape support to drawins
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-01-26 11:09:15 +01:00
SammysHP 0be3b0712a doc: Add missing dot 2017-01-22 09:35:44 -05:00
Vitja Makarov 5dc88da3bd Reply on configurerequest even if geometry is the same (#1388)
Bug was introduced by baaff93a73.

Fixes: https://github.com/awesomeWM/awesome/issues/1340
Fixes: https://github.com/awesomeWM/awesome/issues/1369
2017-01-12 11:19:01 +01:00
Uli Schlachter 528455045c Print warnings on invalid resizes
These warnings might help catching some problems in the future. These
could be asserts, but printing a warning is a lot nicer than dying.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-01-08 15:35:56 +01:00
Uli Schlachter e659b80f36 Refuse attempts to resize clients to invalid size
X11 does not allow to resize a window to size 0x0. Also, there are some
possibilities of integer overflows in our case. We tried to handle this
already, but there was a loop-hole: If the too-small-value is only
produced after applying size hints, then this was not caught.

Fix this by applying size hints before checking if the resulting size is
valid. However, this means some check needs to be duplicated to handle
the possibility of integer underflows while applying size hints.

Helps-with: https://github.com/awesomeWM/awesome/issues/1340
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-01-08 15:35:56 +01:00
Ingo Bürk 11a29540f2 Remove obsolete include and Xlib comment. 2017-01-05 23:17:11 +01:00
Emmanuel Lepage Vallee 160ea0fd66 doc: Fix 2 missing parentheses 2017-01-04 00:12:44 -05:00
Uli Schlachter 20b46cc2b3 tag_client: Update screen workarea
This fixes the last failure in test-struts.lua.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-12-31 15:35:33 +01:00
Uli Schlachter ea2d2cd038 untag_client: Update screen workarea
This partially fixes test-struts.lua. The test now fails at some later
part.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-12-31 15:34:09 +01:00
Uli Schlachter e5be281ff3 client_set_sticky: Update screen workarea
This partially fixes test-struts.lua. The test now fails at some later
part.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-12-31 15:31:41 +01:00
Uli Schlachter feb4fb0fbc tag_view: Update screen workarea
This partially fixes test-struts.lua. The test now fails at some later
part.

Fixes: https://github.com/awesomeWM/awesome/issues/1335
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-12-31 15:30:14 +01:00
Emmanuel Lepage Vallee a93084947a doc: Add a virtual screen example 2016-12-21 11:41:30 -05:00
Emmanuel Lepage Vallee 66a9486992 doc: Add optional shortcuts to manage tags 2016-12-21 11:41:29 -05:00
Emmanuel Lepage Vallee 4dd30c29db doc: Add common ways to access the tags 2016-12-21 11:41:29 -05:00
Emmanuel Lepage Vallee 2523be99d4 doc: Add how to add tags
It's a common question
2016-12-21 11:41:29 -05:00
Uli Schlachter 13e8088d62 Handle unexpected XCB failures (#1260)
We have many places where we are sending an XCB request and expect an
answer where the protocol guarantees that no error can occur and we are
sure to get an answer. However, for example if the X11 server crashes,
these places can still fail. This commit tries to handle failures at all
these places.

I went through the code and tried to add missing error checking (well,
NULL-pointer-checking) to all affected places.

In most cases these errors are just silently ignored. The exception is
in screen querying during startup. If, for example, querying RandR info
fails, we will fall back to Xinerama or zaphod mode. This is serious
enough that it warrants a warning. In most cases, we should exit shortly
afterwards anyway, because, as explained above, these requests should
only fail when our connection to the X11 server breaks.

References: https://github.com/awesomeWM/awesome/issues/1205#issuecomment-265869874
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-12-10 00:48:53 +01:00
Daniel Hahler e1ccfe9168 doc: fix context doc 2016-11-22 01:15:35 +01:00
Daniel Hahler 55689b4cc7 doc: improve client class (#1221) 2016-11-16 11:14:19 +01:00
Uli Schlachter 3189996507 screen: Implement :swap(s)
This allows to change the order in which screens appear in our list of
screens.

Fixes: https://github.com/awesomeWM/awesome/issues/1122
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-10-29 09:36:31 +02:00
Uli Schlachter c347c0a54c screen: Add a "list" signal
Similarly to what we do with the client list, this signal is emitted
whenever the list of screens changes.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-10-29 09:35:02 +02:00
Uli Schlachter c218b1da72 Test and fix swapping clients
The code in luaA_client_swap() is incorrect, because
luaA_object_emit_signal() already pops the arguments to the signal.
Still, the code here tried to remove the arguments from the Lua stack
again, thereby corrupting the stack (removing more items than there are
in the stack).

Normally, popping more things from the stack than it has entries
silently corrupts the Lua stack. Apparently this doesn't necessarily
cause any immediate issues, because this code has been broken since nine
months and no one noticed. This mistakes was introduced in commit
55190646.

This issue was only noticed by accident. Thus, this commit also adds a
small integration test that exercises this bug. This test catches the
issue, but only on Travis, because there we are building our own version
of Lua 5.3 and that one has assertions enabled.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-10-29 09:34:45 +02:00
Uli Schlachter 259c4f716f Remove @release @AWESOME_VERSION@ everywhere (#1157)
It does not provide much value. The version number is already known to
ldoc globally in the "description" variable.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-10-09 22:36:20 +02:00
Uli Schlachter 06f02f6004 Delay client frame window destruction (#1148)
Daniel sees a short flicker of his wallpaper when he closes a client.
This happens because the window is destroyed immediately, but other
clients are re-arranged only shortly later. In the mean time, the X
server updates the display and repaints the root window (= wallpaper
becomes visible).

Work around this by delaying the destruction of frame windows to the end
of the current main loop iteration. This means that we first update the
position of all other windows and later destroy the window that was
actually closed.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-10-07 00:46:57 +02:00
Emmanuel Lepage Vallee c214a9b111 doc: Document the client request::activate contexts 2016-10-04 01:00:55 -04:00
Daniel Hahler d513e2c4fc doc fixes for awful.{client,screen,tag} (#1134)
This adds a tparam alias "@screen" for "@tparam screen" (when used to
document e.g. arguments for callbacks), and "@screen_or_idx" when a
function accepts a "screen" or "number".
2016-10-02 16:03:11 +02:00
Uli Schlachter 19094de661 Speed up client_ignore_enterleave_events()
There are some situations where we do things that can make the mouse pointer
enter another window. We do not want to react to these "self inflicted" mouse
enter and leave events, because they aren't "real" (= generated by the user).

Before this commit, this is done by going through all windows and toggling the
"please send us enter and leave events"-bit on them. This becomes slower when
many windows are visible and floods the server with requests.

This commit changes this to a constant-time logic. Each event contains the
sequence number of the last request that the X11 server handled. Thus, we just
remember the right sequence numbers and ignore any events that comes in whose
sequence number falls into the ignored range.

In detail, we keep a list of "begin" and "end" sequence numbers and ignore any
enter and leave events that fall in this range. If we get any event with a
sequence number higher than "end", we remove this pair from the list, since it
is no longer needed.

To generate these pairs, we use a GrabServer request in
client_ignore_enterleave_events(). This gives us a sequence number and makes
sure that nothing else besides us can cause events. The server is ours! In
client_restore_enterleave_events(), we first do a NoOperation request to
generate the sequence number for the end of the pair and then do UngrabServer.
Any event that is generated after UngrabServer will have at least the sequence
number of the UngrabServer request and thus no longer fails between begin and
end.

Fixes: https://github.com/awesomeWM/awesome/issues/1107
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-09-30 09:37:55 +02:00