Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial Wayland support #218

Open
Alex2772 opened this issue Nov 1, 2023 · 23 comments
Open

Initial Wayland support #218

Alex2772 opened this issue Nov 1, 2023 · 23 comments

Comments

@Alex2772
Copy link
Collaborator

Alex2772 commented Nov 1, 2023

Currently, AUI uses X11 windowing system on Linux platform.

Wayland windowing system is raising in popularity, also, major Linux distributions like Ubuntu and Fedora abandoning X11 session support, thus AUI works on recent desktop Linux OSes as "legacy" application, through compatibility layer, Xwayland.

Showstoppers

  • Stupid obsession with CSD in Gnome => inconsistency
  • Inability to position windows => window position saving doesn't work, log window attaching (not merged yet) doesn't work
  • NVIDIA still has issues under Wayland fixed in nvidia gpu drivers 550 for linux
  • Broken global menus
  • Fractional scaling is blurry (still 12 jan 2025 Fedora 41 KDE)
    • there's alacritty (based on winit) which appears to be sharp and crisp on both macOS and Linux+wayland. Looks like it is both qt's and gtk's wayland implementation fault.
  • and many others
@Alex2772 Alex2772 added this to the Wayland support milestone Nov 1, 2023
@Alex2772
Copy link
Collaborator Author

Alex2772 commented Nov 6, 2023

Should probably use GTK on GNOME and Wayland directly on KDE with serverside decorations extension.

@MrSyabro
Copy link

MrSyabro commented Nov 6, 2023

Should probably use GTK on GNOME and Wayland directly on KDE with serverside decorations extension.

Та зачем метаться со стороны в сторону? Возми просто GTK и он сам подхватит тему Qt на Кедах!

@MrSyabro
Copy link

MrSyabro commented Nov 6, 2023

Хотя я бы был не против верстать заголовок отдельно от GTK на AUI

@Alex2772
Copy link
Collaborator Author

Alex2772 commented Nov 6, 2023

Смотри какой красивый у меня блюр на кедах
image

@Alex2772
Copy link
Collaborator Author

Alex2772 commented Nov 6, 2023

И дополнительные кедовские кнопочки

@MrSyabro
Copy link

MrSyabro commented Nov 6, 2023

Смотри какой красивый у меня блюр на кедах

И как это будет смотреться, если снизу будет AUI?

@Alex2772
Copy link
Collaborator Author

Alex2772 commented Nov 6, 2023

Зато насколько выбиваются gtk окошечки
image

@Alex2772
Copy link
Collaborator Author

Alex2772 commented Nov 6, 2023

Смотри какой красивый у меня блюр на кедах

И как это будет смотреться, если снизу будет AUI?

Да нормально, даже гтк прилично смотрится

@MrSyabro
Copy link

MrSyabro commented Nov 6, 2023

Психани и нарисуй заголовок в AUI.. С полным блюром, самым красивым в Linux. И на винде тоже. Иконки и кнопки можно от системы взять

@Alex2772
Copy link
Collaborator Author

Alex2772 commented Nov 6, 2023

Психани и нарисуй заголовок в AUI.. С полным блюром, самым красивым в Linux. И на винде тоже. Иконки и кнопки можно от системы взять

Я на психа похож?

@MrSyabro
Copy link

MrSyabro commented Nov 6, 2023

Я на психа похож?

Ну ты.. AUI написал так что да

@MrSyabro
Copy link

MrSyabro commented Nov 6, 2023

А AUI поддерживает прозрачность окон? На всех системах.. Если да, то можно свои красивейшие окна делать без всяких там Qt/KDE/GTK

@Alex2772
Copy link
Collaborator Author

Alex2772 commented Nov 6, 2023

А AUI поддерживает прозрачность окон? На всех системах.. Если да, то можно свои красивейшие окна делать без всяких там Qt/KDE/GTK

Поддерживает. Но блюр рисовать силами aui не хочу, пусть композитор рисует

