Commit 28ca9c47 authored by Alberts Muktupāvels's avatar Alberts Muktupāvels

xutils: use WnckScreen instead of X11 Screen

Change X11 Screen parameter to WnckScreen for _wnck_read_icons,
_wnck_keyboard_size, _wnck_keyboard_move, _wnck_activate,
_wnck_change_workspace, _wnck_change_state and _wnck_close.

GNOME/libwnck!16
parent 78d51b3a
Pipeline #113738 passed with stage
in 16 minutes and 20 seconds
......@@ -337,7 +337,7 @@ get_icons (WnckApplication *app)
normal_size = _wnck_get_default_icon_size ();
mini_size = _wnck_get_default_mini_icon_size ();
if (_wnck_read_icons (WNCK_SCREEN_XSCREEN (app->priv->screen),
if (_wnck_read_icons (app->priv->screen,
app->priv->xwindow,
app->priv->icon_cache,
&icon, normal_size, normal_size,
......
......@@ -1341,11 +1341,12 @@ wnck_window_is_skip_pager (WnckWindow *window)
**/
void
wnck_window_set_skip_pager (WnckWindow *window,
gboolean skip)
gboolean skip)
{
g_return_if_fail (WNCK_IS_WINDOW (window));
_wnck_change_state (WNCK_SCREEN_XSCREEN (window->priv->screen),
window->priv->xwindow,
_wnck_change_state (window->priv->screen,
window->priv->xwindow,
skip,
_wnck_atom_get ("_NET_WM_STATE_SKIP_PAGER"),
0);
......@@ -1397,11 +1398,12 @@ wnck_window_is_fullscreen (WnckWindow *window)
**/
void
wnck_window_set_skip_tasklist (WnckWindow *window,
gboolean skip)
gboolean skip)
{
g_return_if_fail (WNCK_IS_WINDOW (window));
_wnck_change_state (WNCK_SCREEN_XSCREEN (window->priv->screen),
window->priv->xwindow,
_wnck_change_state (window->priv->screen,
window->priv->xwindow,
skip,
_wnck_atom_get ("_NET_WM_STATE_SKIP_TASKBAR"),
0);
......@@ -1419,11 +1421,12 @@ wnck_window_set_skip_tasklist (WnckWindow *window,
**/
void
wnck_window_set_fullscreen (WnckWindow *window,
gboolean fullscreen)
gboolean fullscreen)
{
g_return_if_fail (WNCK_IS_WINDOW (window));
_wnck_change_state (WNCK_SCREEN_XSCREEN (window->priv->screen),
window->priv->xwindow,
_wnck_change_state (window->priv->screen,
window->priv->xwindow,
fullscreen,
_wnck_atom_get ("_NET_WM_STATE_FULLSCREEN"),
0);
......@@ -1466,12 +1469,11 @@ wnck_window_is_sticky (WnckWindow *window)
**/
void
wnck_window_close (WnckWindow *window,
guint32 timestamp)
guint32 timestamp)
{
g_return_if_fail (WNCK_IS_WINDOW (window));
_wnck_close (WNCK_SCREEN_XSCREEN (window->priv->screen),
window->priv->xwindow, timestamp);
_wnck_close (window->priv->screen, window->priv->xwindow, timestamp);
}
/**
......@@ -1514,12 +1516,12 @@ wnck_window_unminimize (WnckWindow *window,
* Asks the window manager to maximize @window.
**/
void
wnck_window_maximize (WnckWindow *window)
wnck_window_maximize (WnckWindow *window)
{
g_return_if_fail (WNCK_IS_WINDOW (window));
_wnck_change_state (WNCK_SCREEN_XSCREEN (window->priv->screen),
window->priv->xwindow,
_wnck_change_state (window->priv->screen,
window->priv->xwindow,
TRUE,
_wnck_atom_get ("_NET_WM_STATE_MAXIMIZED_VERT"),
_wnck_atom_get ("_NET_WM_STATE_MAXIMIZED_HORZ"));
......@@ -1532,12 +1534,12 @@ wnck_window_maximize (WnckWindow *window)
* Asks the window manager to unmaximize @window.
**/
void
wnck_window_unmaximize (WnckWindow *window)
wnck_window_unmaximize (WnckWindow *window)
{
g_return_if_fail (WNCK_IS_WINDOW (window));
_wnck_change_state (WNCK_SCREEN_XSCREEN (window->priv->screen),
window->priv->xwindow,
_wnck_change_state (window->priv->screen,
window->priv->xwindow,
FALSE,
_wnck_atom_get ("_NET_WM_STATE_MAXIMIZED_VERT"),
_wnck_atom_get ("_NET_WM_STATE_MAXIMIZED_HORZ"));
......@@ -1550,12 +1552,12 @@ wnck_window_unmaximize (WnckWindow *window)
* Asks the window manager to maximize horizontally @window.
**/
void
wnck_window_maximize_horizontally (WnckWindow *window)
wnck_window_maximize_horizontally (WnckWindow *window)
{
g_return_if_fail (WNCK_IS_WINDOW (window));
_wnck_change_state (WNCK_SCREEN_XSCREEN (window->priv->screen),
window->priv->xwindow,
_wnck_change_state (window->priv->screen,
window->priv->xwindow,
TRUE,
_wnck_atom_get ("_NET_WM_STATE_MAXIMIZED_HORZ"),
0);
......@@ -1572,8 +1574,8 @@ wnck_window_unmaximize_horizontally (WnckWindow *window)
{
g_return_if_fail (WNCK_IS_WINDOW (window));
_wnck_change_state (WNCK_SCREEN_XSCREEN (window->priv->screen),
window->priv->xwindow,
_wnck_change_state (window->priv->screen,
window->priv->xwindow,
FALSE,
_wnck_atom_get ("_NET_WM_STATE_MAXIMIZED_HORZ"),
0);
......@@ -1586,12 +1588,12 @@ wnck_window_unmaximize_horizontally (WnckWindow *window)
* Asks the window manager to maximize vertically @window.
**/
void
wnck_window_maximize_vertically (WnckWindow *window)
wnck_window_maximize_vertically (WnckWindow *window)
{
g_return_if_fail (WNCK_IS_WINDOW (window));
_wnck_change_state (WNCK_SCREEN_XSCREEN (window->priv->screen),
window->priv->xwindow,
_wnck_change_state (window->priv->screen,
window->priv->xwindow,
TRUE,
_wnck_atom_get ("_NET_WM_STATE_MAXIMIZED_VERT"),
0);
......@@ -1604,12 +1606,12 @@ wnck_window_maximize_vertically (WnckWindow *window)
* Asks the window manager to unmaximize vertically @window.
**/
void
wnck_window_unmaximize_vertically (WnckWindow *window)
wnck_window_unmaximize_vertically (WnckWindow *window)
{
g_return_if_fail (WNCK_IS_WINDOW (window));
_wnck_change_state (WNCK_SCREEN_XSCREEN (window->priv->screen),
window->priv->xwindow,
_wnck_change_state (window->priv->screen,
window->priv->xwindow,
FALSE,
_wnck_atom_get ("_NET_WM_STATE_MAXIMIZED_VERT"),
0);
......@@ -1622,12 +1624,12 @@ wnck_window_unmaximize_vertically (WnckWindow *window)
* Asks the window manager to shade @window.
**/
void
wnck_window_shade (WnckWindow *window)
wnck_window_shade (WnckWindow *window)
{
g_return_if_fail (WNCK_IS_WINDOW (window));
_wnck_change_state (WNCK_SCREEN_XSCREEN (window->priv->screen),
window->priv->xwindow,
_wnck_change_state (window->priv->screen,
window->priv->xwindow,
TRUE,
_wnck_atom_get ("_NET_WM_STATE_SHADED"),
0);
......@@ -1640,12 +1642,12 @@ wnck_window_shade (WnckWindow *window)
* Asks the window manager to unshade @window.
**/
void
wnck_window_unshade (WnckWindow *window)
wnck_window_unshade (WnckWindow *window)
{
g_return_if_fail (WNCK_IS_WINDOW (window));
_wnck_change_state (WNCK_SCREEN_XSCREEN (window->priv->screen),
window->priv->xwindow,
_wnck_change_state (window->priv->screen,
window->priv->xwindow,
FALSE,
_wnck_atom_get ("_NET_WM_STATE_SHADED"),
0);
......@@ -1666,7 +1668,7 @@ wnck_window_make_above (WnckWindow *window)
{
g_return_if_fail (WNCK_IS_WINDOW (window));
_wnck_change_state (WNCK_SCREEN_XSCREEN (window->priv->screen),
_wnck_change_state (window->priv->screen,
window->priv->xwindow,
TRUE,
_wnck_atom_get ("_NET_WM_STATE_ABOVE"),
......@@ -1687,7 +1689,7 @@ wnck_window_unmake_above (WnckWindow *window)
{
g_return_if_fail (WNCK_IS_WINDOW (window));
_wnck_change_state (WNCK_SCREEN_XSCREEN (window->priv->screen),
_wnck_change_state (window->priv->screen,
window->priv->xwindow,
FALSE,
_wnck_atom_get ("_NET_WM_STATE_ABOVE"),
......@@ -1707,7 +1709,7 @@ wnck_window_make_below (WnckWindow *window)
{
g_return_if_fail (WNCK_IS_WINDOW (window));
_wnck_change_state (WNCK_SCREEN_XSCREEN (window->priv->screen),
_wnck_change_state (window->priv->screen,
window->priv->xwindow,
TRUE,
_wnck_atom_get ("_NET_WM_STATE_BELOW"),
......@@ -1728,7 +1730,7 @@ wnck_window_unmake_below (WnckWindow *window)
{
g_return_if_fail (WNCK_IS_WINDOW (window));
_wnck_change_state (WNCK_SCREEN_XSCREEN (window->priv->screen),
_wnck_change_state (window->priv->screen,
window->priv->xwindow,
FALSE,
_wnck_atom_get ("_NET_WM_STATE_BELOW"),
......@@ -1743,12 +1745,12 @@ wnck_window_unmake_below (WnckWindow *window)
* screen, even when the workspace or viewport scrolls.
**/
void
wnck_window_stick (WnckWindow *window)
wnck_window_stick (WnckWindow *window)
{
g_return_if_fail (WNCK_IS_WINDOW (window));
_wnck_change_state (WNCK_SCREEN_XSCREEN (window->priv->screen),
window->priv->xwindow,
_wnck_change_state (window->priv->screen,
window->priv->xwindow,
TRUE,
_wnck_atom_get ("_NET_WM_STATE_STICKY"),
0);
......@@ -1762,12 +1764,12 @@ wnck_window_stick (WnckWindow *window)
* screen when the workspace or viewport scrolls.
**/
void
wnck_window_unstick (WnckWindow *window)
wnck_window_unstick (WnckWindow *window)
{
g_return_if_fail (WNCK_IS_WINDOW (window));
_wnck_change_state (WNCK_SCREEN_XSCREEN (window->priv->screen),
window->priv->xwindow,
_wnck_change_state (window->priv->screen,
window->priv->xwindow,
FALSE,
_wnck_atom_get ("_NET_WM_STATE_STICKY"),
0);
......@@ -1784,7 +1786,7 @@ wnck_window_keyboard_move (WnckWindow *window)
{
g_return_if_fail (WNCK_IS_WINDOW (window));
_wnck_keyboard_move (WNCK_SCREEN_XSCREEN (window->priv->screen),
_wnck_keyboard_move (window->priv->screen,
window->priv->xwindow);
}
......@@ -1799,7 +1801,7 @@ wnck_window_keyboard_size (WnckWindow *window)
{
g_return_if_fail (WNCK_IS_WINDOW (window));
_wnck_keyboard_size (WNCK_SCREEN_XSCREEN (window->priv->screen),
_wnck_keyboard_size (window->priv->screen,
window->priv->xwindow);
}
......@@ -1840,8 +1842,8 @@ wnck_window_move_to_workspace (WnckWindow *window,
g_return_if_fail (WNCK_IS_WINDOW (window));
g_return_if_fail (WNCK_IS_WORKSPACE (space));
_wnck_change_workspace (WNCK_SCREEN_XSCREEN (window->priv->screen),
window->priv->xwindow,
_wnck_change_workspace (window->priv->screen,
window->priv->xwindow,
wnck_workspace_get_number (space));
}
......@@ -1874,8 +1876,8 @@ wnck_window_pin (WnckWindow *window)
{
g_return_if_fail (WNCK_IS_WINDOW (window));
_wnck_change_workspace (WNCK_SCREEN_XSCREEN (window->priv->screen),
window->priv->xwindow,
_wnck_change_workspace (window->priv->screen,
window->priv->xwindow,
ALL_WORKSPACES);
}
......@@ -1901,8 +1903,8 @@ wnck_window_unpin (WnckWindow *window)
active = wnck_screen_get_active_workspace (window->priv->screen);
_wnck_change_workspace (WNCK_SCREEN_XSCREEN (window->priv->screen),
window->priv->xwindow,
_wnck_change_workspace (window->priv->screen,
window->priv->xwindow,
active ? wnck_workspace_get_number (active) : 0);
}
......@@ -1928,7 +1930,7 @@ wnck_window_activate (WnckWindow *window,
{
g_return_if_fail (WNCK_IS_WINDOW (window));
_wnck_activate (WNCK_SCREEN_XSCREEN (window->priv->screen),
_wnck_activate (window->priv->screen,
window->priv->xwindow,
timestamp);
}
......@@ -2123,7 +2125,7 @@ get_icons (WnckWindow *window)
normal_size = _wnck_get_default_icon_size ();
mini_size = _wnck_get_default_mini_icon_size ();
if (_wnck_read_icons (WNCK_SCREEN_XSCREEN (window->priv->screen),
if (_wnck_read_icons (window->priv->screen,
window->priv->xwindow,
window->priv->icon_cache,
&icon, normal_size, normal_size,
......
......@@ -882,16 +882,18 @@ _wnck_deiconify (Screen *screen,
}
void
_wnck_close (Screen *screen,
Window xwindow,
Time timestamp)
_wnck_close (WnckScreen *screen,
Window xwindow,
Time timestamp)
{
Screen *xscreen;
Display *display;
Window root;
XEvent xev;
Window root;
XEvent xev;
display = DisplayOfScreen (screen);
root = RootWindowOfScreen (screen);
xscreen = _wnck_screen_get_xscreen (screen);
display = DisplayOfScreen (xscreen);
root = RootWindowOfScreen (xscreen);
xev.xclient.type = ClientMessage;
xev.xclient.serial = 0;
......@@ -928,15 +930,17 @@ _wnck_close (Screen *screen,
#define _NET_WM_MOVERESIZE_MOVE_KEYBOARD 10
void
_wnck_keyboard_move (Screen *screen,
Window xwindow)
_wnck_keyboard_move (WnckScreen *screen,
Window xwindow)
{
Screen *xscreen;
Display *display;
Window root;
XEvent xev;
Window root;
XEvent xev;
display = DisplayOfScreen (screen);
root = RootWindowOfScreen (screen);
xscreen = _wnck_screen_get_xscreen (screen);
display = DisplayOfScreen (xscreen);
root = RootWindowOfScreen (xscreen);
xev.xclient.type = ClientMessage;
xev.xclient.serial = 0;
......@@ -961,15 +965,17 @@ _wnck_keyboard_move (Screen *screen,
}
void
_wnck_keyboard_size (Screen *screen,
Window xwindow)
_wnck_keyboard_size (WnckScreen *screen,
Window xwindow)
{
Screen *xscreen;
Display *display;
Window root;
XEvent xev;
Window root;
XEvent xev;
display = DisplayOfScreen (screen);
root = RootWindowOfScreen (screen);
xscreen = _wnck_screen_get_xscreen (screen);
display = DisplayOfScreen (xscreen);
root = RootWindowOfScreen (xscreen);
xev.xclient.type = ClientMessage;
xev.xclient.serial = 0;
......@@ -994,22 +1000,24 @@ _wnck_keyboard_size (Screen *screen,
}
void
_wnck_change_state (Screen *screen,
Window xwindow,
gboolean add,
Atom state1,
Atom state2)
_wnck_change_state (WnckScreen *screen,
Window xwindow,
gboolean add,
Atom state1,
Atom state2)
{
Screen *xscreen;
Display *display;
Window root;
XEvent xev;
Window root;
XEvent xev;
#define _NET_WM_STATE_REMOVE 0 /* remove/unset property */
#define _NET_WM_STATE_ADD 1 /* add/set property */
#define _NET_WM_STATE_TOGGLE 2 /* toggle property */
display = DisplayOfScreen (screen);
root = RootWindowOfScreen (screen);
xscreen = _wnck_screen_get_xscreen (screen);
display = DisplayOfScreen (xscreen);
root = RootWindowOfScreen (xscreen);
xev.xclient.type = ClientMessage;
xev.xclient.serial = 0;
......@@ -1034,16 +1042,18 @@ _wnck_change_state (Screen *screen,
}
void
_wnck_change_workspace (Screen *screen,
Window xwindow,
_wnck_change_workspace (WnckScreen *screen,
Window xwindow,
int new_space)
{
Screen *xscreen;
Display *display;
Window root;
XEvent xev;
Window root;
XEvent xev;
display = DisplayOfScreen (screen);
root = RootWindowOfScreen (screen);
xscreen = _wnck_screen_get_xscreen (screen);
display = DisplayOfScreen (xscreen);
root = RootWindowOfScreen (xscreen);
xev.xclient.type = ClientMessage;
xev.xclient.serial = 0;
......@@ -1068,20 +1078,22 @@ _wnck_change_workspace (Screen *screen,
}
void
_wnck_activate (Screen *screen,
Window xwindow,
Time timestamp)
_wnck_activate (WnckScreen *screen,
Window xwindow,
Time timestamp)
{
Screen *xscreen;
Display *display;
Window root;
XEvent xev;
Window root;
XEvent xev;
if (timestamp == 0)
g_warning ("Received a timestamp of 0; window activation may not "
"function properly.\n");
display = DisplayOfScreen (screen);
root = RootWindowOfScreen (screen);
xscreen = _wnck_screen_get_xscreen (screen);
display = DisplayOfScreen (xscreen);
root = RootWindowOfScreen (xscreen);
xev.xclient.type = ClientMessage;
xev.xclient.serial = 0;
......@@ -2147,16 +2159,17 @@ scaled_from_pixdata (guchar *pixdata,
}
gboolean
_wnck_read_icons (Screen *screen,
Window xwindow,
WnckIconCache *icon_cache,
GdkPixbuf **iconp,
int ideal_width,
int ideal_height,
GdkPixbuf **mini_iconp,
int ideal_mini_width,
int ideal_mini_height)
{
_wnck_read_icons (WnckScreen *screen,
Window xwindow,
WnckIconCache *icon_cache,
GdkPixbuf **iconp,
int ideal_width,
int ideal_height,
GdkPixbuf **mini_iconp,
int ideal_mini_width,
int ideal_mini_height)
{
Screen *xscreen;
Display *display;
guchar *pixdata;
int w, h;
......@@ -2170,7 +2183,8 @@ _wnck_read_icons (Screen *screen,
g_return_val_if_fail (icon_cache != NULL, FALSE);
display = DisplayOfScreen (screen);
xscreen = _wnck_screen_get_xscreen (screen);
display = DisplayOfScreen (xscreen);
*iconp = NULL;
*mini_iconp = NULL;
......@@ -2206,7 +2220,7 @@ _wnck_read_icons (Screen *screen,
{
icon_cache->net_wm_icon_dirty = FALSE;
if (read_rgb_icon (screen, xwindow,
if (read_rgb_icon (xscreen, xwindow,
ideal_width, ideal_height,
ideal_mini_width, ideal_mini_height,
&w, &h, &pixdata,
......@@ -2253,7 +2267,7 @@ _wnck_read_icons (Screen *screen,
mask != icon_cache->prev_mask) &&
pixmap != None)
{
if (try_pixmap_and_mask (screen, pixmap, mask,
if (try_pixmap_and_mask (xscreen, pixmap, mask,
iconp, ideal_width, ideal_height,
mini_iconp, ideal_mini_width, ideal_mini_height))
{
......@@ -2273,13 +2287,13 @@ _wnck_read_icons (Screen *screen,
{
icon_cache->kwm_win_icon_dirty = FALSE;
get_kwm_win_icon (screen, xwindow, &pixmap, &mask);
get_kwm_win_icon (xscreen, xwindow, &pixmap, &mask);
if ((pixmap != icon_cache->prev_pixmap ||
mask != icon_cache->prev_mask) &&
pixmap != None)
{
if (try_pixmap_and_mask (screen, pixmap, mask,
if (try_pixmap_and_mask (xscreen, pixmap, mask,
iconp, ideal_width, ideal_height,
mini_iconp, ideal_mini_width, ideal_mini_height))
{
......
......@@ -27,6 +27,7 @@
#include <X11/Xatom.h>
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include <libwnck/screen.h>
G_BEGIN_DECLS
......@@ -98,21 +99,24 @@ void _wnck_iconify (Screen *screen,
void _wnck_deiconify (Screen *screen,
Window xwindow);
void _wnck_close (Screen *screen,
Window xwindow,
Time timestamp);
void _wnck_change_state (Screen *screen,
Window xwindow,
gboolean add,
Atom state1,
Atom state2);
void _wnck_change_workspace (Screen *screen,
Window xwindow,
int new_space);
void _wnck_activate (Screen *screen,
Window xwindow,
Time timestamp);
void _wnck_close (WnckScreen *screen,
Window xwindow,
Time timestamp);
void _wnck_change_state (WnckScreen *screen,
Window xwindow,
gboolean add,
Atom state1,
Atom state2);
void _wnck_change_workspace (WnckScreen *screen,
Window xwindow,
int new_space);
void _wnck_activate (WnckScreen *screen,
Window xwindow,
Time timestamp);
void _wnck_activate_workspace (Screen *screen,
int new_active_space,
Time timestamp);
......@@ -146,11 +150,11 @@ int _wnck_select_input (Screen *screen,
int mask,
gboolean update);
void _wnck_keyboard_move (Screen *screen,
Window xwindow);
void _wnck_keyboard_move (WnckScreen *screen,
Window xwindow);
void _wnck_keyboard_size (Screen *screen,
Window xwindow);
void _wnck_keyboard_size (WnckScreen *screen,
Window xwindow);
void _wnck_toggle_showing_desktop (Screen *screen,
gboolean show);
......@@ -166,15 +170,16 @@ void _wnck_icon_cache_set_want_fallback (WnckIconCache *icon_cache,
gboolean setting);
gboolean _wnck_icon_cache_get_is_fallback (WnckIconCache *icon_cache);
gboolean _wnck_read_icons (Screen *screen,
Window xwindow,
WnckIconCache *icon_cache,
GdkPixbuf **iconp,
int ideal_width,
int ideal_height,
GdkPixbuf **mini_iconp,
int ideal_mini_width,
int ideal_mini_height);
gboolean _wnck_read_icons (WnckScreen *screen,
Window xwindow,
WnckIconCache *icon_cache,
GdkPixbuf **iconp,
int ideal_width,