Example #1
0
void
VControl_RemoveJoyHatBinding (int port, int which, Uint8 dir, int *target)
{
#ifdef HAVE_JOYSTICK
	if (port >= 0 && port < joycount)
	{
		joystick *j = &joysticks[port];
		if (!(j->stick))
			create_joystick (port);
		if ((which >= 0) && (which < j->numhats))
		{
			if (dir == SDL_HAT_LEFT)
			{
				remove_binding(&joysticks[port].hats[which].left, target);
			}
			else if (dir == SDL_HAT_RIGHT)
			{
				remove_binding(&joysticks[port].hats[which].right, target);
			}
			else if (dir == SDL_HAT_UP)
			{
				remove_binding(&joysticks[port].hats[which].up, target);
			}
			else if (dir == SDL_HAT_DOWN)
			{
				remove_binding(&joysticks[port].hats[which].down, target);
			}
			else
			{
				log_add (log_Debug, "VControl: Attempted to unbind from illegal direction");
			}
		}
		else
		{
			log_add (log_Debug, "VControl: Attempted to unbind from illegal hat %d", which);
		}
	}
	else
#else
	(void) port;
	(void) which;
	(void) dir;
	(void) target;
#endif /* HAVE_JOYSTICK */
	{
		log_add (log_Debug, "VControl: Attempted to unbind from illegal port %d", port);
	}
}
Example #2
0
void
VControl_RemoveJoyButtonBinding (int port, int button, int *target)
{
#ifdef HAVE_JOYSTICK
	if (port >= 0 && port < joycount)
	{
		joystick *j = &joysticks[port];
		if (!(j->stick))
			create_joystick (port);
		if ((button >= 0) && (button < j->numbuttons))
		{
			remove_binding (&joysticks[port].buttons[button], target);
		}
		else
		{
			log_add (log_Debug, "VControl: Attempted to unbind from illegal button %d", button);
		}
	}
	else
#else
	(void) port;
	(void) button;
	(void) target;
#endif /* HAVE_JOYSTICK */
	{
		log_add (log_Debug, "VControl: Attempted to unbind from illegal port %d", port);
	}
}
Example #3
0
void
VControl_RemoveKeyBinding (SDLKey symbol, int *target)
{
	if ((symbol < 0) || (symbol >= num_sdl_keys)) {
		log_add (log_Warning, "VControl: Illegal key index %d", symbol);
		return;
	}
	remove_binding (&bindings[symbol], target);
}
Example #4
0
void mode_tempbinding(int newmode, int newvalue)
{
   short saveval;
   XPoint cpos;
   Widget window = areawin->viewport;

   if (boundfunction(window, BUTTON1, &saveval) == button1mode) {
      remove_binding(window, BUTTON1, button1mode);
      add_binding(window, BUTTON1, newmode, (short)newvalue);
      cpos = UGetCursor();
      eventdispatch(BUTTON1, (int)cpos.x, (int)cpos.y);
      remove_binding(window, BUTTON1, newmode);
      add_binding(window, BUTTON1, button1mode, saveval);
   }
   else
      fprintf(stderr, "Error: No such button1 binding %s\n",
                func_to_string(button1mode).toLocal8Bit().data());
}
Example #5
0
void mode_rebinding(int newmode, int newvalue)
{
   Widget window = areawin->viewport;

   remove_binding(window, BUTTON1, button1mode);
   add_binding(window, BUTTON1, newmode, (short)newvalue);
   button1mode = newmode;
   toolcursor(newmode);
}
Example #6
0
void remove_keybinding(Widget window, const char *keystring, const char *fstring)
{
   int function = string_to_func(fstring, NULL);
   int keywstate = string_to_key(keystring);

   if ((function < 0) || (remove_binding(window, keywstate, function) < 0)) {
      Wprintf("Key binding \'%s\' to \'%s\' does not exist in list.",
		keystring, fstring);
   }
}
Example #7
0
void
VControl_RemoveJoyAxisBinding (int port, int axis, int polarity, int *target)
{
#ifdef HAVE_JOYSTICK
	if (port >= 0 && port < joycount)
	{
		joystick *j = &joysticks[port];
		if (!(j->stick))
			create_joystick (port);
		if ((axis >= 0) && (axis < j->numaxes))
		{
			if (polarity < 0)
			{
				remove_binding(&joysticks[port].axes[axis].neg, target);
			}
			else if (polarity > 0)
			{
				remove_binding(&joysticks[port].axes[axis].pos, target);
			}
			else
			{
				log_add (log_Debug, "VControl: Attempted to unbind from polarity zero");
			}
		}
		else
		{
			log_add (log_Debug, "VControl: Attempted to unbind from illegal axis %d", axis);
		}
	}
	else
#else
	(void) port;
	(void) axis;
	(void) polarity;
	(void) target;
#endif /* HAVE_JOYSTICK */
	{
		log_add (log_Debug, "VControl: Attempted to unbind from illegal port %d", port);
	}
}
Example #8
0
void generic_bcache::update_binding(in_addr_t hoa, in_addr_t ha, in_addr_t coa, __u16 lifetime)
{
  if (lifetime == 0) {
    remove_binding(hoa, ha, coa);
    return;
  }

  binding *b = add_binding(hoa, ha, coa);
  b->hoa = hoa;
  b->ha = ha;
  b->coa = coa;
  if (lifetime == 0xffff)
    b->timeout = 0;
  else
    b->timeout = time(NULL) + ntohs(lifetime);
}
Example #9
0
/****************************************************************************
 *
 *  Parses a mouse or key binding
 *
 ****************************************************************************/
