Commit Graph

540 Commits

Author SHA1 Message Date
Aire-One 82a2769e04 Fix ldoc modules summaries missing the final `.`. 2019-11-28 13:53:59 +01:00
Emmanuel Lepage Vallee 296ad18922 client: Move the `c:keys()` method to a property. 2019-10-05 18:06:51 -04:00
Emmanuel Lepage Vallee 29e804a4f8 drawin: Turn `:buttons()` into a property. 2019-10-05 18:06:51 -04:00
Emmanuel Lepage Vallée ffe7c4d1cc Apply suggestions from code review
Thanks to @Aire-one for those fixes!

Co-Authored-By: Aire-One <Aire-One@users.noreply.github.com>
2019-10-05 17:16:22 -04:00
Emmanuel Lepage Vallee c2a2c789e6 doc: Add example sequences for the tags. 2019-10-05 17:16:22 -04:00
Emmanuel Lepage Vallee fa2433192a doc: Add some screen example sequences. 2019-10-05 17:16:22 -04:00
Emmanuel Lepage Vallee 9c0e16e623 doc: Add examples for the various maximization. 2019-10-05 17:16:22 -04:00
Emmanuel Lepage Vallée 85c8d5e205
Merge pull request #2854 from Elv13/uml_magic
Add some navigation helpers to the doc (in the form of UML tables)
2019-10-01 00:56:20 -04:00
Emmanuel Lepage Vallee 464e103a4e screen: Add a `name` property to the C API.
This will be useful to address the screens by roles/names in the client
and tag rules. Since the sceen rules will make setups where sceens are
attached and removed much easier to work with, using indexes or output
names in the rules becomes a limitation.
2019-09-30 00:49:40 -04:00
Emmanuel Lepage Vallee aa76b11b81 screen: Move the "added" signal from CAPI to Lua.
When the screens are created from the viewport in Lua, the signal is
sent too early and the DPI and outputs have not yet been added. This
cause the `connect_for_each_screen` callbacks to be called with a
partially initialized screen object. It also causes the drawables to be
repainted too early.

CAPI now emits "_added" and "awful.screen" takes care of emitting
"added".
2019-09-30 00:49:39 -04:00
Emmanuel Lepage Vallee 875941e9ac screen: Store the lifecycle metadata.
With this commit, the C code stores if the screen was created with
`fake_screen` and also stores if the Lua side "promise" to manage
(aka, track the viewport and remove it) the object. There is now
3 kind of screens:

 * Managed by C (created and deleted by the core code)
 * Managed by Lua (replicate the core code, but with more hooks)
 * Unmanaged (created directly with fake_screen)
2019-09-30 00:48:12 -04:00
Emmanuel Lepage Vallee d4ce5706c7 screen: Update the clients screen from fake_resize and fake_add.
Otherwise the client were still in the old tasklist when `:split()` is
called.
2019-09-29 19:07:24 -04:00
Emmanuel Lepage Vallee b0f18bce52 screen: Allow `outputs` to be changed.
This moves the handling of the `outputs` property away from C and into
Lua. It will allow the use of `screen.fake_add` to have outputs.
2019-09-29 19:07:24 -04:00
Emmanuel Lepage Vallee ae99e8d7bb screen: Add an `id` field to the vireport.
This will help to delete screens.
2019-09-29 19:07:24 -04:00
Emmanuel Lepage Vallee 1304f46c0c screen: Split the `outputs` code away from the screen logic.
It moves the actual place where when screen array is stored into the
area object. This allows to store the outputs when screens are not
automatically created.
2019-09-29 18:56:06 -04:00
Emmanuel Lepage Vallee 433898599d init: Add a command line option to start AwesomeWM without screens.
This commit add an optional `--screen off` command to initialize Lua
without first adding the screens. This is inconvinient for most users
since it restrict the APIs that are usable out of the box.

However, this allows AwesomeWM to work independently from the hardware.
This means that when a screen is unplugged, it is the Lua code that will
remove the screen instead of CAPI pulling the carpet from under. It also
allows to ignore some screen areas before the screen is ever created.
Combined, it makes it possible to work with screens even when they are
physically disconnected. Finally, it will allow for an awful.rules like
API to control how screens are created.

All in all, some people need this for their setup and some people might
want to do it anyway for fine grained and/or dynamaic multi-screen
setups.

This commit also adds 4 new signals to `capi` to be able to
execute code at specific points during the initialization. The commit
improves naughty error notifications to work even if problems occurs
before the screens are added.

Note that AwesomeWM will exit if no screens are created. While it would
be easy to just call `refresh_screen();` after unsetting the magic
variable, doing so would have corner cases. Better be harsher and
prevent the user from shooting themselves in the foot from not reading
the f****** manual. Code introduced in future commits will take care
of automatically calling fake_screen in the event nothing is created.

