summaryrefslogtreecommitdiff
path: root/src/apprt/gtk-ng/ui/1.2/surface.blp
blob: 3d17b1d562375b04dec86d79971001e9cef2d0c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
using Gtk 4.0;
using Adw 1;

template $GhosttySurface: Adw.Bin {
  // We need to wrap our Overlay one more time because if you bind a
  // direct child of your widget to a property, it will double free:
  // https://gitlab.gnome.org/GNOME/gtk/-/blob/847571a1e314aba79260e4ef282e2ed9ba91a0d9/gtk/gtkwidget.c#L11423-11425
  Adw.Bin {
    Overlay overlay {
      focusable: false;
      focus-on-click: false;

      GLArea gl_area {
        hexpand: true;
        vexpand: true;
        focusable: true;
        focus-on-click: true;
      }

      [overlay]
      $GhosttyResizeOverlay resize_overlay {
        styles [
          "size-overlay",
        ]
      }

      [overlay]
      Label url_left {
        styles [
          "url-overlay",
        ]

        visible: false;
        halign: start;
        valign: end;
        label: bind template.mouse-hover-url;

        EventControllerMotion url_ec_motion {}
      }

      [overlay]
      Label url_right {
        styles [
          "url-overlay",
        ]

        visible: false;
        halign: end;
        valign: end;
        label: bind template.mouse-hover-url;
      }
    }
  }

  // Event controllers for interactivity
  EventControllerFocus ec_focus {}

  EventControllerKey ec_key {}

  EventControllerMotion ec_motion {}

  EventControllerScroll ec_scroll {}

  GestureClick gesture_click {
    button: 0;
  }
}