Back to index

bamf  0.2.120
Classes | Defines | Typedefs | Enumerations | Functions
bamf-legacy-window.h File Reference
#include "config.h"
#include "bamf.h"
#include "bamf-view.h"
#include <sys/types.h>
#include <glib.h>
#include <glib-object.h>
#include <libwnck/libwnck.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _BamfLegacyWindowClass
struct  _BamfLegacyWindow

Defines

#define BAMF_TYPE_LEGACY_WINDOW   (bamf_legacy_window_get_type ())
#define BAMF_LEGACY_WINDOW(obj)   (G_TYPE_CHECK_INSTANCE_CAST ((obj), BAMF_TYPE_LEGACY_WINDOW, BamfLegacyWindow))
#define BAMF_IS_LEGACY_WINDOW(obj)   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BAMF_TYPE_LEGACY_WINDOW))
#define BAMF_LEGACY_WINDOW_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST ((klass), BAMF_TYPE_LEGACY_WINDOW, BamfLegacyWindowClass))
#define BAMF_IS_LEGACY_WINDOW_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), BAMF_TYPE_LEGACY_WINDOW))
#define BAMF_LEGACY_WINDOW_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), BAMF_TYPE_LEGACY_WINDOW, BamfLegacyWindowClass))
#define BAMF_LEGACY_WINDOW_SIGNAL_NAME_CHANGED   "name-changed"
#define BAMF_LEGACY_WINDOW_SIGNAL_STATE_CHANGED   "state-changed"
#define BAMF_LEGACY_WINDOW_SIGNAL_GEOMETRY_CHANGED   "geometry-changed"
#define BAMF_LEGACY_WINDOW_SIGNAL_CLOSED   "closed"

Typedefs

typedef struct _BamfLegacyWindow
typedef struct _BamfLegacyWindowClass
typedef struct _BamfLegacyWindowPrivate

Enumerations

enum  BamfWindowType {
  BAMF_WINDOW_NORMAL, BAMF_WINDOW_DESKTOP, BAMF_WINDOW_DOCK, BAMF_WINDOW_DIALOG,
  BAMF_WINDOW_TOOLBAR, BAMF_WINDOW_MENU, BAMF_WINDOW_UTILITY, BAMF_WINDOW_SPLASHSCREEN,
  BAMF_WINDOW_NORMAL, BAMF_WINDOW_DESKTOP, BAMF_WINDOW_DOCK, BAMF_WINDOW_DIALOG,
  BAMF_WINDOW_TOOLBAR, BAMF_WINDOW_MENU, BAMF_WINDOW_UTILITY, BAMF_WINDOW_SPLASHSCREEN
}
enum  BamfWindowMaximizationType {
  BAMF_WINDOW_FLOATING, BAMF_WINDOW_HORIZONTAL_MAXIMIZED, BAMF_WINDOW_VERTICAL_MAXIMIZED, BAMF_WINDOW_MAXIMIZED,
  BAMF_WINDOW_FLOATING, BAMF_WINDOW_HORIZONTAL_MAXIMIZED, BAMF_WINDOW_VERTICAL_MAXIMIZED, BAMF_WINDOW_MAXIMIZED
}

Functions

GType bamf_legacy_window_get_type (void) G_GNUC_CONST
guint32 bamf_legacy_window_get_xid (BamfLegacyWindow *self)
gint bamf_legacy_window_get_pid (BamfLegacyWindow *self)
void bamf_legacy_window_get_geometry (BamfLegacyWindow *self, gint *x, gint *y, gint *width, gint *height)
gboolean bamf_legacy_window_is_active (BamfLegacyWindow *self)
gboolean bamf_legacy_window_is_skip_tasklist (BamfLegacyWindow *self)
gboolean bamf_legacy_window_needs_attention (BamfLegacyWindow *self)
gboolean bamf_legacy_window_is_closed (BamfLegacyWindow *self)
BamfWindowType bamf_legacy_window_get_window_type (BamfLegacyWindow *self)
BamfWindowMaximizationType bamf_legacy_window_maximized (BamfLegacyWindow *self)
const char * bamf_legacy_window_get_class_instance_name (BamfLegacyWindow *self)
const char * bamf_legacy_window_get_class_name (BamfLegacyWindow *self)
const char * bamf_legacy_window_get_name (BamfLegacyWindow *self)
const char * bamf_legacy_window_save_mini_icon (BamfLegacyWindow *self)
char * bamf_legacy_window_get_exec_string (BamfLegacyWindow *self)
BamfLegacyWindow * bamf_legacy_window_get_transient (BamfLegacyWindow *self)
char * bamf_legacy_window_get_utf8_xprop (BamfLegacyWindow *self, const char *prop)
gint bamf_legacy_window_get_stacking_position (BamfLegacyWindow *self)
void bamf_legacy_window_reopen (BamfLegacyWindow *self)
BamfLegacyWindow * bamf_legacy_window_new (WnckWindow *legacy_window)

Class Documentation

struct _BamfLegacyWindow

Definition at line 100 of file bamf-legacy-window.h.

Class Members
GObject parent
BamfLegacyWindowPrivate * priv

Define Documentation

#define BAMF_IS_LEGACY_WINDOW (   obj)    (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BAMF_TYPE_LEGACY_WINDOW))

Definition at line 35 of file bamf-legacy-window.h.

#define BAMF_IS_LEGACY_WINDOW_CLASS (   klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), BAMF_TYPE_LEGACY_WINDOW))

Definition at line 37 of file bamf-legacy-window.h.

#define BAMF_LEGACY_WINDOW (   obj)    (G_TYPE_CHECK_INSTANCE_CAST ((obj), BAMF_TYPE_LEGACY_WINDOW, BamfLegacyWindow))

Definition at line 34 of file bamf-legacy-window.h.

#define BAMF_LEGACY_WINDOW_CLASS (   klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), BAMF_TYPE_LEGACY_WINDOW, BamfLegacyWindowClass))

Definition at line 36 of file bamf-legacy-window.h.

#define BAMF_LEGACY_WINDOW_GET_CLASS (   obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), BAMF_TYPE_LEGACY_WINDOW, BamfLegacyWindowClass))

Definition at line 38 of file bamf-legacy-window.h.

#define BAMF_LEGACY_WINDOW_SIGNAL_CLOSED   "closed"

Definition at line 43 of file bamf-legacy-window.h.

#define BAMF_LEGACY_WINDOW_SIGNAL_GEOMETRY_CHANGED   "geometry-changed"

Definition at line 42 of file bamf-legacy-window.h.

#define BAMF_LEGACY_WINDOW_SIGNAL_NAME_CHANGED   "name-changed"

Definition at line 40 of file bamf-legacy-window.h.

#define BAMF_LEGACY_WINDOW_SIGNAL_STATE_CHANGED   "state-changed"

Definition at line 41 of file bamf-legacy-window.h.

Definition at line 33 of file bamf-legacy-window.h.


Typedef Documentation

typedef struct _BamfLegacyWindow

Definition at line 45 of file bamf-legacy-window.h.

typedef struct _BamfLegacyWindowClass

Definition at line 46 of file bamf-legacy-window.h.

typedef struct _BamfLegacyWindowPrivate

Definition at line 47 of file bamf-legacy-window.h.


Enumeration Type Documentation

Enumerator:
BAMF_WINDOW_FLOATING 
BAMF_WINDOW_HORIZONTAL_MAXIMIZED 
BAMF_WINDOW_VERTICAL_MAXIMIZED 
BAMF_WINDOW_MAXIMIZED 
BAMF_WINDOW_FLOATING 
BAMF_WINDOW_HORIZONTAL_MAXIMIZED 
BAMF_WINDOW_VERTICAL_MAXIMIZED 
BAMF_WINDOW_MAXIMIZED 

Definition at line 61 of file bamf-legacy-window.h.

