Commit 24b21a5d authored by Elliot Lee's avatar Elliot Lee

OK, handle box is good to go except for having the parent resize when it is...

OK, handle box is good to go except for having the parent resize when it is dragged out, and also allowing user to drag it back into the original parent
parent 01eda653
...@@ -1763,6 +1763,8 @@ gdk_event_translate (GdkEvent *event, ...@@ -1763,6 +1763,8 @@ gdk_event_translate (GdkEvent *event,
event->button.time = xevent->xbutton.time; event->button.time = xevent->xbutton.time;
event->button.x = xevent->xbutton.x; event->button.x = xevent->xbutton.x;
event->button.y = xevent->xbutton.y; event->button.y = xevent->xbutton.y;
event->button.x_root = (gfloat)xevent->xbutton.x_root;
event->button.y_root = (gfloat)xevent->xbutton.y_root;
event->button.pressure = 0.5; event->button.pressure = 0.5;
event->button.xtilt = 0; event->button.xtilt = 0;
event->button.ytilt = 0; event->button.ytilt = 0;
...@@ -1864,8 +1866,8 @@ gdk_event_translate (GdkEvent *event, ...@@ -1864,8 +1866,8 @@ gdk_event_translate (GdkEvent *event,
event->button.time = xevent->xbutton.time; event->button.time = xevent->xbutton.time;
event->button.x = xevent->xbutton.x; event->button.x = xevent->xbutton.x;
event->button.y = xevent->xbutton.y; event->button.y = xevent->xbutton.y;
event->button.x_root = xevent->xbutton.x_root; event->button.x_root = (gfloat)xevent->xbutton.x_root;
event->button.y_root = xevent->xbutton.y_root; event->button.y_root = (gfloat)xevent->xbutton.y_root;
event->button.pressure = 0.5; event->button.pressure = 0.5;
event->button.xtilt = 0; event->button.xtilt = 0;
event->button.ytilt = 0; event->button.ytilt = 0;
...@@ -1936,8 +1938,8 @@ gdk_event_translate (GdkEvent *event, ...@@ -1936,8 +1938,8 @@ gdk_event_translate (GdkEvent *event,
event->motion.time = xevent->xmotion.time; event->motion.time = xevent->xmotion.time;
event->motion.x = xevent->xmotion.x; event->motion.x = xevent->xmotion.x;
event->motion.y = xevent->xmotion.y; event->motion.y = xevent->xmotion.y;
event->motion.x_root = xevent->xmotion.x_root; event->motion.x_root = (gfloat)xevent->xmotion.x_root;
event->motion.y_root = xevent->xmotion.y_root; event->motion.y_root = (gfloat)xevent->xmotion.y_root;
event->motion.pressure = 0.5; event->motion.pressure = 0.5;
event->motion.xtilt = 0; event->motion.xtilt = 0;
event->motion.ytilt = 0; event->motion.ytilt = 0;
......
...@@ -1763,6 +1763,8 @@ gdk_event_translate (GdkEvent *event, ...@@ -1763,6 +1763,8 @@ gdk_event_translate (GdkEvent *event,
event->button.time = xevent->xbutton.time; event->button.time = xevent->xbutton.time;
event->button.x = xevent->xbutton.x; event->button.x = xevent->xbutton.x;
event->button.y = xevent->xbutton.y; event->button.y = xevent->xbutton.y;
event->button.x_root = (gfloat)xevent->xbutton.x_root;
event->button.y_root = (gfloat)xevent->xbutton.y_root;
event->button.pressure = 0.5; event->button.pressure = 0.5;
event->button.xtilt = 0; event->button.xtilt = 0;
event->button.ytilt = 0; event->button.ytilt = 0;
...@@ -1864,8 +1866,8 @@ gdk_event_translate (GdkEvent *event, ...@@ -1864,8 +1866,8 @@ gdk_event_translate (GdkEvent *event,
event->button.time = xevent->xbutton.time; event->button.time = xevent->xbutton.time;
event->button.x = xevent->xbutton.x; event->button.x = xevent->xbutton.x;
event->button.y = xevent->xbutton.y; event->button.y = xevent->xbutton.y;
event->button.x_root = xevent->xbutton.x_root; event->button.x_root = (gfloat)xevent->xbutton.x_root;
event->button.y_root = xevent->xbutton.y_root; event->button.y_root = (gfloat)xevent->xbutton.y_root;
event->button.pressure = 0.5; event->button.pressure = 0.5;
event->button.xtilt = 0; event->button.xtilt = 0;
event->button.ytilt = 0; event->button.ytilt = 0;
...@@ -1936,8 +1938,8 @@ gdk_event_translate (GdkEvent *event, ...@@ -1936,8 +1938,8 @@ gdk_event_translate (GdkEvent *event,
event->motion.time = xevent->xmotion.time; event->motion.time = xevent->xmotion.time;
event->motion.x = xevent->xmotion.x; event->motion.x = xevent->xmotion.x;
event->motion.y = xevent->xmotion.y; event->motion.y = xevent->xmotion.y;
event->motion.x_root = xevent->xmotion.x_root; event->motion.x_root = (gfloat)xevent->xmotion.x_root;
event->motion.y_root = xevent->xmotion.y_root; event->motion.y_root = (gfloat)xevent->xmotion.y_root;
event->motion.pressure = 0.5; event->motion.pressure = 0.5;
event->motion.xtilt = 0; event->motion.xtilt = 0;
event->motion.ytilt = 0; event->motion.ytilt = 0;
......
...@@ -142,8 +142,8 @@ gtk_handle_box_size_request (GtkWidget *widget, ...@@ -142,8 +142,8 @@ gtk_handle_box_size_request (GtkWidget *widget,
bin = GTK_BIN (widget); bin = GTK_BIN (widget);
requisition->width = DRAG_HANDLE_SIZE; requisition->width = DRAG_HANDLE_SIZE + GTK_CONTAINER(widget)->border_width * 2;
requisition->height = DRAG_HANDLE_SIZE; requisition->height = DRAG_HANDLE_SIZE + GTK_CONTAINER(widget)->border_width * 2;
if (bin->child && GTK_WIDGET_VISIBLE (bin->child)) if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
{ {
...@@ -171,14 +171,14 @@ gtk_handle_box_size_allocate (GtkWidget *widget, ...@@ -171,14 +171,14 @@ gtk_handle_box_size_allocate (GtkWidget *widget,
child_allocation.x = 0; child_allocation.x = 0;
child_allocation.y = 0; child_allocation.y = 0;
child_allocation.width = allocation->width - DRAG_HANDLE_SIZE; child_allocation.width = allocation->width - DRAG_HANDLE_SIZE - GTK_CONTAINER(widget)->border_width * 2;
child_allocation.height = allocation->height; child_allocation.height = allocation->height - GTK_CONTAINER(widget)->border_width * 2;
if (GTK_WIDGET_REALIZED (widget)) if (GTK_WIDGET_REALIZED (widget))
{ {
gdk_window_move_resize (widget->window, gdk_window_move_resize (widget->window,
allocation->x + DRAG_HANDLE_SIZE, allocation->x + DRAG_HANDLE_SIZE + GTK_CONTAINER(widget)->border_width,
allocation->y, allocation->y + GTK_CONTAINER(widget)->border_width,
child_allocation.width, child_allocation.width,
child_allocation.height); child_allocation.height);
} }
...@@ -197,18 +197,26 @@ static void gtk_handle_box_paint(GtkWidget *widget, ...@@ -197,18 +197,26 @@ static void gtk_handle_box_paint(GtkWidget *widget,
g_print("painting %dx%d+%d+%d\n", g_print("painting %dx%d+%d+%d\n",
area->x, area->y, area->width, area->height); area->x, area->y, area->width, area->height);
startx = 1; endx = DRAG_HANDLE_SIZE; startx = 1; endx = DRAG_HANDLE_SIZE;
if(area->x > startx) if(area->x > startx)
startx = area->x; startx = area->x;
if((area->x + area->width) < endx) if((area->x + area->width) < endx)
endx = area->x + area->width; endx = area->x + area->width;
line_y2 = area->y + area->height; line_y2 = area->y + area->height;
for(x = startx; x < DRAG_HANDLE_SIZE; x += 3) for(x = startx; x < DRAG_HANDLE_SIZE; x += 3)
gtk_draw_vline(widget->style, widget->window, gtk_draw_vline(widget->style, widget->window,
GTK_WIDGET_STATE(widget), GTK_WIDGET_STATE(widget),
area->y, line_y2, area->y, line_y2,
x); x);
gtk_draw_shadow(widget->style,
widget->window,
GTK_WIDGET_STATE(widget),
GTK_SHADOW_OUT,
0, 0,
widget->allocation.width - 1,
widget->allocation.height);
} }
static void static void
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment