Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Extra libraries, Code snippets, applications etc. » OS Problems etc., Win32, POSIX, MacOS, FreeBSD, X11 etc » X11App.cpp: GetKbdDelay()/GetkbdSpeed()
X11App.cpp: GetKbdDelay()/GetkbdSpeed() [message #3830] Wed, 28 June 2006 20:49 Go to previous message
guido is currently offline  guido
Messages: 169
Registered: April 2006
Experienced Member
I noticed GetKbdDelay()/GetkbdSpeed() are only returning default values yet, so I gave it a go, equipped with the source of Xorg's xset utility.
It doesn't compile yet due to X11/XKBlib.h importing union structs, incompatible with C++. After getting it to compile, it should work alright.
I think the xkb is ubicituous enough that no extra PLATFORM_ variable needs to be introduced.


#include <X11/XKBlib.h>

static int xkbdelay = 660, xkbrate = (1000/40);

static void GetXkbControls()
{
  int xkbmajor = XkbMajorVersion, xkbminor = XkbMinorVersion;
  int xkbopcode, xkbevent, xkberror;
  XkbDescPtr xkb;
  
  if (XkbQueryExtension(Xdisplay, &xkbopcode, &xkbevent, 
                        &xkberror, &xkbmajor, &xkbminor)
      && (xkb = XkbAllocKeyboard()) != NULL)
  {
     if (XkbGetControls(Xdisplay, XkbRepeatKeysMask, xkb) == Success)
   	 { 
   		xkbdelay = xkb->ctrls->repeat_delay;
   		xkbrate = 1000/xkb->ctrls->repeat_interval;
     }
     XkbFreeKeyboard(xkb, 0, XTrue);
  }
  
}

int Ctrl::GetKbdDelay()
{
	GetXkbControls();
 	return xkbdelay;
}

int Ctrl::GetKbdSpeed()
{
	GetXkbControls();
 	return xkbrate;
}


PS:
What does upp use those methods for anyway?
 
Read Message
Read Message
Previous Topic: Windows drives vs POSIX mounts
Next Topic: Using 605 in Linux several windows are not resizeable and don't fit in screen
Goto Forum:
  


Current Time: Thu Mar 28 19:14:33 CET 2024

Total time taken to generate the page: 0.01538 seconds