Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Oblomov
gtk
Commits
34e324ca
Commit
34e324ca
authored
Mar 24, 1998
by
Owen Taylor
Browse files
/home/otaylor/commit
parent
7bd32a06
Changes
17
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
34e324ca
Mon Mar 23 18:19:42 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkmenu.c gtk/gtkmenushell.c: Instead of making
an X grab when the button is released, grab immediately.
This solves a problem where menus wouldn't pop down
if the caller didn't have the BUTTON_RELEASE mask on
their window, and and another where the X grab would
be released prematurely.
* gtk/gtklist.c gtk/gtktree.c: Do sanity checking on
button presses to make sure they occurred in a child item.
(From: "Damon Chaplin" <DAChaplin@email.msn.com>)
* gtk/gtkmenushell.c: Do sanity checking on button
press/releases. Handle button events on window widget
descendents of menu items correctly.
* gtk/gtkclist.c gtk/gtkbutton.c gtk/gtkviewport.c
gtk/gtkeventbox.c:
Make the window size allocated in _realize() match that
in _size_allocate(). Take into account the border width
in the draw() handler.
Mon Mar 23 15:26:25 1998 Tim Janik <timj@gtk.org>
* gtk/gtkentry.c (gtk_entry_append_text): check for text!=NULL.
...
...
ChangeLog.pre-2-0
View file @
34e324ca
Mon Mar 23 18:19:42 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkmenu.c gtk/gtkmenushell.c: Instead of making
an X grab when the button is released, grab immediately.
This solves a problem where menus wouldn't pop down
if the caller didn't have the BUTTON_RELEASE mask on
their window, and and another where the X grab would
be released prematurely.
* gtk/gtklist.c gtk/gtktree.c: Do sanity checking on
button presses to make sure they occurred in a child item.
(From: "Damon Chaplin" <DAChaplin@email.msn.com>)
* gtk/gtkmenushell.c: Do sanity checking on button
press/releases. Handle button events on window widget
descendents of menu items correctly.
* gtk/gtkclist.c gtk/gtkbutton.c gtk/gtkviewport.c
gtk/gtkeventbox.c:
Make the window size allocated in _realize() match that
in _size_allocate(). Take into account the border width
in the draw() handler.
Mon Mar 23 15:26:25 1998 Tim Janik <timj@gtk.org>
* gtk/gtkentry.c (gtk_entry_append_text): check for text!=NULL.
...
...
ChangeLog.pre-2-10
View file @
34e324ca
Mon Mar 23 18:19:42 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkmenu.c gtk/gtkmenushell.c: Instead of making
an X grab when the button is released, grab immediately.
This solves a problem where menus wouldn't pop down
if the caller didn't have the BUTTON_RELEASE mask on
their window, and and another where the X grab would
be released prematurely.
* gtk/gtklist.c gtk/gtktree.c: Do sanity checking on
button presses to make sure they occurred in a child item.
(From: "Damon Chaplin" <DAChaplin@email.msn.com>)
* gtk/gtkmenushell.c: Do sanity checking on button
press/releases. Handle button events on window widget
descendents of menu items correctly.
* gtk/gtkclist.c gtk/gtkbutton.c gtk/gtkviewport.c
gtk/gtkeventbox.c:
Make the window size allocated in _realize() match that
in _size_allocate(). Take into account the border width
in the draw() handler.
Mon Mar 23 15:26:25 1998 Tim Janik <timj@gtk.org>
* gtk/gtkentry.c (gtk_entry_append_text): check for text!=NULL.
...
...
ChangeLog.pre-2-2
View file @
34e324ca
Mon Mar 23 18:19:42 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkmenu.c gtk/gtkmenushell.c: Instead of making
an X grab when the button is released, grab immediately.
This solves a problem where menus wouldn't pop down
if the caller didn't have the BUTTON_RELEASE mask on
their window, and and another where the X grab would
be released prematurely.
* gtk/gtklist.c gtk/gtktree.c: Do sanity checking on
button presses to make sure they occurred in a child item.
(From: "Damon Chaplin" <DAChaplin@email.msn.com>)
* gtk/gtkmenushell.c: Do sanity checking on button
press/releases. Handle button events on window widget
descendents of menu items correctly.
* gtk/gtkclist.c gtk/gtkbutton.c gtk/gtkviewport.c
gtk/gtkeventbox.c:
Make the window size allocated in _realize() match that
in _size_allocate(). Take into account the border width
in the draw() handler.
Mon Mar 23 15:26:25 1998 Tim Janik <timj@gtk.org>
* gtk/gtkentry.c (gtk_entry_append_text): check for text!=NULL.
...
...
ChangeLog.pre-2-4
View file @
34e324ca
Mon Mar 23 18:19:42 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkmenu.c gtk/gtkmenushell.c: Instead of making
an X grab when the button is released, grab immediately.
This solves a problem where menus wouldn't pop down
if the caller didn't have the BUTTON_RELEASE mask on
their window, and and another where the X grab would
be released prematurely.
* gtk/gtklist.c gtk/gtktree.c: Do sanity checking on
button presses to make sure they occurred in a child item.
(From: "Damon Chaplin" <DAChaplin@email.msn.com>)
* gtk/gtkmenushell.c: Do sanity checking on button
press/releases. Handle button events on window widget
descendents of menu items correctly.
* gtk/gtkclist.c gtk/gtkbutton.c gtk/gtkviewport.c
gtk/gtkeventbox.c:
Make the window size allocated in _realize() match that
in _size_allocate(). Take into account the border width
in the draw() handler.
Mon Mar 23 15:26:25 1998 Tim Janik <timj@gtk.org>
* gtk/gtkentry.c (gtk_entry_append_text): check for text!=NULL.
...
...
ChangeLog.pre-2-6
View file @
34e324ca
Mon Mar 23 18:19:42 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkmenu.c gtk/gtkmenushell.c: Instead of making
an X grab when the button is released, grab immediately.
This solves a problem where menus wouldn't pop down
if the caller didn't have the BUTTON_RELEASE mask on
their window, and and another where the X grab would
be released prematurely.
* gtk/gtklist.c gtk/gtktree.c: Do sanity checking on
button presses to make sure they occurred in a child item.
(From: "Damon Chaplin" <DAChaplin@email.msn.com>)
* gtk/gtkmenushell.c: Do sanity checking on button
press/releases. Handle button events on window widget
descendents of menu items correctly.
* gtk/gtkclist.c gtk/gtkbutton.c gtk/gtkviewport.c
gtk/gtkeventbox.c:
Make the window size allocated in _realize() match that
in _size_allocate(). Take into account the border width
in the draw() handler.
Mon Mar 23 15:26:25 1998 Tim Janik <timj@gtk.org>
* gtk/gtkentry.c (gtk_entry_append_text): check for text!=NULL.
...
...
ChangeLog.pre-2-8
View file @
34e324ca
Mon Mar 23 18:19:42 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkmenu.c gtk/gtkmenushell.c: Instead of making
an X grab when the button is released, grab immediately.
This solves a problem where menus wouldn't pop down
if the caller didn't have the BUTTON_RELEASE mask on
their window, and and another where the X grab would
be released prematurely.
* gtk/gtklist.c gtk/gtktree.c: Do sanity checking on
button presses to make sure they occurred in a child item.
(From: "Damon Chaplin" <DAChaplin@email.msn.com>)
* gtk/gtkmenushell.c: Do sanity checking on button
press/releases. Handle button events on window widget
descendents of menu items correctly.
* gtk/gtkclist.c gtk/gtkbutton.c gtk/gtkviewport.c
gtk/gtkeventbox.c:
Make the window size allocated in _realize() match that
in _size_allocate(). Take into account the border width
in the draw() handler.
Mon Mar 23 15:26:25 1998 Tim Janik <timj@gtk.org>
* gtk/gtkentry.c (gtk_entry_append_text): check for text!=NULL.
...
...
gtk/gtkbutton.c
View file @
34e324ca
...
...
@@ -324,6 +324,7 @@ gtk_button_realize (GtkWidget *widget)
GtkButton
*
button
;
GdkWindowAttr
attributes
;
gint
attributes_mask
;
gint
border_width
;
g_return_if_fail
(
widget
!=
NULL
);
g_return_if_fail
(
GTK_IS_BUTTON
(
widget
));
...
...
@@ -331,11 +332,13 @@ gtk_button_realize (GtkWidget *widget)
button
=
GTK_BUTTON
(
widget
);
GTK_WIDGET_SET_FLAGS
(
widget
,
GTK_REALIZED
);
border_width
=
GTK_CONTAINER
(
widget
)
->
border_width
;
attributes
.
window_type
=
GDK_WINDOW_CHILD
;
attributes
.
x
=
widget
->
allocation
.
x
;
attributes
.
y
=
widget
->
allocation
.
y
;
attributes
.
width
=
widget
->
allocation
.
width
;
attributes
.
height
=
widget
->
allocation
.
height
;
attributes
.
x
=
widget
->
allocation
.
x
+
border_width
;
attributes
.
y
=
widget
->
allocation
.
y
+
border_width
;
attributes
.
width
=
widget
->
allocation
.
width
-
border_width
*
2
;
attributes
.
height
=
widget
->
allocation
.
height
-
border_width
*
2
;
attributes
.
wclass
=
GDK_INPUT_OUTPUT
;
attributes
.
visual
=
gtk_widget_get_visual
(
widget
);
attributes
.
colormap
=
gtk_widget_get_colormap
(
widget
);
...
...
@@ -482,6 +485,7 @@ gtk_button_draw (GtkWidget *widget,
{
GtkButton
*
button
;
GdkRectangle
child_area
;
GdkRectangle
tmp_area
;
g_return_if_fail
(
widget
!=
NULL
);
g_return_if_fail
(
GTK_IS_BUTTON
(
widget
));
...
...
@@ -491,9 +495,13 @@ gtk_button_draw (GtkWidget *widget,
{
button
=
GTK_BUTTON
(
widget
);
gtk_button_paint
(
widget
,
area
);
tmp_area
=
*
area
;
tmp_area
.
x
-=
GTK_CONTAINER
(
button
)
->
border_width
;
tmp_area
.
y
-=
GTK_CONTAINER
(
button
)
->
border_width
;
gtk_button_paint
(
widget
,
&
tmp_area
);
if
(
button
->
child
&&
gtk_widget_intersect
(
button
->
child
,
area
,
&
child_area
))
if
(
button
->
child
&&
gtk_widget_intersect
(
button
->
child
,
&
tmp_
area
,
&
child_area
))
gtk_widget_draw
(
button
->
child
,
&
child_area
);
gtk_widget_draw_default
(
widget
);
...
...
gtk/gtkclist.c
View file @
34e324ca
...
...
@@ -1729,6 +1729,7 @@ gtk_clist_realize (GtkWidget * widget)
GdkWindowAttr
attributes
;
gint
attributes_mask
;
GdkGCValues
values
;
gint
border_width
;
g_return_if_fail
(
widget
!=
NULL
);
g_return_if_fail
(
GTK_IS_CLIST
(
widget
));
...
...
@@ -1737,11 +1738,13 @@ gtk_clist_realize (GtkWidget * widget)
GTK_WIDGET_SET_FLAGS
(
widget
,
GTK_REALIZED
);
border_width
=
GTK_CONTAINER
(
widget
)
->
border_width
;
attributes
.
window_type
=
GDK_WINDOW_CHILD
;
attributes
.
x
=
widget
->
allocation
.
x
;
attributes
.
y
=
widget
->
allocation
.
y
;
attributes
.
width
=
widget
->
allocation
.
width
;
attributes
.
height
=
widget
->
allocation
.
height
;
attributes
.
x
=
widget
->
allocation
.
x
+
border_width
;
attributes
.
y
=
widget
->
allocation
.
y
+
border_width
;
attributes
.
width
=
widget
->
allocation
.
width
-
border_width
*
2
;
attributes
.
height
=
widget
->
allocation
.
height
-
border_width
*
2
;
attributes
.
wclass
=
GDK_INPUT_OUTPUT
;
attributes
.
visual
=
gtk_widget_get_visual
(
widget
);
attributes
.
colormap
=
gtk_widget_get_colormap
(
widget
);
...
...
@@ -1951,6 +1954,7 @@ gtk_clist_draw (GtkWidget * widget,
GdkRectangle
*
area
)
{
GtkCList
*
clist
;
gint
border_width
;
g_return_if_fail
(
widget
!=
NULL
);
g_return_if_fail
(
GTK_IS_CLIST
(
widget
));
...
...
@@ -1959,9 +1963,11 @@ gtk_clist_draw (GtkWidget * widget,
if
(
GTK_WIDGET_DRAWABLE
(
widget
))
{
clist
=
GTK_CLIST
(
widget
);
border_width
=
GTK_CONTAINER
(
widget
)
->
border_width
;
gdk_window_clear_area
(
widget
->
window
,
area
->
x
,
area
->
y
,
area
->
x
-
border_width
,
area
->
y
-
border_width
,
area
->
width
,
area
->
height
);
/* draw list shadow/border */
...
...
gtk/gtkeventbox.c
View file @
34e324ca
...
...
@@ -88,16 +88,19 @@ gtk_event_box_realize (GtkWidget *widget)
{
GdkWindowAttr
attributes
;
gint
attributes_mask
;
gint
border_width
;
g_return_if_fail
(
widget
!=
NULL
);
g_return_if_fail
(
GTK_IS_EVENT_BOX
(
widget
));
GTK_WIDGET_SET_FLAGS
(
widget
,
GTK_REALIZED
);
attributes
.
x
=
widget
->
allocation
.
x
;
attributes
.
y
=
widget
->
allocation
.
y
;
attributes
.
width
=
widget
->
allocation
.
width
;
attributes
.
height
=
widget
->
allocation
.
height
;
border_width
=
GTK_CONTAINER
(
widget
)
->
border_width
;
attributes
.
x
=
widget
->
allocation
.
x
+
border_width
;
attributes
.
y
=
widget
->
allocation
.
y
+
border_width
;
attributes
.
width
=
widget
->
allocation
.
width
-
2
*
border_width
;
attributes
.
height
=
widget
->
allocation
.
height
-
2
*
border_width
;
attributes
.
window_type
=
GDK_WINDOW_CHILD
;
attributes
.
wclass
=
GDK_INPUT_OUTPUT
;
attributes
.
visual
=
gtk_widget_get_visual
(
widget
);
...
...
@@ -182,19 +185,22 @@ gtk_event_box_draw (GtkWidget *widget,
GdkRectangle
*
area
)
{
GtkBin
*
bin
;
GdkRectangle
tmp_area
;
GdkRectangle
child_area
;
g_return_if_fail
(
widget
!=
NULL
);
g_return_if_fail
(
GTK_IS_EVENT_BOX
(
widget
));
g_return_if_fail
(
area
!=
NULL
);
if
(
GTK_WIDGET_DRAWABLE
(
widget
))
{
bin
=
GTK_BIN
(
widget
);
tmp_area
=
*
area
;
tmp_area
.
x
-=
GTK_CONTAINER
(
widget
)
->
border_width
;
tmp_area
.
y
-=
GTK_CONTAINER
(
widget
)
->
border_width
;
if
(
bin
->
child
)
{
if
(
gtk_widget_intersect
(
bin
->
child
,
area
,
&
child_area
))
if
(
gtk_widget_intersect
(
bin
->
child
,
&
tmp_
area
,
&
child_area
))
gtk_widget_draw
(
bin
->
child
,
&
child_area
);
}
}
...
...
gtk/gtkfilesel.c
View file @
34e324ca
...
...
@@ -1278,7 +1278,7 @@ gtk_file_selection_populate (GtkFileSelection *fs,
{
possible_count
+=
1
;
filename
=
g_strdup
(
cmpl_this_completion
(
poss
)
)
;
filename
=
cmpl_this_completion
(
poss
);
text
[
0
]
=
filename
;
...
...
gtk/gtklist.c
View file @
34e324ca
...
...
@@ -698,12 +698,12 @@ gtk_list_button_press (GtkWidget *widget,
list
=
GTK_LIST
(
widget
);
item
=
gtk_get_event_widget
((
GdkEvent
*
)
event
);
if
(
!
item
)
return
FALSE
;
while
(
!
gtk_type_is_a
(
GTK_WIDGET_TYPE
(
item
),
gtk_list_item_get_type
()))
while
(
item
&&
!
GTK_IS_LIST_ITEM
(
item
))
item
=
item
->
parent
;
if
(
!
item
||
(
item
->
parent
!=
widget
))
return
FALSE
;
gtk_list_select_child
(
list
,
item
);
return
FALSE
;
...
...
gtk/gtkmenu.c
View file @
34e324ca
...
...
@@ -279,6 +279,9 @@ gtk_menu_popup (GtkMenu *menu,
guint
button
,
guint32
activate_time
)
{
GtkWidget
*
xgrab_shell
;
GtkWidget
*
parent
;
g_return_if_fail
(
menu
!=
NULL
);
g_return_if_fail
(
GTK_IS_MENU
(
menu
));
...
...
@@ -292,6 +295,41 @@ gtk_menu_popup (GtkMenu *menu,
GTK_MENU_SHELL
(
menu
)
->
activate_time
=
activate_time
;
gtk_widget_show
(
GTK_WIDGET
(
menu
));
/* Find the last viewable ancestor, and make an X grab on it
*/
parent
=
GTK_WIDGET
(
menu
);
xgrab_shell
=
NULL
;
while
(
parent
)
{
gboolean
viewable
=
TRUE
;
GtkWidget
*
tmp
=
parent
;
while
(
tmp
)
{
if
(
!
GTK_WIDGET_MAPPED
(
tmp
))
{
viewable
=
FALSE
;
break
;
}
tmp
=
tmp
->
parent
;
}
if
(
viewable
)
xgrab_shell
=
parent
;
parent
=
GTK_MENU_SHELL
(
parent
)
->
parent_menu_shell
;
}
if
(
xgrab_shell
&&
(
!
GTK_MENU_SHELL
(
xgrab_shell
)
->
have_xgrab
))
{
GTK_MENU_SHELL
(
xgrab_shell
)
->
have_xgrab
=
(
gdk_pointer_grab
(
xgrab_shell
->
window
,
TRUE
,
GDK_BUTTON_PRESS_MASK
|
GDK_BUTTON_RELEASE_MASK
|
GDK_ENTER_NOTIFY_MASK
|
GDK_LEAVE_NOTIFY_MASK
,
NULL
,
NULL
,
activate_time
)
==
0
);
}
gtk_grab_add
(
GTK_WIDGET
(
menu
));
}
...
...
@@ -315,7 +353,11 @@ gtk_menu_popdown (GtkMenu *menu)
menu_shell
->
active_menu_item
=
NULL
;
}
/* The X Grab, if present, will automatically be removed when we hide
* the window */
gtk_widget_hide
(
GTK_WIDGET
(
menu
));
menu_shell
->
have_xgrab
=
FALSE
;
gtk_grab_remove
(
GTK_WIDGET
(
menu
));
}
...
...
gtk/gtkmenushell.c
View file @
34e324ca
...
...
@@ -53,6 +53,8 @@ static void gtk_menu_shell_foreach (GtkContainer *container,
static
void
gtk_real_menu_shell_deactivate
(
GtkMenuShell
*
menu_shell
);
static
gint
gtk_menu_shell_is_item
(
GtkMenuShell
*
menu_shell
,
GtkWidget
*
child
);
static
GtkWidget
*
gtk_menu_shell_get_item
(
GtkMenuShell
*
menu_shell
,
GdkEvent
*
event
);
static
GtkContainerClass
*
parent_class
=
NULL
;
...
...
@@ -302,14 +304,11 @@ gtk_menu_shell_button_press (GtkWidget *widget,
menu_shell
->
active
=
TRUE
;
}
menu_shell
->
button
=
event
->
button
;
menu_item
=
gtk_get_event_widget
((
GdkEvent
*
)
event
);
if
(
!
GTK_WIDGET_IS_SENSITIVE
(
menu_item
))
return
TRUE
;
menu_item
=
gtk_menu_shell_get_item
(
menu_shell
,
(
GdkEvent
*
)
event
);
if
(
menu_item
&&
GTK_IS_MENU_ITEM
(
menu_item
)
&&
gtk_menu_shell_is_item
(
menu_shell
,
menu_item
))
if
(
menu_item
&&
GTK_WIDGET_IS_SENSITIVE
(
menu_item
))
{
if
((
menu_item
->
parent
==
widget
)
&&
(
menu_item
!=
menu_shell
->
active_menu_item
))
...
...
@@ -358,16 +357,13 @@ gtk_menu_shell_button_release (GtkWidget *widget,
}
menu_shell
->
button
=
0
;
menu_item
=
gtk_get_event_widget
((
GdkEvent
*
)
event
);
if
(
!
GTK_WIDGET_IS_SENSITIVE
(
menu_item
))
return
TRUE
;
menu_item
=
gtk_menu_shell_get_item
(
menu_shell
,
(
GdkEvent
*
)
event
);
deactivate
=
TRUE
;
if
((
event
->
time
-
menu_shell
->
activate_time
)
>
MENU_SHELL_TIMEOUT
)
{
if
(
menu_shell
->
active_menu_item
==
menu_item
)
if
(
menu_item
&&
(
menu_shell
->
active_menu_item
==
menu_item
)
)
{
if
(
GTK_MENU_ITEM
(
menu_item
)
->
submenu
==
NULL
)
{
...
...
@@ -385,15 +381,14 @@ gtk_menu_shell_button_release (GtkWidget *widget,
}
else
deactivate
=
FALSE
;
if
((
!
deactivate
||
(
menu_shell
->
active_menu_item
==
menu_item
))
&&
(
gdk_pointer_grab
(
widget
->
window
,
TRUE
,
GDK_BUTTON_PRESS_MASK
|
GDK_BUTTON_RELEASE_MASK
|
GDK_ENTER_NOTIFY_MASK
|
GDK_LEAVE_NOTIFY_MASK
,
NULL
,
NULL
,
event
->
time
)
==
0
))
/* If the button click was very fast, or we ended up on a submenu,
* leave the menu up
*/
if
(
!
deactivate
||
(
menu_item
&&
(
menu_shell
->
active_menu_item
==
menu_item
)
))
{
deactivate
=
FALSE
;
menu_shell
->
have_xgrab
=
TRUE
;
menu_shell
->
ignore_leave
=
TRUE
;
}
else
...
...
@@ -607,3 +602,21 @@ gtk_menu_shell_is_item (GtkMenuShell *menu_shell,
return
FALSE
;
}
static
GtkWidget
*
gtk_menu_shell_get_item
(
GtkMenuShell
*
menu_shell
,
GdkEvent
*
event
)
{
GtkWidget
*
menu_item
;
menu_item
=
gtk_get_event_widget
((
GdkEvent
*
)
event
);
while
(
menu_item
&&
!
GTK_IS_MENU_ITEM
(
menu_item
))
menu_item
=
menu_item
->
parent
;
if
(
menu_item
&&
gtk_menu_shell_is_item
(
menu_shell
,
menu_item
))
return
menu_item
;
else
return
NULL
;
}
gtk/gtktext.c
View file @
34e324ca
...
...
@@ -497,6 +497,7 @@ gtk_text_init (GtkText *text)
text
->
tab_stops
=
g_list_prepend
(
text
->
tab_stops
,
(
void
*
)
8
);
text
->
line_wrap
=
TRUE
;
text
->
word_wrap
=
FALSE
;
text
->
timer
=
0
;
text
->
button
=
0
;
...
...
gtk/gtktree.c
View file @
34e324ca
...
...
@@ -299,9 +299,12 @@ gtk_tree_button_press (GtkWidget *widget,
tree
=
GTK_TREE
(
widget
);
item
=
gtk_get_event_widget
((
GdkEvent
*
)
event
);
while
(
!
gtk_type_is_a
(
GTK_WIDGET_TYPE
(
item
),
gtk_tree_item_get_type
()
))
while
(
item
&&
!
GTK_IS_TREE_ITEM
(
item
))
item
=
item
->
parent
;
if
(
!
item
||
(
item
->
parent
!=
widget
))
return
FALSE
;
switch
(
event
->
button
)
{
case
1
:
...
...
gtk/gtkviewport.c
View file @
34e324ca
...
...
@@ -391,6 +391,7 @@ gtk_viewport_draw (GtkWidget *widget,
GtkBin
*
bin
;
GdkRectangle
tmp_area
;
GdkRectangle
child_area
;
gint
border_width
;
g_return_if_fail
(
widget
!=
NULL
);
g_return_if_fail
(
GTK_IS_VIEWPORT
(
widget
));
...
...
@@ -401,13 +402,18 @@ gtk_viewport_draw (GtkWidget *widget,
viewport
=
GTK_VIEWPORT
(
widget
);
bin
=
GTK_BIN
(
widget
);
gtk_viewport_paint
(
widget
,
area
);
border_width
=
GTK_CONTAINER
(
widget
)
->
border_width
;
tmp_area
=
*
area
;
tmp_area
.
x
-=
border_width
;
tmp_area
.
y
-=
border_width
;
gtk_viewport_paint
(
widget
,
&
tmp_area
);
if
(
bin
->
child
)
{
tmp_area
=
*
area
;
tmp_area
.
x
+=
viewport
->
hadjustment
->
value
;
tmp_area
.
y
+=
viewport
->
vadjustment
->
value
;
tmp_area
.
x
+=
viewport
->
hadjustment
->
value
-
widget
->
style
->
klass
->
xthickness
;
tmp_area
.
y
+=
viewport
->
vadjustment
->
value
-
widget
->
style
->
klass
->
ythickness
;
if
(
gtk_widget_intersect
(
bin
->
child
,
&
tmp_area
,
&
child_area
))
gtk_widget_draw
(
bin
->
child
,
&
child_area
);
...
...
@@ -508,6 +514,7 @@ gtk_viewport_size_allocate (GtkWidget *widget,
GtkBin
*
bin
;
GtkAllocation
child_allocation
;
gint
hval
,
vval
;
gint
border_width
;
g_return_if_fail
(
widget
!=
NULL
);
g_return_if_fail
(
GTK_IS_VIEWPORT
(
widget
));
...
...
@@ -517,6 +524,8 @@ gtk_viewport_size_allocate (GtkWidget *widget,
viewport
=
GTK_VIEWPORT
(
widget
);
bin
=
GTK_BIN
(
widget
);
border_width
=
GTK_CONTAINER
(
widget
)
->
border_width
;
child_allocation
.
x
=
0
;
child_allocation
.
y
=
0
;
...
...
@@ -526,16 +535,16 @@ gtk_viewport_size_allocate (GtkWidget *widget,
child_allocation
.
y
=
GTK_WIDGET
(
viewport
)
->
style
->
klass
->
ythickness
;
}
child_allocation
.
width
=
allocation
->
width
-
child_allocation
.
x
*
2
;
child_allocation
.
height
=
allocation
->
height
-
child_allocation
.
y
*
2
;
child_allocation
.
width
=
allocation
->
width
-
child_allocation
.
x
*
2
-
border_width
*
2
;
child_allocation
.
height
=
allocation
->
height
-
child_allocation
.
y
*
2
-
border_width
*
2
;
if
(
GTK_WIDGET_REALIZED
(
widget
))
{
gdk_window_move_resize
(
widget
->
window
,
allocation
->
x
+
GTK_CONTAINER
(
viewport
)
->
border_width
,
allocation
->
y
+
GTK_CONTAINER
(
viewport
)
->
border_width
,
allocation
->
width
-
GTK_CONTAINER
(
viewport
)
->
border_width
*
2
,
allocation
->
height
-
GTK_CONTAINER
(
viewport
)
->
border_width
*
2
);
allocation
->
x
+
border_width
,
allocation
->
y
+
border_width
,
allocation
->
width
-
border_width
*
2
,
allocation
->
height
-
border_width
*
2
);
gdk_window_move_resize
(
viewport
->
view_window
,
child_allocation
.
x
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment