source: trunk/third/startup-notification/test/test-send-xmessage.c @ 18723

Revision 18723, 2.0 KB checked in by ghudson, 22 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r18722, which included commits to RCS files with non-trunk default branches.
Line 
1/*
2 * Copyright (C) 2002 Red Hat, Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person
5 * obtaining a copy of this software and associated documentation
6 * files (the "Software"), to deal in the Software without
7 * restriction, including without limitation the rights to use, copy,
8 * modify, merge, publish, distribute, sublicense, and/or sell copies
9 * of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be
13 * included in all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
19 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
24
25#include <config.h>
26#include <libsn/sn.h>
27#include <libsn/sn-xmessages.h>
28
29#include "test-boilerplate.h"
30
31int
32main (int argc, char **argv)
33{
34  Display *xdisplay;
35  SnDisplay *display;
36
37  if (argc != 4)
38    {
39      fprintf (stderr, "Must specify message type, message begin type, and message content as first, second, and third args\n");
40      return 1;
41    }
42 
43  xdisplay = XOpenDisplay (NULL);
44  if (xdisplay == NULL)
45    {
46      fprintf (stderr, "Could not open display\n");
47      return 1;
48    }
49
50  if (getenv ("LIBSN_SYNC") != NULL)
51    XSynchronize (xdisplay, True);
52 
53  XSetErrorHandler (x_error_handler);
54 
55  display = sn_display_new (xdisplay,
56                            error_trap_push,
57                            error_trap_pop);
58 
59  sn_internal_broadcast_xmessage (display, DefaultScreen (xdisplay),
60                                  argv[1],
61                                  argv[2],
62                                  argv[3]);
63 
64  return 0;
65}
Note: See TracBrowser for help on using the repository browser.