Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 927931 | Differences between
and this patch

Collapse All | Expand All

(-)a/intern/ghost/intern/GHOST_WindowWayland.cc (-7 / +46 lines)
Lines 65-70 static constexpr size_t base_dpi = 96; Link Here
65
struct WGL_LibDecor_Window {
65
struct WGL_LibDecor_Window {
66
  libdecor_frame *frame = nullptr;
66
  libdecor_frame *frame = nullptr;
67
67
68
  /**
69
   * Store the last size applied from #libdecor_frame_interface::configure
70
   * This is meant to be equivalent of calling:
71
   * `libdecor_frame_get_content_width(frame)`
72
   * `libdecor_frame_get_content_height(frame)`
73
   * However these functions are only available via the plugin API,
74
   * so they need to be stored somewhere.
75
   */
76
  struct {
77
    int32_t size[2] = {0, 0};
78
  } applied;
79
68
  /**
80
  /**
69
   * Used at startup to set the initial window size
81
   * Used at startup to set the initial window size
70
   * (before fractional scale information is available).
82
   * (before fractional scale information is available).
Lines 73-78 struct WGL_LibDecor_Window { Link Here
73
85
74
  /** The window has been configured (see #xdg_surface_ack_configure). */
86
  /** The window has been configured (see #xdg_surface_ack_configure). */
75
  bool initial_configure_seen = false;
87
  bool initial_configure_seen = false;
88
  /** The window size has been configured. */
89
  bool initial_configure_seen_with_size = false;
76
  /** The window state has been configured. */
90
  /** The window state has been configured. */
77
  bool initial_state_seen = false;
91
  bool initial_state_seen = false;
78
};
92
};
Lines 1153-1164 static void libdecor_frame_handle_configure(libdecor_frame *frame, Link Here
1153
  GWL_WindowFrame *frame_pending = &static_cast<GWL_Window *>(data)->frame_pending;
1167
  GWL_WindowFrame *frame_pending = &static_cast<GWL_Window *>(data)->frame_pending;
1154
1168
1155
  /* Set the size. */
1169
  /* Set the size. */
1156
  int size_decor[2]{
1157
      libdecor_frame_get_content_width(frame),
1158
      libdecor_frame_get_content_height(frame),
1159
  };
1160
  int size_next[2] = {0, 0};
1170
  int size_next[2] = {0, 0};
1161
  bool has_size = false;
1171
  bool has_size = false;
1172
1173
  /* Keep track the current size of window decorations (last set by this function). */
1174
  int size_decor[2] = {0, 0};
1175
1176
  {
1177
    const GWL_Window *win = static_cast<GWL_Window *>(data);
1178
    const WGL_LibDecor_Window &decor = *win->libdecor;
1179
    if (decor.initial_configure_seen_with_size) {
1180
      size_decor[0] = decor.applied.size[0];
1181
      size_decor[1] = decor.applied.size[1];
1182
    }
1183
  }
1184
1162
  {
1185
  {
1163
    GWL_Window *win = static_cast<GWL_Window *>(data);
1186
    GWL_Window *win = static_cast<GWL_Window *>(data);
1164
    const int fractional_scale = win->frame.fractional_scale ?
1187
    const int fractional_scale = win->frame.fractional_scale ?
Lines 1259-1270 static void libdecor_frame_handle_configure(libdecor_frame *frame, Link Here
1259
    GWL_Window *win = static_cast<GWL_Window *>(data);
1282
    GWL_Window *win = static_cast<GWL_Window *>(data);
1260
    WGL_LibDecor_Window &decor = *win->libdecor;
1283
    WGL_LibDecor_Window &decor = *win->libdecor;
1261
    if (has_size == false) {
1284
    if (has_size == false) {
1285
      /* Keep the current decor size. */
1262
      size_next[0] = size_decor[0];
1286
      size_next[0] = size_decor[0];
1263
      size_next[1] = size_decor[1];
1287
      size_next[1] = size_decor[1];
1264
    }
1288
    }
1265
    libdecor_state *state = libdecor_state_new(UNPACK2(size_next));
1289
    else {
1266
    libdecor_frame_commit(frame, state, configuration);
1290
      /* Store the new size for later reuse. */
1267
    libdecor_state_free(state);
1291
      decor.applied.size[0] = size_next[0];
1292
      decor.applied.size[1] = size_next[1];
1293
    }
1294
1295
    if (size_next[0] && size_next[1]) {
1296
      libdecor_state *state = libdecor_state_new(UNPACK2(size_next));
1297
      libdecor_frame_commit(frame, state, configuration);
1298
      libdecor_state_free(state);
1299
    }
1268
1300
1269
    /* Only ever use this once, after initial creation:
1301
    /* Only ever use this once, after initial creation:
1270
     * #wp_fractional_scale_v1_listener::preferred_scale provides fractional scaling values. */
1302
     * #wp_fractional_scale_v1_listener::preferred_scale provides fractional scaling values. */
Lines 1278-1283 static void libdecor_frame_handle_configure(libdecor_frame *frame, Link Here
1278
        decor.initial_state_seen = true;
1310
        decor.initial_state_seen = true;
1279
      }
1311
      }
1280
    }
1312
    }
1313
    if (decor.initial_configure_seen_with_size == false) {
1314
      if (is_main_thread) {
1315
        if (size_next[0] && size_next[1]) {
1316
          decor.initial_configure_seen_with_size = true;
1317
        }
1318
      }
1319
    }
1281
  }
1320
  }
1282
}
1321
}
1283
1322
(-)a/intern/wayland_dynload/extern/wayland_dynload_libdecor.h (-8 lines)
Lines 21-28 WAYLAND_DYNLOAD_FN(libdecor_configuration_get_window_state) Link Here
21
WAYLAND_DYNLOAD_FN(libdecor_decorate)
21
WAYLAND_DYNLOAD_FN(libdecor_decorate)
22
WAYLAND_DYNLOAD_FN(libdecor_dispatch)
22
WAYLAND_DYNLOAD_FN(libdecor_dispatch)
23
WAYLAND_DYNLOAD_FN(libdecor_frame_commit)
23
WAYLAND_DYNLOAD_FN(libdecor_frame_commit)
24
WAYLAND_DYNLOAD_FN(libdecor_frame_get_content_height)
25
WAYLAND_DYNLOAD_FN(libdecor_frame_get_content_width)
26
WAYLAND_DYNLOAD_FN(libdecor_frame_get_xdg_toplevel)
24
WAYLAND_DYNLOAD_FN(libdecor_frame_get_xdg_toplevel)
27
WAYLAND_DYNLOAD_FN(libdecor_frame_map)
25
WAYLAND_DYNLOAD_FN(libdecor_frame_map)
28
WAYLAND_DYNLOAD_FN(libdecor_frame_set_app_id)
26
WAYLAND_DYNLOAD_FN(libdecor_frame_set_app_id)
Lines 78-85 struct WaylandDynload_Libdecor { Link Here
78
  void WL_DYN_FN(libdecor_frame_commit)(struct libdecor_frame *frame,
76
  void WL_DYN_FN(libdecor_frame_commit)(struct libdecor_frame *frame,
79
                                        struct libdecor_state *state,
77
                                        struct libdecor_state *state,
80
                                        struct libdecor_configuration *configuration);
78
                                        struct libdecor_configuration *configuration);
81
  int WL_DYN_FN(libdecor_frame_get_content_width)(struct libdecor_frame *frame);
82
  int WL_DYN_FN(libdecor_frame_get_content_height)(struct libdecor_frame *frame);
83
  struct xdg_toplevel *WL_DYN_FN(libdecor_frame_get_xdg_toplevel)(struct libdecor_frame *frame);
79
  struct xdg_toplevel *WL_DYN_FN(libdecor_frame_get_xdg_toplevel)(struct libdecor_frame *frame);
84
  void WL_DYN_FN(libdecor_frame_map)(struct libdecor_frame *frame);
80
  void WL_DYN_FN(libdecor_frame_map)(struct libdecor_frame *frame);
85
  void WL_DYN_FN(libdecor_frame_set_app_id)(struct libdecor_frame *frame, const char *app_id);
81
  void WL_DYN_FN(libdecor_frame_set_app_id)(struct libdecor_frame *frame, const char *app_id);
Lines 116-125 struct WaylandDynload_Libdecor { Link Here
116
#      define libdecor_dispatch(...) (*wayland_dynload_libdecor.libdecor_dispatch)(__VA_ARGS__)
112
#      define libdecor_dispatch(...) (*wayland_dynload_libdecor.libdecor_dispatch)(__VA_ARGS__)
117
#      define libdecor_frame_commit(...) \
113
#      define libdecor_frame_commit(...) \
118
        (*wayland_dynload_libdecor.libdecor_frame_commit)(__VA_ARGS__)
114
        (*wayland_dynload_libdecor.libdecor_frame_commit)(__VA_ARGS__)
119
#      define libdecor_frame_get_content_height(...) \
120
        (*wayland_dynload_libdecor.libdecor_frame_get_content_height)(__VA_ARGS__)
121
#      define libdecor_frame_get_content_width(...) \
122
        (*wayland_dynload_libdecor.libdecor_frame_get_content_width)(__VA_ARGS__)
123
#      define libdecor_frame_get_xdg_toplevel(...) \
115
#      define libdecor_frame_get_xdg_toplevel(...) \
124
        (*wayland_dynload_libdecor.libdecor_frame_get_xdg_toplevel)(__VA_ARGS__)
116
        (*wayland_dynload_libdecor.libdecor_frame_get_xdg_toplevel)(__VA_ARGS__)
125
#      define libdecor_frame_map(...) (*wayland_dynload_libdecor.libdecor_frame_map)(__VA_ARGS__)
117
#      define libdecor_frame_map(...) (*wayland_dynload_libdecor.libdecor_frame_map)(__VA_ARGS__)

Return to bug 927931