Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Evergreen:11.2
petitboot
petitboot-reorder-devices.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File petitboot-reorder-devices.patch of Package petitboot
--- src/petitboot-gui.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) --- a/src/petitboot-gui.c +++ b/src/petitboot-gui.c @@ -1411,11 +1411,13 @@ static void pboot_create_spane(void) twin_window_queue_paint(pboot_spane->window); } +static int sem = 1; static void pboot_add_device(const struct pb_device *device) { pboot_device_t *dev; int devindex; + /* sanity checks */ if (pboot_dev_count >= PBOOT_MAX_DEV) return; @@ -1437,16 +1439,62 @@ static void pboot_add_device(const struc dev->id = malloc(strlen(device->devname) + 1); strcpy(dev->id, device->devname); + /* only one at a time here */ + while (sem <= 0) + usleep(100000); + sem--; + + /* order devices lexicographically - ascending */ + pb_log("XXX pboot_add_device device=%s\n", device->devname); + for (devindex = 0; devindex < pboot_dev_count; devindex++) { + int ret; + pb_log("XXX devindex=%d pboot_dev_count=%d\n", devindex, pboot_dev_count); + if (pboot_devices[devindex] == NULL) { + break; + } + if (*pboot_devices[devindex]->id != '/') + continue; + + ret = strcasecmp(pboot_devices[devindex]->id, dev->id); + /* ret < 0 : try next + * ret > 0 : insert before current entry + */ + if (ret < 0) { + pb_log("XXX pboot_devices[devindex]->id=%s dev->id=%s, ret=%d -> continue\n", pboot_devices[devindex]->id, dev->id, ret); + continue; + } else { + int counter; + pb_log("XXX moving devices\n"); + + for (counter = pboot_dev_count; counter >= devindex; counter--) { + pb_log("XXX counter=%d\n", counter); + pboot_devices[counter] = pboot_devices[counter-1]; + pboot_devices[counter]->box.top += PBOOT_LEFT_ICON_STRIDE; + } + break; + } + pb_log("XXX move done\n"); + } + sem++; + dev->badge = get_icon(device->icon_file, device->type); dev->box.left = PBOOT_LEFT_ICON_XOFF; dev->box.right = dev->box.left + PBOOT_LEFT_ICON_WIDTH; dev->box.top = PBOOT_LEFT_ICON_YOFF + - PBOOT_LEFT_ICON_STRIDE * pboot_dev_count; + PBOOT_LEFT_ICON_STRIDE * devindex; + //dev->box.top = PBOOT_LEFT_ICON_YOFF + + // PBOOT_LEFT_ICON_STRIDE * pboot_dev_count; dev->box.bottom = dev->box.top + PBOOT_LEFT_ICON_HEIGHT; pboot_devices[devindex] = dev; pboot_dev_count++; + /* redraw lpane */ + twin_window_damage(pboot_lpane->window, + 0, 0, + PBOOT_LEFT_PANE_SIZE, pboot_screen->height); + twin_window_queue_paint(pboot_lpane->window); + twin_window_damage(pboot_lpane->window, dev->box.left, dev->box.top, dev->box.right, dev->box.bottom);
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor