Commit 75bc99e6 authored by hybrid's avatar hybrid

Made Linux event local to event handler. Cleaned up file choosing.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@955 dfc29bdd-3216-0410-991c-e03cc46cb475
parent efc44f9b
...@@ -176,7 +176,7 @@ bool CGUIFileOpenDialog::OnEvent(SEvent event) ...@@ -176,7 +176,7 @@ bool CGUIFileOpenDialog::OnEvent(SEvent event)
case EGET_LISTBOX_SELECTED_AGAIN: case EGET_LISTBOX_SELECTED_AGAIN:
{ {
s32 selected = FileBox->getSelected(); const s32 selected = FileBox->getSelected();
if (FileList && FileSystem) if (FileList && FileSystem)
{ {
if (FileList->isDirectory(selected)) if (FileList->isDirectory(selected))
......
...@@ -378,16 +378,14 @@ bool CGUIListBox::OnEvent(SEvent event) ...@@ -378,16 +378,14 @@ bool CGUIListBox::OnEvent(SEvent event)
} }
case EMIE_LMOUSE_LEFT_UP: case EMIE_LMOUSE_LEFT_UP:
{
Selecting = false;
if (!isPointInside(p)) if (isPointInside(p))
{ selectNew(event.MouseInput.Y);
Selecting = false;
return true;
}
Selecting = false;
selectNew(event.MouseInput.Y);
return true; return true;
}
case EMIE_MOUSE_MOVED: case EMIE_MOUSE_MOVED:
if (Selecting || MoveOverSelect) if (Selecting || MoveOverSelect)
...@@ -420,11 +418,11 @@ void CGUIListBox::selectNew(s32 ypos, bool onlyHover) ...@@ -420,11 +418,11 @@ void CGUIListBox::selectNew(s32 ypos, bool onlyHover)
if (ItemHeight!=0) if (ItemHeight!=0)
Selected = ((ypos - AbsoluteRect.UpperLeftCorner.Y - 1) + ScrollBar->getPos()) / ItemHeight; Selected = ((ypos - AbsoluteRect.UpperLeftCorner.Y - 1) + ScrollBar->getPos()) / ItemHeight;
if (Selected >= (s32)Items.size())
Selected = Items.size() - 1;
else
if (Selected<0) if (Selected<0)
Selected = 0; Selected = 0;
else
if ((u32)Selected >= Items.size())
Selected = Items.size() - 1;
recalculateScrollPos(); recalculateScrollPos();
......
...@@ -671,6 +671,7 @@ bool CIrrDeviceLinux::run() ...@@ -671,6 +671,7 @@ bool CIrrDeviceLinux::run()
while (XPending(display) > 0 && !Close) while (XPending(display) > 0 && !Close)
{ {
XEvent event;
XNextEvent(display, &event); XNextEvent(display, &event);
switch (event.type) switch (event.type)
...@@ -773,16 +774,16 @@ bool CIrrDeviceLinux::run() ...@@ -773,16 +774,16 @@ bool CIrrDeviceLinux::run()
break; break;
case KeyRelease: case KeyRelease:
if (!AutorepeatSupport) if (0 == AutorepeatSupport)
{ {
// check for Autorepeat manually // check for Autorepeat manually
// We'll do the same as Windows does: Only send KeyPressed // We'll do the same as Windows does: Only send KeyPressed
// So every KeyRelease is a real release // So every KeyRelease is a real release
XEvent next_event; XEvent next_event;
XPeekEvent (event.xkey.display, &next_event); XPeekEvent (event.xkey.display, &next_event);
if (next_event.type == KeyPress && if ((next_event.type == KeyPress) &&
next_event.xkey.keycode == event.xkey.keycode && (next_event.xkey.keycode == event.xkey.keycode) &&
next_event.xkey.time == event.xkey.time) (next_event.xkey.time == event.xkey.time))
{ {
/* Ignore the key release event */ /* Ignore the key release event */
break; break;
......
...@@ -294,7 +294,6 @@ namespace irr ...@@ -294,7 +294,6 @@ namespace irr
Window window; Window window;
XSetWindowAttributes attributes; XSetWindowAttributes attributes;
XSizeHints* StdHints; XSizeHints* StdHints;
XEvent event;
XImage* SoftwareImage; XImage* SoftwareImage;
#ifdef _IRR_LINUX_X11_VIDMODE_ #ifdef _IRR_LINUX_X11_VIDMODE_
XF86VidModeModeInfo oldVideoMode; XF86VidModeModeInfo oldVideoMode;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment