Skip to content
This repository

ADD: expose ActivateScreenSaver function to python. #1670

Closed
wants to merge 1 commit into from

5 participants

Michael Wehr Martijn Kaijser Matthias Kortstiege ulion Sascha Montellese
Michael Wehr

This closes #1656.

Martijn Kaijser
Owner

@cptspiff
Since you semi commented in referenced PR. Is this ok for you?

Deleted user
ghost commented April 02, 2013

The content you are editing has changed. Reload the page and try again.

no. you cannot call that function off application thread.

Sending Request…

Attach images by dragging & dropping or selecting them. Octocat-spinner-32 Uploading your images… Unfortunately, we don't support that file type. Try again with a PNG, GIF, or JPG. Yowza, that's a big file. Try again with an image file smaller than 10MB. This browser doesn't support image attachments. We recommend updating to the latest Internet Explorer, Google Chrome, or Firefox. Something went really wrong, and we can't process that image. Try again.

Michael Wehr
SlrG commented April 02, 2013

@cptspiff:
Can you please explain a little further what you want me to change?

Matthias Kortstiege
Collaborator

Please move the call to the ApplicationMessenger in order to keep the main application thread clean.

Deleted user
ghost commented April 03, 2013

The content you are editing has changed. Reload the page and try again.

as builtin commands can be called from any thread we need to take concurrency into account. there is no knowing what the application thread is doing and blindly activating the screensaver from another thread is doomed. we thus have to make sure that it is called at a safe point. this is where the application messenger comes in handy. this allows threads to send a message to the application thread and have it do some task at a safe point.

add a new message to be used by the builtin. appmessenger is monkey see monkey do buisiness

Sending Request…

Attach images by dragging & dropping or selecting them. Octocat-spinner-32 Uploading your images… Unfortunately, we don't support that file type. Try again with a PNG, GIF, or JPG. Yowza, that's a big file. Try again with an image file smaller than 10MB. This browser doesn't support image attachments. We recommend updating to the latest Internet Explorer, Google Chrome, or Firefox. Something went really wrong, and we can't process that image. Try again.

ulion
Collaborator
ulion commented May 03, 2013

@cptspiff I checked CBuiltins::Execute(), there's other codes looks should only be called in xbmc main thread. so could it possible we already make sure CBuiltins::Execute() is called in xbmc main thread?

Sascha Montellese
Collaborator

@ulion: Only if it's called through CApplicationMessenger's execute builtins wrapper AFAIK.

ulion
Collaborator
ulion commented May 03, 2013

I didn't see any place calling CBuiltins::Execute() not in xbmc main thread, is there any?

Deleted user
ghost commented May 03, 2013

The content you are editing has changed. Reload the page and try again.

json python eventserver for off the top of my head examples

Sending Request…

Attach images by dragging & dropping or selecting them. Octocat-spinner-32 Uploading your images… Unfortunately, we don't support that file type. Try again with a PNG, GIF, or JPG. Yowza, that's a big file. Try again with an image file smaller than 10MB. This browser doesn't support image attachments. We recommend updating to the latest Internet Explorer, Google Chrome, or Firefox. Something went really wrong, and we can't process that image. Try again.

ulion
Collaborator
ulion commented May 03, 2013

if you mean the one called by CEventServer::ExecuteNextAction(), then it is not, which was called by CApplication::ProcessEventServer() and in xbmc main thread.

ulion
Collaborator
ulion commented May 03, 2013

on the other hand, even there's some place calling CBuiltins::Execute() not in xbmc main thread, as long as the calling params is hardcoded, it is not related to this new function. and I'm sure that in xbmc python calls XBMCAddon::xbmc::executebuiltin which then calls CApplicationMessenger::Get().ExecBuiltIn() so we need not do it again.

Deleted user
ghost commented May 03, 2013

The content you are editing has changed. Reload the page and try again.

fine i didnt dig all details. if all builtin calls from python are serialized we have a fuglier ahole to fill. that is just wrong.

Sending Request…

Attach images by dragging & dropping or selecting them. Octocat-spinner-32 Uploading your images… Unfortunately, we don't support that file type. Try again with a PNG, GIF, or JPG. Yowza, that's a big file. Try again with an image file smaller than 10MB. This browser doesn't support image attachments. We recommend updating to the latest Internet Explorer, Google Chrome, or Firefox. Something went really wrong, and we can't process that image. Try again.

Deleted user
ghost commented June 08, 2013

The content you are editing has changed. Reload the page and try again.

Sending Request…

Attach images by dragging & dropping or selecting them. Octocat-spinner-32 Uploading your images… Unfortunately, we don't support that file type. Try again with a PNG, GIF, or JPG. Yowza, that's a big file. Try again with an image file smaller than 10MB. This browser doesn't support image attachments. We recommend updating to the latest Internet Explorer, Google Chrome, or Firefox. Something went really wrong, and we can't process that image. Try again.

Deleted user ghost closed this June 08, 2013
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Oct 25, 2012
Michael Wehr ADD: expose ActivateScreenSaver function to python.
This closes #1656.
505a901
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 5 additions and 0 deletions. Show diff stats Hide diff stats

  1. 5  xbmc/interfaces/Builtins.cpp
5  xbmc/interfaces/Builtins.cpp
@@ -119,6 +119,7 @@ const BUILT_IN commands[] = {
119 119
   { "Minimize",                   false,  "Minimize XBMC" },
120 120
   { "Reset",                      false,  "Reset the system (same as reboot)" },
121 121
   { "Mastermode",                 false,  "Control master mode" },
  122
+  { "ActivateScreenSaver",        false,  "Activates the screensaver" },
122 123
   { "ActivateWindow",             true,   "Activate the specified window" },
123 124
   { "ActivateWindowAndFocus",     true,   "Activate the specified window and sets focus to the specified id" },
124 125
   { "ReplaceWindow",              true,   "Replaces the current window with the new one" },
@@ -321,6 +322,10 @@ int CBuiltins::Execute(const CStdString& execString)
321 322
     CGUIMessage msg(GUI_MSG_NOTIFY_ALL, 0, 0, GUI_MSG_UPDATE);
322 323
     g_windowManager.SendMessage(msg);
323 324
   }
  325
+  else if (execute.Equals("activatescreensaver"))
  326
+  {
  327
+    g_application.ActivateScreenSaver();
  328
+  }
324 329
   else if (execute.Equals("takescreenshot"))
325 330
   {
326 331
     CScreenShot::TakeScreenshot();
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.