Bonjour,
je tombe encore sur une coquille la ou il ne devrait pas en avoir. En fait, j'essaye de gérer la fenêtre crée par la SDL grâce à Xlib.
Et les informations que me fournie SDL semble être érronnées :/
Voici un simple code ou j'éssaye de bouger la fenêtre:
La sortie :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68 /* * main.cpp * * Created on: Jan 10, 2012 * Author: guillaume */ #include <SDL/SDL.h> #include <SDL/SDL_image.h> #include <SDL/SDL_syswm.h> #include <X11/Xlib.h> #include <X11/Xutil.h> #include <iostream> using namespace std; int main(int argc, char **argv) { Display * display; Window window; SDL_Surface * screen; // Initialize SDL if (SDL_Init(SDL_INIT_VIDEO) < 0 ) { cout << "SDL_Init Failed " << endl; return false; } // Make SDL Window if( !(screen = SDL_SetVideoMode(300, 200, 32, SDL_NOFRAME | SDL_ANYFORMAT | SDL_HWSURFACE | SDL_DOUBLEBUF ) ) ) { cout << "SDL_SetVideoMode Failed " << endl; return false; } // Create Info structure SDL_SysWMinfo info; SDL_VERSION(&info.version); // Get info from SDL if(!SDL_GetWMInfo(&info)) cout << "SDL cant get from SDL" << endl; // Check we are on X11 if ( info.subsystem != SDL_SYSWM_X11 ) cout << "SDL is not running on X11" << endl; // Store X11 informations display = info.info.x11.display; window = info.info.x11.window; cout << "Display : " << display << endl << "Window : " << window << endl; // try to move SDL Window switch(XMoveWindow(display, window,200,200)) { case BadWindow : cout << "BadWindow" << endl; break; case BadValue : cout << "BadValue" << endl; break; case BadRequest : cout << "BadRequest" << endl; break; } sleep(5); }
C'est surement tout bête, mais j'arrive pas à voir la ou ça cloche.Display : 0x854aef0
Window : 71303181
BadRequest
Merci de votre aide
Edit : suis sous Debian, tout ça...
Partager