[quake2] Performance issue fixed, problem found

Brendan Burns brendanburns at attbi.com
Wed Jun 26 16:47:20 EDT 2002

Yeah, I lifted some code from SDL to do this.  Here's what I added:

/* Check to see if this is a repeated key.
   (idea shamelessly lifted from SDL who...)
   (idea shamelessly lifted from GII -- thanks guys! :)
   This has bugs if two keys are being pressed simultaneously and the
   events start getting interleaved.
int X11_KeyRepeat(Display *display, XEvent *event)
	XEvent peekevent;
	int repeated;

	repeated = 0;
	if ( XPending(display) ) {
		XPeekEvent(display, &peekevent);
		if ( (peekevent.type == KeyPress) &&
(peekevent.xkey.keycode == event->xkey.keycode) &&
((peekevent.xkey.time-event->xkey.time) < 2) ) {
			repeated = 1;
			XNextEvent(display, &peekevent);

Then to the HandleEvents function I changed the case for KeyRelease to:
	case KeyRelease:
	    if (! X11_KeyRepeat(dpy, &event)) {
	      if (in_state && in_state->Key_Event_fp)
		in_state->Key_Event_fp (XLateKey(&event.xkey), false);

I suspect that the same ought to work for solaris...


On Wed, 2002-06-26 at 03:21, Steve wrote:
> > How much shared meme did you put in /etc/system? Btw, if you install SUN's
> > gnome (1.4), it will modify /etc/system for you but I didn't know that
> > this would make a diff for quake2...
> 	Well, typically I install postgres at some point on a Sun machine,
> and it complains about not enough shared memory and then I fix it.
> However, this particular machine is just my desktop at the moment, and I
> hadn't had anything that errors due to low shared memory.  And since I
> don't use gnome, well, nothing ever set it for me :-)
> 	I put these shared memory settings in:
> set shmsys:shminfo_shmmax=0x2000000
> set shmsys:shminfo_shmmin=1
> set shmsys:shminfo_shmmni=256
> set shmsys:shminfo_shmseg=256
> set semsys:seminfo_semmap=256
> set semsys:seminfo_semmni=512
> set semsys:seminfo_semmns=512
> set semsys:seminfo_semmsl=32
> 	As for shared memory ... it probably doesn't help to have a *lot*
> of shared memory, but I think if you don't have enough, it probably chokes
> it a bit.  The default Sun level of shared memory probably was
> bottlenecking it somewhat.  Dunno why they default it so low :-)
> > I will try to see if I can reproduce that.. One sure thing is: I think to
> > remember that something about key presses like this was fixed in the Linux
> > source but I haven't (yet) looked into it and ported it to the Solaris
> > source.... Was in rw_x11.c, I think...
> >
> 	Well, let me know if you need help testing or anything, and I'll
> give it a shot >:-)
> Steve

More information about the quake2 mailing list