source: mediastreamer2/tests/test_x11window.c @ 1363:e5ea97496c08

Last change on this file since 1363:e5ea97496c08 was 1363:e5ea97496c08, checked in by Simon Morlat <simon.morlat@…>, 2 years ago

build with correct video options on macosx.

File size: 1.7 KB
Line 
1/*
2mediastreamer2 library - modular sound and video processing and streaming
3Copyright (C) 2010  Belledonne Communications SARL (simon.morlat@linphone.org)
4
5This program is free software; you can redistribute it and/or
6modify it under the terms of the GNU General Public License
7as published by the Free Software Foundation; either version 2
8of the License, or (at your option) any later version.
9
10This program is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with this program; if not, write to the Free Software
17Foundation, 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
31int 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
Note: See TracBrowser for help on using the repository browser.