svn merge -r614882 from trunk (autogenerated kwinadaptor)

svn path=/branches/work/kwin_composite/; revision=614905
This commit is contained in:
Luboš Luňák 2006-12-19 12:53:26 +00:00
parent 18e5c6386c
commit 19b9b0cd09
2 changed files with 166 additions and 55 deletions

View file

@ -8,7 +8,11 @@ add_subdirectory( pics )
add_subdirectory( clients ) add_subdirectory( clients )
add_subdirectory( data ) add_subdirectory( data )
include_directories( ${CMAKE_CURRENT_BINARY_DIR}/lib ${CMAKE_CURRENT_SOURCE_DIR}/lib ) include_directories(
${CMAKE_CURRENT_BINARY_DIR}/lib
${CMAKE_CURRENT_SOURCE_DIR}/lib
${CMAKE_CURRENT_SOURCE_DIR}/effects
)
@ -37,27 +41,102 @@ set(kwin_KDEINIT_SRCS
activation.cpp activation.cpp
useractions.cpp useractions.cpp
geometry.cpp geometry.cpp
rules.cpp ) rules.cpp
composite.cpp
toplevel.cpp
unmanaged.cpp
scene.cpp
scene_basic.cpp
scene_xrender.cpp
scene_opengl.cpp
glutils.cpp
effects.cpp
effects/fadein.cpp
effects/maketransparent.cpp
effects/scalein.cpp
effects/shakymove.cpp
effects/shiftworkspaceup.cpp
effects/howto.cpp
effects/dialogparent.cpp
effects/showfps.cpp
effects/zoom.cpp
)
qt4_add_dbus_adaptor( kwin_KDEINIT_SRCS org.kde.KWin.xml workspace.h KWinInternal::Workspace ) qt4_add_dbus_adaptor( kwin_KDEINIT_SRCS org.kde.KWin.xml workspace.h KWinInternal::Workspace )
kde4_automoc(${kwin_KDEINIT_SRCS}) kde4_automoc(kwin ${kwin_KDEINIT_SRCS})
kde4_add_kdeinit_executable( kwin ${kwin_KDEINIT_SRCS}) kde4_add_kdeinit_executable( kwin ${kwin_KDEINIT_SRCS})
target_link_libraries(kdeinit_kwin ${KDE4_KDEUI_LIBS} kdecorations ${X11_LIBRARIES} ${QT_QT3SUPPORT_LIBRARY} ) target_link_libraries(kdeinit_kwin ${KDE4_KDEUI_LIBS} kdecorations ${X11_LIBRARIES} ${QT_QT3SUPPORT_LIBRARY} )
target_link_libraries(kdeinit_kwin -lGL)
# -ldl used by OpenGL code
target_link_libraries(kdeinit_kwin -ldl)
if (X11_Xrandr_FOUND)
target_link_libraries(kdeinit_kwin ${X11_Xrandr_LIB})
endif (X11_Xrandr_FOUND)
if (X11_Xcomposite_FOUND)
target_link_libraries(kdeinit_kwin ${X11_Xcomposite_LIB})
endif (X11_Xcomposite_FOUND)
if (X11_Xdamage_FOUND)
target_link_libraries(kdeinit_kwin ${X11_Xdamage_LIB})
endif (X11_Xdamage_FOUND)
if (X11_Xrender_FOUND)
target_link_libraries(kdeinit_kwin ${X11_Xrender_LIB})
endif (X11_Xrender_FOUND)
if (X11_Xfixes_FOUND)
target_link_libraries(kdeinit_kwin ${X11_Xfixes_LIB})
endif (X11_Xfixes_FOUND)
install(TARGETS kdeinit_kwin DESTINATION ${LIB_INSTALL_DIR} ) install(TARGETS kdeinit_kwin DESTINATION ${LIB_INSTALL_DIR} )
target_link_libraries( kwin kdeinit_kwin ) target_link_libraries( kwin kdeinit_kwin )
install(TARGETS kwin DESTINATION ${BIN_INSTALL_DIR}) install(TARGETS kwin DESTINATION bin)
########### install files ############### ########### install files ###############
install( FILES kwin.kcfg DESTINATION ${KCFG_INSTALL_DIR} ) install( FILES kwin.kcfg DESTINATION ${KCFG_INSTALL_DIR} )
install( FILES eventsrc DESTINATION ${DATA_INSTALL_DIR}/kwin ) install( FILES eventsrc DESTINATION ${DATA_INSTALL_DIR}/kwin )
kde4_install_icons( ${ICON_INSTALL_DIR} ) kde4_install_icons( ${ICON_INSTALL_DIR} crystalsvg )
#original Makefile.am contents follow:
#INCLUDES = -I$(srcdir)/lib $(all_includes)
#
#SUBDIRS = lib . killer kcmkwin pics clients oldheaders data
#
#bin_PROGRAMS =
#lib_LTLIBRARIES =
#kdeinit_LTLIBRARIES = kwin.la
#
#kwin_la_SOURCES = workspace.cpp client.cpp placement.cpp atoms.cpp \
# utils.cpp layers.cpp main.cpp popupinfo.cpp tabbox.cpp \
# options.cpp plugins.cpp events.cpp KWinInterface.skel \
# killwindow.cpp geometrytip.cpp sm.cpp group.cpp bridge.cpp \
# manage.cpp notifications.cpp activation.cpp useractions.cpp \
# geometry.cpp rules.cpp
#
#kwin_la_LIBADD = $(LIB_KDEUI) lib/libkdecorations.la
#kwin_la_LDFLAGS = $(all_libraries) -module -avoid-version
#
#include_HEADERS = KWinInterface.h
#
#KDE_ICON = kwin
#
#METASOURCES = AUTO
#
#messages: rc.cpp
# $(XGETTEXT) *.h *.cpp killer/*.cpp lib/*.cpp -o $(podir)/kwin.pot
#
#kwin_datadir = $(kde_datadir)/kwin
#
#kwin_data_DATA= eventsrc
#
#kde_kcfg_DATA = kwin.kcfg
#
#include ../../admin/Doxyfile.am

View file

@ -42,6 +42,9 @@ License. See the file "COPYING" for the exact licensing terms.
#include "group.h" #include "group.h"
#include "rules.h" #include "rules.h"
#include "kwinadaptor.h" #include "kwinadaptor.h"
#include "unmanaged.h"
#include "scene.h"
#include "effects.h"
#include <X11/extensions/shape.h> #include <X11/extensions/shape.h>
#include <X11/keysym.h> #include <X11/keysym.h>
@ -93,6 +96,7 @@ Workspace::Workspace( bool restore )
popupinfo (0), popupinfo (0),
popup (0), popup (0),
advanced_popup (0), advanced_popup (0),
trans_popup (0),
desk_popup (0), desk_popup (0),
desk_popup_index (0), desk_popup_index (0),
keys (0), keys (0),
@ -122,12 +126,16 @@ Workspace::Workspace( bool restore )
topmenu_space( NULL ), topmenu_space( NULL ),
set_active_client_recursion( 0 ), set_active_client_recursion( 0 ),
block_stacking_updates( 0 ), block_stacking_updates( 0 ),
forced_global_mouse_grab( false ) forced_global_mouse_grab( false ),
cm_selection( NULL ),
compositeRate( 0 ),
damage_region( None ),
overlay( None ),
transSlider( NULL ),
transButton( NULL )
{ {
(void) new KWinAdaptor( this ); (void) new KWinAdaptor( this );
QDBusConnection dbus = QDBusConnection::sessionBus(); QDBusConnection::sessionBus().registerObject("/KWin", this);
dbus.registerObject("/KWin", this);
dbus.connect(QString(), "/KWin", "org.kde.KWin", "reloadConfig", this, SLOT(slotReloadConfig()));
_self = this; _self = this;
mgr = new PluginMgr; mgr = new PluginMgr;
@ -169,10 +177,12 @@ Workspace::Workspace( bool restore )
ColormapChangeMask | ColormapChangeMask |
SubstructureRedirectMask | SubstructureRedirectMask |
SubstructureNotifyMask | SubstructureNotifyMask |
FocusChangeMask // for NotifyDetailNone FocusChangeMask | // for NotifyDetailNone
ExposureMask
); );
Shape::init(); Extensions::init();
setupCompositing();
// compatibility // compatibility
long data = 1; long data = 1;
@ -321,6 +331,7 @@ void Workspace::init()
connect(&reconfigureTimer, SIGNAL(timeout()), this, connect(&reconfigureTimer, SIGNAL(timeout()), this,
SLOT(slotReconfigure())); SLOT(slotReconfigure()));
connect( &updateToolWindowsTimer, SIGNAL( timeout()), this, SLOT( slotUpdateToolWindows())); connect( &updateToolWindowsTimer, SIGNAL( timeout()), this, SLOT( slotUpdateToolWindows()));
connect( &compositeTimer, SIGNAL( timeout()), SLOT( performCompositing()));
connect(KGlobalSettings::self(), SIGNAL(appearanceChanged()), this, connect(KGlobalSettings::self(), SIGNAL(appearanceChanged()), this,
SLOT(slotReconfigure())); SLOT(slotReconfigure()));
@ -358,7 +369,11 @@ void Workspace::init()
XWindowAttributes attr; XWindowAttributes attr;
XGetWindowAttributes(display(), wins[i], &attr); XGetWindowAttributes(display(), wins[i], &attr);
if (attr.override_redirect ) if (attr.override_redirect )
{
if( attr.map_state != IsUnmapped && attr.c_class != InputOnly && compositing())
createUnmanaged( wins[ i ] );
continue; continue;
}
if( topmenu_space && topmenu_space->winId() == wins[ i ] ) if( topmenu_space && topmenu_space->winId() == wins[ i ] )
continue; continue;
if (attr.map_state != IsUnmapped) if (attr.map_state != IsUnmapped)
@ -421,6 +436,7 @@ void Workspace::init()
Workspace::~Workspace() Workspace::~Workspace()
{ {
finishCompositing();
blockStackingUpdates( true ); blockStackingUpdates( true );
// TODO grabXServer(); // TODO grabXServer();
// use stacking_order, so that kwin --replace keeps stacking order // use stacking_order, so that kwin --replace keeps stacking order
@ -430,12 +446,12 @@ Workspace::~Workspace()
{ {
// only release the window // only release the window
(*it)->releaseWindow( true ); (*it)->releaseWindow( true );
// No removeClient() is called, it does more than just removing. // no removeClient() is called !
// However, remove from some lists to e.g. prevent performTransiencyCheck()
// from crashing.
clients.remove( *it );
desktops.remove( *it );
} }
for( UnmanagedList::ConstIterator it = unmanaged.begin();
it != unmanaged.end();
++it )
(*it)->release();
delete desktop_widget; delete desktop_widget;
delete tab_box; delete tab_box;
delete popupinfo; delete popupinfo;
@ -479,6 +495,28 @@ Client* Workspace::createClient( Window w, bool is_mapped )
return NULL; return NULL;
} }
addClient( c, Allowed ); addClient( c, Allowed );
if( scene )
scene->windowAdded( c );
if( effects )
effects->windowAdded( c );
return c;
}
Unmanaged* Workspace::createUnmanaged( Window w )
{
if( w == overlay )
return NULL;
Unmanaged* c = new Unmanaged( this );
if( !c->track( w ))
{
Unmanaged::deleteUnmanaged( c, Allowed );
return NULL;
}
addUnmanaged( c, Allowed );
if( scene )
scene->windowAdded( c );
if( effects )
effects->windowAdded( c );
return c; return c;
} }
@ -519,7 +557,11 @@ void Workspace::addClient( Client* c, allowed_t )
updateStackingOrder( true ); // propagate new client updateStackingOrder( true ); // propagate new client
if( c->isUtility() || c->isMenu() || c->isToolbar()) if( c->isUtility() || c->isMenu() || c->isToolbar())
updateToolWindows( true ); updateToolWindows( true );
checkNonExistentClients(); }
void Workspace::addUnmanaged( Unmanaged* c, allowed_t )
{
unmanaged.append( c );
} }
/* /*
@ -541,6 +583,10 @@ void Workspace::removeClient( Client* c, allowed_t )
Notify::raise( Notify::Delete ); Notify::raise( Notify::Delete );
Q_ASSERT( clients.contains( c ) || desktops.contains( c )); Q_ASSERT( clients.contains( c ) || desktops.contains( c ));
if( scene )
scene->windowDeleted( c );
if( effects )
effects->windowDeleted( c );
clients.removeAll( c ); clients.removeAll( c );
desktops.removeAll( c ); desktops.removeAll( c );
unconstrained_stacking_order.removeAll( c ); unconstrained_stacking_order.removeAll( c );
@ -576,6 +622,16 @@ void Workspace::removeClient( Client* c, allowed_t )
updateClientArea(); updateClientArea();
} }
void Workspace::removeUnmanaged( Unmanaged* c, allowed_t )
{
assert( unmanaged.contains( c ));
if( scene )
scene->windowDeleted( c );
if( effects )
effects->windowDeleted( c );
unmanaged.removeAll( c );
}
void Workspace::updateFocusChains( Client* c, FocusChainChange change ) void Workspace::updateFocusChains( Client* c, FocusChainChange change )
{ {
if( !c->wantsTabFocus()) // doesn't want tab focus, remove if( !c->wantsTabFocus()) // doesn't want tab focus, remove
@ -601,13 +657,7 @@ void Workspace::updateFocusChains( Client* c, FocusChainChange change )
focus_chain[ i ].prepend( c ); focus_chain[ i ].prepend( c );
} }
else if( !focus_chain[ i ].contains( c )) else if( !focus_chain[ i ].contains( c ))
{ // add it after the active one focus_chain[ i ].prepend( c ); // otherwise add as the last one
if( active_client != NULL && active_client != c
&& !focus_chain[ i ].isEmpty() && focus_chain[ i ].last() == active_client )
focus_chain[ i ].insert( focus_chain[ i ].size() - 1, c );
else
focus_chain[ i ].append( c ); // otherwise add as the first one
}
} }
} }
else //now only on desktop, remove it anywhere else else //now only on desktop, remove it anywhere else
@ -627,13 +677,7 @@ void Workspace::updateFocusChains( Client* c, FocusChainChange change )
focus_chain[ i ].prepend( c ); focus_chain[ i ].prepend( c );
} }
else if( !focus_chain[ i ].contains( c )) else if( !focus_chain[ i ].contains( c ))
{ // add it after the active one focus_chain[ i ].prepend( c );
if( active_client != NULL && active_client != c
&& !focus_chain[ i ].isEmpty() && focus_chain[ i ].last() == active_client )
focus_chain[ i ].insert( focus_chain[ i ].size() - 1, c );
else
focus_chain[ i ].append( c ); // otherwise add as the first one
}
} }
else else
focus_chain[ i ].removeAll( c ); focus_chain[ i ].removeAll( c );
@ -650,13 +694,7 @@ void Workspace::updateFocusChains( Client* c, FocusChainChange change )
global_focus_chain.prepend( c ); global_focus_chain.prepend( c );
} }
else if( !global_focus_chain.contains( c )) else if( !global_focus_chain.contains( c ))
{ // add it after the active one global_focus_chain.prepend( c );
if( active_client != NULL && active_client != c
&& !global_focus_chain.isEmpty() && global_focus_chain.last() == active_client )
global_focus_chain.insert( global_focus_chain.size() - 1, c );
else
global_focus_chain.append( c ); // otherwise add as the first one
}
} }
void Workspace::updateCurrentTopMenu() void Workspace::updateCurrentTopMenu()
@ -874,11 +912,6 @@ void Workspace::updateColormap()
} }
} }
void Workspace::slotReloadConfig()
{
reconfigure();
}
void Workspace::reconfigure() void Workspace::reconfigure()
{ {
reconfigureTimer.start( 200 ); reconfigureTimer.start( 200 );
@ -895,7 +928,7 @@ void Workspace::slotSettingsChanged(int category)
/*! /*!
Reread settings Reread settings
*/ */
KWIN_PROCEDURE( CheckBorderSizesProcedure, cl->checkBorderSizes() ); KWIN_PROCEDURE( CheckBorderSizesProcedure, Client, cl->checkBorderSizes() );
void Workspace::slotReconfigure() void Workspace::slotReconfigure()
{ {
@ -953,6 +986,11 @@ void Workspace::slotReconfigure()
updateCurrentTopMenu(); updateCurrentTopMenu();
} }
if( options->useTranslucency )
setupCompositing();
else
finishCompositing();
loadWindowRules(); loadWindowRules();
for( ClientList::Iterator it = clients.begin(); for( ClientList::Iterator it = clients.begin();
it != clients.end(); it != clients.end();
@ -1241,18 +1279,11 @@ bool Workspace::setCurrentDesktop( int new_desktop )
if ( c ) if ( c )
requestFocus( c ); requestFocus( c );
else if( !desktops.isEmpty() )
requestFocus( findDesktop( true, currentDesktop()));
else else
focusToNull(); focusToNull();
if( !desktops.isEmpty() )
{
Window w_tmp;
int i_tmp;
XGetInputFocus( display(), &w_tmp, &i_tmp );
if( w_tmp == null_focus_window ) // CHECKME?
requestFocus( findDesktop( true, currentDesktop()));
}
updateCurrentTopMenu(); updateCurrentTopMenu();
// Update focus chain: // Update focus chain:
@ -1653,7 +1684,7 @@ void Workspace::slotGrabWindow()
QPixmap snapshot = QPixmap::grabWindow( active_client->frameId() ); QPixmap snapshot = QPixmap::grabWindow( active_client->frameId() );
//No XShape - no work. //No XShape - no work.
if( Shape::available()) if( Extensions::shapeAvailable())
{ {
//As the first step, get the mask from XShape. //As the first step, get the mask from XShape.
int count, order; int count, order;
@ -2006,7 +2037,8 @@ void Workspace::createBorderWindows()
XSetWindowAttributes attributes; XSetWindowAttributes attributes;
unsigned long valuemask; unsigned long valuemask;
attributes.override_redirect = True; attributes.override_redirect = True;
attributes.event_mask = ( EnterWindowMask | LeaveWindowMask ); attributes.event_mask = (EnterWindowMask | LeaveWindowMask |
VisibilityChangeMask);
valuemask= (CWOverrideRedirect | CWEventMask | CWCursor ); valuemask= (CWOverrideRedirect | CWEventMask | CWCursor );
attributes.cursor = XCreateFontCursor(display(), attributes.cursor = XCreateFontCursor(display(),
XC_sb_up_arrow); XC_sb_up_arrow);