Received: from list by lists.gnu.org with archive (Exim 4.71) id 1Uzqa5-00048K-VB for mharc-grub-devel@gnu.org; Thu, 18 Jul 2013 11:57:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45346) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uzqa1-00046Y-8M for grub-devel@gnu.org; Thu, 18 Jul 2013 11:57:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UzqZy-0007VQ-Ow for grub-devel@gnu.org; Thu, 18 Jul 2013 11:57:21 -0400 Received: from collab.rosalab.ru ([195.19.76.181]:52628) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UzqZy-0007Ua-7R for grub-devel@gnu.org; Thu, 18 Jul 2013 11:57:18 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by collab.rosalab.ru (Postfix) with ESMTP id 336C329C234 for ; Thu, 18 Jul 2013 19:57:16 +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 8JSaI9XgLkBu for ; Thu, 18 Jul 2013 19:57:15 +0400 (MSK) Received: from icedphoenix.localnet (unknown [217.199.216.178]) by collab.rosalab.ru (Postfix) with ESMTPSA id 7165829C1AA for ; Thu, 18 Jul 2013 19:57:15 +0400 (MSK) From: Vladimir Testov To: grub-devel@gnu.org Subject: [PATCH] [7/?] grub-core/gfxmenu/gui_list.c - scrollbar thumb offsets Date: Thu, 18 Jul 2013 19:57:14 +0400 Message-ID: <29239602.0j2IXQlNj4@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="nextPart11549679.DIpBuyrX2j" 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: Thu, 18 Jul 2013 15:57:24 -0000 This is a multi-part message in MIME format. --nextPart11549679.DIpBuyrX2j Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" New options scrollbar_thumb_top_offset scrollbar_thumb_bottom_offset With these two options we can make scrollbar thumb with round edges so it will fit to the scrollbar frame. See screenshots. offset is a number of pixels to indent from the edge of the center slice of the scrollbar's frame. positive value means we move to the bottom negative value means we move to the top in the example given (see screenshots) scrollbar_thumb_top_offset = -5 scrollbar_thumb_bottom_offset = 5 Sanity checks are present. -- With best regards, _______________________________ Vladimir Testov, ROSA Laboratory. www.rosalab.ru --nextPart11549679.DIpBuyrX2j Content-Disposition: attachment; filename="before-scrollbar-thumb-offset.png" Content-Transfer-Encoding: base64 Content-Type: image/png; name="before-scrollbar-thumb-offset.png" iVBORw0KGgoAAAANSUhEUgAAAF4AAABeCAYAAACq0qNuAAAABmJLR0QA/wD/AP+gvaeTAAAACXBI WXMAAA7EAAAOxAGVKw4bAAAAB3RJTUUH3QcSDzICImaUNQAAAflJREFUeNrtnMFtwjAYRj9H6RRd oKMwQw+xpQ7BONi+dYgwD0sQ91JURBBBKLWT+D0pB0guPH6+fHEizLeUBNlpUFCG9owDJh7xgHjE A+IRD4inxwMTj3hAPOIRD4ivCPPBjZA/GZJs1+k9RiY+J9Zadc4pSf++If4XZ62sczJkfH7pnFw3 Ll2SWmftJoV2T3yuGEIR6ZLUbrahGKPg/cNjQozFxFcTNT4EhQw18WnxOapT6e0QgpKkISX5GCeP P2fYmhom/ZqU0iImv926+KWWh82KD96Ppv3eCRjxc1/+OzdZKePEF4P4F5kSS52ssU5u9gKqaUbN ZimNZtNRk4bh/vtp+vbDmYmfv8dfsp2oKfFrSAnxWfLeGPnjUb7vObnmlH7oexljZJpmMfKrmfir F4jPweFmwi+xg/ic0/7gvew9fqsP1VzW1qf2p0I9vv3c74tVuhij3k6nGhttuaiJMSoUXB2scskg hCA/cSOaiUf6+sUj/SpqcuYs0gtn/G2tW1qdHLiAIuMB8YgHxCMeEE+PXx083kHUAOIRD4hHPCCe Hv8Y1uOBqEE8IB7xgPhV18mcTwunAnUyvbCfZWGiBhCPeED8GlsNT/Ay8XVNPArGsCxM1MDsUfO1 22GBiUc8IB7xMOfJlX/vGMN6PFEDiEc8IB7x8Cw/KFEYWcbNKR8AAAAASUVORK5CYII= --nextPart11549679.DIpBuyrX2j Content-Disposition: attachment; filename="after-scrollbar-thumb-offset.png" Content-Transfer-Encoding: base64 Content-Type: image/png; name="after-scrollbar-thumb-offset.png" iVBORw0KGgoAAAANSUhEUgAAAF4AAABeCAYAAACq0qNuAAAABmJLR0QA/wD/AP+gvaeTAAAACXBI WXMAAA7EAAAOxAGVKw4bAAAAB3RJTUUH3QcSDzITSNa0xwAAAdlJREFUeNrtnEFugzAUBR+InqIX 6DHaXc7QBbbUQ+Q49feuN8slgrtp1DRUIYqIDWZGYhU2mXw9P4yV5ktKguy0KChDd8QBE494QDzi AfGIB8TT44GJRzwgHvGIB8RviOaFFyG/MiS5vtdzjEx8Tpxz6r1Xkh5+If4H75yc92rI+PzSWVwr ly5JnXeuSqH9Dd8rmhWRLkldtQ2laWQhXL3HYiwmfjNRE8xkGWrizeJzVKfS16eZkqQhJYUYJ+8/ ZrjaLUz6OSmlRUx+V7v4pZaHasVbCKNp/28BRvzcj//eT1bKOPHDIP5OpsRSJzPw5r1eF5T31Ypv 2vaP9FOmL0V+tVGThuHuBfXIxM8TMZcsYeo3uTtZskZuWjyLK+IB8YiHh/b4Wg/VnPbWpz5PhXp8 977flxGTkmKMejociJqcxBhlBXcHN7llYGYKEy+imXikr1880s+iJmfOIr1wxl/WuqXVyYEHKDIe EI94QDziAfH0+NXB8Q6iBhCPeEA84gHx9PjrsB8PRA3iAfGIB8Svuk7mPC2cCtTJdMfnbAsTNYB4 xAPi19hqOMHLxG9r4lEwhm1hogZmj5qP3Q4LTDziAfGIhzkXV/69Ywz78UQNIB7xgHjEw618A7Ty /UpdrrYCAAAAAElFTkSuQmCC --nextPart11549679.DIpBuyrX2j Content-Disposition: attachment; filename="grub-list-scrollbar-thumb-offset.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="grub-list-scrollbar-thumb-offset.patch" diff -Naur grub-new6/grub-core/gfxmenu/gui_list.c grub-new7/grub-core/gfxmenu/gui_list.c --- grub-new6/grub-core/gfxmenu/gui_list.c 2013-07-17 20:07:37.664064169 +0400 +++ grub-new7/grub-core/gfxmenu/gui_list.c 2013-07-18 17:50:44.251123544 +0400 @@ -56,6 +56,8 @@ char *scrollbar_thumb_pattern; grub_gfxmenu_box_t scrollbar_frame; grub_gfxmenu_box_t scrollbar_thumb; + int scrollbar_thumb_top_offset; + int scrollbar_thumb_bottom_offset; int scrollbar_width; int first_shown_index; @@ -149,22 +151,26 @@ self->need_to_recreate_scrollbar = 0; + /* Sanity checks. */ if (self->scrollbar_frame != 0 && self->scrollbar_thumb != 0) { grub_gfxmenu_box_t box = self->menu_box; grub_gfxmenu_box_t frame = self->scrollbar_frame; grub_gfxmenu_box_t thumb = self->scrollbar_thumb; - int box_vertical_pad = (box->get_top_pad (box) - + box->get_bottom_pad (box)); + + int box_top_pad = box->get_top_pad (box); + int box_bottom_pad = box->get_bottom_pad (box); + int box_vertical_pad = box_top_pad + box_bottom_pad; + int frame_top_pad = frame->get_top_pad (frame); + int frame_bottom_pad = frame->get_bottom_pad (frame); + int frame_vertical_pad = frame_top_pad + frame_bottom_pad; int frame_horizontal_pad = (frame->get_left_pad (frame) + frame->get_right_pad (frame)); - int frame_vertical_pad = (frame->get_top_pad (frame) - + frame->get_bottom_pad (frame)); + 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 thumb_vertical_pad = (thumb->get_top_pad (thumb) - + thumb->get_bottom_pad (thumb)); int scrollbar_height = self->bounds.height - box_vertical_pad; if (self->scrollbar_width < frame_horizontal_pad @@ -174,6 +180,22 @@ self->draw_scrollbar = 0; return 0; } + + /* Check offsets. */ + /* Offset from the top of the scrollbar viewport. */ + int thumb_top = frame_top_pad + + self->scrollbar_thumb_top_offset; + /* Offset from the bottom of the scrollbar viewport. */ + int thumb_bottom = - frame_bottom_pad + + self->scrollbar_thumb_bottom_offset; + + int real_height = scrollbar_height - thumb_top + thumb_bottom; + if (thumb_top < 0 || thumb_bottom > 0 + || real_height < thumb_vertical_pad) + { + self->scrollbar_thumb_top_offset = 0; + self->scrollbar_thumb_bottom_offset = 0; + } } } @@ -250,11 +272,13 @@ + 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 tracktop = frame->get_top_pad (frame) + self->scrollbar_thumb_top_offset; int tracklen = scrollbar_height - frame_vertical_pad; frame->set_content_size (frame, scrollbar_width - frame_horizontal_pad, tracklen); + tracklen += - self->scrollbar_thumb_top_offset + + self->scrollbar_thumb_bottom_offset; int thumby; int thumbheight = tracklen * extent / (max - min) + 1; if (thumbheight >= thumb_vertical_pad) @@ -619,6 +643,16 @@ grub_free (self->scrollbar_thumb_pattern); self->scrollbar_thumb_pattern = value ? grub_strdup (value) : 0; } + else if (grub_strcmp (name, "scrollbar_thumb_top_offset") == 0) + { + self->need_to_recreate_scrollbar = 1; + self->scrollbar_thumb_top_offset = grub_strtol (value, 0, 10); + } + else if (grub_strcmp (name, "scrollbar_thumb_bottom_offset") == 0) + { + self->need_to_recreate_scrollbar = 1; + self->scrollbar_thumb_bottom_offset = grub_strtol (value, 0, 10); + } else if (grub_strcmp (name, "scrollbar_width") == 0) { self->scrollbar_width = grub_strtoul (value, 0, 10); @@ -727,6 +761,8 @@ self->scrollbar_thumb = 0; self->scrollbar_frame_pattern = 0; self->scrollbar_thumb_pattern = 0; + self->scrollbar_thumb_top_offset = 0; + self->scrollbar_thumb_bottom_offset = 0; self->scrollbar_width = 16; self->first_shown_index = 0; --nextPart11549679.DIpBuyrX2j--