Fixes #1382
2019-09-29 18:52:00 -04:00
Emmanuel Lepage Vallee 602d6ded07 doc: Add some images to represent the various area of a screen. 2019-08-19 01:48:00 -04:00
Emmanuel Lepage Vallee f0bf0df6f0 doc: Add an UML class diagram like table of cardinalities.
It will help users find how to get some objects from other objects.
2019-08-19 01:19:32 -04:00
Emmanuel Lepage Vallee b4ece0f053 doc: Use an explicit tag for all static functions.
This way their name doesn't get mangle by the broken magic. It will also
eventually allow to `error()` in the template when the implicit
`@function` is used.

This commit also fixes a large number of issues found while
proof-reading everything.
2019-06-08 18:14:13 -04:00
Emmanuel Lepage Vallee 11d7a614d9 doc: Add a constructor stereotype for everything.
This forces the constructor functions to be at the top of the API
documentation rather than in a random position.
2019-06-08 18:13:42 -04:00
Emmanuel Lepage Vallee 63ca0f0d8f doc: Use an explicit @method stereotype for all methods.
ldoc has a magical `@classmod` module type which tries to detect
what is a method and what is a static function. It fails about as
often as it works. This commit makes everything explicit to remove
such issues.

Fixes #2640
Ref #1373
2019-06-08 18:13:42 -04:00
Emmanuel Lepage Vallee 9d0c2200b2 doc: Add a section for the important classes.
The choice is very subjective, but at least they stand out.
2019-06-08 18:13:28 -04:00
Uli Schlachter aa21156ced Make sure we always flush after xcb_ungrab_server()
Between xcb_grab_server() and xcb_ungrab_server(), XCB's output buffer
might fill up. Thus, the GrabServer request might already have been sent
to the server, but the following UngrabServer request could end up in
XCB's output buffer. There, it might sit around for quite a while and
cause problems.

Since we cannot detect when XCB's output buffer fills up, we just always
flush after generating an UngrabServer request.

Very-likely-Fixes: https://github.com/awesomeWM/awesome/issues/2697
Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-27 10:20:22 +01:00
mergify[bot] 2d2dba0d80
Merge pull request #2643 from psychon/selection_ownership
Add API for setting clipboard contents
2019-02-26 19:57:05 +00:00
Uli Schlachter a22479c97b Screen scanning: Use an idle source
Instead of refreshing screens at the end of the current main loop
iteration, this now uses a GLib idle source with a very low priority.
This increases the chance of batching multiple refreshes together. Also,
this means that awesome_refresh() does less work.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-18 10:42:29 +01:00
Uli Schlachter b73fa1cc28 Reduce scope of data variable
This fixes a warning from Codacy.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-17 18:43:02 +01:00
Uli Schlachter 01bd2d1896 selection_acquire: Change the API to a table
As requested in the review, instead of just having a single string
argument, selection_acquire() now has a table as its argument. It
searches the string under the "selection" key here.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-17 08:00:57 +01:00
Uli Schlachter b909068430 Set _NET_WM_DESKTOP for sticky windows specially (#2653)
Today I learnt that _NET_WM_STATE_STICKY means something else than I
previously thought.

ICCCM and EWMH support virtual desktops that are larger than the actual
screen. The idea is that one can scroll through this virtual desktop,
which means that e.g. all windows move to the left, so one can see the
windows that are further to the right.

_NET_WM_STATE_STICKY indicates that a window is sticky. This means that
it does not scroll with the virtual desktop, but instead sticks to its
current position.

In AwesomeWM, we use a different definition. A sticky window is always
visible, even when it is not tagged with any of the currently selected
tags. This behaviour is indicated in EWMH with a special value of
_NET_WM_DESKTOP. This commit updates the code to actually set this
special value.

This fixes attaching tabs in Google Chrome when the "target window" is
sticky (in the AwesomeWM sense).

Fixes: https://github.com/awesomeWM/awesome/issues/2652
Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-16 13:51:29 -05:00
Uli Schlachter d29cf0c926 property: Remove unused int return
Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-11 10:13:13 +01:00
Uli Schlachter 6d7014ca68 Selection transfer: Change event mask after append
When a selection transfer is done, we are no longer interested in events
from the selection window. However, this happens after we set the
property to indicate end of transfer, not before.

The (untested) theory here is that this should make selection transfers
from AwesomeWM to AwesomeWM, i.e. internal transfers, work.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-11 09:21:50 +01:00
Uli Schlachter 18dd22811e Transfer objects: Accept data in chunks
This commit adds a "continue" signal on transfer objects. This signal is
used to request the next chunk of data from Lua after the last one was
sent.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-11 09:21:50 +01:00
Uli Schlachter 434f97e4b1 Selection transfer: Support INCR transfers
Large amounts of data have to be send in chunks via the INCR protocol.
This commit adds support for that protocol to selection transfers.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-11 09:21:50 +01:00
Uli Schlachter fe62ad5faa selection transfer: Support atom format
This commit makes :send{ data={"TARGETS", "UTF8_STRING"}, format="atom"}
work correctly. This was tested with xclip -o -target TARGETS.

With this commit, it becomes possible to implement the TARGETS target.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-11 09:21:50 +01:00
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