Commit 4732f9db authored by Nick Pope's avatar Nick Pope Committed by Rémi Denis-Courmont

Added window roles for X11

Window roles can be used when configuring window managers to help users
place their windows and dialogs according to their preference.  This is
particularly useful for some of the *box window managers.
Signed-off-by: Rémi Denis-Courmont's avatarRémi Denis-Courmont <remi@remlab.net>
parent 47508ae9
......@@ -1304,6 +1304,7 @@ void CaptureOpenPanel::advancedDialog()
/* New Adv Prop dialog */
adv = new QDialog( this );
adv->setWindowTitle( qtr( "Advanced Options" ) );
adv->setWindowRole( "vlc-advanced-options" );
/* A main Layout with a Frame */
QVBoxLayout *mainLayout = new QVBoxLayout( adv );
......
......@@ -115,6 +115,7 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i ) : p_intf ( _p_i )
setAcceptDrops( true );
setWindowTitle( qtr( "Playlist" ) );
setWindowRole( "vlc-playlist" );
setWindowIcon( QApplication::windowIcon() );
}
......
......@@ -1381,6 +1381,7 @@ KeyInputDialog::KeyInputDialog( QTreeWidget *_table,
table = _table;
setWindowTitle( b_global ? qtr( "Global" ): ""
+ qtr( "Hotkey for " ) + keyToChange );
setWindowRole( "vlc-key-input" );
vLayout = new QVBoxLayout( this );
selected = new QLabel( qtr( "Press the new keys for " ) + keyToChange );
......
......@@ -38,6 +38,7 @@ BookmarksDialog::BookmarksDialog( intf_thread_t *_p_intf ):QVLCFrame( _p_intf )
setWindowFlags( Qt::Tool );
setWindowOpacity( config_GetFloat( p_intf, "qt-opacity" ) );
setWindowTitle( qtr( "Edit Bookmarks" ) );
setWindowRole( "vlc-bookmarks" );
QGridLayout *layout = new QGridLayout( this );
......
......@@ -42,6 +42,7 @@ ConvertDialog::ConvertDialog( QWidget *parent, intf_thread_t *_p_intf,
: QVLCDialog( parent, _p_intf )
{
setWindowTitle( qtr( "Convert" ) );
setWindowRole( "vlc-convert" );
QGridLayout *mainLayout = new QGridLayout( this );
SoutInputBox *inputBox = new SoutInputBox( this );
......
......@@ -40,6 +40,7 @@ ErrorsDialog::ErrorsDialog( QWidget *parent, intf_thread_t *_p_intf )
: QVLCDialog( parent, _p_intf )
{
setWindowTitle( qtr( "Errors" ) );
setWindowRole( "vlc-errors" );
resize( 500 , 300 );
QGridLayout *layout = new QGridLayout( this );
......
......@@ -40,6 +40,7 @@ ExtendedDialog::ExtendedDialog( intf_thread_t *_p_intf ): QVLCFrame( _p_intf )
setWindowFlags( Qt::Tool );
setWindowOpacity( config_GetFloat( p_intf, "qt-opacity" ) );
setWindowTitle( qtr( "Adjustments and Effects" ) );
setWindowRole( "vlc-extended" );
QGridLayout *layout = new QGridLayout( this );
layout->setLayoutMargins( 0, 2, 0, 1, 1 );
......
......@@ -106,6 +106,7 @@ void DialogHandler::requestLogin (vlc_object_t *, void *value)
QLayout *layout = new QVBoxLayout (dialog);
dialog->setWindowTitle (qfu(data->title));
dialog->setWindowRole ("vlc-login");
layout->setMargin (2);
/* User name and password fields */
......@@ -185,6 +186,7 @@ QVLCProgressDialog::QVLCProgressDialog (DialogHandler *parent,
{
if (data->title != NULL)
setWindowTitle (qfu(data->title));
setWindowRole ("vlc-progress");
setMinimumDuration (0);
connect (this, SIGNAL(progressed(int)), SLOT(setValue(int)));
......
......@@ -41,6 +41,7 @@ GotoTimeDialog::GotoTimeDialog( QWidget *parent, intf_thread_t *_p_intf)
{
setWindowFlags( Qt::Tool );
setWindowTitle( qtr( "Go to Time" ) );
setWindowRole( "vlc-goto-time" );
QGridLayout *mainLayout = new QGridLayout( this );
mainLayout->setSizeConstraint( QLayout::SetFixedSize );
......
......@@ -53,6 +53,7 @@ HelpDialog::HelpDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
{
setWindowTitle( qtr( "Help" ) );
setWindowRole( "vlc-help" );
setMinimumSize( 350, 300 );
QGridLayout *layout = new QGridLayout( this );
......@@ -85,6 +86,7 @@ AboutDialog::AboutDialog( QWidget *parent, intf_thread_t *_p_intf)
: QVLCDialog( parent, _p_intf )
{
setWindowTitle( qtr( "About" ) );
setWindowRole( "vlc-about" );
resize( 600, 500 );
setMinimumSize( 600, 500 );
......@@ -201,6 +203,7 @@ UpdateDialog *UpdateDialog::instance = NULL;
UpdateDialog::UpdateDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
{
setWindowTitle( qtr( "VLC media player updates" ) );
setWindowRole( "vlc-update" );
QGridLayout *layout = new QGridLayout( this );
......
......@@ -48,6 +48,7 @@ MediaInfoDialog::MediaInfoDialog( intf_thread_t *_p_intf,
isMainInputInfo = ( p_item == NULL );
setWindowTitle( qtr( "Media Information" ) );
setWindowRole( "vlc-media-info" );
/* TabWidgets and Tabs creation */
infoTabW = new QTabWidget;
......
......@@ -73,6 +73,7 @@ MessagesDialog::MessagesDialog( intf_thread_t *_p_intf)
: QVLCFrame( _p_intf )
{
setWindowTitle( qtr( "Messages" ) );
setWindowRole( "vlc-messages" );
/* General widgets */
QGridLayout *mainLayout = new QGridLayout( this );
......
......@@ -78,6 +78,7 @@ OpenDialog::OpenDialog( QWidget *parent,
/* Basic Creation of the Window */
ui.setupUi( this );
setWindowTitle( qtr( "Open Media" ) );
setWindowRole( "vlc-open-media" );
setWindowModality( Qt::WindowModal );
/* Tab definition and creation */
......
......@@ -60,6 +60,7 @@ OpenUrlDialog::OpenUrlDialog( QWidget *parent,
QVLCDialog( parent, _p_intf ), bClipboard( _bClipboard )
{
setWindowTitle( qtr( "Open URL" ) );
setWindowRole( "vlc-open-url" );
/* Buttons */
QPushButton *but;
......
......@@ -41,6 +41,7 @@ PlaylistDialog::PlaylistDialog( intf_thread_t *_p_intf )
QWidget *main = new QWidget( this );
setCentralWidget( main );
setWindowTitle( qtr( "Playlist" ) );
setWindowRole( "vlc-playlist" );
setWindowOpacity( config_GetFloat( p_intf, "qt-opacity" ) );
QHBoxLayout *l = new QHBoxLayout( centralWidget() );
......
......@@ -43,6 +43,7 @@ PluginDialog *PluginDialog::instance = NULL;
PluginDialog::PluginDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
{
setWindowTitle( qtr( "Plugins and extensions" ) );
setWindowRole( "vlc-plugins" );
QGridLayout *layout = new QGridLayout( this );
/* Main Tree for modules */
......
......@@ -44,6 +44,7 @@ PrefsDialog::PrefsDialog( QWidget *parent, intf_thread_t *_p_intf )
{
QGridLayout *main_layout = new QGridLayout( this );
setWindowTitle( qtr( "Preferences" ) );
setWindowRole( "vlc-preferences" );
/* Whether we want it or not, we need to destroy on close to get
consistency when reset */
......
......@@ -40,6 +40,7 @@ SoutDialog::SoutDialog( QWidget *parent, intf_thread_t *_p_intf, const QString&
: QVLCDialog( parent, _p_intf )
{
setWindowTitle( qtr( "Stream Output" ) );
setWindowRole( "vlc-stream-output" );
/* UI stuff */
ui.setupUi( this );
......
......@@ -45,6 +45,7 @@ ToolbarEditDialog::ToolbarEditDialog( QWidget *_w, intf_thread_t *_p_intf)
: QVLCDialog( _w, _p_intf )
{
setWindowTitle( qtr( "Toolbars Editor" ) );
setWindowRole( "vlc-toolbars-editor" );
QGridLayout *mainLayout = new QGridLayout( this );
setMinimumWidth( 600 );
setAttribute( Qt::WA_DeleteOnClose );
......
......@@ -105,6 +105,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
/* Main settings */
setFocusPolicy( Qt::StrongFocus );
setAcceptDrops( true );
setWindowRole( "vlc-main" );
setWindowIcon( QApplication::windowIcon() );
setWindowOpacity( config_GetFloat( p_intf, "qt-opacity" ) );
......@@ -605,6 +606,7 @@ int MainInterface::privacyDialog( QList<ConfigControl *> *controls )
QDialog *privacy = new QDialog( this );
privacy->setWindowTitle( qtr( "Privacy and Network Policies" ) );
privacy->setWindowRole( "vlc-privacy" );
QGridLayout *gLayout = new QGridLayout( privacy );
......
......@@ -267,6 +267,8 @@ static int Open (vlc_object_t *obj)
= intern_string (conn, "_NET_WM_NAME");
xcb_intern_atom_cookie_t net_wm_icon_name_ck
= intern_string (conn, "_NET_WM_ICON_NAME");
xcb_intern_atom_cookie_t wm_window_role_ck
= intern_string (conn, "WM_WINDOW_ROLE");
xcb_atom_t utf8 = get_atom (conn, utf8_string_ck);
......@@ -283,6 +285,9 @@ static int Open (vlc_object_t *obj)
xcb_atom_t net_wm_icon_name = get_atom (conn, net_wm_icon_name_ck);
set_string (conn, window, utf8, net_wm_icon_name, _("VLC"));
xcb_atom_t wm_window_role = get_atom (conn, wm_window_role_ck);
set_ascii_prop (conn, window, wm_window_role, "vlc-video");
/* Make the window visible */
xcb_map_window (conn, window);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment