Back to index

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

Go to the source code of this file.

Classes

struct  _BamfWindow
struct  _BamfWindowClass

Defines

#define BAMF_TYPE_WINDOW   (bamf_window_get_type ())
#define BAMF_WINDOW(obj)
#define BAMF_WINDOW_CLASS(klass)
#define BAMF_IS_WINDOW(obj)
#define BAMF_IS_WINDOW_CLASS(klass)
#define BAMF_WINDOW_GET_CLASS(obj)

Typedefs

typedef struct _BamfWindow
typedef struct _BamfWindowClass
typedef struct _BamfWindowPrivate

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_window_get_type (void) G_GNUC_CONST
BamfWindow * bamf_window_get_transient (BamfWindow *self)
BamfWindowType bamf_window_get_window_type (BamfWindow *self)
guint32 bamf_window_get_xid (BamfWindow *self)
guint32 bamf_window_get_pid (BamfWindow *self)
gint bamf_window_get_monitor (BamfWindow *self)
gchar * bamf_window_get_utf8_prop (BamfWindow *self, const char *prop)
BamfWindowMaximizationType bamf_window_maximized (BamfWindow *self)
time_t bamf_window_last_active (BamfWindow *self)

Class Documentation

struct _BamfWindow

Definition at line 57 of file bamf-window.h.

Class Members
BamfView parent
BamfWindowPrivate * priv

Define Documentation

#define BAMF_IS_WINDOW (   obj)
Value:
(G_TYPE_CHECK_INSTANCE_TYPE ((obj),\
        BAMF_TYPE_WINDOW))

Definition at line 44 of file bamf-window.h.

#define BAMF_IS_WINDOW_CLASS (   klass)
Value:
(G_TYPE_CHECK_CLASS_TYPE ((klass),\
        BAMF_TYPE_WINDOW))

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

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

#define BAMF_WINDOW (   obj)
Value:
(G_TYPE_CHECK_INSTANCE_CAST ((obj),\
        BAMF_TYPE_WINDOW, BamfWindow))

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

#define BAMF_WINDOW_CLASS (   klass)
Value:
(G_TYPE_CHECK_CLASS_CAST ((klass),\
        BAMF_TYPE_WINDOW, BamfWindowClass))

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

#define BAMF_WINDOW_GET_CLASS (   obj)
Value:
(G_TYPE_INSTANCE_GET_CLASS ((obj),\
        BAMF_TYPE_WINDOW, BamfWindowClass))

Definition at line 50 of file bamf-window.h.


Typedef Documentation

typedef struct _BamfWindow

Definition at line 53 of file bamf-window.h.

typedef struct _BamfWindowClass

Definition at line 54 of file bamf-window.h.

typedef struct _BamfWindowPrivate

Definition at line 55 of file bamf-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 76 of file bamf-window.h.

{
  BAMF_WINDOW_FLOATING,              /* Floating window */
  BAMF_WINDOW_HORIZONTAL_MAXIMIZED,  /* Horizontally maximized window */
  BAMF_WINDOW_VERTICAL_MAXIMIZED,    /* Vertically maximized window */
  BAMF_WINDOW_MAXIMIZED              /* Maximized window */
} BamfWindowMaximizationType;
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 64 of file bamf-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

gint bamf_window_get_monitor ( BamfWindow *  self)

Definition at line 344 of file bamf-window.c.

{
  BamfWindowPrivate *priv;
  gint monitor = -2;
  GError *error = NULL;

  g_return_val_if_fail (BAMF_IS_WINDOW (self), -1);
  priv = self->priv;

  if (priv->monitor != -2 || !_bamf_view_remote_ready (BAMF_VIEW (self)))
    {
      return priv->monitor;
    }

  if (!dbus_g_proxy_call (priv->proxy,
                          "Monitor",
                          &error,
                          G_TYPE_INVALID,
                          G_TYPE_INT, &monitor,
                          G_TYPE_INVALID))
    {
      g_warning ("Failed to fetch monitor: %s", error->message);
      g_error_free (error);

      return -1;
    }

  return monitor;
}
guint32 bamf_window_get_pid ( BamfWindow *  self)

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

{
  BamfWindowPrivate *priv;
  guint32 pid = 0;
  GError *error = NULL;

  g_return_val_if_fail (BAMF_IS_WINDOW (self), FALSE);
  priv = self->priv;

  if (priv->pid != 0)
    return priv->pid;

  if (!_bamf_view_remote_ready (BAMF_VIEW (self)))
    return 0;

  if (!dbus_g_proxy_call (priv->proxy,
                          "GetPid",
                          &error,
                          G_TYPE_INVALID,
                          G_TYPE_UINT, &pid,
                          G_TYPE_INVALID))
    {
      g_warning ("Failed to fetch pid: %s", error->message);
      g_error_free (error);
      return 0;
    }

  return pid;
}
BamfWindow* bamf_window_get_transient ( BamfWindow *  self)

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

