Index: source/blender/editors/interface/interface_panel.c
===================================================================
--- source/blender/editors/interface/interface_panel.c	(revision 25101)
+++ source/blender/editors/interface/interface_panel.c	(working copy)
@@ -509,8 +509,14 @@
 	headrect= *rect;
 	headrect.ymin= headrect.ymax;
 	headrect.ymax= headrect.ymin + floor(PNL_HEADER/block->aspect + 0.001f);
-	
-	if(!(panel->runtime_flag & PNL_FIRST)) {
+
+	if(panel->control & UI_PNL_SOLID) uiSetRoundBox(15);
+	else uiSetRoundBox(3);
+	UI_ThemeColor(TH_PANEL);
+	if(!(panel->flag & PNL_CLOSEDX) && !(panel->flag & PNL_CLOSEDY))
+		uiRoundBox(0.5f + rect->xmin + 2, 0.5f + rect->ymin, 0.5f + rect->xmax - 2, 0.5f + headrect.ymax+1, 8);
+
+	if(!(panel->runtime_flag & PNL_FIRST) /* || "panels are horizontal" */) {
 		float minx= rect->xmin+5.0f/block->aspect;
 		float maxx= rect->xmax-5.0f/block->aspect;
 		float y= headrect.ymax;
@@ -1023,7 +1029,7 @@
 	ARegion *ar= CTX_wm_region(C);
 	uiBlock *block;
 	Panel *pa;
-	int retval, mx, my, inside_header= 0, inside_scale= 0, inside;
+	int retval, mx, my, inside_header= 0, inside_scale= 0, inside, numkey = 0, panelnum;
 
 	retval= WM_UI_HANDLER_CONTINUE;
 
@@ -1031,7 +1037,21 @@
 	if(ui_button_is_active(ar))
 		return retval;
 
-	for(block=ar->uiblocks.last; block; block=block->prev) {
+	/* Open/close up to first 20 panels with num keys
+	   a la menu 1 ... 9 0 then alt+1 ... alt+9 alt+0 (byGSR) */
+	if(event->val == KM_PRESS) {
+		/* Assume type values are defined consecutive in order 0 1 ... 9 like ASCII */
+		if ((event->type >= ONEKEY) && (event->type <= NINEKEY))
+			numkey = event->type - ZEROKEY;
+		else if (event->type == ZEROKEY)
+			numkey = 10;
+
+		if(event->alt)
+			numkey += 10;
+	}
+
+	for(block=ar->uiblocks.last, panelnum = 1; block; block=block->prev, panelnum++) {
+
 		mx= event->x;
 		my= event->y;
 		ui_window_to_block(ar, block, &mx, &my);
@@ -1045,6 +1065,12 @@
 		if(pa->type && pa->type->flag & PNL_NO_HEADER) // XXX - accessed freed panels when scripts reload, need to fix.
 			continue;
 
+		/* Open or close via num keys, by faking clicks */
+		if ((numkey > 0) && (event->val == KM_PRESS) && (panelnum == numkey)) {
+			ui_handle_panel_header(C, block, block->minx+10+PNL_ICON+2, block->maxy);
+			break;
+		}
+
 		if(block->minx <= mx && block->maxx >= mx)
 			if(block->miny <= my && block->maxy+PNL_HEADER >= my)
 				inside= 1;