@MrSyabro
Copy link

MrSyabro commented Nov 6, 2023

Поддерживает. Но блюр рисовать силами aui не хочу, пусть композитор рисует

Композитор не сможет красиво совместить с остальным контентом окна. В общем я за консистентность AUI. Похуй на остальное, надо GTK - нарисую на AUI (как это делают Qt)

@Alex2772
Copy link
Collaborator Author

Alex2772 commented Mar 4, 2024

So, what's the point of supporting Wayland, if XWayland does it's job so well?..

@MrSyabro
Copy link

MrSyabro commented Mar 4, 2024

So, what's the point of supporting Wayland, if XWayland does it's job so well?..

А как же через раз работающие клавыши F1-12? Зажатие клавиши удаления удаляет один символ и больше не повторяется. То же самое с другими клавишами.
Нету поддержки дропного скейлинга Wayland

@Alex2772
Copy link
Collaborator Author

Alex2772 commented Mar 4, 2024

So, what's the point of supporting Wayland, if XWayland does it's job so well?..

А как же через раз работающие клавыши F1-12? Зажатие клавиши удаления удаляет один символ и больше не повторяется. То же самое с другими клавишами. Нету поддержки дропного скейлинга Wayland

Разве вейланд уже поддерживает дропный скейлинг без мыла?

@Alex2772
Copy link
Collaborator Author

Alex2772 commented Mar 4, 2024

Нафиг оно вообще надо, других задач нет шоли? Вот бы кто пулл реквест кинул с этим вейландом, а там страшно, абсракцию плодить надо

@MrSyabro
Copy link

MrSyabro commented Mar 4, 2024

Разве вейланд уже поддерживает дропный скейлинг без мыла?

Как раз только он и поддерживает

@MrSyabro
Copy link

MrSyabro commented Mar 4, 2024

Нафиг оно вообще надо, других задач нет шоли? Вот бы кто пулл реквест кинул с этим вейландом, а там страшно, абсракцию плодить надо

Дай луа биндинг, цены не будет твоему фреймворку

@Alex2772
Copy link
Collaborator Author

Alex2772 commented Jan 6, 2025

Wayland is a mess... I've tried to use egl example found on the internet:

#include <EGL/egl.h>
#include <GL/gl.h>
#include <string.h>
#include <wayland_scanner_out.h>
#include <wayland-client.h>
#include <wayland-egl.h>

#define WIDTH 256
#define HEIGHT 256

static struct wl_display* display;
static struct wl_compositor* compositor = NULL;
static struct wl_shell* shell = NULL;
static EGLDisplay egl_display;
static char running = 1;

struct window
{
    EGLContext egl_context;
    struct wl_surface* surface;
    struct wl_shell_surface* shell_surface;
    struct wl_egl_window* egl_window;
    EGLSurface egl_surface;
};

// listeners
static void registry_add_object
        (
                void* data,
                struct wl_registry* registry,
                uint32_t name,
                const char* interface,
                uint32_t version
        ) {
    if (!strcmp(interface, "wl_compositor")) {
        compositor = static_cast<wl_compositor*>(wl_registry_bind(registry, name, &wl_compositor_interface, 1));
    } else if (!strcmp(interface, "wl_shell")) {
        shell = static_cast<wl_shell*>(wl_registry_bind(registry, name, &wl_shell_interface, 1));
    }
}

static void registry_remove_object( void* data, struct wl_registry* registry, uint32_t name )
{
}

static struct wl_registry_listener registry_listener =
        {
                &registry_add_object,
                &registry_remove_object
};

static void shell_surface_ping( void* data, struct wl_shell_surface* shell_surface, uint32_t serial )
{
    wl_shell_surface_pong( shell_surface, serial );
}

static void shell_surface_configure
        (
                void* data,
                struct wl_shell_surface* shell_surface,
                uint32_t edges,
                int32_t width,
                int32_t height
        )
{
    window* window = static_cast<struct window*>(data);
    wl_egl_window_resize( window->egl_window, width, height, 0, 0 );
}