{
  BamfWindowPrivate *priv;
  BamfView *transient;
  char *path = NULL;
  GError *error = NULL;

  g_return_val_if_fail (BAMF_IS_WINDOW (self), FALSE);
  priv = self->priv;

  if (!_bamf_view_remote_ready (BAMF_VIEW (self)))
    return NULL;

  if (!dbus_g_proxy_call (priv->proxy,
                          "Transient",
                          &error,
                          G_TYPE_INVALID,
                          G_TYPE_STRING, &path,
                          G_TYPE_INVALID))
    {
      g_warning ("Failed to fetch path: %s", error->message);
      g_error_free (error);
      return 0;
    }
  
  if (!path)
    return NULL;

  BamfFactory *factory = _bamf_factory_get_default ();
  transient = _bamf_factory_view_for_path_type (factory, path, BAMF_FACTORY_WINDOW);
  g_free (path);  

  if (!BAMF_IS_WINDOW (transient))
    return NULL;
    
  return BAMF_WINDOW (transient);
}
GType bamf_window_get_type ( void  )
gchar* bamf_window_get_utf8_prop ( BamfWindow *  self,
const char *  prop 
)

Definition at line 308 of file bamf-window.c.

{
  BamfWindowPrivate *priv;
  char *result = NULL;
  GError *error = NULL;

  g_return_val_if_fail (BAMF_IS_WINDOW (self), NULL);
  priv = self->priv;

  if (!_bamf_view_remote_ready (BAMF_VIEW (self)))
    return NULL;

  if (!dbus_g_proxy_call (priv->proxy,
                          "Xprop",
                          &error,
                          G_TYPE_STRING, xprop,
                          G_TYPE_INVALID,
                          G_TYPE_STRING, &result,
                          G_TYPE_INVALID))
    {
      g_warning ("Failed to fetch property: %s", error->message);
      g_error_free (error);

      return NULL;
    }

  if (result && result[0] == '\0')
    {
      g_free (result);
      result = NULL;
    }

  return result;
}

Here is the call graph for this function:

Definition at line 116 of file bamf-window.c.

{
  BamfWindowPrivate *priv;
  guint32 type = 0;
  GError *error = NULL;

  g_return_val_if_fail (BAMF_IS_WINDOW (self), FALSE);
  priv = self->priv;

  if (!_bamf_view_remote_ready (BAMF_VIEW (self)))
    return 0;

  if (!dbus_g_proxy_call (priv->proxy,
                          "WindowType",
                          &error,
                          G_TYPE_INVALID,
                          G_TYPE_UINT, &type,
                          G_TYPE_INVALID))
    {
      g_warning ("Failed to fetch type: %s", error->message);
      g_error_free (error);
      return 0;
    }

  return (BamfWindowType) type;
}
guint32 bamf_window_get_xid ( BamfWindow *  self)

Definition at line 173 of file bamf-window.c.

{
  BamfWindowPrivate *priv;
  guint32 xid = 0;
  GError *error = NULL;
  
  g_return_val_if_fail (BAMF_IS_WINDOW (self), FALSE);
  priv = self->priv;
  
  if (priv->xid != 0)
    return priv->xid;

  if (!_bamf_view_remote_ready (BAMF_VIEW (self)))
    return 0;

  if (!dbus_g_proxy_call (priv->proxy,
                          "GetXid",
                          &error,
                          G_TYPE_INVALID,
                          G_TYPE_UINT, &xid,
                          G_TYPE_INVALID))
    {
      g_warning ("Failed to fetch xid: %s", error->message);
      g_error_free (error);
      return 0;
    }

  return xid;
}
time_t bamf_window_last_active ( BamfWindow *  self)

Definition at line 71 of file bamf-window.c.

{
  g_return_val_if_fail (BAMF_IS_WINDOW (self), (time_t) 0);
  
  return self->priv->last_active;
}

Definition at line 375 of file bamf-window.c.

{
  BamfWindowPrivate *priv;
  BamfWindowMaximizationType maximized = -1;
  GError *error = NULL;

  g_return_val_if_fail (BAMF_IS_WINDOW (self), -1);
  priv = self->priv;

  if (priv->maximized != -1 || !_bamf_view_remote_ready (BAMF_VIEW (self)))
    {
      return priv->maximized;
    }

  if (!dbus_g_proxy_call (priv->proxy,
                          "Maximized",
                          &error,
                          G_TYPE_INVALID,
                          G_TYPE_INT, &maximized,
                          G_TYPE_INVALID))
    {
      g_warning ("Failed to fetch maximized state: %s", error->message);
      g_error_free (error);

      return -1;
    }

  return maximized;
}