[Sawfish] libsdl2 wrong window size reported [was: Building .deb from sources: more libtool problems]

[ Thread Index | Date Index | More lists.tuxfamily.org/sawfish Archives ]

Hi again,

I solved the libtool problems. Wrong dependency cascaded through into
the .debs, entirely my fault.

However, the original SDL2 problem is still present in the latest
repository versions:

When using SDL2 to create a 640x480 window, sawfish 1.9.90 does not
report window border sizes correctly and a window with a canvas size of
638x478 results, while SDL2 thinks it's 640x480 and parts of the canvas
are not rendered. Using xfwm4 does not have any problems of this kind.

I'm attaching a short example which demonstrates this on my system
(Ubuntu vivid 64bit, NVIDIA GTX 560Ti running closed-source drivers).

Does anyone know where this problem might originate from so that I can
investigate further?


Rafal Kolanski

/* compile with:
gcc -o sawfish_problem sawfish_problem.c `sdl2-config --cflags` -Wall -std=gnu11 `sdl2-config --libs`
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <assert.h>
#include "SDL.h"

/* Globals */
SDL_Window *window = NULL;
SDL_Renderer *renderer = NULL;

bool init(void) {
    if (SDL_Init(SDL_INIT_EVERYTHING) != 0) {
        printf("Error: SDL_Init: %s\n", SDL_GetError());
        return false;
    window = SDL_CreateWindow("Title",
            /*|SDL_WINDOW_BORDERLESS renders correctly!*/);
    if (!window) {
        printf("Error: SDL_CreateWindow: %s\n", SDL_GetError());
        return false;
    int w=0,h=0;
    SDL_GetWindowSize(window, &w, &h);
    printf("window: %d x %d\n", w, h);
    w = 0; h = 0;
    SDL_GL_GetDrawableSize(window, &w, &h);
    printf("drawable: %d x %d\n", w, h);
    renderer = SDL_CreateRenderer(window, -1,
    if (!renderer) {
        printf("Error: SDL_CreateRenderer: %s\n", SDL_GetError());
        return false;
    w = 0; h = 0;
    SDL_GetRendererOutputSize(renderer, &w, &h);
    printf("output: %d x %d\n", w, h);
    return true;

int main(int argc, char* argv[]) {

    if (!init()) return 1;

    SDL_Event e;
    bool quit = false;
    while (!quit) {
        while (SDL_PollEvent(&e)) {
            if (e.type == SDL_QUIT) quit = true;
            if (e.type == SDL_KEYDOWN) {
                if (e.key.keysym.sym == SDLK_ESCAPE) quit = true;
        SDL_SetRenderDrawColor(renderer, 0x00, 0x00, 0x00, 0x00);

        SDL_SetRenderDrawColor(renderer, 0xFF, 0x00, 0x00, 0x00);
        SDL_Rect rect = {0, 0, 639, 479};
        SDL_RenderDrawRect(renderer, &rect);
        SDL_SetRenderDrawColor(renderer, 0x00, 0xFE, 0xFE, 0x00);
        SDL_RenderDrawPoint(renderer, 0,0);
        /* the pixel can be read back correctly */


    printf("Normal termination.\n");
    return 0;

Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/