Commit graph

213 commits

Author SHA1 Message Date
Mikkel Oscar Lyderik f39034a55f Use correct format string for x86_64 and i686
Fix #587
2016-04-17 16:51:33 +02:00
Mikkel Oscar Lyderik a7f26939c2 Only update geometry of single floating view 2016-04-09 22:51:41 +02:00
Eric Engestrom 3e8081514d Fix spelling mistakes 2016-04-02 16:00:05 +01:00
Drew DeVault 655b003062 Fix pointer scroll thing 2016-03-30 09:24:51 -04:00
Drew DeVault a4bf09f142 Remove leftover comment 2016-03-30 08:36:25 -04:00
Drew DeVault a12850444d New feature: adjust gaps with floating_mod+scroll
I made this configurable but I didn't make the command for it. That's
left as an exercise to an eager contributor.

    mod_scroll_behavior [gaps inner|gaps outer]

Would merge implementions of more behaviors for mod+scroll, if anyone
has some neato ideas.
2016-03-30 08:34:32 -04:00
Mikkel Oscar Lyderik 0af55539a8 Fix borders with floating windows 2016-03-30 10:09:08 +02:00
Mikkel Oscar Lyderik 5a13cb0ed1 Implement borders
The borders are implemented as a surface/buffer attached to each view
which is sent to and rendered by wlc in the view_pre_render callback.

All the drawing logic is handled in sway/border.c and all the logic for
calculating the geometry of the border/view is handled in
`update_geometry` in sway/layout.c (same place as gaps are calculated).
2016-03-30 00:47:58 +02:00
Drew DeVault b903f7f655 Implement some more on borders
Note that this segfaults ALL THE TIME in wlc code. Paging @Cloudef for
help, I'm at a loss.
2016-03-30 00:47:58 +02:00
Drew DeVault 4611bba3db Initial setup of window border rendering
Please don't complain to me about the performance of this
2016-03-30 00:47:58 +02:00
Drew DeVault 5c85c018b4 Update to new WLC API 2016-03-24 14:08:53 -04:00
Mikkel Oscar Lyderik bb32cba795 Make key handling less strict
Sway has been very strict when it comes to key handling. Only on an
exact match would a bindsym be triggered.

This patch makes it less strict by for instance allowing the key combo
`$mod+1+2` to act as `$mod+2` if 2 was the last pressed key and `$mod+1`
if 1 was the last pressed key.

The new key handling uses the following algorithm:

1. List of bindings sorted by number of keys in binding (already the
default)
2. Find all bindings covered by the current keyboard state and list them
by same order as in 1.
3. Select the first binding from the list where the last pressed key is
part of the binding.

Addresses #452
2016-03-19 14:06:46 +01:00
Mikkel Oscar Lyderik f63512480c Remove unused panel_size (and fix rearrange)
desktop_shell.panel_size was only used to determine if sway should
rearrange the output when rendering the panel in the output_pre_render
hook. This is not needed since the output will have been arranged at
that point.
It also caused sway to rearrange all the time when running with two
or more different monitors/resolutions because panel_size kept changing
with every output_pre_render callback.

Should fix #514
2016-03-17 23:47:42 +01:00
Mikkel Oscar Lyderik 1349a44171 Revert "Render outputs as soon as wlc is ready"
This reverts commit 96458bf63c.
2016-03-17 12:05:32 +01:00
Mikkel Oscar Lyderik 96458bf63c Render outputs as soon as wlc is ready
This makes sure that the outputs are rendered when sway is launched, so
the user doesn't have to move the cursor before the background and bar
gets rendered on screen.

Fixes #509
2016-03-13 17:13:30 +01:00
Mikkel Oscar Lyderik c9d9dd7516 Check for empty ws on view destroyed.
In some cases destroying a view can result in an empty and inactive
workspace, which should be destroyed.

This handles those cases.
2016-02-25 13:36:25 +01:00
Mikkel Oscar Lyderik 6f7cbf2eac Replace deprecated function wlc_output_get_pixels.
This makes IPC GET_PIXELS use the new `wlc_pixels_read` call instead of
the deprecated `wlc_output_get_pixels`.

The old version worked by passing a callback function to wlc which would
grab the pixels and send them to the IPC client.
The new version works by maintaining a list of clients who have
requested the pixels of some output and then grap and send the pixels in
the output_post_render hook of the `wlc_interface`.
2016-02-08 12:39:07 +01:00
Drew DeVault 4546ce1188 Add wlc-render.h to handlers.c 2016-02-08 12:20:24 +01:00
Drew DeVault ef407559e2 Add new wlc thing to views 2016-01-23 16:35:39 -05:00
Cole Mickens 28081b7689 libinput 2016-01-19 06:51:36 -08:00
Mikkel Oscar Lyderik f8b260d4a1 Add support for bincode command
If a bindsym and bincode maps to the same combination, the last one will
overwrite any previous mappings.
2016-01-09 18:07:47 +01:00
Mikkel Oscar Lyderik 15cbc53a77 Make IPC binding event support a compile time opt. 2016-01-08 15:03:25 +01:00
Mikkel Oscar Lyderik 14147ac056 Reduce duplicate code 2016-01-08 14:27:41 +01:00
Mikkel Oscar Lyderik 6392abe35b Implement IPC binding event (keyboard)
This implements the IPC binding event for keyboard bindings.  It is
slightly different from the i3 implementation [1] since sway supports
more than one non-modifier key in a binding. Thus the json interface has
been changed from:

    {
      ...
      "symbol": "t",
      ...
    }

to:

    {
      ...
      "symbols": [ "t" ],
      ...
    }

[1] http://i3wm.org/docs/ipc.html#_binding_event
2016-01-08 03:03:55 +01:00
Mikkel Oscar Lyderik 55f63935ab Implement bindsym --release
This is a "simple" version of --release (same as i3) that only supports
a binding that contain one normal key. e.g.:

    bindsym --release $mod+x exec somthing-fun

I didn't bother implementing it for a combination like `$mod+x+z` since
it is a bit tricky to get right and also a bit weird to actually do on a
keyboard.
2016-01-07 21:43:00 +01:00
Drew DeVault 8f5de70c93 Merge pull request #434 from mikkeloscar/detect-modifier
Send IPC modifier event on bar_modifier up/down
2016-01-06 07:26:54 -05:00
Mikkel Oscar Lyderik 843e2ad2c1 Only send modifier event once for active modifiers
This makes sure that a modifier event is only sent for active bar
modifiers, and that it is only sent once for each of those modifiers.

An active bar modifier is a modifier defined for a bar with `mode hide`
and `hidden_state hide`.
2016-01-05 23:18:59 +01:00
Mikkel Oscar Lyderik c20c63b677 Send IPC modifier event on bar_modifier up/down
Detects when a bar modifier key is pressed/released and sends a modifier
IPC event to any listeners (usually swaybars).

This way a swaybar can listen on the modifier event and hide/show the
bar accordingly (not implemented yet)

The modifier event looks like this:

    {
      "change": "pressed", // or released
      "modifier": "Mod4"
    }
2016-01-05 02:25:56 +01:00
crondog b755fd073e Return focus to fullscreen view
This fixes https://github.com/SirCmpwn/sway/issues/431 by returning
focus to the fullscreen view. Also it fixes the issue with the
fullscreen view pointer not being set which did my head in
2016-01-05 10:55:29 +11:00
Mikkel Oscar Lyderik 7727c9efbc Detect bar modifier pressed/released 2016-01-05 00:49:44 +01:00
Drew DeVault d409620a55 Fix use-after-free when closing fullscreen views 2015-12-29 00:04:12 -05:00
S. Christoffer Eliesen b18f004210 handlers: geometry_request: Better debug output.
Previous output was confusing.
2015-12-28 14:58:17 +01:00
S. Christoffer Eliesen e45fd9b6c5 extensions: Track panels by wl_resource, position per panel.
Track each panel separately via its wl_resource. `set_panel_position`
might be called before `set_panel`, so reuse panel config.

