diff options
author | Matt Ebb <matt@mke3.net> | 2010-05-10 12:57:58 +0400 |
---|---|---|
committer | Matt Ebb <matt@mke3.net> | 2010-05-10 12:57:58 +0400 |
commit | 6321838cce95d5dc117d15b4794028271313bdc5 (patch) | |
tree | 973f07a27e0eacdb3e669e1ed31cbb16ca941ee5 /source/blender/editors/space_file/file_ops.c | |
parent | 6a74c16af7a6f7c5cadb9d057fe97afc416d0b85 (diff) |
Tweak for elubie, scroll main file selector window immediately when newly added
folder is out of view.
Diffstat (limited to 'source/blender/editors/space_file/file_ops.c')
-rw-r--r-- | source/blender/editors/space_file/file_ops.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index bd8443dd029..ccecbd61663 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -749,8 +749,9 @@ int file_next_exec(bContext *C, wmOperator *unused) /* only meant for timer usage */ static int file_smoothscroll_invoke(bContext *C, wmOperator *op, wmEvent *event) { + ScrArea *sa = CTX_wm_area(C); SpaceFile *sfile= CTX_wm_space_file(C); - ARegion *ar= CTX_wm_region(C); + ARegion *ar, *oldar= CTX_wm_region(C); int numfiles, offset; int edit_idx = 0; int numfiles_layout; @@ -780,6 +781,7 @@ static int file_smoothscroll_invoke(bContext *C, wmOperator *op, wmEvent *event) } /* we need the correct area for scrolling */ + ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW); if (!ar || ar->regiontype != RGN_TYPE_WINDOW) { WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), sfile->smoothscroll_timer); sfile->smoothscroll_timer=NULL; @@ -809,6 +811,10 @@ static int file_smoothscroll_invoke(bContext *C, wmOperator *op, wmEvent *event) return OPERATOR_FINISHED; } + /* temporarily set context to the main window region, + * so the scroll operators work */ + CTX_wm_region_set(C, ar); + /* scroll one step in the desired direction */ if (sfile->scroll_offset < offset) { if (sfile->layout->flag & FILE_LAYOUT_HOR) { @@ -827,6 +833,9 @@ static int file_smoothscroll_invoke(bContext *C, wmOperator *op, wmEvent *event) ED_region_tag_redraw(CTX_wm_region(C)); + /* and restore context */ + CTX_wm_region_set(C, oldar); + return OPERATOR_FINISHED; } |