Getting screen coordinate of a window
Norman Feske
norman.feske at genode-labs.com
Tue Jan 23 11:58:17 CET 2024
Hi Michael,
> Can I get screen coordinates of a window? I would like to be able to
> caputure absolute mouse events and convert them to the window coordinate
> system. I don't want to have relative mouse movement like I see in many
> examples. In my context it doesn't work very well.
>
> BTW the handle_relative_motion never seems to return anything. Is there a
> configuration that I need? Would be terific if I could by some function
> get window internal coordinates, but handle_relative_motion might not be
> something for that?
both the nitpicker GUI server as well as the wm deliver only absolute
motion events. Events delivered by nitpicker refer to the upper-left
corner of the screen. Events delivered by the wm "virtualize" this
upper-left corner so that the real window position is not exposed to the
application. When creating a view at position (0,0), the received motion
events refer to the position within the window.
BTW, the easiest way to see what input events you receive is to print
each event. You can pass an Input::Event directly to the 'log' function.
The wm (specifically the layouter) reports the window layout (including
pixel positions for each window) as "window_layout" report. This report
is normally consumed only by the decorator. By reflecting this report as
a ROM (using report_rom) to your application, you can make the
application aware of the complete layout if you want so. You may have a
look at [1] to see the interplay of the window-management components
(wm, layouter, decorator).
[1]
https://github.com/genodelabs/genode/blob/master/repos/gems/recipes/raw/motif_wm/wm.config
Cheers
Norman
--
Dr.-Ing. Norman Feske
Genode Labs
https://www.genode-labs.com · https://genode.org
Genode Labs GmbH · Amtsgericht Dresden · HRB 28424 · Sitz Dresden
Geschäftsführer: Dr.-Ing. Norman Feske, Christian Helmuth
More information about the users
mailing list