From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1UzW6R-0002j5-N5 for mharc-grub-devel@gnu.org; Wed, 17 Jul 2013 14:05:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42763) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UzW6L-0002Qh-1F for grub-devel@gnu.org; Wed, 17 Jul 2013 14:05:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UzW6H-0001bR-ST for grub-devel@gnu.org; Wed, 17 Jul 2013 14:05:20 -0400 Received: from collab.rosalab.ru ([195.19.76.181]:39823) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UzW6H-0001Sn-CV for grub-devel@gnu.org; Wed, 17 Jul 2013 14:05:17 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by collab.rosalab.ru (Postfix) with ESMTP id 35B9A29C230 for ; Wed, 17 Jul 2013 22:05:13 +0400 (MSK) X-Virus-Scanned: amavisd-new at rosalab.ru Received: from collab.rosalab.ru ([127.0.0.1]) by localhost (collab.rosalab.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Gmz-wnsMa3q5 for ; Wed, 17 Jul 2013 22:05:12 +0400 (MSK) Received: from icedphoenix.localnet (unknown [217.199.216.178]) by collab.rosalab.ru (Postfix) with ESMTPSA id 7156129C22F for ; Wed, 17 Jul 2013 22:05:12 +0400 (MSK) From: Vladimir Testov To: grub-devel@gnu.org Subject: [PATCH] [5/?] grub-core/gfxmenu/gui_list.c - print scrollbar in separate viewport Date: Wed, 17 Jul 2013 22:05:11 +0400 Message-ID: <76340047.CLFMpyTXpM@icedphoenix> User-Agent: KMail/4.10.4 (Linux/3.8.0-26-generic; KDE/4.10.4; x86_64; ; ) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart1973456.xHZ1rKLb6c" Content-Transfer-Encoding: 7Bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 195.19.76.181 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jul 2013 18:05:26 -0000 This is a multi-part message in MIME format. --nextPart1973456.xHZ1rKLb6c Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Changelog entry: grub-core/gfxmenu/gui_list.c: print scrollbar in separate viewport Print the scrollbar in the separate viewport. Patch makes it clear where exactly the scrollbar will be drawn. Also it simplifies the drawing of the scrollbar. scrollbar thumb and frame processing has been fixed. Now we can use any kind of styled box for thumb and frame. scrollbar_width is total width of the scrollbar backward compatibility is contained -- With best regards, _______________________________ Vladimir Testov, ROSA Laboratory. www.rosalab.ru --nextPart1973456.xHZ1rKLb6c Content-Disposition: attachment; filename="grub-list-scrollbar-print-in-viewport.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="grub-list-scrollbar-print-in-viewport.patch" diff -Naur grub-new4/grub-core/gfxmenu/gui_list.c grub-new5/grub-core/gfxmenu/gui_list.c --- grub-new4/grub-core/gfxmenu/gui_list.c 2013-07-15 16:36:34.544169956 +0400 +++ grub-new5/grub-core/gfxmenu/gui_list.c 2013-07-17 18:57:56.597740755 +0400 @@ -211,7 +211,7 @@ static void draw_scrollbar (list_impl_t self, int value, int extent, int min, int max, - int rightx, int topy, int height) + int scrollbar_width, int scrollbar_height) { grub_gfxmenu_box_t frame = self->scrollbar_frame; grub_gfxmenu_box_t thumb = self->scrollbar_thumb; @@ -219,21 +219,23 @@ + frame->get_bottom_pad (frame)); int frame_horizontal_pad = (frame->get_left_pad (frame) + frame->get_right_pad (frame)); - int tracktop = topy + frame->get_top_pad (frame); - int tracklen = height - frame_vertical_pad; - frame->set_content_size (frame, self->scrollbar_width, tracklen); + int thumb_vertical_pad = (thumb->get_top_pad (thumb) + + thumb->get_bottom_pad (thumb)); + int thumb_horizontal_pad = (thumb->get_left_pad (thumb) + + thumb->get_right_pad (thumb)); + int tracktop = frame->get_top_pad (frame); + int tracklen = scrollbar_height - frame_vertical_pad; + frame->set_content_size (frame, + scrollbar_width - frame_horizontal_pad, + tracklen); int thumby = tracktop + tracklen * (value - min) / (max - min); int thumbheight = tracklen * extent / (max - min) + 1; thumb->set_content_size (thumb, - self->scrollbar_width - frame_horizontal_pad, - thumbheight - (thumb->get_top_pad (thumb) - + thumb->get_bottom_pad (thumb))); - frame->draw (frame, - rightx - (self->scrollbar_width + frame_horizontal_pad), - topy); - thumb->draw (thumb, - rightx - (self->scrollbar_width - frame->get_right_pad (frame)), - thumby); + scrollbar_width - frame_horizontal_pad + - thumb_horizontal_pad, + thumbheight - thumb_vertical_pad); + frame->draw (frame, 0, 0); + thumb->draw (thumb, frame->get_left_pad (frame), thumby); } /* Draw the list of items. */ @@ -390,13 +392,19 @@ grub_gui_restore_viewport (&vpsave2); if (drawing_scrollbar) - draw_scrollbar (self, - self->first_shown_index, num_shown_items, - 0, self->view->menu->size, - self->bounds.width - box_right_pad - + self->scrollbar_width, - box_top_pad, - self->bounds.height - box_top_pad - box_bottom_pad); + { + /* Draw the scrollbar in the east slice. */ + content_rect.x = self->bounds.width - box_right_pad; + content_rect.width = box_right_pad; + + grub_gui_set_viewport (&content_rect, &vpsave2); + draw_scrollbar (self, + self->first_shown_index, num_shown_items, + 0, self->view->menu->size, + self->scrollbar_width, + content_rect.height); + grub_gui_restore_viewport (&vpsave2); + } } grub_gui_restore_viewport (&vpsave); --nextPart1973456.xHZ1rKLb6c--