static void shell_surface_popup_done( void* data, struct wl_shell_surface* shell_surface )
{
}

static struct wl_shell_surface_listener shell_surface_listener =
        {
                &shell_surface_ping,
                &shell_surface_configure,
                &shell_surface_popup_done
};

static void create_window( struct window* window, int32_t width, int32_t height )
{
    eglBindAPI( EGL_OPENGL_API );
    EGLint attributes[] = {EGL_RED_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_BLUE_SIZE, 8, EGL_NONE};
    EGLConfig config;
    EGLint num_config;
    eglChooseConfig( egl_display, attributes, &config, 1, &num_config );
    window->egl_context = eglCreateContext( egl_display, config, EGL_NO_CONTEXT, NULL );

    window->surface = wl_compositor_create_surface( compositor );
    window->shell_surface = wl_shell_get_shell_surface( shell, window->surface );
    wl_shell_surface_add_listener( window->shell_surface, &shell_surface_listener, window );
    wl_shell_surface_set_toplevel( window->shell_surface );
    window->egl_window = wl_egl_window_create( window->surface, width, height );
    window->egl_surface = eglCreateWindowSurface( egl_display, config, (EGLNativeWindowType)window->egl_window, NULL );
    eglMakeCurrent( egl_display, window->egl_surface, window->egl_surface, window->egl_context );
}

static void delete_window( struct window* window )
{
    eglDestroySurface( egl_display, window->egl_surface );
    wl_egl_window_destroy( window->egl_window );
    wl_shell_surface_destroy( window->shell_surface );
    wl_surface_destroy( window->surface );
    eglDestroyContext( egl_display, window->egl_context );
}

static void draw_window( struct window* window )
{
    glClearColor( 0.0, 1.0, 0.0, 1.0 );
    glClear( GL_COLOR_BUFFER_BIT );
    eglSwapBuffers( egl_display, window->egl_surface );
}

int main()
{
    display = wl_display_connect( NULL );
    struct wl_registry* registry = wl_display_get_registry( display );
    wl_registry_add_listener( registry, &registry_listener, NULL );
    wl_display_roundtrip( display );

    egl_display = eglGetDisplay( display );
    eglInitialize( egl_display, NULL, NULL );

    struct window window;
    create_window( &window, WIDTH, HEIGHT );

    while( running )
    {
        wl_display_dispatch_pending( display );
        draw_window( &window );
    }

    delete_window( &window );
    eglTerminate( egl_display );
    wl_display_disconnect( display );
    return 0;
}

And it crashes! You guess why?? Because I'm running KDE!

@Alex2772
Copy link
Collaborator Author

Alex2772 commented Jan 6, 2025

А AUI поддерживает прозрачность окон? На всех системах.. Если да, то можно свои красивейшие окна делать без всяких там Qt/KDE/GTK

KDE implements /usr/share/plasma-wayland-protocols/blur.xml protocol. In theory I can ask KDE to draw a nice backdrop blur like in macOS.

@Alex2772
Copy link
Collaborator Author

Alex2772 commented Jan 6, 2025

Та зачем метаться со стороны в сторону? Возми просто GTK и он сам подхватит тему Qt на Кедах!

Initially I thought is a rather bad option but we already depend on gtk to make system dialogs look native. Also, we won't need to implement ugly AUI-based decorations just for GNOME.

As was suggested, it's a good idea to get rid of X11 entirely and use dependencies that we are already depend on. Let those red-eyed linux shenanigans do their job under gtk and wayland, I don't want to bother with their questionable design decisions like the one with client side decorations.

Okay, there's libdecor, but it looks good on KDE only. On desktop environments that don't implement server-side window decorations protocol (i.e., GNOME) it looks terrible and outstanding especially when comparing to ~native GNOME apps~.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants