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

Dependent fullscreen mode #450

Open
slideray opened this issue May 19, 2021 · 0 comments
Open

Dependent fullscreen mode #450

slideray opened this issue May 19, 2021 · 0 comments

Comments

@slideray
Copy link

slideray commented May 19, 2021

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;
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant