/[oroborus]/oroborus/src/misc.c
ViewVC logotype

Diff of /oroborus/src/misc.c

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

revision 1.1.1.1 by dreamind, Thu May 23 19:55:46 2002 UTC revision 1.2 by dreamind, Thu May 30 13:57:51 2002 UTC
# Line 27  Line 27 
27  #include <unistd.h>  #include <unistd.h>
28  #include "misc.h"  #include "misc.h"
29    
30  void getMouseXY(Display * dpy, Window w, int *x2, int *y2)  void
31    getMouseXY (Display * dpy, Window w, int *x2, int *y2)
32  {  {
33      Window w1, w2;    Window w1, w2;
34      int x1, y1, m;    int x1, y1, m;
35    
36  #ifdef DEBUG  #ifdef DEBUG
37      printf("entering getMouseXY\n");    printf ("entering getMouseXY\n");
38  #endif  #endif
39    
40      XQueryPointer(dpy, w, &w1, &w2, &x1, &y1, x2, y2, &m);    XQueryPointer (dpy, w, &w1, &w2, &x1, &y1, x2, y2, &m);
41  }  }
42    
43  Window getMouseWindow(Display * dpy, Window w)  Window
44    getMouseWindow (Display * dpy, Window w)
45  {  {
46      Window w1, w2;    Window w1, w2;
47      int x1, y1, x2, y2, m;    int x1, y1, x2, y2, m;
48    
49  #ifdef DEBUG  #ifdef DEBUG
50      printf("entering getMouseWindow\n");    printf ("entering getMouseWindow\n");
51  #endif  #endif
52    
53      XQueryPointer(dpy, w, &w1, &w2, &x1, &y1, &x2, &y2, &m);    XQueryPointer (dpy, w, &w1, &w2, &x1, &y1, &x2, &y2, &m);
54      return w2;    return w2;
55  }  }
56    
57  GC createGC(Display * dpy, Colormap cmap, char *col, int func,  GC
58              XFontStruct * font, int inc_sw)  createGC (Display * dpy, Colormap cmap, char *col, int func,
59              XFontStruct * font, int inc_sw)
60  {  {
61      XGCValues gv;    XGCValues gv;
62      XColor xc1, xc2;    XColor xc1, xc2;
63      GC gc;    GC gc;
64      int mask;    int mask;
65    
66  #ifdef DEBUG  #ifdef DEBUG
67      printf("entering createGC\n");    printf ("entering createGC\n");
68      printf("color=%s\n", col);    printf ("color=%s\n", col);
69  #endif  #endif
70    
71      mask = GCForeground | GCFunction;    mask = GCForeground | GCFunction;
72      XAllocNamedColor(dpy, cmap, col, &xc1, &xc2);    XAllocNamedColor (dpy, cmap, col, &xc1, &xc2);
73      gv.foreground = xc2.pixel;    gv.foreground = xc2.pixel;
74      gv.function = func;    gv.function = func;
75      if(font)    if (font)
76      {      {
77          gv.font = font->fid;        gv.font = font->fid;
78          mask = mask | GCFont;        mask = mask | GCFont;
79      }      }
80      if(inc_sw)    if (inc_sw)
81      {      {
82          gv.subwindow_mode = IncludeInferiors;        gv.subwindow_mode = IncludeInferiors;
83          mask = mask | GCSubwindowMode;        mask = mask | GCSubwindowMode;
84      }      }
85      gc = XCreateGC(dpy, XDefaultRootWindow(dpy), mask, &gv);    gc = XCreateGC (dpy, XDefaultRootWindow (dpy), mask, &gv);
86      return gc;    return gc;
87  }  }
88    
89  void sendClientMessage(Display * dpy, Window w, Atom a, long x, int mask)  void
90    sendClientMessage (Display * dpy, Window w, Atom a, long x, int mask)
91  {  {
92      XEvent ev;    XEvent ev;
93    
94  #ifdef DEBUG  #ifdef DEBUG
95      printf("entering sendClientMessage\n");    printf ("entering sendClientMessage\n");
96  #endif  #endif
97    
98      ev.type = ClientMessage;    ev.type = ClientMessage;
99      ev.xclient.window = w;    ev.xclient.window = w;
100      ev.xclient.message_type = a;    ev.xclient.message_type = a;
101      ev.xclient.format = 32;    ev.xclient.format = 32;
102      ev.xclient.data.l[0] = x;    ev.xclient.data.l[0] = x;
103      ev.xclient.data.l[1] = CurrentTime;    ev.xclient.data.l[1] = CurrentTime;
104      XSendEvent(dpy, w, False, mask, &ev);    XSendEvent (dpy, w, False, mask, &ev);
105  }  }

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26