summaryrefslogtreecommitdiff
path: root/app/fvwm/libs/Grab.c
blob: 6d4162824f44d374e412d33eff23e66edd415563 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
** MyXGrabServer & MyXUngrabServer - to handle nested grab server calls
*/

#include <X11/Xlib.h>

/* Made into global for module interface.  See module.c. */
int myxgrabcount = 0;

void MyXGrabServer(Display *disp)
{
  if (myxgrabcount == 0)
  {
    XGrabServer(disp);
  }
  ++myxgrabcount;
}

void MyXUngrabServer(Display *disp)
{
  if (--myxgrabcount < 0) /* should never happen */
  {
    /* fvwm_msg(ERR,"MyXUngrabServer","too many ungrabs!\n"); */
    myxgrabcount = 0;
  }
  if (myxgrabcount == 0)
  {
    XUngrabServer(disp);
  }
}