@@ -54,7 +54,10 @@ NativeWindowGtk::NativeWindowGtk(const base::WeakPtr<content::Shell>& shell,
54
54
state_ (GDK_WINDOW_STATE_WITHDRAWN),
55
55
content_thinks_its_fullscreen_(false ),
56
56
frame_cursor_(NULL ),
57
- resizable_(true ) {
57
+ resizable_(true ),
58
+ last_x_(-1 ), last_y_(-1 ),
59
+ last_width_(-1 ), last_height_(-1 )
60
+ {
58
61
window_ = GTK_WINDOW (gtk_window_new (GTK_WINDOW_TOPLEVEL));
59
62
60
63
vbox_ = gtk_vbox_new (FALSE , 0 );
@@ -94,6 +97,9 @@ NativeWindowGtk::NativeWindowGtk(const base::WeakPtr<content::Shell>& shell,
94
97
gtk_window_set_default_size (window_, width, height);
95
98
}
96
99
100
+ last_width_ = width;
101
+ last_height_ = height;
102
+
97
103
// Hide titlebar when {frame: false} specified.
98
104
if (!has_frame_)
99
105
gtk_window_set_decorated (window_, false );
@@ -124,6 +130,8 @@ NativeWindowGtk::NativeWindowGtk(const base::WeakPtr<content::Shell>& shell,
124
130
G_CALLBACK (OnWindowStateThunk), this );
125
131
g_signal_connect (window_, " delete-event" ,
126
132
G_CALLBACK (OnWindowDeleteEventThunk), this );
133
+ g_signal_connect (window_, " configure-event" ,
134
+ G_CALLBACK (OnWindowConfigureEventThunk), this );
127
135
if (!has_frame_) {
128
136
g_signal_connect (window_, " button-press-event" ,
129
137
G_CALLBACK (OnButtonPressThunk), this );
@@ -579,6 +587,38 @@ gboolean NativeWindowGtk::OnWindowDeleteEvent(GtkWidget* widget,
579
587
return FALSE ;
580
588
}
581
589
590
+ gboolean NativeWindowGtk::OnWindowConfigureEvent (GtkWidget* window,
591
+ GdkEvent* event)
592
+ {
593
+ int x, y;
594
+ int w, h;
595
+
596
+ x = event->configure .x ;
597
+ y = event->configure .y ;
598
+ if (x != last_x_ || y != last_y_) {
599
+ last_x_ = x;
600
+ last_y_ = y;
601
+ base::ListValue args;
602
+ args.AppendInteger (x);
603
+ args.AppendInteger (y);
604
+ if (shell ())
605
+ shell ()->SendEvent (" move" , args);
606
+ }
607
+
608
+ w = event->configure .width ;
609
+ h = event->configure .height ;
610
+ if (w != last_width_ || h != last_height_) {
611
+ last_width_ = w;
612
+ last_height_ = h;
613
+ base::ListValue args;
614
+ args.AppendInteger (w);
615
+ args.AppendInteger (h);
616
+ if (shell ())
617
+ shell ()->SendEvent (" resize" , args);
618
+ }
619
+ return FALSE ;
620
+ }
621
+
582
622
bool NativeWindowGtk::GetWindowEdge (int x, int y, GdkWindowEdge* edge) {
583
623
if (has_frame_)
584
624
return false ;
0 commit comments