diff options
Diffstat (limited to 'WebCore/platform/gtk')
28 files changed, 581 insertions, 1118 deletions
diff --git a/WebCore/platform/gtk/ContextMenuItemGtk.cpp b/WebCore/platform/gtk/ContextMenuItemGtk.cpp index cf34640..aaec206 100644 --- a/WebCore/platform/gtk/ContextMenuItemGtk.cpp +++ b/WebCore/platform/gtk/ContextMenuItemGtk.cpp @@ -56,10 +56,8 @@ static const char* gtkStockIDFromContextMenuAction(const ContextMenuAction& acti return GTK_STOCK_PASTE; case ContextMenuItemTagDelete: return GTK_STOCK_DELETE; -#if GTK_CHECK_VERSION(2, 10, 0) case ContextMenuItemTagSelectAll: return GTK_STOCK_SELECT_ALL; -#endif case ContextMenuItemTagSpellingGuess: return GTK_STOCK_INFO; case ContextMenuItemTagIgnoreSpelling: diff --git a/WebCore/platform/gtk/CursorGtk.cpp b/WebCore/platform/gtk/CursorGtk.cpp index 76f6d00..115760e 100644 --- a/WebCore/platform/gtk/CursorGtk.cpp +++ b/WebCore/platform/gtk/CursorGtk.cpp @@ -28,7 +28,6 @@ #include "config.h" #include "CursorGtk.h" -#include "NotImplemented.h" #include <wtf/Assertions.h> #include <gdk/gdk.h> @@ -63,7 +62,13 @@ Cursor::Cursor(const Cursor& other) Cursor::Cursor(Image*, const IntPoint&) { - notImplemented(); + // FIXME: We don't support images for cursors yet. + // This is just a placeholder to avoid crashes. + Cursor other(crossCursor()); + m_impl = other.m_impl; + + if (m_impl) + gdk_cursor_ref(m_impl); } Cursor::~Cursor() @@ -204,13 +209,13 @@ const Cursor& northWestSouthEastResizeCursor() const Cursor& columnResizeCursor() { - static Cursor c = gdk_cursor_new(GDK_DOUBLE_ARROW); + static Cursor c = gdk_cursor_new(GDK_SB_H_DOUBLE_ARROW); return c; } const Cursor& rowResizeCursor() { - static Cursor c = gdk_cursor_new(GDK_DOUBLE_ARROW); + static Cursor c = gdk_cursor_new(GDK_SB_V_DOUBLE_ARROW); return c; } @@ -268,8 +273,8 @@ const Cursor& verticalTextCursor() const Cursor& cellCursor() { - notImplemented(); - return pointerCursor(); + static Cursor c = gdk_cursor_new(GDK_PLUS); + return c; } const Cursor& contextMenuCursor() @@ -280,8 +285,8 @@ const Cursor& contextMenuCursor() const Cursor& noDropCursor() { - notImplemented(); - return pointerCursor(); + static Cursor c = customCursorNew(CustomCursorNoDrop); + return c; } const Cursor& copyCursor() @@ -292,8 +297,8 @@ const Cursor& copyCursor() const Cursor& progressCursor() { - notImplemented(); - return pointerCursor(); + static Cursor c = customCursorNew(CustomCursorProgress); + return c; } const Cursor& aliasCursor() @@ -304,14 +309,13 @@ const Cursor& aliasCursor() const Cursor& noneCursor() { - notImplemented(); - return pointerCursor(); + static Cursor c = customCursorNew(CustomCursorNone); + return c; } const Cursor& notAllowedCursor() { - notImplemented(); - return pointerCursor(); + return noDropCursor(); } const Cursor& zoomInCursor() @@ -328,14 +332,14 @@ const Cursor& zoomOutCursor() const Cursor& grabCursor() { - notImplemented(); - return pointerCursor(); + static Cursor c = customCursorNew(CustomCursorGrab); + return c; } const Cursor& grabbingCursor() { - notImplemented(); - return pointerCursor(); + static Cursor c = customCursorNew(CustomCursorGrabbing); + return c; } } diff --git a/WebCore/platform/gtk/CursorGtk.h b/WebCore/platform/gtk/CursorGtk.h index 73f05a9..85aaefa 100644 --- a/WebCore/platform/gtk/CursorGtk.h +++ b/WebCore/platform/gtk/CursorGtk.h @@ -1,23 +1,40 @@ -/* - * Copyright (C) 2001 Tim Copperfield <timecop@network.email.ne.jp> - * Copyright (C) 2007 Christian Dywan <christian@twotoasts.de> +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * The Original Code is mozilla.org code. * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. + * The Initial Developer of the Original Code is + * Tim Copperfield. + * Portions created by the Initial Developer are Copyright (C) 2001 + * the Initial Developer. All Rights Reserved. * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * Contributor(s): + * Tim Copperfield <timecop@network.email.ne.jp> + * Christian Dywan <christian@twotoasts.de> * - */ + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ #ifndef CursorGtk_h #define CursorGtk_h @@ -191,31 +208,176 @@ static const char moz_zoom_out_mask_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +/* MOZ_CURSOR_NOT_ALLOWED */ +static const char moz_not_allowed_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x80, 0x1f, 0x00, 0x00, 0xe0, 0x7f, 0x00, 0x00, + 0xf0, 0xf0, 0x00, 0x00, 0x38, 0xc0, 0x01, 0x00, 0x7c, 0x80, 0x03, 0x00, + 0xec, 0x00, 0x03, 0x00, 0xce, 0x01, 0x07, 0x00, 0x86, 0x03, 0x06, 0x00, + 0x06, 0x07, 0x06, 0x00, 0x06, 0x0e, 0x06, 0x00, 0x06, 0x1c, 0x06, 0x00, + 0x0e, 0x38, 0x07, 0x00, 0x0c, 0x70, 0x03, 0x00, 0x1c, 0xe0, 0x03, 0x00, + 0x38, 0xc0, 0x01, 0x00, 0xf0, 0xf0, 0x00, 0x00, 0xe0, 0x7f, 0x00, 0x00, + 0x80, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +static const char moz_not_allowed_mask_bits[] = { + 0x80, 0x1f, 0x00, 0x00, 0xe0, 0x7f, 0x00, 0x00, 0xf0, 0xff, 0x00, 0x00, + 0xf8, 0xff, 0x01, 0x00, 0xfc, 0xf0, 0x03, 0x00, 0xfe, 0xc0, 0x07, 0x00, + 0xfe, 0x81, 0x07, 0x00, 0xff, 0x83, 0x0f, 0x00, 0xcf, 0x07, 0x0f, 0x00, + 0x8f, 0x0f, 0x0f, 0x00, 0x0f, 0x1f, 0x0f, 0x00, 0x0f, 0x3e, 0x0f, 0x00, + 0x1f, 0xfc, 0x0f, 0x00, 0x1e, 0xf8, 0x07, 0x00, 0x3e, 0xf0, 0x07, 0x00, + 0xfc, 0xf0, 0x03, 0x00, 0xf8, 0xff, 0x01, 0x00, 0xf0, 0xff, 0x00, 0x00, + 0xe0, 0x7f, 0x00, 0x00, 0x80, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +/* MOZ_CURSOR_SPINNING */ +static const char moz_spinning_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x0c, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, + 0x7c, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, + 0xfc, 0x3b, 0x00, 0x00, 0x7c, 0x38, 0x00, 0x00, 0x6c, 0x54, 0x00, 0x00, + 0xc4, 0xdc, 0x00, 0x00, 0xc0, 0x44, 0x00, 0x00, 0x80, 0x39, 0x00, 0x00, + 0x80, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +static const char moz_spinning_mask_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, + 0x1e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, + 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00, 0xfe, 0x3b, 0x00, 0x00, + 0xfe, 0x7f, 0x00, 0x00, 0xfe, 0x7f, 0x00, 0x00, 0xfe, 0xfe, 0x00, 0x00, + 0xee, 0xff, 0x01, 0x00, 0xe4, 0xff, 0x00, 0x00, 0xc0, 0x7f, 0x00, 0x00, + 0xc0, 0x7f, 0x00, 0x00, 0x80, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +/* MOZ_CURSOR_NONE */ +static const char moz_none_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +static const char moz_none_mask_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +/* MOZ_CURSOR_HAND_GRAB */ +static const char moz_hand_grab_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, + 0x60, 0x39, 0x00, 0x00, 0x90, 0x49, 0x00, 0x00, 0x90, 0x49, 0x01, 0x00, + 0x20, 0xc9, 0x02, 0x00, 0x20, 0x49, 0x02, 0x00, 0x58, 0x40, 0x02, 0x00, + 0x64, 0x00, 0x02, 0x00, 0x44, 0x00, 0x01, 0x00, 0x08, 0x00, 0x01, 0x00, + 0x10, 0x00, 0x01, 0x00, 0x10, 0x80, 0x00, 0x00, 0x20, 0x80, 0x00, 0x00, + 0x40, 0x40, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +static const char moz_hand_grab_mask_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x60, 0x3f, 0x00, 0x00, + 0xf0, 0x7f, 0x00, 0x00, 0xf8, 0xff, 0x01, 0x00, 0xf8, 0xff, 0x03, 0x00, + 0xf0, 0xff, 0x07, 0x00, 0xf8, 0xff, 0x07, 0x00, 0xfc, 0xff, 0x07, 0x00, + 0xfe, 0xff, 0x07, 0x00, 0xfe, 0xff, 0x03, 0x00, 0xfc, 0xff, 0x03, 0x00, + 0xf8, 0xff, 0x03, 0x00, 0xf8, 0xff, 0x01, 0x00, 0xf0, 0xff, 0x01, 0x00, + 0xe0, 0xff, 0x00, 0x00, 0xc0, 0xff, 0x00, 0x00, 0xc0, 0xff, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +/* MOZ_CURSOR_HAND_GRABBING */ +static const char moz_hand_grabbing_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xc0, 0x36, 0x00, 0x00, 0x20, 0xc9, 0x00, 0x00, 0x20, 0x40, 0x01, 0x00, + 0x40, 0x00, 0x01, 0x00, 0x60, 0x00, 0x01, 0x00, 0x10, 0x00, 0x01, 0x00, + 0x10, 0x00, 0x01, 0x00, 0x10, 0x80, 0x00, 0x00, 0x20, 0x80, 0x00, 0x00, + 0x40, 0x40, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +static const char moz_hand_grabbing_mask_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x36, 0x00, 0x00, + 0xe0, 0xff, 0x00, 0x00, 0xf0, 0xff, 0x01, 0x00, 0xf0, 0xff, 0x03, 0x00, + 0xe0, 0xff, 0x03, 0x00, 0xf0, 0xff, 0x03, 0x00, 0xf8, 0xff, 0x03, 0x00, + 0xf8, 0xff, 0x03, 0x00, 0xf8, 0xff, 0x01, 0x00, 0xf0, 0xff, 0x01, 0x00, + 0xe0, 0xff, 0x00, 0x00, 0xc0, 0xff, 0x00, 0x00, 0xc0, 0x7f, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + enum CustomCursorType { - CustomCursorCopy = 0, - CustomCursorAlias, - CustomCursorContextMenu, - CustomCursorZoomIn, - CustomCursorZoomOut, - CustomCursorVerticalText -} ; + CustomCursorCopy = 0, + CustomCursorAlias, + CustomCursorContextMenu, + CustomCursorZoomIn, + CustomCursorZoomOut, + CustomCursorVerticalText, + CustomCursorNoDrop, + CustomCursorProgress, + CustomCursorNone, + CustomCursorGrab, + CustomCursorGrabbing, +}; typedef struct { - const char* name; - const char* bits; - const char* mask_bits; - int hot_x; - int hot_y; + const char* name; + const char* bits; + const char* mask_bits; + int hot_x; + int hot_y; } CustomCursor; // create custom pixmap cursor from cursors in nsGTKCursorData.h static const CustomCursor CustomCursors[] = { - { "copy", moz_copy_bits, moz_copy_mask_bits, 2, 2 }, - { "alias", moz_alias_bits, moz_alias_mask_bits, 2, 2 }, - { "context-menu", moz_menu_bits, moz_menu_mask_bits, 2, 2 }, - { "zoom-in", moz_zoom_in_bits, moz_zoom_in_mask_bits, 6, 6 }, - { "zoom-out", moz_zoom_out_bits, moz_zoom_out_mask_bits, 6, 6 }, - { "vertical-text", moz_vertical_text_bits, moz_vertical_text_mask_bits, 8, 4 }, + { "copy", moz_copy_bits, moz_copy_mask_bits, 2, 2 }, + { "alias", moz_alias_bits, moz_alias_mask_bits, 2, 2 }, + { "context-menu", moz_menu_bits, moz_menu_mask_bits, 2, 2 }, + { "zoom-in", moz_zoom_in_bits, moz_zoom_in_mask_bits, 6, 6 }, + { "zoom-out", moz_zoom_out_bits, moz_zoom_out_mask_bits, 6, 6 }, + { "vertical-text", moz_vertical_text_bits, moz_vertical_text_mask_bits, 8, 4 }, + { "dnd-no-drop", moz_not_allowed_bits, moz_not_allowed_mask_bits, 9, 9 }, + { "progress", moz_spinning_bits, moz_spinning_mask_bits, 2, 2}, + { "none", moz_none_bits, moz_none_mask_bits, 0, 0 }, + { "grab", moz_hand_grab_bits, moz_hand_grab_mask_bits, 10, 10 }, + { "grabbing", moz_hand_grabbing_bits, moz_hand_grabbing_mask_bits, 10, 10 } }; #endif // CursorGtk_h diff --git a/WebCore/platform/gtk/FileChooserGtk.cpp b/WebCore/platform/gtk/FileChooserGtk.cpp index e984718..a25d88b 100644 --- a/WebCore/platform/gtk/FileChooserGtk.cpp +++ b/WebCore/platform/gtk/FileChooserGtk.cpp @@ -34,7 +34,6 @@ #include "StringTruncator.h" #include <glib.h> -#include <glib/gi18n.h> #include <gtk/gtk.h> namespace WebCore { diff --git a/WebCore/platform/gtk/FileSystemGtk.cpp b/WebCore/platform/gtk/FileSystemGtk.cpp index 94e06db..fcdc863 100644 --- a/WebCore/platform/gtk/FileSystemGtk.cpp +++ b/WebCore/platform/gtk/FileSystemGtk.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007 Holger Hans Peter Freyther + * Copyright (C) 2007, 2009 Holger Hans Peter Freyther * Copyright (C) 2008 Collabora, Ltd. * Copyright (C) 2008 Apple Inc. All rights reserved. * @@ -22,8 +22,7 @@ #include "config.h" #include "FileSystem.h" -#include "guriescape.h" -#include "NotImplemented.h" +#include "GOwnPtr.h" #include "PlatformString.h" #include "CString.h" @@ -180,6 +179,9 @@ String homeDirectoryPath() String pathGetFileName(const String& pathName) { + if (pathName.isEmpty()) + return pathName; + char* tmpFilename = filenameFromString(pathName); char* baseName = g_path_get_basename(tmpFilename); String fileName = String::fromUTF8(baseName); @@ -191,8 +193,10 @@ String pathGetFileName(const String& pathName) String directoryName(const String& path) { - notImplemented(); - return String(); + /* No null checking needed */ + GOwnPtr<char> tmpFilename(filenameFromString(path)); + GOwnPtr<char> dirname(g_path_get_dirname(tmpFilename.get())); + return String::fromUTF8(dirname.get()); } Vector<String> listDirectory(const String& path, const String& filter) diff --git a/WebCore/platform/gtk/GeolocationServiceGtk.cpp b/WebCore/platform/gtk/GeolocationServiceGtk.cpp index cc69d44..fc15833 100644 --- a/WebCore/platform/gtk/GeolocationServiceGtk.cpp +++ b/WebCore/platform/gtk/GeolocationServiceGtk.cpp @@ -181,8 +181,8 @@ void GeolocationServiceGtk::updatePosition() m_lastError = 0; RefPtr<Coordinates> coordinates = Coordinates::create(m_latitude, m_longitude, - m_altitude, m_accuracy, - m_altitudeAccuracy, 0.0, 0.0); + true, m_altitude, m_accuracy, + true, m_altitudeAccuracy, false, 0.0, false, 0.0); m_lastPosition = Geoposition::create(coordinates.release(), m_timestamp * 1000.0); positionChanged(); } diff --git a/WebCore/platform/gtk/GtkPluginWidget.cpp b/WebCore/platform/gtk/GtkPluginWidget.cpp new file mode 100644 index 0000000..bc2dd92 --- /dev/null +++ b/WebCore/platform/gtk/GtkPluginWidget.cpp @@ -0,0 +1,105 @@ +/* + * Copyright (C) 2009 Holger Hans Peter Freyther + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "GtkPluginWidget.h" + +#include "GraphicsContext.h" +#include "ScrollView.h" + +#include <gtk/gtk.h> + +namespace WebCore { + +GtkPluginWidget::GtkPluginWidget(GtkWidget* widget) + : Widget(widget) +{ + gtk_widget_hide(widget); +} + +void GtkPluginWidget::invalidateRect(const IntRect& _rect) +{ + /* no need to */ + if (GTK_WIDGET_NO_WINDOW(platformWidget())) + return; + + GdkWindow* window = platformWidget()->window; + if (!window) + return; + + GdkRectangle rect = _rect; + gdk_window_invalidate_rect(window, &rect, FALSE); +} + +void GtkPluginWidget::frameRectsChanged() +{ + IntRect rect = frameRect(); + IntPoint loc = parent()->contentsToWindow(rect.location()); + GtkAllocation allocation = { loc.x(), loc.y(), rect.width(), rect.height() }; + + gtk_widget_set_size_request(platformWidget(), rect.width(), rect.height()); + gtk_widget_size_allocate(platformWidget(), &allocation); + gtk_widget_show(platformWidget()); +} + +void GtkPluginWidget::paint(GraphicsContext* context, const IntRect& rect) +{ + if (!context->gdkExposeEvent()) + return; + + /* only paint widgets with NO_WINDOW this way */ + if (!GTK_WIDGET_NO_WINDOW(platformWidget())) + return; + + GtkWidget* widget = platformWidget(); + ASSERT(GTK_WIDGET_NO_WINDOW(widget)); + + GdkEvent* event = gdk_event_new(GDK_EXPOSE); + event->expose = *context->gdkExposeEvent(); + event->expose.area = static_cast<GdkRectangle>(rect); + + IntPoint loc = parent()->contentsToWindow(rect.location()); + + event->expose.area.x = loc.x(); + event->expose.area.y = loc.y(); + + event->expose.region = gdk_region_rectangle(&event->expose.area); + + /* + * This will be unref'ed by gdk_event_free. + */ + g_object_ref(event->expose.window); + + /* + * If we are going to paint do the translation and GtkAllocation manipulation. + */ + if (!gdk_region_empty(event->expose.region)) + gtk_widget_send_expose(widget, event); + + gdk_event_free(event); +} + +} diff --git a/WebCore/platform/gtk/GtkPluginWidget.h b/WebCore/platform/gtk/GtkPluginWidget.h new file mode 100644 index 0000000..cad3462 --- /dev/null +++ b/WebCore/platform/gtk/GtkPluginWidget.h @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2009 Holger Hans Peter Freyther + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef GtkPluginWidget_h +#define GtkPluginWidget_h + +#include "Widget.h" + +namespace WebCore { + class GtkPluginWidget : public Widget { + public: + GtkPluginWidget(GtkWidget*); + void invalidateRect(const IntRect&); + void frameRectsChanged(); + void paint(GraphicsContext*, const IntRect&); + }; +} + +#endif diff --git a/WebCore/platform/gtk/KeyEventGtk.cpp b/WebCore/platform/gtk/KeyEventGtk.cpp index e0742f4..5875547 100644 --- a/WebCore/platform/gtk/KeyEventGtk.cpp +++ b/WebCore/platform/gtk/KeyEventGtk.cpp @@ -37,9 +37,6 @@ #include <gdk/gdk.h> #include <gdk/gdkkeysyms.h> -// GTK_CHECK_VERSION is defined in gtk/gtkversion.h -#include <gtk/gtk.h> - namespace WebCore { // FIXME: This is incomplete. We should change this to mirror @@ -260,9 +257,10 @@ static int windowsKeyCodeForKeyEvent(unsigned int keycode) case GDK_Help: return VK_HELP; // (2F) HELP key case GDK_0: - case GDK_parenleft: + case GDK_parenright: return VK_0; // (30) 0) key case GDK_1: + case GDK_exclam: return VK_1; // (31) 1 ! key case GDK_2: case GDK_at: @@ -286,7 +284,7 @@ static int windowsKeyCodeForKeyEvent(unsigned int keycode) case GDK_asterisk: return VK_8; // (38) 8 key '*' case GDK_9: - case GDK_parenright: + case GDK_parenleft: return VK_9; // (39) 9 key '(' case GDK_a: case GDK_A: @@ -536,12 +534,7 @@ PlatformKeyboardEvent::PlatformKeyboardEvent(GdkEventKey* event) , m_shiftKey((event->state & GDK_SHIFT_MASK) || (event->keyval == GDK_3270_BackTab)) , m_ctrlKey(event->state & GDK_CONTROL_MASK) , m_altKey(event->state & GDK_MOD1_MASK) -#if GTK_CHECK_VERSION(2,10,0) , m_metaKey(event->state & GDK_META_MASK) -#else - // GDK_MOD2_MASK doesn't always mean meta so we can't use it - , m_metaKey(false) -#endif , m_gdkEventKey(event) { } diff --git a/WebCore/platform/gtk/KeyboardCodes.h b/WebCore/platform/gtk/KeyboardCodes.h deleted file mode 100644 index 3ad1243..0000000 --- a/WebCore/platform/gtk/KeyboardCodes.h +++ /dev/null @@ -1,543 +0,0 @@ -/* - * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef KeyboardCodes_h -#define KeyboardCodes_h - -namespace WebCore { - -// VK_LBUTTON (01) Left mouse button -// VK_RBUTTON (02) Right mouse button -// VK_CANCEL (03) Control-break processing -// VK_MBUTTON (04) Middle mouse button (three-button mouse) -// VK_XBUTTON1 (05) -// VK_XBUTTON2 (06) - -// VK_BACK (08) BACKSPACE key -const int VK_BACK = 0x08; - -// VK_TAB (09) TAB key -const int VK_TAB = 0x09; - -// VK_CLEAR (0C) CLEAR key -const int VK_CLEAR = 0x0C; - -// VK_RETURN (0D) -const int VK_RETURN = 0x0D; - -// VK_SHIFT (10) SHIFT key -const int VK_SHIFT = 0x10; - -// VK_CONTROL (11) CTRL key -const int VK_CONTROL = 0x11; - -// VK_MENU (12) ALT key -const int VK_MENU = 0x12; - -// VK_PAUSE (13) PAUSE key -const int VK_PAUSE = 0x13; - -// VK_CAPITAL (14) CAPS LOCK key -const int VK_CAPITAL = 0x14; - -// VK_KANA (15) Input Method Editor (IME) Kana mode -const int VK_KANA = 0x15; - -// VK_HANGUEL (15) IME Hanguel mode (maintained for compatibility; use VK_HANGUL) -// VK_HANGUL (15) IME Hangul mode -const int VK_HANGUL = 0x15; - -// VK_JUNJA (17) IME Junja mode -const int VK_JUNJA = 0x17; - -// VK_FINAL (18) IME final mode -const int VK_FINAL = 0x18; - -// VK_HANJA (19) IME Hanja mode -const int VK_HANJA = 0x19; - -// VK_KANJI (19) IME Kanji mode -const int VK_KANJI = 0x19; - -// VK_ESCAPE (1B) ESC key -const int VK_ESCAPE = 0x1B; - -// VK_CONVERT (1C) IME convert -const int VK_CONVERT = 0x1C; - -// VK_NONCONVERT (1D) IME nonconvert -const int VK_NONCONVERT = 0x1D; - -// VK_ACCEPT (1E) IME accept -const int VK_ACCEPT = 0x1E; - -// VK_MODECHANGE (1F) IME mode change request -const int VK_MODECHANGE = 0x1F; - -// VK_SPACE (20) SPACEBAR -const int VK_SPACE = 0x20; - -// VK_PRIOR (21) PAGE UP key -const int VK_PRIOR = 0x21; - -// VK_NEXT (22) PAGE DOWN key -const int VK_NEXT = 0x22; - -// VK_END (23) END key -const int VK_END = 0x23; - -// VK_HOME (24) HOME key -const int VK_HOME = 0x24; - -// VK_LEFT (25) LEFT ARROW key -const int VK_LEFT = 0x25; - -// VK_UP (26) UP ARROW key -const int VK_UP = 0x26; - -// VK_RIGHT (27) RIGHT ARROW key -const int VK_RIGHT = 0x27; - -// VK_DOWN (28) DOWN ARROW key -const int VK_DOWN = 0x28; - -// VK_SELECT (29) SELECT key -const int VK_SELECT = 0x29; - -// VK_PRINT (2A) PRINT key -const int VK_PRINT = 0x2A; - -// VK_EXECUTE (2B) EXECUTE key -const int VK_EXECUTE = 0x2B; - -// VK_SNAPSHOT (2C) PRINT SCREEN key -const int VK_SNAPSHOT = 0x2C; - -// VK_INSERT (2D) INS key -const int VK_INSERT = 0x2D; - -// VK_DELETE (2E) DEL key -const int VK_DELETE = 0x2E; - -// VK_HELP (2F) HELP key -const int VK_HELP = 0x2F; - -// (30) 0 key -const int VK_0 = 0x30; - -// (31) 1 key -const int VK_1 = 0x31; - -// (32) 2 key -const int VK_2 = 0x32; - -// (33) 3 key -const int VK_3 = 0x33; - -// (34) 4 key -const int VK_4 = 0x34; - -// (35) 5 key; - -const int VK_5 = 0x35; - -// (36) 6 key -const int VK_6 = 0x36; - -// (37) 7 key -const int VK_7 = 0x37; - -// (38) 8 key -const int VK_8 = 0x38; - -// (39) 9 key -const int VK_9 = 0x39; - -// (41) A key -const int VK_A = 0x41; - -// (42) B key -const int VK_B = 0x42; - -// (43) C key -const int VK_C = 0x43; - -// (44) D key -const int VK_D = 0x44; - -// (45) E key -const int VK_E = 0x45; - -// (46) F key -const int VK_F = 0x46; - -// (47) G key -const int VK_G = 0x47; - -// (48) H key -const int VK_H = 0x48; - -// (49) I key -const int VK_I = 0x49; - -// (4A) J key -const int VK_J = 0x4A; - -// (4B) K key -const int VK_K = 0x4B; - -// (4C) L key -const int VK_L = 0x4C; - -// (4D) M key -const int VK_M = 0x4D; - -// (4E) N key -const int VK_N = 0x4E; - -// (4F) O key -const int VK_O = 0x4F; - -// (50) P key -const int VK_P = 0x50; - -// (51) Q key -const int VK_Q = 0x51; - -// (52) R key -const int VK_R = 0x52; - -// (53) S key -const int VK_S = 0x53; - -// (54) T key -const int VK_T = 0x54; - -// (55) U key -const int VK_U = 0x55; - -// (56) V key -const int VK_V = 0x56; - -// (57) W key -const int VK_W = 0x57; - -// (58) X key -const int VK_X = 0x58; - -// (59) Y key -const int VK_Y = 0x59; - -// (5A) Z key -const int VK_Z = 0x5A; - -// VK_LWIN (5B) Left Windows key (Microsoft Natural keyboard) -const int VK_LWIN = 0x5B; - -// VK_RWIN (5C) Right Windows key (Natural keyboard) -const int VK_RWIN = 0x5C; - -// VK_APPS (5D) Applications key (Natural keyboard) -const int VK_APPS = 0x5D; - -// VK_SLEEP (5F) Computer Sleep key -const int VK_SLEEP = 0x5F; - -// VK_NUMPAD0 (60) Numeric keypad 0 key -const int VK_NUMPAD0 = 0x60; - -// VK_NUMPAD1 (61) Numeric keypad 1 key -const int VK_NUMPAD1 = 0x61; - -// VK_NUMPAD2 (62) Numeric keypad 2 key -const int VK_NUMPAD2 = 0x62; - -// VK_NUMPAD3 (63) Numeric keypad 3 key -const int VK_NUMPAD3 = 0x63; - -// VK_NUMPAD4 (64) Numeric keypad 4 key -const int VK_NUMPAD4 = 0x64; - -// VK_NUMPAD5 (65) Numeric keypad 5 key -const int VK_NUMPAD5 = 0x65; - -// VK_NUMPAD6 (66) Numeric keypad 6 key -const int VK_NUMPAD6 = 0x66; - -// VK_NUMPAD7 (67) Numeric keypad 7 key -const int VK_NUMPAD7 = 0x67; - -// VK_NUMPAD8 (68) Numeric keypad 8 key -const int VK_NUMPAD8 = 0x68; - -// VK_NUMPAD9 (69) Numeric keypad 9 key -const int VK_NUMPAD9 = 0x69; - -// VK_MULTIPLY (6A) Multiply key -const int VK_MULTIPLY = 0x6A; - -// VK_ADD (6B) Add key -const int VK_ADD = 0x6B; - -// VK_SEPARATOR (6C) Separator key -const int VK_SEPARATOR = 0x6C; - -// VK_SUBTRACT (6D) Subtract key -const int VK_SUBTRACT = 0x6D; - -// VK_DECIMAL (6E) Decimal key -const int VK_DECIMAL = 0x6E; - -// VK_DIVIDE (6F) Divide key -const int VK_DIVIDE = 0x6F; - -// VK_F1 (70) F1 key -const int VK_F1 = 0x70; - -// VK_F2 (71) F2 key -const int VK_F2 = 0x71; - -// VK_F3 (72) F3 key -const int VK_F3 = 0x72; - -// VK_F4 (73) F4 key -const int VK_F4 = 0x73; - -// VK_F5 (74) F5 key -const int VK_F5 = 0x74; - -// VK_F6 (75) F6 key -const int VK_F6 = 0x75; - -// VK_F7 (76) F7 key -const int VK_F7 = 0x76; - -// VK_F8 (77) F8 key -const int VK_F8 = 0x77; - -// VK_F9 (78) F9 key -const int VK_F9 = 0x78; - -// VK_F10 (79) F10 key -const int VK_F10 = 0x79; - -// VK_F11 (7A) F11 key -const int VK_F11 = 0x7A; - -// VK_F12 (7B) F12 key -const int VK_F12 = 0x7B; - -// VK_F13 (7C) F13 key -const int VK_F13 = 0x7C; - -// VK_F14 (7D) F14 key -const int VK_F14 = 0x7D; - -// VK_F15 (7E) F15 key -const int VK_F15 = 0x7E; - -// VK_F16 (7F) F16 key -const int VK_F16 = 0x7F; - -// VK_F17 (80H) F17 key -const int VK_F17 = 0x80; - -// VK_F18 (81H) F18 key -const int VK_F18 = 0x81; - -// VK_F19 (82H) F19 key -const int VK_F19 = 0x82; - -// VK_F20 (83H) F20 key -const int VK_F20 = 0x83; - -// VK_F21 (84H) F21 key -const int VK_F21 = 0x84; - -// VK_F22 (85H) F22 key -const int VK_F22 = 0x85; - -// VK_F23 (86H) F23 key -const int VK_F23 = 0x86; - -// VK_F24 (87H) F24 key -const int VK_F24 = 0x87; - -// VK_NUMLOCK (90) NUM LOCK key -const int VK_NUMLOCK = 0x90; - -// VK_SCROLL (91) SCROLL LOCK key -const int VK_SCROLL = 0x91; - -// VK_LSHIFT (A0) Left SHIFT key -const int VK_LSHIFT = 0xA0; - -// VK_RSHIFT (A1) Right SHIFT key -const int VK_RSHIFT = 0xA1; - -// VK_LCONTROL (A2) Left CONTROL key -const int VK_LCONTROL = 0xA2; - -// VK_RCONTROL (A3) Right CONTROL key -const int VK_RCONTROL = 0xA3; - -// VK_LMENU (A4) Left MENU key -const int VK_LMENU = 0xA4; - -// VK_RMENU (A5) Right MENU key -const int VK_RMENU = 0xA5; - -// VK_BROWSER_BACK (A6) Windows 2000/XP: Browser Back key -const int VK_BROWSER_BACK = 0xA6; - -// VK_BROWSER_FORWARD (A7) Windows 2000/XP: Browser Forward key -const int VK_BROWSER_FORWARD = 0xA7; - -// VK_BROWSER_REFRESH (A8) Windows 2000/XP: Browser Refresh key -const int VK_BROWSER_REFRESH = 0xA8; - -// VK_BROWSER_STOP (A9) Windows 2000/XP: Browser Stop key -const int VK_BROWSER_STOP = 0xA9; - -// VK_BROWSER_SEARCH (AA) Windows 2000/XP: Browser Search key -const int VK_BROWSER_SEARCH = 0xAA; - -// VK_BROWSER_FAVORITES (AB) Windows 2000/XP: Browser Favorites key -const int VK_BROWSER_FAVORITES = 0xAB; - -// VK_BROWSER_HOME (AC) Windows 2000/XP: Browser Start and Home key -const int VK_BROWSER_HOME = 0xAC; - -// VK_VOLUME_MUTE (AD) Windows 2000/XP: Volume Mute key -const int VK_VOLUME_MUTE = 0xAD; - -// VK_VOLUME_DOWN (AE) Windows 2000/XP: Volume Down key -const int VK_VOLUME_DOWN = 0xAE; - -// VK_VOLUME_UP (AF) Windows 2000/XP: Volume Up key -const int VK_VOLUME_UP = 0xAF; - -// VK_MEDIA_NEXT_TRACK (B0) Windows 2000/XP: Next Track key -const int VK_MEDIA_NEXT_TRACK = 0xB0; - -// VK_MEDIA_PREV_TRACK (B1) Windows 2000/XP: Previous Track key -const int VK_MEDIA_PREV_TRACK = 0xB1; - -// VK_MEDIA_STOP (B2) Windows 2000/XP: Stop Media key -const int VK_MEDIA_STOP = 0xB2; - -// VK_MEDIA_PLAY_PAUSE (B3) Windows 2000/XP: Play/Pause Media key -const int VK_MEDIA_PLAY_PAUSE = 0xB3; - -// VK_LAUNCH_MAIL (B4) Windows 2000/XP: Start Mail key -const int VK_MEDIA_LAUNCH_MAIL = 0xB4; - -// VK_LAUNCH_MEDIA_SELECT (B5) Windows 2000/XP: Select Media key -const int VK_MEDIA_LAUNCH_MEDIA_SELECT = 0xB5; - -// VK_LAUNCH_APP1 (B6) Windows 2000/XP: Start Application 1 key -const int VK_MEDIA_LAUNCH_APP1 = 0xB6; - -// VK_LAUNCH_APP2 (B7) Windows 2000/XP: Start Application 2 key -const int VK_MEDIA_LAUNCH_APP2 = 0xB7; - -// VK_OEM_1 (BA) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ';:' key -const int VK_OEM_1 = 0xBA; - -// VK_OEM_PLUS (BB) Windows 2000/XP: For any country/region, the '+' key -const int VK_OEM_PLUS = 0xBB; - -// VK_OEM_COMMA (BC) Windows 2000/XP: For any country/region, the ',' key -const int VK_OEM_COMMA = 0xBC; - -// VK_OEM_MINUS (BD) Windows 2000/XP: For any country/region, the '-' key -const int VK_OEM_MINUS = 0xBD; - -// VK_OEM_PERIOD (BE) Windows 2000/XP: For any country/region, the '.' key -const int VK_OEM_PERIOD = 0xBE; - -// VK_OEM_2 (BF) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '/?' key -const int VK_OEM_2 = 0xBF; - -// VK_OEM_3 (C0) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '`~' key -const int VK_OEM_3 = 0xC0; - -// VK_OEM_4 (DB) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '[{' key -const int VK_OEM_4 = 0xDB; - -// VK_OEM_5 (DC) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '\|' key -const int VK_OEM_5 = 0xDC; - -// VK_OEM_6 (DD) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ']}' key -const int VK_OEM_6 = 0xDD; - -// VK_OEM_7 (DE) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the 'single-quote/double-quote' key -const int VK_OEM_7 = 0xDE; - -// VK_OEM_8 (DF) Used for miscellaneous characters; it can vary by keyboard. -const int VK_OEM_8 = 0xDF; - -// VK_OEM_102 (E2) Windows 2000/XP: Either the angle bracket key or the backslash key on the RT 102-key keyboard -const int VK_OEM_102 = 0xE2; - -// VK_PROCESSKEY (E5) Windows 95/98/Me, Windows NT 4.0, Windows 2000/XP: IME PROCESS key -const int VK_PROCESSKEY = 0xE5; - -// VK_PACKET (E7) Windows 2000/XP: Used to pass Unicode characters as if they were keystrokes. The VK_PACKET key is the low word of a 32-bit Virtual Key value used for non-keyboard input methods. For more information, see Remark in KEYBDINPUT,SendInput, WM_KEYDOWN, and WM_KEYUP -const int VK_PACKET = 0xE7; - -// VK_ATTN (F6) Attn key -const int VK_ATTN = 0xF6; - -// VK_CRSEL (F7) CrSel key -const int VK_CRSEL = 0xF7; - -// VK_EXSEL (F8) ExSel key -const int VK_EXSEL = 0xF8; - -// VK_EREOF (F9) Erase EOF key -const int VK_EREOF = 0xF9; - -// VK_PLAY (FA) Play key -const int VK_PLAY = 0xFA; - -// VK_ZOOM (FB) Zoom key -const int VK_ZOOM = 0xFB; - -// VK_NONAME (FC) Reserved for future use -const int VK_NONAME = 0xFC; - -// VK_PA1 (FD) PA1 key -const int VK_PA1 = 0xFD; - -// VK_OEM_CLEAR (FE) Clear key -const int VK_OEM_CLEAR = 0xFE; - -const int VK_UNKNOWN = 0; - -} - -#endif diff --git a/WebCore/platform/gtk/LocalizedStringsGtk.cpp b/WebCore/platform/gtk/LocalizedStringsGtk.cpp index 52d4f5f..70e3aff 100644 --- a/WebCore/platform/gtk/LocalizedStringsGtk.cpp +++ b/WebCore/platform/gtk/LocalizedStringsGtk.cpp @@ -30,11 +30,14 @@ #include "config.h" #include "LocalizedStrings.h" +#include "CString.h" +#include "GOwnPtr.h" +#include "IntSize.h" #include "NotImplemented.h" #include "PlatformString.h" +#include <glib/gi18n-lib.h> #include <gtk/gtk.h> -#include <glib/gi18n.h> namespace WebCore { @@ -125,11 +128,7 @@ String contextMenuItemTagDelete() String contextMenuItemTagSelectAll() { -#if GTK_CHECK_VERSION(2,10,0) static String stockLabel = String::fromUTF8(gtkStockLabel(GTK_STOCK_SELECT_ALL)); -#else - static String stockLabel = String::fromUTF8(_("Select _All")); -#endif return stockLabel; } @@ -339,8 +338,11 @@ String unknownFileSizeText() String imageTitle(const String& filename, const IntSize& size) { - notImplemented(); - return String(); + GOwnPtr<gchar> string(g_strdup_printf(C_("Title string for images", "%s (%dx%d pixels)"), + filename.utf8().data(), + size.width(), size.height())); + + return String::fromUTF8(string.get()); } } diff --git a/WebCore/platform/gtk/MouseEventGtk.cpp b/WebCore/platform/gtk/MouseEventGtk.cpp index 2400ebf..69f938f 100644 --- a/WebCore/platform/gtk/MouseEventGtk.cpp +++ b/WebCore/platform/gtk/MouseEventGtk.cpp @@ -31,9 +31,6 @@ #include <gdk/gdk.h> -// GTK_CHECK_VERSION is defined in gtk/gtkversion.h -#include <gtk/gtk.h> - namespace WebCore { // FIXME: Would be even better to figure out which modifier is Alt instead of always using GDK_MOD1_MASK. @@ -47,12 +44,7 @@ PlatformMouseEvent::PlatformMouseEvent(GdkEventButton* event) m_shiftKey = event->state & GDK_SHIFT_MASK; m_ctrlKey = event->state & GDK_CONTROL_MASK; m_altKey = event->state & GDK_MOD1_MASK; -#if GTK_CHECK_VERSION(2,10,0) m_metaKey = event->state & GDK_META_MASK; -#else - // GDK_MOD2_MASK doesn't always mean meta so we can't use it - m_metaKey = false; -#endif switch (event->type) { case GDK_BUTTON_PRESS: diff --git a/WebCore/platform/gtk/PasteboardGtk.cpp b/WebCore/platform/gtk/PasteboardGtk.cpp index 15a7e64..062ecb8 100644 --- a/WebCore/platform/gtk/PasteboardGtk.cpp +++ b/WebCore/platform/gtk/PasteboardGtk.cpp @@ -103,7 +103,6 @@ void Pasteboard::setHelper(PasteboardHelper* helper) void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete, Frame* frame) { GtkClipboard* clipboard = m_helper->getClipboard(frame); -#if GTK_CHECK_VERSION(2,10,0) gchar* text = g_strdup(frame->selectedText().utf8().data()); gchar* markup = g_strdup(createMarkup(selectedRange, 0, AnnotateForInterchange).utf8().data()); PasteboardSelectionData* data = new PasteboardSelectionData(text, markup); @@ -113,9 +112,6 @@ void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete, gtk_clipboard_set_with_data(clipboard, targets, n_targets, clipboard_get_contents_cb, clipboard_clear_contents_cb, data); gtk_target_table_free(targets, n_targets); -#else - gtk_clipboard_set_text(clipboard, frame->selectedText().utf8().data(), frame->selectedText().utf8().length()); -#endif } void Pasteboard::writeURL(const KURL& url, const String&, Frame* frame) @@ -124,14 +120,13 @@ void Pasteboard::writeURL(const KURL& url, const String&, Frame* frame) return; GtkClipboard* clipboard = m_helper->getClipboard(frame); + GtkClipboard* primary = m_helper->getPrimary(frame); gtk_clipboard_set_text(clipboard, url.string().utf8().data(), url.string().utf8().length()); + gtk_clipboard_set_text(primary, url.string().utf8().data(), url.string().utf8().length()); } void Pasteboard::writeImage(Node* node, const KURL&, const String&) { - // TODO: Enable this when Image gets GdkPixbuf support - - /* GtkClipboard* clipboard = gtk_clipboard_get_for_display(gdk_display_get_default(), GDK_SELECTION_CLIPBOARD); ASSERT(node && node->renderer() && node->renderer()->isImage()); @@ -141,10 +136,9 @@ void Pasteboard::writeImage(Node* node, const KURL&, const String&) Image* image = cachedImage->image(); ASSERT(image); - gtk_clipboard_set_image(clipboard, image->pixbuf()); - */ - - notImplemented(); + GdkPixbuf* pixbuf = image->getGdkPixbuf(); + gtk_clipboard_set_image(clipboard, pixbuf); + g_object_unref(pixbuf); } void Pasteboard::clear() @@ -163,12 +157,8 @@ bool Pasteboard::canSmartReplace() PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame* frame, PassRefPtr<Range> context, bool allowPlainText, bool& chosePlainText) { -#if GTK_CHECK_VERSION(2,10,0) GdkAtom textHtml = gdk_atom_intern_static_string("text/html"); -#else - GdkAtom textHtml = gdk_atom_intern("text/html", false); -#endif - GtkClipboard* clipboard = m_helper->getClipboard(frame); + GtkClipboard* clipboard = m_helper->getCurrentTarget(frame); chosePlainText = false; if (GtkSelectionData* data = gtk_clipboard_wait_for_contents(clipboard, textHtml)) { @@ -201,7 +191,7 @@ PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame* frame, PassRefP String Pasteboard::plainText(Frame* frame) { - GtkClipboard* clipboard = m_helper->getClipboard(frame); + GtkClipboard* clipboard = m_helper->getCurrentTarget(frame); gchar* utf8 = gtk_clipboard_wait_for_text(clipboard); diff --git a/WebCore/platform/gtk/PasteboardHelper.h b/WebCore/platform/gtk/PasteboardHelper.h index 6bdc05e..9943a2d 100644 --- a/WebCore/platform/gtk/PasteboardHelper.h +++ b/WebCore/platform/gtk/PasteboardHelper.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2007 Luca Bruno <lethalman88@gmail.com> + * Copyright (C) 2009 Holger Hans Peter Freyther * All rights reserved. * * This library is free software; you can redistribute it and/or @@ -37,7 +38,9 @@ class PasteboardHelper { public: virtual ~PasteboardHelper() {}; + virtual GtkClipboard* getCurrentTarget(Frame*) const = 0; virtual GtkClipboard* getClipboard(Frame*) const = 0; + virtual GtkClipboard* getPrimary(Frame*) const = 0; virtual GtkTargetList* getCopyTargetList(Frame*) const = 0; virtual GtkTargetList* getPasteTargetList(Frame*) const = 0; }; diff --git a/WebCore/platform/gtk/PlatformScreenGtk.cpp b/WebCore/platform/gtk/PlatformScreenGtk.cpp index 3512be1..27985ef 100644 --- a/WebCore/platform/gtk/PlatformScreenGtk.cpp +++ b/WebCore/platform/gtk/PlatformScreenGtk.cpp @@ -31,7 +31,6 @@ #include "PlatformScreen.h" #include "HostWindow.h" -#include "NotImplemented.h" #include "ScrollView.h" #include "Widget.h" diff --git a/WebCore/platform/gtk/PopupMenuGtk.cpp b/WebCore/platform/gtk/PopupMenuGtk.cpp index 54b41ab..121d7b0 100644 --- a/WebCore/platform/gtk/PopupMenuGtk.cpp +++ b/WebCore/platform/gtk/PopupMenuGtk.cpp @@ -28,7 +28,6 @@ #include "CString.h" #include "FrameView.h" #include "HostWindow.h" -#include "NotImplemented.h" #include "PlatformString.h" #include <gtk/gtk.h> @@ -42,8 +41,11 @@ PopupMenu::PopupMenu(PopupMenuClient* client) PopupMenu::~PopupMenu() { - if (m_popup) + if (m_popup) { + g_signal_handlers_disconnect_matched(m_popup, G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, this); + hide(); g_object_unref(m_popup); + } } void PopupMenu::show(const IntRect& rect, FrameView* view, int index) diff --git a/WebCore/platform/gtk/RenderThemeGtk.cpp b/WebCore/platform/gtk/RenderThemeGtk.cpp index ee462e0..a95f557 100644 --- a/WebCore/platform/gtk/RenderThemeGtk.cpp +++ b/WebCore/platform/gtk/RenderThemeGtk.cpp @@ -54,6 +54,14 @@ RenderThemeGtk::RenderThemeGtk() } } +RenderThemeGtk::~RenderThemeGtk() +{ + if (mozGtkInitialized) { + moz_gtk_shutdown(); + mozGtkInitialized = false; + } +} + static bool supportsFocus(ControlPart appearance) { switch (appearance) { diff --git a/WebCore/platform/gtk/RenderThemeGtk.h b/WebCore/platform/gtk/RenderThemeGtk.h index 76f7a0a..82a87cb 100644 --- a/WebCore/platform/gtk/RenderThemeGtk.h +++ b/WebCore/platform/gtk/RenderThemeGtk.h @@ -36,6 +36,7 @@ namespace WebCore { class RenderThemeGtk : public RenderTheme { public: RenderThemeGtk(); + virtual ~RenderThemeGtk(); // A method asking if the theme's controls actually care about redrawing when hovered. virtual bool supportsHover(const RenderStyle* style) const { return true; } diff --git a/WebCore/platform/gtk/ScrollViewGtk.cpp b/WebCore/platform/gtk/ScrollViewGtk.cpp index b3b6dd9..0f066fc 100644 --- a/WebCore/platform/gtk/ScrollViewGtk.cpp +++ b/WebCore/platform/gtk/ScrollViewGtk.cpp @@ -1,7 +1,7 @@ /* * Copyright (C) 2006, 2007, 2008 Apple Computer, Inc. All rights reserved. * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com - * Copyright (C) 2007 Holger Hans Peter Freyther + * Copyright (C) 2007, 2009 Holger Hans Peter Freyther * Copyright (C) 2008 Collabora Ltd. * * All rights reserved. @@ -35,7 +35,6 @@ #include "GraphicsContext.h" #include "HostWindow.h" #include "IntRect.h" -#include "NotImplemented.h" #include "PlatformMouseEvent.h" #include "PlatformWheelEvent.h" #include "ScrollbarGtk.h" @@ -47,28 +46,6 @@ using namespace std; namespace WebCore { -static void adjustmentChanged(GtkAdjustment* adjustment, gpointer _that) -{ - ScrollView* that = reinterpret_cast<ScrollView*>(_that); - - // Figure out if we really moved. - IntSize newOffset = that->scrollOffset(); - if (adjustment == that->m_horizontalAdjustment) - newOffset.setWidth(static_cast<int>(gtk_adjustment_get_value(adjustment))); - else if (adjustment == that->m_verticalAdjustment) - newOffset.setHeight(static_cast<int>(gtk_adjustment_get_value(adjustment))); - - IntSize scrollDelta = newOffset - that->scrollOffset(); - if (scrollDelta == IntSize()) - return; - that->setScrollOffset(newOffset); - - if (that->scrollbarsSuppressed()) - return; - - that->scrollContents(scrollDelta); -} - void ScrollView::platformInit() { m_horizontalAdjustment = 0; @@ -77,15 +54,18 @@ void ScrollView::platformInit() void ScrollView::platformDestroy() { - if (m_horizontalAdjustment) { - g_signal_handlers_disconnect_by_func(G_OBJECT(m_horizontalAdjustment), (gpointer)adjustmentChanged, this); - g_object_unref(m_horizontalAdjustment); - } + m_horizontalAdjustment = 0; + m_verticalAdjustment = 0; +} - if (m_verticalAdjustment) { - g_signal_handlers_disconnect_by_func(G_OBJECT(m_verticalAdjustment), (gpointer)adjustmentChanged, this); - g_object_unref(m_verticalAdjustment); - } +PassRefPtr<Scrollbar> ScrollView::createScrollbar(ScrollbarOrientation orientation) +{ + if (orientation == HorizontalScrollbar && m_horizontalAdjustment) + return ScrollbarGtk::createScrollbar(this, orientation, m_horizontalAdjustment); + else if (orientation == VerticalScrollbar && m_verticalAdjustment) + return ScrollbarGtk::createScrollbar(this, orientation, m_verticalAdjustment); + else + return Scrollbar::createNativeScrollbar(this, orientation, RegularScrollbar); } /* @@ -96,30 +76,27 @@ void ScrollView::setGtkAdjustments(GtkAdjustment* hadj, GtkAdjustment* vadj) { ASSERT(!hadj == !vadj); - if (m_horizontalAdjustment) { - g_signal_handlers_disconnect_by_func(G_OBJECT(m_horizontalAdjustment), (gpointer)adjustmentChanged, this); - g_signal_handlers_disconnect_by_func(G_OBJECT(m_verticalAdjustment), (gpointer)adjustmentChanged, this); - g_object_unref(m_horizontalAdjustment); - g_object_unref(m_verticalAdjustment); - } - m_horizontalAdjustment = hadj; m_verticalAdjustment = vadj; + // Reset the adjustments to a sane default if (m_horizontalAdjustment) { - g_signal_connect(m_horizontalAdjustment, "value-changed", G_CALLBACK(adjustmentChanged), this); - g_signal_connect(m_verticalAdjustment, "value-changed", G_CALLBACK(adjustmentChanged), this); - - /* - * disable the scrollbars (if we have any) as the GtkAdjustment over - */ - setHasVerticalScrollbar(false); - setHasHorizontalScrollbar(false); + m_horizontalAdjustment->lower = 0; + m_horizontalAdjustment->upper = 0; + m_horizontalAdjustment->value = 0; + gtk_adjustment_changed(m_horizontalAdjustment); + gtk_adjustment_value_changed(m_horizontalAdjustment); - g_object_ref(m_horizontalAdjustment); - g_object_ref(m_verticalAdjustment); + m_verticalAdjustment->lower = 0; + m_verticalAdjustment->upper = 0; + m_verticalAdjustment->value = 0; + gtk_adjustment_changed(m_verticalAdjustment); + gtk_adjustment_value_changed(m_verticalAdjustment); } + /* reconsider having a scrollbar */ + setHasVerticalScrollbar(false); + setHasHorizontalScrollbar(false); updateScrollbars(m_scrollOffset); } @@ -144,52 +121,4 @@ void ScrollView::platformRemoveChild(Widget* child) gtk_container_remove(GTK_CONTAINER(parent), child->platformWidget()); } -bool ScrollView::platformHandleHorizontalAdjustment(const IntSize& scroll) -{ - if (m_horizontalAdjustment) { - m_horizontalAdjustment->page_size = visibleWidth(); - m_horizontalAdjustment->step_increment = visibleWidth() / 10.0; - m_horizontalAdjustment->page_increment = visibleWidth() * 0.9; - m_horizontalAdjustment->lower = 0; - m_horizontalAdjustment->upper = contentsWidth(); - gtk_adjustment_changed(m_horizontalAdjustment); - - if (m_horizontalAdjustment->value != scroll.width()) { - m_horizontalAdjustment->value = scroll.width(); - gtk_adjustment_value_changed(m_horizontalAdjustment); - } - return true; - } - return false; -} - -bool ScrollView::platformHandleVerticalAdjustment(const IntSize& scroll) -{ - if (m_verticalAdjustment) { - m_verticalAdjustment->page_size = visibleHeight(); - m_verticalAdjustment->step_increment = visibleHeight() / 10.0; - m_verticalAdjustment->page_increment = visibleHeight() * 0.9; - m_verticalAdjustment->lower = 0; - m_verticalAdjustment->upper = contentsHeight(); - gtk_adjustment_changed(m_verticalAdjustment); - - if (m_verticalAdjustment->value != scroll.height()) { - m_verticalAdjustment->value = scroll.height(); - gtk_adjustment_value_changed(m_verticalAdjustment); - } - return true; - } - return false; -} - -bool ScrollView::platformHasHorizontalAdjustment() const -{ - return m_horizontalAdjustment != 0; -} - -bool ScrollView::platformHasVerticalAdjustment() const -{ - return m_verticalAdjustment != 0; -} - } diff --git a/WebCore/platform/gtk/ScrollbarGtk.cpp b/WebCore/platform/gtk/ScrollbarGtk.cpp index 7543e23..d7f6d26 100644 --- a/WebCore/platform/gtk/ScrollbarGtk.cpp +++ b/WebCore/platform/gtk/ScrollbarGtk.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007 Holger Hans Peter Freyther zecke@selfish.org + * Copyright (C) 2007, 2009 Holger Hans Peter Freyther zecke@selfish.org * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -22,7 +22,6 @@ #include "IntRect.h" #include "GraphicsContext.h" #include "FrameView.h" -#include "NotImplemented.h" #include "ScrollbarTheme.h" #include "gtkdrawing.h" @@ -35,6 +34,11 @@ PassRefPtr<Scrollbar> Scrollbar::createNativeScrollbar(ScrollbarClient* client, return adoptRef(new ScrollbarGtk(client, orientation, size)); } +PassRefPtr<ScrollbarGtk> ScrollbarGtk::createScrollbar(ScrollbarClient* client, ScrollbarOrientation orientation, GtkAdjustment* adj) +{ + return adoptRef(new ScrollbarGtk(client, orientation, adj)); +} + static gboolean gtkScrollEventCallback(GtkWidget* widget, GdkEventScroll* event, ScrollbarGtk*) { /* Scroll only if our parent rejects the scroll event. The rationale for @@ -52,7 +56,8 @@ ScrollbarGtk::ScrollbarGtk(ScrollbarClient* client, ScrollbarOrientation orienta gtk_hscrollbar_new(m_adjustment): gtk_vscrollbar_new(m_adjustment); gtk_widget_show(scrollBar); - g_signal_connect(scrollBar, "value-changed", G_CALLBACK(ScrollbarGtk::gtkValueChanged), this); + g_object_ref(m_adjustment); + g_signal_connect(m_adjustment, "value-changed", G_CALLBACK(ScrollbarGtk::gtkValueChanged), this); g_signal_connect(scrollBar, "scroll-event", G_CALLBACK(gtkScrollEventCallback), this); setPlatformWidget(scrollBar); @@ -65,6 +70,37 @@ ScrollbarGtk::ScrollbarGtk(ScrollbarClient* client, ScrollbarOrientation orienta ScrollbarTheme::nativeTheme()->scrollbarThickness()); } +// Create a ScrollbarGtk on top of an existing GtkAdjustment but do not create a +// GtkScrollbar on top of this adjustment. The goal is to have a WebCore::Scrollbar +// that will manipulate the GtkAdjustment properties, will react to the changed +// value but will not consume any space on the screen and will not be painted +// at all. It is achieved by not calling setPlatformWidget. +ScrollbarGtk::ScrollbarGtk(ScrollbarClient* client, ScrollbarOrientation orientation, GtkAdjustment* adjustment) + : Scrollbar(client, orientation, RegularScrollbar) + , m_adjustment(adjustment) +{ + g_object_ref(m_adjustment); + g_signal_connect(m_adjustment, "value-changed", G_CALLBACK(ScrollbarGtk::gtkValueChanged), this); + + // We have nothing to show as we are solely operating on the GtkAdjustment + resize(0, 0); +} + +ScrollbarGtk::~ScrollbarGtk() +{ + g_signal_handlers_disconnect_by_func(G_OBJECT(m_adjustment), (gpointer)ScrollbarGtk::gtkValueChanged, this); + + // For the case where we only operate on the GtkAdjustment it is best to + // reset the values so that the surrounding scrollbar gets updated, or + // e.g. for a GtkScrolledWindow the scrollbar gets hidden. + m_adjustment->lower = 0; + m_adjustment->upper = 0; + m_adjustment->value = 0; + gtk_adjustment_changed(m_adjustment); + gtk_adjustment_value_changed(m_adjustment); + g_object_unref(m_adjustment); +} + IntPoint ScrollbarGtk::getLocationInParentWindow(const IntRect& rect) { IntPoint loc; @@ -79,7 +115,7 @@ IntPoint ScrollbarGtk::getLocationInParentWindow(const IntRect& rect) void ScrollbarGtk::frameRectsChanged() { - if (!parent()) + if (!parent() || !platformWidget()) return; IntPoint loc = getLocationInParentWindow(frameRect()); diff --git a/WebCore/platform/gtk/ScrollbarGtk.h b/WebCore/platform/gtk/ScrollbarGtk.h index 1ef4c49..b4b5989 100644 --- a/WebCore/platform/gtk/ScrollbarGtk.h +++ b/WebCore/platform/gtk/ScrollbarGtk.h @@ -36,6 +36,8 @@ namespace WebCore { class ScrollbarGtk : public Scrollbar { public: friend class Scrollbar; + friend class ScrollView; + ~ScrollbarGtk(); virtual void setFrameRect(const IntRect&); virtual void paint(GraphicsContext*, const IntRect&); @@ -50,7 +52,10 @@ public: virtual void frameRectsChanged(); protected: + static PassRefPtr<ScrollbarGtk> createScrollbar(ScrollbarClient* client, ScrollbarOrientation orientation, GtkAdjustment*); + ScrollbarGtk(ScrollbarClient*, ScrollbarOrientation, ScrollbarControlSize); + ScrollbarGtk(ScrollbarClient*, ScrollbarOrientation, GtkAdjustment*); virtual void updateThumbPosition(); virtual void updateThumbProportion(); diff --git a/WebCore/platform/gtk/TemporaryLinkStubs.cpp b/WebCore/platform/gtk/TemporaryLinkStubs.cpp index edabd10..8c12fcb 100644 --- a/WebCore/platform/gtk/TemporaryLinkStubs.cpp +++ b/WebCore/platform/gtk/TemporaryLinkStubs.cpp @@ -38,26 +38,10 @@ using namespace WebCore; -// This function loads resources from WebKit -// This does not belong here and I'm not sure where -// it should go -// I don't know what the plans or design is -// for none code resources -Vector<char> loadResourceIntoArray(const char* resourceName) -{ - Vector<char> resource; - //if (strcmp(resourceName,"missingImage") == 0) { - //} - return resource; -} - - /********************************************************/ /* Completely empty stubs (mostly to allow DRT to run): */ /********************************************************/ -void PluginView::invalidateRegion(NPRegion) { notImplemented(); } - namespace WebCore { void getSupportedKeySizes(Vector<String>&) { notImplemented(); } String signedPublicKeyAndChallengeString(unsigned keySizeIndex, const String &challengeString, const KURL &url) { return String(); } diff --git a/WebCore/platform/gtk/WheelEventGtk.cpp b/WebCore/platform/gtk/WheelEventGtk.cpp index 075bed2..404bf29 100644 --- a/WebCore/platform/gtk/WheelEventGtk.cpp +++ b/WebCore/platform/gtk/WheelEventGtk.cpp @@ -31,9 +31,6 @@ #include <gdk/gdk.h> -// GTK_CHECK_VERSION is defined in gtk/gtkversion.h -#include <gtk/gtk.h> - namespace WebCore { // Keep this in sync with the other platform event constructors @@ -69,12 +66,7 @@ PlatformWheelEvent::PlatformWheelEvent(GdkEventScroll* event) m_shiftKey = event->state & GDK_SHIFT_MASK; m_ctrlKey = event->state & GDK_CONTROL_MASK; m_altKey = event->state & GDK_MOD1_MASK; -#if GTK_CHECK_VERSION(2,10,0) m_metaKey = event->state & GDK_META_MASK; -#else - // GDK_MOD2_MASK doesn't always mean meta so we can't use it - m_metaKey = false; -#endif // FIXME: retrieve the user setting for the number of lines to scroll on each wheel event m_deltaX *= static_cast<float>(cScrollbarPixelsPerLineStep); diff --git a/WebCore/platform/gtk/WidgetGtk.cpp b/WebCore/platform/gtk/WidgetGtk.cpp index 4f09e77..007f2ee 100644 --- a/WebCore/platform/gtk/WidgetGtk.cpp +++ b/WebCore/platform/gtk/WidgetGtk.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com - * Copyright (C) 2007 Holger Hans Peter Freyther + * Copyright (C) 2007, 2009 Holger Hans Peter Freyther * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,7 +33,6 @@ #include "GraphicsContext.h" #include "HostWindow.h" #include "IntRect.h" -#include "NotImplemented.h" #include "RenderObject.h" #include <gdk/gdk.h> @@ -99,9 +98,19 @@ void Widget::paint(GraphicsContext* context, const IntRect& rect) { } -void Widget::setIsSelected(bool) +void Widget::setIsSelected(bool isSelected) { - notImplemented(); + if (!platformWidget()) + return; + + // See if the platformWidget has a webkit-widget-is-selected property + // and set it afterwards. + GParamSpec* spec = g_object_class_find_property(G_OBJECT_GET_CLASS(platformWidget()), + "webkit-widget-is-selected"); + if (!spec) + return; + + g_object_set(platformWidget(), "webkit-widget-is-selected", isSelected, NULL); } IntRect Widget::frameRect() const diff --git a/WebCore/platform/gtk/gtk2drawing.c b/WebCore/platform/gtk/gtk2drawing.c index dd46e74..1f62c96 100644 --- a/WebCore/platform/gtk/gtk2drawing.c +++ b/WebCore/platform/gtk/gtk2drawing.c @@ -49,6 +49,8 @@ #include <string.h> #include "gtkdrawing.h" +#include "Assertions.h" + #include <math.h> #define XTHICKNESS(style) (style->xthickness) @@ -56,6 +58,7 @@ #define WINDOW_IS_MAPPED(window) ((window) && GDK_IS_WINDOW(window) && gdk_window_is_visible(window)) static GtkWidget* gProtoWindow; +static GtkWidget* gProtoLayout; static GtkWidget* gButtonWidget; static GtkWidget* gToggleButtonWidget; static GtkWidget* gButtonArrowWidget; @@ -101,7 +104,6 @@ static GtkWidget* gScrolledWindowWidget; static style_prop_t style_prop_func; static gboolean have_arrow_scaling; -static gboolean have_2_10; static gboolean is_initialized; /* Because we have such an unconventional way of drawing widgets, signal to the GTK theme engine @@ -134,14 +136,13 @@ ensure_window_widget() static gint setup_widget_prototype(GtkWidget* widget) { - static GtkWidget* protoLayout; ensure_window_widget(); - if (!protoLayout) { - protoLayout = gtk_fixed_new(); - gtk_container_add(GTK_CONTAINER(gProtoWindow), protoLayout); + if (!gProtoLayout) { + gProtoLayout = gtk_fixed_new(); + gtk_container_add(GTK_CONTAINER(gProtoWindow), gProtoLayout); } - gtk_container_add(GTK_CONTAINER(protoLayout), widget); + gtk_container_add(GTK_CONTAINER(gProtoLayout), widget); gtk_widget_realize(widget); g_object_set_data(G_OBJECT(widget), "transparent-bg-hint", GINT_TO_POINTER(TRUE)); return MOZ_GTK_SUCCESS; @@ -409,8 +410,7 @@ moz_gtk_get_combo_box_entry_arrow(GtkWidget *widget, gpointer client_data) g_object_add_weak_pointer(G_OBJECT(widget), (gpointer) &gComboBoxEntryArrowWidget); gtk_widget_realize(widget); - g_object_set_data(G_OBJECT(widget), "transparent-bg-hint", - GINT_TO_POINTER(TRUE)); + g_object_set_data(G_OBJECT(widget), "transparent-bg-hint", GINT_TO_POINTER(TRUE)); } } @@ -502,8 +502,7 @@ ensure_toolbar_widget() gToolbarWidget = gtk_toolbar_new(); gtk_container_add(GTK_CONTAINER(gHandleBoxWidget), gToolbarWidget); gtk_widget_realize(gToolbarWidget); - g_object_set_data(G_OBJECT(gToolbarWidget), "transparent-bg-hint", - GINT_TO_POINTER(TRUE)); + g_object_set_data(G_OBJECT(gToolbarWidget), "transparent-bg-hint", GINT_TO_POINTER(TRUE)); } return MOZ_GTK_SUCCESS; } @@ -710,17 +709,17 @@ ensure_tree_header_cell_widget() gtk_tree_view_append_column(GTK_TREE_VIEW(gTreeViewWidget), firstTreeViewColumn); gMiddleTreeViewColumn = gtk_tree_view_column_new(); - gtk_tree_view_column_set_title(GTK_TREE_VIEW_COLUMN(gMiddleTreeViewColumn), "M"); + gtk_tree_view_column_set_title(gMiddleTreeViewColumn, "M"); gtk_tree_view_append_column(GTK_TREE_VIEW(gTreeViewWidget), - GTK_TREE_VIEW_COLUMN(gMiddleTreeViewColumn)); + gMiddleTreeViewColumn); lastTreeViewColumn = gtk_tree_view_column_new(); gtk_tree_view_column_set_title(lastTreeViewColumn, "M"); gtk_tree_view_append_column(GTK_TREE_VIEW(gTreeViewWidget), lastTreeViewColumn); /* Use the middle column's header for our button */ - gTreeHeaderCellWidget = GTK_TREE_VIEW_COLUMN(gMiddleTreeViewColumn)->button; - gTreeHeaderSortArrowWidget = GTK_TREE_VIEW_COLUMN(gMiddleTreeViewColumn)->arrow; + gTreeHeaderCellWidget = gMiddleTreeViewColumn->button; + gTreeHeaderSortArrowWidget = gMiddleTreeViewColumn->arrow; g_object_set_data(G_OBJECT(gTreeHeaderCellWidget), "transparent-bg-hint", GINT_TO_POINTER(TRUE)); g_object_set_data(G_OBJECT(gTreeHeaderSortArrowWidget), @@ -880,9 +879,6 @@ moz_gtk_init() have_arrow_scaling = (gtk_major_version > 2 || (gtk_major_version == 2 && gtk_minor_version >= 12)); - have_2_10 = (gtk_major_version > 2 || - (gtk_major_version == 2 && gtk_minor_version >= 10)); - /* Add style property to GtkEntry. * Adding the style property to the normal GtkEntry class means that it * will work without issues inside GtkComboBox and for Spinbuttons. */ @@ -953,10 +949,9 @@ gint moz_gtk_button_get_inner_border(GtkWidget* widget, GtkBorder* inner_border) { static const GtkBorder default_inner_border = { 1, 1, 1, 1 }; - GtkBorder *tmp_border = NULL; + GtkBorder *tmp_border; - if (have_2_10) - gtk_widget_style_get (widget, "inner-border", &tmp_border, NULL); + gtk_widget_style_get (widget, "inner-border", &tmp_border, NULL); if (tmp_border) { *inner_border = *tmp_border; @@ -971,8 +966,8 @@ moz_gtk_button_get_inner_border(GtkWidget* widget, GtkBorder* inner_border) static gint moz_gtk_toggle_paint(GdkDrawable* drawable, GdkRectangle* rect, GdkRectangle* cliprect, GtkWidgetState* state, - gboolean selected, gboolean isradio, - GtkTextDirection direction) + gboolean selected, gboolean inconsistent, + gboolean isradio, GtkTextDirection direction) { GtkStateType state_type = ConvertGtkState(state); GtkShadowType shadow_type = (selected)?GTK_SHADOW_IN:GTK_SHADOW_OUT; @@ -990,6 +985,12 @@ moz_gtk_toggle_paint(GdkDrawable* drawable, GdkRectangle* rect, w = gCheckboxWidget; } + // "GetMinimumWidgetSize was ignored" + // FIXME: This assert causes a build failure in WebKitGTK+ debug + // builds, because it uses 'false' in its definition. We may want + // to force this file to be built with g++, by renaming it. + // ASSERT(rect->width == indicator_size); + /* * vertically center in the box, since XUL sometimes ignores our * GetMinimumWidgetSize in the vertical dimension @@ -1022,6 +1023,17 @@ moz_gtk_toggle_paint(GdkDrawable* drawable, GdkRectangle* rect, } } else { + /* + * 'indeterminate' type on checkboxes. In GTK, the shadow type + * must also be changed for the state to be drawn. + */ + if (inconsistent) { + gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON(gCheckboxWidget), TRUE); + shadow_type = GTK_SHADOW_ETCHED_IN; + } else { + gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON(gCheckboxWidget), FALSE); + } + gtk_paint_check(style, drawable, state_type, shadow_type, cliprect, gCheckboxWidget, "checkbutton", x, y, width, height); if (state->focused) { @@ -1490,9 +1502,15 @@ static gint moz_gtk_caret_paint(GdkDrawable* drawable, GdkRectangle* rect, GdkRectangle* cliprect, GtkTextDirection direction) { + GdkRectangle location = *rect; + if (direction == GTK_TEXT_DIR_RTL) { + /* gtk_draw_insertion_cursor ignores location.width */ + location.x = rect->x + rect->width; + } + ensure_entry_widget(); gtk_draw_insertion_cursor(gEntryWidget, drawable, cliprect, - rect, TRUE, direction, FALSE); + &location, TRUE, direction, FALSE); return MOZ_GTK_SUCCESS; } @@ -1538,8 +1556,7 @@ moz_gtk_entry_paint(GdkDrawable* drawable, GdkRectangle* rect, * If the theme is able to cope with transparency, then we can skip pre-filling * and notify the theme it will paint directly on the canvas. */ if (theme_honors_transparency) { - g_object_set_data(G_OBJECT(widget), "transparent-bg-hint", - GINT_TO_POINTER(TRUE)); + g_object_set_data(G_OBJECT(widget), "transparent-bg-hint", GINT_TO_POINTER(TRUE)); } else { gdk_draw_rectangle(drawable, style->base_gc[bg_state], TRUE, cliprect->x, cliprect->y, cliprect->width, cliprect->height); @@ -1650,7 +1667,7 @@ moz_gtk_tree_header_cell_paint(GdkDrawable* drawable, GdkRectangle* rect, GdkRectangle* cliprect, GtkWidgetState* state, gboolean isSorted, GtkTextDirection direction) { - gtk_tree_view_column_set_sort_indicator(GTK_TREE_VIEW_COLUMN(gMiddleTreeViewColumn), + gtk_tree_view_column_set_sort_indicator(gMiddleTreeViewColumn, isSorted); moz_gtk_button_paint(drawable, rect, cliprect, state, GTK_RELIEF_NORMAL, @@ -1742,8 +1759,8 @@ moz_gtk_combo_box_paint(GdkDrawable* drawable, GdkRectangle* rect, gboolean ishtml, GtkTextDirection direction) { GdkRectangle arrow_rect, real_arrow_rect; - gint arrow_size, separator_width = 0; - gboolean wide_separators = FALSE; + gint arrow_size, separator_width; + gboolean wide_separators; GtkStateType state_type = ConvertGtkState(state); GtkShadowType shadow_type = state->active ? GTK_SHADOW_IN : GTK_SHADOW_OUT; GtkStyle* style; @@ -1786,11 +1803,10 @@ moz_gtk_combo_box_paint(GdkDrawable* drawable, GdkRectangle* rect, style = gComboBoxSeparatorWidget->style; TSOffsetStyleGCs(style, rect->x, rect->y); - if (have_2_10) - gtk_widget_style_get(gComboBoxSeparatorWidget, - "wide-separators", &wide_separators, - "separator-width", &separator_width, - NULL); + gtk_widget_style_get(gComboBoxSeparatorWidget, + "wide-separators", &wide_separators, + "separator-width", &separator_width, + NULL); if (wide_separators) { if (direction == GTK_TEXT_DIR_LTR) @@ -2015,9 +2031,9 @@ moz_gtk_toolbar_separator_paint(GdkDrawable* drawable, GdkRectangle* rect, GtkTextDirection direction) { GtkStyle* style; - gint separator_width = 0; + gint separator_width; gint paint_width; - gboolean wide_separators = FALSE; + gboolean wide_separators; /* Defined as constants in GTK+ 2.10.14 */ const double start_fraction = 0.2; @@ -2028,11 +2044,10 @@ moz_gtk_toolbar_separator_paint(GdkDrawable* drawable, GdkRectangle* rect, style = gToolbarSeparatorWidget->style; - if (have_2_10) - gtk_widget_style_get(gToolbarWidget, - "wide-separators", &wide_separators, - "separator-width", &separator_width, - NULL); + gtk_widget_style_get(gToolbarWidget, + "wide-separators", &wide_separators, + "separator-width", &separator_width, + NULL); TSOffsetStyleGCs(style, rect->x, rect->y); @@ -2423,9 +2438,9 @@ moz_gtk_menu_separator_paint(GdkDrawable* drawable, GdkRectangle* rect, GdkRectangle* cliprect, GtkTextDirection direction) { GtkStyle* style; - gboolean wide_separators = FALSE; - gint separator_height = 0; - guint horizontal_padding = 0; + gboolean wide_separators; + gint separator_height; + guint horizontal_padding; gint paint_height; ensure_menu_separator_widget(); @@ -2433,13 +2448,9 @@ moz_gtk_menu_separator_paint(GdkDrawable* drawable, GdkRectangle* rect, style = gMenuSeparatorWidget->style; - if (have_2_10) - gtk_widget_style_get(gMenuSeparatorWidget, - "wide-separators", &wide_separators, - "separator-height", &separator_height, - NULL); - gtk_widget_style_get(gMenuSeparatorWidget, + "wide-separators", &wide_separators, + "separator-height", &separator_height, "horizontal-padding", &horizontal_padding, NULL); @@ -2687,7 +2698,7 @@ moz_gtk_get_widget_border(GtkThemeWidgetType widget, gint* left, gint* top, /* We need to account for the arrow on the dropdown, so text * doesn't come too close to the arrow, or in some cases spill * into the arrow. */ - gboolean ignored_interior_focus, wide_separators = FALSE; + gboolean ignored_interior_focus, wide_separators; gint focus_width, focus_pad, separator_width; GtkRequisition arrow_req; @@ -2710,11 +2721,10 @@ moz_gtk_get_widget_border(GtkThemeWidgetType widget, gint* left, gint* top, /* If there is no separator, don't try to count its width. */ separator_width = 0; if (gComboBoxSeparatorWidget) { - if (have_2_10) - gtk_widget_style_get(gComboBoxSeparatorWidget, - "wide-separators", &wide_separators, - "separator-width", &separator_width, - NULL); + gtk_widget_style_get(gComboBoxSeparatorWidget, + "wide-separators", &wide_separators, + "separator-width", &separator_width, + NULL); if (!wide_separators) separator_width = @@ -2895,13 +2905,12 @@ moz_gtk_get_combo_box_entry_button_size(gint* width, gint* height) gint moz_gtk_get_tab_scroll_arrow_size(gint* width, gint* height) { - gint arrow_size = 16; + gint arrow_size; ensure_tab_widget(); - if (have_2_10) - gtk_widget_style_get(gTabWidget, - "scroll-arrow-hlength", &arrow_size, - NULL); + gtk_widget_style_get(gTabWidget, + "scroll-arrow-hlength", &arrow_size, + NULL); *height = *width = arrow_size; @@ -2924,22 +2933,18 @@ moz_gtk_get_downarrow_size(gint* width, gint* height) gint moz_gtk_get_toolbar_separator_width(gint* size) { - gboolean wide_separators = FALSE; - gint separator_width = 0; + gboolean wide_separators; + gint separator_width; GtkStyle* style; ensure_toolbar_widget(); style = gToolbarWidget->style; - if (have_2_10) - gtk_widget_style_get(gToolbarWidget, - "wide-separators", &wide_separators, - "separator-width", &separator_width, - NULL); - gtk_widget_style_get(gToolbarWidget, "space-size", size, + "wide-separators", &wide_separators, + "separator-width", &separator_width, NULL); /* Just in case... */ @@ -2973,16 +2978,15 @@ moz_gtk_get_treeview_expander_size(gint* size) gint moz_gtk_get_menu_separator_height(gint *size) { - gboolean wide_separators = FALSE; - gint separator_height = 0; + gboolean wide_separators; + gint separator_height; ensure_menu_separator_widget(); - if (have_2_10) - gtk_widget_style_get(gMenuSeparatorWidget, - "wide-separators", &wide_separators, - "separator-height", &separator_height, - NULL); + gtk_widget_style_get(gMenuSeparatorWidget, + "wide-separators", &wide_separators, + "separator-height", &separator_height, + NULL); if (wide_separators) *size = separator_height + gMenuSeparatorWidget->style->ythickness; @@ -3061,7 +3065,8 @@ moz_gtk_widget_paint(GtkThemeWidgetType widget, GdkDrawable* drawable, case MOZ_GTK_CHECKBUTTON: case MOZ_GTK_RADIOBUTTON: return moz_gtk_toggle_paint(drawable, rect, cliprect, state, - (gboolean) flags, + !!(flags & MOZ_GTK_WIDGET_CHECKED), + !!(flags & MOZ_GTK_WIDGET_INCONSISTENT), (widget == MOZ_GTK_RADIOBUTTON), direction); break; @@ -3262,6 +3267,7 @@ moz_gtk_shutdown() gtk_widget_destroy(gProtoWindow); gProtoWindow = NULL; + gProtoLayout = NULL; gButtonWidget = NULL; gToggleButtonWidget = NULL; gButtonArrowWidget = NULL; diff --git a/WebCore/platform/gtk/gtkdrawing.h b/WebCore/platform/gtk/gtkdrawing.h index eb6995a..1a33bfb 100644 --- a/WebCore/platform/gtk/gtkdrawing.h +++ b/WebCore/platform/gtk/gtkdrawing.h @@ -110,6 +110,10 @@ typedef gint (*style_prop_t)(GtkStyle*, const gchar*, gint); #define MOZ_GTK_UNKNOWN_WIDGET -1 #define MOZ_GTK_UNSAFE_THEME -2 +/*** checkbox/radio flags ***/ +#define MOZ_GTK_WIDGET_CHECKED 1 +#define MOZ_GTK_WIDGET_INCONSISTENT (1 << 1) + /*** widget type constants ***/ typedef enum { /* Paints a GtkButton. flags is a GtkReliefStyle. */ diff --git a/WebCore/platform/gtk/guriescape.c b/WebCore/platform/gtk/guriescape.c deleted file mode 100644 index 0792587..0000000 --- a/WebCore/platform/gtk/guriescape.c +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Copyright (C) 2008 Collabora, Ltd. - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * Copyright (C) 1997-2000 The GLib Team - * Copyright (C) 2006-2007 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "config.h" -#include "guriescape.h" - -#include <string.h> - -#if !PLATFORM(WIN_OS) && !GLIB_CHECK_VERSION(2,16,0) - -/* is_valid, gunichar_ok and g_string_append_uri_escaped were copied for glib/gstring.c - * in the glib package. - * - * Original copyright: - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - * - * Please don't change the indentation so it's easier to update these functions - * if they are changed in glib. - */ -static gboolean -is_valid (char c, const char *reserved_chars_allowed) -{ - if (g_ascii_isalnum (c) || - c == '-' || - c == '.' || - c == '_' || - c == '~') - return TRUE; - - if (reserved_chars_allowed && - strchr (reserved_chars_allowed, c) != NULL) - return TRUE; - - return FALSE; -} - -static gboolean -gunichar_ok (gunichar c) -{ - return - (c != (gunichar) -2) && - (c != (gunichar) -1); -} - -static GString * -_webcore_g_string_append_uri_escaped (GString *string, - const char *unescaped, - const char *reserved_chars_allowed, - gboolean allow_utf8) -{ - unsigned char c; - const char *end; - static const gchar hex[16] = "0123456789ABCDEF"; - - g_return_val_if_fail (string != NULL, NULL); - g_return_val_if_fail (unescaped != NULL, NULL); - - end = unescaped + strlen (unescaped); - - while ((c = *unescaped) != 0) - { - if (c >= 0x80 && allow_utf8 && - gunichar_ok (g_utf8_get_char_validated (unescaped, end - unescaped))) - { - int len = g_utf8_skip [c]; - g_string_append_len (string, unescaped, len); - unescaped += len; - } - else if (is_valid (c, reserved_chars_allowed)) - { - g_string_append_c (string, c); - unescaped++; - } - else - { - g_string_append_c (string, '%'); - g_string_append_c (string, hex[((guchar)c) >> 4]); - g_string_append_c (string, hex[((guchar)c) & 0xf]); - unescaped++; - } - } - - return string; -} - -/* g_uri_escape_string, unescape_character, g_uri_unescape_segment and - * g_uri_unescape_string were copied for glib/gurifuncs.c in the glib package - * and prefixed with _webcore (if necessary) to avoid exporting a symbol with - * the "g_" prefix. - * - * Original copyright: - * Copyright (C) 2006-2007 Red Hat, Inc. - * Author: Alexander Larsson <alexl@redhat.com> - * - * Please don't change the indentation so it's easier to update this function - * if it's changed in glib. - */ -char * -_webcore_g_uri_escape_string (const char *unescaped, - const char *reserved_chars_allowed, - gboolean allow_utf8) -{ - GString *s; - - g_return_val_if_fail (unescaped != NULL, NULL); - - s = g_string_sized_new (strlen (unescaped) + 10); - - _webcore_g_string_append_uri_escaped (s, unescaped, reserved_chars_allowed, allow_utf8); - - return g_string_free (s, FALSE); -} - -static int -unescape_character (const char *scanner) -{ - int first_digit; - int second_digit; - - first_digit = g_ascii_xdigit_value (*scanner++); - if (first_digit < 0) - return -1; - - second_digit = g_ascii_xdigit_value (*scanner++); - if (second_digit < 0) - return -1; - - return (first_digit << 4) | second_digit; -} - - - -static char * -_webcore_g_uri_unescape_segment (const char *escaped_string, - const char *escaped_string_end, - const char *illegal_characters) -{ - const char *in; - char *out, *result; - gint character; - - if (escaped_string == NULL) - return NULL; - - if (escaped_string_end == NULL) - escaped_string_end = escaped_string + strlen (escaped_string); - - result = g_malloc (escaped_string_end - escaped_string + 1); - - out = result; - for (in = escaped_string; in < escaped_string_end; in++) - { - character = *in; - - if (*in == '%') - { - in++; - - if (escaped_string_end - in < 2) - { - /* Invalid escaped char (to short) */ - g_free (result); - return NULL; - } - - character = unescape_character (in); - - /* Check for an illegal character. We consider '\0' illegal here. */ - if (character <= 0 || - (illegal_characters != NULL && - strchr (illegal_characters, (char)character) != NULL)) - { - g_free (result); - return NULL; - } - - in++; /* The other char will be eaten in the loop header */ - } - *out++ = (char)character; - } - - *out = '\0'; - - return result; -} - - -char * -_webcore_g_uri_unescape_string (const char *escaped_string, - const char *illegal_characters) -{ - return _webcore_g_uri_unescape_segment (escaped_string, NULL, illegal_characters); -} - -#endif /* #if !PLATFORM(WIN_OS) && !GLIB_CHECK_VERSION(2,16,0) */ diff --git a/WebCore/platform/gtk/guriescape.h b/WebCore/platform/gtk/guriescape.h deleted file mode 100644 index 8c6662a..0000000 --- a/WebCore/platform/gtk/guriescape.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2008 Collabora, Ltd. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifndef guriescape_h -#define guriescape_h - -#include <glib.h> -#include <wtf/Platform.h> - -G_BEGIN_DECLS - -#if !PLATFORM(WIN_OS) && !GLIB_CHECK_VERSION(2,16,0) - -#define g_uri_escape_string _webcore_g_uri_escape_string -#define g_uri_unescape_string _webcore_g_uri_unescape_string - -char *_webcore_g_uri_escape_string (const char *unescaped, - const char *reserved_chars_allowed, - gboolean allow_utf8); - -char *_webcore_g_uri_unescape_string (const char *escaped_string, - const char *illegal_characters); - -#endif - -G_END_DECLS - -#endif /* guriescape_h */ |