- New upstream release 0.7.0

- Drop all patches (all upstreamed)
- Enable smartcard (CAC) support
This commit is contained in:
Hans de Goede 2010-12-17 12:32:40 +01:00
parent ee30e70841
commit b843d63547
16 changed files with 11 additions and 1015 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@ spice-0.5.3.tar.bz2
/spice-0.6.0.tar.bz2
/spice-0.6.1.tar.bz2
/spice-0.6.3.tar.bz2
/spice-0.7.0.tar.bz2

View File

@ -1,57 +0,0 @@
From 79fffbf95d96b0eeb740fdfb9cca285fab8735c6 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Wed, 20 Oct 2010 21:52:49 +0200
Subject: [PATCH spice 1/3] spicec-x11: Change source of controller socket name, fixing CVE-2010-2792
The socket name used to communicate between the xpi browser plugin and the
spicec was predictable allowing a non priviliged user on the same system
to create the socket before spicec does and thus intercept the messages from
the xpi to the client, including login credentials. This security vulnerability
has been registred with mitre as CVE-2010-2792:
http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2010-2792
This patch changes the controller code to instead read the socket name
from an environment variable which gets set by the xpi before executing
the spicec, making the socketname private between the client and the xpi.
Note that this means that the controller will only work with an xpi which
has matching changes, the changes are present in the latest version of the
xpi as available as update for / with RHEL-5.5 and RHEL-6.0 .
---
client/controller.cpp | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/client/controller.cpp b/client/controller.cpp
index b293771..032afae 100644
--- a/client/controller.cpp
+++ b/client/controller.cpp
@@ -28,10 +28,6 @@
#ifdef WIN32
#define PIPE_NAME "SpiceController-%lu"
-#elif defined(__i386__)
-#define PIPE_NAME "/tmp/SpiceController-%llu.uds"
-#else
-#define PIPE_NAME "/tmp/SpiceController-%lu.uds"
#endif
Controller::Controller(ControllerInterface *handler)
@@ -42,7 +38,15 @@ Controller::Controller(ControllerInterface *handler)
char pipe_name[PIPE_NAME_MAX_LEN];
ASSERT(_handler);
+#ifdef WIN32
snprintf(pipe_name, PIPE_NAME_MAX_LEN, PIPE_NAME, Platform::get_process_id());
+#else
+ char *p_socket = getenv("SPICE_XPI_SOCKET");
+ if (!p_socket) {
+ LOG_ERROR("Failed to get a controller connection (SPICE_XPI_SOCKET)");
+ }
+ strncpy(pipe_name, p_socket, sizeof(pipe_name));
+#endif
LOG_INFO("Creating a controller connection %s", pipe_name);
_pipe = NamedPipe::create(pipe_name, *this);
if (!_pipe) {
--
1.7.3.1

View File

@ -1,208 +0,0 @@
From fa2e125ec4535b4a56a33aed76e3a0f9ce75eca0 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Wed, 20 Oct 2010 17:28:07 +0200
Subject: [PATCH spice 2/3] client: Interpret the title control message as utf8 instead of unicode16
The activex browser plugin is sending unicode16 text, where as the
xpi one is sending utf8 text. After discussing this on irc we've decided
that utf8 is what we want to use. So the client (this patch), and the
activex will be changed to expect resp. send utf8 text as the title.
---
client/application.cpp | 4 ++--
client/application.h | 4 ++--
client/controller.cpp | 8 ++------
client/controller.h | 2 +-
client/red_window.h | 2 +-
client/screen.cpp | 6 +++---
client/screen.h | 6 +++---
client/windows/red_window.cpp | 2 +-
client/x11/red_window.cpp | 8 ++++----
9 files changed, 19 insertions(+), 23 deletions(-)
diff --git a/client/application.cpp b/client/application.cpp
index 212b20e..d5b24a7 100644
--- a/client/application.cpp
+++ b/client/application.cpp
@@ -355,7 +355,7 @@ Application::Application()
, _key_handler (&default_key_handler)
, _mouse_handler (&default_mouse_handler)
, _monitors (NULL)
- , _title (L"SPICEc:%d")
+ , _title ("SPICEc:%d")
, _sys_key_intercept_mode (false)
, _enable_controller (false)
#ifdef USE_GUI
@@ -1603,7 +1603,7 @@ uint32_t Application::get_mouse_mode()
return _client.get_mouse_mode();
}
-void Application::set_title(const std::wstring& title)
+void Application::set_title(const std::string& title)
{
_title = title;
diff --git a/client/application.h b/client/application.h
index c01e08b..19c68a5 100644
--- a/client/application.h
+++ b/client/application.h
@@ -218,7 +218,7 @@ public:
void exit_full_screen();
bool toggle_full_screen();
void minimize();
- void set_title(const std::wstring& title);
+ void set_title(const std::string& title);
void hide();
void show();
void external_show();
@@ -367,7 +367,7 @@ private:
KeyHandlersStack _key_handlers;
MouseHandler* _mouse_handler;
const MonitorsList* _monitors;
- std::wstring _title;
+ std::string _title;
bool _sys_key_intercept_mode;
StickyInfo _sticky_info;
std::vector<int> _canvas_types;
diff --git a/client/controller.cpp b/client/controller.cpp
index 032afae..6d1272c 100644
--- a/client/controller.cpp
+++ b/client/controller.cpp
@@ -308,12 +308,8 @@ bool ControllerConnection::handle_message(ControllerMsg *hdr)
_handler->set_auto_display_res(!!(value & CONTROLLER_AUTO_DISPLAY_RES));
break;
case CONTROLLER_SET_TITLE: {
- std::wstring str;
-#ifdef WIN32
- wstring_printf(str, L"%s", data);
-#else
- wstring_printf(str, L"%S", data);
-#endif
+ std::string str;
+ string_printf(str, "%s", data);
_handler->set_title(str);
break;
}
diff --git a/client/controller.h b/client/controller.h
index 89b2c23..924f351 100644
--- a/client/controller.h
+++ b/client/controller.h
@@ -33,7 +33,7 @@ public:
virtual bool connect(const std::string& host, int port, int sport,
const std::string& password) = 0;
- virtual void set_title(const std::wstring& title) = 0;
+ virtual void set_title(const std::string& title) = 0;
virtual void set_auto_display_res(bool auto_display_res) = 0;
virtual void show_me(bool full_screen) = 0;
virtual void hide_me() = 0;
diff --git a/client/red_window.h b/client/red_window.h
index 97f3b79..632564d 100644
--- a/client/red_window.h
+++ b/client/red_window.h
@@ -48,7 +48,7 @@ public:
void hide();
void minimize();
void activate();
- void set_title(std::wstring& title);
+ void set_title(std::string& title);
void set_icon(Icon *icon);
virtual RedDrawable::Format get_format();
diff --git a/client/screen.cpp b/client/screen.cpp
index 7c4e1e3..575ab5d 100644
--- a/client/screen.cpp
+++ b/client/screen.cpp
@@ -71,7 +71,7 @@ void UpdateTimer::response(AbstractProcessLoop& events_loop)
_screen->periodic_update();
}
-RedScreen::RedScreen(Application& owner, int id, const std::wstring& name, int width, int height)
+RedScreen::RedScreen(Application& owner, int id, const std::string& name, int width, int height)
: _owner (owner)
, _id (id)
, _refs (1)
@@ -216,10 +216,10 @@ void RedScreen::unlock_size()
_owner.on_screen_unlocked(*this);
}
-void RedScreen::set_name(const std::wstring& name)
+void RedScreen::set_name(const std::string& name)
{
if (!name.empty()) {
- wstring_printf(_name, name.c_str(), _id);
+ string_printf(_name, name.c_str(), _id);
}
_window.set_title(_name);
}
diff --git a/client/screen.h b/client/screen.h
index dfef989..d81ebf8 100644
--- a/client/screen.h
+++ b/client/screen.h
@@ -54,7 +54,7 @@ private:
class RedScreen: public RedWindow::Listener {
public:
- RedScreen(Application& owner, int id, const std::wstring& name, int width, int height);
+ RedScreen(Application& owner, int id, const std::string& name, int width, int height);
RedScreen* ref();
void unref();
@@ -63,7 +63,7 @@ public:
void detach_layer(ScreenLayer& layer);
void on_layer_changed(ScreenLayer& layer);
void resize(int width, int height);
- void set_name(const std::wstring& name);
+ void set_name(const std::string& name);
uint64_t invalidate(const SpiceRect& rect, bool urgent);
void invalidate(const QRegion &region);
void capture_mouse();
@@ -163,7 +163,7 @@ private:
Application& _owner;
int _id;
AtomicCount _refs;
- std::wstring _name;
+ std::string _name;
RedWindow _window;
std::vector<ScreenLayer*> _layes;
QRegion _dirty_region;
diff --git a/client/windows/red_window.cpp b/client/windows/red_window.cpp
index bab2d97..0413945 100644
--- a/client/windows/red_window.cpp
+++ b/client/windows/red_window.cpp
@@ -446,7 +446,7 @@ RedWindow::~RedWindow()
}
}
-void RedWindow::set_title(std::wstring& title)
+void RedWindow::set_title(std::string& title)
{
SetWindowText(_win, title.c_str());
}
diff --git a/client/x11/red_window.cpp b/client/x11/red_window.cpp
index 7cdf684..416f6c7 100644
--- a/client/x11/red_window.cpp
+++ b/client/x11/red_window.cpp
@@ -1331,16 +1331,16 @@ RedWindow::~RedWindow()
}
}
-void RedWindow::set_title(std::wstring& title)
+void RedWindow::set_title(std::string& title)
{
XTextProperty text_prop;
- wchar_t *name = const_cast<wchar_t *>(title.c_str());
+ char *name = const_cast<char *>(title.c_str());
int r;
if (_win) {
XLockDisplay(x_display);
- r = XwcTextListToTextProperty(x_display, &name, 1, XStringStyle, &text_prop);
+ r = Xutf8TextListToTextProperty(x_display, &name, 1, XUTF8StringStyle, &text_prop);
XUnlockDisplay(x_display);
- if (r >= 0) {
+ if (r == Success) {
XSetWMName(x_display, _win, &text_prop);
XFree(text_prop.value);
} else {
--
1.7.3.1

View File

@ -1,98 +0,0 @@
From 4c81024ca2d6bff33df9b52d0600ef5146f6d86d Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Thu, 21 Oct 2010 13:17:23 +0200
Subject: [PATCH spice 3/3] Remove no longer used wstring_printf functions
---
client/utils.cpp | 8 --------
client/utils.h | 2 --
client/windows/platform_utils.cpp | 14 --------------
client/x11/platform_utils.cpp | 18 ------------------
4 files changed, 0 insertions(+), 42 deletions(-)
diff --git a/client/utils.cpp b/client/utils.cpp
index 9ce09d7..460f610 100644
--- a/client/utils.cpp
+++ b/client/utils.cpp
@@ -29,14 +29,6 @@ void string_printf(std::string& str, const char* format, ...)
va_end(ap);
}
-void wstring_printf(std::wstring& str, const wchar_t* format, ...)
-{
- va_list ap;
- va_start(ap, format);
- wstring_vprintf(str, format, ap);
- va_end(ap);
-}
-
int str_to_port(const char *str)
{
long port;
diff --git a/client/utils.h b/client/utils.h
index 33922a7..3b3cbb0 100644
--- a/client/utils.h
+++ b/client/utils.h
@@ -99,8 +99,6 @@ int str_to_port(const char *str);
void string_vprintf(std::string& str, const char* format, va_list ap);
void string_printf(std::string& str, const char *format, ...);
-void wstring_vprintf(std::wstring& str, const wchar_t* format, va_list ap);
-void wstring_printf(std::wstring& str, const wchar_t *format, ...);
template<class T>
class FreeObject {
diff --git a/client/windows/platform_utils.cpp b/client/windows/platform_utils.cpp
index 0270959..eb87468 100644
--- a/client/windows/platform_utils.cpp
+++ b/client/windows/platform_utils.cpp
@@ -35,20 +35,6 @@ void string_vprintf(std::string& str, const char* format, va_list ap)
}
}
-void wstring_vprintf(std::wstring& str, const wchar_t* format, va_list ap)
-{
- int buf_size = 256;
- for (;;) {
- AutoArray<wchar_t> buf(new wchar_t[buf_size]);
- int r = vswprintf(buf.get(), buf_size, format, ap);
- if (r != -1) {
- str = buf.get();
- return;
- }
- buf_size *= 2;
- }
-}
-
HDC create_compatible_dc()
{
HDC dc = CreateCompatibleDC(NULL);
diff --git a/client/x11/platform_utils.cpp b/client/x11/platform_utils.cpp
index a646a80..5ca68f4 100644
--- a/client/x11/platform_utils.cpp
+++ b/client/x11/platform_utils.cpp
@@ -28,21 +28,3 @@ void string_vprintf(std::string& str, const char* format, va_list ap)
vsnprintf(buf.get(), len, format, ap);
str = buf.get();
}
-
-void wstring_vprintf(std::wstring& str, const wchar_t* format, va_list ap)
-{
- int buf_size = 256;
- for (;;) {
- AutoArray<wchar_t> buf(new wchar_t[buf_size]);
- va_list ap_test;
- va_copy(ap_test, ap);
- int r = vswprintf(buf.get(), buf_size, format, ap_test);
- va_end(ap_test);
- if (r != -1) {
- str = buf.get();
- return;
- }
- buf_size *= 2;
- }
-}
-
--
1.7.3.1

View File

@ -1,69 +0,0 @@
From 99a74a06744bac4e45e66ce6512f52c1de5febb2 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Thu, 21 Oct 2010 16:22:06 +0200
Subject: [PATCH spice 4/4] spicec-x11: Do not set _NET_WM_USER_TIME to 0 on startup
Setting _NET_WM_USER_TIME to 0 means we do not want focus, not good.
---
client/x11/red_window.cpp | 10 ++++++----
client/x11/red_window_p.h | 2 +-
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/client/x11/red_window.cpp b/client/x11/red_window.cpp
index 416f6c7..c3ee1b0 100644
--- a/client/x11/red_window.cpp
+++ b/client/x11/red_window.cpp
@@ -801,7 +801,7 @@ void RedWindow_p::win_proc(XEvent& event)
}
case KeyPress:
red_window->handle_key_press_event(*red_window, &event.xkey);
- red_window->last_event_time = event.xkey.time;
+ red_window->_last_event_time = event.xkey.time;
XChangeProperty(x_display, red_window->_win, wm_user_time,
XA_CARDINAL, 32, PropModeReplace,
(unsigned char *)&event.xkey.time, 1);
@@ -833,7 +833,7 @@ void RedWindow_p::win_proc(XEvent& event)
break;
}
red_window->get_listener().on_mouse_button_press(button, state);
- red_window->last_event_time = event.xkey.time;
+ red_window->_last_event_time = event.xkey.time;
XChangeProperty(x_display, red_window->_win, wm_user_time,
XA_CARDINAL, 32, PropModeReplace,
(unsigned char *)&event.xbutton.time, 1);
@@ -1119,6 +1119,7 @@ RedWindow_p::RedWindow_p()
, _ignore_pointer (false)
,_width (200)
,_height (200)
+ ,_last_event_time (0)
{
}
@@ -1534,8 +1535,9 @@ void RedWindow::show(int screen_id)
XDeleteProperty(x_display, _win, wm_state);
wait_parent = true;
}
- XChangeProperty(x_display, _win, wm_user_time, XA_CARDINAL, 32,
- PropModeReplace, (unsigned char *)&last_event_time, 1);
+ if (_last_event_time != 0)
+ XChangeProperty(x_display, _win, wm_user_time, XA_CARDINAL, 32,
+ PropModeReplace, (unsigned char *)&_last_event_time, 1);
XMapWindow(x_display, _win);
move_to_current_desktop();
_expect_parent = wait_parent;
diff --git a/client/x11/red_window_p.h b/client/x11/red_window_p.h
index 4ad5451..777a855 100644
--- a/client/x11/red_window_p.h
+++ b/client/x11/red_window_p.h
@@ -82,7 +82,7 @@ protected:
RedWindow *_red_window;
int _width;
int _height;
- Time last_event_time;
+ Time _last_event_time;
};
#endif
--
1.7.3.1

View File

@ -1,57 +0,0 @@
From 922b831db2a19e7620fa5f93b7fb33aca86f3717 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Thu, 28 Oct 2010 12:05:30 +0200
Subject: [PATCH spice] spicec-x11: Listen for selection owner window destroy / close events too
These rarely happen as most apps have the decency to do a SetSelectionOwner
None before exiting. But some do not, so listen for these too.
---
client/x11/platform.cpp | 18 +++++++++++++++---
1 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/client/x11/platform.cpp b/client/x11/platform.cpp
index 13bc0a6..2009817 100644
--- a/client/x11/platform.cpp
+++ b/client/x11/platform.cpp
@@ -922,7 +922,9 @@ DynamicScreen::DynamicScreen(Display* display, int screen, int& next_mon_id)
XRRSelectInput(display, platform_win, RRScreenChangeNotifyMask);
if (using_xfixes_1_0) {
XFixesSelectSelectionInput(display, platform_win, clipboard_prop,
- XFixesSetSelectionOwnerNotifyMask);
+ XFixesSetSelectionOwnerNotifyMask|
+ XFixesSelectionWindowDestroyNotifyMask|
+ XFixesSelectionClientCloseNotifyMask);
}
Monitor::self_monitors_change++;
@@ -1224,7 +1226,9 @@ MultyMonScreen::MultyMonScreen(Display* display, int screen, int& next_mon_id)
X_DEBUG_SYNC(get_display());
if (using_xfixes_1_0) {
XFixesSelectSelectionInput(display, platform_win, clipboard_prop,
- XFixesSetSelectionOwnerNotifyMask);
+ XFixesSetSelectionOwnerNotifyMask|
+ XFixesSelectionWindowDestroyNotifyMask|
+ XFixesSelectionClientCloseNotifyMask);
}
XMonitor::inc_change_ref();
@@ -2745,7 +2749,15 @@ static void root_win_proc(XEvent& event)
}
if (event.type == XFixesSelectionNotify + xfixes_event_base) {
XFixesSelectionNotifyEvent* selection_event = (XFixesSelectionNotifyEvent *)&event;
- if (selection_event->subtype != XFixesSetSelectionOwnerNotify) {
+ switch (selection_event->subtype) {
+ case XFixesSetSelectionOwnerNotify:
+ break;
+ /* Treat ... as a SelectionOwnerNotify None */
+ case XFixesSelectionWindowDestroyNotify:
+ case XFixesSelectionClientCloseNotify:
+ selection_event->owner = None;
+ break;
+ default:
LOG_INFO("Unsupported selection event %u", selection_event->subtype);
return;
}
--
1.7.3.2

View File

@ -1,42 +0,0 @@
From bfaa4579103d924bec737b52b947b512d89460d6 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Fri, 5 Nov 2010 20:46:28 +0100
Subject: [PATCH spice] spicec: Make cegui log to <app_data_dir>/cegui.log
This stops the client from dropping CEGUI.log files into the cwd all
the time, and stops it from crashing when the cwd is not writable
(rhbz#650253).
---
client/gui/gui.cpp | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/client/gui/gui.cpp b/client/gui/gui.cpp
index f1ca13d..d8513c6 100644
--- a/client/gui/gui.cpp
+++ b/client/gui/gui.cpp
@@ -891,7 +891,6 @@ GUI::GUI(Application& app, Application::State state)
, _pixmap (new RedPixmapSw(MAIN_GUI_WIDTH, MAIN_GUI_HEIGHT, RedDrawable::RGB32, true, 0))
, _renderer (new CEGUI::SoftRenderer(_pixmap->get_data(), MAIN_GUI_WIDTH, MAIN_GUI_HEIGHT,
_pixmap->get_stride()))
- , _gui_system (new CEGUI::System(_renderer, new CEGUIResourceProvider()))
, _dialog (NULL)
, _prev_time (Platform::get_monolithic_time())
@@ -919,6 +918,14 @@ GUI::~GUI()
void GUI::init_cegui()
{
+ std::string log_file_name;
+
+ Platform::get_app_data_dir(log_file_name, "spicec");
+ Platform::path_append(log_file_name, "cegui.log");
+
+ _gui_system = new CEGUI::System(_renderer, new CEGUIResourceProvider(),
+ NULL, NULL, "", log_file_name);
+
CEGUI::SchemeManager::getSingleton().loadScheme("TaharezLook.scheme");
_gui_system->setDefaultMouseCursor("TaharezLook", "MouseArrow");
_gui_system->setDefaultTooltip("TaharezLook/Tooltip");
--
1.7.3.2

View File

@ -1,38 +0,0 @@
From 6fd1bbb846b0fc4b704c277ffa5974fc565ae05f Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Tue, 9 Nov 2010 11:24:59 +0100
Subject: [PATCH spice 1/7] spicec: Fix info layer sometimes not showing
Currently we are calling show_info_layer from hide_gui in application.cpp, but
there are 2 cases where this does not happen:
1) When compiled without gui support hide_gui is a complete nop, so we never
show the info layer when compiled without gui support
2) When run with --controller we never show the gui, and hide_gui
checks if there is a gui to hide as the first thing and if not returns
resulting in show_info_layer not being called, and thus the info layer
not showing when launched from the xpi
This patch fixes both by adding a call to show_info_layer from
on_visibility_start note that on_visibility_start also calls hide_gui,
so in some cases show_info_layer may be called twice, this is not a
problem as show_info_layer is protected against this.
---
client/application.cpp | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/client/application.cpp b/client/application.cpp
index d5b24a7..7ef2c78 100644
--- a/client/application.cpp
+++ b/client/application.cpp
@@ -854,6 +854,7 @@ void Application::on_visibility_start(int screen_id)
}
set_state(VISIBILITY);
hide_gui();
+ show_info_layer();
}
void Application::on_disconnecting()
--
1.7.3.2

View File

@ -1,55 +0,0 @@
From 8d6b124f2a0e4ab4e3d61415cec77038b94e517f Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Tue, 9 Nov 2010 11:32:07 +0100
Subject: [PATCH spice 2/7] spicec: Remove empty show / hide gui functions
When compiling without gui support just don't call show / hide
gui, rather then making them stubs, this makes it easier to follow what is
going on.
---
client/application.cpp | 4 ++++
client/application.h | 4 ----
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/client/application.cpp b/client/application.cpp
index 7ef2c78..2701641 100644
--- a/client/application.cpp
+++ b/client/application.cpp
@@ -841,7 +841,9 @@ void Application::on_disconnected(int error_code)
// todo: display special notification for host switch (during migration)
set_state(DISCONNECTED);
+#ifdef USE_GUI
show_gui();
+#endif
if (host_switch) {
_client.connect(true);
}
@@ -853,7 +855,9 @@ void Application::on_visibility_start(int screen_id)
return;
}
set_state(VISIBILITY);
+#ifdef USE_GUI
hide_gui();
+#endif
show_info_layer();
}
diff --git a/client/application.h b/client/application.h
index 19c68a5..0e761ec 100644
--- a/client/application.h
+++ b/client/application.h
@@ -322,10 +322,6 @@ private:
void create_gui_barrier(RedScreen& screen, int id);
void destroyed_gui_barrier(int id);
void destroyed_gui_barriers();
-#else // USE_GUI
- void show_gui() {}
- void hide_gui() {}
-
#endif // USE_GUI
// returns the press value before operation (i.e., if it was already pressed)
--
1.7.3.2

View File

@ -1,40 +0,0 @@
From 0bb53766fae863b927f82d06eb85e4f5a8e25280 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Tue, 9 Nov 2010 11:45:41 +0100
Subject: [PATCH spice 3/7] spicec: Don't show gui when connection info is specified on the cmdline
Currently when compiled with the gui enabled if you specify a host to connect
to on the cmdline the gui flashes by (show_gui gets called, then the connect
handler calls hide_gui as soon as the connection is made).
This patch removes this ugly flashing by of the gui.
---
client/application.cpp | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/client/application.cpp b/client/application.cpp
index 2701641..4b22e1f 100644
--- a/client/application.cpp
+++ b/client/application.cpp
@@ -602,14 +602,12 @@ void Application::on_start_running()
}
//FIXME: _client.connect() or use the following instead?
#ifdef USE_GUI
- if (_gui_mode != GUI_MODE_FULL) {
- connect();
+ if (_gui_mode == GUI_MODE_FULL) {
+ show_gui();
+ return;
}
-
- show_gui();
-#else
- connect();
#endif // HAVE_GUI
+ connect();
}
RedScreen* Application::find_screen(int id)
--
1.7.3.2

View File

@ -1,48 +0,0 @@
From c5a903b6655f4f6dacb333fa897d60636aa92d58 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Wed, 17 Nov 2010 12:19:41 +0100
Subject: [PATCH spice 4/7] spicec-x11: Add a few missing XLockDisplay calls (rhbz#654265)
The XIM functions end up waiting for a reply from the server, so they
need locking around them. Idem for the XLookupString call.
---
client/x11/red_window.cpp | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/client/x11/red_window.cpp b/client/x11/red_window.cpp
index c3ee1b0..c50e307 100644
--- a/client/x11/red_window.cpp
+++ b/client/x11/red_window.cpp
@@ -733,7 +733,9 @@ void RedWindow_p::handle_key_press_event(RedWindow& window, XKeyEvent* event)
if (x_input_context != NULL) {
for (;;) {
+ XLockDisplay(x_display);
len = XwcLookupString(x_input_context, event, utf32_buf, buf_size, &key_sym, &status);
+ XUnlockDisplay(x_display);
if (status != XBufferOverflow) {
break;
}
@@ -767,7 +769,9 @@ void RedWindow_p::handle_key_press_event(RedWindow& window, XKeyEvent* event)
unsigned char buffer[16];
int i;
+ XLockDisplay(x_display);
len = XLookupString(event, (char *)buffer, sizeof(buffer), NULL, NULL);
+ XUnlockDisplay(x_display);
for (i = 0; i < len; i++) {
window.get_listener().on_char((uint32_t)buffer[i]);
}
@@ -2135,7 +2139,9 @@ void RedWindow::on_focus_in()
}
_focused = true;
if (x_input_context) {
+ XLockDisplay(x_display);
XwcResetIC(x_input_context);
+ XUnlockDisplay(x_display);
}
XPlatform::on_focus_in();
get_listener().on_activate();
--
1.7.3.2

View File

@ -1,70 +0,0 @@
From 0e7a79ae11a905cee128c2429a7738fe43e30586 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Mon, 22 Nov 2010 16:09:15 +0100
Subject: [PATCH spice 5/7] spicec-x11: Fix modifier keys getting stuck (rhbz#655048)
Currently modifier keys (ctrl, alt) can get stuck when using the x11 client.
To reproduce under gnome:
-focus the client window without causing it to grab the keyborad (click on
the title bar not the window)
-press crlt + alt + right arrow to switch virtual desktop
-press crlt + alt + left arrow to switch back
-notice ctrl + alt are stuck pressed
What is happening here is:
-We get a focus out event, caused by the hotkey combi key grab, focus event
notify mode == NotifyGrab, and release all keys -> good
-We get another focus out event, as we really loose the focus.
notify mode == NotifyWhileGrabbed, which we ignore as we already lost
focus before
-We get a focus in event, as the focus is returning to us, but we don't
really have the focus yet, as the hotkey combi key grab is still active
(ie ctrl + alt are still pressed).
We now sync the vm's modifier key state with the current X-server state,
telling the vm ctrl + alt are pressed. Note we do this by directly reading
the X-server keyboard status, we are not getting any key press events from the
X-server -> bad
-We get another focus in event, as we really get the focus back,
notify mode == NotifyUngrab. We ignore this one as already have gained the
focus before. If we were to sync the vm modifier state here, all would be
well we would no longer see the modifier keys pressed, or if we would we
would get a release event when they get released (testing has shown both).
The solution here is to ignore the first focus in event, and do the modifier
sync on the second focus in event, or more in general to ignore focus events
where notify mode == NotifyWhileGrabbed.
---
client/x11/red_window.cpp | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/client/x11/red_window.cpp b/client/x11/red_window.cpp
index c50e307..6e8cd58 100644
--- a/client/x11/red_window.cpp
+++ b/client/x11/red_window.cpp
@@ -866,6 +866,11 @@ void RedWindow_p::win_proc(XEvent& event)
break;
}
case FocusIn:
+ /* Ignore focus events caused by grabbed (hotkeys) */
+ if (event.xfocus.mode == NotifyWhileGrabbed) {
+ break;
+ }
+
if (event.xany.serial < focus_serial) {
DBG(0, "Ignored FocusIn win=%p (serial=%d, Last foucs serial=%d)",
red_window, event.xany.serial, focus_serial);
@@ -886,6 +891,11 @@ void RedWindow_p::win_proc(XEvent& event)
}
break;
case FocusOut:
+ /* Ignore focus events caused by grabbed (hotkeys) */
+ if (event.xfocus.mode == NotifyWhileGrabbed) {
+ break;
+ }
+
if (event.xany.serial <= focus_serial) {
DBG(0, "Ignored FocusOut win=%p (serial=%d, Last foucs serial=%d)",
red_window, event.xany.serial, focus_serial);
--
1.7.3.2

View File

@ -1,43 +0,0 @@
From c8a034f2858f247d6a00ec1ad47de491b7e99575 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Tue, 23 Nov 2010 15:32:15 +0100
Subject: [PATCH spice 6/7] spicec-x11: Fix unhandled exception: no window proc crash (rhbz#655836)
When XIM + ibus is in use XIM creates an invisible window for its own
purposes, we sometimes get a _GTK_LOAD_ICONTHEMES ClientMessage event on
this window. Since this window was not explicitly created by spicec, it
does not have a Window Context (with the event handling function for the
window in question) set. This would cause spicec to throw an unhandled
exception and exit.
This patch replaces the exception throwing with silently ignoring
ClientMessage events on Windows without a Context and logging a warning
for other event types.
---
client/x11/platform.cpp | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/client/x11/platform.cpp b/client/x11/platform.cpp
index 2009817..334a74f 100644
--- a/client/x11/platform.cpp
+++ b/client/x11/platform.cpp
@@ -295,7 +295,15 @@ void XEventHandler::on_event()
}
if (XFindContext(&_x_display, event.xany.window, _win_proc_context, &proc_pointer)) {
- THROW("no window proc");
+ /* When XIM + ibus is in use XIM creates an invisible window for
+ its own purposes, we sometimes get a _GTK_LOAD_ICONTHEMES
+ ClientMessage event on this window -> skip logging. */
+ if (event.type != ClientMessage) {
+ LOG_WARN(
+ "Event on window without a win proc, type: %d, window: %u",
+ event.type, (unsigned int)event.xany.window);
+ }
+ continue;
}
XUnlockDisplay(x_display);
((XPlatform::win_proc_t)proc_pointer)(event);
--
1.7.3.2

View File

@ -1,159 +0,0 @@
From 6437f11de2ceee2be932143c5f3779e232ec3415 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Tue, 23 Nov 2010 21:07:56 +0100
Subject: [PATCH spice 7/7] spicec: Don't show a white screen if guest resolution does not fit fullscreen
Currently when going / starting fullscreen if the guest resolution for one of
the monitors is higher then that monitor on the client can handle, we show a
white screen. Leaving the user stuck (unless they know the fullscreen key
switch combi) with a white screen when starting the client fullscreen from
the XPI.
This patch changes the client to fall back to windowed mode in this case
instead.
---
client/application.cpp | 30 ++++++++++++++++++++++++++++++
client/application.h | 2 ++
client/display_channel.cpp | 2 +-
client/screen.h | 2 +-
4 files changed, 34 insertions(+), 2 deletions(-)
diff --git a/client/application.cpp b/client/application.cpp
index 4b22e1f..c380373 100644
--- a/client/application.cpp
+++ b/client/application.cpp
@@ -348,6 +348,7 @@ Application::Application()
, _active (false)
, _full_screen (false)
, _changing_screens (false)
+ , _out_of_sync (false)
, _exit_code (0)
, _active_screen (NULL)
, _num_keys_pressed (0)
@@ -674,6 +675,12 @@ RedScreen* Application::get_screen(int id)
prepare_monitors();
position_screens();
screen->show_full_screen();
+ if (screen->is_out_of_sync()) {
+ _out_of_sync = true;
+ /* If the client monitor cannot handle the guest resolution
+ drop back to windowed mode */
+ exit_full_screen();
+ }
if (capture) {
_main_screen->activate();
@@ -1492,6 +1499,9 @@ void Application::show_full_screen()
for (int i = 0; i < (int)_screens.size(); i++) {
if (_screens[i]) {
_screens[i]->show_full_screen();
+ if (_screens[i]->is_out_of_sync()) {
+ _out_of_sync = true;
+ }
}
}
}
@@ -1512,6 +1522,11 @@ void Application::enter_full_screen()
}
_changing_screens = false;
_full_screen = true;
+ /* If the client monitor cannot handle the guest resolution drop back
+ to windowed mode */
+ if (_out_of_sync) {
+ exit_full_screen();
+ }
}
void Application::restore_screens_size()
@@ -1529,6 +1544,9 @@ void Application::exit_full_screen()
if (!_full_screen) {
return;
}
+ if (_out_of_sync) {
+ LOG_WARN("Falling back to windowed mode (guest resolution too large for client?)");
+ }
LOG_INFO("");
_changing_screens = true;
release_capture();
@@ -1544,6 +1562,7 @@ void Application::exit_full_screen()
}
}
_full_screen = false;
+ _out_of_sync = false;
restore_screens_size();
show();
_main_screen->activate();
@@ -1560,6 +1579,17 @@ bool Application::toggle_full_screen()
return _full_screen;
}
+void Application::resize_screen(RedScreen *screen, int width, int height)
+{
+ screen->resize(width, height);
+ if (screen->is_out_of_sync()) {
+ _out_of_sync = true;
+ /* If the client monitor cannot handle the guest resolution
+ drop back to windowed mode */
+ exit_full_screen();
+ }
+}
+
void Application::minimize()
{
for (int i = 0; i < (int)_screens.size(); i++) {
diff --git a/client/application.h b/client/application.h
index 0e761ec..5a5a488 100644
--- a/client/application.h
+++ b/client/application.h
@@ -217,6 +217,7 @@ public:
void enter_full_screen();
void exit_full_screen();
bool toggle_full_screen();
+ void resize_screen(RedScreen *screen, int width, int height);
void minimize();
void set_title(const std::string& title);
void hide();
@@ -352,6 +353,7 @@ private:
bool _active;
bool _full_screen;
bool _changing_screens;
+ bool _out_of_sync;
int _exit_code;
RedScreen* _active_screen;
bool _keyboard_state[REDKEY_NUM_KEYS];
diff --git a/client/display_channel.cpp b/client/display_channel.cpp
index c371f4a..1d5ebf3 100644
--- a/client/display_channel.cpp
+++ b/client/display_channel.cpp
@@ -57,7 +57,7 @@ public:
{
Application* app = (Application*)events_loop.get_owner();
_channel.screen()->lock_size();
- _channel.screen()->resize(_width, _height);
+ app->resize_screen(_channel.screen(), _width, _height);
_channel.create_canvas(0, app->get_canvas_types(), _width, _height, _format);
}
diff --git a/client/screen.h b/client/screen.h
index d81ebf8..2b40d77 100644
--- a/client/screen.h
+++ b/client/screen.h
@@ -78,6 +78,7 @@ public:
void set_monitor(Monitor *monitor) { _monitor = monitor;}
Monitor* get_monitor() { return _monitor;}
RedWindow* get_window() { return &_window;}
+ bool is_out_of_sync() { return _out_of_sync;}
void set_cursor(LocalCursor* cursor);
void hide_cursor();
void exit_full_screen();
@@ -118,7 +119,6 @@ private:
void notify_new_size();
void adjust_window_rect(int x, int y);
void save_position();
- bool is_out_of_sync() { return _out_of_sync;}
void __show_full_screen();
bool _invalidate(const SpiceRect& rect, bool urgent, uint64_t& update_mark);
--
1.7.3.2

View File

@ -1 +1 @@
b332bd61610f3b7c0987bd64ebfd6d56 spice-0.6.3.tar.bz2
061dde7bdd0d5dec79c3cc0ff0b4d7e5 spice-0.7.0.tar.bz2

View File

@ -1,25 +1,11 @@
Name: spice
Version: 0.6.3
Release: 4%{?dist}
Version: 0.7.0
Release: 1%{?dist}
Summary: Implements the SPICE protocol
Group: User Interface/Desktops
License: LGPLv2+
URL: http://www.spice-space.org/
Source0: http://www.spice-space.org/download/releases/%{name}-%{version}.tar.bz2
# bugfixes from upstream git
Patch1: 0001-spicec-x11-Change-source-of-controller-socket-name-f.patch
Patch2: 0002-client-Interpret-the-title-control-message-as-utf8-i.patch
Patch3: 0003-Remove-no-longer-used-wstring_printf-functions.patch
Patch4: 0004-spicec-x11-Do-not-set-_NET_WM_USER_TIME-to-0-on-star.patch
Patch5: 0005-spicec-x11-Listen-for-selection-owner-window-destroy.patch
Patch6: 0006-spicec-Make-cegui-log-to-app_data_dir-cegui.log.patch
Patch7: 0007-spicec-Fix-info-layer-sometimes-not-showing.patch
Patch8: 0008-spicec-Remove-empty-show-hide-gui-functions.patch
Patch9: 0009-spicec-Don-t-show-gui-when-connection-info-is-specif.patch
Patch10: 0010-spicec-x11-Add-a-few-missing-XLockDisplay-calls-rhbz.patch
Patch11: 0011-spicec-x11-Fix-modifier-keys-getting-stuck-rhbz-6550.patch
Patch12: 0012-spicec-x11-Fix-unhandled-exception-no-window-proc-cr.patch
Patch13: 0013-spicec-Don-t-show-a-white-screen-if-guest-resolution.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=613529
ExclusiveArch: i686 x86_64
@ -29,6 +15,7 @@ BuildRequires: spice-protocol >= 0.6.3
BuildRequires: celt051-devel
BuildRequires: pixman-devel alsa-lib-devel openssl-devel libjpeg-devel
BuildRequires: libXrandr-devel cegui-devel
BuildRequires: libcacard-devel
%description
The Simple Protocol for Independent Computing Environments (SPICE) is
@ -77,22 +64,9 @@ using spice-server, you will need to install spice-server-devel.
%prep
%setup -q
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%build
%configure --enable-gui
%configure --enable-gui --enable-smartcard
make -C client %{?_smp_mflags}
%ifarch x86_64
make %{?_smp_mflags}
@ -132,6 +106,11 @@ rm -f %{buildroot}%{_libdir}/libspice-server.la
%endif
%changelog
* Fri Dec 17 2010 Hans de Goede <hdegoede@redhat.com> - 0.7.0-1
- New upstream release 0.7.0
- Drop all patches (all upstreamed)
- Enable smartcard (CAC) support
* Wed Nov 17 2010 Hans de Goede <hdegoede@redhat.com> - 0.6.3-4
- Fix the info layer not showing when used through the XPI
- Do not let the connection gui flash by when a hostname has been specified