aboutsummaryrefslogtreecommitdiff
path: root/sway/handlers.c
AgeCommit message (Collapse)Author
2016-03-30Implement bordersMikkel Oscar Lyderik
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-30Implement some more on bordersDrew DeVault
Note that this segfaults ALL THE TIME in wlc code. Paging @Cloudef for help, I'm at a loss.
2016-03-30Initial setup of window border renderingDrew DeVault
Please don't complain to me about the performance of this
2016-03-24Update to new WLC APIDrew DeVault
2016-03-19Make key handling less strictMikkel Oscar Lyderik
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-17Remove unused panel_size (and fix rearrange)Mikkel Oscar Lyderik
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-17Revert "Render outputs as soon as wlc is ready"Mikkel Oscar Lyderik
This reverts commit 96458bf63c10a702797a8687e2f73d7814a6b079.
2016-03-13Render outputs as soon as wlc is readyMikkel Oscar Lyderik
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-02-25Check for empty ws on view destroyed.Mikkel Oscar Lyderik
In some cases destroying a view can result in an empty and inactive workspace, which should be destroyed. This handles those cases.
2016-02-08Replace deprecated function wlc_output_get_pixels.Mikkel Oscar Lyderik
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-08Add wlc-render.h to handlers.cDrew DeVault
2016-01-23Add new wlc thing to viewsDrew DeVault
2016-01-19libinputCole Mickens
2016-01-09Add support for bincode commandMikkel Oscar Lyderik
If a bindsym and bincode maps to the same combination, the last one will overwrite any previous mappings.
2016-01-08Make IPC binding event support a compile time opt.Mikkel Oscar Lyderik
2016-01-08Reduce duplicate codeMikkel Oscar Lyderik
2016-01-08Implement IPC binding event (keyboard)Mikkel Oscar Lyderik
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-07Implement bindsym --releaseMikkel Oscar Lyderik
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-06Merge pull request #434 from mikkeloscar/detect-modifierDrew DeVault
Send IPC modifier event on bar_modifier up/down
2016-01-05Only send modifier event once for active modifiersMikkel Oscar Lyderik
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-05Send IPC modifier event on bar_modifier up/downMikkel Oscar Lyderik
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-05Return focus to fullscreen viewcrondog
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-05Detect bar modifier pressed/releasedMikkel Oscar Lyderik
2015-12-29Fix use-after-free when closing fullscreen viewsDrew DeVault
2015-12-28handlers: geometry_request: Better debug output.S. Christoffer Eliesen
Previous output was confusing.
2015-12-20extensions: Track panels by wl_resource, position per panel.S. Christoffer Eliesen
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-18Implement compositor support for swaylockDrew DeVault
This makes swaylock more or less work.
2015-12-16Bring unmanaged windows to front on output arrangeDrew DeVault
Fixes #312
2015-12-01Use wlc_point instead of deprecated wlc_originMikkel Oscar Lyderik
Struct was renamed in wlc, use the new name.
2015-11-29Support desktop shell panels in compositorDrew DeVault
2015-11-25criteria: Add. Learn for_window command.S. Christoffer Eliesen
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-19Add wallpapers to output commandDrew DeVault
2015-11-19Fix background extensionsDrew DeVault
Thanks @Cloudef, it works great
2015-11-18Add background handlingDrew DeVault
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-16output: Support multiple adjacent outputs.S. Christoffer Eliesen
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-14We somewhat more wlc_point nowDrew DeVault
Apparently I missed some cc @Cloudef
2015-10-29input_state: Remove mouse_origin (x&y). Query wlc instead.S. Christoffer Eliesen
2015-10-29input_state: Extract 'pointer_position_set' function from handlers.S. Christoffer Eliesen
2015-10-29container: Move container_under_pointer here from handlers.S. Christoffer Eliesen
2015-10-27handlers: Pass workspace to workspace_switch, not output.S. Christoffer Eliesen
2015-10-25sway/output: Create, move code from handlers.c here.S. Christoffer Eliesen
2015-10-23Update set_origin to match wlc changesDrew DeVault
2015-10-23seamless_mouse: Move pointer only if successfully changed workspace.S. Christoffer Eliesen
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-23handlers: Don't switch output when mouse button is pressed.S. Christoffer Eliesen
(E.g. if the user is using a scrollbar at the edge of the screen then switching workspace would cancel the scroll.)
2015-10-22ipc,commands,config: Replace cmd_status enum with cmd_results struct.S. Christoffer Eliesen
In i3 the ipc reply will contain a human readable error message, and this patch replicates that behaviour. However, that error message is also useful for logging, which this patch takes advantage of. E.g. instead of logging errors directly in commands.c/checkargs, it is fed back to the caller which eventually ends up logging everything with maximum context available (config.c/read_config). So instead of logging e.g. "Error on line 'exit'" it will now log: "Error on line 'exit': Can't execute from config."
2015-10-22handlers: Fix swapped top/bottom for seamless transitions.S. Christoffer Eliesen
2015-10-22Move pointer during seamless transitionsDrew DeVault
2015-10-22config: Add "seamless_mouse" to decide if pointer crosses output edges.S. Christoffer Eliesen
2015-10-22Switch to adjacent output when hitting output edge.S. Christoffer Eliesen
(Currently, after switching output the relative position of the mouse stays the same.)
2015-09-22Merge branch 'master' of https://github.com/taiyu-len/swaytaiyu
merge