5
5
static Display * display ;
6
6
static Window root ;
7
7
static int screen ;
8
+ static GC gc ;
8
9
9
10
Window createWindow (int x , int y , int width , int height , int border , long borderColor , long rgb ) {
10
11
Window window = XCreateSimpleWindow (display , root , x , y , width , height , border , (long ) borderColor , (long ) rgb );
@@ -15,6 +16,21 @@ Window getParentWindow() {
15
16
return root ;
16
17
}
17
18
19
+ void changeWindowBackground (Window window , long background ) {
20
+ XSetWindowBackground (display , window , background );
21
+ }
22
+
23
+ void changeWindowBorderColor (Window window , long color ) {
24
+ XSetWindowBorder (display , window , color );
25
+ }
26
+
27
+ void writeText (char [] text , int x , int y , Window window , long background , long foreground ) {
28
+ gc = XCreateGC (display , window , 0 , 0 );
29
+ XSetBackground (display , gc , (long ) background );
30
+ XSetForeground (display , gc , (long ) foreground );
31
+ XDrawString (display , window , gc , x , y , text , strlen (text ));
32
+ }
33
+
18
34
long rgb (int r , int g , int b ) {
19
35
return b + (g <<8 ) + (r <<16 );
20
36
}
0 commit comments