Bug 890125 - Part 3 - Convert the Linux virtual desktop handling to accept string-type workspace IDs. r=stransky,nika

Differential Revision: https://phabricator.services.mozilla.com/D67824

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mike de Boer 2020-04-03 10:20:57 +00:00
Родитель 0f7ed04e2f
Коммит 2c14753eb4
2 изменённых файлов: 13 добавлений и 10 удалений

Просмотреть файл

@ -1599,14 +1599,16 @@ void nsWindow::SetSizeMode(nsSizeMode aMode) {
mSizeState = mSizeMode;
}
int32_t nsWindow::GetWorkspaceID() {
void nsWindow::GetWorkspaceID(nsAString& workspaceID) {
workspaceID.Truncate();
if (!mIsX11Display || !mShell) {
return 0;
return;
}
// Get the gdk window for this widget.
GdkWindow* gdk_window = gtk_widget_get_window(mShell);
if (!gdk_window) {
return 0;
return;
}
GdkAtom cardinal_atom = gdk_x11_xatom_to_atom(XA_CARDINAL);
@ -1622,16 +1624,17 @@ int32_t nsWindow::GetWorkspaceID() {
FALSE, // delete
&type_returned, &format_returned, &length_returned,
(guchar**)&wm_desktop)) {
return 0;
return;
}
auto desktop = int32_t(wm_desktop[0]);
workspaceID.AppendInt(wm_desktop[0]);
g_free(wm_desktop);
return desktop;
}
void nsWindow::MoveToWorkspace(int32_t workspaceID) {
if (!workspaceID || !mIsX11Display || !mShell) {
void nsWindow::MoveToWorkspace(const nsAString& workspaceIDStr) {
nsresult rv = NS_OK;
int32_t workspaceID = workspaceIDStr.ToInteger(&rv);
if (NS_FAILED(rv) || !workspaceID || !mIsX11Display || !mShell) {
return;
}

Просмотреть файл

@ -151,8 +151,8 @@ class nsWindow final : public nsBaseWidget {
void SetZIndex(int32_t aZIndex) override;
virtual void SetSizeMode(nsSizeMode aMode) override;
virtual int32_t GetWorkspaceID() override;
virtual void MoveToWorkspace(int32_t workspaceID) override;
virtual void GetWorkspaceID(nsAString& workspaceID) override;
virtual void MoveToWorkspace(const nsAString& workspaceID) override;
virtual void Enable(bool aState) override;
virtual void SetFocus(Raise, mozilla::dom::CallerType aCallerType) override;
virtual LayoutDeviceIntRect GetScreenBounds() override;