[MPlayer-dev-eng] [PATCH PROPOSAL] Gui Saves Windows' Positions

Nicolas BENOIT nbenoit at tuxfamily.org
Tue Mar 18 19:12:06 CET 2003


Hello everybody!

I wrote that, in order to get my windows'position saved when I am using
the GUI. It doesn't work properly with the VideoOut Window, however,
this is better than before (at least for me).

Here are the lines you have to add, in order to get things working:

-------------------------------------------------------------------------------------------

In file mplayer/Gui/cfg.c:
   
[line 62]
int    gui_save_pos = 1;
int    gui_main_pos_x = -2;
int    gui_main_pos_y = -2;
int    gui_sub_pos_x = -1;
int    gui_sub_pos_y = -1;

[line 151]
{ "gui_save_pos", &gui_save_pos, CONF_TYPE_FLAG,0,0,1,NULL},
{ "gui_main_pos_x", &gui_main_pos_x, CONF_TYPE_INT,0,0,0,NULL},
{ "gui_main_pos_y", &gui_main_pos_y, CONF_TYPE_INT,0,0,0,NULL},
{ "gui_video_out_pos_x", &gui_sub_pos_x, CONF_TYPE_INT,0,0,0,NULL},
{ "gui_video_out_pos_y", &gui_sub_pos_y, CONF_TYPE_INT,0,0,0,NULL},

-------------------------------------------------------------------------------------------

In file mplayer/Gui/cfg.h:

[line 44]
extern int    gui_save_pos;
extern int    gui_main_pos_x;
extern int    gui_main_pos_y;
extern int    gui_sub_pos_x;
extern int    gui_sub_pos_y;

-------------------------------------------------------------------------------------------

In file mplayer/Gui/interface.c:

[line 197]
if (gui_save_pos)
{
  appMPlayer.main.x = gui_main_pos_x;
  appMPlayer.main.y = gui_main_pos_y;
  appMPlayer.sub.x = gui_sub_pos_x;
  appMPlayer.sub.y = gui_sub_pos_y; 
}

[line 333]
if (gui_save_pos)
{
  wsGetWindowPos( appMPlayer.mainWindow.WindowID, &gui_main_pos_x,
&gui_main_pos_y );
  wsGetWindowPos( appMPlayer.subWindow.WindowID, &gui_sub_pos_x,
&gui_sub_pos_y );
}

-------------------------------------------------------------------------------------------

In file mplayer/Gui/wm/ws.c:

[line 1198]
void wsGetWindowPos( Window win , int * pos_x , int * pos_y )
{
  XWindowAttributes win_attr;
  Status stat;

  stat = XGetWindowAttributes(wsDisplay, win, &win_attr);

  if ((stat != BadDrawable) && (stat != BadWindow))
  {
    *pos_x = win_attr.x;
    *pos_y = win_attr.y;
  }
  else
  {
    *pos_x = -1;
    *pos_y = -1;
  }

  return;
}

-------------------------------------------------------------------------------------------

In file mplayer/Gui/wm/ws.h:

[line 231]
extern void wsGetWindowPos( Window win , int * pos_x , int * pos_y ); //
This Writes The Window Position

-------------------------------------------------------------------------------------------


The lines' numbers are MPlayer-RC5 compliant.
After compiling, launch MPlayer, close it, and make sure you've got
gui_save_pos=yes in the gui.conf file. Then, the positions should be
saved...

Nicolas.

-- 
Nicolas BENOIT
http://nbenoit.tuxfamily.org



More information about the MPlayer-dev-eng mailing list