[Spice-commits] Branch '0.8' - 5 commits - client/application.cpp client/x11 configure.ac server/red_worker.c

Hans de Goede jwrdegoede at kemper.freedesktop.org
Thu Dec 16 07:26:18 PST 2010


 client/application.cpp    |    6 ++++++
 client/x11/red_window.cpp |   19 +++++++++++++++++--
 client/x11/red_window_p.h |    1 +
 configure.ac              |    4 ++--
 server/red_worker.c       |    2 +-
 5 files changed, 27 insertions(+), 5 deletions(-)

New commits:
commit 85ebe4fc4dae442d7140747c22a053d8fedbf012
Author: Hans de Goede <hdegoede at redhat.com>
Date:   Wed Dec 15 15:25:07 2010 +0100

    spicec-x11: Let the window manager place our window the 1st time (rhbz#662407)
    
    The problem is that RedWindow::show calls the XLib MoveWindow function
    on the window after it has been mapped, moving it to the location in
    _show_pos. This is seen by the window manager as the application saying
    I know exactly where I want my window to be placed, don't do placing for
    me. Which causes the client window to always be shown at pos 0x0, even
    though that may not be the best location.
    
    What this patch does is:
    1) It makes RedWindow::show not call MoveWindow when a window is
       first created normally and then shown
    2) It makes RedWindow::show still call MoveWindow when:
       -when the window has been shown before, and was hidden for some
        reason (controller interface), and is now being re-shown
        so that it ends up being re-shown at its old position
       -when the window is a fullscreen window (screen.cpp always
        calls move on the window before showing it to set its position)
       -when the user switch from windowed mode -> fullscreen ->
        windowed mode again, to make sure that the windowed mode window
        is shown in the same position as before switching to fullscreen
        mode

diff --git a/client/x11/red_window.cpp b/client/x11/red_window.cpp
index 569cf4e..d7b19f9 100644
--- a/client/x11/red_window.cpp
+++ b/client/x11/red_window.cpp
@@ -1123,6 +1123,7 @@ Cursor RedWindow_p::create_invisible_cursor(Window window)
 
 RedWindow_p::RedWindow_p()
     : _win (None)
+    , _show_pos_valid (false)
 #ifdef USE_OGL
     , _glcont_copy (NULL)
 #endif // USE_OGL
@@ -1565,7 +1566,9 @@ void RedWindow::show(int screen_id)
     move_to_current_desktop();
     _expect_parent = wait_parent;
     wait_for_map();
-    move(_show_pos.x, _show_pos.y);
+    if (_show_pos_valid) {
+        move(_show_pos.x, _show_pos.y);
+    }
 }
 
 static bool get_prop_32(Window win, Atom prop, uint32_t &val)
@@ -1644,6 +1647,7 @@ void RedWindow::hide()
     on_focus_out();
     XUnmapWindow(x_display, _win);
     _show_pos = get_position();
+    _show_pos_valid = true;
     wait_for_unmap();
     ASSERT(!_focused);
     ASSERT(!_pointer_in_window);
@@ -1672,6 +1676,7 @@ void RedWindow::move_and_resize(int x, int y, int width, int height)
     XMoveResizeWindow(x_display, _win, x, y, width, height);
     _show_pos.x = x;
     _show_pos.y = y;
+    _show_pos_valid = true;
     if (_visibale) {
         send_expose(_win, width, height);
     }
@@ -1682,6 +1687,7 @@ void RedWindow::move(int x, int y)
     XMoveWindow(x_display, _win, x, y);
     _show_pos.x = x;
     _show_pos.y = y;
+    _show_pos_valid = true;
 }
 
 void RedWindow::resize(int width, int height)
diff --git a/client/x11/red_window_p.h b/client/x11/red_window_p.h
index 777a855..6f05a90 100644
--- a/client/x11/red_window_p.h
+++ b/client/x11/red_window_p.h
@@ -66,6 +66,7 @@ protected:
     bool _visibale;
     bool _expect_parent;
     SpicePoint _show_pos;
+    bool _show_pos_valid;
 #ifdef USE_OGL
     GLXContext _glcont_copy;
 #endif // USE_OGL
commit 546a21b7f3c9e750b8a5839d0527edfba164fa07
Author: Hans de Goede <hdegoede at redhat.com>
Date:   Wed Dec 15 16:43:19 2010 +0100

    spicec-x11: Add a class hint to our window managet hints
    
    This helps people who want to tell their windowmanager to do something special
    with spicec, like make it sticky, or whatever, see:
    https://bugzilla.redhat.com/show_bug.cgi?id=662452#c4

