URI: 
       Move ltk_surface definition to graphics_xlib.h - ltk - GUI toolkit for X11 (WIP)
  HTML git clone git://lumidify.org/ltk.git (fast, but not encrypted)
  HTML git clone https://lumidify.org/ltk.git (encrypted, but very slow)
  HTML git clone git://4kcetb7mo7hj6grozzybxtotsub5bempzo4lirzc3437amof2c2impyd.onion/ltk.git (over tor)
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit a69310e2abfdd32a215f15785b9c12cb47cbc32c
   DIR parent 5d7021e4df96c9133cfc51e7a2f75bc62c381a75
  HTML Author: lumidify <nobody@lumidify.org>
       Date:   Fri,  3 May 2024 14:01:12 +0200
       
       Move ltk_surface definition to graphics_xlib.h
       
       Diffstat:
         M src/ltk/graphics_xlib.c             |      22 ----------------------
         M src/ltk/graphics_xlib.h             |      35 ++++++++++++++++---------------
         M src/ltk/image_imlib.c               |       6 +++---
         M src/ltk/text_pango.c                |       5 ++---
       
       4 files changed, 23 insertions(+), 45 deletions(-)
       ---
   DIR diff --git a/src/ltk/graphics_xlib.c b/src/ltk/graphics_xlib.c
       @@ -39,16 +39,6 @@
        LTK_ARRAY_INIT_FUNC_DECL_STATIC(moninfo, struct ltk_moninfo)
        LTK_ARRAY_INIT_IMPL_STATIC(moninfo, struct ltk_moninfo)
        
       -struct ltk_surface {
       -        int w, h;
       -        ltk_renderwindow *window;
       -        Drawable d;
       -        #if USE_XFT == 1
       -        XftDraw *xftdraw;
       -        #endif
       -        char resizable;
       -};
       -
        ltk_surface *
        ltk_surface_create(ltk_renderwindow *window, int w, int h) {
                ltk_surface *s = ltk_malloc(sizeof(ltk_surface));
       @@ -365,18 +355,6 @@ ltk_surface_fill_circle(ltk_surface *s, ltk_color *c, int xc, int yc, int r) {
        }
        */
        
       -#if USE_XFT == 1
       -XftDraw *
       -ltk_surface_get_xft_draw(ltk_surface *s) {
       -        return s->xftdraw;
       -}
       -#endif
       -
       -Drawable
       -ltk_surface_get_drawable(ltk_surface *s) {
       -        return s->d;
       -}
       -
        /* FIXME: move this to a file where it makes more sense */
        /* blatantly stolen from st */
        static void ximinstantiate(Display *dpy, XPointer client, XPointer call);
   DIR diff --git a/src/ltk/graphics_xlib.h b/src/ltk/graphics_xlib.h
       @@ -25,17 +25,18 @@
        #define USE_XFT 1
        #endif
        
       +#include <X11/X.h>
        #include <X11/Xlib.h>
        #include <X11/extensions/Xdbe.h>
        
       +#if USE_XFT == 1
       +#include <X11/Xft/Xft.h>
       +#endif
       +
        #include "rect.h"
        #include "array.h"
        #include "graphics.h"
        
       -#if USE_XFT == 1
       -  #include <X11/Xft/Xft.h>
       -#endif
       -
        struct ltk_moninfo {
                int x, y;
                int width, height;
       @@ -79,23 +80,23 @@ struct ltk_renderwindow {
        };
        
        /* FIXME: only generate draw if needed */
       -#if USE_XFT == 1
       -#include <X11/Xft/Xft.h>
       -XftDraw *ltk_surface_get_xft_draw(ltk_surface *s);
       -#endif
       -
       -#if USE_XLIB_GRAPHICS == 1
       -#include <X11/X.h>
       -Drawable ltk_surface_get_drawable(ltk_surface *s);
       -#endif
       +struct ltk_surface {
       +        int w, h;
       +        ltk_renderwindow *window;
       +        Drawable d;
       +        #if USE_XFT == 1
       +        XftDraw *xftdraw;
       +        #endif
       +        char resizable;
       +};
        
        int ltk_recalc_renderwindow_dpi(ltk_renderwindow *window);
        
        struct ltk_color {
       -        XColor xcolor;
       -        #if USE_XFT == 1
       -        XftColor xftcolor;
       -        #endif
       +        XColor xcolor;
       +        #if USE_XFT == 1
       +        XftColor xftcolor;
       +        #endif
        };
        
        #endif /* LTK_GRAPHICS_XLIB_H */
   DIR diff --git a/src/ltk/image_imlib.c b/src/ltk/image_imlib.c
       @@ -78,7 +78,7 @@ ltk_image_create_cropped_scaled(
        void
        ltk_image_draw(ltk_image *image, ltk_surface *draw_surf, int x, int y) {
                imlib_context_set_image(image->img);
       -        imlib_context_set_drawable(ltk_surface_get_drawable(draw_surf));
       +        imlib_context_set_drawable(draw_surf->d);
                imlib_render_image_on_drawable(x, y);
        }
        
       @@ -87,7 +87,7 @@ ltk_image_draw_scaled(
            ltk_image *image, ltk_surface *draw_surf,
            int x, int y, int w, int h) {
                imlib_context_set_image(image->img);
       -        imlib_context_set_drawable(ltk_surface_get_drawable(draw_surf));
       +        imlib_context_set_drawable(draw_surf->d);
                imlib_render_image_on_drawable_at_size(x, y, w, h);
        }
        
       @@ -97,7 +97,7 @@ ltk_image_draw_cropped_scaled(
            int src_x, int src_y, int src_w, int src_h,
            int dst_x, int dst_y, int dst_w, int dst_h) {
                imlib_context_set_image(image->img);
       -        imlib_context_set_drawable(ltk_surface_get_drawable(draw_surf));
       +        imlib_context_set_drawable(draw_surf->d);
                imlib_render_image_part_on_drawable_at_size(
                    src_x, src_y, src_w, src_h, dst_x, dst_y, dst_w, dst_h
                );
   DIR diff --git a/src/ltk/text_pango.c b/src/ltk/text_pango.c
       @@ -156,13 +156,12 @@ ltk_text_line_create_const_text(ltk_text_context *ctx, const char *font, int fon
        
        void
        ltk_text_line_draw(ltk_text_line *tl, ltk_surface *s, ltk_color *color, int x, int y) {
       -        XftDraw *d = ltk_surface_get_xft_draw(s);
       -        pango_xft_render_layout(d, &color->xftcolor, tl->layout, x * PANGO_SCALE, y * PANGO_SCALE);
       +        pango_xft_render_layout(s->xftdraw, &color->xftcolor, tl->layout, x * PANGO_SCALE, y * PANGO_SCALE);
        }
        
        void
        ltk_text_line_draw_clipped(ltk_text_line *tl, ltk_surface *s, ltk_color *color, int x, int y, ltk_rect clip) {
       -        XftDraw *d = ltk_surface_get_xft_draw(s);
       +        XftDraw *d = s->xftdraw;
                /* FIXME: check for integer overflow */
                XPoint points[] = {
                    {clip.x, clip.y},