Skip to content
This repository was archived by the owner on Jan 16, 2023. It is now read-only.

Dependent fullscreen mode #450

@slideray

Description

@slideray

I'm trying to implement the ability to switch modes depending on the state of the window.

The idea is that the image (MODE_IMAGE) should always be viewed in a full-screen state. And the thumbnail view mode (MODE_THUMB) should always be non-fullscreen.

I do not know the language, I tried to think logically and here is what the function turned out to be:

bool cg_switch_mode_fullscreen(arg_t _)
{

  if (mode == MODE_IMAGE) {
    if (tns.thumbs == NULL)
      tns_init(&tns, files, &filecnt, &fileidx, &win);
    img_close(&img, false);
    reset_timeout(reset_cursor);
    if (img.ss.on) {
      img.ss.on = false;
      reset_timeout(slideshow);
    }
    if (ATOM__NET_WM_STATE_FULLSCREEN == false)
    tns.dirty = true;
    mode = MODE_THUMB;
  }

  if (mode == MODE_IMAGE) {
    if (tns.thumbs == NULL)
      tns_init(&tns, files, &filecnt, &fileidx, &win);
    img_close(&img, false);
    reset_timeout(reset_cursor);
    if (img.ss.on) {
      img.ss.on = false;
      reset_timeout(slideshow);
    }
    if (ATOM__NET_WM_STATE_FULLSCREEN == true)
    tns.dirty = true;
    mode = MODE_THUMB;
    win_toggle_fullscreen(&win);
  }

  if (mode == MODE_THUMB) {
    if (ATOM__NET_WM_STATE_FULLSCREEN == true)
    load_image(fileidx);
    mode = MODE_IMAGE;
  }

  else {
    if (ATOM__NET_WM_STATE_FULLSCREEN == false)
      load_image(fileidx);
    mode = MODE_IMAGE;
    win_toggle_fullscreen(&win);
  }

  return true;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions