Is it possible to resize a client from the compositor? #90
-
Hello. I've checked the docs for LSurface and couldn't find any function to set a surface's size, only its position. Is there a way to force a surface to resize on the compositor side? Sorry if this is an obvious question. I'm just not very well versed with the Louvre API. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi! I noticed you started developing a compositor some time ago and now you're creating bindings for Nim. That's very cool! A surface on its own only contains a buffer (texture) and some properties like scaling factor, transform, etc. What gives a surface additional "functionality" is a role, which is assigned by the client. Without a role, surfaces shouldn't be displayed (i.e., LSurface::mapped() returns false). When a client assigns a role to a surface, the LSurface::roleChanged() event is triggered. You can access the role with LSurface::role() or with role-specific functions. For example, LSurface::toplevel() returns a pointer to an There are many different roles which are listed here. The one you're probably looking for is LToplevelRole, which represents typical desktop windows. The For example: // Somewhere in your code
#include <LSurface.h>
#include <LToplevelRole.h>
if (surface->toplevel())
surface->toplevel()->configureSize(800, 600); // Not applied immediately // In your own toplevel implementation
void YourToplevelRoleImp::atomsChanged(LBitset<AtomChanges> changes, const Atoms &prevAtoms) {
if (changes.check(WindowGeometryChanged)) {
// Now windowGeometry().size() should be (800x600) (if the client obeyed your request)
// And what was the previous size? : prevAtoms.windowGeometry.size()
}
} I understand that the documentation can be overwhelming and difficult to navigate. As a tip, I recommend always clicking on the |
Beta Was this translation helpful? Give feedback.
-
Thank you for the quick answer! Louvre is quite the joy to write code with, I must admit. I've used wlroots before, and Louvre is leaps more friendlier than it. :^) |
Beta Was this translation helpful? Give feedback.
Hi! I noticed you started developing a compositor some time ago and now you're creating bindings for Nim. That's very cool!
A surface on its own only contains a buffer (texture) and some properties like scaling factor, transform, etc. What gives a surface additional "functionality" is a role, which is assigned by the client. Without a role, surfaces shouldn't be displayed (i.e., LSurface::mapped() returns false). When a client assigns a role to a surface, the LSurface::roleChanged() event is triggered. You can access the role with LSurface::role() or with role-specific functions. For example, LSurface::toplevel() returns a pointer to an
LToplevelRole
, ornullptr
if the surface has another…