mirror of
https://github.com/lbonn/rofi
synced 2024-11-26 22:00:20 +00:00
Display something on wayland with layer shell
Based on sardemff7 previous wayland attempt
This commit is contained in:
parent
c0b429f56c
commit
7d94413675
10 changed files with 2837 additions and 7 deletions
|
@ -106,4 +106,13 @@ void display_dump_monitor_layout ( void );
|
|||
*/
|
||||
void display_startup_notification ( RofiHelperExecuteContext *context, GSpawnChildSetupFunc *child_setup, gpointer *user_data );
|
||||
|
||||
|
||||
// !
|
||||
typedef struct _display_buffer_pool display_buffer_pool;
|
||||
display_buffer_pool *display_buffer_pool_new(gint width, gint height);
|
||||
void display_buffer_pool_free(display_buffer_pool *pool);
|
||||
|
||||
cairo_surface_t *display_buffer_pool_get_next_buffer(display_buffer_pool *pool);
|
||||
void display_surface_commit(cairo_surface_t *surface);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -125,6 +125,9 @@ struct RofiViewState
|
|||
/** Y position of the view */
|
||||
int y;
|
||||
|
||||
display_buffer_pool *pool;
|
||||
gboolean frame_callback;
|
||||
|
||||
/** Position and target of the mouse. */
|
||||
struct
|
||||
{
|
||||
|
|
|
@ -313,4 +313,9 @@ void rofi_view_set_window_title ( const char * title );
|
|||
*/
|
||||
void rofi_view_ellipsize_start ( RofiViewState *state );
|
||||
/**@}*/
|
||||
|
||||
void rofi_view_set_size ( RofiViewState * state, gint width, gint height );
|
||||
|
||||
void rofi_view_get_size ( RofiViewState * state, gint *width, gint *height );
|
||||
|
||||
#endif
|
||||
|
|
110
include/wayland-internal.h
Normal file
110
include/wayland-internal.h
Normal file
|
@ -0,0 +1,110 @@
|
|||
#ifndef ROFI_WAYLAND_INTERNAL_H
|
||||
#define ROFI_WAYLAND_INTERNAL_H
|
||||
|
||||
#include <glib.h>
|
||||
#include <cairo.h>
|
||||
#include <xkbcommon/xkbcommon.h>
|
||||
#include <xcb/xkb.h>
|
||||
#include <wayland-client.h>
|
||||
#include <libgwater-wayland.h>
|
||||
#include <nkutils-bindings.h>
|
||||
|
||||
typedef enum {
|
||||
WAYLAND_GLOBAL_COMPOSITOR,
|
||||
WAYLAND_GLOBAL_SHM,
|
||||
WAYLAND_GLOBAL_LAYER_SHELL,
|
||||
_WAYLAND_GLOBAL_SIZE,
|
||||
} wayland_global_name;
|
||||
|
||||
#if 0
|
||||
typedef enum {
|
||||
WIDGET_MODMASK_SHIFT = (1 << WIDGET_MOD_SHIFT),
|
||||
WIDGET_MODMASK_CONTROL = (1 << WIDGET_MOD_CONTROL),
|
||||
WIDGET_MODMASK_ALT = (1 << WIDGET_MOD_ALT),
|
||||
WIDGET_MODMASK_META = (1 << WIDGET_MOD_META),
|
||||
WIDGET_MODMASK_SUPER = (1 << WIDGET_MOD_SUPER),
|
||||
WIDGET_MODMASK_HYPER = (1 << WIDGET_MOD_HYPER),
|
||||
WIDGET_MODMASK_ALL = (WIDGET_MODMASK_SHIFT | WIDGET_MODMASK_CONTROL | WIDGET_MODMASK_ALT | WIDGET_MODMASK_META | WIDGET_MODMASK_SUPER | WIDGET_MODMASK_HYPER)
|
||||
} widget_modifier_mask;
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
NkBindingsMouseButton button;
|
||||
char modifiers;
|
||||
gint x, y;
|
||||
gboolean pressed;
|
||||
guint32 time;
|
||||
} widget_button_event;
|
||||
|
||||
typedef struct {
|
||||
gint x, y;
|
||||
guint32 time;
|
||||
} widget_motion_event;
|
||||
|
||||
typedef struct _wayland_seat wayland_seat;
|
||||
|
||||
typedef struct {
|
||||
GMainLoop *main_loop;
|
||||
GWaterWaylandSource *main_loop_source;
|
||||
struct wl_display *display;
|
||||
struct wl_registry *registry;
|
||||
uint32_t global_names[_WAYLAND_GLOBAL_SIZE];
|
||||
struct wl_compositor *compositor;
|
||||
struct zww_launcher_menu_v1 *launcher_menu;
|
||||
struct zww_window_switcher_v1 *window_switcher;
|
||||
|
||||
struct zwlr_layer_shell_v1 *layer_shell;
|
||||
|
||||
struct wl_shm *shm;
|
||||
size_t buffer_count;
|
||||
struct {
|
||||
char *theme_name;
|
||||
char **name;
|
||||
struct wl_cursor_theme *theme;
|
||||
struct wl_cursor *cursor;
|
||||
struct wl_cursor_image *image;
|
||||
struct wl_surface *surface;
|
||||
struct wl_callback *frame_cb;
|
||||
} cursor;
|
||||
GHashTable *seats;
|
||||
GHashTable *seats_by_name;
|
||||
wayland_seat *last_seat;
|
||||
GHashTable *outputs;
|
||||
struct wl_surface *surface;
|
||||
struct zwlr_layer_surface_v1* wlr_surface;
|
||||
struct wl_callback *frame_cb;
|
||||
size_t scales[3];
|
||||
int32_t scale;
|
||||
NkBindingsSeat *bindings_seat;
|
||||
|
||||
uint32_t layer_width;
|
||||
uint32_t layer_height;
|
||||
} wayland_stuff;
|
||||
|
||||
struct _wayland_seat {
|
||||
wayland_stuff *context;
|
||||
uint32_t global_name;
|
||||
struct wl_seat *seat;
|
||||
gchar *name;
|
||||
uint32_t serial;
|
||||
struct wl_keyboard *keyboard;
|
||||
// xkb_stuff xkb;
|
||||
struct wl_pointer *pointer;
|
||||
widget_button_event button;
|
||||
widget_motion_event motion;
|
||||
struct {
|
||||
gint vertical;
|
||||
gint horizontal;
|
||||
} wheel;
|
||||
};
|
||||
|
||||
/* Supported interface versions */
|
||||
#define WL_COMPOSITOR_INTERFACE_VERSION 3
|
||||
#define WL_SHM_INTERFACE_VERSION 1
|
||||
#define WL_SEAT_INTERFACE_VERSION 5
|
||||
#define WL_OUTPUT_INTERFACE_VERSION 2
|
||||
#define WL_LAYER_SHELL_INTERFACE_VERSION 1
|
||||
|
||||
extern wayland_stuff *wayland;
|
||||
|
||||
#endif
|
16
meson.build
16
meson.build
|
@ -68,9 +68,12 @@ deps += [
|
|||
|
||||
wayland_client = dependency('wayland-client', required: get_option('wayland'))
|
||||
wayland_protocols = dependency('wayland-protocols', required: get_option('wayland'))
|
||||
wayland_cursor = dependency('wayland-cursor', required: get_option('wayland'))
|
||||
if wayland_client.found()
|
||||
deps += wayland_client
|
||||
deps += wayland_protocols
|
||||
deps += wayland_cursor
|
||||
deps += subproject('libgwater/wayland').get_variable('libgwater_wayland')
|
||||
endif
|
||||
|
||||
check = dependency('check', version: '>= 0.11.0', required: get_option('check'))
|
||||
|
@ -92,7 +95,9 @@ header_conf.set('GLIB_VERSION_MIN_REQUIRED', '(G_ENCODE_VERSION(@0@,@1@))'.forma
|
|||
header_conf.set('GLIB_VERSION_MAX_ALLOWED', '(G_ENCODE_VERSION(@0@,@1@))'.format(glib_min_major, glib_min_minor))
|
||||
|
||||
header_conf.set('ENABLE_DRUN', get_option('drun'))
|
||||
header_conf.set('WINDOW_MODE', get_option('window'))
|
||||
#header_conf.set('WINDOW_MODE', get_option('window'))
|
||||
|
||||
header_conf.set('ENABLE_WAYLAND', wayland_client.found())
|
||||
|
||||
header_conf.set_quoted('MANPAGE_PATH', join_paths(get_option('prefix'), get_option('mandir')))
|
||||
header_conf.set_quoted('SYSCONFDIR', join_paths(get_option('prefix'), get_option('sysconfdir')))
|
||||
|
@ -151,6 +156,8 @@ rofi_sources = files(
|
|||
'source/theme.c',
|
||||
'source/rofi-icon-fetcher.c',
|
||||
'source/css-colors.c',
|
||||
'source/wayland/view.c',
|
||||
'source/wayland/display.c',
|
||||
'source/widgets/box.c',
|
||||
'source/widgets/icon.c',
|
||||
'source/widgets/container.c',
|
||||
|
@ -165,11 +172,11 @@ rofi_sources = files(
|
|||
'source/dialogs/drun.c',
|
||||
'source/dialogs/dmenu.c',
|
||||
'source/dialogs/combi.c',
|
||||
'source/dialogs/window.c',
|
||||
#'source/dialogs/window.c',
|
||||
'source/dialogs/script.c',
|
||||
'source/dialogs/help-keys.c',
|
||||
'source/xcb/display.c',
|
||||
'source/xcb/view.c',
|
||||
#'source/xcb/display.c',
|
||||
#'source/xcb/view.c',
|
||||
'include/display.h',
|
||||
'include/xcb.h',
|
||||
'include/xcb-internal.h',
|
||||
|
@ -188,6 +195,7 @@ rofi_sources = files(
|
|||
'include/theme.h',
|
||||
'include/rofi-types.h',
|
||||
'include/css-colors.h',
|
||||
'include/wayland-internal.h',
|
||||
'include/widgets/box.h',
|
||||
'include/widgets/icon.h',
|
||||
'include/widgets/container.h',
|
||||
|
|
|
@ -617,6 +617,8 @@ int config_sanity_check ( void )
|
|||
}
|
||||
|
||||
// Check size
|
||||
#if 0
|
||||
// TODO
|
||||
{
|
||||
workarea mon;
|
||||
if ( !monitor_active ( &mon ) ) {
|
||||
|
@ -631,6 +633,7 @@ int config_sanity_check ( void )
|
|||
found_error = TRUE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( config.menu_font ) {
|
||||
PangoFontDescription *pfd = pango_font_description_from_string ( config.menu_font );
|
||||
|
|
|
@ -306,7 +306,7 @@ static void help ( G_GNUC_UNUSED int argc, char **argv )
|
|||
printf ( "Global options:\n" );
|
||||
print_options ();
|
||||
printf ( "\n" );
|
||||
display_dump_monitor_layout ();
|
||||
//display_dump_monitor_layout ();
|
||||
printf ( "\n" );
|
||||
printf ( "Detected modi:\n" );
|
||||
print_list_of_modi ( is_term );
|
||||
|
@ -926,7 +926,7 @@ int main ( int argc, char *argv[] )
|
|||
g_free ( etc );
|
||||
}
|
||||
// Load in config from X resources.
|
||||
config_parse_xresource_options ( xcb );
|
||||
// config_parse_xresource_options ( xcb );
|
||||
|
||||
if ( config_path_new && g_file_test ( config_path_new, G_FILE_TEST_IS_REGULAR ) ) {
|
||||
if ( rofi_theme_parse_file ( config_path_new ) ) {
|
||||
|
|
1024
source/wayland/display.c
Normal file
1024
source/wayland/display.c
Normal file
File diff suppressed because it is too large
Load diff
1668
source/wayland/view.c
Normal file
1668
source/wayland/view.c
Normal file
File diff suppressed because it is too large
Load diff
|
@ -113,7 +113,7 @@ struct _listview
|
|||
|
||||
gboolean scrollbar_scroll;
|
||||
|
||||
xcb_timestamp_t last_click;
|
||||
guint32 last_click;
|
||||
listview_mouse_activated_cb mouse_activated;
|
||||
void *mouse_activated_data;
|
||||
|
||||
|
|
Loading…
Reference in a new issue