File:Xlib square example with ICEWM decorations.png
From Wikimedia Commons, the free media repository
Jump to navigation
Jump to search
Xlib_square_example_with_ICEWM_decorations.png (208 × 228 pixels, file size: 2 KB, MIME type: image/png)
File information
Structured data
Captions
Captions
Add a one-line explanation of what this file represents
Summary
[edit]DescriptionXlib square example with ICEWM decorations.png |
Čeština: Jednoduchá Xlib aplikace vykreslující čtvereček a text v okně. S dekoracemi správce oken IceWM.
English: Simple Xlib application drawing a box and text in a window. With IceWM window manager decorations. |
Date | |
Source | Own work |
Author | Skim |
Licensing
[edit]I, the copyright holder of this work, hereby publish it under the following license:
This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license.
- You are free:
- to share – to copy, distribute and transmit the work
- to remix – to adapt the work
- Under the following conditions:
- attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
- share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
C source code
[edit]/*
* Simple Xlib application drawing a box in a window.
* gcc input.c -o output -lX11
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <X11/Xlib.h>
int
main(int argc, char **argv)
{
Display *display;
Window window;
XEvent event;
char *msg = "Hello, World!";
int s;
/* Open connection with the server. */
display = XOpenDisplay(NULL);
if(display == NULL){
fprintf(stderr, "Cannot open display\n");
exit(1);
}
s = DefaultScreen(display);
/* Create window. */
window = XCreateSimpleWindow(display, RootWindow(display, s), 10, 10,
200, 200, 1, BlackPixel(display, s), WhitePixel(display, s));
/* Select kind of events we are interested in. */
XSelectInput(display, window, ExposureMask | KeyPressMask);
/* Map (show) the window. */
XMapWindow(display, window);
/* Event loop. */
for(;;){
XNextEvent(display, &event);
/* Draw or redraw the window. */
if(event.type == Expose){
XFillRectangle(display, window, DefaultGC(display, s),
20, 20, 10, 10);
XDrawString(display, window, DefaultGC(display, s), 50,
50, msg, strlen(msg));
}
/* Exit on key press. */
if(event.type == KeyPress)
break;
}
/* Close connection to server. */
XCloseDisplay(display);
return 0;
}
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 09:28, 1 January 2014 | 208 × 228 (2 KB) | Skim (talk | contribs) | User created page with UploadWizard |
You cannot overwrite this file.
File usage on Commons
The following page uses this file:
File usage on other wikis
The following other wikis use this file:
Metadata
This file contains additional information such as Exif metadata which may have been added by the digital camera, scanner, or software program used to create or digitize it. If the file has been modified from its original state, some details such as the timestamp may not fully reflect those of the original file. The timestamp is only as accurate as the clock in the camera, and it may be completely wrong.
PNG file comment |
|
---|---|
Horizontal resolution | 37.8 dpc |
Vertical resolution | 37.8 dpc |
File change date and time | 09:24, 1 January 2014 |