Back to index

lightning-sunbird  0.9+nobinonly
Defines | Typedefs | Functions | Variables
nsWindow.cpp File Reference
#include "prlink.h"
#include "nsWindow.h"
#include "nsToolkit.h"
#include "nsIRenderingContext.h"
#include "nsIRegion.h"
#include "nsIRollupListener.h"
#include "nsIMenuRollup.h"
#include "nsIDOMNode.h"
#include "nsWidgetsCID.h"
#include "nsIDragService.h"
#include "nsIDragSessionGTK.h"
#include "nsGtkKeyUtils.h"
#include "nsGtkCursors.h"
#include <gtk/gtkwindow.h>
#include <gdk/gdkx.h>
#include <gdk/gdkkeysyms.h>
#include "gtk2xtbin.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "nsIServiceManager.h"
#include "nsGfxCIID.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsXPIDLString.h"
#include "nsIFile.h"
#include "nsILocalFile.h"
#include <gdk/gdk.h>
#include "imgIContainer.h"
#include "gfxIImageFrame.h"
#include "nsIImage.h"
#include "nsIGdkPixbufImage.h"
#include "nsIInterfaceRequestorUtils.h"

Go to the source code of this file.

Defines

#define NS_WINDOW_TITLE_MAX_LENGTH   4095
#define kWindowPositionSlop   20
#define ARRAY_LENGTH(a)   (sizeof(a)/sizeof(a[0]))
#define UTF8_FOLLOWBYTE(ch)   (((ch) & 0xC0) == 0x80)

Typedefs

typedef struct _GdkDisplay
typedef GdkDisplay *(* _gdk_display_get_default_fn )(void)
typedef GdkCursor *(* _gdk_cursor_new_from_pixbuf_fn )(GdkDisplay *display, GdkPixbuf *pixbuf, gint x, gint y)
typedef void(* _gdk_window_set_urgency_hint_fn )(GdkWindow *window, gboolean urgency)

Functions

static PRBool check_for_rollup (GdkWindow *aWindow, gdouble aMouseX, gdouble aMouseY, PRBool aIsWheel)
static PRBool is_mouse_in_window (GdkWindow *aWindow, gdouble aMouseX, gdouble aMouseY)
static nsWindowget_window_for_gtk_widget (GtkWidget *widget)
static nsWindowget_window_for_gdk_window (GdkWindow *window)
static nsWindowget_owning_window_for_gdk_window (GdkWindow *window)
static GtkWidget * get_gtk_widget_for_gdk_window (GdkWindow *window)
static GdkCursor * get_gtk_cursor (nsCursor aCursor)
static GdkWindow * get_inner_gdk_window (GdkWindow *aWindow, gint x, gint y, gint *retx, gint *rety)
static PRBool is_context_menu_key (const nsKeyEvent &inKeyEvent)
static void key_event_to_context_menu_event (const nsKeyEvent *inKeyEvent, nsMouseEvent *outCMEvent)
static int is_parent_ungrab_enter (GdkEventCrossing *aEvent)
static int is_parent_grab_leave (GdkEventCrossing *aEvent)
static gboolean expose_event_cb (GtkWidget *widget, GdkEventExpose *event)
static gboolean configure_event_cb (GtkWidget *widget, GdkEventConfigure *event)
static void size_allocate_cb (GtkWidget *widget, GtkAllocation *allocation)
static gboolean delete_event_cb (GtkWidget *widget, GdkEventAny *event)
static gboolean enter_notify_event_cb (GtkWidget *widget, GdkEventCrossing *event)
static gboolean leave_notify_event_cb (GtkWidget *widget, GdkEventCrossing *event)
static gboolean motion_notify_event_cb (GtkWidget *widget, GdkEventMotion *event)
static gboolean button_press_event_cb (GtkWidget *widget, GdkEventButton *event)
static gboolean button_release_event_cb (GtkWidget *widget, GdkEventButton *event)
static gboolean focus_in_event_cb (GtkWidget *widget, GdkEventFocus *event)
static gboolean focus_out_event_cb (GtkWidget *widget, GdkEventFocus *event)
static gboolean key_press_event_cb (GtkWidget *widget, GdkEventKey *event)
static gboolean key_release_event_cb (GtkWidget *widget, GdkEventKey *event)
static gboolean scroll_event_cb (GtkWidget *widget, GdkEventScroll *event)
static gboolean visibility_notify_event_cb (GtkWidget *widget, GdkEventVisibility *event)
static gboolean window_state_event_cb (GtkWidget *widget, GdkEventWindowState *event)
static void theme_changed_cb (GtkSettings *settings, GParamSpec *pspec, nsWindow *data)
static GdkFilterReturn plugin_window_filter_func (GdkXEvent *gdk_xevent, GdkEvent *event, gpointer data)
static GdkFilterReturn plugin_client_message_filter (GdkXEvent *xevent, GdkEvent *event, gpointer data)
static gboolean drag_motion_event_cb (GtkWidget *aWidget, GdkDragContext *aDragContext, gint aX, gint aY, guint aTime, gpointer aData)
static void drag_leave_event_cb (GtkWidget *aWidget, GdkDragContext *aDragContext, guint aTime, gpointer aData)
static gboolean drag_drop_event_cb (GtkWidget *aWidget, GdkDragContext *aDragContext, gint aX, gint aY, guint aTime, gpointer *aData)
static void drag_data_received_event_cb (GtkWidget *aWidget, GdkDragContext *aDragContext, gint aX, gint aY, GtkSelectionData *aSelectionData, guint aInfo, guint32 aTime, gpointer aData)
static nsresult initialize_prefs (void)
static NS_DEFINE_IID (kCDragServiceCID, NS_DRAGSERVICE_CID)
 NS_IMPL_ISUPPORTS_INHERITED1 (nsWindow, nsCommonWidget, nsISupportsWeakReference) NS_IMETHODIMP nsWindow
