| 1 | /* |
|---|
| 2 | mediastreamer2 library - modular sound and video processing and streaming |
|---|
| 3 | Copyright (C) 2010 Belledonne Communications SARL (simon.morlat@linphone.org) |
|---|
| 4 | |
|---|
| 5 | This program is free software; you can redistribute it and/or |
|---|
| 6 | modify it under the terms of the GNU General Public License |
|---|
| 7 | as published by the Free Software Foundation; either version 2 |
|---|
| 8 | of the License, or (at your option) any later version. |
|---|
| 9 | |
|---|
| 10 | This program is distributed in the hope that it will be useful, |
|---|
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 13 | GNU General Public License for more details. |
|---|
| 14 | |
|---|
| 15 | You should have received a copy of the GNU General Public License |
|---|
| 16 | along with this program; if not, write to the Free Software |
|---|
| 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|---|
| 18 | */ |
|---|
| 19 | #ifdef HAVE_CONFIG_H |
|---|
| 20 | #include "mediastreamer-config.h" |
|---|
| 21 | #endif |
|---|
| 22 | #include <stdio.h> |
|---|
| 23 | #ifdef HAVE_X11_XLIB_H |
|---|
| 24 | #include <X11/Xlib.h> |
|---|
| 25 | #include <stdlib.h> |
|---|
| 26 | #include <string.h> |
|---|
| 27 | #include <unistd.h> |
|---|
| 28 | #endif |
|---|
| 29 | |
|---|
| 30 | |
|---|
| 31 | int main(int argc, char *argv[]){ |
|---|
| 32 | #ifdef HAVE_X11_XLIB_H |
|---|
| 33 | Display *display=XOpenDisplay(getenv("DISPLAY")); |
|---|
| 34 | XSetWindowAttributes wa; |
|---|
| 35 | memset(&wa,0,sizeof(wa)); |
|---|
| 36 | wa.event_mask=StructureNotifyMask; |
|---|
| 37 | if (display==NULL){ |
|---|
| 38 | printf("Could not open display.\n"); |
|---|
| 39 | return -1; |
|---|
| 40 | } |
|---|
| 41 | Window w=XCreateWindow(display,DefaultRootWindow(display),200,200, |
|---|
| 42 | 352, 288,0,CopyFromParent,CopyFromParent,CopyFromParent, |
|---|
| 43 | CWEventMask|CWBackPixel,&wa); |
|---|
| 44 | XMapWindow(display,w); |
|---|
| 45 | XSync(display,0); |
|---|
| 46 | printf("Created window with id=%lu\n",w); |
|---|
| 47 | while (1){ |
|---|
| 48 | sleep(1); |
|---|
| 49 | } |
|---|
| 50 | return 0; |
|---|
| 51 | #else |
|---|
| 52 | printf("This program only works with X11.\n"); |
|---|
| 53 | return -1; |
|---|
| 54 | #endif |
|---|
| 55 | } |
|---|
| 56 | |
|---|