Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 191dde5

Browse files
made some additions
1 parent 06745e4 commit 191dde5

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

‎Source.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
static Display *display;
66
static Window root;
77
static int screen;
8+
static GC gc;
89

910
Window createWindow(int x, int y, int width, int height, int border, long borderColor, long rgb) {
1011
Window window = XCreateSimpleWindow(display, root, x, y, width, height, border, (long) borderColor, (long) rgb);
@@ -15,6 +16,21 @@ Window getParentWindow() {
1516
return root;
1617
}
1718

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+
1834
long rgb(int r, int g, int b) {
1935
return b + (g<<8) + (r<<16);
2036
}

‎Source.i

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
extern Window createWindow(int x, int y, int width, int height, int border, long borderColor, long rgb);
44
extern Window getParentWindow();
5+
extern void changeWindowBackground(Window window, long background);
6+
extern void changeWindowBorderColor(Window window, long color);
7+
extern void writeText(char[] text, int x, int y, Window window, long background, long foreground);
58
extern long rgb(int r, int g, int b);
69
extern long red();
710
extern long green();

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /