+static Boolean player_widget_set_size(XtPointer data) {
+ Player *player = data;
+ MainWindow *win = GetMainWindow();
+
+ if(!win->adjustWindowSize) {
+ return 0;
+ }
+
+ Dimension win_width, win_height;
+ XtVaGetValues(win->window, XmNwidth, &win_width, XmNheight, &win_height, NULL);
+ Dimension player_width, player_height;
+ XtVaGetValues(win->player_widget, XmNwidth, &player_width, XmNheight, &player_height, NULL);
+
+ Dimension new_width = player->width + win_width - player_width;
+ Dimension new_height = player->height + win_height - player_height;
+
+ // set window size
+ XtVaSetValues(win->window, XmNwidth, new_width, XmNheight, new_height, NULL);
+
+ // set window aspect ratio
+ XSizeHints hints;
+ hints.flags = PAspect;
+ hints.min_aspect.x = new_width;
+ hints.min_aspect.y = new_height;
+ hints.max_aspect.x = new_width;
+ hints.max_aspect.y = new_height;
+ XSetWMNormalHints(XtDisplay(win->window), XtWindow(win->window), &hints);
+
+ return 0;
+}
+
+
+