Weird Mouse Behavior
Posted: Thu Aug 11, 2005 17:19
Alright, so I got this screen like displayed below. I think you can figure out what's CEGUI and what's not.
The green part on the side and bottom and the grid is drawn by my game engine, pretty much everything else is CEGUI.
Now, for some reason, on this screen only, when I click someplace, my mouse kinda freezes for a second and the FPS of my game engine goes to 0. When I click the grid section, the mouse freezes for about 1-1.5 seconds. When i click on a CEGUI button it takes about 0.5 seconds to respond and if i click on the green, the mouse freezes for about 0.5 seconds...
It didn't do this before (not that I knew of), so i tried commenting out whatever i've done since, and nothing works...
I removed ALL mouse events that might interfere in any way, or maybe was in a loop in some way, but with still all mouse events commented out, it still does it.
I know it is from inside CEGUI because the problem happens in the injectMouseButtonDown function. I can't seem to able to following to code to the function in debug mode though, it just does whatever it does and comes back (takes the same amount of time to go through in debug compared to runtime).
I don't know if you've ever seen this behavior before, but I'd like to know what you think about it before I take every part of the screen and iterate between them to see what part seems to be the problem...
Thanks
* EDIT *
BTW, here's the screen specific CEGUI code and the layout of the current screen:
Code:
Layout:
The green part on the side and bottom and the grid is drawn by my game engine, pretty much everything else is CEGUI.
Now, for some reason, on this screen only, when I click someplace, my mouse kinda freezes for a second and the FPS of my game engine goes to 0. When I click the grid section, the mouse freezes for about 1-1.5 seconds. When i click on a CEGUI button it takes about 0.5 seconds to respond and if i click on the green, the mouse freezes for about 0.5 seconds...
It didn't do this before (not that I knew of), so i tried commenting out whatever i've done since, and nothing works...
I removed ALL mouse events that might interfere in any way, or maybe was in a loop in some way, but with still all mouse events commented out, it still does it.
I know it is from inside CEGUI because the problem happens in the injectMouseButtonDown function. I can't seem to able to following to code to the function in debug mode though, it just does whatever it does and comes back (takes the same amount of time to go through in debug compared to runtime).
I don't know if you've ever seen this behavior before, but I'd like to know what you think about it before I take every part of the screen and iterate between them to see what part seems to be the problem...
Thanks
* EDIT *
BTW, here's the screen specific CEGUI code and the layout of the current screen:
Code:
// Setup SAD screen
SADWindow = (CEGUI::DefaultWindow*) CEGUI::WindowManager::getSingleton().loadWindowLayout("../layouts/SAD.layout");
// Sets up Playback Controls Position relative to SAD height
CEGUI::StaticText* ctrl = (CEGUI::StaticText*) CEGUI::WindowManager::getSingleton().getWindow("ControlBackground");
ctrl->setPosition(CEGUI::Absolute,CEGUI::Point(ctrl->getAbsoluteXPosition(), Constant::CFG_SCREENHEIGHT-Constant::CFG_SADGUI_HEIGHT+1));
CEGUI::Scrollbar* slider = (CEGUI::Scrollbar*) CEGUI::WindowManager::getSingleton().getWindow("TimeSlider");
slider->setPosition(CEGUI::Absolute,CEGUI::Point(slider->getAbsoluteXPosition(), Constant::CFG_SCREENHEIGHT-Constant::CFG_SADGUI_HEIGHT+59));
CEGUI::StaticText* mousepos = (CEGUI::StaticText*) CEGUI::WindowManager::getSingleton().getWindow("MousePOSBackground");
mousepos->setPosition(CEGUI::Absolute,CEGUI::Point(mousepos->getAbsoluteXPosition(), Constant::CFG_SCREENHEIGHT-Constant::CFG_SADGUI_HEIGHT+1));
// Sets up Tab Manager
tabMan = new TabManager(SADWindow); // Nothing fancy, just a way to be able to manipulate the tabs easily within its own class to free up Engine size
// Adds another Tab ontop of the default
tabMan->addTab("Tab #2");
// Sets up bottom corner buttons
CEGUI::PushButton* move = (CEGUI::PushButton*)CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/Button","MoveButton");
CEGUI::PushButton* zoom = (CEGUI::PushButton*)CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/Button","ZoomButton");
// Move Button Properties
move->setSize(CEGUI::Absolute,CEGUI::Size(18,18));
move->setPosition(CEGUI::Absolute,CEGUI::Point(Constant::CFG_SCREENWIDTH-Constant::CFG_SADGUI_WIDTH-55,Constant::CFG_SCREENHEIGHT-Constant::CFG_SADGUI_HEIGHT-27));
move->setZOrderingEnabled(false);
move->setAlwaysOnTop(true);
move->setProperty("NormalImage","set:Images image:MoveNormalButton");
move->setProperty("HoverImage","set:Images image:MoveHoverButton");
move->setProperty("PushedImage","set:Images image:MoveDownButton");
move->setProperty("UseStandardImagery","False");
move->setMouseAutoRepeatEnabled(true);
//move->subscribeEvent(CEGUI::Window::EventMouseButtonDown,CEGUI::Event::Subscriber(&ButtonHandle::handleMoveButton,BHandle));
zoom->setSize(CEGUI::Absolute,CEGUI::Size(18,18));
zoom->setPosition(CEGUI::Absolute,CEGUI::Point(Constant::CFG_SCREENWIDTH-Constant::CFG_SADGUI_WIDTH-28,Constant::CFG_SCREENHEIGHT-Constant::CFG_SADGUI_HEIGHT-27));
zoom->setZOrderingEnabled(false);
zoom->setAlwaysOnTop(true);
zoom->setProperty("NormalImage","set:Images image:ZoomNormalButton");
zoom->setProperty("HoverImage","set:Images image:ZoomHoverButton");
zoom->setProperty("PushedImage","set:Images image:ZoomDownButton");
zoom->setProperty("UseStandardImagery","False");
//zoom->subscribeEvent(CEGUI::Window::EventMouseButtonDown,CEGUI::Event::Subscriber(&ButtonHandle::handleZoomButton,BHandle));
SADWindow->addChildWindow(move);
SADWindow->addChildWindow(zoom);
CEGUI::Combobox* type = (CEGUI::Combobox*) CEGUI::WindowManager::getSingleton().getWindow("PropertyTypeBox");
type->addItem(new CEGUI::ListboxTextItem("Plane"));
type->addItem(new CEGUI::ListboxTextItem("Cruiser"));
type->addItem(new CEGUI::ListboxTextItem("Radar"));
type->addItem(new CEGUI::ListboxTextItem("Troops"));
type->addItem(new CEGUI::ListboxTextItem("Tank"));
type->setText("Cruiser");
rootWindow->addChildWindow(SADWindow);
Layout:
<?xml version="1.0" ?>
<GUILayout>
<Window Type="DefaultWindow" Name="SAD">
<Window Type="TaharezLook/StaticText" Name="ControlBackground">
<Property Name="BackgroundImage" Value="set:Images image:StaticBackground" />
<Property Name="TopLeftFrameImage" Value="set:Images image:StaticTopLeft" />
<Property Name="TopFrameImage" Value="set:Images image:StaticTop" />
<Property Name="TopRightFrameImage" Value="set:Images image:StaticTopRight" />
<Property Name="RightFrameImage" Value="set:Images image:StaticRight" />
<Property Name="BottomRightFrameImage" Value="set:Images image:StaticBottomRight" />
<Property Name="BottomFrameImage" Value="set:Images image:StaticBottom" />
<Property Name="BottomLeftFrameImage" Value="set:Images image:StaticBottomLeft" />
<Property Name="LeftFrameImage" Value="set:Images image:StaticLeft" />
<Property Name="AbsoluteSize" Value="w:146 h:60" />
<Property Name="AbsolutePosition" Value="x:5 y:825" />
<Property Name="ZOrderChangeEnabled" Value="False" />
<Window Type="TaharezLook/StaticText" Name="ControlText">
<Property Name="Text" Value="Controls" />
<Property Name="AbsoluteSize" Value="w:100 h:20" />
<Property Name="RelativePosition" Value="x:0.06 y:0.01" />
<Property Name="ZOrderChangeEnabled" Value="False" />
</Window>
<Window Type="TaharezLook/Button" Name="ControlRewind">
<Property Name="AbsoluteSize" Value="w:27 h:18" />
<Property Name="RelativePosition" Value="x:0.05 y:0.48" />
<Property Name="NormalImage" Value="set:Images image:RewindNormalButton" />
<Property Name="HoverImage" Value="set:Images image:RewindHoverButton" />
<Property Name="PushedImage" Value="set:Images image:RewindDownButton" />
<Property Name="UseStandardImagery" Value="False" />
<Property Name="Tooltip" Value="Rewind" />
</Window>
<Window Type="TaharezLook/Button" Name="ControlStop">
<Property Name="AbsoluteSize" Value="w:18 h:18" />
<Property Name="RelativePosition" Value="x:0.28 y:0.48" />
<Property Name="NormalImage" Value="set:Images image:StopNormalButton" />
<Property Name="HoverImage" Value="set:Images image:StopHoverButton" />
<Property Name="PushedImage" Value="set:Images image:StopDownButton" />
<Property Name="UseStandardImagery" Value="False" />
<Property Name="Tooltip" Value="Stop" />
</Window>
<Window Type="TaharezLook/Button" Name="ControlPause">
<Property Name="AbsoluteSize" Value="w:13 h:18" />
<Property Name="RelativePosition" Value="x:0.45 y:0.48" />
<Property Name="NormalImage" Value="set:Images image:PauseNormalButton" />
<Property Name="HoverImage" Value="set:Images image:PauseHoverButton" />
<Property Name="PushedImage" Value="set:Images image:PauseDownButton" />
<Property Name="UseStandardImagery" Value="False" />
<Property Name="Tooltip" Value="Pause" />
</Window>
<Window Type="TaharezLook/Button" Name="ControlPlay">
<Property Name="AbsoluteSize" Value="w:21 h:19" />
<Property Name="RelativePosition" Value="x:0.59 y:0.48" />
<Property Name="NormalImage" Value="set:Images image:PlayNormalButton" />
<Property Name="HoverImage" Value="set:Images image:PlayHoverButton" />
<Property Name="PushedImage" Value="set:Images image:PlayDownButton" />
<Property Name="UseStandardImagery" Value="False" />
<Property Name="Tooltip" Value="Play" />
</Window>
<Window Type="TaharezLook/Button" Name="ControlFastForward">
<Property Name="AbsoluteSize" Value="w:27 h:18" />
<Property Name="RelativePosition" Value="x:0.77 y:0.48" />
<Property Name="NormalImage" Value="set:Images image:FastForwardNormalButton" />
<Property Name="HoverImage" Value="set:Images image:FastForwardHoverButton" />
<Property Name="PushedImage" Value="set:Images image:FastForwardDownButton" />
<Property Name="UseStandardImagery" Value="False" />
<Property Name="Tooltip" Value="Fast Forward" />
</Window>
</Window>
<Window Type="TaharezLook/StaticText" Name="MousePOSBackground">
<Property Name="BackgroundImage" Value="set:Images image:StaticBackground" />
<Property Name="TopLeftFrameImage" Value="set:Images image:StaticTopLeft" />
<Property Name="TopFrameImage" Value="set:Images image:StaticTop" />
<Property Name="TopRightFrameImage" Value="set:Images image:StaticTopRight" />
<Property Name="RightFrameImage" Value="set:Images image:StaticRight" />
<Property Name="BottomRightFrameImage" Value="set:Images image:StaticBottomRight" />
<Property Name="BottomFrameImage" Value="set:Images image:StaticBottom" />
<Property Name="BottomLeftFrameImage" Value="set:Images image:StaticBottomLeft" />
<Property Name="LeftFrameImage" Value="set:Images image:StaticLeft" />
<Property Name="AbsoluteSize" Value="w:146 h:60" />
<Property Name="AbsolutePosition" Value="x:175 y:825" />
<Property Name="ZOrderChangeEnabled" Value="False" />
<Window Type="TaharezLook/StaticText" Name="MousePOSText">
<Property Name="Text" Value="Mouse" />
<Property Name="AbsoluteSize" Value="w:100 h:20" />
<Property Name="RelativePosition" Value="x:0.06 y:0.01" />
<Property Name="ZOrderChangeEnabled" Value="False" />
</Window>
<Window Type="TaharezLook/StaticText" Name="MousePOSXText">
<Property Name="Text" Value="x:" />
<Property Name="AbsoluteSize" Value="w:50 h:20" />
<Property Name="RelativePosition" Value="x:0.05 y:0.48" />
<Property Name="ZOrderChangeEnabled" Value="False" />
</Window>
<Window Type="TaharezLook/StaticText" Name="MousePOSX">
<Property Name="Text" Value="0" />
<Property Name="AbsoluteSize" Value="w:70 h:20" />
<Property Name="RelativePosition" Value="x:0.135 y:0.48" />
<Property Name="ZOrderChangeEnabled" Value="False" />
</Window>
<Window Type="TaharezLook/StaticText" Name="MousePOSYText">
<Property Name="Text" Value="y:" />
<Property Name="AbsoluteSize" Value="w:50 h:20" />
<Property Name="RelativePosition" Value="x:0.47 y:0.48" />
<Property Name="ZOrderChangeEnabled" Value="False" />
</Window>
<Window Type="TaharezLook/StaticText" Name="MousePOSY">
<Property Name="Text" Value="0" />
<Property Name="AbsoluteSize" Value="w:70 h:20" />
<Property Name="RelativePosition" Value="x:0.58 y:0.48" />
<Property Name="ZOrderChangeEnabled" Value="False" />
</Window>
</Window>
<Window Type="TaharezLook/HorizontalScrollbar" Name="TimeSlider">
<Property Name="AbsoluteSize" Value="w:144 h:10" />
<Property Name="AbsolutePosition" Value="x:7 y:883" />
<Property Name="ScrollPosition" Value="0" />
<Property Name="DocumentSize" Value="600" />
<Property Name="PageSize" Value="1" /
<Property Name="StepSize" Value="1" />
<Property Name="Tooltip" Value="Timeline Slider" />
</Window>
</Window>
</GUILayout>