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 cee03a0

Browse files
made additions to library source
1 parent 2165b82 commit cee03a0

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

‎Source.c

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#include <X11/Xlib.h>
2+
#include <X11/Xutil.h>
3+
#include <X11/Xos.h>
4+
5+
static Display *display;
6+
static Window root;
7+
static int screen;
8+
9+
Window createWindow(int x, int y, int width, int height, int border, long borderColor, long rgb) {
10+
Window window = XCreateSimpleWindow(display, root, x, y, width, height, border, borderColor, rgb);
11+
return window;
12+
}
13+
14+
long rgb(int r, int g, int b) {
15+
return b + (g<<8) + (r<<16);
16+
}
17+
18+
int start(int x, int y, int width, int height, int border, long borderColor, long rgb, char[] windowTitle) {
19+
Window window;
20+
21+
if((display = XOpenDisplay(NULL)) == NULL) {
22+
printf("%s\n", "Couldn't open display");
23+
return 1;
24+
}
25+
26+
/* Get default screen and root window */
27+
screen = DefaultScreen(display);
28+
root = RootWindow(display, screen);
29+
30+
window = createWindow(x, y, width, height, border, borderColor, rgb);
31+
XSetStandardProperties(display, window, windowTitle, "", None, NULL, 0, NULL);
32+
/* Map window to display server */
33+
XMapWindow(display, window);
34+
35+
/* Unmap window */
36+
XUnmapWindow(display, window);
37+
XDestroyWindow(display, window);
38+
/* Close connection with display server */
39+
XCloseDisplay(display);
40+
return 0;
41+
}

‎Source.i

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
%module Source
2+
3+
extern Window createWindow(int x, int y, int width, int height, int border, long borderColor, long rgb);
4+
extern long rgb(int r, int g, int b);
5+
extern int start(int x, int y, int width, int height, int border, long borderColor, long rgb, char[] windowTitle);

0 commit comments

Comments
(0)

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