11// Copyright (c) 2012 Intel Corp
22// Copyright (c) 2012 The Chromium Authors
3- //
4- // Permission is hereby granted, free of charge, to any person obtaining a copy
3+ //
4+ // Permission is hereby granted, free of charge, to any person obtaining a copy
55// of this software and associated documentation files (the "Software"), to deal
66// in the Software without restriction, including without limitation the rights
77// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell co
88// pies of the Software, and to permit persons to whom the Software is furnished
99// to do so, subject to the following conditions:
10- //
10+ //
1111// The above copyright notice and this permission notice shall be included in al
1212// l copies or substantial portions of the Software.
13- //
13+ //
1414// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IM
1515// PLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNES
1616// S FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
@@ -161,35 +161,23 @@ void Shell::PlatformCreateWindow(int width, int height) {
161161 g_signal_connect (G_OBJECT (window_), " destroy" ,
162162 G_CALLBACK (OnWindowDestroyedThunk), this );
163163
164- std::string title = " node-webkit" ;
165-
166164 // window.as_desktop, the window will be used as a desktop background window
167- bool as_desktop = false ;
168- if (window_manifest_ &&
169- window_manifest_->GetBoolean (switches::kmAsDesktop, &as_desktop) &&
170- as_desktop) {
171- gtk_window_set_type_hint (window_, GDK_WINDOW_TYPE_HINT_DESKTOP);
165+ if (is_desktop_) {
166+ gtk_window_set_type_hint (window_, GDK_WINDOW_TYPE_HINT_DESKTOP);
172167 GdkScreen* screen = gtk_window_get_screen (window_);
173168 gtk_window_set_default_size (window_,
174169 gdk_screen_get_width (screen),
175170 gdk_screen_get_height (screen));
176- }
177-
178- if (window_manifest_ && !as_desktop) {
179- // window.x and window.y
180- int x, y;
181- if (window_manifest_->GetInteger (switches::kmX, &x) &&
182- window_manifest_->GetInteger (switches::kmY, &y)) {
171+ } else {
172+ if (x_ > 0 && y_ > 0 ) {
173+ // window.x and window.y
183174 gtk_window_move (window_, x, y);
184175 } else {
185176 // window.postion
186- std::string desription;
187- if (window_manifest_->GetString (switches::kmPosition, &desription)) {
188- if (desription == " center" )
189- gtk_window_set_position (window_, GTK_WIN_POS_CENTER);
190- else if (desription == " mouse" )
191- gtk_window_set_position (window_, GTK_WIN_POS_MOUSE);
192- }
177+ if (position_ == " center" )
178+ gtk_window_set_position (window_, GTK_WIN_POS_CENTER);
179+ else if (position_ == " mouse" )
180+ gtk_window_set_position (window_, GTK_WIN_POS_MOUSE);
193181 }
194182
195183 GdkGeometry geometry = { 0 };
@@ -205,7 +193,7 @@ void Shell::PlatformCreateWindow(int width, int height) {
205193 if (max_width_ > 0 ) {
206194 hints |= GDK_HINT_MAX_SIZE;
207195 geometry.max_width = max_width_;
208- }
196+ }
209197 if (max_height_ > 0 ) {
210198 hints |= GDK_HINT_MAX_SIZE;
211199 geometry.max_height = max_height_;
@@ -214,12 +202,9 @@ void Shell::PlatformCreateWindow(int width, int height) {
214202 gtk_window_set_geometry_hints (
215203 window_, GTK_WIDGET (window_), &geometry, (GdkWindowHints)hints);
216204 }
217-
218- // window.title
219- window_manifest_->GetString (switches::kmTitle, &title);
220205 }
221206
222- gtk_window_set_title (window_, title .c_str ());
207+ gtk_window_set_title (window_, title_ .c_str ());
223208
224209 vbox_ = gtk_vbox_new (FALSE , 0 );
225210
@@ -229,23 +214,6 @@ void Shell::PlatformCreateWindow(int width, int height) {
229214 gtk_box_pack_start (GTK_BOX (vbox_), menu_bar, FALSE , FALSE , 0 );
230215 }
231216
232- // Create the object that mediates accelerators.
233- GtkAccelGroup* accel_group = gtk_accel_group_new ();
234- gtk_window_add_accel_group (GTK_WINDOW (window_), accel_group);
235-
236- // Set global window handling accelerators:
237- gtk_accel_group_connect (
238- accel_group, GDK_w, GDK_CONTROL_MASK,
239- GTK_ACCEL_VISIBLE,
240- g_cclosure_new (G_CALLBACK (OnCloseWindowKeyPressedThunk),
241- this , NULL ));
242-
243- gtk_accel_group_connect (
244- accel_group, GDK_n, GDK_CONTROL_MASK,
245- GTK_ACCEL_VISIBLE,
246- g_cclosure_new (G_CALLBACK (OnNewWindowKeyPressedThunk),
247- this , NULL ));
248-
249217 GtkWidget* toolbar = gtk_toolbar_new ();
250218 // Turn off the labels on the toolbar buttons.
251219 gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_ICONS);
@@ -254,24 +222,16 @@ void Shell::PlatformCreateWindow(int width, int height) {
254222 g_signal_connect (back_button_, " clicked" ,
255223 G_CALLBACK (&OnBackButtonClickedThunk), this );
256224 gtk_toolbar_insert (GTK_TOOLBAR (toolbar), back_button_, -1 /* append */ );
257- gtk_widget_add_accelerator (GTK_WIDGET (back_button_), " clicked" , accel_group,
258- GDK_Left, GDK_MOD1_MASK, GTK_ACCEL_VISIBLE);
259225
260226 forward_button_ = gtk_tool_button_new_from_stock (GTK_STOCK_GO_FORWARD);
261227 g_signal_connect (forward_button_, " clicked" ,
262228 G_CALLBACK (&OnForwardButtonClickedThunk), this );
263229 gtk_toolbar_insert (GTK_TOOLBAR (toolbar), forward_button_, -1 /* append */ );
264- gtk_widget_add_accelerator (GTK_WIDGET (forward_button_), " clicked" ,
265- accel_group,
266- GDK_Right, GDK_MOD1_MASK, GTK_ACCEL_VISIBLE);
267230
268231 reload_button_ = gtk_tool_button_new_from_stock (GTK_STOCK_REFRESH);
269232 g_signal_connect (reload_button_, " clicked" ,
270233 G_CALLBACK (&OnReloadButtonClickedThunk), this );
271234 gtk_toolbar_insert (GTK_TOOLBAR (toolbar), reload_button_, -1 /* append */ );
272- gtk_widget_add_accelerator (GTK_WIDGET (reload_button_), " clicked" ,
273- accel_group,
274- GDK_r, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
275235
276236 stop_button_ = gtk_tool_button_new_from_stock (GTK_STOCK_STOP);
277237 g_signal_connect (stop_button_, " clicked" ,
@@ -282,12 +242,6 @@ void Shell::PlatformCreateWindow(int width, int height) {
282242 g_signal_connect (G_OBJECT (url_edit_view_), " activate" ,
283243 G_CALLBACK (&OnURLEntryActivateThunk), this );
284244
285- gtk_accel_group_connect (
286- accel_group, GDK_l, GDK_CONTROL_MASK,
287- GTK_ACCEL_VISIBLE,
288- g_cclosure_new (G_CALLBACK (OnHighlightURLViewThunk),
289- this , NULL ));
290-
291245 GtkToolItem* tool_item = gtk_tool_item_new ();
292246 gtk_container_add (GTK_CONTAINER (tool_item), url_edit_view_);
293247 gtk_tool_item_set_expand (tool_item, TRUE );
@@ -377,37 +331,6 @@ gboolean Shell::OnWindowDestroyed(GtkWidget* window) {
377331 return FALSE ; // Don't stop this message.
378332}
379333
380- gboolean Shell::OnCloseWindowKeyPressed (GtkAccelGroup* accel_group,
381- GObject* acceleratable,
382- guint keyval,
383- GdkModifierType modifier) {
384- gtk_widget_destroy (GTK_WIDGET (window_));
385- return TRUE ;
386- }
387-
388- gboolean Shell::OnNewWindowKeyPressed (GtkAccelGroup* accel_group,
389- GObject* acceleratable,
390- guint keyval,
391- GdkModifierType modifier) {
392- ShellBrowserContext* browser_context =
393- static_cast <ShellContentBrowserClient*>(
394- GetContentClient ()->browser ())->browser_context ();
395- Shell::CreateNewWindow (browser_context,
396- GURL (),
397- NULL ,
398- MSG_ROUTING_NONE,
399- NULL );
400- return TRUE ;
401- }
402-
403- gboolean Shell::OnHighlightURLView (GtkAccelGroup* accel_group,
404- GObject* acceleratable,
405- guint keyval,
406- GdkModifierType modifier) {
407- gtk_widget_grab_focus (GTK_WIDGET (url_edit_view_));
408- return TRUE ;
409- }
410-
411334void Shell::PlatformSetTitle (const string16& title) {
412335 std::string title_utf8 = UTF16ToUTF8 (title);
413336 gtk_window_set_title (GTK_WINDOW (window_), title_utf8.c_str ());
0 commit comments