static PRUint8Data32BitTo1Bit (PRUint8 *aImageData, PRUint32 aImageBytesPerRow, PRUint32 aWidth, PRUint32 aHeight)
void drag_data_received_event_cb (GtkWidget *aWidget, GdkDragContext *aDragContext, gint aX, gint aY, GtkSelectionData *aSelectionData, guint aInfo, guint aTime, gpointer aData)

Variables

static nsWindowgFocusWindow = NULL
static PRBool gGlobalsInitialized = PR_FALSE
static PRBool gRaiseWindows = PR_TRUE
static nsWindowgPluginFocusWindow = NULL
nsCOMPtr< nsIRollupListenergRollupListener
nsWeakPtr gRollupWindow
static _gdk_display_get_default_fn _gdk_display_get_default
static
_gdk_cursor_new_from_pixbuf_fn 
_gdk_cursor_new_from_pixbuf
static PRBool sPixbufCursorChecked
static GdkCursor * gCursorCache [eCursorCount]

Define Documentation

#define ARRAY_LENGTH (   a)    (sizeof(a)/sizeof(a[0]))

Definition at line 267 of file nsWindow.cpp.

Definition at line 262 of file nsWindow.cpp.

Definition at line 217 of file nsWindow.cpp.

#define UTF8_FOLLOWBYTE (   ch)    (((ch) & 0xC0) == 0x80)

Typedef Documentation

typedef GdkCursor*(* _gdk_cursor_new_from_pixbuf_fn)(GdkDisplay *display, GdkPixbuf *pixbuf, gint x, gint y)

Definition at line 249 of file nsWindow.cpp.

typedef GdkDisplay*(* _gdk_display_get_default_fn)(void)

Definition at line 247 of file nsWindow.cpp.

typedef void(* _gdk_window_set_urgency_hint_fn)(GdkWindow *window, gboolean urgency)

Definition at line 259 of file nsWindow.cpp.

typedef struct _GdkDisplay

Definition at line 246 of file nsWindow.cpp.


Function Documentation

gboolean button_press_event_cb ( GtkWidget *  widget,
GdkEventButton *  event 
) [static]

Definition at line 3901 of file nsWindow.cpp.

{
    LOG(("button_press_event_cb\n"));
    nsWindow *window = get_window_for_gdk_window(event->window);
    if (!window)
        return TRUE;

    window->OnButtonPressEvent(widget, event);

    return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean button_release_event_cb ( GtkWidget *  widget,
GdkEventButton *  event 
) [static]

Definition at line 3915 of file nsWindow.cpp.

{
    nsWindow *window = get_window_for_gdk_window(event->window);
    if (!window)
        return TRUE;

    window->OnButtonReleaseEvent(widget, event);

    return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool check_for_rollup ( GdkWindow *  aWindow,
gdouble  aMouseX,
gdouble  aMouseY,
PRBool  aIsWheel 
) [static]

Definition at line 3470 of file nsWindow.cpp.

{
    PRBool retVal = PR_FALSE;
    nsCOMPtr<nsIWidget> rollupWidget = do_QueryReferent(gRollupWindow);

    if (rollupWidget && gRollupListener) {
        GdkWindow *currentPopup =
            (GdkWindow *)rollupWidget->GetNativeData(NS_NATIVE_WINDOW);
        if (!is_mouse_in_window(currentPopup, aMouseX, aMouseY)) {
            PRBool rollup = PR_TRUE;
            if (aIsWheel) {
                gRollupListener->ShouldRollupOnMouseWheelEvent(&rollup);
                retVal = PR_TRUE;
            }
            // if we're dealing with menus, we probably have submenus and
            // we don't want to rollup if the clickis in a parent menu of
            // the current submenu
            nsCOMPtr<nsIMenuRollup> menuRollup;
            menuRollup = (do_QueryInterface(gRollupListener));
            if (menuRollup) {
                nsCOMPtr<nsISupportsArray> widgetChain;
                menuRollup->GetSubmenuWidgetChain(getter_AddRefs(widgetChain));
                if (widgetChain) {
                    PRUint32 count = 0;
                    widgetChain->Count(&count);
                    for (PRUint32 i=0; i<count; ++i) {
                        nsCOMPtr<nsISupports> genericWidget;
                        widgetChain->GetElementAt(i,
                                                  getter_AddRefs(genericWidget));
                        nsCOMPtr<nsIWidget> widget(do_QueryInterface(genericWidget));
                        if (widget) {
                            GdkWindow* currWindow =
                                (GdkWindow*) widget->GetNativeData(NS_NATIVE_WINDOW);
                            if (is_mouse_in_window(currWindow, aMouseX, aMouseY)) {
                                rollup = PR_FALSE;
                                break;
                            }
                        }
                    } // foreach parent menu widget
                }
            } // if rollup listener knows about menus

            // if we've determined that we should still rollup, do it.
            if (rollup) {
                gRollupListener->Rollup();
                retVal = PR_TRUE;
            }
        }
    } else {
        gRollupWindow = nsnull;
        gRollupListener = nsnull;
    }

    return retVal;
}

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean configure_event_cb ( GtkWidget *  widget,
GdkEventConfigure *  event 
) [static]

Definition at line 3816 of file nsWindow.cpp.

{
    nsWindow *window = get_window_for_gtk_widget(widget);
    if (!window)
        return FALSE;

    return window->OnConfigureEvent(widget, event);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PRUint8* Data32BitTo1Bit ( PRUint8 aImageData,
PRUint32  aImageBytesPerRow,
PRUint32  aWidth,
PRUint32  aHeight 
) [static]

Definition at line 833 of file nsWindow.cpp.

{
  PRUint32 outBpr = (aWidth + 7) / 8;
  
  PRUint8* outData = new PRUint8[outBpr * aHeight];
  if (!outData)
      return NULL;

  PRUint8 *outRow = outData,
          *imageRow = aImageData;

  for (PRUint32 curRow = 0; curRow < aHeight; curRow++) {
      PRUint8 *irow = imageRow;
      PRUint8 *orow = outRow;
      PRUint8 imagePixels = 0;
      PRUint8 offset = 0;

      for (PRUint32 curCol = 0; curCol < aWidth; curCol++) {
          PRUint8 r = *imageRow++,
                  g = *imageRow++,
                  b = *imageRow++;
               /* a = * */imageRow++;

          if ((r + b + g) < 3 * 128)
              imagePixels |= (1 << offset);

          if (offset == 7) {
              *outRow++ = imagePixels;
              offset = 0;
              imagePixels = 0;
          } else {
              offset++;
          }
      }
      if (offset != 0)
          *outRow++ = imagePixels;

      imageRow = irow + aImageBytesPerRow;
      outRow = orow + outBpr;
  }

  return outData;
}

Here is the caller graph for this function:

gboolean delete_event_cb ( GtkWidget *  widget,
GdkEventAny *  event 
) [static]

Definition at line 3839 of file nsWindow.cpp.

{
    nsWindow *window = get_window_for_gtk_widget(widget);
    if (!window)
        return FALSE;

    window->OnDeleteEvent(widget, event);

    return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void drag_data_received_event_cb ( GtkWidget *  aWidget,
GdkDragContext *  aDragContext,
gint  aX,
gint  aY,
GtkSelectionData *  aSelectionData,
guint  aInfo,
guint32  aTime,
gpointer  aData 
) [static]

Here is the caller graph for this function:

void drag_data_received_event_cb ( GtkWidget *  aWidget,
GdkDragContext *  aDragContext,
gint  aX,
gint  aY,
GtkSelectionData *  aSelectionData,
guint  aInfo,
guint  aTime,
gpointer  aData 
)

Definition at line 4233 of file nsWindow.cpp.

{
    nsWindow *window = get_window_for_gtk_widget(aWidget);
    if (!window)
        return;

    window->OnDragDataReceivedEvent(aWidget,
                                    aDragContext,
                                    aX, aY,
                                    aSelectionData,
                                    aInfo, aTime, aData);
}

Here is the call graph for this function:

gboolean drag_drop_event_cb ( GtkWidget *  aWidget,
GdkDragContext *  aDragContext,
gint  aX,
gint  aY,
guint  aTime,
gpointer *  aData 
) [static]

Definition at line 4213 of file nsWindow.cpp.

{
    nsWindow *window = get_window_for_gtk_widget(aWidget);

    if (!window)
        return FALSE;

    return window->OnDragDropEvent(aWidget,
                                   aDragContext,
                                   aX, aY, aTime, aData);

}

Here is the call graph for this function:

Here is the caller graph for this function:

void drag_leave_event_cb ( GtkWidget *  aWidget,
GdkDragContext *  aDragContext,
guint  aTime,
gpointer  aData 
) [static]

Definition at line 4198 of file nsWindow.cpp.

{
    nsWindow *window = get_window_for_gtk_widget(aWidget);
    if (!window)
        return;

    window->OnDragLeaveEvent(aWidget, aDragContext, aTime, aData);
}

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean drag_motion_event_cb ( GtkWidget *  aWidget,
GdkDragContext *  aDragContext,
gint  aX,
gint  aY,
guint  aTime,
gpointer  aData 
) [static]

Definition at line 4181 of file nsWindow.cpp.

{
    nsWindow *window = get_window_for_gtk_widget(aWidget);
    if (!window)
        return FALSE;

    return window->OnDragMotionEvent(aWidget,
                                     aDragContext,
                                     aX, aY, aTime, aData);
}

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean enter_notify_event_cb ( GtkWidget *  widget,
GdkEventCrossing *  event 
) [static]

Definition at line 3852 of file nsWindow.cpp.

{
    if (is_parent_ungrab_enter(event)) {
        return TRUE;
    }

    nsWindow *window = get_window_for_gdk_window(event->window);
    if (!window)
        return TRUE;

    window->OnEnterNotifyEvent(widget, event);

    return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean expose_event_cb ( GtkWidget *  widget,
GdkEventExpose *  event 
) [static]

Definition at line 3796 of file nsWindow.cpp.

{
    nsWindow *window = get_window_for_gdk_window(event->window);
    if (!window)
        return FALSE;

    // XXX We are so getting lucky here.  We are doing all of
    // mozilla's painting and then allowing default processing to occur.
    // This means that Mozilla paints in all of it's stuff and then
    // NO_WINDOW widgets (like scrollbars, for example) are painted by
    // Gtk on top of what we painted.

    // This return window->OnExposeEvent(widget, event); */

    window->OnExposeEvent(widget, event);
    return FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean focus_in_event_cb ( GtkWidget *  widget,
GdkEventFocus *  event 
) [static]

Definition at line 3928 of file nsWindow.cpp.

{
    nsWindow *window = get_window_for_gtk_widget(widget);
    if (!window)
        return FALSE;

    window->OnContainerFocusInEvent(widget, event);

    return FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean focus_out_event_cb ( GtkWidget *  widget,
GdkEventFocus *  event 
) [static]

Definition at line 3941 of file nsWindow.cpp.

{
    nsWindow *window = get_window_for_gtk_widget(widget);
    if (!window)
        return FALSE;

    window->OnContainerFocusOutEvent(widget, event);

    return FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

GdkCursor * get_gtk_cursor ( nsCursor  aCursor) [static]

Definition at line 3639 of file nsWindow.cpp.

{
    GdkPixmap *cursor;
    GdkPixmap *mask;
    GdkColor fg, bg;
    GdkCursor *gdkcursor = nsnull;
    PRUint8 newType = 0xff;

    if ((gdkcursor = gCursorCache[aCursor])) {
        return gdkcursor;
    }

    switch (aCursor) {
    case eCursor_standard:
        gdkcursor = gdk_cursor_new(GDK_LEFT_PTR);
        break;
    case eCursor_wait:
        gdkcursor = gdk_cursor_new(GDK_WATCH);
        break;
    case eCursor_select:
        gdkcursor = gdk_cursor_new(GDK_XTERM);
        break;
    case eCursor_hyperlink:
        gdkcursor = gdk_cursor_new(GDK_HAND2);
        break;
    case eCursor_n_resize:
        gdkcursor = gdk_cursor_new(GDK_TOP_SIDE);
        break;
    case eCursor_s_resize:
        gdkcursor = gdk_cursor_new(GDK_BOTTOM_SIDE);
        break;
    case eCursor_w_resize:
        gdkcursor = gdk_cursor_new(GDK_LEFT_SIDE);
        break;
    case eCursor_e_resize:
        gdkcursor = gdk_cursor_new(GDK_RIGHT_SIDE);
        break;
    case eCursor_nw_resize:
        gdkcursor = gdk_cursor_new(GDK_TOP_LEFT_CORNER);
        break;
    case eCursor_se_resize:
        gdkcursor = gdk_cursor_new(GDK_BOTTOM_RIGHT_CORNER);
        break;
    case eCursor_ne_resize:
        gdkcursor = gdk_cursor_new(GDK_TOP_RIGHT_CORNER);
        break;
    case eCursor_sw_resize:
        gdkcursor = gdk_cursor_new(GDK_BOTTOM_LEFT_CORNER);
        break;
    case eCursor_crosshair:
        gdkcursor = gdk_cursor_new(GDK_CROSSHAIR);
        break;
    case eCursor_move:
        gdkcursor = gdk_cursor_new(GDK_FLEUR);
        break;
    case eCursor_help:
        newType = MOZ_CURSOR_QUESTION_ARROW;
        break;
    case eCursor_copy: // CSS3
        newType = MOZ_CURSOR_COPY;
        break;
    case eCursor_alias:
        newType = MOZ_CURSOR_ALIAS;
        break;
    case eCursor_context_menu:
        newType = MOZ_CURSOR_CONTEXT_MENU;
        break;
    case eCursor_cell:
        gdkcursor = gdk_cursor_new(GDK_PLUS);
        break;
    case eCursor_grab:
        newType = MOZ_CURSOR_HAND_GRAB;
        break;
    case eCursor_grabbing:
        newType = MOZ_CURSOR_HAND_GRABBING;
        break;
    case eCursor_spinning:
        newType = MOZ_CURSOR_SPINNING;
        break;
    case eCursor_zoom_in:
        newType = MOZ_CURSOR_ZOOM_IN;
        break;
    case eCursor_zoom_out:
        newType = MOZ_CURSOR_ZOOM_OUT;
        break;
    case eCursor_not_allowed:
    case eCursor_no_drop:
        newType = MOZ_CURSOR_NOT_ALLOWED;
        break;
    case eCursor_col_resize:
        newType = MOZ_CURSOR_COL_RESIZE;
        break;
    case eCursor_row_resize:
        newType = MOZ_CURSOR_ROW_RESIZE;
        break;
    case eCursor_vertical_text:
        newType = MOZ_CURSOR_VERTICAL_TEXT;
        break;
    case eCursor_all_scroll:
        gdkcursor = gdk_cursor_new(GDK_FLEUR);
        break;
    case eCursor_nesw_resize:
        newType = MOZ_CURSOR_NESW_RESIZE;
        break;
    case eCursor_nwse_resize:
        newType = MOZ_CURSOR_NWSE_RESIZE;
        break;
    case eCursor_ns_resize:
        gdkcursor = gdk_cursor_new(GDK_SB_V_DOUBLE_ARROW);
        break;
    case eCursor_ew_resize:
        gdkcursor = gdk_cursor_new(GDK_SB_H_DOUBLE_ARROW);
        break;
    default:
        NS_ASSERTION(aCursor, "Invalid cursor type");
        gdkcursor = gdk_cursor_new(GDK_LEFT_PTR);
        break;
    }

    // if by now we dont have a xcursor, this means we have to make a
    // custom one
    if (newType != 0xff) {
        gdk_color_parse("#000000", &fg);
        gdk_color_parse("#ffffff", &bg);

        cursor = gdk_bitmap_create_from_data(NULL,
                                             (char *)GtkCursors[newType].bits,
                                             32, 32);
        if (!cursor)
            return NULL;

        mask =
            gdk_bitmap_create_from_data(NULL,
                                        (char *)GtkCursors[newType].mask_bits,
                                        32, 32);
        if (!mask) {
            gdk_bitmap_unref(cursor);
            return NULL;
        }

        gdkcursor = gdk_cursor_new_from_pixmap(cursor, mask, &fg, &bg,
                                               GtkCursors[newType].hot_x,
                                               GtkCursors[newType].hot_y);

        gdk_bitmap_unref(mask);
        gdk_bitmap_unref(cursor);
    }

    gCursorCache[aCursor] = gdkcursor;

    return gdkcursor;
}
GtkWidget * get_gtk_widget_for_gdk_window ( GdkWindow *  window) [static]

Definition at line 3627 of file nsWindow.cpp.

{
    gpointer user_data = NULL;
    gdk_window_get_user_data(window, &user_data);
    if (!user_data)
        return NULL;

    return GTK_WIDGET(user_data);
}

Here is the caller graph for this function:

GdkWindow * get_inner_gdk_window ( GdkWindow *  aWindow,
gint  x,
gint  y,
gint *  retx,
gint *  rety 
) [static]

Definition at line 4358 of file nsWindow.cpp.

{
    gint cx, cy, cw, ch, cd;
    GList * children = gdk_window_peek_children(aWindow);
    guint num = g_list_length(children);
    for (int i = 0; i < (int)num; i++) {
        GList * child = g_list_nth(children, num - i - 1) ;
        if (child) {
            GdkWindow * childWindow = (GdkWindow *) child->data;
            gdk_window_get_geometry (childWindow, &cx, &cy, &cw, &ch, &cd);
            if ((cx < x) && (x < (cx + cw)) &&
                (cy < y) && (y < (cy + ch)) &&
                gdk_window_is_visible (childWindow)) {
                return get_inner_gdk_window (childWindow,
                                             x - cx, y - cy,
                                             retx, rety);
            }
        }
    }
    *retx = x;
    *rety = y;
    return aWindow;
}

Here is the caller graph for this function:

nsWindow * get_owning_window_for_gdk_window ( GdkWindow *  window) [static]

Definition at line 3610 of file nsWindow.cpp.

{
    GtkWidget *owningWidget = get_gtk_widget_for_gdk_window(window);
    if (!owningWidget)
        return nsnull;

    gpointer user_data;
    user_data = g_object_get_data(G_OBJECT(owningWidget), "nsWindow");

    if (!user_data)
        return nsnull;

    return (nsWindow *)user_data;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsWindow * get_window_for_gdk_window ( GdkWindow *  window) [static]

Definition at line 3597 of file nsWindow.cpp.

{
    gpointer user_data;
    user_data = g_object_get_data(G_OBJECT(window), "nsWindow");

    if (!user_data)
        return nsnull;

    return NS_STATIC_CAST(nsWindow *, user_data);
}

Here is the caller graph for this function:

nsWindow * get_window_for_gtk_widget ( GtkWidget *  widget) [static]

Definition at line 3584 of file nsWindow.cpp.

{
    gpointer user_data;
    user_data = g_object_get_data(G_OBJECT(widget), "nsWindow");

    if (!user_data)
        return nsnull;

    return NS_STATIC_CAST(nsWindow *, user_data);
}

Here is the caller graph for this function:

nsresult initialize_prefs ( void  ) [static]

Definition at line 4255 of file nsWindow.cpp.

{
    // check to see if we should set our raise pref
    nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
    if (prefs) {
        PRBool val = PR_TRUE;
        nsresult rv;
        rv = prefs->GetBoolPref("mozilla.widget.raise-on-setfocus", &val);
        if (NS_SUCCEEDED(rv))
            gRaiseWindows = val;
    }

    return NS_OK;
}

Here is the call graph for this function:

PRBool is_context_menu_key ( const nsKeyEvent inKeyEvent) [inline, static]

Definition at line 4385 of file nsWindow.cpp.

{
    return ((aKeyEvent.keyCode == NS_VK_F10 && aKeyEvent.isShift &&
             !aKeyEvent.isControl && !aKeyEvent.isMeta && !aKeyEvent.isAlt) ||
            (aKeyEvent.keyCode == NS_VK_CONTEXT_MENU && !aKeyEvent.isShift &&
             !aKeyEvent.isControl && !aKeyEvent.isMeta && !aKeyEvent.isAlt));
}

Here is the caller graph for this function:

PRBool is_mouse_in_window ( GdkWindow *  aWindow,
gdouble  aMouseX,
gdouble  aMouseY 
) [static]

Definition at line 3539 of file nsWindow.cpp.

{
    gint x = 0;
    gint y = 0;
    gint w, h;

    gint offsetX = 0;
    gint offsetY = 0;

    GtkWidget *widget;
    GdkWindow *window;

    window = aWindow;

    while (window) {
        gint tmpX = 0;
        gint tmpY = 0;

        gdk_window_get_position(window, &tmpX, &tmpY);
        widget = get_gtk_widget_for_gdk_window(window);

        // if this is a window, compute x and y given its origin and our
        // offset
        if (GTK_IS_WINDOW(widget)) {
            x = tmpX + offsetX;
            y = tmpY + offsetY;
            break;
        }

        offsetX += tmpX;
        offsetY += tmpY;
        window = gdk_window_get_parent(window);
    }

    gdk_window_get_size(aWindow, &w, &h);

    if (aMouseX > x && aMouseX < x + w &&
        aMouseY > y && aMouseY < y + h)
        return PR_TRUE;

    return PR_FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int is_parent_grab_leave ( GdkEventCrossing *  aEvent) [static]

Definition at line 4418 of file nsWindow.cpp.

{
    return (GDK_CROSSING_GRAB == aEvent->mode) &&
        ((GDK_NOTIFY_ANCESTOR == aEvent->detail) ||
            (GDK_NOTIFY_VIRTUAL == aEvent->detail));
}

Here is the caller graph for this function:

int is_parent_ungrab_enter ( GdkEventCrossing *  aEvent) [static]

Definition at line 4408 of file nsWindow.cpp.

{
    return (GDK_CROSSING_UNGRAB == aEvent->mode) &&
        ((GDK_NOTIFY_ANCESTOR == aEvent->detail) ||
         (GDK_NOTIFY_VIRTUAL == aEvent->detail));

}

Here is the caller graph for this function:

void key_event_to_context_menu_event ( const nsKeyEvent inKeyEvent,
nsMouseEvent outCMEvent 
) [static]

Definition at line 4394 of file nsWindow.cpp.

{
    memcpy(aCMEvent, aKeyEvent, sizeof(nsInputEvent));
    aCMEvent->eventStructType = NS_MOUSE_EVENT;
    aCMEvent->message = NS_CONTEXTMENU_KEY;
    aCMEvent->isShift = aCMEvent->isControl = PR_FALSE;
    aCMEvent->isAlt = aCMEvent->isMeta = PR_FALSE;
    aCMEvent->clickCount = 0;
    aCMEvent->acceptActivation = PR_FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean key_press_event_cb ( GtkWidget *  widget,
GdkEventKey *  event 
) [static]

Definition at line 4053 of file nsWindow.cpp.

{
    LOG(("key_press_event_cb\n"));
    // find the window with focus and dispatch this event to that widget
    nsWindow *window = get_window_for_gtk_widget(widget);
    if (!window)
        return FALSE;

    nsWindow *focusWindow = gFocusWindow ? gFocusWindow : window;

    return focusWindow->OnKeyPressEvent(widget, event);
}

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean key_release_event_cb ( GtkWidget *  widget,
GdkEventKey *  event 
) [static]

Definition at line 4067 of file nsWindow.cpp.

{
    LOG(("key_release_event_cb\n"));
    // find the window with focus and dispatch this event to that widget
    nsWindow *window = get_window_for_gtk_widget(widget);
    if (!window)
        return FALSE;

    nsWindow *focusWindow = gFocusWindow ? gFocusWindow : window;

    return focusWindow->OnKeyReleaseEvent(widget, event);
}

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean leave_notify_event_cb ( GtkWidget *  widget,
GdkEventCrossing *  event 
) [static]

Definition at line 3870 of file nsWindow.cpp.

{
    if (is_parent_grab_leave(event)) {
        return TRUE;
    }

    nsWindow *window = get_window_for_gdk_window(event->window);
    if (!window)
        return TRUE;

    window->OnLeaveNotifyEvent(widget, event);

    return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean motion_notify_event_cb ( GtkWidget *  widget,
GdkEventMotion *  event 
) [static]

Definition at line 3888 of file nsWindow.cpp.

{
    nsWindow *window = get_window_for_gdk_window(event->window);
    if (!window)
        return TRUE;

    window->OnMotionNotifyEvent(widget, event);

    return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static NS_DEFINE_IID ( kCDragServiceCID  ,
NS_DRAGSERVICE_CID   
) [static]

Definition at line 342 of file nsWindow.cpp.

{
    nsresult rv = NativeCreate(aParent, nsnull, aRect, aHandleEventFunction,
                               aContext, aAppShell, aToolkit, aInitData);
    return rv;
}
GdkFilterReturn plugin_client_message_filter ( GdkXEvent *  xevent,
GdkEvent *  event,
gpointer  data 
) [static]

Definition at line 4016 of file nsWindow.cpp.

{
    XEvent    *xevent;
    xevent = (XEvent *)gdk_xevent;

    GdkFilterReturn return_val;
    return_val = GDK_FILTER_CONTINUE;

    if (!gPluginFocusWindow || xevent->type!=ClientMessage) {
        return return_val;
    }

    // When WM sends out WM_TAKE_FOCUS, gtk2 will use XSetInputFocus
    // to set the focus to the focus proxy. To prevent this happen
    // while the focus is on the plugin, we filter the WM_TAKE_FOCUS
    // out.
    Display *dpy ;
    dpy = GDK_WINDOW_XDISPLAY((GdkWindow*)(gPluginFocusWindow->
                GetNativeData(NS_NATIVE_WINDOW)));
    if (gdk_x11_get_xatom_by_name("WM_PROTOCOLS")
            != xevent->xclient.message_type) {
        return return_val;
    }

    if ((Atom) xevent->xclient.data.l[0] ==
            gdk_x11_get_xatom_by_name("WM_TAKE_FOCUS")) {
        // block it from gtk2.0 focus proxy
        return_val = GDK_FILTER_REMOVE;
    }

    return return_val;
}

Here is the caller graph for this function:

GdkFilterReturn plugin_window_filter_func ( GdkXEvent *  gdk_xevent,
GdkEvent *  event,
gpointer  data 
) [static]

Definition at line 3954 of file nsWindow.cpp.

{
    GtkWidget *widget;
    GdkWindow *plugin_window;
    gpointer  user_data;
    XEvent    *xevent;

    nsWindow  *nswindow = (nsWindow*)data;
    GdkFilterReturn return_val;

    xevent = (XEvent *)gdk_xevent;
    return_val = GDK_FILTER_CONTINUE;

    switch (xevent->type)
    {
        case CreateNotify:
        case ReparentNotify:
            if (xevent->type==CreateNotify) {
                plugin_window = gdk_window_lookup(xevent->xcreatewindow.window);
            }
            else {
                if (xevent->xreparent.event != xevent->xreparent.parent)
                    break;
                plugin_window = gdk_window_lookup (xevent->xreparent.window);
            }
            if (plugin_window) {
                user_data = nsnull;
                gdk_window_get_user_data(plugin_window, &user_data);
                widget = GTK_WIDGET(user_data);

                if (GTK_IS_XTBIN(widget)) {
                    nswindow->SetPluginType(nsWindow::PluginType_NONXEMBED);
                    break;
                }
                else if(GTK_IS_SOCKET(widget)) {
                    nswindow->SetPluginType(nsWindow::PluginType_XEMBED);
                    break;
                }
            }
            nswindow->SetPluginType(nsWindow::PluginType_NONXEMBED);
            return_val = GDK_FILTER_REMOVE;
            break;
        case EnterNotify:
            nswindow->SetNonXEmbedPluginFocus();
            break;
        case DestroyNotify:
            gdk_window_remove_filter
                ((GdkWindow*)(nswindow->GetNativeData(NS_NATIVE_WINDOW)),
                 plugin_window_filter_func,
                 nswindow);
            // Currently we consider all plugins are non-xembed and calls
            // LoseNonXEmbedPluginFocus without any checking.
            nswindow->LoseNonXEmbedPluginFocus();
            break;
        default:
            break;
    }
    return return_val;
}

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean scroll_event_cb ( GtkWidget *  widget,
GdkEventScroll *  event 
) [static]

Definition at line 4082 of file nsWindow.cpp.

{
    nsWindow *window = get_window_for_gdk_window(event->window);
    if (!window)
        return FALSE;

    window->OnScrollEvent(widget, event);

    return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void size_allocate_cb ( GtkWidget *  widget,
GtkAllocation *  allocation 
) [static]

Definition at line 3828 of file nsWindow.cpp.

{
    nsWindow *window = get_window_for_gtk_widget(widget);
    if (!window)
        return;

    window->OnSizeAllocate(widget, allocation);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void theme_changed_cb ( GtkSettings *  settings,
GParamSpec *  pspec,
nsWindow data 
) [static]

Definition at line 4121 of file nsWindow.cpp.

{
    data->ThemeChanged();
}

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean visibility_notify_event_cb ( GtkWidget *  widget,
GdkEventVisibility *  event 
) [static]

Definition at line 4095 of file nsWindow.cpp.

{
    nsWindow *window = get_window_for_gdk_window(event->window);
    if (!window)
        return FALSE;

    window->OnVisibilityNotifyEvent(widget, event);

    return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean window_state_event_cb ( GtkWidget *  widget,
GdkEventWindowState *  event 
) [static]

Definition at line 4108 of file nsWindow.cpp.

{
    nsWindow *window = get_window_for_gtk_widget(widget);
    if (!window)
        return FALSE;

    window->OnWindowStateEvent(widget, event);

    return FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 254 of file nsWindow.cpp.

Definition at line 253 of file nsWindow.cpp.

GdkCursor* gCursorCache[eCursorCount] [static]

Definition at line 265 of file nsWindow.cpp.

nsWindow* gFocusWindow = NULL [static]

Definition at line 209 of file nsWindow.cpp.

Definition at line 210 of file nsWindow.cpp.

Definition at line 212 of file nsWindow.cpp.

Definition at line 211 of file nsWindow.cpp.

Definition at line 214 of file nsWindow.cpp.

Definition at line 215 of file nsWindow.cpp.

Definition at line 255 of file nsWindow.cpp.