aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorJP Rosevear <jpr@ximian.com>2003-05-16 22:55:37 +0800
committerJP Rosevear <jpr@src.gnome.org>2003-05-16 22:55:37 +0800
commit0873f0f22e444543392653523c75dd1f9713d7d3 (patch)
tree670f266ddb842c7858dd78b9885b5bba4033f0e2 /calendar
parent58c259ace11ebb84e898749e9b47c32e59e206cf (diff)
downloadgsoc2013-evolution-0873f0f22e444543392653523c75dd1f9713d7d3.tar
gsoc2013-evolution-0873f0f22e444543392653523c75dd1f9713d7d3.tar.gz
gsoc2013-evolution-0873f0f22e444543392653523c75dd1f9713d7d3.tar.bz2
gsoc2013-evolution-0873f0f22e444543392653523c75dd1f9713d7d3.tar.lz
gsoc2013-evolution-0873f0f22e444543392653523c75dd1f9713d7d3.tar.xz
gsoc2013-evolution-0873f0f22e444543392653523c75dd1f9713d7d3.tar.zst
gsoc2013-evolution-0873f0f22e444543392653523c75dd1f9713d7d3.zip
Fixes #41935
2003-05-15 JP Rosevear <jpr@ximian.com> Fixes #41935 * gui/e-week-view.c (e_week_view_init): listen for scroll events on the canvas (e_week_view_on_button_press): don't scroll here (e_week_view_on_scroll): scroll here * gui/e-day-view.c (e_day_view_init): listen for scroll events on the time and main canvases (e_day_view_on_main_canvas_button_press): don't scroll here (e_day_view_on_main_canvas_scroll): scroll here (e_day_view_on_time_canvas_scroll): and here svn path=/trunk/; revision=21210
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog15
-rw-r--r--calendar/gui/e-day-view.c74
-rw-r--r--calendar/gui/e-week-view.c44
3 files changed, 85 insertions, 48 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 005dd97098..ef9f894152 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,5 +1,20 @@
2003-05-15 JP Rosevear <jpr@ximian.com>
+ Fixes #41935
+
+ * gui/e-week-view.c (e_week_view_init): listen for scroll events
+ on the canvas
+ (e_week_view_on_button_press): don't scroll here
+ (e_week_view_on_scroll): scroll here
+
+ * gui/e-day-view.c (e_day_view_init): listen for scroll events on
+ the time and main canvases
+ (e_day_view_on_main_canvas_button_press): don't scroll here
+ (e_day_view_on_main_canvas_scroll): scroll here
+ (e_day_view_on_time_canvas_scroll): and here
+
+2003-05-15 JP Rosevear <jpr@ximian.com>
+
Fixes #43029
* gui/e-week-view.c (e_week_view_init): don't listen for destroy
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index 6764085741..f6aba9eede 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -188,10 +188,13 @@ static gboolean e_day_view_on_main_canvas_button_press (GtkWidget *widget,
static gboolean e_day_view_on_main_canvas_button_release (GtkWidget *widget,
GdkEventButton *event,
EDayView *day_view);
+static gboolean e_day_view_on_main_canvas_scroll (GtkWidget *widget,
+ GdkEventScroll *scroll,
+ EDayView *day_view);
-static gboolean e_day_view_on_time_canvas_button_press (GtkWidget *widget,
- GdkEventButton *event,
- EDayView *day_view);
+static gboolean e_day_view_on_time_canvas_scroll (GtkWidget *widget,
+ GdkEventScroll *scroll,
+ EDayView *day_view);
static void e_day_view_update_calendar_selection_time (EDayView *day_view);
static gboolean e_day_view_on_main_canvas_motion (GtkWidget *widget,
@@ -448,10 +451,6 @@ static time_t e_day_view_find_work_week_start (EDayView *day_view,
time_t start_time);
static void e_day_view_recalc_work_week (EDayView *day_view);
static void e_day_view_recalc_work_week_days_shown (EDayView *day_view);
-static gboolean e_day_view_set_event_font_cb (EDayView *day_view,
- gint day,
- gint event_num,
- gpointer data);
static void selection_clear_event (GtkWidget *invisible,
GdkEventSelection *event,
@@ -696,6 +695,10 @@ e_day_view_init (EDayView *day_view)
G_CALLBACK (e_day_view_on_main_canvas_button_release),
day_view);
g_signal_connect_after (day_view->main_canvas,
+ "scroll_event",
+ G_CALLBACK (e_day_view_on_main_canvas_scroll),
+ day_view);
+ g_signal_connect_after (day_view->main_canvas,
"motion_notify_event",
G_CALLBACK (e_day_view_on_main_canvas_motion),
day_view);
@@ -791,8 +794,8 @@ e_day_view_init (EDayView *day_view)
0, 1, 1, 2,
GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_widget_show (day_view->time_canvas);
- g_signal_connect_after (day_view->time_canvas, "button_press_event",
- G_CALLBACK (e_day_view_on_time_canvas_button_press), day_view);
+ g_signal_connect_after (day_view->time_canvas, "scroll_event",
+ G_CALLBACK (e_day_view_on_time_canvas_scroll), day_view);
canvas_group = GNOME_CANVAS_GROUP (GNOME_CANVAS (day_view->time_canvas)->root);
@@ -3129,18 +3132,6 @@ e_day_view_on_main_canvas_button_press (GtkWidget *widget,
g_print ("In e_day_view_on_main_canvas_button_press\n");
#endif
- /* Handle scroll wheel events */
- if (event->button == 4) {
- /* The wheel has been moved up, so scroll the canvas down. */
- e_day_view_scroll (day_view, E_DAY_VIEW_WHEEL_MOUSE_STEP_SIZE);
- return TRUE;
- }
- if (event->button == 5) {
- /* The wheel has been moved down, so scroll the canvas up. */
- e_day_view_scroll (day_view, -E_DAY_VIEW_WHEEL_MOUSE_STEP_SIZE);
- return TRUE;
- }
-
/* Convert the coords to the main canvas window, or return if the
window is not found. */
if (!e_day_view_convert_event_coords (day_view, (GdkEvent*) event,
@@ -3204,24 +3195,39 @@ e_day_view_on_main_canvas_button_press (GtkWidget *widget,
return TRUE;
}
-
static gboolean
-e_day_view_on_time_canvas_button_press (GtkWidget *widget,
- GdkEventButton *event,
- EDayView *day_view)
+e_day_view_on_main_canvas_scroll (GtkWidget *widget,
+ GdkEventScroll *scroll,
+ EDayView *day_view)
{
- /* Handle scroll wheel events */
- if (event->button == 4 || event->button == 5) {
- GtkAdjustment *adj = GTK_LAYOUT (day_view->main_canvas)->vadjustment;
- gfloat new_value;
+ switch (scroll->direction) {
+ case GDK_SCROLL_UP:
+ e_day_view_scroll (day_view, E_DAY_VIEW_WHEEL_MOUSE_STEP_SIZE);
+ return TRUE;
+ case GDK_SCROLL_DOWN:
+ e_day_view_scroll (day_view, -E_DAY_VIEW_WHEEL_MOUSE_STEP_SIZE);
+ return TRUE;
+ default:
+ }
- new_value = adj->value + ((event->button == 4) ?
- -adj->page_increment / 2:
- adj->page_increment / 2);
- new_value = CLAMP (new_value, adj->lower, adj->upper - adj->page_size);
- gtk_adjustment_set_value (adj, new_value);
+ return FALSE;
+}
+
+static gboolean
+e_day_view_on_time_canvas_scroll (GtkWidget *widget,
+ GdkEventScroll *scroll,
+ EDayView *day_view)
+{
+
+ switch (scroll->direction) {
+ case GDK_SCROLL_UP:
+ e_day_view_scroll (day_view, E_DAY_VIEW_WHEEL_MOUSE_STEP_SIZE);
+ return TRUE;
+ case GDK_SCROLL_DOWN:
+ e_day_view_scroll (day_view, -E_DAY_VIEW_WHEEL_MOUSE_STEP_SIZE);
return TRUE;
+ default:
}
return FALSE;
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index 2e83b2c6c7..5a7ea363c6 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -122,6 +122,9 @@ static gboolean e_week_view_on_button_press (GtkWidget *widget,
static gboolean e_week_view_on_button_release (GtkWidget *widget,
GdkEventButton *event,
EWeekView *week_view);
+static gboolean e_week_view_on_scroll (GtkWidget *widget,
+ GdkEventScroll *scroll,
+ EWeekView *week_view);
static gboolean e_week_view_on_motion (GtkWidget *widget,
GdkEventMotion *event,
EWeekView *week_view);
@@ -383,6 +386,8 @@ e_week_view_init (EWeekView *week_view)
G_CALLBACK (e_week_view_on_button_press), week_view);
g_signal_connect_after (week_view->main_canvas, "button_release_event",
G_CALLBACK (e_week_view_on_button_release), week_view);
+ g_signal_connect_after (week_view->main_canvas, "scroll_event",
+ G_CALLBACK (e_week_view_on_scroll), week_view);
g_signal_connect_after (week_view->main_canvas, "motion_notify_event",
G_CALLBACK (e_week_view_on_motion), week_view);
@@ -2213,20 +2218,6 @@ e_week_view_on_button_press (GtkWidget *widget,
g_print (" item is pressed\n");
#endif
- /* Handle scroll wheel events */
- if (event->button == 4 || event->button == 5) {
- GtkAdjustment *adj = GTK_RANGE (week_view->vscrollbar)->adjustment;
- gfloat new_value;
-
- new_value = adj->value + ((event->button == 4) ?
- -adj->page_increment:
- adj->page_increment);
- new_value = CLAMP (new_value, adj->lower, adj->upper - adj->page_size);
- gtk_adjustment_set_value (adj, new_value);
-
- return TRUE;
- }
-
/* Convert the mouse position to a week & day. */
x = event->x;
y = event->y;
@@ -2303,6 +2294,31 @@ e_week_view_on_button_release (GtkWidget *widget,
return FALSE;
}
+static gboolean
+e_week_view_on_scroll (GtkWidget *widget,
+ GdkEventScroll *scroll,
+ EWeekView *week_view)
+{
+ GtkAdjustment *adj = GTK_RANGE (week_view->vscrollbar)->adjustment;
+ gfloat new_value;
+
+ switch (scroll->direction){
+ case GDK_SCROLL_UP:
+ new_value = adj->value - adj->page_increment;
+ break;
+ case GDK_SCROLL_DOWN:
+ new_value = adj->value + adj->page_increment;
+ break;
+ default:
+ return FALSE;
+ }
+
+ new_value = CLAMP (new_value, adj->lower, adj->upper - adj->page_size);
+ gtk_adjustment_set_value (adj, new_value);
+
+ return TRUE;
+}
+
static gboolean
e_week_view_on_motion (GtkWidget *widget,