Commit graph

52 commits

Author SHA1 Message Date
John Lindgren
9d49d19cd2 include: add config/types.h 2025-08-21 16:55:25 +09:00
John Lindgren
e1475a1e47 include: reduce global includes in labwc.h 2025-07-30 21:04:31 +01:00
John Lindgren
e21fc065c4 include: split output.h from labwc.h 2025-07-30 21:04:31 +01:00
John Lindgren
31d42b50e2 src: include primary header first
This is a common practice in C projects, which simply enforces that
each header must compile cleanly without implicit dependencies on
other headers (see also the previous commit).
2025-07-29 21:51:56 +01:00
Sumandora
e72f862650
src/workspaces.c: allow dragged views to be moved to other workspaces 2025-06-27 13:30:30 +02:00
DreamMaoMao
614c008bea feat: add left-occupied and right-occupied to workspaces_find 2025-06-06 18:35:32 +02:00
tokyo4j
68bf55d724 Add -Wshadow + reformat switch cases
Adding -Wshadow will prevent unintentional variable overrides.

Also, wrapping switch cases with declarations with braces will make our
logic more robust by limiting lifetimes of variables.
2025-05-23 21:32:17 +01:00
tokyo4j
261126fcd0 chase wlroots: let scene restack xwayland surfaces (MR 4756)
Ref: 1133bc15ceb2c2bcb6df692acda6bfa39a292ab5
("Transparently restack xwayland surfaces")

In addition, MR 4772 makes sure the hidden windows are stacked at the
bottom, just like what we did with XWAYLAND_VIEW_HIDDEN.
2025-05-21 06:36:08 +01:00
Dmitry
4f42b7a12b osd: add osd.workspace-switcher.boxes.border.width 2025-04-14 20:06:38 +01:00
Dmitry
79b92d821f osd: fix boxes size and alignment in workspace switcher
Workspace switcher boxes height was 2px more than supposed,
e.g. theme defaults of 20x20 resulted in 20x22 boxes.

The middle of the boxes list was also 1px to the left of the middle
of the osd window.
2025-04-14 20:06:38 +01:00
tokyo4j
140e913c44 project wide: clean up event listeners on shutdown (part 2) 2025-03-13 20:08:59 +00:00
Consolatis
0627190060 keyboard: add keyboard_get_all_modifiers()
And make mousebind handlers use that one.
Also remove keyboard_any_modifiers_pressed() and replace its usage
with the new function.

Without this patch we would only request the modifier state of the
keyboard group which makes mousebinds involving keyboard modifiers
break for virtual keyboards like when using wayvnc. Same story for
hiding the workspace overlay or snapping to regions.

Fixes: #2511
2025-01-13 06:28:37 +09:00
tinyboxvk
1a6dd845a2 Fix typos
Signed-off-by: tinyboxvk <13696594+tinyboxvk@users.noreply.github.com>
2025-01-09 06:59:57 +00:00
Consolatis
8156b91306 ext-workspace protocol integration 2024-12-23 04:14:53 +01:00
Consolatis
5766bec70a cosmic-workspaces: remove workspace_set_hidden() calls
It is a concept that labwc does not support.
2024-12-16 21:28:13 +00:00
Consolatis
b63c8fe411 cosmic-workspaces: add cosmic_ prefix
In preperation for a future ext-workspace integration.
2024-12-16 21:28:13 +00:00
tokyo4j
4502d58eec buffer: remove buffer->cairo
It's more common for cairo_t to have a temporary lifetime and it will
prevent accidentally reusing its previous state.
2024-11-28 18:56:03 +09:00
Consolatis
763ba6209e workspaces: use view_for_each_reverse() to move omnipresent views
This ensures that the view ordering and focus behavior of
omnipresent views is the same when switching workspaces.
2024-11-25 19:21:43 +00:00
Consolatis
77d1747f1b workspaces: keep focus on omnipresent windows when switching workspaces
Fixes: #2329
2024-11-12 20:24:22 +01:00
John Lindgren
d2b161bdf8 buffer: reduce unnecessary painting to new cairo surfaces
Add buffer_adopt_cairo_surface(), which allows wrapping an existing
cairo image surface in a struct lab_data_buffer. This is useful when
loading PNGs since most will be loaded as ARGB32 already.

