Bonjour a tous.
J'essaie de traduire ce code C en Java avec JNA.
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
 
if(dock) {
        type = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DOCK", False);
        XChangeProperty(
                        dpy,
                        w,
                        XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False),
                        XInternAtom(dpy, "ATOM", False),
                        32,
                        PropModeReplace,
                        (unsigned char *)&type,
                        1
                        );
 
        type = XInternAtom(dpy, "_NET_WM_STATE_ABOVE", False);
        XChangeProperty(
                        dpy,
                        w,
                        XInternAtom(dpy, "_NET_WM_STATE", False),
                        XInternAtom(dpy, "ATOM", False),
                        32,
                        PropModeReplace,
                        (unsigned char *)&type,
                        1
                        );
 
        type = XInternAtom(dpy, "_NET_WM_STATE_STICKY", False);
        XChangeProperty(
                        dpy,
                        w,
                        XInternAtom(dpy, "_NET_WM_STATE", False),
                        XInternAtom(dpy, "ATOM", False),
                        32,
                        PropModeAppend,
                        (unsigned char *)&type,
                        1
                        );
 
 
        desktop = 0xffffffff;
        XChangeProperty(
                        dpy,
                        w,
                        XInternAtom(dpy, "_NET_WM_DESKTOP", False),
                        XInternAtom(dpy, "CARDINAL", False),
                        32,
                        PropModeReplace,
                        (unsigned char *)&desktop,
                        1
                        );
}
En Java pour fixer une fenetre en type dock par exemple :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
 
X11.Atom atomType = getAtom("_NET_WM_WINDOW_TYPE_DOCK");
x11.XChangeProperty(x11Display,     // DISPLAY
                                 win,               // FENETRE
                                 getAtom("_NET_WM_WINDOW_TYPE"),
                                 getAtom("ATOM"),
                                 32,
                                 X11.PropModeReplace,
                                 atomType, // <--
                                 1);
J'arrive a recuperer une valeur de type X11.Atom avec :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
 
X11.AtomByReference xa_ret_type_ref = new X11.AtomByReference();
...
X11.Atom xa_ret_type = xa_ret_type_ref.getValue();
Mon probleme se situe au niveau de 'atomType' puisqu'il faut passer
la reference de ce type. L'erreur renvoye est logique :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
 
'incompatible types: Atom cannot be converted to Pointer'
J'ai essaye de passer par le type 'Pointer' de JNA mais sans succes.
J'ai cherche et trouve des exemples de code pour passer la reference
avec JNA, mais rien qui puisse m'aider.
Si quelqu'un a une idee ou une piste
Merci par avance.