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 next 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?
Re: X11App.cpp: GetKbdDelay()/GetkbdSpeed() [message #3833 is a reply to message #3830] Thu, 29 June 2006 05:45 Go to previous message
mirek is currently offline  mirek
Messages: 12050
Registered: November 2005
Ultimate Member
For "MouseRepeat". In other words, if you push scrollbar up arrow.

There is LeftRepeat / RightRepeat virtual method in Ctrl. Both initial delay and repeat rate are derived from keyboard settings.

Mirek
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: Wed Oct 16 17:29:38 CEST 2019

Total time taken to generate the page: 0.02244 seconds