void ParseBindEntry(XEvent *eventp,Window w,FvwmWindow *tmp_win,
		    unsigned long junk, char *tline,int* Module, Bool fKey)
{
  char *action,context[20],modifiers[20],key[20],*ptr, *token;
  Binding *temp;
  int button,i,min,max;
  int n1=0,n2=0,n3=0;
  KeySym keysym;
  KeySym tkeysym;
  int contexts;
  int mods;
  int maxmods;
  int m;

  /* tline points after the key word "Mouse" or "Key" */
  ptr = GetNextToken(tline, &token);
  if(token != NULL)
  {
    if (fKey)
      n1 = sscanf(token,"%19s",key);
    else
      n1 = sscanf(token,"%d",&button);
    free(token);
  }

  ptr = GetNextToken(ptr,&token);
  if(token != NULL)
  {
    n2 = sscanf(token,"%19s",context);
    free(token);
  }

  action = GetNextToken(ptr,&token);
  if(token != NULL)
  {
    n3 = sscanf(token,"%19s",modifiers);
    free(token);
  }

  if((n1 != 1)||(n2 != 1)||(n3 != 1))
  {
    fvwm_msg(ERR,"ParseBindEntry","Syntax error in line %s",tline);
    return;
  }

  find_context(context,&contexts,win_contexts,tline);
  find_context(modifiers,&mods,key_modifiers,tline);

  if (fKey)
    {
      /*
       * Don't let a 0 keycode go through, since that means AnyKey to the
       * XGrabKey call in GrabKeys().
       */
      if ((keysym = XStringToKeysym(key)) == NoSymbol ||
	  (XKeysymToKeycode(dpy, keysym)) == 0)
	return;
    }

  /*
  ** strip leading whitespace from action if necessary
  */
  while (*action && (*action == ' ' || *action == '\t'))
    action++;

  /*
  ** is this an unbind request?
  */
  if (!action || action[0] == '-')
  {
    if (fKey)
      remove_binding(contexts,mods,0,keysym,0);
    else
      remove_binding(contexts,mods,button,0,1);
    return;
  }

  if (!fKey)
    {
      int j;

      if((contexts != C_ALL) && (contexts & C_LALL))
	{
	  /* check for nr_left_buttons */
	  i=0;
	  j=(contexts &C_LALL)/C_L1;
	  while(j>0)
	    {
	      i++;
	      j=j>>1;
	    }
	  if(Scr.nr_left_buttons <i)
	    Scr.nr_left_buttons = i;
	}