[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdelibs/kdecore
From:       Thomas Lübking <thomas.luebking () web ! de>
Date:       2005-01-27 7:33:22
Message-ID: 20050127073322.5B43E1C51F () office ! kde ! org
[Download RAW message or body]

CVS commit by luebking: 


added wrapper functions to set window opacity/shadow size


  M +30 -1     kwin.cpp   1.109
  M +24 -0     kwin.h   1.96


--- kdelibs/kdecore/kwin.h  #1.95:1.96
@@ -297,4 +297,28 @@ public:
 
     /**
+     * Sets the opacity of window @p win to percetage @p percent.
+     *
+     * Convenience function that just sets an X property
+     * needs a running composite manager for any visible effect
+     *
+     * @param win the id of the window
+     * @param percent the opacity value in percent (will be justified to [ 0: \
transparent - 100: opaque ]) +     * @since 3.4
+     */
+    static void setOpacity( WId win, uint percent );
+    
+    /**
+     * Sets the shadowsize of window @p win to percetage @p percent.
+     *
+     * Convenience function that just sets an X property
+     * needs the running KDE kompmgr manager for any visible effect
+     *
+     * @param win the id of the window
+     * @param percent the opacity value in percent (0 leads to a completely \
unshadowed window) +     * @since 3.4
+     */
+    static void setShadowSize( WId win, uint percent );
+
+    /**
      * Sets window @p win to be present on all virtual desktops if @p
      * is true. Otherwise the window lives only on one single desktop.

--- kdelibs/kdecore/kwin.cpp  #1.108:1.109
@@ -63,4 +63,6 @@ extern Time qt_x_user_time;
 static Atom net_wm_context_help;
 static Atom kde_wm_change_state;
+static Atom kde_wm_window_opacity;
+static Atom kde_wm_window_shadow;
 static void kwin_net_create_atoms() {
     if (!atoms_created){
@@ -77,4 +79,10 @@ static void kwin_net_create_atoms() {
         names[n++] = "_KDE_WM_CHANGE_STATE";
 
+        atoms[n] = &kde_wm_window_opacity;
+        names[n++] = (char*) "_KDE_WM_WINDOW_OPACITY";
+
+        atoms[n] = &kde_wm_window_shadow;
+        names[n++] = (char*) "_KDE_WM_WINDOW_SHADOW";
+
         // we need a const_cast for the shitty X API
         XInternAtoms( qt_xdisplay(), const_cast<char**>(names), n, false, \
atoms_return ); @@ -535,4 +543,25 @@ void KWin::clearState( WId win, unsigned
 }
 
+void KWin::setOpacity( WId win, uint percent )
+{
+#ifdef Q_QS_X11
+    if (percent > 99)
+        XDeleteProperty (qt_xdisplay(), win, kde_wm_window_opacity);
+    else
+    {
+        uint opacity = 0xFFFFFFFF/100.0*percent;
+        XChangeProperty(qt_xdisplay(), win, kde_wm_window_opacity, XA_CARDINAL, 32, \
PropModeReplace, (unsigned char *) &opacity, 1L); +    }
+#endif
+}
+
+void KWin::setShadowSize( WId win, uint percent )
+{
+#ifdef Q_QS_X11
+    uint shadowSize = 0xFFFFFFFF/100.0*percent;
+    XChangeProperty(qt_xdisplay(), win, kde_wm_window_shadow, XA_CARDINAL, 32, \
PropModeReplace, (unsigned char *) &shadowSize, 1L); +#endif
+}
+
 void KWin::setOnAllDesktops( WId win, bool b )
 {


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic