Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

calculate gdk win32 monitor offset #3208

Open
totaam opened this issue Jul 17, 2021 · 1 comment
Open

calculate gdk win32 monitor offset #3208

totaam opened this issue Jul 17, 2021 · 1 comment
Labels
enhancement New feature or request geometry win32 MS Windows OS

Comments

@totaam
Copy link
Collaborator

totaam commented Jul 17, 2021

So we can reliably convert between GDK coordinates (unsigned) and win32 coordinates (signed).
This is needed for #2943 and multi-monitors.
The offset values are in a private header, and are not exposed directly anywhere.

Here's how they are calculated:

  _gdk_offset_x = G_MININT;
  _gdk_offset_y = G_MININT;

  for (i = 0; i < data.monitors->len; i++)
    {
      GdkWin32Monitor *m;
      GdkRectangle rect;

      m = g_ptr_array_index (data.monitors, i);

      /* Calculate offset */
      gdk_monitor_get_geometry (GDK_MONITOR (m), &rect);
      _gdk_offset_x = MAX (_gdk_offset_x, -rect.x);
      _gdk_offset_y = MAX (_gdk_offset_y, -rect.y);
    }

Problems:

  • ("making stuff up as we go") looks no different, so the offset will be G_MININT? How does it know to make stuff up?
  • They filter out monitors... so if we don't do exactly the same thing, we will get a different offset
  • This will need to be re-calculated whenever monitors are added or removed

Since the offset is global, perhaps we can just calculate it as long as we have at least one window on-screen?

@totaam
Copy link
Collaborator Author

totaam commented Jul 25, 2022

Seeing the direction that GTK is taking (removing essential features because Wayland does not have them: #1977), it may be best to just replace GTK: #1995.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request geometry win32 MS Windows OS
Projects
None yet
Development

No branches or pull requests

1 participant