From 19b9b0cd0960275d7c717b380e5291861b793374 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Tue, 19 Dec 2006 12:53:26 +0000 Subject: [PATCH] svn merge -r614882 from trunk (autogenerated kwinadaptor) svn path=/branches/work/kwin_composite/; revision=614905 --- CMakeLists.txt | 89 +++++++++++++++++++++++++++++++-- workspace.cpp | 132 ++++++++++++++++++++++++++++++------------------- 2 files changed, 166 insertions(+), 55 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e6039081d1..9cc256fd69 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,11 @@ add_subdirectory( pics ) add_subdirectory( clients ) 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 useractions.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 ) -kde4_automoc(${kwin_KDEINIT_SRCS}) +kde4_automoc(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 -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} ) target_link_libraries( kwin kdeinit_kwin ) -install(TARGETS kwin DESTINATION ${BIN_INSTALL_DIR}) +install(TARGETS kwin DESTINATION bin) ########### install files ############### install( FILES kwin.kcfg DESTINATION ${KCFG_INSTALL_DIR} ) 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 diff --git a/workspace.cpp b/workspace.cpp index e53d34dca9..2536cdf21f 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -42,6 +42,9 @@ License. See the file "COPYING" for the exact licensing terms. #include "group.h" #include "rules.h" #include "kwinadaptor.h" +#include "unmanaged.h" +#include "scene.h" +#include "effects.h" #include #include @@ -93,6 +96,7 @@ Workspace::Workspace( bool restore ) popupinfo (0), popup (0), advanced_popup (0), + trans_popup (0), desk_popup (0), desk_popup_index (0), keys (0), @@ -122,12 +126,16 @@ Workspace::Workspace( bool restore ) topmenu_space( NULL ), set_active_client_recursion( 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 ); - QDBusConnection dbus = QDBusConnection::sessionBus(); - dbus.registerObject("/KWin", this); - dbus.connect(QString(), "/KWin", "org.kde.KWin", "reloadConfig", this, SLOT(slotReloadConfig())); + QDBusConnection::sessionBus().registerObject("/KWin", this); _self = this; mgr = new PluginMgr; @@ -169,10 +177,12 @@ Workspace::Workspace( bool restore ) ColormapChangeMask | SubstructureRedirectMask | SubstructureNotifyMask | - FocusChangeMask // for NotifyDetailNone + FocusChangeMask | // for NotifyDetailNone + ExposureMask ); - Shape::init(); + Extensions::init(); + setupCompositing(); // compatibility long data = 1; @@ -321,6 +331,7 @@ void Workspace::init() connect(&reconfigureTimer, SIGNAL(timeout()), this, SLOT(slotReconfigure())); connect( &updateToolWindowsTimer, SIGNAL( timeout()), this, SLOT( slotUpdateToolWindows())); + connect( &compositeTimer, SIGNAL( timeout()), SLOT( performCompositing())); connect(KGlobalSettings::self(), SIGNAL(appearanceChanged()), this, SLOT(slotReconfigure())); @@ -358,7 +369,11 @@ void Workspace::init() XWindowAttributes attr; XGetWindowAttributes(display(), wins[i], &attr); if (attr.override_redirect ) + { + if( attr.map_state != IsUnmapped && attr.c_class != InputOnly && compositing()) + createUnmanaged( wins[ i ] ); continue; + } if( topmenu_space && topmenu_space->winId() == wins[ i ] ) continue; if (attr.map_state != IsUnmapped) @@ -421,6 +436,7 @@ void Workspace::init() Workspace::~Workspace() { + finishCompositing(); blockStackingUpdates( true ); // TODO grabXServer(); // use stacking_order, so that kwin --replace keeps stacking order @@ -430,12 +446,12 @@ Workspace::~Workspace() { // only release the window (*it)->releaseWindow( true ); - // No removeClient() is called, it does more than just removing. - // However, remove from some lists to e.g. prevent performTransiencyCheck() - // from crashing. - clients.remove( *it ); - desktops.remove( *it ); + // no removeClient() is called ! } + for( UnmanagedList::ConstIterator it = unmanaged.begin(); + it != unmanaged.end(); + ++it ) + (*it)->release(); delete desktop_widget; delete tab_box; delete popupinfo; @@ -479,6 +495,28 @@ Client* Workspace::createClient( Window w, bool is_mapped ) return NULL; } 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; } @@ -519,7 +557,11 @@ void Workspace::addClient( Client* c, allowed_t ) updateStackingOrder( true ); // propagate new client if( c->isUtility() || c->isMenu() || c->isToolbar()) 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 ); Q_ASSERT( clients.contains( c ) || desktops.contains( c )); + if( scene ) + scene->windowDeleted( c ); + if( effects ) + effects->windowDeleted( c ); clients.removeAll( c ); desktops.removeAll( c ); unconstrained_stacking_order.removeAll( c ); @@ -576,6 +622,16 @@ void Workspace::removeClient( Client* c, allowed_t ) 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 ) { 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 ); } else if( !focus_chain[ i ].contains( c )) - { // add it after the active 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 - } + focus_chain[ i ].prepend( c ); // otherwise add as the last one } } 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 ); } else if( !focus_chain[ i ].contains( c )) - { // add it after the active 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 - } + focus_chain[ i ].prepend( c ); } else focus_chain[ i ].removeAll( c ); @@ -650,13 +694,7 @@ void Workspace::updateFocusChains( Client* c, FocusChainChange change ) global_focus_chain.prepend( c ); } else if( !global_focus_chain.contains( c )) - { // add it after the active one - 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 - } + global_focus_chain.prepend( c ); } void Workspace::updateCurrentTopMenu() @@ -874,11 +912,6 @@ void Workspace::updateColormap() } } -void Workspace::slotReloadConfig() -{ - reconfigure(); -} - void Workspace::reconfigure() { reconfigureTimer.start( 200 ); @@ -895,7 +928,7 @@ void Workspace::slotSettingsChanged(int category) /*! Reread settings */ -KWIN_PROCEDURE( CheckBorderSizesProcedure, cl->checkBorderSizes() ); +KWIN_PROCEDURE( CheckBorderSizesProcedure, Client, cl->checkBorderSizes() ); void Workspace::slotReconfigure() { @@ -952,6 +985,11 @@ void Workspace::slotReconfigure() updateTopMenuGeometry(); updateCurrentTopMenu(); } + + if( options->useTranslucency ) + setupCompositing(); + else + finishCompositing(); loadWindowRules(); for( ClientList::Iterator it = clients.begin(); @@ -1241,18 +1279,11 @@ bool Workspace::setCurrentDesktop( int new_desktop ) if ( c ) requestFocus( c ); + else if( !desktops.isEmpty() ) + requestFocus( findDesktop( true, currentDesktop())); else 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(); // Update focus chain: @@ -1653,7 +1684,7 @@ void Workspace::slotGrabWindow() QPixmap snapshot = QPixmap::grabWindow( active_client->frameId() ); //No XShape - no work. - if( Shape::available()) + if( Extensions::shapeAvailable()) { //As the first step, get the mask from XShape. int count, order; @@ -2006,7 +2037,8 @@ void Workspace::createBorderWindows() XSetWindowAttributes attributes; unsigned long valuemask; attributes.override_redirect = True; - attributes.event_mask = ( EnterWindowMask | LeaveWindowMask ); + attributes.event_mask = (EnterWindowMask | LeaveWindowMask | + VisibilityChangeMask); valuemask= (CWOverrideRedirect | CWEventMask | CWCursor ); attributes.cursor = XCreateFontCursor(display(), XC_sb_up_arrow);