File:Xhole.png

Page contents not supported in other languages.
This is a file from the Wikimedia Commons
From Wikipedia, the free encyclopedia

Xhole.png(433 × 384 pixels, file size: 8 KB, MIME type: image/png)

Summary

Description

A window with a hole in the middle. Used to illustrate the X Window shape extension. The decorative frames etc. are generated by twm. The program that creates this window is below; it has been written by User:Tizio, who release it in the public domain. I have took the screenshot myself.

/*
 * xhole.c
 *
 * A sample application using the shape extension.
 * Creates a window with a hole in the middle. Works
 * with twm, fvwm, and mwm, but kde refuses to add
 * a title bar to it.
 * Compile with `gcc xhole.c -o xhole -lX11 -lXext'
 */

#include <stdio.h>
#include <stdlib.h>
#include <X11/Xlib.h>
#include <X11/extensions/shape.h>

int main(int argc, char* argv[]) {
	Display *d;
	int s;
	Window w;
	Pixmap p;
	GC gw, gp;
	XEvent e;
	int x, y;

	/* open connection with the server */
	d = XOpenDisplay(NULL);
	if (d == NULL) {
		printf("Cannot open display\n");
		exit(1);
	}
	s = DefaultScreen(d);
	gw = DefaultGC(d, s);

	/* create window, select events, map  */
	w = XCreateSimpleWindow(d, RootWindow(d, s), 10, 10, 300, 200, 1,
			BlackPixel(d, s), WhitePixel(d, s));
	XSelectInput(d, w, ExposureMask | KeyPressMask | ButtonPressMask);
	XStoreName(d, w, "XHole");
	XMapWindow(d, w);

	/* create the pixmap that specifies the shape */
	p = XCreatePixmap(d, w, 400, 300, 1);
	gp = XCreateGC(d, p, 0, NULL);
	XSetForeground(d, gp, WhitePixel(d, s));
	XFillRectangle(d, p, gp, 0, 0, 400, 300);
	XSetForeground(d, gp, BlackPixel(d, s));
	XFillArc(d, p, gp, 120, 100, 100, 100, 0, 360*64);

	/* set the pixmap as the new window mask;
	the pixmap is slightly larger than the window
	to allow for the window border and title bar
	(as added by the window manager) to be visible */
	XShapeCombineMask(d, w, ShapeBounding, -20, -50, p, ShapeSet);

	/* event polling loop */
	while (1) {
		XNextEvent(d, &e);
		/* draw or redraw the window */
		if (e.type == Expose) {
			/* not the correct way of drawing text... */
			for (y = 10; y <= 210; y += 11) {
				for (x = 0; x < 300; x += 25) XDrawString(d, w, gw, x, y, "test", 4);
			}
		}

		/* exit on button press */
		if (e.type == ButtonPress)
			break;
	}

	/* close connection to display */
	XCloseDisplay(d);

	return 0;
}

Date 2 January 2006 (original upload date); 11 January 2006 (last version)
Source Transferred from en.wikipedia to Commons by User:JohnnyMrNinja using CommonsHelper.
Author Tizio at en.wikipedia
Permission
(Reusing this file)
twm is under the MIT License

Licensing

This screenshot either does not contain copyright-eligible parts or visuals of copyrighted software, or the author has released it under a free license (which should be indicated beneath this notice), and as such follows the licensing guidelines for screenshots of Wikimedia Commons. You may use it freely according to its particular license. Free software license:

This file is licensed under the Expat License, sometimes known as the MIT License:

Copyright © The author(s)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

The Software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the Software or the use or other dealings in the Software.


To uploader: MIT License has various versions, you may want to specify the license more precisely. Click {{MIT}} to see details.

Note: if the screenshot shows any work that is not a direct result of the program code itself, such as a text or graphics that are not part of the program, the license for that work must be indicated separately.


Public domain This work has been released into the public domain by its author, Tizio at English Wikipedia. This applies worldwide.
In some countries this may not be legally possible; if so:
Tizio grants anyone the right to use this work for any purpose, without any conditions, unless such conditions are required by law.

Original upload log

The original description page was here. All following user names refer to en.wikipedia.
  • 2006-01-11 20:38 Tizio 433×384×8 (8179 bytes) Cleaner version
  • 2006-01-02 13:08 Tizio 448×387×8 (8253 bytes) A window with a hole in the middle. Used to illustrate the X Window shape extension.

Captions

Add a one-line explanation of what this file represents

Items portrayed in this file

depicts

2 January 2006

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current06:46, 24 July 2008Thumbnail for version as of 06:46, 24 July 2008433 × 384 (8 KB)File Upload Bot (Magnus Manske) {{BotMoveToCommons|en.wikipedia}} {{Information |Description={{en|A window with a hole in the middle. Used to illustrate the X Window shape extension. The decorative frames etc. are generated by en:twm. The program that creates this window is below;
The following pages on the English Wikipedia use this file (pages on other projects are not listed):