/[rdesktop]/sourceforge.net/trunk/rdesktop/ewmhints.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /sourceforge.net/trunk/rdesktop/ewmhints.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 300 by matthewc, Thu Jan 30 11:20:30 2003 UTC revision 468 by astrand, Mon Sep 15 07:59:36 2003 UTC
# Line 4  Line 4 
4     Support functions for Extended Window Manager Hints,     Support functions for Extended Window Manager Hints,
5     http://www.freedesktop.org/standards/wm-spec.html     http://www.freedesktop.org/standards/wm-spec.html
6    
7     Copyright (C) Matthew Chapman 1999-2002     Copyright (C) Peter Astrand <peter@cendio.se> 2003
8        
9     This program is free software; you can redistribute it and/or modify     This program is free software; you can redistribute it and/or modify
10     it under the terms of the GNU General Public License as published by     it under the terms of the GNU General Public License as published by
# Line 24  Line 24 
24  #include <X11/Xlib.h>  #include <X11/Xlib.h>
25  #include "rdesktop.h"  #include "rdesktop.h"
26    
27  extern Display *display;  extern Display *g_display;
28    
29  /*  /*
30     Get window property value (32 bit format)     Get window property value (32 bit format)
# Line 40  get_property_value(char *propname, long Line 40  get_property_value(char *propname, long
40          int actual_format_return;          int actual_format_return;
41          unsigned long bytes_after_return;          unsigned long bytes_after_return;
42    
43          property = XInternAtom(display, propname, True);          property = XInternAtom(g_display, propname, True);
44          if (property == None)          if (property == None)
45          {          {
46                  fprintf(stderr, "Atom %s does not exist\n", propname);                  fprintf(stderr, "Atom %s does not exist\n", propname);
47                  return (-1);                  return (-1);
48          }          }
49    
50          result = XGetWindowProperty(display, DefaultRootWindow(display), property, 0,   /* long_offset */          result = XGetWindowProperty(g_display, DefaultRootWindow(g_display), property, 0,       /* long_offset */
51                                      max_length, /* long_length */                                      max_length, /* long_length */
52                                      False,      /* delete */                                      False,      /* delete */
53                                      AnyPropertyType,    /* req_type */                                      AnyPropertyType,    /* req_type */
# Line 90  static int Line 90  static int
90  get_current_desktop(void)  get_current_desktop(void)
91  {  {
92          unsigned long nitems_return;          unsigned long nitems_return;
93          uint32 *prop_return;          unsigned char *prop_return;
94          int current_desktop;          int current_desktop;
95    
96          if (get_property_value("_NET_CURRENT_DESKTOP", 1, &nitems_return,          if (get_property_value("_NET_CURRENT_DESKTOP", 1, &nitems_return, &prop_return) < 0)
                                (unsigned char **) &prop_return) < 0)  
97                  return (-1);                  return (-1);
98    
99          if (nitems_return != 1)          if (nitems_return != 1)
# Line 118  get_current_workarea(uint32 * x, uint32 Line 117  get_current_workarea(uint32 * x, uint32
117  {  {
118          int current_desktop;          int current_desktop;
119          unsigned long nitems_return;          unsigned long nitems_return;
120          uint32 *prop_return;          unsigned char *prop_return;
121            uint32 *return_words;
122          const uint32 net_workarea_x_offset = 0;          const uint32 net_workarea_x_offset = 0;
123          const uint32 net_workarea_y_offset = 1;          const uint32 net_workarea_y_offset = 1;
124          const uint32 net_workarea_width_offset = 2;          const uint32 net_workarea_width_offset = 2;
125          const uint32 net_workarea_height_offset = 3;          const uint32 net_workarea_height_offset = 3;
126          const uint32 max_prop_length = 32 * 4;  /* Max 32 desktops */          const uint32 max_prop_length = 32 * 4;  /* Max 32 desktops */
127    
128          if (get_property_value("_NET_WORKAREA", max_prop_length, &nitems_return,          if (get_property_value("_NET_WORKAREA", max_prop_length, &nitems_return, &prop_return) < 0)
                                (unsigned char **) &prop_return) < 0)  
129                  return (-1);                  return (-1);
130    
131          if (nitems_return % 4)          if (nitems_return % 4)
# Line 140  get_current_workarea(uint32 * x, uint32 Line 139  get_current_workarea(uint32 * x, uint32
139          if (current_desktop < 0)          if (current_desktop < 0)
140                  return -1;                  return -1;
141    
142          *x = prop_return[current_desktop * 4 + net_workarea_x_offset];          return_words = (uint32 *) prop_return;
143          *y = prop_return[current_desktop * 4 + net_workarea_y_offset];  
144          *width = prop_return[current_desktop * 4 + net_workarea_width_offset];          *x = return_words[current_desktop * 4 + net_workarea_x_offset];
145          *height = prop_return[current_desktop * 4 + net_workarea_height_offset];          *y = return_words[current_desktop * 4 + net_workarea_y_offset];
146            *width = return_words[current_desktop * 4 + net_workarea_width_offset];
147            *height = return_words[current_desktop * 4 + net_workarea_height_offset];
148    
149          XFree(prop_return);          XFree(prop_return);
150    

Legend:
Removed from v.300  
changed lines
  Added in v.468

  ViewVC Help
Powered by ViewVC 1.1.26