Fix a memory leak in the non-ARGB32 PNG case, where we do still need to
paint to a new image surface -- we were leaking the original surface.

Eliminate an unnecessary temporary image surface in SVG loading and just
render the SVG to the image surface held by the lab_data_buffer.

I also cleaned up and clarified the buffer API a bit:

- Add a pointer to the held cairo_surface_t (so we can still access it
  if there is no cairo_t).
- Remove the free_on_destroy bool (it was always true).
- Rename unscaled_width/height to logical_width/height and add an
  explanatory comment. It was unclear what "unscaled" meant.
- Rename buffer_create_wrap() to buffer_create_from_data().

This is laying groundwork for some more icon fixes I am working on
(making sure icons are loaded and rendered at the correct scale).
2024-10-06 16:51:14 +01:00
Consolatis
904e0d2e97 cosmic-workspaces: labwc integration 2024-08-03 18:25:23 +02:00
Consolatis
d9866aafa5 workspaces: slight struct reordering 2024-08-02 19:35:36 +02:00
Johan Malm
c3ea956837 Disable pango glyph position rounding
Chase 8c5b23e592

Pango rounds glyph position and widths to nearest integer, which leads to
font dimensions jumping around when rendering with a scale, causing text
geometry to jump around when changing scale.

Disable this rounding to make the geometry stable.
2024-07-19 22:17:42 +01:00
tokyo4j
bc0174d849 workspaces: react to Reconfigure
Changes in `<desktops><names>` or `<desktop><number="" prefix="">` required
restarting labwc to take effect.

This commit adds `workspaces_reconfigure()` to update `server->workspaces` on
Reconfigure.
2024-04-22 05:44:52 +09:00
01micko
8b8652e2b3 workspaces.c: fix bug with RTL locales, closes #1633 2024-03-19 22:09:36 +00:00
Johan Malm
3a959cc74b s/focused_view/active_view/ 2023-12-19 20:34:07 +00:00
kyak
268191fce8
Add theme option to configure boxes from workspace OSD
This allows to configure width and height of "boxes" displayed in the
workspace OSD. A setting of `0` disables the boxes.
2023-12-11 10:41:33 +01:00
Brandon Nason
bad8f334ea Add omnipresent flag for views 2023-11-28 21:41:30 +00:00
Consolatis
6c1ca61ee7 Keep xwayland stacking order in sync when switching workspaces
Until we expose the workspaces to xwayland we need a way to
ensure that xwayland views on the current workspace are always
stacked above xwayland views on other workspaces.

If we fail to do so, issues arise in scenarios where we change
the mouse focus but do not change the (xwayland) stacking order.

Reproducer:
- If followMouse is enabled, raiseOnFocus must be disabled
- Open at least two xwayland windows which allow scrolling
  (some X11 terminal with 'man man' for example)
- Switch to another workspace, open another xwayland window
  which allows scrolling and maximize it
- Switch back to the previous workspace with the two windows
- Move the mouse to the xwayland window that does *not* have
  focus
- Start scrolling
- All scroll events should end up on the maximized window on
  the other workspace

This patch fixes the issue by simply raising all windows from
the current workspace again in their original stacking order
when switching workspaces.

Reported-by: Domo via IRC (thanks!)
2023-11-21 22:31:05 +01:00
Consolatis
13d0b14244 Update top layer visiblity on workspace switch
Fixes: #1158
2023-11-12 17:39:00 +00:00
Consolatis
b359b1560c Move keyboard functions into input/keyboard.h 2023-10-30 21:14:04 +00:00
Consus
e864419194 workspaces: allow referencing the current workspace
This value allows a user to reference the currently visible workspace.
2023-10-01 14:17:29 +01:00
John Lindgren
7e72bf975f view/xwayland: avoid focusing views that don't want focus
XWayland views can self-declare that they don't want keyboard focus via
the ICCCM WM_HINTS property. Most of the logic is already in place to
avoid giving focus to such views (e.g. taskbars).

Add a couple of missing pieces to make this work:

