Skip to content
Snippets Groups Projects

Properly raise windows on activation

Merged Guido Gunther requested to merge guido.gunther/phoc:gtk-shell into master
2 unresolved threads

This is a quick PoC to implement the necessary bit of gtk-shell to fix #93 (closed) for window activation (since the upstream protocol discussion seems to take way longer and so we can safe implementing the toolkit part until this is settled in).

Can be desktop on desktop by e.g. lanunching gedit, selecting help form the menu, putting the help window in the background and seleting help again. The functions used there are the same as e.g. when contacts talks to chatty.

This is leaky, i'll clean this up over the next days.

Closes: #93 (closed)

Edited by Guido Gunther

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
src/gtk-shell.c 0 → 100644
13 #include "desktop.h"
14 #include "gtk-shell.h"
15
16 /**
17 * SECTION:phoc-gtk-shell
18 * @short_description: A minimal implementeation of gtk_shell1 protocol
19 * @Title: PhocGtkShell
20 *
21 * Implement just enough to raise windows for GTK based applications
22 * until there's an agreed on upstream protocol.
23 */
24
25 static void
26 handle_set_dbus_properties(struct wl_client *client,
27 struct wl_resource *resource,
28 const char *application_id,
  • Guido Gunther added 6 commits

    added 6 commits

    • 9289a588 - 1 commit from branch Librem5:master
    • 772011d6 - phosh: Fix indentation
    • abdb41c0 - view: Introduce helper to find a roots_surface from a given wlr_surface
    • 28447752 - protocols: Add gtk-shell v3
    • b5753f06 - Implement gtk-shell's handle_request_focus
    • 76b5db6d - desktop: Wire up gtk-shell

    Compare with previous version

  • Guido Gunther enabled an automatic merge when the pipeline for 76b5db6d succeeds

    enabled an automatic merge when the pipeline for 76b5db6d succeeds

  • merged

    • Just sat down to review it and got surprised when pull on master already got these commits in... ;)

      Anyway, looks good at first glance, although I already started getting rid of view->type switches across the code base and there's only a few left, so I'd rather have that implemented by particular view types instead of introducing yet another one. FWIW, the roots_view_get_from_wlr_surface helper will make !106 (merged) cleaner as well.

    • sorry about that then, i saw you active on matrix the last days but on here so i figured i put that in since it bumps up usability quite a bit over here (and rather hold off the release a couple more days !117 (merged)) so people can test on the devkit. I saw your view->type removal and agree but as written int the commit it'd rather do that more when there's proper gobject interfaces (and it's local to a single function so will be easy to clean up).

    • Hmm... but is this type checking actually needed there? I just tested:

      diff --git a/src/view.c b/src/view.c
      index aa6e949..27ef80c 100644
      --- a/src/view.c
      +++ b/src/view.c
      @@ -959,35 +959,13 @@ roots_view_get_from_wlr_surface (struct wlr_surface *wlr_surface)
       {
         PhocServer *server = phoc_server_get_default ();
         PhocDesktop *desktop = server->desktop;
      -  struct roots_view *view, *found_view = NULL;
      +  struct roots_view *view;
       
         wl_list_for_each(view, &desktop->views, link) {
      -    switch (view->type) {
      -    case ROOTS_XDG_SHELL_VIEW: {
      -      struct roots_xdg_surface *xdg_surface =
      -       roots_xdg_surface_from_view(view);
      -      if (xdg_surface->xdg_surface->surface == wlr_surface)
      -       found_view = view;
      -      break;
      -    }
      -    case ROOTS_XDG_SHELL_V6_VIEW: {
      -      struct roots_xdg_surface_v6 *xdg_surface_v6 =
      -       roots_xdg_surface_v6_from_view(view);
      -      if (xdg_surface_v6->xdg_surface_v6->surface == wlr_surface)
      -       found_view = view;
      -      break;
      -    }
      -#ifdef PHOC_XWAYLAND
      -    case ROOTS_XWAYLAND_VIEW: {
      -      struct roots_xwayland_surface *xwayland_surface =
      -       roots_xwayland_surface_from_view(view);
      -      if (xwayland_surface->xwayland_surface->surface == wlr_surface)
      -       found_view = view;
      -      break;
      -    }
      -#endif
      +    if (view->wlr_surface == wlr_surface) {
      +      return view;
           }
         }
       
      -  return found_view;
      +  return NULL;
       }

      and it appears to work.

    • that works as well and makes things more compact! could you squeeze that into an mr?

    • Please register or sign in to reply
  • Guido Gunther mentioned in issue calls#106

    mentioned in issue calls#106

  • Guido Gunther mentioned in issue #82

    mentioned in issue #82

  • Please register or sign in to reply
    Loading