redirect key events to the player window
[uwplayer.git] / application / player.c
index 7620a63..9e47049 100644 (file)
@@ -394,6 +394,23 @@ static void handle_json_rpc_reqid(Player *player, JSONValue *v, int reqid) {
     }
 }
 
+static Boolean get_player_window(XtPointer data) {
+    Player *p = data;
+    MainWindow *win = GetMainWindow();
+    
+    Widget player_wid = win->player_widget;
+    Window root, parent;
+    Window *child;
+    unsigned int nchild;
+    XQueryTree(XtDisplay(player_wid), XtWindow(player_wid), &root, &parent, &child, &nchild);
+    if(nchild > 0) {
+        p->window = child[0];
+        XFree(child);
+    }
+    
+    return 0;
+}
+
 static void handle_json_rpc_event(Player *p, JSONValue *v, JSONValue *event) {
     if(!json_strcmp(event, "property-change")) {
         JSONValue *name = json_obj_get(&v->value.object, "name");
@@ -411,6 +428,8 @@ static void handle_json_rpc_event(Player *p, JSONValue *v, JSONValue *event) {
                     "{ \"command\": [\"set_property\", \"keep-open\", true] }\n";
         write(p->ipc, cmd, strlen(cmd));
         p->isstarted = TRUE;
+        
+        AppExecProc(get_player_window, p);
     }
 }
 
@@ -508,3 +527,7 @@ void PlayerEOF(Player *p) {
     char *cmd = "{ \"command\": [\"set_property\", \"playback-time\", 0] }\n";
     write(p->ipc, cmd, strlen(cmd));
 }
+
+void PlayerHandleInput(MainWindow *win, Player *p, XmDrawingAreaCallbackStruct *cb) {
+    
+}