Place the position in panel_config so that each panel has its own
position.
2015-12-20 12:54:34 +01:00
Drew DeVault 3282163f64 Implement compositor support for swaylock
This makes swaylock more or less work.
2015-12-18 19:30:19 -05:00
Drew DeVault f6da4dda4b Bring unmanaged windows to front on output arrange
Fixes #312
2015-12-16 19:20:34 -05:00
Mikkel Oscar Lyderik 3658777e47 Use wlc_point instead of deprecated wlc_origin
Struct was renamed in wlc, use the new name.
2015-12-01 21:04:34 +01:00
Drew DeVault e59cffcea2 Support desktop shell panels in compositor 2015-11-29 12:03:13 -05:00
S. Christoffer Eliesen a06cb7cd01 criteria: Add. Learn for_window command.
A criteria is a string in the form of `[class="regex.*" title="str"]`.
It is stored in a struct with a list of *tokens* which is a
attribute/value pair (stored as a `crit_token` struct). Most tokens will
also have a precompiled regex stored that will be used during criteria
matching.

for_window command: When a new view is created its metadata is tested
against all stored criteria, and if a match is found the associated
command list is executed.

Unfortunately some metadata is not available in sway at the moment
(specifically `instance`, `window_role` and `urgent`). Any criteria
string that tries to match an unsupported attribute will fail.

(Note that while the criteria code can be used to parse any criteria
string it is currently only used by the `for_window` command.)
2015-11-25 14:34:33 +01:00
Drew DeVault 5728307520 Add wallpapers to output command 2015-11-19 18:55:17 -05:00
Drew DeVault 4a1584be53 Fix background extensions
Thanks @Cloudef, it works great
2015-11-19 07:23:11 -05:00
Drew DeVault 65b8a5c3ce Add background handling
This does not work as expected. I think the problem is on the wlc side.
Please review, @Cloudef. To reproduce the issues:

1. Run sway
2. Open terminal in sway
3. Run swaybg

swaybg will create a surface and ask to have it set as the background,
but wlc_handle_from_wl_surface_resource will return 0. If the swaybg
surface is a shell surface, then it works - but wlc complains about the
pointer type and segfaults as soon as the pre-render hook tries to draw
the background.
2015-11-18 22:14:57 -05:00
S. Christoffer Eliesen 236f26f62e output: Support multiple adjacent outputs.
When querying for an adjacent output we now need an absolute position in
order to know which adjacent output that matches. (The position is
either the current mouse position or the center of the currently focused
container, depending on context.)

If two outputs have one edge each that at least partially align with
each other they now count as adjacent.

Seamless mouse is affected by this and now properly moves and positions
itself between outputs with "uneven" placement (as long as they have at
least some part of the edge adjacent to each other).

When focusing or moving a container in a specified direction the center
of the current focused container decides where to look for an adjacent
output. So if e.g. an output has two adjacent outputs to the right and a
"focus right" command is issued then it's the placement of the currently
focused container that decides which output actually gets focused.

Also, if an output has at least one output adjacent in some direction
but the entire edge is not covered (ie. it has "holes" with no outputs),
then the algorithm will choose the output that is closest to the
currently focused container (this does not apply to seamless mouse, the
pointer will just stop at the edge in that case).
2015-11-16 21:32:18 +01:00
Drew DeVault cd161aa985 We somewhat more wlc_point now
Apparently I missed some

cc @Cloudef
2015-11-14 17:14:23 -05:00
S. Christoffer Eliesen 5ba47d4a44 input_state: Remove mouse_origin (x&y). Query wlc instead. 2015-10-29 18:02:02 +01:00
S. Christoffer Eliesen 4799d07ac1 input_state: Extract 'pointer_position_set' function from handlers. 2015-10-29 16:37:19 +01:00
S. Christoffer Eliesen 865b30f138 container: Move container_under_pointer here from handlers. 2015-10-29 16:37:19 +01:00
S. Christoffer Eliesen fabcf7c678 handlers: Pass workspace to workspace_switch, not output. 2015-10-27 23:22:57 +01:00
S. Christoffer Eliesen c6bb23b7dd sway/output: Create, move code from handlers.c here. 2015-10-25 13:14:23 +01:00
Drew DeVault 010368150b Update set_origin to match wlc changes 2015-10-23 14:29:35 -04:00
S. Christoffer Eliesen c1479701de seamless_mouse: Move pointer only if successfully changed workspace.
If e.g. a window has a popup open then that will lock the current focus,
making a workspace switch denied.

So don't move the mouse pointer in such cases.
2015-10-23 16:35:48 +02:00