Back to index

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

Go to the source code of this file.

Classes

struct  _BamfWindowClass
struct  _BamfWindow

Defines

#define BAMF_TYPE_WINDOW   (bamf_window_get_type ())
#define BAMF_WINDOW(obj)   (G_TYPE_CHECK_INSTANCE_CAST ((obj), BAMF_TYPE_WINDOW, BamfWindow))
#define BAMF_IS_WINDOW(obj)   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BAMF_TYPE_WINDOW))
#define BAMF_WINDOW_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST ((klass), BAMF_TYPE_WINDOW, BamfWindowClass))
#define BAMF_IS_WINDOW_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), BAMF_TYPE_WINDOW))
#define BAMF_WINDOW_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), BAMF_TYPE_WINDOW, BamfWindowClass))

Typedefs

typedef struct _BamfWindow
typedef struct _BamfWindowClass
typedef struct _BamfWindowPrivate

Functions

GType bamf_window_get_type (void) G_GNUC_CONST
BamfLegacyWindow * bamf_window_get_window (BamfWindow *self)
BamfWindow * bamf_window_get_transient (BamfWindow *self)
const char * bamf_window_get_transient_path (BamfWindow *self)
guint32 bamf_window_get_window_type (BamfWindow *self)
guint32 bamf_window_get_xid (BamfWindow *window)
guint32 bamf_window_get_pid (BamfWindow *window)
time_t bamf_window_last_active (BamfWindow *window)
time_t bamf_window_opened (BamfWindow *window)
gint bamf_window_get_stack_position (BamfWindow *window)
char * bamf_window_get_xprop (BamfWindow *self, const char *prop)
BamfWindowMaximizationType bamf_window_maximized (BamfWindow *self)
gint bamf_window_get_monitor (BamfWindow *self)
BamfWindow * bamf_window_new (BamfLegacyWindow *window)

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)    (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BAMF_TYPE_WINDOW))

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

#define BAMF_IS_WINDOW_CLASS (   klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), BAMF_TYPE_WINDOW))

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

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

#define BAMF_WINDOW (   obj)    (G_TYPE_CHECK_INSTANCE_CAST ((obj), BAMF_TYPE_WINDOW, BamfWindow))

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

#define BAMF_WINDOW_CLASS (   klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), BAMF_TYPE_WINDOW, BamfWindowClass))

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

#define BAMF_WINDOW_GET_CLASS (   obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), BAMF_TYPE_WINDOW, BamfWindowClass))

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


Typedef Documentation

typedef struct _BamfWindow

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

typedef struct _BamfWindowClass

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

typedef struct _BamfWindowPrivate

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


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;
}

Here is the call graph for this function:

Here is the caller graph for this function:

guint32 bamf_window_get_pid ( BamfWindow *  window)

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;
}

Here is the call graph for this function:

Here is the caller graph for this function:

gint bamf_window_get_stack_position ( BamfWindow *  window)

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

{
  g_return_val_if_fail (BAMF_IS_WINDOW (self), -1);

  return bamf_legacy_window_get_stacking_position (self->priv->legacy_window);
}

Here is the call graph for this function:

Here is the caller graph for this function:

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);
}

Here is the call graph for this function:

Here is the caller graph for this function:

const char* bamf_window_get_transient_path ( BamfWindow *  self)

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

{
  BamfWindow *transient;
  
  g_return_val_if_fail (BAMF_IS_WINDOW (self), NULL);
  
  transient = bamf_window_get_transient (self);
  
  if (transient == NULL)
    return "";
  
  return bamf_view_get_path (BAMF_VIEW (transient));
} 

Here is the call graph for this function:

Here is the caller graph for this function:

GType bamf_window_get_type ( void  )
BamfLegacyWindow* bamf_window_get_window ( BamfWindow *  self)

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

{
  g_return_val_if_fail (BAMF_IS_WINDOW (self), NULL);

  if (BAMF_WINDOW_GET_CLASS (self)->get_window)
    return BAMF_WINDOW_GET_CLASS (self)->get_window (self);

  return self->priv->legacy_window;
}

Here is the caller graph for this function:

guint32 bamf_window_get_window_type ( BamfWindow *  self)

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;
}

Here is the call graph for this function:

Here is the caller graph for this function:

guint32 bamf_window_get_xid ( BamfWindow *  window)

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;
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* bamf_window_get_xprop ( BamfWindow *  self,
const char *  prop 
)

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

{
  g_return_val_if_fail (BAMF_IS_WINDOW (self), NULL);
  return bamf_legacy_window_get_utf8_xprop(self->priv->legacy_window, prop);
}

Here is the call graph for this function:

Here is the caller graph for this function:

time_t bamf_window_last_active ( BamfWindow *  window)

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;
}

Here is the call graph for this function:

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;
}

Here is the call graph for this function:

Here is the caller graph for this function:

BamfWindow* bamf_window_new ( BamfLegacyWindow *  window)

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

{
  BamfWindow *self;
  self = (BamfWindow *) g_object_new (BAMF_TYPE_WINDOW, "legacy-window", window, NULL);
  
  return self;
}
time_t bamf_window_opened ( BamfWindow *  window)

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

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