- Hook up view_isfocusable() to look at WM_HINTS for XWayland views
- Adjust desktop_focus_topmost_mapped_view() to skip unfocusable views
2023-09-29 18:04:32 +01:00
John Lindgren
4028a9482f seat: use focus_change event to update focused/active view
- Connect to wlr_seat_keyboard_state's focus_change event.
- Add view_from_wlr_surface(), which does what the name says.
- Use focus_change event along with view_from_wlr_surface() to update
  server->focused_view and set SSD states via view_set_activated().
- Eliminate desktop_focused_view() since server->focused_view should be
  reliably up-to-date now.
- Eliminate view_focus/defocus() since we can now just call
  seat_focus_surface() directly.
2023-09-28 22:52:30 +01:00
John Lindgren
e5aef03319 desktop: switch workspaces and optionally raise in desktop_focus_view()
Make desktop_focus_view() always switch to the workspace containing the
view being focused. It doesn't make much sense for an invisible view to
have the keyboard focus.

Also add an optional "raise" parameter to desktop_focus_view(). This
allows the common pattern of desktop_focus_view() + view_move_to_front()
to be reduced to a single function call.
2023-09-28 03:38:51 +02:00
Johan Malm
b200dd2e7b osd: use theme->osd_border_width for focused item 2023-06-29 19:14:08 +01:00
Tomi Ollila
f2c3f83041 action: support {Go,Send}ToDesktop 'wrap' option
Make wrap 'true' by default for both GoToDesktop and SendToDesktop,
in order to default to the current behaviour, and to stay consistent
with Openbox behaviour.
2023-05-21 22:32:07 +02:00
Consolatis
f2aa030aac src/workspaces.c: do not render OSD on disabled outputs
Fixes #914
2023-05-17 13:56:11 +02:00
Consolatis
037dace5bc src/workspaces.c: update cursor focus
Fixes #807
2023-03-05 21:07:58 +00:00
Consolatis
e39fd341ec src/workspaces.c: prevent re-focus for always-on-top views
Before this patch a focused always-on-top view lost its keyboard
focus when switching workspaces. Now the view keeps its focus.
2022-12-29 18:58:25 +01:00
Consolatis
f7c8663f67 src/workspaces.c: use cached server pointer 2022-12-29 18:58:25 +01:00
John Lindgren
957d9e5926 ssd: Cosmetic cleanups
- Minimize includes in `ssd.h`
- Avoid repetitive `view->ssd.margin` pattern
- Use `struct ssd *` or `const struct ssd *` rather than `struct view *`
  where convenient

Part of the motivation is to make it easier to separate `struct ssd`
from `struct view` in a future commit.
2022-11-26 21:24:46 +00:00
John Lindgren
c67c6691ac view: Rename/move workspaces_send_to() to view_move_to_workspace()
This function semantically belongs in view.c since it
modifies `struct view`.

Also a minor formatting fix in view_toggle_always_on_top().
2022-11-22 09:17:33 +01:00
John Lindgren
f08e931a29 include: Break out view.h from labwc.h
IMHO it encourages better design (by making dependencies more obvious)
to have source file/header file pairs like view.c/view.h, rather than a
monolithic header like labwc.h with everything in it.

I don't think we need to break up all of labwc.h at once, but maybe we
can start pulling it apart bit by bit as it's convenient.

Also:

- Move "struct border" to ssd.h so that view.h can use it without pulling
  in all of labwc.h.
- Add a missing required #include within scaled_font_buffer.h (forward
  declaration of "struct font" is not enough).
2022-11-21 21:42:37 +00:00
Consolatis
89ad0b808f s/wl_list_insert(list.prev...)/wl_list_append(list...)/ 2022-10-05 19:50:36 +01:00
Johan Malm
d424514e24 Fix minor coding-style violations
...based on https://github.com/johanmalm/checkpatch.pl
2022-09-22 22:39:44 +01:00
John Lindgren
a54d378e6c common: Add znew/znew_n() macros 2022-09-18 15:25:19 -04:00
John Lindgren
cb40cdc36c common: Add additional memory utilities (xzalloc() etc.) 2022-09-17 10:57:30 -04:00
John Lindgren
07a83c19f0 config: Add support for font slant and weight 2022-09-15 21:48:05 +01:00
Consolatis
fb36463c34 common/graphic-helpers: Add cairo helpers 2022-08-20 22:16:52 +01:00