Last active
November 1, 2015 01:41
-
-
Save bFraley/11f60f20c42211bbdf70 to your computer and use it in GitHub Desktop.
Revisions
-
bFraley revised this gist
Aug 11, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -45,7 +45,7 @@ int main() redraw(); } XSetForeground(display, gc, 100); // 100 is a color XFillRectangle(display, win, gc, 30, 30, 200, 200); } } /* END MAIN */ -
bFraley revised this gist
Aug 11, 2015 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -44,8 +44,8 @@ int main() /* The window was exposed, redraw it */ redraw(); } XSetForeground(display, gc, 100); // 100 is a color XFillRectangle(display, win, gc, 30, 30, 200, 200); } } /* END MAIN */ -
bFraley revised this gist
Aug 11, 2015 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -30,10 +30,10 @@ int main() window_init(); // Basic setup for events and keypress keys XEvent event; /* XEvent declaration. */ KeySym key; /* KeyPress event key */ char text[255]; /* Buffer for KeyPress events */ _Bool run = 1; while(run) { @@ -74,7 +74,7 @@ void window_init() // NOTE: At minimum, we have to select the ExposureMask in order for draw // functions to produce output (draw) to the window. XSelectInput(display, win, ExposureMask|ButtonPressMask|KeyPressMask); gc=XCreateGC(display, win, 0, 0); -
bFraley revised this gist
Aug 11, 2015 . 1 changed file with 15 additions and 16 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -27,26 +27,26 @@ Main */ int main() { window_init(); // Basic setup for events and keypress keys XEvent event; /* XEvent declaration. */ KeySym key; /* KeyPress event key */ char text[255]; /* Buffer for KeyPress events */ _Bool run = 1; while(run) { XNextEvent(display, &event); if (event.type==Expose && event.xexpose.count==0) { /* The window was exposed, redraw it */ redraw(); } XSetForeground(display, gc, 100); // 100 is a color XFillRectangle(display, win, gc, 30, 30, 200, 200); } } /* END MAIN */ @@ -57,34 +57,34 @@ Function definitions. /* window_init creates and manages a window and it's structures.*/ void window_init() { unsigned long black, white; display=XOpenDisplay((char *)0); screen=DefaultScreen(display); black=BlackPixel(display, screen), white=WhitePixel(display, screen); win=XCreateSimpleWindow(display,DefaultRootWindow(display), 50, 50, 500, 500, 5, black, white); XSetStandardProperties(display, win, "zeta","zeta", None, NULL, 0, NULL); // NOTE: At minimum, we have to select the ExposureMask in order for draw // functions to produce output (draw) to the window. XSelectInput(display, win, ExposureMask|ButtonPressMask|KeyPressMask); gc=XCreateGC(display, win, 0, 0); XSetBackground(display, gc, white); XSetForeground(display, gc, black); XClearWindow(display, win); XMapRaised(display, win); }; void close_window() @@ -94,7 +94,6 @@ void close_window() XDestroyWindow(display, win); XCloseDisplay(display); }; void redraw() -
bFraley created this gist
Aug 11, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,103 @@ /* This should compile using: gcc X11_testAPI.c-o X11_test -I /usr/include/X11 -L /usr/X11/lib -lX11 */ // X11 header files. #include <X11/Xlib.h> #include <X11/Xutil.h> #include <X11/Xos.h> // Declare X11 globals Display *display; /* X11 display type */ int screen; /* X11 - client screen */ Window win; /* X11 Window type */ GC gc; /* X11 GC (graphic context) type */ /** Function declarations. */ void window_init(); void close_window(); void redraw(); /** Main */ int main() { window_init(); // Basic setup for events and keypress keys XEvent event; /* XEvent declaration. */ KeySym key; /* KeyPress event key */ char text[255]; /* Buffer for KeyPress events */ _Bool run = 1; while(run) { XNextEvent(display, &event); if (event.type==Expose && event.xexpose.count==0) { /* The window was exposed, redraw it */ redraw(); } XSetForeground(display, gc, 100); // 100 is a color XFillRectangle(display, win, gc, 30, 30, 200, 200); } } /* END MAIN */ /** Function definitions. */ /* window_init creates and manages a window and it's structures.*/ void window_init() { unsigned long black, white; display=XOpenDisplay((char *)0); screen=DefaultScreen(display); black=BlackPixel(display, screen), white=WhitePixel(display, screen); win=XCreateSimpleWindow(display,DefaultRootWindow(display), 50, 50, 500, 500, 5, black, white); XSetStandardProperties(display, win, "zeta","zeta", None, NULL, 0, NULL); // NOTE: At minimum, we have to select the ExposureMask in order for draw // functions to produce output (draw) to the window. XSelectInput(display, win, ExposureMask|ButtonPressMask|KeyPressMask); gc=XCreateGC(display, win, 0, 0); XSetBackground(display, gc, white); XSetForeground(display, gc, black); XClearWindow(display, win); XMapRaised(display, win); }; void close_window() { XFreeGC(display, gc); XDestroyWindow(display, win); XCloseDisplay(display); }; void redraw() { XClearWindow(display, win); };