2025-08-02 07:19 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0001733Spring engineGeneralpublic2010-01-08 02:14
ReporterTronic 
Assigned ToAuswaschbar 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
Product Version0.80.5 
Target Version0.81.0.0Fixed in Version 
Summary0001733: [PATCH] Dual screen "spring test" startup menu displays right but behaves incorrectly
DescriptionThe menu displays on one display only (as it should), but clicking the buttons is very difficult because the hitboxes are strecthed over both screens as if dual screen mode was not in use. Therefore the button graphics and the area one needs to click appear at different positions.

Tested on Linux.

TagsNo tags attached.
Checked infolog.txt for Errors
Attached Files
  • patch file icon screen_position_size_fixes.patch (3,377 bytes) 2009-11-25 09:04 -
    diff --git a/rts/System/SpringApp.cpp b/rts/System/SpringApp.cpp
    index eac5260..9c849ee 100644
    --- a/rts/System/SpringApp.cpp
    +++ b/rts/System/SpringApp.cpp
    @@ -519,7 +519,11 @@ void SpringApp::SetupViewportGeometry()
     		}
     	}
     
    -	agui::gui->UpdateScreenGeometry(gu->viewSizeX, gu->viewSizeY);
    +	agui::gui->UpdateScreenGeometry(
    +			gu->viewSizeX, 
    +			gu->viewSizeY, 
    +			gu->viewPosX, 
    +			(gu->winSizeY - gu->viewSizeY - gu->viewPosY) );
     	gu->pixelX = 1.0f / (float)gu->viewSizeX;
     	gu->pixelY = 1.0f / (float)gu->viewSizeY;
     
    diff --git a/rts/aGui/Gui.cpp b/rts/aGui/Gui.cpp
    index 927d5ab..beb1fec 100644
    --- a/rts/aGui/Gui.cpp
    +++ b/rts/aGui/Gui.cpp
    @@ -84,9 +84,9 @@ void Gui::RmElement(GuiElement* elem)
     	}
     }
     
    -void Gui::UpdateScreenGeometry(int screenx, int screeny)
    +void Gui::UpdateScreenGeometry(int screenx, int screeny, int screenOffsetX, int screenOffsetY)
     {
    -	GuiElement::UpdateDisplayGeo(screenx, screeny);
    +	GuiElement::UpdateDisplayGeo(screenx, screeny, screenOffsetX, screenOffsetY);
     }
     
     bool Gui::MouseOverElement(const GuiElement* elem, int x, int y) const
    diff --git a/rts/aGui/Gui.h b/rts/aGui/Gui.h
    index 95e74bd..4e62c68 100644
    --- a/rts/aGui/Gui.h
    +++ b/rts/aGui/Gui.h
    @@ -21,7 +21,7 @@ public:
     	/// deletes the element on the next draw
     	void RmElement(GuiElement*);
     	
    -	void UpdateScreenGeometry(int screenx, int screeny);
    +	void UpdateScreenGeometry(int screenx, int screeny, int screenOffsetX, int screenOffsetY);
     
     	bool MouseOverElement(const GuiElement*, int x, int y) const;
     
    @@ -46,4 +46,4 @@ void InitGui();
     
     }
     
    -#endif
    \ No newline at end of file
    +#endif
    diff --git a/rts/aGui/GuiElement.cpp b/rts/aGui/GuiElement.cpp
    index a083f56..f9a12ab 100644
    --- a/rts/aGui/GuiElement.cpp
    +++ b/rts/aGui/GuiElement.cpp
    @@ -6,6 +6,7 @@ namespace agui
     {
     
     int GuiElement::screensize[2];
    +int GuiElement::screenoffset[2];
     
     GuiElement::GuiElement(GuiElement* _parent) : parent(_parent), fixedSize(false)
     {
    @@ -53,20 +54,22 @@ bool GuiElement::MouseOver(float x, float y) const
     	return (x >= pos[0] && x <= pos[0]+size[0]) && (y >= pos[1] && y <= pos[1]+size[1]);
     }
     
    -void GuiElement::UpdateDisplayGeo(int x, int y)
    +void GuiElement::UpdateDisplayGeo(int x, int y, int xOffset, int yOffset)
     {
     	screensize[0] = x;
     	screensize[1] = y;
    +	screenoffset[0] = xOffset;
    +	screenoffset[1] = yOffset;
     }
     
     float GuiElement::PixelToGlX(int x)
     {
    -	return float(x)/float(screensize[0]);
    +	return float(x - screenoffset[0])/float(screensize[0]);
     }
     
     float GuiElement::PixelToGlY(int y)
     {
    -	return 1.0f - float(y)/float(screensize[1]);
    +	return 1.0f - float(y - screenoffset[1])/float(screensize[1]);
     }
     
     void GuiElement::AddChild(GuiElement* elem)
    diff --git a/rts/aGui/GuiElement.h b/rts/aGui/GuiElement.h
    index 272ff26..aa121b8 100644
    --- a/rts/aGui/GuiElement.h
    +++ b/rts/aGui/GuiElement.h
    @@ -18,7 +18,7 @@ public:
     	bool MouseOver(int x, int y) const;
     	bool MouseOver(float x, float y) const;
     	
    -	static void UpdateDisplayGeo(int x, int y);
    +	static void UpdateDisplayGeo(int x, int y, int offsetX, int offsetY);
     	static float PixelToGlX(int x);
     	static float PixelToGlY(int y);
     	
    @@ -76,6 +76,7 @@ protected:
     	virtual void GeometryChangeSelf() {};
     	
     	static int screensize[2];
    +	static int screenoffset[2];
     	
     	bool fixedSize;
     	float pos[2];
    @@ -84,4 +85,4 @@ protected:
     
     }
     
    -#endif
    \ No newline at end of file
    +#endif
    
    patch file icon screen_position_size_fixes.patch (3,377 bytes) 2009-11-25 09:04 +

-Relationships
+Relationships

-Notes

~0004371

stephenashelton (reporter)

Last edited: 2009-11-25 09:15

This patch (screen_position_size_fixes.patch) should work out kinks regarding both size and position. I tested some very unusual combinations of both without fail.

Note - the patch is for the 0.8.5 branch.

~0004376

hoijui (reporter)

thanks stephenashelton :-)
+Notes

-Issue History
Date Modified Username Field Change
2009-11-17 03:23 Tronic New Issue
2009-11-25 09:04 stephenashelton File Added: screen_position_size_fixes.patch
2009-11-25 09:05 stephenashelton Note Added: 0004371
2009-11-25 09:15 stephenashelton Note Edited: 0004371
2009-11-26 13:57 hoijui Note Added: 0004376
2009-11-26 13:57 hoijui Status new => confirmed
2009-11-26 13:57 hoijui Target Version => 0.81.0.0
2009-11-26 13:57 hoijui Summary Dual screen "spring test" startup menu displays right but behaves incorrectly => [PATCH] Dual screen "spring test" startup menu displays right but behaves incorrectly
2010-01-08 02:14 Auswaschbar Status confirmed => resolved
2010-01-08 02:14 Auswaschbar Resolution open => fixed
2010-01-08 02:14 Auswaschbar Assigned To => Auswaschbar
+Issue History