Commit 433efe12 authored by Darin Adler's avatar Darin Adler

Fixed bug 334 (Need proper hit detection when hit-testing icons.

	* libnautilus/nautilus-icon-canvas-item.c: (hit_test_pixbuf):
	Fixed a typo-type error where we were checking every pixel of the
	pixbuf instead of only the pixels that we were hit testing against.

	* libnautilus/nautilus-icon-container.c: Tweaks.
parent daff2271
2000-03-22 Darin Adler <darin@eazel.com>
Fixed bug 334 (Need proper hit detection when hit-testing icons.
* libnautilus/nautilus-icon-canvas-item.c: (hit_test_pixbuf):
Fixed a typo-type error where we were checking every pixel of the
pixbuf instead of only the pixels that we were hit testing against.
* libnautilus/nautilus-icon-container.c: Tweaks.
2000-03-22 John Sullivan <sullivan@eazel.com>
Fixed bug 308 (Straighten out the new_window situation
......@@ -23,12 +33,8 @@
* src/file-manager/fm-directory-view.c:
Simplified all users of Nautilus_NavigationRequestInfo to match.
* components/music/main.c: Added a #include to kill
warning about gnome_vfs_init being undefined.
2000-03-21 John Sullivan <sullivan@eazel.com>
......
......@@ -1071,7 +1071,7 @@ hit_test_pixbuf (GdkPixbuf *pixbuf, const ArtIRect *pixbuf_location, const ArtIR
int x, y;
guint8 *pixel;
/* You can get here without a pixbuf in some strage cases. */
/* You can get here without a pixbuf in some strange cases. */
if (pixbuf == NULL) {
return FALSE;
}
......@@ -1097,8 +1097,8 @@ hit_test_pixbuf (GdkPixbuf *pixbuf, const ArtIRect *pixbuf_location, const ArtIR
g_assert (gdk_pixbuf_get_n_channels (pixbuf) == 4);
/* Check the alpha channel of the pixel to see if we have a hit. */
for (x = pixbuf_rect.x0; x < pixbuf_rect.x1; x++) {
for (y = pixbuf_rect.y0; y < pixbuf_rect.y1; y++) {
for (x = relative_rect.x0; x < relative_rect.x1; x++) {
for (y = relative_rect.y0; y < relative_rect.y1; y++) {
pixel = gdk_pixbuf_get_pixels (pixbuf)
+ y * gdk_pixbuf_get_rowstride (pixbuf)
+ x * 4;
......
......@@ -574,7 +574,7 @@ request_idle (NautilusIconContainer *container)
static gboolean
button_event_modifies_selection (GdkEventButton *event)
{
return event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK);
return (event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK)) != 0;
}
static gboolean
......@@ -1148,13 +1148,13 @@ keyboard_move_to (NautilusIconContainer *container,
return;
}
if ((event->state & GDK_CONTROL_MASK) == 0) {
if ((event->state & GDK_CONTROL_MASK) != 0) {
/* Select icons and get rid of the special keyboard focus. */
clear_keyboard_focus (container);
if (select_one_unselect_others (container, icon)) {
gtk_signal_emit (GTK_OBJECT (container),
signals[SELECTION_CHANGED]);
}
clear_keyboard_focus (container);
} else {
/* Move the keyboard focus. */
set_keyboard_focus (container, icon);
......@@ -1318,7 +1318,7 @@ keyboard_space (NautilusIconContainer *container,
{
/* Control-space toggles the selection state of the current icon. */
if (container->details->keyboard_focus != NULL &&
(event->state & GDK_CONTROL_MASK) == GDK_CONTROL_MASK) {
(event->state & GDK_CONTROL_MASK) != 0) {
icon_toggle_selected (container, container->details->keyboard_focus);
gtk_signal_emit (GTK_OBJECT (container), signals[SELECTION_CHANGED]);
}
......
......@@ -1071,7 +1071,7 @@ hit_test_pixbuf (GdkPixbuf *pixbuf, const ArtIRect *pixbuf_location, const ArtIR
int x, y;
guint8 *pixel;
/* You can get here without a pixbuf in some strage cases. */
/* You can get here without a pixbuf in some strange cases. */
if (pixbuf == NULL) {
return FALSE;
}
......@@ -1097,8 +1097,8 @@ hit_test_pixbuf (GdkPixbuf *pixbuf, const ArtIRect *pixbuf_location, const ArtIR
g_assert (gdk_pixbuf_get_n_channels (pixbuf) == 4);
/* Check the alpha channel of the pixel to see if we have a hit. */
for (x = pixbuf_rect.x0; x < pixbuf_rect.x1; x++) {
for (y = pixbuf_rect.y0; y < pixbuf_rect.y1; y++) {
for (x = relative_rect.x0; x < relative_rect.x1; x++) {
for (y = relative_rect.y0; y < relative_rect.y1; y++) {
pixel = gdk_pixbuf_get_pixels (pixbuf)
+ y * gdk_pixbuf_get_rowstride (pixbuf)
+ x * 4;
......
......@@ -574,7 +574,7 @@ request_idle (NautilusIconContainer *container)
static gboolean
button_event_modifies_selection (GdkEventButton *event)
{
return event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK);
return (event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK)) != 0;
}
static gboolean
......@@ -1148,13 +1148,13 @@ keyboard_move_to (NautilusIconContainer *container,
return;
}
if ((event->state & GDK_CONTROL_MASK) == 0) {
if ((event->state & GDK_CONTROL_MASK) != 0) {
/* Select icons and get rid of the special keyboard focus. */
clear_keyboard_focus (container);
if (select_one_unselect_others (container, icon)) {
gtk_signal_emit (GTK_OBJECT (container),
signals[SELECTION_CHANGED]);
}
clear_keyboard_focus (container);
} else {
/* Move the keyboard focus. */
set_keyboard_focus (container, icon);
......@@ -1318,7 +1318,7 @@ keyboard_space (NautilusIconContainer *container,
{
/* Control-space toggles the selection state of the current icon. */
if (container->details->keyboard_focus != NULL &&
(event->state & GDK_CONTROL_MASK) == GDK_CONTROL_MASK) {
(event->state & GDK_CONTROL_MASK) != 0) {
icon_toggle_selected (container, container->details->keyboard_focus);
gtk_signal_emit (GTK_OBJECT (container), signals[SELECTION_CHANGED]);
}
......
......@@ -1071,7 +1071,7 @@ hit_test_pixbuf (GdkPixbuf *pixbuf, const ArtIRect *pixbuf_location, const ArtIR
int x, y;
guint8 *pixel;
/* You can get here without a pixbuf in some strage cases. */
/* You can get here without a pixbuf in some strange cases. */
if (pixbuf == NULL) {
return FALSE;
}
......@@ -1097,8 +1097,8 @@ hit_test_pixbuf (GdkPixbuf *pixbuf, const ArtIRect *pixbuf_location, const ArtIR
g_assert (gdk_pixbuf_get_n_channels (pixbuf) == 4);
/* Check the alpha channel of the pixel to see if we have a hit. */
for (x = pixbuf_rect.x0; x < pixbuf_rect.x1; x++) {
for (y = pixbuf_rect.y0; y < pixbuf_rect.y1; y++) {
for (x = relative_rect.x0; x < relative_rect.x1; x++) {
for (y = relative_rect.y0; y < relative_rect.y1; y++) {
pixel = gdk_pixbuf_get_pixels (pixbuf)
+ y * gdk_pixbuf_get_rowstride (pixbuf)
+ x * 4;
......
......@@ -574,7 +574,7 @@ request_idle (NautilusIconContainer *container)
static gboolean
button_event_modifies_selection (GdkEventButton *event)
{
return event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK);
return (event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK)) != 0;
}
static gboolean
......@@ -1148,13 +1148,13 @@ keyboard_move_to (NautilusIconContainer *container,
return;
}
if ((event->state & GDK_CONTROL_MASK) == 0) {
if ((event->state & GDK_CONTROL_MASK) != 0) {
/* Select icons and get rid of the special keyboard focus. */
clear_keyboard_focus (container);
if (select_one_unselect_others (container, icon)) {
gtk_signal_emit (GTK_OBJECT (container),
signals[SELECTION_CHANGED]);
}
clear_keyboard_focus (container);
} else {
/* Move the keyboard focus. */
set_keyboard_focus (container, icon);
......@@ -1318,7 +1318,7 @@ keyboard_space (NautilusIconContainer *container,
{
/* Control-space toggles the selection state of the current icon. */
if (container->details->keyboard_focus != NULL &&
(event->state & GDK_CONTROL_MASK) == GDK_CONTROL_MASK) {
(event->state & GDK_CONTROL_MASK) != 0) {
icon_toggle_selected (container, container->details->keyboard_focus);
gtk_signal_emit (GTK_OBJECT (container), signals[SELECTION_CHANGED]);
}
......
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