Skip to content

Add the ability to set the alpha of a Window and retrieve it via WindowInfo#4704

Merged
AlanGriffiths merged 7 commits intomainfrom
feature/window_info_alpha
Feb 26, 2026
Merged

Add the ability to set the alpha of a Window and retrieve it via WindowInfo#4704
AlanGriffiths merged 7 commits intomainfrom
feature/window_info_alpha

Conversation

@mattkae
Copy link
Copy Markdown
Contributor

@mattkae mattkae commented Feb 19, 2026

What's new?

  • Added miral::WindowSpecification::alpha
  • Added miral::WindowInfo::alpha
  • Added mir::scene::Surface::alpha
  • Clamped alpha between 0 and 1 in mir::scene::BasicSurface::set_alpha

How to test

  1. Modify FloatingWindowManager to set an alpha of 0.5 on all new surfaces in place_new_window
  2. Run miral-shell
  3. Watch as your window is transparent!

Checklist

  • Tests added and pass
  • Adequate documentation added
  • (optional) Added Screenshots or videos

@mattkae mattkae requested a review from a team as a code owner February 19, 2026 21:57
Copy link
Copy Markdown
Contributor

@tarek-y-ismail tarek-y-ismail left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than the nits I pointed out, I don't have an issue with this addition. Though, I recall @AlanGriffiths not being 100% convinced? Maybe wait for a review from him as well.

Comment thread debian/libmiral7.symbols Outdated
///
/// \returns the alpha
/// \remark Since MirAL 5.6
auto alpha() -> mir::optional_value<float>&;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get using mir::optional_value for consistency. But shouldn't we start using std::optional for new things at this point?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I figured it would be better to keep it for consistency at this point. I would hate to use an API that mixes the two personally.

Comment thread include/miral/miral/window_specification.h Outdated
Comment thread src/server/symbols.map
Comment on lines -383 to 389
mir::input::CursorObserverMultiplexer::register_interest*;
mir::input::CursorObserverMultiplexer::register_early_observer*;
mir::input::CursorObserverMultiplexer::cursor_moved_to*;
mir::input::CursorObserverMultiplexer::image_set_to*;
mir::input::CursorObserverMultiplexer::operator*;
mir::input::CursorObserverMultiplexer::pointer_unusable*;
mir::input::CursorObserverMultiplexer::pointer_usable*;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm tempted to keep it since I just ran the tool :) And this does put it in alphabetical order. Saves future people from fighting the tool IMO

Comment thread src/server/symbols.map
Comment on lines +1003 to 1004
non-virtual?thunk?to?mir::input::CursorObserverMultiplexer::image_set_to*;
non-virtual?thunk?to?mir::input::CursorObserverMultiplexer::pointer_unusable*;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above, its a minor enough reorder imo

Comment thread src/server/shell/surface_specification.cpp
@AlanGriffiths
Copy link
Copy Markdown
Contributor

  • Modify FloatingWindowManager to set an alpha of 0.5 on all new surfaces in place_new_window

  • Run miral-shell

  • Watch as your window is transparent!

That's a long way down the "manual testing" leg!

@AlanGriffiths
Copy link
Copy Markdown
Contributor

I recall @AlanGriffiths not being 100% convinced?

Apart from the nits you've raised, I don't have concerns.

I remember Saviq pointing out that the existing feature being exposed here might not "do the right thing" when compositing popups and subsurfaces, but that's orthogonal to propagating the surface alpha channel through miral.

@github-actions
Copy link
Copy Markdown

TICS Quality Gate

✔️ Passed

mir

Coding Standards: ✔️ Passed

✔️ Condition “No new Coding Standard Violations for level 1, 2, 3 with respect to Previous analysis” passed.

See the results in the TICS Viewer

The following files have been checked for this project
  • include/miral/miral/window_info.h
  • include/miral/miral/window_specification.h
  • src/include/server/mir/scene/basic_surface.h
  • src/include/server/mir/scene/surface.h
  • src/include/server/mir/shell/surface_specification.h
  • src/miral/window_info.cpp
  • src/miral/window_specification_internal.cpp
  • src/miral/window_specification_internal.h
  • src/miral/window_specification.cpp
  • src/server/scene/application_session.cpp
  • src/server/scene/basic_surface.cpp
  • src/server/shell/surface_specification.cpp

TICS / TICS / Run TICS analysis

Copy link
Copy Markdown
Contributor

@AlanGriffiths AlanGriffiths left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

@AlanGriffiths AlanGriffiths added this pull request to the merge queue Feb 26, 2026
Merged via the queue into main with commit 135b44a Feb 26, 2026
60 of 65 checks passed
@AlanGriffiths AlanGriffiths deleted the feature/window_info_alpha branch February 26, 2026 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants