Back to index

lightning-sunbird  0.9+nobinonly
Functions | Variables
gtkmozbox.c File Reference
#include "gtkmozbox.h"
#include <gtk/gtkmain.h>
#include <X11/Xlib.h>

Go to the source code of this file.


static void gtk_mozbox_class_init (GtkMozBoxClass *klass)
static void gtk_mozbox_init (GtkMozBox *mozbox)
static void gtk_mozbox_realize (GtkWidget *widget)
static void gtk_mozbox_set_focus (GtkWindow *window, GtkWidget *focus)
static gint gtk_mozbox_key_press_event (GtkWidget *widget, GdkEventKey *event)
static GdkFilterReturn gtk_mozbox_filter (GdkXEvent *xevent, GdkEvent *event, gpointer data)
static GtkWindow * gtk_mozbox_get_parent_gtkwindow (GtkMozBox *mozbox)
GtkType gtk_mozbox_get_type (void)
GtkWidget * gtk_mozbox_new (GdkWindow *parent_window)
void gtk_mozbox_set_position (GtkMozBox *mozbox, gint x, gint y)


void(* parent_class_set_focus )(GtkWindow *, GtkWidget *)

Function Documentation

static void gtk_mozbox_class_init ( GtkMozBoxClass *  klass) [static]

Definition at line 84 of file gtkmozbox.c.

  GtkWidgetClass *widget_class;
  GtkWindowClass *window_class;

  widget_class = GTK_WIDGET_CLASS (klass);
  window_class = GTK_WINDOW_CLASS (klass);

  widget_class->realize         = gtk_mozbox_realize;
  widget_class->key_press_event = gtk_mozbox_key_press_event;

  /* save the parent class' set_focus method */
  parent_class_set_focus = window_class->set_focus;
  window_class->set_focus       = gtk_mozbox_set_focus;

Here is the call graph for this function:

Here is the caller graph for this function:

static GdkFilterReturn gtk_mozbox_filter ( GdkXEvent *  xevent,
GdkEvent *  event,
gpointer  data 
) [static]

Definition at line 208 of file gtkmozbox.c.

  XEvent *xev = xevent;
  GtkWidget *widget = data;

  switch (xev->xany.type)
    case ConfigureNotify:
      event->configure.type = GDK_CONFIGURE;
      event->configure.window = widget->window;
      event->configure.x = 0;
      event->configure.y = 0;
      event->configure.width = xev->xconfigure.width;
      event->configure.height = xev->xconfigure.height;

Here is the caller graph for this function:

static GtkWindow * gtk_mozbox_get_parent_gtkwindow ( GtkMozBox *  mozbox) [static]

Definition at line 231 of file gtkmozbox.c.

  GdkWindow *tmpWindow;
  /* look for a parent GtkWindow in the heirarchy */
  tmpWindow = mozbox->parent_window;
  while (tmpWindow) {
    gpointer data = NULL;
    gdk_window_get_user_data(tmpWindow, &data);
    if (data && GTK_IS_WINDOW(data)) {
      return GTK_WINDOW(data);
    tmpWindow = gdk_window_get_parent(tmpWindow);
  return NULL;

Here is the caller graph for this function:

GtkType gtk_mozbox_get_type ( void  )

Definition at line 59 of file gtkmozbox.c.

  static GtkType mozbox_type = 0;

  if (!mozbox_type)
      static const GtkTypeInfo mozbox_info =
        sizeof (GtkMozBox),
        sizeof (GtkMozBoxClass),
        (GtkClassInitFunc) gtk_mozbox_class_init,
        (GtkObjectInitFunc) gtk_mozbox_init,
        /* reserved_1 */ NULL,
        /* reserved_2 */ NULL,
        (GtkClassInitFunc) NULL

      mozbox_type = gtk_type_unique (GTK_TYPE_WINDOW, &mozbox_info);

  return mozbox_type;

Here is the call graph for this function:

static void gtk_mozbox_init ( GtkMozBox *  mozbox) [static]

Definition at line 102 of file gtkmozbox.c.

  mozbox->parent_window = NULL;
  mozbox->x = 0;
  mozbox->y = 0;

Here is the caller graph for this function:

static gint gtk_mozbox_key_press_event ( GtkWidget *  widget,
GdkEventKey *  event 
) [static]

Definition at line 178 of file gtkmozbox.c.

  GtkWindow *window;
  GtkMozBox *mozbox;
  GtkWindow *parentWindow;
  gboolean   handled = FALSE;

  window = GTK_WINDOW (widget);
  mozbox = GTK_MOZBOX (widget);

  parentWindow = gtk_mozbox_get_parent_gtkwindow(mozbox);

  /* give the focus window the chance to handle the event first. */
  if (parentWindow && parentWindow->focus_widget) {
    handled = gtk_widget_event (parentWindow->focus_widget, (GdkEvent*) event);

  /* pass it off to the parent widget */
  if (!handled) {
    event->window = mozbox->parent_window;
    gdk_event_put((GdkEvent *)event);

  return TRUE;

Here is the call graph for this function:

Here is the caller graph for this function:

GtkWidget* gtk_mozbox_new ( GdkWindow *  parent_window)

Definition at line 248 of file gtkmozbox.c.

  GtkMozBox *mozbox;

  mozbox = gtk_type_new (GTK_TYPE_MOZBOX);
  mozbox->parent_window = parent_window;

  return GTK_WIDGET (mozbox);

Here is the caller graph for this function:

static void gtk_mozbox_realize ( GtkWidget *  widget) [static]

Definition at line 110 of file gtkmozbox.c.

  GdkWindowAttr attributes;
  gint attributes_mask;
  GtkMozBox *mozbox;

  g_return_if_fail (GTK_IS_MOZBOX (widget));

  mozbox = GTK_MOZBOX (widget);

  /* GtkWindow checks against premature realization here. Just
   * don't do it.

  attributes.window_type = GDK_WINDOW_CHILD;
  attributes.x = mozbox->x;
  attributes.y = mozbox->y;
  attributes.width = widget->allocation.width;
  attributes.height = widget->allocation.height;
  attributes.wclass = GDK_INPUT_OUTPUT;
  attributes.visual = gtk_widget_get_visual (widget);
  attributes.colormap = gtk_widget_get_colormap (widget);
  attributes.event_mask = gtk_widget_get_events (widget);
  attributes.event_mask |= GDK_EXPOSURE_MASK;
  attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;

  widget->window = gdk_window_new (mozbox->parent_window,
                               &attributes, attributes_mask);

  /* set the back pixmap to None so that you don't end up with the gtk
     default which is BlackPixel */
  gdk_window_set_back_pixmap (widget->window, NULL, FALSE);

  gdk_window_set_user_data (widget->window, mozbox);

  widget->style = gtk_style_attach (widget->style, widget->window);
  gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);

  gdk_window_add_filter (widget->window, gtk_mozbox_filter, mozbox);

Here is the call graph for this function:

Here is the caller graph for this function:

static void gtk_mozbox_set_focus ( GtkWindow *  window,
GtkWidget *  focus 
) [static]

Definition at line 153 of file gtkmozbox.c.

  GtkMozBox *mozbox;
  GdkWindow *tmpWindow;
  GtkWindow *parentGtkWindow;

  g_return_if_fail(window != NULL);

  mozbox = GTK_MOZBOX(window);

  parentGtkWindow = gtk_mozbox_get_parent_gtkwindow (mozbox);

  if (parentGtkWindow) {
    parent_class_set_focus(parentGtkWindow, focus);

  /* as a fall back just hand it off to our parent class */
  parent_class_set_focus(window, focus);


Here is the call graph for this function:

Here is the caller graph for this function:

void gtk_mozbox_set_position ( GtkMozBox *  mozbox,
gint  x,
gint  y 

Definition at line 259 of file gtkmozbox.c.

  mozbox->x = x;
  mozbox->y = y;

  if (GTK_WIDGET_REALIZED (mozbox))
    gdk_window_move (GTK_WIDGET (mozbox)->window, x, y);

Here is the caller graph for this function:

Variable Documentation

void(* parent_class_set_focus)(GtkWindow *, GtkWidget *)

Definition at line 56 of file gtkmozbox.c.