summaryrefslogtreecommitdiff
path: root/include/sway/desktop
diff options
context:
space:
mode:
authorReza Jelveh <[email protected]>2024-04-15 13:39:41 +0800
committerGitHub <[email protected]>2024-04-15 01:39:41 -0400
commitfb86ed6b0588dfdebfb66ce875bc63cfa0a897f6 (patch)
tree29857a1769107adc58696f08d379f608aa4e29a2 /include/sway/desktop
parenta5e79676c4bd22fc5902182acf0667907202a465 (diff)
feat: 1.9 merge (#277)
Co-authored-by: William McKinnon <[email protected]> Co-authored-by: Erik Reider <[email protected]>
Diffstat (limited to 'include/sway/desktop')
-rw-r--r--include/sway/desktop/fx_renderer/fx_framebuffer.h27
-rw-r--r--include/sway/desktop/fx_renderer/fx_renderer.h236
-rw-r--r--include/sway/desktop/fx_renderer/fx_stencilbuffer.h18
-rw-r--r--include/sway/desktop/fx_renderer/fx_texture.h22
-rw-r--r--include/sway/desktop/fx_renderer/matrix.h9
-rw-r--r--include/sway/desktop/idle_inhibit_v1.h12
-rw-r--r--include/sway/desktop/launcher.h12
7 files changed, 13 insertions, 323 deletions
diff --git a/include/sway/desktop/fx_renderer/fx_framebuffer.h b/include/sway/desktop/fx_renderer/fx_framebuffer.h
deleted file mode 100644
index 3372cd00..00000000
--- a/include/sway/desktop/fx_renderer/fx_framebuffer.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef FX_FRAMEBUFFER_H
-#define FX_FRAMEBUFFER_H
-
-#include <GLES2/gl2.h>
-#include <stdbool.h>
-#include <wlr/types/wlr_output.h>
-
-#include "sway/desktop/fx_renderer/fx_stencilbuffer.h"
-#include "sway/desktop/fx_renderer/fx_texture.h"
-
-struct fx_framebuffer {
- GLuint fb;
- struct fx_stencilbuffer stencil_buffer;
- struct fx_texture texture;
-};
-
-struct fx_framebuffer fx_framebuffer_create();
-
-void fx_framebuffer_bind(struct fx_framebuffer *buffer);
-
-void fx_framebuffer_update(struct fx_framebuffer *buffer, int width, int height);
-
-void fx_framebuffer_add_stencil_buffer(struct fx_framebuffer *buffer, int width, int height);
-
-void fx_framebuffer_release(struct fx_framebuffer *buffer);
-
-#endif
diff --git a/include/sway/desktop/fx_renderer/fx_renderer.h b/include/sway/desktop/fx_renderer/fx_renderer.h
deleted file mode 100644
index 7643caaf..00000000
--- a/include/sway/desktop/fx_renderer/fx_renderer.h
+++ /dev/null
@@ -1,236 +0,0 @@
-#ifndef _SWAY_OPENGL_H
-#define _SWAY_OPENGL_H
-
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-#include <stdbool.h>
-#include <wlr/render/egl.h>
-
-#include "sway/desktop/fx_renderer/fx_framebuffer.h"
-#include "sway/desktop/fx_renderer/fx_texture.h"
-
-enum corner_location { TOP_LEFT, TOP_RIGHT, BOTTOM_RIGHT, BOTTOM_LEFT, ALL, NONE };
-
-enum fx_tex_shader_source {
- SHADER_SOURCE_TEXTURE_RGBA = 1,
- SHADER_SOURCE_TEXTURE_RGBX = 2,
- SHADER_SOURCE_TEXTURE_EXTERNAL = 3,
-};
-
-enum fx_rounded_quad_shader_source {
- SHADER_SOURCE_QUAD_ROUND = 1,
- SHADER_SOURCE_QUAD_ROUND_TOP_LEFT = 2,
- SHADER_SOURCE_QUAD_ROUND_TOP_RIGHT = 3,
- SHADER_SOURCE_QUAD_ROUND_BOTTOM_RIGHT = 4,
- SHADER_SOURCE_QUAD_ROUND_BOTTOM_LEFT = 5,
-};
-
-struct decoration_data {
- float alpha;
- float saturation;
- int corner_radius;
- float dim;
- float *dim_color;
- bool has_titlebar;
- bool discard_transparent;
- bool blur;
- bool shadow;
-};
-
-struct blur_shader {
- GLuint program;
- GLint proj;
- GLint tex;
- GLint pos_attrib;
- GLint tex_attrib;
- GLint radius;
- GLint halfpixel;
-};
-
-struct effects_shader {
- GLuint program;
- GLint proj;
- GLint tex;
- GLint pos_attrib;
- GLint tex_attrib;
- GLfloat noise;
- GLfloat brightness;
- GLfloat contrast;
- GLfloat saturation;
-};
-
-struct box_shadow_shader {
- GLuint program;
- GLint proj;
- GLint color;
- GLint pos_attrib;
- GLint position;
- GLint size;
- GLint blur_sigma;
- GLint corner_radius;
-};
-
-struct corner_shader {
- GLuint program;
- GLint proj;
- GLint color;
- GLint pos_attrib;
- GLint is_top_left;
- GLint is_top_right;
- GLint is_bottom_left;
- GLint is_bottom_right;
- GLint position;
- GLint radius;
- GLint half_size;
- GLint half_thickness;
-};
-
-struct quad_shader {
- GLuint program;
- GLint proj;
- GLint color;
- GLint pos_attrib;
-};
-
-struct rounded_quad_shader {
- GLuint program;
- GLint proj;
- GLint color;
- GLint pos_attrib;
- GLint size;
- GLint position;
- GLint radius;
-};
-
-struct stencil_mask_shader {
- GLuint program;
- GLint proj;
- GLint color;
- GLint pos_attrib;
- GLint half_size;
- GLint position;
- GLint radius;
-};
-
-struct tex_shader {
- GLuint program;
- GLint proj;
- GLint tex;
- GLint alpha;
- GLint pos_attrib;
- GLint tex_attrib;
- GLint size;
- GLint position;
- GLint radius;
- GLint saturation;
- GLint dim;
- GLint dim_color;
- GLint has_titlebar;
- GLint discard_transparent;
-};
-
-struct fx_renderer {
- float projection[9];
-
- int viewport_width, viewport_height;
-
- struct wlr_output *wlr_output;
-
- // The framebuffer used by wlroots
- struct fx_framebuffer wlr_buffer;
- // Contains the blurred background for tiled windows
- struct fx_framebuffer blur_buffer;
- // Contains the original pixels to draw over the areas where artifact are visible
- struct fx_framebuffer blur_saved_pixels_buffer;
- // Blur swaps between the two effects buffers everytime it scales the image
- // Buffer used for effects
- struct fx_framebuffer effects_buffer;
- // Swap buffer used for effects
- struct fx_framebuffer effects_buffer_swapped;
-
- // The region where there's blur
- pixman_region32_t blur_padding_region;
-
- bool blur_buffer_dirty;
-
- struct {
- bool OES_egl_image_external;
- } exts;
-
- struct {
- PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOES;
- } procs;
-
- struct {
- struct box_shadow_shader box_shadow;
- struct blur_shader blur1;
- struct blur_shader blur2;
- struct effects_shader blur_effects;
- struct corner_shader corner;
- struct quad_shader quad;
- struct rounded_quad_shader rounded_quad;
- struct rounded_quad_shader rounded_tl_quad;
- struct rounded_quad_shader rounded_tr_quad;
- struct rounded_quad_shader rounded_bl_quad;
- struct rounded_quad_shader rounded_br_quad;
- struct stencil_mask_shader stencil_mask;
- struct tex_shader tex_rgba;
- struct tex_shader tex_rgbx;
- struct tex_shader tex_ext;
- } shaders;
-};
-
-struct decoration_data get_undecorated_decoration_data();
-
-struct fx_renderer *fx_renderer_create(struct wlr_egl *egl, struct wlr_output *output);
-
-void fx_renderer_fini(struct fx_renderer *renderer);
-
-void fx_renderer_begin(struct fx_renderer *renderer, int width, int height);
-
-void fx_renderer_end(struct fx_renderer *renderer);
-
-void fx_renderer_clear(const float color[static 4]);
-
-void fx_renderer_scissor(struct wlr_box *box);
-
-// Initialize the stenciling work
-void fx_renderer_stencil_mask_init();
-
-// Close the mask
-void fx_renderer_stencil_mask_close(bool draw_inside_mask);
-
-// Finish stenciling and clear the buffer
-void fx_renderer_stencil_mask_fini();
-
-bool fx_render_subtexture_with_matrix(struct fx_renderer *renderer, struct fx_texture *fx_texture,
- const struct wlr_fbox *src_box, const struct wlr_box *dst_box, const float matrix[static 9],
- struct decoration_data deco_data);
-
-bool fx_render_texture_with_matrix(struct fx_renderer *renderer, struct fx_texture *fx_texture,
- const struct wlr_box *dst_box, const float matrix[static 9], struct decoration_data deco_data);
-
-void fx_render_rect(struct fx_renderer *renderer, const struct wlr_box *box,
- const float color[static 4], const float projection[static 9]);
-
-void fx_render_rounded_rect(struct fx_renderer *renderer, const struct wlr_box *box,
- const float color[static 4], const float matrix[static 9], int radius,
- enum corner_location corner_location);
-
-void fx_render_border_corner(struct fx_renderer *renderer, const struct wlr_box *box,
- const float color[static 4], const float matrix[static 9],
- enum corner_location corner_location, int radius, int border_thickness);
-
-void fx_render_box_shadow(struct fx_renderer *renderer, const struct wlr_box *box,
- const struct wlr_box *inner_box, const float color[static 4],
- const float matrix[static 9], int corner_radius, float blur_sigma);
-
-void fx_render_blur(struct fx_renderer *renderer, const float matrix[static 9],
- struct fx_framebuffer **buffer, struct blur_shader *shader,
- const struct wlr_box *box, int blur_radius);
-
-void fx_render_blur_effects(struct fx_renderer *renderer, const float matrix[static 9],
- struct fx_framebuffer **buffer, float blur_noise, float blur_brightness,
- float blur_contrast, float blur_saturation);
-
-#endif
diff --git a/include/sway/desktop/fx_renderer/fx_stencilbuffer.h b/include/sway/desktop/fx_renderer/fx_stencilbuffer.h
deleted file mode 100644
index 157c0282..00000000
--- a/include/sway/desktop/fx_renderer/fx_stencilbuffer.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef FX_STENCILBUFFER_H
-#define FX_STENCILBUFFER_H
-
-#include <GLES2/gl2.h>
-#include <stdbool.h>
-#include <wlr/render/wlr_texture.h>
-
-struct fx_stencilbuffer {
- GLuint rb;
- int width;
- int height;
-};
-
-struct fx_stencilbuffer fx_stencilbuffer_create();
-
-void fx_stencilbuffer_release(struct fx_stencilbuffer *stencil_buffer);
-
-#endif
diff --git a/include/sway/desktop/fx_renderer/fx_texture.h b/include/sway/desktop/fx_renderer/fx_texture.h
deleted file mode 100644
index 62e635e6..00000000
--- a/include/sway/desktop/fx_renderer/fx_texture.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef FX_TEXTURE_H
-#define FX_TEXTURE_H
-
-#include <GLES2/gl2.h>
-#include <stdbool.h>
-#include <wlr/render/wlr_texture.h>
-
-struct fx_texture {
- GLuint target;
- GLuint id;
- bool has_alpha;
- int width;
- int height;
-};
-
-struct fx_texture fx_texture_create();
-
-struct fx_texture fx_texture_from_wlr_texture(struct wlr_texture *tex);
-
-void fx_texture_release(struct fx_texture *texture);
-
-#endif
diff --git a/include/sway/desktop/fx_renderer/matrix.h b/include/sway/desktop/fx_renderer/matrix.h
deleted file mode 100644
index 6931e8d2..00000000
--- a/include/sway/desktop/fx_renderer/matrix.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef _MATRIX_H
-#define _MATRIX_H
-
-#include <wlr/types/wlr_output.h>
-
-void matrix_projection(float mat[static 9], int width, int height,
- enum wl_output_transform transform);
-
-#endif
diff --git a/include/sway/desktop/idle_inhibit_v1.h b/include/sway/desktop/idle_inhibit_v1.h
index 58d54c68..84cc666d 100644
--- a/include/sway/desktop/idle_inhibit_v1.h
+++ b/include/sway/desktop/idle_inhibit_v1.h
@@ -1,8 +1,6 @@
#ifndef _SWAY_DESKTOP_IDLE_INHIBIT_V1_H
#define _SWAY_DESKTOP_IDLE_INHIBIT_V1_H
#include <wlr/types/wlr_idle_inhibit_v1.h>
-#include <wlr/types/wlr_idle.h>
-#include "sway/server.h"
enum sway_idle_inhibit_mode {
INHIBIT_IDLE_APPLICATION, // Application set inhibitor (when visible)
@@ -16,12 +14,9 @@ struct sway_idle_inhibit_manager_v1 {
struct wlr_idle_inhibit_manager_v1 *wlr_manager;
struct wl_listener new_idle_inhibitor_v1;
struct wl_list inhibitors;
-
- struct wlr_idle *idle;
};
struct sway_idle_inhibitor_v1 {
- struct sway_idle_inhibit_manager_v1 *manager;
struct wlr_idle_inhibitor_v1 *wlr_inhibitor;
struct sway_view *view;
enum sway_idle_inhibit_mode mode;
@@ -33,8 +28,7 @@ struct sway_idle_inhibitor_v1 {
bool sway_idle_inhibit_v1_is_active(
struct sway_idle_inhibitor_v1 *inhibitor);
-void sway_idle_inhibit_v1_check_active(
- struct sway_idle_inhibit_manager_v1 *manager);
+void sway_idle_inhibit_v1_check_active(void);
void sway_idle_inhibit_v1_user_inhibitor_register(struct sway_view *view,
enum sway_idle_inhibit_mode mode);
@@ -48,6 +42,6 @@ struct sway_idle_inhibitor_v1 *sway_idle_inhibit_v1_application_inhibitor_for_vi
void sway_idle_inhibit_v1_user_inhibitor_destroy(
struct sway_idle_inhibitor_v1 *inhibitor);
-struct sway_idle_inhibit_manager_v1 *sway_idle_inhibit_manager_v1_create(
- struct wl_display *wl_display, struct wlr_idle *idle);
+bool sway_idle_inhibit_manager_v1_init(void);
+
#endif
diff --git a/include/sway/desktop/launcher.h b/include/sway/desktop/launcher.h
index 3b577f74..412068a9 100644
--- a/include/sway/desktop/launcher.h
+++ b/include/sway/desktop/launcher.h
@@ -2,14 +2,19 @@
#define _SWAY_LAUNCHER_H
#include <stdlib.h>
+#include <wayland-server-core.h>
+#include "sway/input/seat.h"
struct launcher_ctx {
pid_t pid;
- char *name;
+ char *fallback_name;
struct wlr_xdg_activation_token_v1 *token;
struct wl_listener token_destroy;
+ struct sway_seat *seat;
+ struct wl_listener seat_destroy;
bool activated;
+ bool had_focused_surface;
struct sway_node *node;
struct wl_listener node_destroy;
@@ -25,7 +30,10 @@ void launcher_ctx_consume(struct launcher_ctx *ctx);
void launcher_ctx_destroy(struct launcher_ctx *ctx);
-struct launcher_ctx *launcher_ctx_create(void);
+struct launcher_ctx *launcher_ctx_create_internal(void);
+
+struct launcher_ctx *launcher_ctx_create(
+ struct wlr_xdg_activation_token_v1 *token, struct sway_node *node);
const char *launcher_ctx_get_token_name(struct launcher_ctx *ctx);