Enumerator:
BAMF_WINDOW_NORMAL 
BAMF_WINDOW_DESKTOP 
BAMF_WINDOW_DOCK 
BAMF_WINDOW_DIALOG 
BAMF_WINDOW_TOOLBAR 
BAMF_WINDOW_MENU 
BAMF_WINDOW_UTILITY 
BAMF_WINDOW_SPLASHSCREEN 
BAMF_WINDOW_NORMAL 
BAMF_WINDOW_DESKTOP 
BAMF_WINDOW_DOCK 
BAMF_WINDOW_DIALOG 
BAMF_WINDOW_TOOLBAR 
BAMF_WINDOW_MENU 
BAMF_WINDOW_UTILITY 
BAMF_WINDOW_SPLASHSCREEN 

Definition at line 49 of file bamf-legacy-window.h.

{
  BAMF_WINDOW_NORMAL,       /* document/app window */
  BAMF_WINDOW_DESKTOP,      /* desktop background */
  BAMF_WINDOW_DOCK,         /* panel */
  BAMF_WINDOW_DIALOG,       /* dialog */
  BAMF_WINDOW_TOOLBAR,      /* tearoff toolbar */
  BAMF_WINDOW_MENU,         /* tearoff menu */
  BAMF_WINDOW_UTILITY,      /* palette/toolbox window */
  BAMF_WINDOW_SPLASHSCREEN  /* splash screen */
} BamfWindowType;

Function Documentation

const char* bamf_legacy_window_get_class_instance_name ( BamfLegacyWindow *  self)

Definition at line 114 of file bamf-legacy-window.c.

{
  WnckWindow *window;

  g_return_val_if_fail (BAMF_IS_LEGACY_WINDOW (self), NULL);

  window = self->priv->legacy_window;

  if (BAMF_LEGACY_WINDOW_GET_CLASS (self)->get_class_instance_name)
    return BAMF_LEGACY_WINDOW_GET_CLASS (self)->get_class_instance_name (self);

  if (!window)
    return NULL;

#ifdef USE_GTK3
  return wnck_window_get_class_instance_name (window);

#else
  if (!self->priv->instance_name)
    {
      Window xid = wnck_window_get_xid (window);
      bamf_xutils_get_window_class_hints (xid, &self->priv->instance_name, NULL);
    }

  return self->priv->instance_name;
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

const char* bamf_legacy_window_get_class_name ( BamfLegacyWindow *  self)

Definition at line 143 of file bamf-legacy-window.c.

{
  WnckWindow *window;

  g_return_val_if_fail (BAMF_IS_LEGACY_WINDOW (self), NULL);

  window = self->priv->legacy_window;

  if (BAMF_LEGACY_WINDOW_GET_CLASS (self)->get_class_name)
    return BAMF_LEGACY_WINDOW_GET_CLASS (self)->get_class_name (self);

  if (!window)
    return NULL;

#ifdef USE_GTK3
  return wnck_window_get_class_group_name (window);

#else
  if (!self->priv->group_name)
    {
      Window xid = wnck_window_get_xid (window);
      bamf_xutils_get_window_class_hints (xid, NULL, &self->priv->group_name);
    }

  return self->priv->group_name;
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* bamf_legacy_window_get_exec_string ( BamfLegacyWindow *  self)

Definition at line 186 of file bamf-legacy-window.c.

{
  gchar *result = NULL;
  gint pid = 0, i = 0;
  gchar **argv = NULL;
  GString *exec = NULL;
  glibtop_proc_args buffer;

  g_return_val_if_fail (BAMF_IS_LEGACY_WINDOW (self), NULL);

  if (BAMF_LEGACY_WINDOW_GET_CLASS (self)->get_exec_string)
    return BAMF_LEGACY_WINDOW_GET_CLASS (self)->get_exec_string (self);

  pid = bamf_legacy_window_get_pid (self);

  if (pid == 0)
    return NULL;

  argv = glibtop_get_proc_argv (&buffer, pid, 0);
  exec = g_string_new ("");

  while (argv[i] != NULL)
    {
      g_string_append (exec, argv[i]);
      if (argv[i + 1] != NULL)
        g_string_append (exec, " ");
      g_free (argv[i]);
      i++;
    }

  g_free (argv);

  result = g_strdup (exec->str);
  g_string_free (exec, TRUE);
  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void bamf_legacy_window_get_geometry ( BamfLegacyWindow *  self,
gint *  x,
gint *  y,
gint *  width,
gint *  height 
)

Definition at line 368 of file bamf-legacy-window.c.

{
  if (x) *x = 0;
  if (y) *y = 0;
  if (width) *width = 0;
  if (height) *height = 0;

  g_return_if_fail (BAMF_IS_LEGACY_WINDOW (self));

  if (BAMF_LEGACY_WINDOW_GET_CLASS (self)->get_app_id)
    BAMF_LEGACY_WINDOW_GET_CLASS (self)->get_app_id (self);

  if (!self->priv->legacy_window)
    return;

  wnck_window_get_geometry (self->priv->legacy_window, x, y, width, height);
}

Here is the caller graph for this function:

const char* bamf_legacy_window_get_name ( BamfLegacyWindow *  self)

Definition at line 172 of file bamf-legacy-window.c.

{
  g_return_val_if_fail (BAMF_IS_LEGACY_WINDOW (self), NULL);


  if (BAMF_LEGACY_WINDOW_GET_CLASS (self)->get_name)
    return BAMF_LEGACY_WINDOW_GET_CLASS (self)->get_name (self);

  if (!self->priv->legacy_window)
    return NULL;
  return wnck_window_get_name (self->priv->legacy_window);
}

Here is the caller graph for this function:

gint bamf_legacy_window_get_pid ( BamfLegacyWindow *  self)

Definition at line 261 of file bamf-legacy-window.c.

{
  g_return_val_if_fail (BAMF_IS_LEGACY_WINDOW (self), 0);

  if (BAMF_LEGACY_WINDOW_GET_CLASS (self)->get_pid)
    return BAMF_LEGACY_WINDOW_GET_CLASS (self)->get_pid (self);

  if (!self->priv->legacy_window)
    return 0;
  return wnck_window_get_pid (self->priv->legacy_window);
}

Here is the caller graph for this function:

gint bamf_legacy_window_get_stacking_position ( BamfLegacyWindow *  self)

Definition at line 320 of file bamf-legacy-window.c.

{
  BamfLegacyScreen *screen;
  
  g_return_val_if_fail (BAMF_IS_LEGACY_WINDOW (self), -1);

  screen = bamf_legacy_screen_get_default ();
  g_return_val_if_fail (BAMF_IS_LEGACY_SCREEN (screen), -1);
  
  return g_list_index (bamf_legacy_screen_get_windows (screen), self);
}

Here is the call graph for this function:

Here is the caller graph for this function:

BamfLegacyWindow* bamf_legacy_window_get_transient ( BamfLegacyWindow *  self)

Definition at line 288 of file bamf-legacy-window.c.

{
  BamfLegacyScreen *screen;
  BamfLegacyWindow *other;
  GList *windows, *l;
  WnckWindow *transient_legacy;
  
  g_return_val_if_fail (BAMF_IS_LEGACY_WINDOW (self), NULL);
  
  transient_legacy = wnck_window_get_transient (self->priv->legacy_window);
  if (transient_legacy == NULL)
    return NULL;
  
  screen = bamf_legacy_screen_get_default ();
  g_return_val_if_fail (BAMF_IS_LEGACY_SCREEN (screen), NULL);
  
  windows = bamf_legacy_screen_get_windows (screen);
  for (l = windows; l; l = l->next)
    {
      other = l->data;
      
      if (!BAMF_IS_LEGACY_WINDOW (other))
        continue;
      
      if (other->priv->legacy_window == transient_legacy)
        return other;
    }
  
  return NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

GType bamf_legacy_window_get_type ( void  )
char* bamf_legacy_window_get_utf8_xprop ( BamfLegacyWindow *  self,
const char *  prop 
)

Definition at line 426 of file bamf-legacy-window.c.

{
  g_return_val_if_fail (BAMF_IS_LEGACY_WINDOW (self), NULL);

  if (!self->priv->legacy_window)
    return NULL;

  guint xid = bamf_legacy_window_get_xid (self);
  return bamf_xutils_get_window_hint (xid, prop, XInternAtom(gdk_x11_get_default_xdisplay (), "UTF8_STRING", False));
}

Here is the call graph for this function:

Here is the caller graph for this function:

BamfWindowType bamf_legacy_window_get_window_type ( BamfLegacyWindow *  self)

Definition at line 78 of file bamf-legacy-window.c.

{
  g_return_val_if_fail (BAMF_IS_LEGACY_WINDOW (self), 0);
  g_return_val_if_fail (self->priv->legacy_window, 0);

  return (BamfWindowType) wnck_window_get_window_type (self->priv->legacy_window);
}

Here is the caller graph for this function:

guint32 bamf_legacy_window_get_xid ( BamfLegacyWindow *  self)

Definition at line 274 of file bamf-legacy-window.c.

{
  g_return_val_if_fail (BAMF_IS_LEGACY_WINDOW (self), 0);

  if (BAMF_LEGACY_WINDOW_GET_CLASS (self)->get_xid)
    return BAMF_LEGACY_WINDOW_GET_CLASS (self)->get_xid (self);

  if (!self->priv->legacy_window)
    return 0;

  return (guint32) wnck_window_get_xid (self->priv->legacy_window);
}

Here is the caller graph for this function:

gboolean bamf_legacy_window_is_active ( BamfLegacyWindow *  self)

Definition at line 63 of file bamf-legacy-window.c.

{
  WnckWindow *active;

  g_return_val_if_fail (BAMF_IS_LEGACY_WINDOW (self), FALSE);

  if (BAMF_LEGACY_WINDOW_GET_CLASS (self)->is_active)
    return BAMF_LEGACY_WINDOW_GET_CLASS (self)->is_active (self);

  active = wnck_screen_get_active_window (wnck_screen_get_default ());

  return active == self->priv->legacy_window;
}

Here is the caller graph for this function:

gboolean bamf_legacy_window_is_closed ( BamfLegacyWindow *  self)

Definition at line 360 of file bamf-legacy-window.c.

{
  g_return_val_if_fail (BAMF_IS_LEGACY_WINDOW (self), TRUE);
  
  return self->priv->is_closed;
}
gboolean bamf_legacy_window_is_skip_tasklist ( BamfLegacyWindow *  self)

Definition at line 101 of file bamf-legacy-window.c.

{
  g_return_val_if_fail (BAMF_IS_LEGACY_WINDOW (self), FALSE);

  if (BAMF_LEGACY_WINDOW_GET_CLASS (self)->is_skip_tasklist)
    return BAMF_LEGACY_WINDOW_GET_CLASS (self)->is_skip_tasklist (self);

  if (!self->priv->legacy_window)
    return FALSE;
  return wnck_window_is_skip_tasklist (self->priv->legacy_window);
}

Here is the caller graph for this function:

Definition at line 388 of file bamf-legacy-window.c.

{
  WnckWindowState window_state;
  BamfWindowMaximizationType maximization_type;
  g_return_val_if_fail (BAMF_IS_LEGACY_WINDOW (self), BAMF_WINDOW_FLOATING);

  if (BAMF_LEGACY_WINDOW_GET_CLASS (self)->maximized)
    return BAMF_LEGACY_WINDOW_GET_CLASS (self)->maximized (self);

  if (!self->priv->legacy_window)
    return BAMF_WINDOW_FLOATING;

  window_state = wnck_window_get_state (self->priv->legacy_window);

  gboolean vertical = (window_state & WNCK_WINDOW_STATE_MAXIMIZED_VERTICALLY);
  gboolean horizontal = (window_state & WNCK_WINDOW_STATE_MAXIMIZED_HORIZONTALLY);

  if (vertical && horizontal)
    {
      maximization_type = BAMF_WINDOW_MAXIMIZED;
    }
  else if (horizontal)
    {
      maximization_type = BAMF_WINDOW_HORIZONTAL_MAXIMIZED;
    }
  else if (vertical)
    {
      maximization_type = BAMF_WINDOW_VERTICAL_MAXIMIZED;
    }
  else
    {
      maximization_type = BAMF_WINDOW_FLOATING;
    }

  return maximization_type;
}

Here is the caller graph for this function:

gboolean bamf_legacy_window_needs_attention ( BamfLegacyWindow *  self)

Definition at line 87 of file bamf-legacy-window.c.

{
  g_return_val_if_fail (BAMF_IS_LEGACY_WINDOW (self), FALSE);


  if (BAMF_LEGACY_WINDOW_GET_CLASS (self)->needs_attention)
    return BAMF_LEGACY_WINDOW_GET_CLASS (self)->needs_attention (self);

  if (!self->priv->legacy_window)
    return FALSE;
  return wnck_window_needs_attention (self->priv->legacy_window);
}

Here is the caller graph for this function:

BamfLegacyWindow* bamf_legacy_window_new ( WnckWindow *  legacy_window)

Definition at line 592 of file bamf-legacy-window.c.

{
  BamfLegacyWindow *self;
  self = (BamfLegacyWindow *) g_object_new (BAMF_TYPE_LEGACY_WINDOW, NULL);

  self->priv->legacy_window = legacy_window;

  self->priv->name_changed_id = g_signal_connect (G_OBJECT (legacy_window), "name-changed",
                                                  (GCallback) handle_name_changed, self);

  self->priv->state_changed_id = g_signal_connect (G_OBJECT (legacy_window), "state-changed",
                                                   (GCallback) handle_state_changed, self);

  self->priv->geometry_changed_id = g_signal_connect (G_OBJECT (legacy_window), "geometry-changed",
                                                      (GCallback) handle_geometry_changed, self);

  return self;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void bamf_legacy_window_reopen ( BamfLegacyWindow *  self)

Definition at line 463 of file bamf-legacy-window.c.

{
  g_return_if_fail (BAMF_IS_LEGACY_WINDOW (self));
  g_return_if_fail (WNCK_IS_WINDOW (self->priv->legacy_window));

  guint xid = bamf_legacy_window_get_xid (self);

  /* Adding a weak ref to this object, causes to get notified after the object
   * destruction, so once this BamfLegacyWindow has been closed and drestroyed
   * the handle_destroy_notify() function will be called, and that will
   * provide to iniject another window like this one to the BamfLegacyScreen  */
  g_object_weak_ref (G_OBJECT (self), (GWeakNotify) handle_destroy_notify,
                                                    GUINT_TO_POINTER (xid));

  self->priv->is_closed = TRUE;
  g_signal_emit (self, legacy_window_signals[CLOSED], 0);
}

Here is the call graph for this function:

Here is the caller graph for this function:

const char* bamf_legacy_window_save_mini_icon ( BamfLegacyWindow *  self)

Definition at line 224 of file bamf-legacy-window.c.

{
  WnckWindow *window;
  GdkPixbuf *pbuf;
  char *tmp;
  
  g_return_val_if_fail (BAMF_IS_LEGACY_WINDOW (self), NULL);
  
  if (self->priv->mini_icon_path)
    {
      if (g_file_test (self->priv->mini_icon_path, G_FILE_TEST_EXISTS))
        return self->priv->mini_icon_path;
      else
        g_free (self->priv->mini_icon_path);
    }
  
  window = self->priv->legacy_window;
  
  if (!window)
    return NULL;
  
  if (wnck_window_get_icon_is_fallback (window))
    return NULL;
  
  tmp = tmpnam (NULL);
  if (!tmp)
    return NULL;
  
  pbuf = wnck_window_get_icon (window);
  if (!gdk_pixbuf_save (pbuf, tmp, "png", NULL, NULL))
    return NULL;
  
  self->priv->mini_icon_path = g_strdup (tmp);
  return self->priv->mini_icon_path;
}

Here is the caller graph for this function: