Browse Source

Enable context cursor handling by default, cursor property is empty string by default, removed auto keyword.

Michael Ragazzon 6 years ago
parent
commit
22422f2fe2

+ 2 - 2
Include/Rocket/Core/Context.h

@@ -120,8 +120,8 @@ public:
 	/// Unloads all loaded documents.
 	void UnloadAllDocuments();
 
-	/// Enable or disable handling of the mouse cursor from this context. If enabled, this will disable
-	/// cursor handling in all other contexts.
+	/// Enable or disable handling of the mouse cursor from this context.
+	/// When enabled, changes to the cursor name is transmitted through the system interface.
 	/// @param[in] show True to enable mouse cursor handling, false to disable.
 	void EnableMouseCursor(bool enable);
 

+ 2 - 8
Source/Core/Context.cpp

@@ -65,7 +65,7 @@ Context::Context(const String& name) : name(name), dimensions(0, 0), density_ind
 	document_focus_history.push_back(root);
 	focus = root;
 
-	enable_cursor = false;
+	enable_cursor = true;
 
 	drag_started = false;
 	drag_verbose = false;
@@ -370,12 +370,6 @@ void Context::UnloadAllDocuments()
 // Enables or disables the mouse cursor.
 void Context::EnableMouseCursor(bool enable)
 {
-	for (int i = 0; i < GetNumContexts(); i++)
-	{
-		if (Context * other_context = GetContext(i))
-			other_context->enable_cursor = false;
-	}
-
 	// The cursor is set to an invalid name so that it is forced to update in the next update loop.
 	cursor_name = ":reset:";
 	enable_cursor = enable;
@@ -948,7 +942,7 @@ void Context::UpdateHoverChain(const Dictionary& parameters, const Dictionary& d
 	{
 		String new_cursor_name;
 
-		if (hover && hover->GetProperty(CURSOR)->unit != Property::KEYWORD)
+		if (hover)
 			new_cursor_name = hover->GetProperty< String >(CURSOR);
 
 		if(new_cursor_name != cursor_name)

+ 1 - 1
Source/Core/StyleSheetSpecification.cpp

@@ -263,7 +263,7 @@ void StyleSheetSpecification::RegisterDefaultProperties()
 	RegisterProperty(TEXT_TRANSFORM, "none", true, true).AddParser("keyword", "none, capitalize, uppercase, lowercase");
 	RegisterProperty(WHITE_SPACE, "normal", true, true).AddParser("keyword", "normal, pre, nowrap, pre-wrap, pre-line");
 
-	RegisterProperty(CURSOR, "auto", true, false).AddParser("keyword", "auto").AddParser("string");
+	RegisterProperty(CURSOR, "", true, false).AddParser("string");
 
 	// Functional property specifications.
 	RegisterProperty(DRAG, "none", false, false).AddParser("keyword", "none, drag, drag-drop, block, clone");