1 /*****************************************************************************
2 * x11_theme.cpp: X11 implementation of the Theme class
3 *****************************************************************************
4 * Copyright (C) 2003 VideoLAN
5 * $Id: x11_theme.cpp,v 1.15 2003/06/22 12:46:49 asmax Exp $
7 * Authors: Cyril Deguet <asmax@videolan.org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111,
23 *****************************************************************************/
27 //--- X11 -------------------------------------------------------------------
30 //--- VLC -------------------------------------------------------------------
33 //--- SKIN ------------------------------------------------------------------
34 #include "../os_api.h"
35 #include "../src/banks.h"
36 #include "../src/window.h"
37 #include "../os_window.h"
38 #include "../src/event.h"
39 #include "../os_event.h"
40 #include "../src/theme.h"
41 #include "../os_theme.h"
42 #include "../src/vlcproc.h"
43 #include "../src/skin_common.h"
46 //---------------------------------------------------------------------------
47 void SkinManage( intf_thread_t *p_intf );
50 //---------------------------------------------------------------------------
52 //---------------------------------------------------------------------------
53 X11Theme::X11Theme( intf_thread_t *_p_intf ) : Theme( _p_intf )
57 display = p_intf->p_sys->display;
60 //---------------------------------------------------------------------------
64 //---------------------------------------------------------------------------
65 void X11Theme::OnLoadTheme()
71 //---------------------------------------------------------------------------
72 void X11Theme::AddSystemMenu( string name, Event *event )
74 if( name == "SEPARATOR" )
76 AppendMenu( SysMenu, MF_SEPARATOR, 0, NULL );
80 AppendMenu( SysMenu, MF_STRING, (unsigned int)event,
81 (char *)name.c_str() );
84 //---------------------------------------------------------------------------
85 void X11Theme::ChangeClientWindowName( string name )
88 XStoreName( display, p_intf->p_sys->mainWin, name.c_str() );
91 //---------------------------------------------------------------------------
92 void X11Theme::AddWindow( string name, int x, int y, bool visible,
93 int fadetime, int alpha, int movealpha, bool dragdrop )
96 Window root = DefaultRootWindow( display );
97 XSetWindowAttributes attr;
99 Window wnd = XCreateWindow( display, root, 0, 0, 1, 1, 0, 0, InputOutput,
100 CopyFromParent, 0, &attr );
101 XSelectInput( display, wnd, ExposureMask|StructureNotifyMask|
102 KeyPressMask|KeyReleaseMask|ButtonPressMask|
103 ButtonReleaseMask|PointerMotionMask|EnterWindowMask|
107 // Changing decorations
110 unsigned long functions;
111 unsigned long decorations;
113 unsigned long status;
116 Atom hints_atom = XInternAtom( display, "_MOTIF_WM_HINTS", False );
118 motifWmHints.flags = 2; // MWM_HINTS_DECORATIONS;
119 motifWmHints.decorations = 0;
121 XChangeProperty( display, wnd, hints_atom, hints_atom, 32,
122 PropModeReplace, (unsigned char *)&motifWmHints,
123 sizeof( motifWmHints ) / sizeof( long ) );
125 // Change the window title
126 XStoreName( display, wnd, name.c_str() );
129 WindowList.push_back( (SkinWindow *)new OSWindow( p_intf, wnd, x, y,
130 visible, fadetime, alpha, movealpha, dragdrop, name ) ) ;
132 //---------------------------------------------------------------------------
133 void X11Theme::ChangeTray()
137 Shell_NotifyIcon( NIM_DELETE, &TrayIcon );
142 Shell_NotifyIcon( NIM_ADD, &TrayIcon );
146 //---------------------------------------------------------------------------
147 void X11Theme::ChangeTaskbar()
151 ShowWindow( ParentWindow, SW_HIDE );
152 SetWindowLongPtr( ParentWindow, GWL_EXSTYLE,
153 WS_EX_LAYERED|WS_EX_TOOLWINDOW );
154 ShowWindow( ParentWindow, SW_SHOW );
155 ShowInTaskbar = false;
159 ShowWindow( ParentWindow, SW_HIDE );
160 SetWindowLongPtr( ParentWindow, GWL_EXSTYLE,
161 WS_EX_LAYERED|WS_EX_APPWINDOW );
162 ShowWindow( ParentWindow, SW_SHOW );
163 ShowInTaskbar = true;
166 //---------------------------------------------------------------------------