diff --git a/client/x11/red_window.cpp b/client/x11/red_window.cpp
index 6e8cd58..569cf4e 100644
--- a/client/x11/red_window.cpp
+++ b/client/x11/red_window.cpp
@@ -1213,6 +1213,7 @@ void RedWindow_p::create(RedWindow& red_window, PixelsSource_p& pix_source,
 
     try {
         int res;
+        XClassHint *class_hint;
 
         XLockDisplay(x_display);
         res = XSaveContext(x_display, window, user_data_context, (XPointer)&red_window);
@@ -1222,8 +1223,16 @@ void RedWindow_p::create(RedWindow& red_window, PixelsSource_p& pix_source,
         }
 
         XSetWMProtocols(x_display, window, &wm_delete_window_atom, 1);
-        XGCValues gc_vals;
+        class_hint = XAllocClassHint();
+        if (!class_hint) {
+            THROW("allocating class hint failed");
+        }
+        class_hint->res_name = (char *)"spicec";
+        class_hint->res_class = (char *)"spicec";
+        XSetClassHint(x_display, window, class_hint);
+        XFree(class_hint);
 
+        XGCValues gc_vals;
         XLockDisplay(x_display);
         gc = XCreateGC(x_display, window, 0, &gc_vals);
         XUnlockDisplay(x_display);
commit 29a2988f15d6175cb5b23ac044ed795c126447a3
Author: Hans de Goede <hdegoede at redhat.com>
Date:   Mon Dec 13 15:37:37 2010 +0100

    spicec: Add a --title cmdline option (rhbz#662452)

diff --git a/client/application.cpp b/client/application.cpp
index a484bbc..96a5c24 100644
--- a/client/application.cpp
+++ b/client/application.cpp
@@ -2213,6 +2213,7 @@ bool Application::process_cmd_line(int argc, char** argv)
         SPICE_OPT_DISPLAY_COLOR_DEPTH,
         SPICE_OPT_DISABLE_DISPLAY_EFFECTS,
         SPICE_OPT_CONTROLLER,
+        SPICE_OPT_TITLE,
 #ifdef USE_SMARTCARD
         SPICE_OPT_SMARTCARD,
         SPICE_OPT_NOSMARTCARD,
@@ -2277,6 +2278,8 @@ bool Application::process_cmd_line(int argc, char** argv)
 
     parser.add(SPICE_OPT_CONTROLLER, "controller", "enable external controller");
 
+    parser.add(SPICE_OPT_TITLE, "title", "set window title", "title", true, 't');
+
 #ifdef USE_SMARTCARD
     parser.add(SPICE_OPT_SMARTCARD, "smartcard", "enable smartcard channel");
     parser.add(SPICE_OPT_NOSMARTCARD, "nosmartcard", "disable smartcard channel");
@@ -2391,6 +2394,9 @@ bool Application::process_cmd_line(int argc, char** argv)
             }
             _enable_controller = true;
             return true;
+        case SPICE_OPT_TITLE:
+            set_title(val);
+            break;
 #ifdef USE_SMARTCARD
         case SPICE_OPT_SMARTCARD:
             _smartcard_options->enable= true;
commit 5cea3389541d12a7a99d3eb0c16093d154835401
Author: Alon Levy <alevy at redhat.com>
Date:   Wed Dec 15 14:43:45 2010 +0200

    server/red_worker: fix worker->drawable_count
    
    drawable_count was becoming negative. It tracks the number of
    items in the worker->current_list ring. It was decremented correctly,
    but incremented only in several cases. The cases it wasn't incremented
    where:
     red_current_add_equal found an equivalent drawable
    by moving the increment to where the item is added to current_list, in
    __current_add_drawable, the accounting remains correct.
    
    This has no affect other then correct accounting, as drawable_count isn't
    used for anything.

diff --git a/server/red_worker.c b/server/red_worker.c
index d59726f..937e0aa 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -2136,6 +2136,7 @@ static inline void __current_add_drawable(RedWorker *worker, Drawable *drawable,
     surface = &worker->surfaces[surface_id];
     ring_add_after(&drawable->tree_item.base.siblings_link, pos);
     ring_add(&worker->current_list, &drawable->list_link);
+    worker->drawable_count++;
     ring_add(&surface->current_list, &drawable->surface_list_link);
     drawable->refs++;
 }
@@ -3501,7 +3502,6 @@ static inline void red_process_drawable(RedWorker *worker, RedDrawable *drawable
 
     if (red_current_add_qxl(worker, &worker->surfaces[surface_id].current, item,
                             drawable)) {
-        worker->drawable_count++;
         if (item->tree_item.effect != QXL_EFFECT_OPAQUE) {
             worker->transparent_count++;
         }
commit 2b83fe700b3060601c524f92d9702be1938d9113
Author: Alon Levy <alevy at redhat.com>
Date:   Thu Dec 9 15:32:45 2010 +0200

    client/smartcard: external cac card library name and version changed

diff --git a/configure.ac b/configure.ac
index 4f3b118..aea7e2e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -179,10 +179,10 @@ if test "x$have_tunnel" = "xyes"; then
 fi
 
 if test "x$have_smartcard" = "xyes"; then
-    PKG_CHECK_MODULES(CAC_CARD, cac_card >= 0.0.1)
+    PKG_CHECK_MODULES(CAC_CARD, libcacard >= 0.1.0)
     SMARTCARD_LIBS="$CAC_CARD_LIBS"
     SMARTCARD_CFLAGS="$CAC_CARD_CFLAGS"
-    SPICE_REQUIRES+=" cac_card"
+    SPICE_REQUIRES+=" libcacard"
     AC_SUBST(SMARTCARD_LIBS)
     AC_SUBST(SMARTCARD_CFLAGS)
 fi


More information about the Spice-commits mailing list